From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WELfr-00088v-37 for qemu-devel@nongnu.org; Fri, 14 Feb 2014 11:31:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WELfj-0001y7-Ps for qemu-devel@nongnu.org; Fri, 14 Feb 2014 11:31:35 -0500 Received: from cantor2.suse.de ([195.135.220.15]:49317 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WELfj-0001xz-JZ for qemu-devel@nongnu.org; Fri, 14 Feb 2014 11:31:27 -0500 Message-ID: <52FE44DB.8030408@suse.de> Date: Fri, 14 Feb 2014 17:31:23 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <52FE3D0E.8070904@redhat.com> In-Reply-To: <52FE3D0E.8070904@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Trying to write a new device / virtio-i2c ? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Alex David , qemu-devel@nongnu.org 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 tryi= ng >> to write something like a "virtio-i2c" : I wrote a virtio-i2c module f= or >> my kernel (I used some examples from virtio-pci and virtio-console), i= t >> seems that it created a "i2c-1" device in /dev, >> >> My device that I launch with QEMU (-chardev >> socket,path=3D/tmp/test0,server,nowait,id=3Dbob -device >> virtio-i2c,chardev=3Dbob) doesn't seem to be recognized by the kernel >> driver : my probe function doesn't run. >=20 > i2c is a bus, not directly a device. Do you want to pass an entire > adapter down to the guest? Or just a slave? >=20 > 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 lik= e >=20 > -object i2c-linux,file=3D/dev/i2c-1,id=3Di2c-backend > -device i2c-host,backend=3Di2c-backend,hostaddr=3D0x40,address=3D0x= 40 > -device i2c-host,backend=3Di2c-backend,hostaddr=3D0x50,address=3D0x= 50 >=20 > 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 device= s. Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg