1
0
Fork 0

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>
hifive-unleashed-5.1
Frank Blaschka 2014-11-07 09:52:22 -07:00 committed by Alex Williamson
parent 0df1f2487d
commit 1d53a3a7d3
4 changed files with 19 additions and 3 deletions

View File

@ -16,7 +16,7 @@ config VFIO_SPAPR_EEH
menuconfig VFIO menuconfig VFIO
tristate "VFIO Non-Privileged userspace driver framework" tristate "VFIO Non-Privileged userspace driver framework"
depends on IOMMU_API depends on IOMMU_API
select VFIO_IOMMU_TYPE1 if X86 select VFIO_IOMMU_TYPE1 if (X86 || S390)
select VFIO_IOMMU_SPAPR_TCE if (PPC_POWERNV || PPC_PSERIES) select VFIO_IOMMU_SPAPR_TCE if (PPC_POWERNV || PPC_PSERIES)
select VFIO_SPAPR_EEH if (PPC_POWERNV || PPC_PSERIES) select VFIO_SPAPR_EEH if (PPC_POWERNV || PPC_PSERIES)
select ANON_INODES select ANON_INODES

View File

@ -16,3 +16,11 @@ config VFIO_PCI_VGA
BIOS and generic video drivers. BIOS and generic video drivers.
If you don't know what to do here, say N. If you don't know what to do here, say N.
config VFIO_PCI_MMAP
depends on VFIO_PCI
def_bool y if !S390
config VFIO_PCI_INTX
depends on VFIO_PCI
def_bool y if !S390

View File

@ -215,7 +215,7 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type)
if (irq_type == VFIO_PCI_INTX_IRQ_INDEX) { if (irq_type == VFIO_PCI_INTX_IRQ_INDEX) {
u8 pin; u8 pin;
pci_read_config_byte(vdev->pdev, PCI_INTERRUPT_PIN, &pin); pci_read_config_byte(vdev->pdev, PCI_INTERRUPT_PIN, &pin);
if (pin) if (IS_ENABLED(CONFIG_VFIO_PCI_INTX) && pin)
return 1; return 1;
} else if (irq_type == VFIO_PCI_MSI_IRQ_INDEX) { } else if (irq_type == VFIO_PCI_MSI_IRQ_INDEX) {
@ -406,7 +406,8 @@ static long vfio_pci_ioctl(void *device_data,
info.flags = VFIO_REGION_INFO_FLAG_READ | info.flags = VFIO_REGION_INFO_FLAG_READ |
VFIO_REGION_INFO_FLAG_WRITE; VFIO_REGION_INFO_FLAG_WRITE;
if (pci_resource_flags(pdev, info.index) & if (IS_ENABLED(CONFIG_VFIO_PCI_MMAP) &&
pci_resource_flags(pdev, info.index) &
IORESOURCE_MEM && info.size >= PAGE_SIZE) IORESOURCE_MEM && info.size >= PAGE_SIZE)
info.flags |= VFIO_REGION_INFO_FLAG_MMAP; info.flags |= VFIO_REGION_INFO_FLAG_MMAP;
break; break;

View File

@ -609,6 +609,10 @@ static int __init init_pci_cap_basic_perm(struct perm_bits *perm)
/* Sometimes used by sw, just virtualize */ /* Sometimes used by sw, just virtualize */
p_setb(perm, PCI_INTERRUPT_LINE, (u8)ALL_VIRT, (u8)ALL_WRITE); p_setb(perm, PCI_INTERRUPT_LINE, (u8)ALL_VIRT, (u8)ALL_WRITE);
/* Virtualize interrupt pin to allow hiding INTx */
p_setb(perm, PCI_INTERRUPT_PIN, (u8)ALL_VIRT, (u8)NO_WRITE);
return 0; return 0;
} }
@ -1445,6 +1449,9 @@ int vfio_config_init(struct vfio_pci_device *vdev)
*(__le16 *)&vconfig[PCI_DEVICE_ID] = cpu_to_le16(pdev->device); *(__le16 *)&vconfig[PCI_DEVICE_ID] = cpu_to_le16(pdev->device);
} }
if (!IS_ENABLED(CONFIG_VFIO_PCI_INTX))
vconfig[PCI_INTERRUPT_PIN] = 0;
ret = vfio_cap_init(vdev); ret = vfio_cap_init(vdev);
if (ret) if (ret)
goto out; goto out;