diff mbox series

[v4,2/2] s390x/pci: indicate QEMU supports relaxed translation for passthrough

Message ID 20250207205613.474092-3-mjrosato@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x/pci: relax I/O address translation requirement | expand

Commit Message

Matthew Rosato Feb. 7, 2025, 8:56 p.m. UTC
Specifying this bit in the guest CLP response indicates that the guest
can optionally choose to skip translation and instead use
identity-mapped operations.

Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
---
 hw/s390x/s390-pci-vfio.c        | 5 ++++-
 include/hw/s390x/s390-pci-clp.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Niklas Schnelle Feb. 10, 2025, 1:29 p.m. UTC | #1
On Fri, 2025-02-07 at 15:56 -0500, Matthew Rosato wrote:
> Specifying this bit in the guest CLP response indicates that the guest
> can optionally choose to skip translation and instead use
> identity-mapped operations.
> 
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
> ---
>  hw/s390x/s390-pci-vfio.c        | 5 ++++-
>  include/hw/s390x/s390-pci-clp.h | 1 +
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c
> index 443e222912..6236ac7f1e 100644
> --- a/hw/s390x/s390-pci-vfio.c
> +++ b/hw/s390x/s390-pci-vfio.c
> @@ -238,8 +238,11 @@ static void s390_pci_read_group(S390PCIBusDevice *pbdev,
>          pbdev->pci_group = s390_group_create(pbdev->zpci_fn.pfgid, start_gid);
>  
>          resgrp = &pbdev->pci_group->zpci_group;
> +        if (pbdev->rtr_avail) {
> +            resgrp->fr |= CLP_RSP_QPCIG_MASK_RTR;
> +        }
>          if (cap->flags & VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH) {
> -            resgrp->fr = 1;
> +            resgrp->fr |= CLP_RSP_QPCIG_MASK_REFRESH;
>          }
>          resgrp->dasm = cap->dasm;
>          resgrp->msia = cap->msi_addr;
> diff --git a/include/hw/s390x/s390-pci-clp.h b/include/hw/s390x/s390-pci-clp.h
> index 03b7f9ba5f..6a635d693b 100644
> --- a/include/hw/s390x/s390-pci-clp.h
> +++ b/include/hw/s390x/s390-pci-clp.h
> @@ -158,6 +158,7 @@ typedef struct ClpRspQueryPciGrp {
>  #define CLP_RSP_QPCIG_MASK_NOI 0xfff
>      uint16_t i;
>      uint8_t version;
> +#define CLP_RSP_QPCIG_MASK_RTR     0x20
>  #define CLP_RSP_QPCIG_MASK_FRAME   0x2
>  #define CLP_RSP_QPCIG_MASK_REFRESH 0x1
>      uint8_t fr;

Looks good to me!

Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
diff mbox series

Patch

diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c
index 443e222912..6236ac7f1e 100644
--- a/hw/s390x/s390-pci-vfio.c
+++ b/hw/s390x/s390-pci-vfio.c
@@ -238,8 +238,11 @@  static void s390_pci_read_group(S390PCIBusDevice *pbdev,
         pbdev->pci_group = s390_group_create(pbdev->zpci_fn.pfgid, start_gid);
 
         resgrp = &pbdev->pci_group->zpci_group;
+        if (pbdev->rtr_avail) {
+            resgrp->fr |= CLP_RSP_QPCIG_MASK_RTR;
+        }
         if (cap->flags & VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH) {
-            resgrp->fr = 1;
+            resgrp->fr |= CLP_RSP_QPCIG_MASK_REFRESH;
         }
         resgrp->dasm = cap->dasm;
         resgrp->msia = cap->msi_addr;
diff --git a/include/hw/s390x/s390-pci-clp.h b/include/hw/s390x/s390-pci-clp.h
index 03b7f9ba5f..6a635d693b 100644
--- a/include/hw/s390x/s390-pci-clp.h
+++ b/include/hw/s390x/s390-pci-clp.h
@@ -158,6 +158,7 @@  typedef struct ClpRspQueryPciGrp {
 #define CLP_RSP_QPCIG_MASK_NOI 0xfff
     uint16_t i;
     uint8_t version;
+#define CLP_RSP_QPCIG_MASK_RTR     0x20
 #define CLP_RSP_QPCIG_MASK_FRAME   0x2
 #define CLP_RSP_QPCIG_MASK_REFRESH 0x1
     uint8_t fr;