Re: [PATCH v13 02/22] vfio: VFIO based driver for Mediated devices
From: Kirti Wankhede
Date: Wed Nov 16 2016 - 10:07:48 EST
On 11/16/2016 7:59 AM, Dong Jia Shi wrote:
> * Kirti Wankhede <kwankhede@xxxxxxxxxx> [2016-11-15 20:59:45 +0530]:
>
> Hi Kirti,
>
>> vfio_mdev driver registers with mdev core driver.
>> mdev core driver creates mediated device and calls probe routine of
>> vfio_mdev driver for each device.
>> Probe routine of vfio_mdev driver adds mediated device to VFIO core module
>>
>> This driver forms a shim layer that pass through VFIO devices operations
>> to vendor driver for mediated devices.
>>
>> Signed-off-by: Kirti Wankhede <kwankhede@xxxxxxxxxx>
>> Signed-off-by: Neo Jia <cjia@xxxxxxxxxx>
>> Reviewed-by: Jike Song <jike.song@xxxxxxxxx>
>>
>> Change-Id: I583f4734752971d3d112324d69e2508c88f359ec
>> ---
>> drivers/vfio/mdev/Kconfig | 7 ++
>> drivers/vfio/mdev/Makefile | 1 +
>> drivers/vfio/mdev/mdev_core.c | 16 ++++-
>> drivers/vfio/mdev/vfio_mdev.c | 148 ++++++++++++++++++++++++++++++++++++++++++
>> 4 files changed, 171 insertions(+), 1 deletion(-)
>> create mode 100644 drivers/vfio/mdev/vfio_mdev.c
>>
>> diff --git a/drivers/vfio/mdev/Kconfig b/drivers/vfio/mdev/Kconfig
>> index 258481d65ebd..1aa0391d74f2 100644
>> --- a/drivers/vfio/mdev/Kconfig
>> +++ b/drivers/vfio/mdev/Kconfig
>> @@ -7,3 +7,10 @@ config VFIO_MDEV
>> Provides a framework to virtualize devices.
>>
>> If you don't know what do here, say N.
>> +
>> +config VFIO_MDEV_DEVICE
>> + tristate "VFIO support for Mediated devices"
> ^^^^^^^^^^^^^^^^
>
>> + depends on VFIO && VFIO_MDEV
>> + default n
>> + help
>> + VFIO based driver for mediated devices.
> ^^^^^^^^^^^^^^^^
> nit:
> s/mediated/Mediated/
>
> I saw in many places you use the term "Mediated device", so I guess this
> is what you preferred to name them.
>
>> diff --git a/drivers/vfio/mdev/Makefile b/drivers/vfio/mdev/Makefile
>> index 31bc04801d94..fa2d5ea466ee 100644
>> --- a/drivers/vfio/mdev/Makefile
>> +++ b/drivers/vfio/mdev/Makefile
>> @@ -2,3 +2,4 @@
>> mdev-y := mdev_core.o mdev_sysfs.o mdev_driver.o
>>
>> obj-$(CONFIG_VFIO_MDEV) += mdev.o
>> +obj-$(CONFIG_VFIO_MDEV_DEVICE) += vfio_mdev.o
>> diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
>> index 613e8a8a3b2a..1e0714ebc56a 100644
>> --- a/drivers/vfio/mdev/mdev_core.c
>> +++ b/drivers/vfio/mdev/mdev_core.c
>> @@ -354,7 +354,21 @@ int mdev_device_remove(struct device *dev, bool force_remove)
>>
>> static int __init mdev_init(void)
>> {
>> - return mdev_bus_register();
>> + int ret;
>> +
>> + ret = mdev_bus_register();
>> + if (ret) {
>> + pr_err("Failed to register mdev bus\n");
> If you want to report an error message here, you should do it in a
> previous patch where you introduce the call for mdev_bus_register.
>
Removing this error message.
>> + return ret;
>> + }
>> +
>> + /*
>> + * Attempt to load known vfio_mdev. This gives us a working environment
>> + * without the user needing to explicitly load vfio_mdev driver.
>> + */
>> + request_module_nowait("vfio_mdev");
>> +
>> + return ret;
>> }
>>
>> static void __exit mdev_exit(void)
> [...]
>
> Please:
> Reviewed-by: Dong Jia Shi <bjsdjshi@xxxxxxxxxxxxxxxxxx>
>
Thanks.