qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Virtual I2C adapter and I2C external simulator


From: Rahul Govind
Subject: [Qemu-devel] Virtual I2C adapter and I2C external simulator
Date: Thu, 13 Jun 2019 10:53:16 -0700

Hi Everyone,

I'm working on a project that involves building on top of existing QEMU
work, and I'm trying to virtualize I2C devices that are shared between
multiple VMs. I've been reading QEMU documentation and source code to get a
better idea of how to add something like this to QEMU (since it doesn't
look like something similar is already present) but I'm not sure how to
proceed. I do have a few ideas and I would be grateful if anyone could give
me feedback on them or suggestions for alternative solutions.

More specifically, I wish to virtualize a couple of devices that sit on the
I2C bus. However, directly virtualizing the devices doesn't seem feasible
since there are many other devices like multiplexers on the way to these
devices. Also, what we need is to handle is just reads/write/ioctls on
/dev/i2c-N.

I was wondering if there is a way to create a device that
- 1) Emulates an I2C adapter, say /dev/i2c-0.
- 2) Handles any reads/writes/ioctls sent to /dev/i2c-0, reformats any
ioctls as IO, and then sends this to a simulator on the host.

This approach is just based on the ipmi interface and ipmi-bmc-extern
device already present in QEMU, where ipmi-bmc-extern can communicate
through a chardev with a simulator running on the host. Having a simulator
on the host would be nice to have since it lets us write the simulator in a
higher level language, and as previously mentioned, we have a few cases
where multiple VMs share the same I2C device. However, I'm not sure if this
even makes sense in the case of I2C.

If this approach doesn't make sense, what method would you recommend to
have virtual I2C devices which are shared between multiple VMs?

Any suggestions or guidance is much appreciated!

Thanks in advance.

Sincerely,
Rahul Govind.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]