qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Alex David <alex.daerf@gmail.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Trying to write a new device / virtio-i2c ?
Date: Fri, 14 Feb 2014 17:31:23 +0100	[thread overview]
Message-ID: <52FE44DB.8030408@suse.de> (raw)
In-Reply-To: <52FE3D0E.8070904@redhat.com>

Am 14.02.2014 16:58, schrieb Paolo Bonzini:
> Il 13/02/2014 14:26, Alex David ha scritto:
>> After reading code, documentation and available things, I've been trying
>> to write something like a "virtio-i2c" : I wrote a virtio-i2c module for
>> my kernel (I used some examples from virtio-pci and virtio-console), it
>> seems that it created a "i2c-1" device in /dev,
>>
>> My device that I launch with QEMU (-chardev
>> socket,path=/tmp/test0,server,nowait,id=bob -device
>> virtio-i2c,chardev=bob) doesn't seem to be recognized by the kernel
>> driver : my probe function doesn't run.
> 
> i2c is a bus, not directly a device.  Do you want to pass an entire
> adapter down to the guest?  Or just a slave?
> 
> QEMU has i2c emulation but it is bus-based, so you need one device per
> slave + 1 for the adapter. x86 already has an I2C bus (actually it's
> SMBus) that you may be able to use.  So you probably want something like
> 
>     -object i2c-linux,file=/dev/i2c-1,id=i2c-backend
>     -device i2c-host,backend=i2c-backend,hostaddr=0x40,address=0x40
>     -device i2c-host,backend=i2c-backend,hostaddr=0x50,address=0x50
> 
> and so on.  i2c-linux would be the object issuing ioctls to /dev/i2c-1,
> multiplexing access to the device for all the i2c-host devices.

While that is certainly possible in case host passthrough was desired,
maybe virtio was mixed up with VFIO? For now I believe it is PCI-only
and there was work on platform devices at KVM Forum 2013; for s390x a
ccw backend may be needed, so maybe it's possible to extend vfio for I2C?

If however it's just about QEMU reading data from a daemon on the host,
a simple slave device might do and is then independent of host I2C devices.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2014-02-14 16:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13 13:26 [Qemu-devel] Trying to write a new device / virtio-i2c ? Alex David
2014-02-14 15:26 ` Stefan Hajnoczi
2014-02-14 15:58 ` Paolo Bonzini
2014-02-14 16:31   ` Andreas Färber [this message]
2014-02-14 16:45     ` Paolo Bonzini
2014-02-17  8:35       ` Alex David
2014-02-17  9:19         ` Paolo Bonzini
     [not found]           ` <CAA17Vo9E9D-jPa3gwhsui3i=APz1FM-41jbK+zpOm2tWf7swdw@mail.gmail.com>
2014-02-17  9:38             ` [Qemu-devel] Fwd: " Alex David
2014-02-17  9:55               ` Paolo Bonzini
     [not found]                 ` <CAA17Vo_cBCbKkqDu2zQ0DW2FoAyVqxVXGtNGArJ1tnk6N9AUqA@mail.gmail.com>
2014-02-17 10:38                   ` Paolo Bonzini
2014-02-17 12:23                     ` Alex David
2014-02-17 13:11                       ` Alex David
2014-02-17 13:19                         ` Paolo Bonzini
2014-02-17 13:32                           ` Alex David
2014-02-17 14:30                             ` Paolo Bonzini
2014-02-17 15:33                               ` Alex David
2014-02-17 16:11                                 ` Paolo Bonzini
2014-02-18 12:48                                   ` Alex David
2014-02-18 13:05                                     ` Paolo Bonzini
2014-02-18 13:44                                       ` Alex David
2014-02-18 13:47                                         ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52FE44DB.8030408@suse.de \
    --to=afaerber@suse.de \
    --cc=alex.daerf@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).