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

Re: [PATCH V5 1/6] libxl: Add support for Virtio I2C device



Hi Viresh,

Jumping in the conversation.

On 07/09/2022 13:32, Viresh Kumar wrote:
I don't have much knowledge of the Xen code and wanted this code for I2C and
GPIO to be tested on Xen for the work we are doing around hypervisor agnostic
backends [1].

I started looking for a simple device's implementation and began by (blindly)
copying code from Keyboard device and so much of wasted code in here, which
isn't really required.

On 06-09-22, 17:15, Anthony PERARD wrote:
On Mon, Aug 22, 2022 at 02:45:13PM +0530, Viresh Kumar wrote:
An example of domain configuration for Virtio I2c:
i2c = [ "" ]

Is this doing something meaningful (with the whole series applied)?

If I am not wrong, this is required by parse_i2c_list()'s implementation.
Without this I don't get the I2C device populated in the guest.

Is there another way to achieve it ?

Looking at this series, you will add ~250 lines (assuming your new patch) for the i2c and then likely the same amount for GPIO.

I am assuming that for every new virtio device (e.g. gps, sound, display...), we would also need to 250 lines of code. I am worry that we will end up to bloat libxl with duplicated code and or for device that are barely used.

I think it would be better to find a generic way to add new virtio device without adding code (very limited) in libxl. The advantage is someone will be able to create a new virtio device with less effort.

The approach I can think of is something along the lines:

virtio = ["type=<compatible>,transport=<transport>,..."]

where the compatible is the one that should be written in the DT and transport is mmio or pci. the [...] refers to specific parameters that would need to be passed to the backend (it is not clear how you provide them today?).

AFAICT, the GPIO one may need some tweaking because it requires specific properties. I think it would be more acceptable as this will be only a few lines (compare to 250 lines today).

Cheers,

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.