How can we create a virtio platform device?

280 Views Asked by At

I am writing a virtio driver for a device that is seen in the original driver as a platform device, that is the parent of a character device in the device tree.

In the tutorials that I followed, The virtio drivers are always done for "regular" character devices.

I wanted to create my virtio driver for it to expose a fake platform device as a parent of a "regular" character device.

My question is this one: Should I detect my virtual device in the regular way using the probe function and then create my platform device inside of it or is there a recommended way or order to create both (the platform device and the character device (child))?

1

There are 1 best solutions below

0
On BEST ANSWER

When we get the virtio device and trigger the associated probe, we can then register a platform driver and then add some platform devices correponding to your needs.

And your device will appear as a platform device instead of a virtio_device in the guest OS.