Re: [PATCH] i2c: virtio: add a virtio i2c frontend driver
From: Jie Deng <hidden>
Date: 2020-09-04 05:29:07
Also in:
linux-i2c, lkml
On 2020/9/3 17:58, Michael S. Tsirkin wrote:
On Thu, Sep 03, 2020 at 01:34:45PM +0800, Jie Deng wrote:quoted
Add an I2C bus driver for virtio para-virtualization. The controller can be emulated by the backend driver in any device model software by following the virtio protocol. This driver communicates with the backend driver through a virtio I2C message structure which includes following parts: - Header: i2c_msg addr, flags, len. - Data buffer: the pointer to the i2c msg data. - Status: the processing result from the backend. People may implement different backend drivers to emulate different controllers according to their needs. A backend example can be found in the device model of the open source project ACRN. For more information, please refer to https://projectacrn.org. The virtio device ID 34 is used for this I2C adpter since IDs before 34 have been reserved by other virtio devices.Please reserve the ID with the virtio tc so no one conflicts.
Sure. I will send a patch to request the ID.
+
+/**
+ * struct virtio_i2c_hdr - the virtio I2C message header structure
+ * @addr: i2c_msg addr, the slave address
+ * @flags: i2c_msg flags
+ * @len: i2c_msg len
+ */
+struct virtio_i2c_hdr {
+ __virtio16 addr;
+ __virtio16 flags;
+ __virtio16 len;
+} __packed;
virtio16 is for legacy devices, modern ones should be __le.
and we don't really need to pack it I think.Right. I will fix these. Thanks. _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization