[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH] s390x/pci: Enforce PCI_COMMAND_MEMORY for vfio-pci
From: |
Matthew Rosato |
Subject: |
[RFC PATCH] s390x/pci: Enforce PCI_COMMAND_MEMORY for vfio-pci |
Date: |
Thu, 23 Jul 2020 11:13:56 -0400 |
After kernel commit abafbc55 'vfio-pci: Invalidate mmaps and
block MMIO access on disabled memory', I'm seeing qemu errors
on s390x as vfio-pci devices attempt to read bar 0 because
PCI_COMMAND_MEMORY is not reliably set. Ensure the value
stays ON while the device is in-use.
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
---
hw/s390x/s390-pci-inst.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 2f7a7d7..74b8796 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -555,6 +555,16 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t
r2, uintptr_t ra)
}
/* len = 1,2,4 so we do not need to test */
zpci_endian_swap(&data, len);
+
+ /*
+ * vfio-pci requires PCI_COMMAND_MEMORY. Ensure that it
+ * stays on for an active device.
+ */
+ if ((pbdev->fh & FH_SHM_VFIO) && (offset == PCI_COMMAND) &&
+ (len == 2) && (data != 0)) {
+ data |= PCI_COMMAND_MEMORY;
+ }
+
pci_host_config_write_common(pbdev->pdev, offset,
pci_config_size(pbdev->pdev),
data, len);
--
1.8.3.1
- [RFC PATCH] s390x/pci: vfio-pci breakage with disabled mem enforcement, Matthew Rosato, 2020/07/23
- [RFC PATCH] s390x/pci: Enforce PCI_COMMAND_MEMORY for vfio-pci,
Matthew Rosato <=
- Re: [RFC PATCH] s390x/pci: vfio-pci breakage with disabled mem enforcement, Alex Williamson, 2020/07/23
- Re: [RFC PATCH] s390x/pci: vfio-pci breakage with disabled mem enforcement, Matthew Rosato, 2020/07/23
- Re: [RFC PATCH] s390x/pci: vfio-pci breakage with disabled mem enforcement, Pierre Morel, 2020/07/27
- Re: [RFC PATCH] s390x/pci: vfio-pci breakage with disabled mem enforcement, Matthew Rosato, 2020/07/27
- Re: [RFC PATCH] s390x/pci: vfio-pci breakage with disabled mem enforcement, Alex Williamson, 2020/07/27
- Re: [RFC PATCH] s390x/pci: vfio-pci breakage with disabled mem enforcement, Niklas Schnelle, 2020/07/28
- Re: [RFC PATCH] s390x/pci: vfio-pci breakage with disabled mem enforcement, Alex Williamson, 2020/07/28
- Re: [RFC PATCH] s390x/pci: vfio-pci breakage with disabled mem enforcement, Niklas Schnelle, 2020/07/28
- Re: [RFC PATCH] s390x/pci: vfio-pci breakage with disabled mem enforcement, Niklas Schnelle, 2020/07/28
Re: [RFC PATCH] s390x/pci: vfio-pci breakage with disabled mem enforcement, Niklas Schnelle, 2020/07/24