[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ? |
Date: |
Mon, 17 Feb 2014 11:38:34 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
Il 17/02/2014 11:01, Alex David ha scritto:
I indeed don't use paravirtualization.
Virtio _is_ paravirtualization. :)
I'm emulating a bunch of sensors/actuators.
If I virtualize my sensors and attach them to the i2c-dev with -device,
how do I get those data on the host then ?
It depends on your use case.
It could be that you can make them return a constant value.
Otherwise, you may want to use a chardev for that purpose, or finally a
QOM (QEMU Object Model) property. For example, add
CONFIG_TMP105=y
to default-configs/x86_64-softmmu.mak before building QEMU, then do the
following (indented = in the guest):
$ x86_64-softmmu/qemu-system-x86_64 --enable-kvm ~/test2.img -m 256 \
-device tmp105,id=sensor,address=0x50 \
-qmp unix:$HOME/qmp.sock,server,nowait
$ qmp/qom-list -s ~/qmp.sock /machine/peripheral/sensor
temperature
@parent_bus/
address
hotpluggable
realized
type
$ scripts/qmp/qmp-shell ~/qmp.sock
(QEMU) qom-get path=/machine/peripheral/sensor property=temperature
{u'return': 0}
(QEMU) qom-get path=sensor property=address
{u'return': 80}
# modprobe i2c-dev
# i2cget -y 0 0x50 0 w
0x0000
(QEMU) qom-set path=sensor property=temperature value=20000
{u'return': {}}
# i2cget -y 0 0x50 0 w
0x0014
For this particular sensor, you have to swap the two bytes and the
result is 8.8 fixed-point.
Paolo
Thanks for your help. As you may see, I'm not that experienced in
QEMU/Linux kernel.
- [Qemu-devel] Trying to write a new device / virtio-i2c ?, Alex David, 2014/02/13
- Re: [Qemu-devel] Trying to write a new device / virtio-i2c ?, Stefan Hajnoczi, 2014/02/14
- Re: [Qemu-devel] Trying to write a new device / virtio-i2c ?, Paolo Bonzini, 2014/02/14
- Re: [Qemu-devel] Trying to write a new device / virtio-i2c ?, Andreas Färber, 2014/02/14
- Re: [Qemu-devel] Trying to write a new device / virtio-i2c ?, Paolo Bonzini, 2014/02/14
- Re: [Qemu-devel] Trying to write a new device / virtio-i2c ?, Alex David, 2014/02/17
- Re: [Qemu-devel] Trying to write a new device / virtio-i2c ?, Paolo Bonzini, 2014/02/17
- Message not available
- [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?, Alex David, 2014/02/17
- Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?, Paolo Bonzini, 2014/02/17
- Message not available
- Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?,
Paolo Bonzini <=
- Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?, Alex David, 2014/02/17
- Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?, Alex David, 2014/02/17
- Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?, Paolo Bonzini, 2014/02/17
- Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?, Alex David, 2014/02/17
- Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?, Paolo Bonzini, 2014/02/17
- Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?, Alex David, 2014/02/17
- Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?, Paolo Bonzini, 2014/02/17
- Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?, Alex David, 2014/02/18
- Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?, Paolo Bonzini, 2014/02/18
- Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?, Alex David, 2014/02/18