Skip to content

Commit c61302a

Browse files
yishaihAlex Williamson
authored andcommitted
vfio/pci: Move module parameters to vfio_pci.c
This is a preparation before splitting vfio_pci.ko to 2 modules. As module parameters are a kind of uAPI they need to stay on vfio_pci.ko to avoid a user visible impact. For now continue to keep the implementation of these options in vfio_pci_core.c. Arguably they are vfio_pci functionality, but further splitting of vfio_pci_core.c will be better done in another series Signed-off-by: Yishai Hadas <yishaih@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20210826103912.128972-9-yishaih@nvidia.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 2fb89f5 commit c61302a

3 files changed

Lines changed: 33 additions & 12 deletions

File tree

drivers/vfio/pci/vfio_pci.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ static char ids[1024] __initdata;
3434
module_param_string(ids, ids, sizeof(ids), 0);
3535
MODULE_PARM_DESC(ids, "Initial PCI IDs to add to the vfio driver, format is \"vendor:device[:subvendor[:subdevice[:class[:class_mask]]]]\" and multiple comma separated entries can be specified");
3636

37+
static bool nointxmask;
38+
module_param_named(nointxmask, nointxmask, bool, S_IRUGO | S_IWUSR);
39+
MODULE_PARM_DESC(nointxmask,
40+
"Disable support for PCI 2.3 style INTx masking. If this resolves problems for specific devices, report lspci -vvvxxx to linux-pci@vger.kernel.org so the device can be fixed automatically via the broken_intx_masking flag.");
41+
42+
#ifdef CONFIG_VFIO_PCI_VGA
43+
static bool disable_vga;
44+
module_param(disable_vga, bool, S_IRUGO);
45+
MODULE_PARM_DESC(disable_vga, "Disable VGA resource access through vfio-pci");
46+
#endif
47+
48+
static bool disable_idle_d3;
49+
module_param(disable_idle_d3, bool, S_IRUGO | S_IWUSR);
50+
MODULE_PARM_DESC(disable_idle_d3,
51+
"Disable using the PCI D3 low power state for idle, unused devices");
52+
3753
static bool enable_sriov;
3854
#ifdef CONFIG_PCI_IOV
3955
module_param(enable_sriov, bool, 0644);
@@ -215,6 +231,13 @@ static void __init vfio_pci_fill_ids(void)
215231
static int __init vfio_pci_init(void)
216232
{
217233
int ret;
234+
bool is_disable_vga = true;
235+
236+
#ifdef CONFIG_VFIO_PCI_VGA
237+
is_disable_vga = disable_vga;
238+
#endif
239+
240+
vfio_pci_core_set_params(nointxmask, is_disable_vga, disable_idle_d3);
218241

219242
ret = vfio_pci_core_init();
220243
if (ret)

drivers/vfio/pci/vfio_pci_core.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,8 @@
2828
#include "vfio_pci_core.h"
2929

3030
static bool nointxmask;
31-
module_param_named(nointxmask, nointxmask, bool, S_IRUGO | S_IWUSR);
32-
MODULE_PARM_DESC(nointxmask,
33-
"Disable support for PCI 2.3 style INTx masking. If this resolves problems for specific devices, report lspci -vvvxxx to linux-pci@vger.kernel.org so the device can be fixed automatically via the broken_intx_masking flag.");
34-
35-
#ifdef CONFIG_VFIO_PCI_VGA
3631
static bool disable_vga;
37-
module_param(disable_vga, bool, S_IRUGO);
38-
MODULE_PARM_DESC(disable_vga, "Disable VGA resource access through vfio-pci");
39-
#endif
40-
4132
static bool disable_idle_d3;
42-
module_param(disable_idle_d3, bool, S_IRUGO | S_IWUSR);
43-
MODULE_PARM_DESC(disable_idle_d3,
44-
"Disable using the PCI D3 low power state for idle, unused devices");
4533

4634
static inline bool vfio_vga_disabled(void)
4735
{
@@ -2121,6 +2109,14 @@ static bool vfio_pci_dev_set_try_reset(struct vfio_device_set *dev_set)
21212109
return true;
21222110
}
21232111

2112+
void vfio_pci_core_set_params(bool is_nointxmask, bool is_disable_vga,
2113+
bool is_disable_idle_d3)
2114+
{
2115+
nointxmask = is_nointxmask;
2116+
disable_vga = is_disable_vga;
2117+
disable_idle_d3 = is_disable_idle_d3;
2118+
}
2119+
21242120
/* This will become the __exit function of vfio_pci_core.ko */
21252121
void vfio_pci_core_cleanup(void)
21262122
{

drivers/vfio/pci/vfio_pci_core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ static inline int vfio_pci_info_zdev_add_caps(struct vfio_pci_core_device *vdev,
209209
/* Will be exported for vfio pci drivers usage */
210210
void vfio_pci_core_cleanup(void);
211211
int vfio_pci_core_init(void);
212+
void vfio_pci_core_set_params(bool nointxmask, bool is_disable_vga,
213+
bool is_disable_idle_d3);
212214
void vfio_pci_core_close_device(struct vfio_device *core_vdev);
213215
void vfio_pci_core_init_device(struct vfio_pci_core_device *vdev,
214216
struct pci_dev *pdev,

0 commit comments

Comments
 (0)