qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [qemu-s390x] [PATCH 3/5] s390: vfio_pci: Use a PCI Group structure


From: Pierre Morel
Subject: Re: [qemu-s390x] [PATCH 3/5] s390: vfio_pci: Use a PCI Group structure
Date: Thu, 16 May 2019 10:55:30 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 14/05/2019 13:49, Cornelia Huck wrote:
On Fri, 10 May 2019 16:38:51 +0200
Pierre Morel <address@hidden> wrote:

We use a S390PCIGroup structure to hold the information
related to zPCI Function group.

This allows us to be ready to support multiple groups and to retrieve
the group information from the host.

What if there is no host to retrieve information from?

There is a default group for emulate devices.
I will enhance the comment.

Thanks



Signed-off-by: Pierre Morel <address@hidden>
---
  hw/s390x/s390-pci-bus.c  | 42 ++++++++++++++++++++++++++++++++++++++++++
  hw/s390x/s390-pci-bus.h  | 11 ++++++++++-
  hw/s390x/s390-pci-inst.c | 22 +++++++++++++---------
  3 files changed, 65 insertions(+), 10 deletions(-)

diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index be28962..8147847 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -284,21 +284,25 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t 
ra)
          stq_p(&resquery->edma, ZPCI_EDMA_ADDR);
          stl_p(&resquery->fid, pbdev->fid);
          stw_p(&resquery->pchid, 0);
-        stw_p(&resquery->ug, 1);
+        stw_p(&resquery->ug, ZPCI_DEFAULT_FN_GRP);
          stl_p(&resquery->uid, pbdev->uid);
          stw_p(&resquery->hdr.rsp, CLP_RC_OK);
          break;
      }
      case CLP_QUERY_PCI_FNGRP: {
          ClpRspQueryPciGrp *resgrp = (ClpRspQueryPciGrp *)resh;
-        resgrp->fr = 1;
-        stq_p(&resgrp->dasm, 0);
-        stq_p(&resgrp->msia, ZPCI_MSI_ADDR);
-        stw_p(&resgrp->mui, DEFAULT_MUI);
-        stw_p(&resgrp->i, 128);
-        stw_p(&resgrp->maxstbl, 128);
-        resgrp->version = 0;
+ ClpReqQueryPciGrp *reqgrp = (ClpReqQueryPciGrp *)reqh;
+        S390PCIGroup *grp;
+
+        grp = s390_grp_find(reqgrp->g);
+        if (!grp) {
+            /* We do not allow access to unknown groups */
+            /* The group must have been obtained with a vfio device */

What about non-vfio devices? How does this whole feature work for
emulated devices?

Emulated devices get a default group with predefined values.
The predefined values we used before this series.
I will modify the patch comment to explain the emulated devices case.
Thanks for the comments.

Regards,
Pierre


--
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany




reply via email to

[Prev in Thread] Current Thread [Next in Thread]