diff options
author | Frank Blaschka <frank.blaschka@de.ibm.com> | 2014-11-07 11:52:22 -0500 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2014-11-07 11:52:22 -0500 |
commit | 1d53a3a7d3b886bcc60b90e41693b82a791c25ba (patch) | |
tree | 0c3ccdb3b8b5c769b458b185b2eb209468e8667e | |
parent | 0df1f2487d2f0d04703f142813d53615d62a1da4 (diff) |
vfio: make vfio run on s390
add Kconfig switch to hide INTx
add Kconfig switch to let vfio announce PCI BARs are not mapable
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
-rw-r--r-- | drivers/vfio/Kconfig | 2 | ||||
-rw-r--r-- | drivers/vfio/pci/Kconfig | 8 | ||||
-rw-r--r-- | drivers/vfio/pci/vfio_pci.c | 5 | ||||
-rw-r--r-- | drivers/vfio/pci/vfio_pci_config.c | 7 |
4 files changed, 19 insertions, 3 deletions
diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig index d8c57636b9ce..b93c25901e89 100644 --- a/drivers/vfio/Kconfig +++ b/drivers/vfio/Kconfig | |||
@@ -16,7 +16,7 @@ config VFIO_SPAPR_EEH | |||
16 | menuconfig VFIO | 16 | menuconfig VFIO |
17 | tristate "VFIO Non-Privileged userspace driver framework" | 17 | tristate "VFIO Non-Privileged userspace driver framework" |
18 | depends on IOMMU_API | 18 | depends on IOMMU_API |
19 | select VFIO_IOMMU_TYPE1 if X86 | 19 | select VFIO_IOMMU_TYPE1 if (X86 || S390) |
20 | select VFIO_IOMMU_SPAPR_TCE if (PPC_POWERNV || PPC_PSERIES) | 20 | select VFIO_IOMMU_SPAPR_TCE if (PPC_POWERNV || PPC_PSERIES) |
21 | select VFIO_SPAPR_EEH if (PPC_POWERNV || PPC_PSERIES) | 21 | select VFIO_SPAPR_EEH if (PPC_POWERNV || PPC_PSERIES) |
22 | select ANON_INODES | 22 | select ANON_INODES |
diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig index c41b01e2b693..c6bb5da2d2a7 100644 --- a/drivers/vfio/pci/Kconfig +++ b/drivers/vfio/pci/Kconfig | |||
@@ -16,3 +16,11 @@ config VFIO_PCI_VGA | |||
16 | BIOS and generic video drivers. | 16 | BIOS and generic video drivers. |
17 | 17 | ||
18 | If you don't know what to do here, say N. | 18 | If you don't know what to do here, say N. |
19 | |||
20 | config VFIO_PCI_MMAP | ||
21 | depends on VFIO_PCI | ||
22 | def_bool y if !S390 | ||
23 | |||
24 | config VFIO_PCI_INTX | ||
25 | depends on VFIO_PCI | ||
26 | def_bool y if !S390 | ||
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 9558da3f06a0..255201f22126 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c | |||
@@ -215,7 +215,7 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type) | |||
215 | if (irq_type == VFIO_PCI_INTX_IRQ_INDEX) { | 215 | if (irq_type == VFIO_PCI_INTX_IRQ_INDEX) { |
216 | u8 pin; | 216 | u8 pin; |
217 | pci_read_config_byte(vdev->pdev, PCI_INTERRUPT_PIN, &pin); | 217 | pci_read_config_byte(vdev->pdev, PCI_INTERRUPT_PIN, &pin); |
218 | if (pin) | 218 | if (IS_ENABLED(CONFIG_VFIO_PCI_INTX) && pin) |
219 | return 1; | 219 | return 1; |
220 | 220 | ||
221 | } else if (irq_type == VFIO_PCI_MSI_IRQ_INDEX) { | 221 | } else if (irq_type == VFIO_PCI_MSI_IRQ_INDEX) { |
@@ -406,7 +406,8 @@ static long vfio_pci_ioctl(void *device_data, | |||
406 | 406 | ||
407 | info.flags = VFIO_REGION_INFO_FLAG_READ | | 407 | info.flags = VFIO_REGION_INFO_FLAG_READ | |
408 | VFIO_REGION_INFO_FLAG_WRITE; | 408 | VFIO_REGION_INFO_FLAG_WRITE; |
409 | if (pci_resource_flags(pdev, info.index) & | 409 | if (IS_ENABLED(CONFIG_VFIO_PCI_MMAP) && |
410 | pci_resource_flags(pdev, info.index) & | ||
410 | IORESOURCE_MEM && info.size >= PAGE_SIZE) | 411 | IORESOURCE_MEM && info.size >= PAGE_SIZE) |
411 | info.flags |= VFIO_REGION_INFO_FLAG_MMAP; | 412 | info.flags |= VFIO_REGION_INFO_FLAG_MMAP; |
412 | break; | 413 | break; |
diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index 1de3f94aa7de..ff75ca31a199 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c | |||
@@ -609,6 +609,10 @@ static int __init init_pci_cap_basic_perm(struct perm_bits *perm) | |||
609 | 609 | ||
610 | /* Sometimes used by sw, just virtualize */ | 610 | /* Sometimes used by sw, just virtualize */ |
611 | p_setb(perm, PCI_INTERRUPT_LINE, (u8)ALL_VIRT, (u8)ALL_WRITE); | 611 | p_setb(perm, PCI_INTERRUPT_LINE, (u8)ALL_VIRT, (u8)ALL_WRITE); |
612 | |||
613 | /* Virtualize interrupt pin to allow hiding INTx */ | ||
614 | p_setb(perm, PCI_INTERRUPT_PIN, (u8)ALL_VIRT, (u8)NO_WRITE); | ||
615 | |||
612 | return 0; | 616 | return 0; |
613 | } | 617 | } |
614 | 618 | ||
@@ -1445,6 +1449,9 @@ int vfio_config_init(struct vfio_pci_device *vdev) | |||
1445 | *(__le16 *)&vconfig[PCI_DEVICE_ID] = cpu_to_le16(pdev->device); | 1449 | *(__le16 *)&vconfig[PCI_DEVICE_ID] = cpu_to_le16(pdev->device); |
1446 | } | 1450 | } |
1447 | 1451 | ||
1452 | if (!IS_ENABLED(CONFIG_VFIO_PCI_INTX)) | ||
1453 | vconfig[PCI_INTERRUPT_PIN] = 0; | ||
1454 | |||
1448 | ret = vfio_cap_init(vdev); | 1455 | ret = vfio_cap_init(vdev); |
1449 | if (ret) | 1456 | if (ret) |
1450 | goto out; | 1457 | goto out; |