vfio_pci: wrap pci device as a mediated device
Subsystems (2)
v3 cover vfio_pci: wrap pci device as a mediated device
This patchset aims to add a vfio-pci-like meta driver as a demo user of the vfio changes introduced in "vfio/mdev: IOMMU aware mediated device" patchset from Baolu Lu.
Previous RFC v1 has given two proposals and the discussion could be found in following link. Per the comments, this patchset adds a separate driver named vfio-mdev-pci. It is a sample driver, but loactes in drivers/vfio/pci due to code sharing consideration. The corresponding Kconfig definition is in samples/Kconfig.
https://lkml.org/lkml/2019/3/4/529
Besides the test purpose, per Alex's comments, it could also be a good base driver for experimenting with device specific mdev migration.
Specific interface tested in this proposal:
*) int mdev_set_iommu_device(struct device *dev,
struct device *iommu_device)
introduced in the patch as below:
"[PATCH v5 6/8] vfio/mdev: Add iommu related member in mdev_device"
Links:
*) Link of "vfio/mdev: IOMMU aware mediated device"
https://lwn.net/Articles/780522/
Please feel free give your comments.
Thanks,
Yi Liu
Change log:
v2->v3:
- use vfio-mdev-pci instead of vfio-pci-mdev
- place the new driver under drivers/vfio/pci while define Kconfig in samples/Kconfig to clarify it is a sample driver
v1->v2:
- instead of adding kernel option to existing vfio-pci module in v1, v2 follows Alex's suggestion to add a separate vfio-pci-mdev module.
- new patchset subject: "vfio/pci: wrap pci device as a mediated device"
Liu, Yi L (3):
vfio_pci: split vfio_pci.c into two source files vfio/pci: protect cap/ecap_perm bits alloc/free with atomic op
smaples: add vfio-mdev-pci driver
drivers/vfio/pci/Makefile | 7 +- drivers/vfio/pci/common.c | 1511 +++++++++++++++++++++++++++++++++++ drivers/vfio/pci/vfio_mdev_pci.c | 386 +++++++++ drivers/vfio/pci/vfio_pci.c | 1476 +--------------------------------- drivers/vfio/pci/vfio_pci_config.c | 9 + drivers/vfio/pci/vfio_pci_private.h | 27 + samples/Kconfig | 11 + 7 files changed, 1962 insertions(+), 1465 deletions(-) create mode 100644 drivers/vfio/pci/common.c create mode 100644 drivers/vfio/pci/vfio_mdev_pci.c
Signature · 1 line
2.7.4
RFC v3 1/3 vfio_pci: split vfio_pci.c into two source files
This patch splits the non-module specific codes from original drivers/vfio/pci/vfio_pci.c into a common.c under drivers/vfio/pci. This is for potential code sharing. e.g. vfio-mdev-pci driver
--- drivers/vfio/pci/Makefile | 2 +- drivers/vfio/pci/common.c | 1511 +++++++++++++++++++++++++++++++++++ drivers/vfio/pci/vfio_pci.c | 1476 +--------------------------------- drivers/vfio/pci/vfio_pci_private.h | 27 + 4 files changed, 1551 insertions(+), 1465 deletions(-) create mode 100644 drivers/vfio/pci/common.c
drivers/vfio/pci/Makefile +1 -1
@@ -1,5 +1,5 @@ -vfio-pci-y := vfio_pci.o vfio_pci_intrs.o vfio_pci_rdwr.o vfio_pci_config.o +vfio-pci-y := vfio_pci.o common.o vfio_pci_intrs.o vfio_pci_rdwr.o vfio_pci_config.o vfio-pci-$(CONFIG_VFIO_PCI_IGD) += vfio_pci_igd.o vfio-pci-$(CONFIG_VFIO_PCI_NVLINK2) += vfio_pci_nvlink2.o
drivers/vfio/pci/common.c new file +1511 -0
1,511 lines not on this page · raw message
drivers/vfio/pci/vfio_pci.c +12 -1464
1,483 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.7.4 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Part of the diff is not shown here. View the raw message.
Re: [RFC v3 1/3] vfio_pci: split vfio_pci.c into two source files
drivers/vfio/pci/common.c
Quoted 31 lines · Yi L
This patch splits the non-module specific codes from original
drivers/vfio/pci/vfio_pci.cinto acommon.cunderdrivers/vfio/pci. This is for potential code sharing. e.g. vfio-mdev-pci driverCc Kevin Tian <[email protected]>Cc Lu Baolu <[email protected]>Signed-off-by Liu, Yi L <[email protected]>--- drivers/vfio/pci/Makefile | 2 +- drivers/vfio/pci/common.c | 1511 +++++++++++++++++++++++++++++++++++ drivers/vfio/pci/vfio_pci.c | 1476 +--------------------------------- drivers/vfio/pci/vfio_pci_private.h | 27 + 4 files changed, 1551 insertions(+), 1465 deletions(-) create mode 100644 drivers/vfio/pci/common.cdrivers/vfio/pci/Makefile +1
-1@@ -1,5 +1,5 @@ -vfio-pci-y := vfio_pci.o vfio_pci_intrs.o vfio_pci_rdwr.o vfio_pci_config.o +vfio-pci-y := vfio_pci.o common.o vfio_pci_intrs.o vfio_pci_rdwr.o vfio_pci_config.o vfio-pci-$(CONFIG_VFIO_PCI_IGD) += vfio_pci_igd.o vfio-pci-$(CONFIG_VFIO_PCI_NVLINK2) += vfio_pci_nvlink2.odrivers/vfio/pci/common.c new file +0
-0
Nit, I realize that our file naming scheme includes a lot of redundancy, but better to have redundancy than inconsistency imo. Perhaps vfio_pci_common.c.
Quoted 29 lines
drivers/vfio/pci/common.c new file +28
-0@@ -0,0 +1,1511 @@ +/* +* Copyright © 2019 Intel Corporation. +* Author: Liu, Yi L <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* Derived from original vfio_pci.c: +* Copyright (C) 2012 Red Hat, Inc. All rights reserved. +* Author: Alex Williamson <[email protected]> +* +* Derived from original vfio: +* Copyright 2010 Cisco Systems, Inc. All rights reserved. +* Author: Tom Lyon, [email protected] +*/ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#include <linux/device.h> +#include <linux/eventfd.h> +#include <linux/file.h> +#include <linux/interrupt.h> +#include <linux/iommu.h> +#include <linux/module.h> +#include <linux/mutex.h> +#include <linux/notifier.h> +#include <linux/pci.h>
drivers/vfio/pci/common.c line 38
Quoted 10 lines
drivers/vfio/pci/common.c new file +10
-0+#include <linux/pm_runtime.h> +#include <linux/slab.h> +#include <linux/types.h> +#include <linux/uaccess.h> +#include <linux/vfio.h> +#include <linux/vgaarb.h> +#include <linux/nospec.h> + +#include "vfio_pci_private.h" +
[snip faithful code moves]
Quoted 4 lines
drivers/vfio/pci/common.c new file +4
-0+void vfio_pci_vga_probe (struct vfio_pci_device *vdev) +{ +vga_client_register (vdev->pdev, vdev,NULL , vfio_pci_set_vga_decode); + vga_set_legacy_decoding(vdev->pdev,
drivers/vfio/pci/common.c line 106
Quoted 10 lines
drivers/vfio/pci/common.c new file +10
-0+ vfio_pci_set_vga_decode(vdev, false)); +} + +void vfio_pci_vga_remove (struct vfio_pci_device *vdev) +{ +vga_client_register (vdev->pdev,NULL ,NULL ,NULL ); +vga_set_legacy_decoding (vdev->pdev, +VGA_RSRC_NORMAL_IO |VGA_RSRC_NORMAL_MEM | +VGA_RSRC_LEGACY_IO |VGA_RSRC_LEGACY_MEM ); +}
Two new functions, though the names don't really match their purpose.
[snip more faithful code moves]
Quoted 6 lines
drivers/vfio/pci/common.c new file +6
-0+ +void vfio_pci_probe_idle_d3 (struct vfio_pci_device *vdev) +{ + +/* +* pci-core sets the device power state to an unknown value at
drivers/vfio/pci/common.c line 272
Quoted 10 lines
drivers/vfio/pci/common.c new file +10
-0+* bootup and after being removed from a driver. The only +* transition it allows from this unknown state is to D0, which +* typically happens when a driver calls pci_enable_device(). +* We're not ready to enable the device yet, but we do want to +* be able to get to D3. Therefore first do a D0 transition +* before going to D3. +*/ +vfio_pci_set_power_state (vdev,PCI_D0 ); +vfio_pci_set_power_state (vdev, PCI_D3hot); +}
Another new function. This also doesn't really match function name to purpose.
[snip more faithful code moves]
drivers/vfio/pci/vfio_pci.c
Quoted 4 lines
drivers/vfio/pci/vfio_pci.c +0
-0
[en masse code deletes]
Quoted 77 lines
drivers/vfio/pci/vfio_pci.c +10
-42@@ -1324,6 +147,11 @@ static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)spin_lock_init (&vdev->irqlock);mutex_init (&vdev->ioeventfds_lock);INIT_LIST_HEAD (&vdev->ioeventfds_list); + vdev->nointxmask = nointxmask; +#ifdef CONFIG_VFIO_PCI_VGA + vdev->disable_vga = disable_vga; +#endif + vdev->disable_idle_d3 = disable_idle_d3; ret =vfio_add_group_dev (&pdev->dev, &vfio_pci_ops, vdev);if (ret) {@@ -1340,27 +168,13 @@ static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)return ret; } -if (vfio_pci_is_vga (pdev)) { -vga_client_register (pdev, vdev,NULL , vfio_pci_set_vga_decode); -vga_set_legacy_decoding (pdev, -vfio_pci_set_vga_decode (vdev, false)); - } +if (vfio_pci_is_vga (pdev)) +vfio_pci_vga_probe (vdev);vfio_pci_probe_power_state (vdev); -if (!disable_idle_d3) { -/* -* pci-core sets the device power state to an unknown value at -* bootup and after being removed from a driver. The only -* transition it allows from this unknown state is to D0, which -* typically happens when a driver calls pci_enable_device(). -* We're not ready to enable the device yet, but we do want to -* be able to get to D3. Therefore first do a D0 transition -* before going to D3. -*/ -vfio_pci_set_power_state (vdev,PCI_D0 ); -vfio_pci_set_power_state (vdev, PCI_D3hot); - } +if (!disable_idle_d3) +vfio_pci_probe_idle_d3 (vdev);return ret; }@@ -1383,48 +197,14 @@ static void vfio_pci_remove(struct pci_dev *pdev)vfio_pci_set_power_state (vdev,PCI_D0 );kfree (vdev->pm_save); -kfree (vdev);if (vfio_pci_is_vga (pdev)) { -vga_client_register (pdev,NULL ,NULL ,NULL ); -vga_set_legacy_decoding (pdev, -VGA_RSRC_NORMAL_IO |VGA_RSRC_NORMAL_MEM | -VGA_RSRC_LEGACY_IO |VGA_RSRC_LEGACY_MEM ); - } -} - -static pci_ers_result_t vfio_pci_aer_err_detected (struct pci_dev *pdev, -pci_channel_state_t state) -{ -struct vfio_pci_device *vdev; -struct vfio_device *device; - - device =vfio_device_get_from_dev (&pdev->dev); -if (device ==NULL ) -return PCI_ERS_RESULT_DISCONNECT ; - - vdev =vfio_device_data (device); -if (vdev ==NULL ) { -vfio_device_put (device); -return PCI_ERS_RESULT_DISCONNECT ; +vfio_pci_vga_remove (vdev); } -mutex_lock (&vdev->igate); -
drivers/vfio/pci/vfio_pci.c static void vfio_pci_remove(struct pci_dev *pdev) · line 206
Quoted 10 lines
drivers/vfio/pci/vfio_pci.c +1
-8-if (vdev->err_trigger) -eventfd_signal (vdev->err_trigger,1 ); - -mutex_unlock (&vdev->igate); - -vfio_device_put (device); - -return PCI_ERS_RESULT_CAN_RECOVER ; +kfree (vdev); }
All of the above refactoring should occur in a preceding patch(es). This patch should be 100% unchanged code moves plus support includes/defines and comment header in the new file.
drivers/vfio/pci/vfio_pci.c static int __init vfio_pci_init(void) · line 236
Quoted 6 lines
drivers/vfio/pci/vfio_pci.c +1
-1@@ -1685,7 +233,7 @@ static int __init vfio_pci_init(void)if (ret) goto out_driver; -vfio_pci_fill_ids (); +vfio_pci_fill_ids (&ids[0 ], &vfio_pci_driver);
For instance I missed this change.
Quoted 8 lines
drivers/vfio/pci/vfio_pci.c +0
-0return 0 ;drivers/vfio/pci/vfio_pci_private.h +0
-0
drivers/vfio/pci/vfio_pci_private.h struct vfio_pci_device { · line 132
Quoted 8 lines
drivers/vfio/pci/vfio_pci_private.h +5
-0@@ -125,6 +125,11 @@ struct vfio_pci_device {struct list_head dummy_resources_list;struct mutex ioeventfds_lock;struct list_head ioeventfds_list; +bool nointxmask; +#ifdef CONFIG_VFIO_PCI_VGA +bool disable_vga; +#endif +bool disable_idle_d3;
More refactoring, do these separately so they can be properly reviewed without trying to spot changes in 3000 lines of diff. I think what you've done is sound, it just needs to be refactored separate from the code moves so that it can be reviewed. Thanks!
Alex
RFC v3 2/3 vfio/pci: protect cap/ecap_perm bits alloc/free with atomic op
In reply to Liu, Yi LThere is a case in which cap_perms and ecap_perms can be reallocated by different modules. e.g. the vfio-mdev-pci sample driver. To secure the initialization of cap_perms and ecap_perms, this patch adds an atomic variable to track the user of cap/ecap_perms bits. First caller of vfio_pci_init_perm_bits() will initialize the bits. While the last caller of vfio_pci_uninit_perm_bits() will free the bits.
--- drivers/vfio/pci/vfio_pci_config.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/vfio/pci/vfio_pci_config.c +9 -0
@@ -996,11 +996,17 @@ static int __init init_pci_ext_cap_pwr_perm(struct perm_bits *perm)return 0 ; } +/* Track the user number of the cap/ecap perm_bits */ +atomic_t vfio_pci_perm_bits_users =ATOMIC_INIT (0 ); +/* * Initialize the shared permission tables */ void vfio_pci_uninit_perm_bits (void ) { +if (atomic_dec_return (&vfio_pci_perm_bits_users)) +return ; +free_perm_bits (&cap_perms[PCI_CAP_ID_BASIC ]);free_perm_bits (&cap_perms[PCI_CAP_ID_PM ]);
@@ -1017,6 +1023,9 @@ int __init vfio_pci_init_perm_bits(void) {int ret; +if (atomic_inc_return (&vfio_pci_perm_bits_users) !=1 ) +return 0 ; +/* Basic config space */ ret =init_pci_cap_basic_perm (&cap_perms[PCI_CAP_ID_BASIC ]);
Signature · 1 line
2.7.4
RFC v3 3/3 smaples: add vfio-mdev-pci driver
In reply to Liu, Yi LThis patch adds sample driver named vfio-mdev-pci. It is to wrap a PCI device as a mediated device. For a pci device, once bound to vfio-mdev-pci driver, user space access of this device will go through vfio mdev framework. The usage of the device follows mdev management method. e.g. user should create a mdev before exposing the device to user-space.
Benefit of this new driver would be acting as a sample driver for recent changes from "vfio/mdev: IOMMU aware mediated device" patchset. Also it could be a good experiment driver for future device specific mdev migration support.
To use this driver:
a) build and load vfio-mdev-pci.ko module
execute "make menuconfig" and config CONFIG_SAMPLE_VFIO_MDEV_PCI then load it with following command
Quoted 3 lines
sudo modprobe vfio
sudo modprobe vfio-pci
sudo insmoddrivers/vfio/pci/vfio-mdev-pci.ko
b) unbind original device driver
e.g. use following command to unbind its original driver
Quoted 1 line
echo $dev_bdf >
/sys/bus/pci/devices/$dev_bdf/driver/unbind
c) bind vfio-mdev-pci driver to the physical device
Quoted 1 line
echo $vend_id $dev_id >
/sys/bus/pci/drivers/vfio-mdev-pci/new_id
d) check the supported mdev instances
Quoted 1 line
ls
/sys/bus/pci/devices/$dev_bdf/mdev_supported_types/
vfio-mdev-pci-type1
Quoted 1 line
ls /sys/bus/pci/devices/$dev_bdf/mdev_supported_types/\
vfio-mdev-pci-type1/
available_instances create device_api devices name
e) create mdev on this physical device (only 1 instance)
Quoted 1 line
echo "83b8f4f2-509f-382f-3c1e-e6bfe0fa1003" > \
/sys/bus/pci/devices/$dev_bdf/mdev_supported_types/\
vfio-mdev-pci-type1/createf) passthru the mdev to guest
add the following line in Qemu boot command
-device vfio-pci,\
sysfsdev=/sys/bus/mdev/devices/83b8f4f2-509f-382f-3c1e-e6bfe0fa1003g) destroy mdev
Quoted 1 line
echo 1 > /sys/bus/mdev/devices/83b8f4f2-509f-382f-3c1e-e6bfe0fa1003/\
remove
--- drivers/vfio/pci/Makefile | 5 + drivers/vfio/pci/vfio_mdev_pci.c | 386 +++++++++++++++++++++++++++++++++++++++ samples/Kconfig | 11 ++ 3 files changed, 402 insertions(+) create mode 100644 drivers/vfio/pci/vfio_mdev_pci.c
drivers/vfio/pci/Makefile +5 -0
@@ -3,4 +3,9 @@ vfio-pci-y := vfio_pci.o common.o vfio_pci_intrs.o vfio_pci_rdwr.o vfio_pci_conf vfio-pci-$(CONFIG_VFIO_PCI_IGD) += vfio_pci_igd.o vfio-pci-$(CONFIG_VFIO_PCI_NVLINK2) += vfio_pci_nvlink2.o +vfio-mdev-pci-y := vfio_mdev_pci.o common.o vfio_pci_intrs.o vfio_pci_rdwr.o vfio_pci_config.o +vfio-mdev-pci-$(CONFIG_VFIO_PCI_IGD) += vfio_pci_igd.o +vfio-mdev-pci-$(CONFIG_VFIO_PCI_NVLINK2) += vfio_pci_nvlink2.o + obj-$(CONFIG_VFIO_PCI) += vfio-pci.o +obj-$(CONFIG_SAMPLE_VFIO_MDEV_PCI) += vfio-mdev-pci.o
drivers/vfio/pci/vfio_mdev_pci.c new file +386 -0
386 lines not on this page · raw message
samples/Kconfig +11 -0
@@ -160,4 +160,15 @@ config SAMPLE_STATX help Build example userspace program to use the new extended-stat syscall. +config SAMPLE_VFIO_MDEV_PCI + tristate "Sample driver for wrapping PCI device as mdev" + depends on PCI && EVENTFD && VFIO_MDEV_DEVICE + select VFIO_VIRQFD + select IRQ_BYPASS_MANAGER + help + Sample driver for wrapping a PCI device as a mdev. Once bound to + this driver, device passthru should through mdev path. + + If you don't know what to do here, say N. + endif # SAMPLES
Signature · 1 line
2.7.4
Hi Alex,
Sorry to disturb you. Do you want to review on this version or review a rebased version? :-) If rebase version is better, I can try to do it asap.
Thanks,
Yi Liu
Quoted 72 lines
-----Original Message-----
From: Liu, Yi L
Sent: Tuesday, April 23, 2019 8:15 PM
To: [email protected]; [email protected]
Cc: Tian, Kevin <[email protected]>; [email protected]; Liu, Yi L <[email protected]>; Sun, Yi Y <[email protected]>; [email protected]; jean- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected] foundation.org
Subject: [RFC v3 0/3]vfio_pci: wrap pci device as a mediated deviceThis patchset aims to add a vfio-pci-like meta driver as a demo user of the vfio changes introduced in "vfio/mdev: IOMMU aware mediated device" patchset from Baolu Lu.
Previous RFC v1 has given two proposals and the discussion could be found in following link. Per the comments, this patchset adds a separate driver named vfio- mdev-pci. It is a sample driver, but loactes in
drivers/vfio/pcidue to code sharing consideration.
The correspondingKconfigdefinition is insamples/Kconfig.https://lkml.org/lkml/2019/3/4/529
Besides the test purpose, per Alex's comments, it could also be a good base driver for experimenting with device specific mdev migration.
Specific interface tested in this proposal:
*) int mdev_set_iommu_device(struct device *dev,
struct device*iommu_device)
introduced in the patch as below:
"[PATCH v5 6/8] vfio/mdev: Add iommu related member inmdev_device"Links:
*) Link of "vfio/mdev: IOMMU aware mediated device"https://lwn.net/Articles/780522/Please feel free give your comments.
Thanks,
Yi LiuChange log:
v2->v3:
- use vfio-mdev-pci instead of vfio-pci-mdev
- place the new driver underdrivers/vfio/pciwhile defineKconfiginsamples/Kconfigto clarify it is a sample driver
v1->v2:
- instead of adding kernel option to existing vfio-pci module in v1, v2 follows Alex's suggestion to add a separate vfio-pci-mdev module.
- new patchset subject: "vfio/pci: wrap pci device as a mediated device"Liu, Yi L (3):
vfio_pci: splitvfio_pci.cinto two source files vfio/pci: protect cap/ecap_perm bits alloc/free with atomic op
smaples: add vfio-mdev-pci driverdrivers/vfio/pci/Makefile | 7 +- drivers/vfio/pci/common.c | 1511 +++++++++++++++++++++++++++++++++++ drivers/vfio/pci/vfio_mdev_pci.c | 386 +++++++++ drivers/vfio/pci/vfio_pci.c | 1476 +--------------------------------- drivers/vfio/pci/vfio_pci_config.c | 9 + drivers/vfio/pci/vfio_pci_private.h | 27 + samples/Kconfig | 11 + 7 files changed, 1962 insertions(+), 1465 deletions(-) create mode 100644
drivers/vfio/pci/common.ccreate mode 100644drivers/vfio/pci/vfio_mdev_pci.c--
2.7.4
Quoted 3 lines · Yi L
Hi Alex,
Sorry to disturb you. Do you want to review on this version or review a rebased version? :-) If rebase version is better, I can try to do it asap.
Hi Yi,
Perhaps you missed my comments on 1/3:
https://www.spinics.net/lists/kvm/msg187282.html
In summary, it looks pretty good, but consider a file name more consistent with the existing files and prune out the code changes from the code moves so they can be reviewed more easily. Thanks,
Alex
Quoted 70 lines
Quoted 70 lines
-----Original Message-----
From: Liu, Yi L
Sent: Tuesday, April 23, 2019 8:15 PM
To: [email protected]; [email protected]
Cc: Tian, Kevin <[email protected]>; [email protected]; Liu, Yi L <[email protected]>; Sun, Yi Y <[email protected]>; [email protected]; jean- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected] foundation.org
Subject: [RFC v3 0/3]vfio_pci: wrap pci device as a mediated deviceThis patchset aims to add a vfio-pci-like meta driver as a demo user of the vfio changes introduced in "vfio/mdev: IOMMU aware mediated device" patchset from Baolu Lu.
Previous RFC v1 has given two proposals and the discussion could be found in following link. Per the comments, this patchset adds a separate driver named vfio- mdev-pci. It is a sample driver, but loactes in
drivers/vfio/pcidue to code sharing consideration.
The correspondingKconfigdefinition is insamples/Kconfig.https://lkml.org/lkml/2019/3/4/529
Besides the test purpose, per Alex's comments, it could also be a good base driver for experimenting with device specific mdev migration.
Specific interface tested in this proposal:
*) int mdev_set_iommu_device(struct device *dev,
struct device*iommu_device)
introduced in the patch as below:
"[PATCH v5 6/8] vfio/mdev: Add iommu related member inmdev_device"Links:
*) Link of "vfio/mdev: IOMMU aware mediated device"https://lwn.net/Articles/780522/Please feel free give your comments.
Thanks,
Yi LiuChange log:
v2->v3:
- use vfio-mdev-pci instead of vfio-pci-mdev
- place the new driver underdrivers/vfio/pciwhile defineKconfiginsamples/Kconfigto clarify it is a sample driver
v1->v2:
- instead of adding kernel option to existing vfio-pci module in v1, v2 follows Alex's suggestion to add a separate vfio-pci-mdev module.
- new patchset subject: "vfio/pci: wrap pci device as a mediated device"Liu, Yi L (3):
vfio_pci: splitvfio_pci.cinto two source files vfio/pci: protect cap/ecap_perm bits alloc/free with atomic op
smaples: add vfio-mdev-pci driverdrivers/vfio/pci/Makefile | 7 +- drivers/vfio/pci/common.c | 1511 +++++++++++++++++++++++++++++++++++ drivers/vfio/pci/vfio_mdev_pci.c | 386 +++++++++ drivers/vfio/pci/vfio_pci.c | 1476 +--------------------------------- drivers/vfio/pci/vfio_pci_config.c | 9 + drivers/vfio/pci/vfio_pci_private.h | 27 + samples/Kconfig | 11 + 7 files changed, 1962 insertions(+), 1465 deletions(-) create mode 100644
drivers/vfio/pci/common.ccreate mode 100644drivers/vfio/pci/vfio_mdev_pci.c
Quoted 3 lines
Quoted 2 lines
--
2.7.4
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 20 lines
From Alex Williamson
Sent: Thursday, May 23, 2019 9:03 PM
To: Liu, Yi L <[email protected]>
Cc: [email protected]; Tian, Kevin <[email protected]>; [email protected]; Sun, Yi Y <[email protected]>; [email protected]; jean- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected] foundation.org
Subject: Re: [RFC v3 0/3]vfio_pci: wrap pci device as a mediated deviceQuoted 3 lines · Yi L
Hi Alex,
Sorry to disturb you. Do you want to review on this version or review a rebased
version? :-) If rebase version is better, I can try to do it asap.
Hi Yi,
Quoted 7 lines
Perhaps you missed my comments on 1/3:
https://www.spinics.net/lists/kvm/msg187282.html
In summary, it looks pretty good, but consider a file name more consistent with the existing files and prune out the code changes from the code moves so they can be reviewed more easily. Thanks,
Thanks for the remind, Alex. So sorry I made changes in a "disordered". I've made the changes accordingly. Pls refer to my latest post just now :-)
Regards,
Yi Liu
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu