From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFKvA-0007EF-Hb for qemu-devel@nongnu.org; Mon, 17 Feb 2014 04:55:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFKv1-0008JU-P5 for qemu-devel@nongnu.org; Mon, 17 Feb 2014 04:55:28 -0500 Received: from mail-qa0-x22d.google.com ([2607:f8b0:400d:c00::22d]:55196) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFKv1-0008JO-Ka for qemu-devel@nongnu.org; Mon, 17 Feb 2014 04:55:19 -0500 Received: by mail-qa0-f45.google.com with SMTP id m5so8259944qaj.32 for ; Mon, 17 Feb 2014 01:55:19 -0800 (PST) Sender: Paolo Bonzini Message-ID: <5301DC83.6030307@redhat.com> Date: Mon, 17 Feb 2014 10:55:15 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <52FE3D0E.8070904@redhat.com> <52FE44DB.8030408@suse.de> <52FE4820.8050009@redhat.com> <5301D40F.2010506@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex David , qemu-devel@nongnu.org Il 17/02/2014 10:38, Alex David ha scritto: > > From an upstream point of view, a host passthrough device pair (one > object talking to /dev/i2c-N on the host, and one device per sensor > talking to the other object) would be the best. > > > i2c-N is on the guest, that's why I want to virtualize an i2c hardware > on QEMU. My idea was getting the data on a socket on the host => read > these data from my daemon. That's why virtio-serial seemed like a good > thing to use / adapt as i2c. > > I'll look on the parallel solution, I don't think there's a > virtio-parallel, right ? You do not need to use virtio at all costs. Paravirtualization is just where existing hardware doesn't have the required performance or feature set. If you don't use paravirtualization, you have the big advantage of not having to write a guest driver! You have not answered my question. Are you emulating a bunch of sensors/actuators? Or do the sensors/actuators physically exist in the host? So far I assumed the latter. If that is not correct, and you just need to emulate a temperature sensor or something like that, there is already an I2C bus in the guest. If you do "modprobe i2c-dev" in the guest you'll see it. Just use "-device" and QEMU will attach the emulated sensor to that bus. Something like USB-I2C is only needed if you need more than one I2C bus (e.g. because of two devices with the same address). And parallel port I2C is probably useless for anything except passing through a host /dev/i2c-N to the guest. Paolo