diff mbox series

[SRU,F,1/1] s390/pci: Mark all VFs as not implementing PCI_COMMAND_MEMORY

Message ID 20201209073301.491765-2-frank.heimes@canonical.com
State New
Headers show
Series s390/pci: vfio-pci mmio being disabled erroneously (LP: 1907265) | expand

Commit Message

Frank Heimes Dec. 9, 2020, 7:33 a.m. UTC
From: Matthew Rosato <mjrosato@linux.ibm.com>

BugLink: https://bugs.launchpad.net/bugs/1907265

For s390 we can have VFs that are passed-through without the associated
PF. Firmware provides an emulation layer to allow these devices to
operate independently, but is missing emulation of the Memory Space
Enable bit.  For these as well as linked VFs, set no_command_memory
which specifies these devices do not implement PCI_COMMAND_MEMORY.

Fixes: abafbc551fdd ("vfio-pci: Invalidate mmaps and block MMIO access on disabled memory")
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
(cherry picked from commit 08b6e22b850c28b6032da1e4d767a33116e23dfb)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
---
 arch/s390/pci/pci_bus.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Stefan Bader Dec. 14, 2020, 8:19 a.m. UTC | #1
On 09.12.20 08:33, frank.heimes@canonical.com wrote:
> From: Matthew Rosato <mjrosato@linux.ibm.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1907265
> 
> For s390 we can have VFs that are passed-through without the associated
> PF. Firmware provides an emulation layer to allow these devices to
> operate independently, but is missing emulation of the Memory Space
> Enable bit.  For these as well as linked VFs, set no_command_memory
> which specifies these devices do not implement PCI_COMMAND_MEMORY.
> 
> Fixes: abafbc551fdd ("vfio-pci: Invalidate mmaps and block MMIO access on disabled memory")
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
> Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
> Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> (cherry picked from commit 08b6e22b850c28b6032da1e4d767a33116e23dfb)
> Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  arch/s390/pci/pci_bus.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/pci/pci_bus.c b/arch/s390/pci/pci_bus.c
> index 07b4b4367d69..ebcd04514e8e 100644
> --- a/arch/s390/pci/pci_bus.c
> +++ b/arch/s390/pci/pci_bus.c
> @@ -192,9 +192,10 @@ void pcibios_bus_add_device(struct pci_dev *pdev)
>  	 * With pdev->no_vf_scan the common PCI probing code does not
>  	 * perform PF/VF linking.
>  	 */
> -	if (zdev->vfn)
> +	if (zdev->vfn) {
>  		zpci_bus_setup_virtfn(zdev->zbus, pdev, zdev->vfn);
> -
> +		pdev->no_command_memory = 1;
> +	}
>  }
>  
>  static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev)
>
Kleber Sacilotto de Souza Dec. 15, 2020, 10:35 a.m. UTC | #2
On 09.12.20 08:33, frank.heimes@canonical.com wrote:
> From: Matthew Rosato <mjrosato@linux.ibm.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1907265
> 
> For s390 we can have VFs that are passed-through without the associated
> PF. Firmware provides an emulation layer to allow these devices to
> operate independently, but is missing emulation of the Memory Space
> Enable bit.  For these as well as linked VFs, set no_command_memory
> which specifies these devices do not implement PCI_COMMAND_MEMORY.
> 
> Fixes: abafbc551fdd ("vfio-pci: Invalidate mmaps and block MMIO access on disabled memory")
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
> Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
> Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> (cherry picked from commit 08b6e22b850c28b6032da1e4d767a33116e23dfb)
> Signed-off-by: Frank Heimes <frank.heimes@canonical.com>

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

> ---
>   arch/s390/pci/pci_bus.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/pci/pci_bus.c b/arch/s390/pci/pci_bus.c
> index 07b4b4367d69..ebcd04514e8e 100644
> --- a/arch/s390/pci/pci_bus.c
> +++ b/arch/s390/pci/pci_bus.c
> @@ -192,9 +192,10 @@ void pcibios_bus_add_device(struct pci_dev *pdev)
>   	 * With pdev->no_vf_scan the common PCI probing code does not
>   	 * perform PF/VF linking.
>   	 */
> -	if (zdev->vfn)
> +	if (zdev->vfn) {
>   		zpci_bus_setup_virtfn(zdev->zbus, pdev, zdev->vfn);
> -
> +		pdev->no_command_memory = 1;
> +	}
>   }
>   
>   static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev)
>
Ian May Dec. 17, 2020, 1:14 a.m. UTC | #3
Applied to focal/linux

Thanks,
Ian

On 2020-12-09 08:33:01 , frank.heimes@canonical.com wrote:
> From: Matthew Rosato <mjrosato@linux.ibm.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1907265
> 
> For s390 we can have VFs that are passed-through without the associated
> PF. Firmware provides an emulation layer to allow these devices to
> operate independently, but is missing emulation of the Memory Space
> Enable bit.  For these as well as linked VFs, set no_command_memory
> which specifies these devices do not implement PCI_COMMAND_MEMORY.
> 
> Fixes: abafbc551fdd ("vfio-pci: Invalidate mmaps and block MMIO access on disabled memory")
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
> Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
> Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> (cherry picked from commit 08b6e22b850c28b6032da1e4d767a33116e23dfb)
> Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
> ---
>  arch/s390/pci/pci_bus.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/pci/pci_bus.c b/arch/s390/pci/pci_bus.c
> index 07b4b4367d69..ebcd04514e8e 100644
> --- a/arch/s390/pci/pci_bus.c
> +++ b/arch/s390/pci/pci_bus.c
> @@ -192,9 +192,10 @@ void pcibios_bus_add_device(struct pci_dev *pdev)
>  	 * With pdev->no_vf_scan the common PCI probing code does not
>  	 * perform PF/VF linking.
>  	 */
> -	if (zdev->vfn)
> +	if (zdev->vfn) {
>  		zpci_bus_setup_virtfn(zdev->zbus, pdev, zdev->vfn);
> -
> +		pdev->no_command_memory = 1;
> +	}
>  }
>  
>  static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev)
> -- 
> 2.25.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/arch/s390/pci/pci_bus.c b/arch/s390/pci/pci_bus.c
index 07b4b4367d69..ebcd04514e8e 100644
--- a/arch/s390/pci/pci_bus.c
+++ b/arch/s390/pci/pci_bus.c
@@ -192,9 +192,10 @@  void pcibios_bus_add_device(struct pci_dev *pdev)
 	 * With pdev->no_vf_scan the common PCI probing code does not
 	 * perform PF/VF linking.
 	 */
-	if (zdev->vfn)
+	if (zdev->vfn) {
 		zpci_bus_setup_virtfn(zdev->zbus, pdev, zdev->vfn);
-
+		pdev->no_command_memory = 1;
+	}
 }
 
 static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev)