* [Qemu-devel] [PATCH 00/17] s390x: the big pci update
@ 2016-06-24 13:28 Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 01/17] s390x/pci: fix failures of dma map/unmap Cornelia Huck
` (19 more replies)
0 siblings, 20 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:28 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
We had been looking at remodelling the pci representation for s390x
to handle our slightly odd architecture correctly some time ago
already, but now we have a patchset that we're happy with.
There's a bunch of bugfixes, cleanups and architecture conformance
changes in there, but the most interesting part is the modelling
(which, in some respects, takes a cue from what sPAPR does).
We introduce a 'zpci' device to hold s390x-specific properties like
the uid and fid. This 'zpci' device is connected to a run-of-the-mill
pci device via the 'target' property.
Example command line portion:
-device zpci,uid=1,fid=1,target=vpci0 \
-device vfio-pci,host=0000:00:00.0,id=vpci0 \
-device zpci,target=vpci1 \
-device vfio-pci,host=0001:00:00.0,id=vpci1 \
-device vfio-pci,host=0002:00:00.0,id=vpci2
For device vpci0, uid and fid are specified in the associated zpci
device.
For device vpci1, uid and fid are automatically generated.
For device vpci2, first an associated zpci device is generated and
then autogenerated values for uid and fid are placed in it.
This should accomodate both specifying our special parameters and
re-using standard statements for pci devices. You can still specify
bus/slot/function for the pci device, but it will not be propagated
into the guest (as the s390 pci architecture does not allow for it;
the guest only sees uid/fid).
The "introduce S390PCI<foo>" patches are probably the most interesting
for those looking at the modelling.
I'd love to see some feedback from a PCI perspective, as I'm happy
from the s390x perspective (and I'd like to see this in 2.7).
Branch available at git://github.com/cohuck/qemu s390x-pci-update
Yi Min Zhao (17):
s390x/pci: fix failures of dma map/unmap
s390x/pci: acceleration for getting S390pciState
s390x/pci: write fid in CLP_QUERY_PCI_FN
s390x/pci: unify FH_ macros
s390x/pci: refactor s390_pci_find_dev_by_fh
s390x/pci: enforce zPCI state checking
s390x/pci: introduce S390PCIBus
s390x/pci: introduce S390PCIIOMMU
s390x/pci: introduce S390PCIBusDevice qdev
s390x/pci: enable uid-checking
s390x/pci: enable zpci hot-plug/hot-unplug
s390x/pci: add checkings in CLP_SET_PCI_FN
s390x/pci: refactor s390_pci_find_dev_by_idx
s390x/pci: refactor list_pci
s390x/pci: fix stpcifc_service_call
s390x/pci: replace fid with idx in msg data of msix
s390x/pci: make hot-unplug handler smoother
hw/s390x/s390-pci-bus.c | 579 +++++++++++++++++++++++++++++++++++------------
hw/s390x/s390-pci-bus.h | 77 ++++++-
hw/s390x/s390-pci-inst.c | 266 ++++++++++++++++------
hw/s390x/s390-pci-inst.h | 7 +-
include/hw/s390x/sclp.h | 1 +
target-s390x/kvm.c | 4 +-
6 files changed, 718 insertions(+), 216 deletions(-)
--
2.9.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 01/17] s390x/pci: fix failures of dma map/unmap
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
@ 2016-06-24 13:28 ` Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 02/17] s390x/pci: acceleration for getting S390pciState Cornelia Huck
` (18 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:28 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
In commit d78c19b5cf4821d0c198f4132a085bdbf19dda4c, vfio code stores
the IOMMU's offset_within_address_space and adjusts the IOVA before
calling vfio_dma_map/vfio_dma_unmap. But s390_translate_iommu already
considers the base address of an IOMMU memory region.
Thus we use pal as the size and 0x0 as the base address to initialize
IOMMU memory subregion.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index a77c10c..8f03b82 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -498,11 +498,9 @@ static const MemoryRegionOps s390_msi_ctrl_ops = {
void s390_pci_iommu_enable(S390PCIBusDevice *pbdev)
{
- uint64_t size = pbdev->pal - pbdev->pba + 1;
-
memory_region_init_iommu(&pbdev->iommu_mr, OBJECT(&pbdev->mr),
- &s390_iommu_ops, "iommu-s390", size);
- memory_region_add_subregion(&pbdev->mr, pbdev->pba, &pbdev->iommu_mr);
+ &s390_iommu_ops, "iommu-s390", pbdev->pal + 1);
+ memory_region_add_subregion(&pbdev->mr, 0, &pbdev->iommu_mr);
pbdev->iommu_enabled = true;
}
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 02/17] s390x/pci: acceleration for getting S390pciState
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 01/17] s390x/pci: fix failures of dma map/unmap Cornelia Huck
@ 2016-06-24 13:28 ` Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 03/17] s390x/pci: write fid in CLP_QUERY_PCI_FN Cornelia Huck
` (17 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:28 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
There are a number of places where the code needs to get the instance
of S390pciState. It calls object_resolve_path() every time. This
wastes a lot of time and leads to low performance. Thus we add
s390_get_phb() to improve it.
Because we always have a phb, we remove all return checkings in the
callers and add an assert in s390_get_phb() to make sure that phb is
getted successfully.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 53 +++++++++++++++++++------------------------------
1 file changed, 20 insertions(+), 33 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 8f03b82..ba637c9 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -29,6 +29,19 @@
do { } while (0)
#endif
+static S390pciState *s390_get_phb(void)
+{
+ static S390pciState *phb;
+
+ if (!phb) {
+ phb = S390_PCI_HOST_BRIDGE(
+ object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL));
+ assert(phb != NULL);
+ }
+
+ return phb;
+}
+
int chsc_sei_nt2_get_event(void *res)
{
ChscSeiNt2Res *nt2_res = (ChscSeiNt2Res *)res;
@@ -36,12 +49,7 @@ int chsc_sei_nt2_get_event(void *res)
PciCcdfErr *eccdf;
int rc = 1;
SeiContainer *sei_cont;
- S390pciState *s = S390_PCI_HOST_BRIDGE(
- object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL));
-
- if (!s) {
- return rc;
- }
+ S390pciState *s = s390_get_phb();
sei_cont = QTAILQ_FIRST(&s->pending_sei);
if (sei_cont) {
@@ -76,12 +84,7 @@ int chsc_sei_nt2_get_event(void *res)
int chsc_sei_nt2_have_event(void)
{
- S390pciState *s = S390_PCI_HOST_BRIDGE(
- object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL));
-
- if (!s) {
- return 0;
- }
+ S390pciState *s = s390_get_phb();
return !QTAILQ_EMPTY(&s->pending_sei);
}
@@ -90,12 +93,7 @@ S390PCIBusDevice *s390_pci_find_dev_by_fid(uint32_t fid)
{
S390PCIBusDevice *pbdev;
int i;
- S390pciState *s = S390_PCI_HOST_BRIDGE(
- object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL));
-
- if (!s) {
- return NULL;
- }
+ S390pciState *s = s390_get_phb();
for (i = 0; i < PCI_SLOT_MAX; i++) {
pbdev = &s->pbdev[i];
@@ -180,12 +178,7 @@ S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)
S390PCIBusDevice *pbdev;
int i;
int j = 0;
- S390pciState *s = S390_PCI_HOST_BRIDGE(
- object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL));
-
- if (!s) {
- return NULL;
- }
+ S390pciState *s = s390_get_phb();
for (i = 0; i < PCI_SLOT_MAX; i++) {
pbdev = &s->pbdev[i];
@@ -207,10 +200,9 @@ S390PCIBusDevice *s390_pci_find_dev_by_fh(uint32_t fh)
{
S390PCIBusDevice *pbdev;
int i;
- S390pciState *s = S390_PCI_HOST_BRIDGE(
- object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL));
+ S390pciState *s = s390_get_phb();
- if (!s || !fh) {
+ if (!fh) {
return NULL;
}
@@ -228,12 +220,7 @@ static void s390_pci_generate_event(uint8_t cc, uint16_t pec, uint32_t fh,
uint32_t fid, uint64_t faddr, uint32_t e)
{
SeiContainer *sei_cont;
- S390pciState *s = S390_PCI_HOST_BRIDGE(
- object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL));
-
- if (!s) {
- return;
- }
+ S390pciState *s = s390_get_phb();
sei_cont = g_malloc0(sizeof(SeiContainer));
sei_cont->fh = fh;
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 03/17] s390x/pci: write fid in CLP_QUERY_PCI_FN
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 01/17] s390x/pci: fix failures of dma map/unmap Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 02/17] s390x/pci: acceleration for getting S390pciState Cornelia Huck
@ 2016-06-24 13:28 ` Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 04/17] s390x/pci: unify FH_ macros Cornelia Huck
` (16 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:28 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
We forgot to write the fid; fix that.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Acked-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-inst.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 479375f..2cd7d14 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -256,6 +256,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2)
stq_p(&resquery->sdma, ZPCI_SDMA_ADDR);
stq_p(&resquery->edma, ZPCI_EDMA_ADDR);
+ stl_p(&resquery->fid, pbdev->fid);
stw_p(&resquery->pchid, 0);
stw_p(&resquery->ug, 1);
stl_p(&resquery->uid, pbdev->fid);
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 04/17] s390x/pci: unify FH_ macros
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (2 preceding siblings ...)
2016-06-24 13:28 ` [Qemu-devel] [PATCH 03/17] s390x/pci: write fid in CLP_QUERY_PCI_FN Cornelia Huck
@ 2016-06-24 13:28 ` Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 05/17] s390x/pci: refactor s390_pci_find_dev_by_fh Cornelia Huck
` (15 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:28 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Present code uses some macros to structure PCI Function Handle. But
their names don't have a uniform format. Let's use FH_MASK_ as the
unified prefix.
While we're at it, differentiate the SHM bits: use different bits for
vfio and emulated devices.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 6 +++---
hw/s390x/s390-pci-bus.h | 9 ++++++---
hw/s390x/s390-pci-inst.c | 18 +++++++++---------
3 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index ba637c9..7111587 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -170,7 +170,7 @@ static uint32_t s390_pci_get_pfid(PCIDevice *pdev)
static uint32_t s390_pci_get_pfh(PCIDevice *pdev)
{
- return PCI_SLOT(pdev->devfn) | FH_VIRT;
+ return PCI_SLOT(pdev->devfn) | FH_SHM_VFIO;
}
S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)
@@ -345,7 +345,7 @@ static IOMMUTLBEntry s390_translate_iommu(MemoryRegion *iommu, hwaddr addr,
};
if (!pbdev->configured || !pbdev->pdev ||
- !(pbdev->fh & FH_ENABLED) || !pbdev->iommu_enabled) {
+ !(pbdev->fh & FH_MASK_ENABLE) || !pbdev->iommu_enabled) {
return ret;
}
@@ -456,7 +456,7 @@ static void s390_msi_ctrl_write(void *opaque, hwaddr addr, uint64_t data,
return;
}
- if (!(pbdev->fh & FH_ENABLED)) {
+ if (!(pbdev->fh & FH_MASK_ENABLE)) {
return;
}
diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h
index 2c852d4..5cf7926 100644
--- a/hw/s390x/s390-pci-bus.h
+++ b/hw/s390x/s390-pci-bus.h
@@ -21,9 +21,12 @@
#include "hw/s390x/css.h"
#define TYPE_S390_PCI_HOST_BRIDGE "s390-pcihost"
-#define FH_VIRT 0x00ff0000
-#define ENABLE_BIT_OFFSET 31
-#define FH_ENABLED (1 << ENABLE_BIT_OFFSET)
+#define FH_MASK_ENABLE 0x80000000
+#define FH_MASK_INSTANCE 0x7f000000
+#define FH_MASK_SHM 0x00ff0000
+#define FH_MASK_INDEX 0x0000001f
+#define FH_SHM_VFIO 0x00010000
+#define FH_SHM_EMUL 0x00020000
#define S390_PCIPT_ADAPTER 2
#define S390_PCI_HOST_BRIDGE(obj) \
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 2cd7d14..8b68824 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -92,7 +92,7 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
stl_p(&rrb->response.fmt, 0);
stq_p(&rrb->response.reserved1, 0);
stq_p(&rrb->response.reserved2, 0);
- stl_p(&rrb->response.mdd, FH_VIRT);
+ stl_p(&rrb->response.mdd, FH_MASK_SHM);
stw_p(&rrb->response.max_fn, PCI_MAX_FUNCTIONS);
rrb->response.entry_size = sizeof(ClpFhListEntry);
finish = 0;
@@ -212,12 +212,12 @@ int clp_service_call(S390CPU *cpu, uint8_t r2)
switch (reqsetpci->oc) {
case CLP_SET_ENABLE_PCI_FN:
- pbdev->fh = pbdev->fh | FH_ENABLED;
+ pbdev->fh |= FH_MASK_ENABLE;
stl_p(&ressetpci->fh, pbdev->fh);
stw_p(&ressetpci->hdr.rsp, CLP_RC_OK);
break;
case CLP_SET_DISABLE_PCI_FN:
- pbdev->fh = pbdev->fh & ~FH_ENABLED;
+ pbdev->fh &= ~FH_MASK_ENABLE;
pbdev->error_state = false;
pbdev->lgstg_blocked = false;
stl_p(&ressetpci->fh, pbdev->fh);
@@ -318,7 +318,7 @@ int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2)
offset = env->regs[r2 + 1];
pbdev = s390_pci_find_dev_by_fh(fh);
- if (!pbdev || !(pbdev->fh & FH_ENABLED)) {
+ if (!pbdev || !(pbdev->fh & FH_MASK_ENABLE)) {
DPRINTF("pcilg no pci dev\n");
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
@@ -435,7 +435,7 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2)
offset = env->regs[r2 + 1];
pbdev = s390_pci_find_dev_by_fh(fh);
- if (!pbdev || !(pbdev->fh & FH_ENABLED)) {
+ if (!pbdev || !(pbdev->fh & FH_MASK_ENABLE)) {
DPRINTF("pcistg no pci dev\n");
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
@@ -526,7 +526,7 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2)
end = start + env->regs[r2 + 1];
pbdev = s390_pci_find_dev_by_fh(fh);
- if (!pbdev || !(pbdev->fh & FH_ENABLED)) {
+ if (!pbdev || !(pbdev->fh & FH_MASK_ENABLE)) {
DPRINTF("rpcit no pci dev\n");
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
goto out;
@@ -590,7 +590,7 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr,
}
pbdev = s390_pci_find_dev_by_fh(fh);
- if (!pbdev || !(pbdev->fh & FH_ENABLED)) {
+ if (!pbdev || !(pbdev->fh & FH_MASK_ENABLE)) {
DPRINTF("pcistb no pci dev fh 0x%x\n", fh);
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
@@ -743,7 +743,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar)
}
pbdev = s390_pci_find_dev_by_fh(fh);
- if (!pbdev || !(pbdev->fh & FH_ENABLED)) {
+ if (!pbdev || !(pbdev->fh & FH_MASK_ENABLE)) {
DPRINTF("mpcifc no pci dev fh 0x%x\n", fh);
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
@@ -873,7 +873,7 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar)
((uint32_t)pbdev->sum << 7) | pbdev->routes.adapter.summary_offset;
stl_p(&fib.data, data);
- if (pbdev->fh & FH_ENABLED) {
+ if (pbdev->fh & FH_MASK_ENABLE) {
fib.fc |= 0x80;
}
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 05/17] s390x/pci: refactor s390_pci_find_dev_by_fh
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (3 preceding siblings ...)
2016-06-24 13:28 ` [Qemu-devel] [PATCH 04/17] s390x/pci: unify FH_ macros Cornelia Huck
@ 2016-06-24 13:28 ` Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 06/17] s390x/pci: enforce zPCI state checking Cornelia Huck
` (14 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:28 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Because this function is called very frequently, we should use a more
effective way to find the zpci device. So we use the FH's index to get
the device directly.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 7111587..1b83772 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -198,19 +198,12 @@ S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)
S390PCIBusDevice *s390_pci_find_dev_by_fh(uint32_t fh)
{
- S390PCIBusDevice *pbdev;
- int i;
S390pciState *s = s390_get_phb();
+ S390PCIBusDevice *pbdev;
- if (!fh) {
- return NULL;
- }
-
- for (i = 0; i < PCI_SLOT_MAX; i++) {
- pbdev = &s->pbdev[i];
- if (pbdev->fh == fh) {
- return pbdev;
- }
+ pbdev = &s->pbdev[fh & FH_MASK_INDEX];
+ if (pbdev->fh != 0 && pbdev->fh == fh) {
+ return pbdev;
}
return NULL;
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 06/17] s390x/pci: enforce zPCI state checking
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (4 preceding siblings ...)
2016-06-24 13:28 ` [Qemu-devel] [PATCH 05/17] s390x/pci: refactor s390_pci_find_dev_by_fh Cornelia Huck
@ 2016-06-24 13:28 ` Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 07/17] s390x/pci: introduce S390PCIBus Cornelia Huck
` (13 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:28 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Current code uses some fields combinatorially to indicate the state of
a s390 pci device. This patch introduces device states in order to make
the code more readable and more logical.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 104 +++++++++++++++--------------
hw/s390x/s390-pci-bus.h | 34 +++++++++-
hw/s390x/s390-pci-inst.c | 168 ++++++++++++++++++++++++++++++++++++++---------
hw/s390x/s390-pci-inst.h | 5 ++
include/hw/s390x/sclp.h | 1 +
5 files changed, 230 insertions(+), 82 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 1b83772..0f6fcef 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -116,16 +116,22 @@ void s390_pci_sclp_configure(SCCB *sccb)
goto out;
}
- if (pbdev) {
- if (pbdev->configured) {
- rc = SCLP_RC_NO_ACTION_REQUIRED;
- } else {
- pbdev->configured = true;
- rc = SCLP_RC_NORMAL_COMPLETION;
- }
- } else {
+ if (!pbdev) {
DPRINTF("sclp config no dev found\n");
rc = SCLP_RC_ADAPTER_ID_NOT_RECOGNIZED;
+ goto out;
+ }
+
+ switch (pbdev->state) {
+ case ZPCI_FS_RESERVED:
+ rc = SCLP_RC_ADAPTER_IN_RESERVED_STATE;
+ break;
+ case ZPCI_FS_STANDBY:
+ pbdev->state = ZPCI_FS_DISABLED;
+ rc = SCLP_RC_NORMAL_COMPLETION;
+ break;
+ default:
+ rc = SCLP_RC_NO_ACTION_REQUIRED;
}
out:
psccb->header.response_code = cpu_to_be16(rc);
@@ -142,22 +148,28 @@ void s390_pci_sclp_deconfigure(SCCB *sccb)
goto out;
}
- if (pbdev) {
- if (!pbdev->configured) {
- rc = SCLP_RC_NO_ACTION_REQUIRED;
- } else {
- if (pbdev->summary_ind) {
- pci_dereg_irqs(pbdev);
- }
- if (pbdev->iommu_enabled) {
- pci_dereg_ioat(pbdev);
- }
- pbdev->configured = false;
- rc = SCLP_RC_NORMAL_COMPLETION;
- }
- } else {
+ if (!pbdev) {
DPRINTF("sclp deconfig no dev found\n");
rc = SCLP_RC_ADAPTER_ID_NOT_RECOGNIZED;
+ goto out;
+ }
+
+ switch (pbdev->state) {
+ case ZPCI_FS_RESERVED:
+ rc = SCLP_RC_ADAPTER_IN_RESERVED_STATE;
+ break;
+ case ZPCI_FS_STANDBY:
+ rc = SCLP_RC_NO_ACTION_REQUIRED;
+ break;
+ default:
+ if (pbdev->summary_ind) {
+ pci_dereg_irqs(pbdev);
+ }
+ if (pbdev->iommu_enabled) {
+ pci_dereg_ioat(pbdev);
+ }
+ pbdev->state = ZPCI_FS_STANDBY;
+ rc = SCLP_RC_NORMAL_COMPLETION;
}
out:
psccb->header.response_code = cpu_to_be16(rc);
@@ -183,7 +195,7 @@ S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)
for (i = 0; i < PCI_SLOT_MAX; i++) {
pbdev = &s->pbdev[i];
- if (pbdev->fh == 0) {
+ if (pbdev->state == ZPCI_FS_RESERVED) {
continue;
}
@@ -233,9 +245,8 @@ static void s390_pci_generate_plug_event(uint16_t pec, uint32_t fh,
s390_pci_generate_event(2, pec, fh, fid, 0, 0);
}
-static void s390_pci_generate_error_event(uint16_t pec, uint32_t fh,
- uint32_t fid, uint64_t faddr,
- uint32_t e)
+void s390_pci_generate_error_event(uint16_t pec, uint32_t fh, uint32_t fid,
+ uint64_t faddr, uint32_t e)
{
s390_pci_generate_event(1, pec, fh, fid, faddr, e);
}
@@ -337,8 +348,14 @@ static IOMMUTLBEntry s390_translate_iommu(MemoryRegion *iommu, hwaddr addr,
.perm = IOMMU_NONE,
};
- if (!pbdev->configured || !pbdev->pdev ||
- !(pbdev->fh & FH_MASK_ENABLE) || !pbdev->iommu_enabled) {
+ switch (pbdev->state) {
+ case ZPCI_FS_ENABLED:
+ case ZPCI_FS_BLOCKED:
+ if (!pbdev->iommu_enabled) {
+ return ret;
+ }
+ break;
+ default:
return ret;
}
@@ -357,30 +374,13 @@ static IOMMUTLBEntry s390_translate_iommu(MemoryRegion *iommu, hwaddr addr,
return ret;
}
- if (!pbdev->g_iota) {
- pbdev->error_state = true;
- pbdev->lgstg_blocked = true;
- s390_pci_generate_error_event(ERR_EVENT_INVALAS, pbdev->fh, pbdev->fid,
- addr, 0);
- return ret;
- }
-
if (addr < pbdev->pba || addr > pbdev->pal) {
- pbdev->error_state = true;
- pbdev->lgstg_blocked = true;
- s390_pci_generate_error_event(ERR_EVENT_OORANGE, pbdev->fh, pbdev->fid,
- addr, 0);
return ret;
}
pte = s390_guest_io_table_walk(s390_pci_get_table_origin(pbdev->g_iota),
addr);
-
if (!pte) {
- pbdev->error_state = true;
- pbdev->lgstg_blocked = true;
- s390_pci_generate_error_event(ERR_EVENT_SERR, pbdev->fh, pbdev->fid,
- addr, ERR_EVENT_Q_BIT);
return ret;
}
@@ -449,7 +449,7 @@ static void s390_msi_ctrl_write(void *opaque, hwaddr addr, uint64_t data,
return;
}
- if (!(pbdev->fh & FH_MASK_ENABLE)) {
+ if (pbdev->state != ZPCI_FS_ENABLED) {
return;
}
@@ -571,7 +571,7 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,
pbdev->fid = s390_pci_get_pfid(pci_dev);
pbdev->pdev = pci_dev;
- pbdev->configured = true;
+ pbdev->state = ZPCI_FS_DISABLED;
pbdev->fh = s390_pci_get_pfh(pci_dev);
s390_pcihost_setup_msix(pbdev);
@@ -592,8 +592,12 @@ static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev,
->qbus.parent);
S390PCIBusDevice *pbdev = &s->pbdev[PCI_SLOT(pci_dev->devfn)];
- if (pbdev->configured) {
- pbdev->configured = false;
+ switch (pbdev->state) {
+ case ZPCI_FS_RESERVED:
+ goto out;
+ case ZPCI_FS_STANDBY:
+ break;
+ default:
s390_pci_generate_plug_event(HP_EVENT_CONFIGURED_TO_STBRES,
pbdev->fh, pbdev->fid);
}
@@ -603,6 +607,8 @@ static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev,
pbdev->fh = 0;
pbdev->fid = 0;
pbdev->pdev = NULL;
+ pbdev->state = ZPCI_FS_RESERVED;
+out:
object_unparent(OBJECT(pci_dev));
}
diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h
index 5cf7926..e332f6a 100644
--- a/hw/s390x/s390-pci-bus.h
+++ b/hw/s390x/s390-pci-bus.h
@@ -153,6 +153,34 @@ enum ZpciIoatDtype {
#define ZPCI_TABLE_VALID_MASK 0x20
#define ZPCI_TABLE_PROT_MASK 0x200
+/* PCI Function States
+ *
+ * reserved: default; device has just been plugged or is in progress of being
+ * unplugged
+ * standby: device is present but not configured; transition from any
+ * configured state/to this state via sclp configure/deconfigure
+ *
+ * The following states make up the "configured" meta-state:
+ * disabled: device is configured but not enabled; transition between this
+ * state and enabled via clp enable/disable
+ * enbaled: device is ready for use; transition to disabled via clp disable;
+ * may enter an error state
+ * blocked: ignore all DMA and interrupts; transition back to enabled or from
+ * error state via mpcifc
+ * error: an error occured; transition back to enabled via mpcifc
+ * permanent error: an unrecoverable error occured; transition to standby via
+ * sclp deconfigure
+ */
+typedef enum {
+ ZPCI_FS_RESERVED,
+ ZPCI_FS_STANDBY,
+ ZPCI_FS_DISABLED,
+ ZPCI_FS_ENABLED,
+ ZPCI_FS_BLOCKED,
+ ZPCI_FS_ERROR,
+ ZPCI_FS_PERMANENT_ERROR,
+} ZpciState;
+
typedef struct SeiContainer {
QTAILQ_ENTRY(SeiContainer) link;
uint32_t fid;
@@ -219,9 +247,7 @@ typedef struct S390MsixInfo {
typedef struct S390PCIBusDevice {
PCIDevice *pdev;
- bool configured;
- bool error_state;
- bool lgstg_blocked;
+ ZpciState state;
bool iommu_enabled;
uint32_t fh;
uint32_t fid;
@@ -255,6 +281,8 @@ void s390_pci_sclp_configure(SCCB *sccb);
void s390_pci_sclp_deconfigure(SCCB *sccb);
void s390_pci_iommu_enable(S390PCIBusDevice *pbdev);
void s390_pci_iommu_disable(S390PCIBusDevice *pbdev);
+void s390_pci_generate_error_event(uint16_t pec, uint32_t fh, uint32_t fid,
+ uint64_t faddr, uint32_t e);
S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx);
S390PCIBusDevice *s390_pci_find_dev_by_fh(uint32_t fh);
S390PCIBusDevice *s390_pci_find_dev_by_fid(uint32_t fid);
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 8b68824..744f435 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -108,8 +108,9 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
pci_get_word(pbdev->pdev->config + PCI_DEVICE_ID));
stw_p(&rrb->response.fh_list[idx - resume_token].vendor_id,
pci_get_word(pbdev->pdev->config + PCI_VENDOR_ID));
+ /* Ignore RESERVED devices. */
stl_p(&rrb->response.fh_list[idx - resume_token].config,
- pbdev->configured << 31);
+ pbdev->state == ZPCI_FS_STANDBY ? 0 : 1 << 31);
stl_p(&rrb->response.fh_list[idx - resume_token].fid, pbdev->fid);
stl_p(&rrb->response.fh_list[idx - resume_token].fh, pbdev->fh);
@@ -213,13 +214,13 @@ int clp_service_call(S390CPU *cpu, uint8_t r2)
switch (reqsetpci->oc) {
case CLP_SET_ENABLE_PCI_FN:
pbdev->fh |= FH_MASK_ENABLE;
+ pbdev->state = ZPCI_FS_ENABLED;
stl_p(&ressetpci->fh, pbdev->fh);
stw_p(&ressetpci->hdr.rsp, CLP_RC_OK);
break;
case CLP_SET_DISABLE_PCI_FN:
pbdev->fh &= ~FH_MASK_ENABLE;
- pbdev->error_state = false;
- pbdev->lgstg_blocked = false;
+ pbdev->state = ZPCI_FS_DISABLED;
stl_p(&ressetpci->fh, pbdev->fh);
stw_p(&ressetpci->hdr.rsp, CLP_RC_OK);
break;
@@ -318,16 +319,25 @@ int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2)
offset = env->regs[r2 + 1];
pbdev = s390_pci_find_dev_by_fh(fh);
- if (!pbdev || !(pbdev->fh & FH_MASK_ENABLE)) {
+ if (!pbdev) {
DPRINTF("pcilg no pci dev\n");
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
}
- if (pbdev->lgstg_blocked) {
+ switch (pbdev->state) {
+ case ZPCI_FS_RESERVED:
+ case ZPCI_FS_STANDBY:
+ case ZPCI_FS_DISABLED:
+ case ZPCI_FS_PERMANENT_ERROR:
+ setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
+ return 0;
+ case ZPCI_FS_ERROR:
setcc(cpu, ZPCI_PCI_LS_ERR);
s390_set_status_code(env, r2, ZPCI_PCI_ST_BLOCKED);
return 0;
+ default:
+ break;
}
if (pcias < 6) {
@@ -435,16 +445,25 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2)
offset = env->regs[r2 + 1];
pbdev = s390_pci_find_dev_by_fh(fh);
- if (!pbdev || !(pbdev->fh & FH_MASK_ENABLE)) {
+ if (!pbdev) {
DPRINTF("pcistg no pci dev\n");
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
}
- if (pbdev->lgstg_blocked) {
+ switch (pbdev->state) {
+ case ZPCI_FS_RESERVED:
+ case ZPCI_FS_STANDBY:
+ case ZPCI_FS_DISABLED:
+ case ZPCI_FS_PERMANENT_ERROR:
+ setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
+ return 0;
+ case ZPCI_FS_ERROR:
setcc(cpu, ZPCI_PCI_LS_ERR);
s390_set_status_code(env, r2, ZPCI_PCI_ST_BLOCKED);
return 0;
+ default:
+ break;
}
data = env->regs[r1];
@@ -526,18 +545,55 @@ int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2)
end = start + env->regs[r2 + 1];
pbdev = s390_pci_find_dev_by_fh(fh);
- if (!pbdev || !(pbdev->fh & FH_MASK_ENABLE)) {
+ if (!pbdev) {
DPRINTF("rpcit no pci dev\n");
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
goto out;
}
+ switch (pbdev->state) {
+ case ZPCI_FS_RESERVED:
+ case ZPCI_FS_STANDBY:
+ case ZPCI_FS_DISABLED:
+ case ZPCI_FS_PERMANENT_ERROR:
+ setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
+ return 0;
+ case ZPCI_FS_ERROR:
+ setcc(cpu, ZPCI_PCI_LS_ERR);
+ s390_set_status_code(env, r1, ZPCI_MOD_ST_ERROR_RECOVER);
+ return 0;
+ default:
+ break;
+ }
+
+ if (!pbdev->g_iota) {
+ pbdev->state = ZPCI_FS_ERROR;
+ setcc(cpu, ZPCI_PCI_LS_ERR);
+ s390_set_status_code(env, r1, ZPCI_PCI_ST_INSUF_RES);
+ s390_pci_generate_error_event(ERR_EVENT_INVALAS, pbdev->fh, pbdev->fid,
+ start, 0);
+ goto out;
+ }
+
+ if (end < pbdev->pba || start > pbdev->pal) {
+ pbdev->state = ZPCI_FS_ERROR;
+ setcc(cpu, ZPCI_PCI_LS_ERR);
+ s390_set_status_code(env, r1, ZPCI_PCI_ST_INSUF_RES);
+ s390_pci_generate_error_event(ERR_EVENT_OORANGE, pbdev->fh, pbdev->fid,
+ start, 0);
+ goto out;
+ }
+
mr = &pbdev->iommu_mr;
while (start < end) {
entry = mr->iommu_ops->translate(mr, start, 0);
if (!entry.translated_addr) {
+ pbdev->state = ZPCI_FS_ERROR;
setcc(cpu, ZPCI_PCI_LS_ERR);
+ s390_set_status_code(env, r1, ZPCI_PCI_ST_INSUF_RES);
+ s390_pci_generate_error_event(ERR_EVENT_SERR, pbdev->fh, pbdev->fid,
+ start, ERR_EVENT_Q_BIT);
goto out;
}
@@ -590,16 +646,25 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr,
}
pbdev = s390_pci_find_dev_by_fh(fh);
- if (!pbdev || !(pbdev->fh & FH_MASK_ENABLE)) {
+ if (!pbdev) {
DPRINTF("pcistb no pci dev fh 0x%x\n", fh);
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
}
- if (pbdev->lgstg_blocked) {
+ switch (pbdev->state) {
+ case ZPCI_FS_RESERVED:
+ case ZPCI_FS_STANDBY:
+ case ZPCI_FS_DISABLED:
+ case ZPCI_FS_PERMANENT_ERROR:
+ setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
+ return 0;
+ case ZPCI_FS_ERROR:
setcc(cpu, ZPCI_PCI_LS_ERR);
s390_set_status_code(env, r1, ZPCI_PCI_ST_BLOCKED);
return 0;
+ default:
+ break;
}
mr = pbdev->pdev->io_regions[pcias].memory;
@@ -743,12 +808,23 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar)
}
pbdev = s390_pci_find_dev_by_fh(fh);
- if (!pbdev || !(pbdev->fh & FH_MASK_ENABLE)) {
+ if (!pbdev) {
DPRINTF("mpcifc no pci dev fh 0x%x\n", fh);
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
}
+ switch (pbdev->state) {
+ case ZPCI_FS_RESERVED:
+ case ZPCI_FS_STANDBY:
+ case ZPCI_FS_DISABLED:
+ case ZPCI_FS_PERMANENT_ERROR:
+ setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
+ return 0;
+ default:
+ break;
+ }
+
if (s390_cpu_virt_mem_read(cpu, fiba, ar, (uint8_t *)&fib, sizeof(fib))) {
return 0;
}
@@ -815,11 +891,25 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar)
}
break;
case ZPCI_MOD_FC_RESET_ERROR:
- pbdev->error_state = false;
- pbdev->lgstg_blocked = false;
+ switch (pbdev->state) {
+ case ZPCI_FS_BLOCKED:
+ case ZPCI_FS_ERROR:
+ pbdev->state = ZPCI_FS_ENABLED;
+ break;
+ default:
+ cc = ZPCI_PCI_LS_ERR;
+ s390_set_status_code(env, r1, ZPCI_MOD_ST_SEQUENCE);
+ }
break;
case ZPCI_MOD_FC_RESET_BLOCK:
- pbdev->lgstg_blocked = false;
+ switch (pbdev->state) {
+ case ZPCI_FS_ERROR:
+ pbdev->state = ZPCI_FS_BLOCKED;
+ break;
+ default:
+ cc = ZPCI_PCI_LS_ERR;
+ s390_set_status_code(env, r1, ZPCI_MOD_ST_SEQUENCE);
+ }
break;
case ZPCI_MOD_FC_SET_MEASURE:
pbdev->fmb_addr = ldq_p(&fib.fmb_addr);
@@ -861,6 +951,39 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar)
}
memset(&fib, 0, sizeof(fib));
+
+ switch (pbdev->state) {
+ case ZPCI_FS_RESERVED:
+ case ZPCI_FS_STANDBY:
+ setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
+ return 0;
+ case ZPCI_FS_DISABLED:
+ if (fh & FH_MASK_ENABLE) {
+ setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
+ return 0;
+ }
+ goto out;
+ /* BLOCKED bit is set to one coincident with the setting of ERROR bit.
+ * FH Enabled bit is set to one in states of ENABLED, BLOCKED or ERROR. */
+ case ZPCI_FS_ERROR:
+ fib.fc |= 0x20;
+ case ZPCI_FS_BLOCKED:
+ fib.fc |= 0x40;
+ case ZPCI_FS_ENABLED:
+ fib.fc |= 0x80;
+ if (pbdev->iommu_enabled) {
+ fib.fc |= 0x10;
+ }
+ if (!(fh & FH_MASK_ENABLE)) {
+ env->regs[r1] |= 1ULL << 63;
+ }
+ break;
+ case ZPCI_FS_PERMANENT_ERROR:
+ setcc(cpu, ZPCI_PCI_LS_ERR);
+ s390_set_status_code(env, r1, ZPCI_STPCIFC_ST_PERM_ERROR);
+ return 0;
+ }
+
stq_p(&fib.pba, pbdev->pba);
stq_p(&fib.pal, pbdev->pal);
stq_p(&fib.iota, pbdev->g_iota);
@@ -873,22 +996,7 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar)
((uint32_t)pbdev->sum << 7) | pbdev->routes.adapter.summary_offset;
stl_p(&fib.data, data);
- if (pbdev->fh & FH_MASK_ENABLE) {
- fib.fc |= 0x80;
- }
-
- if (pbdev->error_state) {
- fib.fc |= 0x40;
- }
-
- if (pbdev->lgstg_blocked) {
- fib.fc |= 0x20;
- }
-
- if (pbdev->g_iota) {
- fib.fc |= 0x10;
- }
-
+out:
if (s390_cpu_virt_mem_write(cpu, fiba, ar, (uint8_t *)&fib, sizeof(fib))) {
return 0;
}
diff --git a/hw/s390x/s390-pci-inst.h b/hw/s390x/s390-pci-inst.h
index b084f23..c35f337 100644
--- a/hw/s390x/s390-pci-inst.h
+++ b/hw/s390x/s390-pci-inst.h
@@ -249,6 +249,11 @@ typedef struct ClpReqRspQueryPciGrp {
#define ZPCI_MOD_FC_RESET_BLOCK 9
#define ZPCI_MOD_FC_SET_MEASURE 10
+/* Store PCI Function Controls status codes */
+#define ZPCI_STPCIFC_ST_PERM_ERROR 8
+#define ZPCI_STPCIFC_ST_INVAL_DMAAS 28
+#define ZPCI_STPCIFC_ST_ERROR_RECOVER 40
+
/* FIB function controls */
#define ZPCI_FIB_FC_ENABLED 0x80
#define ZPCI_FIB_FC_ERROR 0x40
diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h
index b0c71b5..fbf357d 100644
--- a/include/hw/s390x/sclp.h
+++ b/include/hw/s390x/sclp.h
@@ -58,6 +58,7 @@
#define SCLP_RC_CONTAINED_EQUIPMENT_CHECK 0x0340
#define SCLP_RC_INSUFFICIENT_SCCB_LENGTH 0x0300
#define SCLP_RC_STANDBY_READ_COMPLETION 0x0410
+#define SCLP_RC_ADAPTER_IN_RESERVED_STATE 0x05f0
#define SCLP_RC_ADAPTER_ID_NOT_RECOGNIZED 0x09f0
#define SCLP_RC_INVALID_FUNCTION 0x40f0
#define SCLP_RC_NO_EVENT_BUFFERS_STORED 0x60f0
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 07/17] s390x/pci: introduce S390PCIBus
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (5 preceding siblings ...)
2016-06-24 13:28 ` [Qemu-devel] [PATCH 06/17] s390x/pci: enforce zPCI state checking Cornelia Huck
@ 2016-06-24 13:28 ` Cornelia Huck
2016-06-28 14:39 ` Marcel Apfelbaum
2016-06-24 13:28 ` [Qemu-devel] [PATCH 08/17] s390x/pci: introduce S390PCIIOMMU Cornelia Huck
` (12 subsequent siblings)
19 siblings, 1 reply; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:28 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
To enable S390PCIBusDevice as qdev, there should be a new bus to
plug and manage all instances of S390PCIBusDevice. Due to this,
S390PCIBus is introduced.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 10 ++++++++++
hw/s390x/s390-pci-bus.h | 8 ++++++++
2 files changed, 18 insertions(+)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 0f6fcef..0c67c1e 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -527,6 +527,9 @@ static int s390_pcihost_init(SysBusDevice *dev)
bus = BUS(b);
qbus_set_hotplug_handler(bus, DEVICE(dev), NULL);
phb->bus = b;
+
+ s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL));
+
QTAILQ_INIT(&s->pending_sei);
return 0;
}
@@ -636,9 +639,16 @@ static const TypeInfo s390_pcihost_info = {
}
};
+static const TypeInfo s390_pcibus_info = {
+ .name = TYPE_S390_PCI_BUS,
+ .parent = TYPE_BUS,
+ .instance_size = sizeof(S390PCIBus),
+};
+
static void s390_pci_register_types(void)
{
type_register_static(&s390_pcihost_info);
+ type_register_static(&s390_pcibus_info);
}
type_init(s390_pci_register_types)
diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h
index e332f6a..c4d4079 100644
--- a/hw/s390x/s390-pci-bus.h
+++ b/hw/s390x/s390-pci-bus.h
@@ -21,6 +21,7 @@
#include "hw/s390x/css.h"
#define TYPE_S390_PCI_HOST_BRIDGE "s390-pcihost"
+#define TYPE_S390_PCI_BUS "s390-pcibus"
#define FH_MASK_ENABLE 0x80000000
#define FH_MASK_INSTANCE 0x7f000000
#define FH_MASK_SHM 0x00ff0000
@@ -31,6 +32,8 @@
#define S390_PCI_HOST_BRIDGE(obj) \
OBJECT_CHECK(S390pciState, (obj), TYPE_S390_PCI_HOST_BRIDGE)
+#define S390_PCI_BUS(obj) \
+ OBJECT_CHECK(S390PCIBus, (obj), TYPE_S390_PCI_BUS)
#define HP_EVENT_TO_CONFIGURED 0x0301
#define HP_EVENT_RESERVED_TO_STANDBY 0x0302
@@ -267,8 +270,13 @@ typedef struct S390PCIBusDevice {
IndAddr *indicator;
} S390PCIBusDevice;
+typedef struct S390PCIBus {
+ BusState qbus;
+} S390PCIBus;
+
typedef struct S390pciState {
PCIHostState parent_obj;
+ S390PCIBus *bus;
S390PCIBusDevice pbdev[PCI_SLOT_MAX];
AddressSpace msix_notify_as;
MemoryRegion msix_notify_mr;
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 08/17] s390x/pci: introduce S390PCIIOMMU
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (6 preceding siblings ...)
2016-06-24 13:28 ` [Qemu-devel] [PATCH 07/17] s390x/pci: introduce S390PCIBus Cornelia Huck
@ 2016-06-24 13:28 ` Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 09/17] s390x/pci: introduce S390PCIBusDevice qdev Cornelia Huck
` (11 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:28 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Currently each zpci device holds its own DMA address space and memory
region. At the same time, all instances of zpci device are stored in
S390pciState. So duirng the initialization of S390pciState, all zpci
devices are created and then all DMA address spaces are created. Thus,
when initializing pci devices, their corresponding DMA address spaces
could be found.
But zpci qdev will be introduced later. Zpci device may be initialized
and plugged afterwards generic pci device. So we should initialize all
DMA address spaces and memory regions before initializing zpci devices.
We introduce a new struct named S390PCIIOMMU. And a new field of
S390pciState, which is an array to store all instances of S390PCIIOMMU,
is added so that qemu pci code could find the corresponding DMA
address space when initializing a generic pci device. And this should
be done before the connection of a zpci device and a generic pci
device is built.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Acked-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 19 +++++++++++--------
hw/s390x/s390-pci-bus.h | 9 +++++++--
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 0c67c1e..af3263f 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -406,7 +406,7 @@ static AddressSpace *s390_pci_dma_iommu(PCIBus *bus, void *opaque, int devfn)
{
S390pciState *s = opaque;
- return &s->pbdev[PCI_SLOT(devfn)].as;
+ return &s->iommu[PCI_SLOT(devfn)]->as;
}
static uint8_t set_ind_atomic(uint64_t ind_loc, uint8_t to_be_set)
@@ -478,15 +478,15 @@ static const MemoryRegionOps s390_msi_ctrl_ops = {
void s390_pci_iommu_enable(S390PCIBusDevice *pbdev)
{
- memory_region_init_iommu(&pbdev->iommu_mr, OBJECT(&pbdev->mr),
+ memory_region_init_iommu(&pbdev->iommu_mr, OBJECT(&pbdev->iommu->mr),
&s390_iommu_ops, "iommu-s390", pbdev->pal + 1);
- memory_region_add_subregion(&pbdev->mr, 0, &pbdev->iommu_mr);
+ memory_region_add_subregion(&pbdev->iommu->mr, 0, &pbdev->iommu_mr);
pbdev->iommu_enabled = true;
}
void s390_pci_iommu_disable(S390PCIBusDevice *pbdev)
{
- memory_region_del_subregion(&pbdev->mr, &pbdev->iommu_mr);
+ memory_region_del_subregion(&pbdev->iommu->mr, &pbdev->iommu_mr);
object_unparent(OBJECT(&pbdev->iommu_mr));
pbdev->iommu_enabled = false;
}
@@ -494,13 +494,15 @@ void s390_pci_iommu_disable(S390PCIBusDevice *pbdev)
static void s390_pcihost_init_as(S390pciState *s)
{
int i;
- S390PCIBusDevice *pbdev;
+ S390PCIIOMMU *iommu;
for (i = 0; i < PCI_SLOT_MAX; i++) {
- pbdev = &s->pbdev[i];
- memory_region_init(&pbdev->mr, OBJECT(s),
+ iommu = g_malloc0(sizeof(S390PCIIOMMU));
+ memory_region_init(&iommu->mr, OBJECT(s),
"iommu-root-s390", UINT64_MAX);
- address_space_init(&pbdev->as, &pbdev->mr, "iommu-pci");
+ address_space_init(&iommu->as, &iommu->mr, "iommu-pci");
+
+ s->iommu[i] = iommu;
}
memory_region_init_io(&s->msix_notify_mr, OBJECT(s),
@@ -576,6 +578,7 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,
pbdev->pdev = pci_dev;
pbdev->state = ZPCI_FS_DISABLED;
pbdev->fh = s390_pci_get_pfh(pci_dev);
+ pbdev->iommu = s->iommu[PCI_SLOT(pci_dev->devfn)];
s390_pcihost_setup_msix(pbdev);
diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h
index c4d4079..ea1efcc 100644
--- a/hw/s390x/s390-pci-bus.h
+++ b/hw/s390x/s390-pci-bus.h
@@ -248,6 +248,11 @@ typedef struct S390MsixInfo {
uint32_t pba_offset;
} S390MsixInfo;
+typedef struct S390PCIIOMMU {
+ AddressSpace as;
+ MemoryRegion mr;
+} S390PCIIOMMU;
+
typedef struct S390PCIBusDevice {
PCIDevice *pdev;
ZpciState state;
@@ -263,8 +268,7 @@ typedef struct S390PCIBusDevice {
uint8_t sum;
S390MsixInfo msix;
AdapterRoutes routes;
- AddressSpace as;
- MemoryRegion mr;
+ S390PCIIOMMU *iommu;
MemoryRegion iommu_mr;
IndAddr *summary_ind;
IndAddr *indicator;
@@ -278,6 +282,7 @@ typedef struct S390pciState {
PCIHostState parent_obj;
S390PCIBus *bus;
S390PCIBusDevice pbdev[PCI_SLOT_MAX];
+ S390PCIIOMMU *iommu[PCI_SLOT_MAX];
AddressSpace msix_notify_as;
MemoryRegion msix_notify_mr;
QTAILQ_HEAD(, SeiContainer) pending_sei;
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 09/17] s390x/pci: introduce S390PCIBusDevice qdev
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (7 preceding siblings ...)
2016-06-24 13:28 ` [Qemu-devel] [PATCH 08/17] s390x/pci: introduce S390PCIIOMMU Cornelia Huck
@ 2016-06-24 13:28 ` Cornelia Huck
2016-06-28 14:49 ` Marcel Apfelbaum
2016-06-24 13:28 ` [Qemu-devel] [PATCH 10/17] s390x/pci: enable uid-checking Cornelia Huck
` (10 subsequent siblings)
19 siblings, 1 reply; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:28 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
To support definitions of s390 pci attributes in Qemu cmdline, we have
to make current S390PCIBusDevice struct inherit DeviceState and add
three properties for it. Currently we only support definitions of uid
and fid.
'uid' is optionally defined by users, identifies a zpci device and
must be defined with a 16-bit and non-zero unique value.
'fid' ranges from 0x0 to 0xFFFFFFFF. For fid property, we introduce a
new PropertyInfo by the name of s390_pci_fid_propinfo with our special
setter and getter. As 'fid' is optional, introduce 'fid_defined' to
track whether the user specified a fid.
'target' field is to direct qemu to find the corresponding generic PCI
device. It is equal to the 'id' value of one of generic pci devices.
If the user doesn't specify 'id' parameter for a generic pci device,
its 'id' value will be generated automatically and use this value as
'target' to create an associated zpci device.
If the user did not specify 'uid' or 'fid', values are generated
automatically. 'target' is required.
In addition, if a pci device has no associated zpci device, the code
will generate a zpci device automatically for it.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 257 ++++++++++++++++++++++++++++++++++++++++++++++--
hw/s390x/s390-pci-bus.h | 12 ++-
2 files changed, 261 insertions(+), 8 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index af3263f..8e0f707 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -12,6 +12,8 @@
*/
#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qapi/visitor.h"
#include "qemu-common.h"
#include "cpu.h"
#include "s390-pci-bus.h"
@@ -96,8 +98,8 @@ S390PCIBusDevice *s390_pci_find_dev_by_fid(uint32_t fid)
S390pciState *s = s390_get_phb();
for (i = 0; i < PCI_SLOT_MAX; i++) {
- pbdev = &s->pbdev[i];
- if ((pbdev->fh != 0) && (pbdev->fid == fid)) {
+ pbdev = s->pbdev[i];
+ if (pbdev && pbdev->fid == fid) {
return pbdev;
}
}
@@ -185,6 +187,50 @@ static uint32_t s390_pci_get_pfh(PCIDevice *pdev)
return PCI_SLOT(pdev->devfn) | FH_SHM_VFIO;
}
+static S390PCIBusDevice *s390_pci_find_dev_by_uid(uint16_t uid)
+{
+ int i;
+ S390PCIBusDevice *pbdev;
+ S390pciState *s = s390_get_phb();
+
+ for (i = 0; i < PCI_SLOT_MAX; i++) {
+ pbdev = s->pbdev[i];
+ if (!pbdev) {
+ continue;
+ }
+
+ if (pbdev->uid == uid) {
+ return pbdev;
+ }
+ }
+
+ return NULL;
+}
+
+static S390PCIBusDevice *s390_pci_find_dev_by_target(const char *target)
+{
+ int i;
+ S390PCIBusDevice *pbdev;
+ S390pciState *s = s390_get_phb();
+
+ if (!target) {
+ return NULL;
+ }
+
+ for (i = 0; i < PCI_SLOT_MAX; i++) {
+ pbdev = s->pbdev[i];
+ if (!pbdev) {
+ continue;
+ }
+
+ if (!strcmp(pbdev->target, target)) {
+ return pbdev;
+ }
+ }
+
+ return NULL;
+}
+
S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)
{
S390PCIBusDevice *pbdev;
@@ -193,7 +239,10 @@ S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)
S390pciState *s = s390_get_phb();
for (i = 0; i < PCI_SLOT_MAX; i++) {
- pbdev = &s->pbdev[i];
+ pbdev = s->pbdev[i];
+ if (!pbdev) {
+ continue;
+ }
if (pbdev->state == ZPCI_FS_RESERVED) {
continue;
@@ -213,8 +262,8 @@ S390PCIBusDevice *s390_pci_find_dev_by_fh(uint32_t fh)
S390pciState *s = s390_get_phb();
S390PCIBusDevice *pbdev;
- pbdev = &s->pbdev[fh & FH_MASK_INDEX];
- if (pbdev->fh != 0 && pbdev->fh == fh) {
+ pbdev = s->pbdev[fh & FH_MASK_INDEX];
+ if (pbdev && pbdev->fh == fh) {
return pbdev;
}
@@ -564,6 +613,22 @@ static int s390_pcihost_setup_msix(S390PCIBusDevice *pbdev)
return 0;
}
+static S390PCIBusDevice *s390_pci_device_new(const char *target)
+{
+ DeviceState *dev = NULL;
+ S390pciState *s = s390_get_phb();
+
+ dev = qdev_try_create(BUS(s->bus), TYPE_S390_PCI_DEVICE);
+ if (!dev) {
+ return NULL;
+ }
+
+ qdev_prop_set_string(dev, "target", target);
+ qdev_init_nofail(dev);
+
+ return S390_PCI_DEVICE(dev);
+}
+
static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
@@ -572,8 +637,24 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,
S390pciState *s = S390_PCI_HOST_BRIDGE(pci_device_root_bus(pci_dev)
->qbus.parent);
- pbdev = &s->pbdev[PCI_SLOT(pci_dev->devfn)];
+ if (!dev->id) {
+ /* In the case the PCI device does not define an id */
+ /* we generate one based on the PCI address */
+ dev->id = g_strdup_printf("auto_%02x:%02x.%01x",
+ pci_bus_num(pci_dev->bus),
+ PCI_SLOT(pci_dev->devfn),
+ PCI_FUNC(pci_dev->devfn));
+ }
+
+ pbdev = s390_pci_find_dev_by_target(dev->id);
+ if (!pbdev) {
+ pbdev = s390_pci_device_new(dev->id);
+ if (!pbdev) {
+ error_setg(errp, "create zpci device failed");
+ }
+ }
+ s->pbdev[PCI_SLOT(pci_dev->devfn)] = pbdev;
pbdev->fid = s390_pci_get_pfid(pci_dev);
pbdev->pdev = pci_dev;
pbdev->state = ZPCI_FS_DISABLED;
@@ -596,7 +677,7 @@ static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev,
PCIDevice *pci_dev = PCI_DEVICE(dev);
S390pciState *s = S390_PCI_HOST_BRIDGE(pci_device_root_bus(pci_dev)
->qbus.parent);
- S390PCIBusDevice *pbdev = &s->pbdev[PCI_SLOT(pci_dev->devfn)];
+ S390PCIBusDevice *pbdev = s->pbdev[PCI_SLOT(pci_dev->devfn)];
switch (pbdev->state) {
case ZPCI_FS_RESERVED:
@@ -648,10 +729,172 @@ static const TypeInfo s390_pcibus_info = {
.instance_size = sizeof(S390PCIBus),
};
+static uint16_t s390_pci_generate_uid(void)
+{
+ uint16_t uid = 0;
+
+ do {
+ uid++;
+ if (!s390_pci_find_dev_by_uid(uid)) {
+ return uid;
+ }
+ } while (uid < ZPCI_MAX_UID);
+
+ return UID_UNDEFINED;
+}
+
+static uint32_t s390_pci_generate_fid(Error **errp)
+{
+ uint32_t fid = 0;
+
+ while (fid <= ZPCI_MAX_FID) {
+ if (!s390_pci_find_dev_by_fid(fid)) {
+ return fid;
+ }
+
+ if (fid == ZPCI_MAX_FID) {
+ break;
+ }
+
+ fid++;
+ }
+
+ error_setg(errp, "no free fid could be found");
+ return 0;
+}
+
+static void s390_pci_device_realize(DeviceState *dev, Error **errp)
+{
+ S390PCIBusDevice *zpci = S390_PCI_DEVICE(dev);
+
+ if (!zpci->target) {
+ error_setg(errp, "target must be defined");
+ return;
+ }
+
+ if (s390_pci_find_dev_by_target(zpci->target)) {
+ error_setg(errp, "target %s already has an associated zpci device",
+ zpci->target);
+ return;
+ }
+
+ if (zpci->uid == UID_UNDEFINED) {
+ zpci->uid = s390_pci_generate_uid();
+ if (!zpci->uid) {
+ error_setg(errp, "no free uid could be found");
+ return;
+ }
+ } else if (s390_pci_find_dev_by_uid(zpci->uid)) {
+ error_setg(errp, "uid %u already in use", zpci->uid);
+ return;
+ }
+
+ if (!zpci->fid_defined) {
+ Error *local_error = NULL;
+
+ zpci->fid = s390_pci_generate_fid(&local_error);
+ if (local_error) {
+ error_propagate(errp, local_error);
+ return;
+ }
+ } else if (s390_pci_find_dev_by_fid(zpci->fid)) {
+ error_setg(errp, "fid %u already in use", zpci->fid);
+ return;
+ }
+
+ zpci->state = ZPCI_FS_RESERVED;
+}
+
+static void s390_pci_device_reset(DeviceState *dev)
+{
+ S390PCIBusDevice *pbdev = S390_PCI_DEVICE(dev);
+
+ switch (pbdev->state) {
+ case ZPCI_FS_RESERVED:
+ return;
+ case ZPCI_FS_STANDBY:
+ break;
+ default:
+ pbdev->fh &= ~FH_MASK_ENABLE;
+ pbdev->state = ZPCI_FS_DISABLED;
+ break;
+ }
+
+ if (pbdev->summary_ind) {
+ pci_dereg_irqs(pbdev);
+ }
+ if (pbdev->iommu_enabled) {
+ pci_dereg_ioat(pbdev);
+ }
+
+ pbdev->fmb_addr = 0;
+}
+
+static void s390_pci_get_fid(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ Property *prop = opaque;
+ uint32_t *ptr = qdev_get_prop_ptr(DEVICE(obj), prop);
+
+ visit_type_uint32(v, name, ptr, errp);
+}
+
+static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ DeviceState *dev = DEVICE(obj);
+ S390PCIBusDevice *zpci = S390_PCI_DEVICE(obj);
+ Property *prop = opaque;
+ uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
+
+ if (dev->realized) {
+ qdev_prop_set_after_realize(dev, name, errp);
+ return;
+ }
+
+ visit_type_uint32(v, name, ptr, errp);
+ zpci->fid_defined = true;
+}
+
+static PropertyInfo s390_pci_fid_propinfo = {
+ .name = "zpci_fid",
+ .get = s390_pci_get_fid,
+ .set = s390_pci_set_fid,
+};
+
+#define DEFINE_PROP_S390_PCI_FID(_n, _s, _f) \
+ DEFINE_PROP(_n, _s, _f, s390_pci_fid_propinfo, uint32_t)
+
+static Property s390_pci_device_properties[] = {
+ DEFINE_PROP_UINT16("uid", S390PCIBusDevice, uid, UID_UNDEFINED),
+ DEFINE_PROP_S390_PCI_FID("fid", S390PCIBusDevice, fid),
+ DEFINE_PROP_STRING("target", S390PCIBusDevice, target),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
+static void s390_pci_device_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+
+ dc->desc = "zpci device";
+ dc->reset = s390_pci_device_reset;
+ dc->bus_type = TYPE_S390_PCI_BUS;
+ dc->realize = s390_pci_device_realize;
+ dc->props = s390_pci_device_properties;
+}
+
+static const TypeInfo s390_pci_device_info = {
+ .name = TYPE_S390_PCI_DEVICE,
+ .parent = TYPE_DEVICE,
+ .instance_size = sizeof(S390PCIBusDevice),
+ .class_init = s390_pci_device_class_init,
+};
+
static void s390_pci_register_types(void)
{
type_register_static(&s390_pcihost_info);
type_register_static(&s390_pcibus_info);
+ type_register_static(&s390_pci_device_info);
}
type_init(s390_pci_register_types)
diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h
index ea1efcc..658bda5 100644
--- a/hw/s390x/s390-pci-bus.h
+++ b/hw/s390x/s390-pci-bus.h
@@ -22,6 +22,7 @@
#define TYPE_S390_PCI_HOST_BRIDGE "s390-pcihost"
#define TYPE_S390_PCI_BUS "s390-pcibus"
+#define TYPE_S390_PCI_DEVICE "zpci"
#define FH_MASK_ENABLE 0x80000000
#define FH_MASK_INSTANCE 0x7f000000
#define FH_MASK_SHM 0x00ff0000
@@ -29,11 +30,16 @@
#define FH_SHM_VFIO 0x00010000
#define FH_SHM_EMUL 0x00020000
#define S390_PCIPT_ADAPTER 2
+#define ZPCI_MAX_FID 0xffffffff
+#define ZPCI_MAX_UID 0xffff
+#define UID_UNDEFINED 0
#define S390_PCI_HOST_BRIDGE(obj) \
OBJECT_CHECK(S390pciState, (obj), TYPE_S390_PCI_HOST_BRIDGE)
#define S390_PCI_BUS(obj) \
OBJECT_CHECK(S390PCIBus, (obj), TYPE_S390_PCI_BUS)
+#define S390_PCI_DEVICE(obj) \
+ OBJECT_CHECK(S390PCIBusDevice, (obj), TYPE_S390_PCI_DEVICE)
#define HP_EVENT_TO_CONFIGURED 0x0301
#define HP_EVENT_RESERVED_TO_STANDBY 0x0302
@@ -254,11 +260,15 @@ typedef struct S390PCIIOMMU {
} S390PCIIOMMU;
typedef struct S390PCIBusDevice {
+ DeviceState qdev;
PCIDevice *pdev;
ZpciState state;
bool iommu_enabled;
+ char *target;
+ uint16_t uid;
uint32_t fh;
uint32_t fid;
+ bool fid_defined;
uint64_t g_iota;
uint64_t pba;
uint64_t pal;
@@ -281,7 +291,7 @@ typedef struct S390PCIBus {
typedef struct S390pciState {
PCIHostState parent_obj;
S390PCIBus *bus;
- S390PCIBusDevice pbdev[PCI_SLOT_MAX];
+ S390PCIBusDevice *pbdev[PCI_SLOT_MAX];
S390PCIIOMMU *iommu[PCI_SLOT_MAX];
AddressSpace msix_notify_as;
MemoryRegion msix_notify_mr;
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 10/17] s390x/pci: enable uid-checking
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (8 preceding siblings ...)
2016-06-24 13:28 ` [Qemu-devel] [PATCH 09/17] s390x/pci: introduce S390PCIBusDevice qdev Cornelia Huck
@ 2016-06-24 13:28 ` Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 11/17] s390x/pci: enable zpci hot-plug/hot-unplug Cornelia Huck
` (9 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:28 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
The uid-checking facility guarantees uniqueness of the uid within the
vm and exposes the real uid to the guest when listing pci devices.
Let's always enable it and present it to the guest in the response to
the list pci clp command.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.h | 1 +
hw/s390x/s390-pci-inst.c | 7 +++----
hw/s390x/s390-pci-inst.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h
index 658bda5..2d9150c 100644
--- a/hw/s390x/s390-pci-bus.h
+++ b/hw/s390x/s390-pci-bus.h
@@ -33,6 +33,7 @@
#define ZPCI_MAX_FID 0xffffffff
#define ZPCI_MAX_UID 0xffff
#define UID_UNDEFINED 0
+#define UID_CHECKING_ENABLED 0x01
#define S390_PCI_HOST_BRIDGE(obj) \
OBJECT_CHECK(S390pciState, (obj), TYPE_S390_PCI_HOST_BRIDGE)
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 744f435..c84d0eb 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -56,8 +56,7 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
}
if ((ldl_p(&rrb->request.fmt) & ~CLP_MASK_FMT) != 0 ||
- ldq_p(&rrb->request.reserved1) != 0 ||
- ldq_p(&rrb->request.reserved2) != 0) {
+ ldq_p(&rrb->request.reserved1) != 0) {
res_code = CLP_RC_RESNOT0;
rc = -EINVAL;
goto out;
@@ -91,9 +90,9 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
stl_p(&rrb->response.fmt, 0);
stq_p(&rrb->response.reserved1, 0);
- stq_p(&rrb->response.reserved2, 0);
stl_p(&rrb->response.mdd, FH_MASK_SHM);
stw_p(&rrb->response.max_fn, PCI_MAX_FUNCTIONS);
+ rrb->response.flags = UID_CHECKING_ENABLED;
rrb->response.entry_size = sizeof(ClpFhListEntry);
finish = 0;
idx = resume_token;
@@ -260,7 +259,7 @@ int clp_service_call(S390CPU *cpu, uint8_t r2)
stl_p(&resquery->fid, pbdev->fid);
stw_p(&resquery->pchid, 0);
stw_p(&resquery->ug, 1);
- stl_p(&resquery->uid, pbdev->fid);
+ stl_p(&resquery->uid, pbdev->uid);
stw_p(&resquery->hdr.rsp, CLP_RC_OK);
break;
}
diff --git a/hw/s390x/s390-pci-inst.h b/hw/s390x/s390-pci-inst.h
index c35f337..e1c2ee1 100644
--- a/hw/s390x/s390-pci-inst.h
+++ b/hw/s390x/s390-pci-inst.h
@@ -104,7 +104,7 @@ typedef struct ClpRspListPci {
uint64_t resume_token;
uint32_t mdd;
uint16_t max_fn;
- uint8_t reserved2;
+ uint8_t flags;
uint8_t entry_size;
ClpFhListEntry fh_list[CLP_FH_LIST_NR_ENTRIES];
} QEMU_PACKED ClpRspListPci;
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 11/17] s390x/pci: enable zpci hot-plug/hot-unplug
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (9 preceding siblings ...)
2016-06-24 13:28 ` [Qemu-devel] [PATCH 10/17] s390x/pci: enable uid-checking Cornelia Huck
@ 2016-06-24 13:29 ` Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 12/17] s390x/pci: add checkings in CLP_SET_PCI_FN Cornelia Huck
` (8 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:29 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
We need to support hot-plug/hot-unplug for the new zpci devices as
well. This patch enables the present hot-plug/hot-unplug handlers
to support not only generic pci devices but also zpci devices.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 119 +++++++++++++++++++++++++++++-------------------
1 file changed, 73 insertions(+), 46 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 8e0f707..57d5d14 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -177,16 +177,6 @@ out:
psccb->header.response_code = cpu_to_be16(rc);
}
-static uint32_t s390_pci_get_pfid(PCIDevice *pdev)
-{
- return PCI_SLOT(pdev->devfn);
-}
-
-static uint32_t s390_pci_get_pfh(PCIDevice *pdev)
-{
- return PCI_SLOT(pdev->devfn) | FH_SHM_VFIO;
-}
-
static S390PCIBusDevice *s390_pci_find_dev_by_uid(uint16_t uid)
{
int i;
@@ -580,6 +570,7 @@ static int s390_pcihost_init(SysBusDevice *dev)
phb->bus = b;
s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL));
+ qbus_set_hotplug_handler(BUS(s->bus), DEVICE(s), NULL);
QTAILQ_INIT(&s->pending_sei);
return 0;
@@ -632,52 +623,87 @@ static S390PCIBusDevice *s390_pci_device_new(const char *target)
static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
- PCIDevice *pci_dev = PCI_DEVICE(dev);
- S390PCIBusDevice *pbdev;
- S390pciState *s = S390_PCI_HOST_BRIDGE(pci_device_root_bus(pci_dev)
- ->qbus.parent);
+ PCIDevice *pdev = NULL;
+ S390PCIBusDevice *pbdev = NULL;
+ S390pciState *s = s390_get_phb();
- if (!dev->id) {
- /* In the case the PCI device does not define an id */
- /* we generate one based on the PCI address */
- dev->id = g_strdup_printf("auto_%02x:%02x.%01x",
- pci_bus_num(pci_dev->bus),
- PCI_SLOT(pci_dev->devfn),
- PCI_FUNC(pci_dev->devfn));
- }
+ if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
+ pdev = PCI_DEVICE(dev);
- pbdev = s390_pci_find_dev_by_target(dev->id);
- if (!pbdev) {
- pbdev = s390_pci_device_new(dev->id);
+ if (!dev->id) {
+ /* In the case the PCI device does not define an id */
+ /* we generate one based on the PCI address */
+ dev->id = g_strdup_printf("auto_%02x:%02x.%01x",
+ pci_bus_num(pdev->bus),
+ PCI_SLOT(pdev->devfn),
+ PCI_FUNC(pdev->devfn));
+ }
+
+ pbdev = s390_pci_find_dev_by_target(dev->id);
if (!pbdev) {
- error_setg(errp, "create zpci device failed");
+ pbdev = s390_pci_device_new(dev->id);
+ if (!pbdev) {
+ error_setg(errp, "create zpci device failed");
+ }
}
- }
- s->pbdev[PCI_SLOT(pci_dev->devfn)] = pbdev;
- pbdev->fid = s390_pci_get_pfid(pci_dev);
- pbdev->pdev = pci_dev;
- pbdev->state = ZPCI_FS_DISABLED;
- pbdev->fh = s390_pci_get_pfh(pci_dev);
- pbdev->iommu = s->iommu[PCI_SLOT(pci_dev->devfn)];
+ if (object_dynamic_cast(OBJECT(dev), "vfio-pci")) {
+ pbdev->fh |= FH_SHM_VFIO;
+ } else {
+ pbdev->fh |= FH_SHM_EMUL;
+ }
- s390_pcihost_setup_msix(pbdev);
+ pbdev->pdev = pdev;
+ pbdev->iommu = s->iommu[PCI_SLOT(pdev->devfn)];
+ pbdev->state = ZPCI_FS_STANDBY;
+ s390_pcihost_setup_msix(pbdev);
- if (dev->hotplugged) {
- s390_pci_generate_plug_event(HP_EVENT_RESERVED_TO_STANDBY,
- pbdev->fh, pbdev->fid);
- s390_pci_generate_plug_event(HP_EVENT_TO_CONFIGURED,
- pbdev->fh, pbdev->fid);
+ if (dev->hotplugged) {
+ s390_pci_generate_plug_event(HP_EVENT_RESERVED_TO_STANDBY,
+ pbdev->fh, pbdev->fid);
+ }
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_S390_PCI_DEVICE)) {
+ int idx;
+
+ pbdev = S390_PCI_DEVICE(dev);
+ for (idx = 0; idx < PCI_SLOT_MAX; idx++) {
+ if (!s->pbdev[idx]) {
+ s->pbdev[idx] = pbdev;
+ pbdev->fh = idx;
+ return;
+ }
+ }
+
+ error_setg(errp, "no slot for plugging zpci device");
}
}
static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
- PCIDevice *pci_dev = PCI_DEVICE(dev);
- S390pciState *s = S390_PCI_HOST_BRIDGE(pci_device_root_bus(pci_dev)
- ->qbus.parent);
- S390PCIBusDevice *pbdev = s->pbdev[PCI_SLOT(pci_dev->devfn)];
+ int i;
+ PCIDevice *pci_dev = NULL;
+ S390PCIBusDevice *pbdev = NULL;
+ S390pciState *s = s390_get_phb();
+
+ if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
+ pci_dev = PCI_DEVICE(dev);
+
+ for (i = 0 ; i < PCI_SLOT_MAX; i++) {
+ if (s->pbdev[i]->pdev == pci_dev) {
+ pbdev = s->pbdev[i];
+ break;
+ }
+ }
+
+ if (!pbdev) {
+ object_unparent(OBJECT(pci_dev));
+ return;
+ }
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_S390_PCI_DEVICE)) {
+ pbdev = S390_PCI_DEVICE(dev);
+ pci_dev = pbdev->pdev;
+ }
switch (pbdev->state) {
case ZPCI_FS_RESERVED:
@@ -691,12 +717,13 @@ static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev,
s390_pci_generate_plug_event(HP_EVENT_STANDBY_TO_RESERVED,
pbdev->fh, pbdev->fid);
- pbdev->fh = 0;
- pbdev->fid = 0;
+ object_unparent(OBJECT(pci_dev));
pbdev->pdev = NULL;
pbdev->state = ZPCI_FS_RESERVED;
out:
- object_unparent(OBJECT(pci_dev));
+ pbdev->fid = 0;
+ s->pbdev[pbdev->fh & FH_MASK_INDEX] = NULL;
+ object_unparent(OBJECT(pbdev));
}
static void s390_pcihost_class_init(ObjectClass *klass, void *data)
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 12/17] s390x/pci: add checkings in CLP_SET_PCI_FN
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (10 preceding siblings ...)
2016-06-24 13:29 ` [Qemu-devel] [PATCH 11/17] s390x/pci: enable zpci hot-plug/hot-unplug Cornelia Huck
@ 2016-06-24 13:29 ` Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 13/17] s390x/pci: refactor s390_pci_find_dev_by_idx Cornelia Huck
` (7 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:29 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
The code in CLP_SET_PCI_FN case misses some checkings. Let's add
them.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-inst.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index c84d0eb..8b4f4d4 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -212,12 +212,33 @@ int clp_service_call(S390CPU *cpu, uint8_t r2)
switch (reqsetpci->oc) {
case CLP_SET_ENABLE_PCI_FN:
+ switch (reqsetpci->ndas) {
+ case 0:
+ stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_DMAAS);
+ goto out;
+ case 1:
+ break;
+ default:
+ stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_RES);
+ goto out;
+ }
+
+ if (pbdev->fh & FH_MASK_ENABLE) {
+ stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP);
+ goto out;
+ }
+
pbdev->fh |= FH_MASK_ENABLE;
pbdev->state = ZPCI_FS_ENABLED;
stl_p(&ressetpci->fh, pbdev->fh);
stw_p(&ressetpci->hdr.rsp, CLP_RC_OK);
break;
case CLP_SET_DISABLE_PCI_FN:
+ if (!(pbdev->fh & FH_MASK_ENABLE)) {
+ stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP);
+ goto out;
+ }
+ device_reset(DEVICE(pbdev));
pbdev->fh &= ~FH_MASK_ENABLE;
pbdev->state = ZPCI_FS_DISABLED;
stl_p(&ressetpci->fh, pbdev->fh);
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 13/17] s390x/pci: refactor s390_pci_find_dev_by_idx
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (11 preceding siblings ...)
2016-06-24 13:29 ` [Qemu-devel] [PATCH 12/17] s390x/pci: add checkings in CLP_SET_PCI_FN Cornelia Huck
@ 2016-06-24 13:29 ` Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 14/17] s390x/pci: refactor list_pci Cornelia Huck
` (6 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:29 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
s390_find_dev_by_idx() only indexes usable zpci devices. It implies
that the index value of each zpci device is dynamic and may change if
a new zpci device is plugged. So we have to use a constant index to
look up the device.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 57d5d14..9e24268 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -223,28 +223,9 @@ static S390PCIBusDevice *s390_pci_find_dev_by_target(const char *target)
S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)
{
- S390PCIBusDevice *pbdev;
- int i;
- int j = 0;
S390pciState *s = s390_get_phb();
- for (i = 0; i < PCI_SLOT_MAX; i++) {
- pbdev = s->pbdev[i];
- if (!pbdev) {
- continue;
- }
-
- if (pbdev->state == ZPCI_FS_RESERVED) {
- continue;
- }
-
- if (j == idx) {
- return pbdev;
- }
- j++;
- }
-
- return NULL;
+ return s->pbdev[idx & FH_MASK_INDEX];
}
S390PCIBusDevice *s390_pci_find_dev_by_fh(uint32_t fh)
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 14/17] s390x/pci: refactor list_pci
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (12 preceding siblings ...)
2016-06-24 13:29 ` [Qemu-devel] [PATCH 13/17] s390x/pci: refactor s390_pci_find_dev_by_idx Cornelia Huck
@ 2016-06-24 13:29 ` Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 15/17] s390x/pci: fix stpcifc_service_call Cornelia Huck
` (5 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:29 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Because of the refactor of s390_pci_find_dev_by_idx(), list_pci()
should be updated. We introduce a new function to get the next
available zpci device. It simplifies the code of looking up zpci
devices.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Acked-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 20 +++++++++++++++++++
hw/s390x/s390-pci-bus.h | 1 +
hw/s390x/s390-pci-inst.c | 50 +++++++++++++++++++++++-------------------------
3 files changed, 45 insertions(+), 26 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 9e24268..f930b04 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -91,6 +91,26 @@ int chsc_sei_nt2_have_event(void)
return !QTAILQ_EMPTY(&s->pending_sei);
}
+S390PCIBusDevice *s390_pci_find_next_avail_dev(S390PCIBusDevice *pbdev)
+{
+ int idx = 0;
+ S390PCIBusDevice *dev = NULL;
+ S390pciState *s = s390_get_phb();
+
+ if (pbdev) {
+ idx = (pbdev->fh & FH_MASK_INDEX) + 1;
+ }
+
+ for (; idx < PCI_SLOT_MAX; idx++) {
+ dev = s->pbdev[idx];
+ if (dev && dev->state != ZPCI_FS_RESERVED) {
+ return dev;
+ }
+ }
+
+ return NULL;
+}
+
S390PCIBusDevice *s390_pci_find_dev_by_fid(uint32_t fid)
{
S390PCIBusDevice *pbdev;
diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h
index 2d9150c..71cdd7a 100644
--- a/hw/s390x/s390-pci-bus.h
+++ b/hw/s390x/s390-pci-bus.h
@@ -310,5 +310,6 @@ void s390_pci_generate_error_event(uint16_t pec, uint32_t fh, uint32_t fid,
S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx);
S390PCIBusDevice *s390_pci_find_dev_by_fh(uint32_t fh);
S390PCIBusDevice *s390_pci_find_dev_by_fid(uint32_t fid);
+S390PCIBusDevice *s390_pci_find_next_avail_dev(S390PCIBusDevice *pbdev);
#endif
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 8b4f4d4..70db835 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -37,9 +37,9 @@ static void s390_set_status_code(CPUS390XState *env,
static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
{
- S390PCIBusDevice *pbdev;
- uint32_t res_code, initial_l2, g_l2, finish;
- int rc, idx;
+ S390PCIBusDevice *pbdev = NULL;
+ uint32_t res_code, initial_l2, g_l2;
+ int rc, i;
uint64_t resume_token;
rc = 0;
@@ -71,6 +71,8 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
rc = -EINVAL;
goto out;
}
+ } else {
+ pbdev = s390_pci_find_next_avail_dev(NULL);
}
if (lduw_p(&rrb->response.hdr.len) < 48) {
@@ -94,40 +96,36 @@ static int list_pci(ClpReqRspListPci *rrb, uint8_t *cc)
stw_p(&rrb->response.max_fn, PCI_MAX_FUNCTIONS);
rrb->response.flags = UID_CHECKING_ENABLED;
rrb->response.entry_size = sizeof(ClpFhListEntry);
- finish = 0;
- idx = resume_token;
+
+ i = 0;
g_l2 = LIST_PCI_HDR_LEN;
- do {
- pbdev = s390_pci_find_dev_by_idx(idx);
- if (!pbdev) {
- finish = 1;
- break;
- }
- stw_p(&rrb->response.fh_list[idx - resume_token].device_id,
+ while (g_l2 < initial_l2 && pbdev) {
+ stw_p(&rrb->response.fh_list[i].device_id,
pci_get_word(pbdev->pdev->config + PCI_DEVICE_ID));
- stw_p(&rrb->response.fh_list[idx - resume_token].vendor_id,
+ stw_p(&rrb->response.fh_list[i].vendor_id,
pci_get_word(pbdev->pdev->config + PCI_VENDOR_ID));
/* Ignore RESERVED devices. */
- stl_p(&rrb->response.fh_list[idx - resume_token].config,
+ stl_p(&rrb->response.fh_list[i].config,
pbdev->state == ZPCI_FS_STANDBY ? 0 : 1 << 31);
- stl_p(&rrb->response.fh_list[idx - resume_token].fid, pbdev->fid);
- stl_p(&rrb->response.fh_list[idx - resume_token].fh, pbdev->fh);
+ stl_p(&rrb->response.fh_list[i].fid, pbdev->fid);
+ stl_p(&rrb->response.fh_list[i].fh, pbdev->fh);
g_l2 += sizeof(ClpFhListEntry);
/* Add endian check for DPRINTF? */
DPRINTF("g_l2 %d vendor id 0x%x device id 0x%x fid 0x%x fh 0x%x\n",
- g_l2,
- lduw_p(&rrb->response.fh_list[idx - resume_token].vendor_id),
- lduw_p(&rrb->response.fh_list[idx - resume_token].device_id),
- ldl_p(&rrb->response.fh_list[idx - resume_token].fid),
- ldl_p(&rrb->response.fh_list[idx - resume_token].fh));
- idx++;
- } while (g_l2 < initial_l2);
-
- if (finish == 1) {
+ g_l2,
+ lduw_p(&rrb->response.fh_list[i].vendor_id),
+ lduw_p(&rrb->response.fh_list[i].device_id),
+ ldl_p(&rrb->response.fh_list[i].fid),
+ ldl_p(&rrb->response.fh_list[i].fh));
+ pbdev = s390_pci_find_next_avail_dev(pbdev);
+ i++;
+ }
+
+ if (!pbdev) {
resume_token = 0;
} else {
- resume_token = idx;
+ resume_token = pbdev->fh & FH_MASK_INDEX;
}
stq_p(&rrb->response.resume_token, resume_token);
stw_p(&rrb->response.hdr.len, g_l2);
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 15/17] s390x/pci: fix stpcifc_service_call
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (13 preceding siblings ...)
2016-06-24 13:29 ` [Qemu-devel] [PATCH 14/17] s390x/pci: refactor list_pci Cornelia Huck
@ 2016-06-24 13:29 ` Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 16/17] s390x/pci: replace fid with idx in msg data of msix Cornelia Huck
` (4 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:29 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Firstly the function misses dmaas checking. This patch adds it.
Secondly the function uses s390_pci_find_dev_by_fh() to look up the
zpci device. This may fail if the guest provides a valid and disabled
fh but fh of the associated zpci device is enabled. Thus we use
s390_pci_find_dev_by_idx() instead.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-inst.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 70db835..37572df 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -944,6 +944,7 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar)
int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar)
{
CPUS390XState *env = &cpu->env;
+ uint8_t dmaas;
uint32_t fh;
ZpciFib fib;
S390PCIBusDevice *pbdev;
@@ -956,13 +957,20 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar)
}
fh = env->regs[r1] >> 32;
+ dmaas = (env->regs[r1] >> 16) & 0xff;
+
+ if (dmaas) {
+ setcc(cpu, ZPCI_PCI_LS_ERR);
+ s390_set_status_code(env, r1, ZPCI_STPCIFC_ST_INVAL_DMAAS);
+ return 0;
+ }
if (fiba & 0x7) {
program_interrupt(env, PGM_SPECIFICATION, 6);
return 0;
}
- pbdev = s390_pci_find_dev_by_fh(fh);
+ pbdev = s390_pci_find_dev_by_idx(fh & FH_MASK_INDEX);
if (!pbdev) {
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 16/17] s390x/pci: replace fid with idx in msg data of msix
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (14 preceding siblings ...)
2016-06-24 13:29 ` [Qemu-devel] [PATCH 15/17] s390x/pci: fix stpcifc_service_call Cornelia Huck
@ 2016-06-24 13:29 ` Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 17/17] s390x/pci: make hot-unplug handler smoother Cornelia Huck
` (3 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:29 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Present code uses fid as the part of message data of msix for looking
up the specific zpci device. However it limits the usable range of fid,
and the code looking up the zpci device may fail due to truncation of
the fid.
In addition, fh is composed of enabled bit, FH_VIRT and the array index.
So we can use the array index as the identifier to store in msg data.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 8 ++++----
hw/s390x/s390-pci-inst.c | 3 ++-
target-s390x/kvm.c | 4 ++--
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index f930b04..630a826 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -474,18 +474,18 @@ static void s390_msi_ctrl_write(void *opaque, hwaddr addr, uint64_t data,
{
S390PCIBusDevice *pbdev;
uint32_t io_int_word;
- uint32_t fid = data >> ZPCI_MSI_VEC_BITS;
+ uint32_t idx = data >> ZPCI_MSI_VEC_BITS;
uint32_t vec = data & ZPCI_MSI_VEC_MASK;
uint64_t ind_bit;
uint32_t sum_bit;
uint32_t e = 0;
- DPRINTF("write_msix data 0x%" PRIx64 " fid %d vec 0x%x\n", data, fid, vec);
+ DPRINTF("write_msix data 0x%" PRIx64 " idx %d vec 0x%x\n", data, idx, vec);
- pbdev = s390_pci_find_dev_by_fid(fid);
+ pbdev = s390_pci_find_dev_by_idx(idx);
if (!pbdev) {
e |= (vec << ERR_EVENT_MVN_OFFSET);
- s390_pci_generate_error_event(ERR_EVENT_NOMSI, 0, fid, addr, e);
+ s390_pci_generate_error_event(ERR_EVENT_NOMSI, idx, 0, addr, e);
return;
}
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 37572df..331bc4c 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -419,7 +419,8 @@ static void update_msix_table_msg_data(S390PCIBusDevice *pbdev, uint64_t offset,
msg_data = (uint8_t *)data - offset % PCI_MSIX_ENTRY_SIZE +
PCI_MSIX_ENTRY_VECTOR_CTRL;
- val = pci_get_long(msg_data) | (pbdev->fid << ZPCI_MSI_VEC_BITS);
+ val = pci_get_long(msg_data) |
+ ((pbdev->fh & FH_MASK_INDEX) << ZPCI_MSI_VEC_BITS);
pci_set_long(msg_data, val);
DPRINTF("update msix msg_data to 0x%" PRIx64 "\n", *data);
}
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 45e94ca..2991bff 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -2246,10 +2246,10 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
uint64_t address, uint32_t data, PCIDevice *dev)
{
S390PCIBusDevice *pbdev;
- uint32_t fid = data >> ZPCI_MSI_VEC_BITS;
+ uint32_t idx = data >> ZPCI_MSI_VEC_BITS;
uint32_t vec = data & ZPCI_MSI_VEC_MASK;
- pbdev = s390_pci_find_dev_by_fid(fid);
+ pbdev = s390_pci_find_dev_by_idx(idx);
if (!pbdev) {
DPRINTF("add_msi_route no dev\n");
return -ENODEV;
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [Qemu-devel] [PATCH 17/17] s390x/pci: make hot-unplug handler smoother
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (15 preceding siblings ...)
2016-06-24 13:29 ` [Qemu-devel] [PATCH 16/17] s390x/pci: replace fid with idx in msg data of msix Cornelia Huck
@ 2016-06-24 13:29 ` Cornelia Huck
2016-06-28 14:33 ` [Qemu-devel] [PATCH 00/17] s390x: the big pci update Marcel Apfelbaum
` (2 subsequent siblings)
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-24 13:29 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin, Cornelia Huck
From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
The current implementation of hot-unplug handler is abrupt. Any pci
operation will be just rejected if pci device is unconfigured. Thus a
pci device can not be reset or destroyed in a right, smooth and safe
way.
Improve this as follows:
- Notify the guest via a HP_EVENT_DECONFIGURE_REQUEST(0x303) event in
the unplug handler, giving it a chance to deconfigure the device via
sclp and allowing us to continue hot-unplug afterwards.
- Set up a timer that will generate the HP_EVENT_CONFIGURE_TO_STBRES
(0x304) event as before if the guest did not react after an adequate
time.
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/s390-pci-bus.c | 35 ++++++++++++++++++++++++++++++++++-
hw/s390x/s390-pci-bus.h | 3 +++
2 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 630a826..640a4ea 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -192,6 +192,10 @@ void s390_pci_sclp_deconfigure(SCCB *sccb)
}
pbdev->state = ZPCI_FS_STANDBY;
rc = SCLP_RC_NORMAL_COMPLETION;
+
+ if (pbdev->release_timer) {
+ qdev_unplug(DEVICE(pbdev->pdev), NULL);
+ }
}
out:
psccb->header.response_code = cpu_to_be16(rc);
@@ -679,6 +683,23 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,
}
}
+static void s390_pcihost_timer_cb(void *opaque)
+{
+ S390PCIBusDevice *pbdev = opaque;
+
+ if (pbdev->summary_ind) {
+ pci_dereg_irqs(pbdev);
+ }
+ if (pbdev->iommu_enabled) {
+ pci_dereg_ioat(pbdev);
+ }
+
+ pbdev->state = ZPCI_FS_STANDBY;
+ s390_pci_generate_plug_event(HP_EVENT_CONFIGURED_TO_STBRES,
+ pbdev->fh, pbdev->fid);
+ qdev_unplug(DEVICE(pbdev), NULL);
+}
+
static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
@@ -712,8 +733,20 @@ static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev,
case ZPCI_FS_STANDBY:
break;
default:
- s390_pci_generate_plug_event(HP_EVENT_CONFIGURED_TO_STBRES,
+ s390_pci_generate_plug_event(HP_EVENT_DECONFIGURE_REQUEST,
pbdev->fh, pbdev->fid);
+ pbdev->release_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
+ s390_pcihost_timer_cb,
+ pbdev);
+ timer_mod(pbdev->release_timer,
+ qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + HOT_UNPLUG_TIMEOUT);
+ return;
+ }
+
+ if (pbdev->release_timer && timer_pending(pbdev->release_timer)) {
+ timer_del(pbdev->release_timer);
+ timer_free(pbdev->release_timer);
+ pbdev->release_timer = NULL;
}
s390_pci_generate_plug_event(HP_EVENT_STANDBY_TO_RESERVED,
diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h
index 71cdd7a..f1fbd3c 100644
--- a/hw/s390x/s390-pci-bus.h
+++ b/hw/s390x/s390-pci-bus.h
@@ -34,6 +34,7 @@
#define ZPCI_MAX_UID 0xffff
#define UID_UNDEFINED 0
#define UID_CHECKING_ENABLED 0x01
+#define HOT_UNPLUG_TIMEOUT (NANOSECONDS_PER_SECOND * 60 * 5)
#define S390_PCI_HOST_BRIDGE(obj) \
OBJECT_CHECK(S390pciState, (obj), TYPE_S390_PCI_HOST_BRIDGE)
@@ -44,6 +45,7 @@
#define HP_EVENT_TO_CONFIGURED 0x0301
#define HP_EVENT_RESERVED_TO_STANDBY 0x0302
+#define HP_EVENT_DECONFIGURE_REQUEST 0x0303
#define HP_EVENT_CONFIGURED_TO_STBRES 0x0304
#define HP_EVENT_STANDBY_TO_RESERVED 0x0308
@@ -283,6 +285,7 @@ typedef struct S390PCIBusDevice {
MemoryRegion iommu_mr;
IndAddr *summary_ind;
IndAddr *indicator;
+ QEMUTimer *release_timer;
} S390PCIBusDevice;
typedef struct S390PCIBus {
--
2.9.0
^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [Qemu-devel] [PATCH 00/17] s390x: the big pci update
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (16 preceding siblings ...)
2016-06-24 13:29 ` [Qemu-devel] [PATCH 17/17] s390x/pci: make hot-unplug handler smoother Cornelia Huck
@ 2016-06-28 14:33 ` Marcel Apfelbaum
2016-06-28 15:02 ` Cornelia Huck
2016-07-01 12:59 ` Cornelia Huck
2016-07-05 13:51 ` Cornelia Huck
19 siblings, 1 reply; 30+ messages in thread
From: Marcel Apfelbaum @ 2016-06-28 14:33 UTC (permalink / raw)
To: Cornelia Huck, qemu-devel; +Cc: mst, borntraeger, agraf, jfrei, zyimin
On 06/24/2016 04:28 PM, Cornelia Huck wrote:
> We had been looking at remodelling the pci representation for s390x
> to handle our slightly odd architecture correctly some time ago
> already, but now we have a patchset that we're happy with.
>
> There's a bunch of bugfixes, cleanups and architecture conformance
> changes in there, but the most interesting part is the modelling
> (which, in some respects, takes a cue from what sPAPR does).
>
> We introduce a 'zpci' device to hold s390x-specific properties like
> the uid and fid. This 'zpci' device is connected to a run-of-the-mill
> pci device via the 'target' property.
>
> Example command line portion:
>
> -device zpci,uid=1,fid=1,target=vpci0 \
> -device vfio-pci,host=0000:00:00.0,id=vpci0 \
> -device zpci,target=vpci1 \
> -device vfio-pci,host=0001:00:00.0,id=vpci1 \
> -device vfio-pci,host=0002:00:00.0,id=vpci2
>
> For device vpci0, uid and fid are specified in the associated zpci
> device.
> For device vpci1, uid and fid are automatically generated.
> For device vpci2, first an associated zpci device is generated and
> then autogenerated values for uid and fid are placed in it.
>
> This should accomodate both specifying our special parameters and
> re-using standard statements for pci devices.
[...]
You can still specify
> bus/slot/function for the pci device, but it will not be propagated
> into the guest (as the s390 pci architecture does not allow for it;
> the guest only sees uid/fid).
>
Hi,
Please excuse my lack of s390 knowledge, but I find hard to understand
how it works. If using bus/slot/function is not an option,
how can one access the configuration space? This configuration is not PCI compliant?
Thanks,
Marcel
[...]
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [Qemu-devel] [PATCH 07/17] s390x/pci: introduce S390PCIBus
2016-06-24 13:28 ` [Qemu-devel] [PATCH 07/17] s390x/pci: introduce S390PCIBus Cornelia Huck
@ 2016-06-28 14:39 ` Marcel Apfelbaum
2016-06-28 15:20 ` Cornelia Huck
0 siblings, 1 reply; 30+ messages in thread
From: Marcel Apfelbaum @ 2016-06-28 14:39 UTC (permalink / raw)
To: Cornelia Huck, qemu-devel; +Cc: mst, borntraeger, agraf, jfrei, zyimin
On 06/24/2016 04:28 PM, Cornelia Huck wrote:
> From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
>
> To enable S390PCIBusDevice as qdev, there should be a new bus to
> plug and manage all instances of S390PCIBusDevice. Due to this,
> S390PCIBus is introduced.
>
> Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
> Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> ---
> hw/s390x/s390-pci-bus.c | 10 ++++++++++
> hw/s390x/s390-pci-bus.h | 8 ++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> index 0f6fcef..0c67c1e 100644
> --- a/hw/s390x/s390-pci-bus.c
> +++ b/hw/s390x/s390-pci-bus.c
> @@ -527,6 +527,9 @@ static int s390_pcihost_init(SysBusDevice *dev)
> bus = BUS(b);
> qbus_set_hotplug_handler(bus, DEVICE(dev), NULL);
> phb->bus = b;
> +
> + s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL));
> +
> QTAILQ_INIT(&s->pending_sei);
> return 0;
> }
> @@ -636,9 +639,16 @@ static const TypeInfo s390_pcihost_info = {
> }
> };
>
> +static const TypeInfo s390_pcibus_info = {
> + .name = TYPE_S390_PCI_BUS,
> + .parent = TYPE_BUS,
Hi,
The type is named TYPE_S390_PCI_BUS, but does not
derive from PCI_BUS. I find it a little confusing, anyway is just a thought.
Maybe you should go with TYPE_S390_BUS.
Thanks,
Marcel
> + .instance_size = sizeof(S390PCIBus),
> +};
> +
> static void s390_pci_register_types(void)
> {
> type_register_static(&s390_pcihost_info);
> + type_register_static(&s390_pcibus_info);
> }
>
> type_init(s390_pci_register_types)
> diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h
> index e332f6a..c4d4079 100644
> --- a/hw/s390x/s390-pci-bus.h
> +++ b/hw/s390x/s390-pci-bus.h
> @@ -21,6 +21,7 @@
> #include "hw/s390x/css.h"
>
> #define TYPE_S390_PCI_HOST_BRIDGE "s390-pcihost"
> +#define TYPE_S390_PCI_BUS "s390-pcibus"
> #define FH_MASK_ENABLE 0x80000000
> #define FH_MASK_INSTANCE 0x7f000000
> #define FH_MASK_SHM 0x00ff0000
> @@ -31,6 +32,8 @@
>
> #define S390_PCI_HOST_BRIDGE(obj) \
> OBJECT_CHECK(S390pciState, (obj), TYPE_S390_PCI_HOST_BRIDGE)
> +#define S390_PCI_BUS(obj) \
> + OBJECT_CHECK(S390PCIBus, (obj), TYPE_S390_PCI_BUS)
>
> #define HP_EVENT_TO_CONFIGURED 0x0301
> #define HP_EVENT_RESERVED_TO_STANDBY 0x0302
> @@ -267,8 +270,13 @@ typedef struct S390PCIBusDevice {
> IndAddr *indicator;
> } S390PCIBusDevice;
>
> +typedef struct S390PCIBus {
> + BusState qbus;
> +} S390PCIBus;
> +
> typedef struct S390pciState {
> PCIHostState parent_obj;
> + S390PCIBus *bus;
> S390PCIBusDevice pbdev[PCI_SLOT_MAX];
> AddressSpace msix_notify_as;
> MemoryRegion msix_notify_mr;
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [Qemu-devel] [PATCH 09/17] s390x/pci: introduce S390PCIBusDevice qdev
2016-06-24 13:28 ` [Qemu-devel] [PATCH 09/17] s390x/pci: introduce S390PCIBusDevice qdev Cornelia Huck
@ 2016-06-28 14:49 ` Marcel Apfelbaum
2016-06-28 15:21 ` Cornelia Huck
0 siblings, 1 reply; 30+ messages in thread
From: Marcel Apfelbaum @ 2016-06-28 14:49 UTC (permalink / raw)
To: Cornelia Huck, qemu-devel; +Cc: mst, borntraeger, agraf, jfrei, zyimin
On 06/24/2016 04:28 PM, Cornelia Huck wrote:
> From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
>
> To support definitions of s390 pci attributes in Qemu cmdline, we have
> to make current S390PCIBusDevice struct inherit DeviceState and add
> three properties for it. Currently we only support definitions of uid
> and fid.
>
> 'uid' is optionally defined by users, identifies a zpci device and
> must be defined with a 16-bit and non-zero unique value.
>
> 'fid' ranges from 0x0 to 0xFFFFFFFF. For fid property, we introduce a
> new PropertyInfo by the name of s390_pci_fid_propinfo with our special
> setter and getter. As 'fid' is optional, introduce 'fid_defined' to
> track whether the user specified a fid.
>
> 'target' field is to direct qemu to find the corresponding generic PCI
> device. It is equal to the 'id' value of one of generic pci devices.
> If the user doesn't specify 'id' parameter for a generic pci device,
> its 'id' value will be generated automatically and use this value as
> 'target' to create an associated zpci device.
>
> If the user did not specify 'uid' or 'fid', values are generated
> automatically. 'target' is required.
>
> In addition, if a pci device has no associated zpci device, the code
> will generate a zpci device automatically for it.
>
> Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
> Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> ---
> hw/s390x/s390-pci-bus.c | 257 ++++++++++++++++++++++++++++++++++++++++++++++--
> hw/s390x/s390-pci-bus.h | 12 ++-
> 2 files changed, 261 insertions(+), 8 deletions(-)
>
> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> index af3263f..8e0f707 100644
> --- a/hw/s390x/s390-pci-bus.c
> +++ b/hw/s390x/s390-pci-bus.c
> @@ -12,6 +12,8 @@
> */
>
> #include "qemu/osdep.h"
> +#include "qapi/error.h"
> +#include "qapi/visitor.h"
> #include "qemu-common.h"
> #include "cpu.h"
> #include "s390-pci-bus.h"
> @@ -96,8 +98,8 @@ S390PCIBusDevice *s390_pci_find_dev_by_fid(uint32_t fid)
> S390pciState *s = s390_get_phb();
>
> for (i = 0; i < PCI_SLOT_MAX; i++) {
> - pbdev = &s->pbdev[i];
> - if ((pbdev->fh != 0) && (pbdev->fid == fid)) {
> + pbdev = s->pbdev[i];
> + if (pbdev && pbdev->fid == fid) {
> return pbdev;
> }
> }
> @@ -185,6 +187,50 @@ static uint32_t s390_pci_get_pfh(PCIDevice *pdev)
> return PCI_SLOT(pdev->devfn) | FH_SHM_VFIO;
> }
>
> +static S390PCIBusDevice *s390_pci_find_dev_by_uid(uint16_t uid)
> +{
> + int i;
> + S390PCIBusDevice *pbdev;
> + S390pciState *s = s390_get_phb();
> +
> + for (i = 0; i < PCI_SLOT_MAX; i++) {
> + pbdev = s->pbdev[i];
> + if (!pbdev) {
> + continue;
> + }
> +
> + if (pbdev->uid == uid) {
> + return pbdev;
> + }
> + }
> +
> + return NULL;
> +}
> +
> +static S390PCIBusDevice *s390_pci_find_dev_by_target(const char *target)
> +{
> + int i;
> + S390PCIBusDevice *pbdev;
> + S390pciState *s = s390_get_phb();
> +
> + if (!target) {
> + return NULL;
> + }
> +
> + for (i = 0; i < PCI_SLOT_MAX; i++) {
> + pbdev = s->pbdev[i];
> + if (!pbdev) {
> + continue;
> + }
> +
> + if (!strcmp(pbdev->target, target)) {
> + return pbdev;
> + }
> + }
> +
> + return NULL;
> +}
> +
> S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)
> {
> S390PCIBusDevice *pbdev;
> @@ -193,7 +239,10 @@ S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)
> S390pciState *s = s390_get_phb();
>
> for (i = 0; i < PCI_SLOT_MAX; i++) {
> - pbdev = &s->pbdev[i];
> + pbdev = s->pbdev[i];
> + if (!pbdev) {
> + continue;
> + }
>
> if (pbdev->state == ZPCI_FS_RESERVED) {
> continue;
> @@ -213,8 +262,8 @@ S390PCIBusDevice *s390_pci_find_dev_by_fh(uint32_t fh)
> S390pciState *s = s390_get_phb();
> S390PCIBusDevice *pbdev;
>
> - pbdev = &s->pbdev[fh & FH_MASK_INDEX];
> - if (pbdev->fh != 0 && pbdev->fh == fh) {
> + pbdev = s->pbdev[fh & FH_MASK_INDEX];
> + if (pbdev && pbdev->fh == fh) {
> return pbdev;
> }
>
> @@ -564,6 +613,22 @@ static int s390_pcihost_setup_msix(S390PCIBusDevice *pbdev)
> return 0;
> }
>
> +static S390PCIBusDevice *s390_pci_device_new(const char *target)
> +{
> + DeviceState *dev = NULL;
> + S390pciState *s = s390_get_phb();
> +
> + dev = qdev_try_create(BUS(s->bus), TYPE_S390_PCI_DEVICE);
> + if (!dev) {
> + return NULL;
> + }
> +
> + qdev_prop_set_string(dev, "target", target);
> + qdev_init_nofail(dev);
> +
> + return S390_PCI_DEVICE(dev);
> +}
> +
> static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,
> DeviceState *dev, Error **errp)
> {
> @@ -572,8 +637,24 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,
> S390pciState *s = S390_PCI_HOST_BRIDGE(pci_device_root_bus(pci_dev)
> ->qbus.parent);
>
> - pbdev = &s->pbdev[PCI_SLOT(pci_dev->devfn)];
> + if (!dev->id) {
> + /* In the case the PCI device does not define an id */
> + /* we generate one based on the PCI address */
> + dev->id = g_strdup_printf("auto_%02x:%02x.%01x",
> + pci_bus_num(pci_dev->bus),
> + PCI_SLOT(pci_dev->devfn),
> + PCI_FUNC(pci_dev->devfn));
> + }
> +
> + pbdev = s390_pci_find_dev_by_target(dev->id);
> + if (!pbdev) {
> + pbdev = s390_pci_device_new(dev->id);
> + if (!pbdev) {
> + error_setg(errp, "create zpci device failed");
> + }
> + }
>
> + s->pbdev[PCI_SLOT(pci_dev->devfn)] = pbdev;
> pbdev->fid = s390_pci_get_pfid(pci_dev);
> pbdev->pdev = pci_dev;
> pbdev->state = ZPCI_FS_DISABLED;
> @@ -596,7 +677,7 @@ static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev,
> PCIDevice *pci_dev = PCI_DEVICE(dev);
> S390pciState *s = S390_PCI_HOST_BRIDGE(pci_device_root_bus(pci_dev)
> ->qbus.parent);
> - S390PCIBusDevice *pbdev = &s->pbdev[PCI_SLOT(pci_dev->devfn)];
> + S390PCIBusDevice *pbdev = s->pbdev[PCI_SLOT(pci_dev->devfn)];
>
> switch (pbdev->state) {
> case ZPCI_FS_RESERVED:
> @@ -648,10 +729,172 @@ static const TypeInfo s390_pcibus_info = {
> .instance_size = sizeof(S390PCIBus),
> };
>
> +static uint16_t s390_pci_generate_uid(void)
> +{
> + uint16_t uid = 0;
> +
> + do {
> + uid++;
> + if (!s390_pci_find_dev_by_uid(uid)) {
> + return uid;
> + }
> + } while (uid < ZPCI_MAX_UID);
> +
> + return UID_UNDEFINED;
> +}
> +
> +static uint32_t s390_pci_generate_fid(Error **errp)
> +{
> + uint32_t fid = 0;
> +
> + while (fid <= ZPCI_MAX_FID) {
> + if (!s390_pci_find_dev_by_fid(fid)) {
> + return fid;
> + }
> +
> + if (fid == ZPCI_MAX_FID) {
> + break;
> + }
> +
> + fid++;
> + }
> +
> + error_setg(errp, "no free fid could be found");
> + return 0;
> +}
> +
> +static void s390_pci_device_realize(DeviceState *dev, Error **errp)
> +{
> + S390PCIBusDevice *zpci = S390_PCI_DEVICE(dev);
> +
> + if (!zpci->target) {
> + error_setg(errp, "target must be defined");
> + return;
> + }
> +
> + if (s390_pci_find_dev_by_target(zpci->target)) {
> + error_setg(errp, "target %s already has an associated zpci device",
> + zpci->target);
> + return;
> + }
> +
> + if (zpci->uid == UID_UNDEFINED) {
> + zpci->uid = s390_pci_generate_uid();
> + if (!zpci->uid) {
> + error_setg(errp, "no free uid could be found");
> + return;
> + }
> + } else if (s390_pci_find_dev_by_uid(zpci->uid)) {
> + error_setg(errp, "uid %u already in use", zpci->uid);
> + return;
> + }
> +
> + if (!zpci->fid_defined) {
> + Error *local_error = NULL;
> +
> + zpci->fid = s390_pci_generate_fid(&local_error);
> + if (local_error) {
> + error_propagate(errp, local_error);
> + return;
> + }
> + } else if (s390_pci_find_dev_by_fid(zpci->fid)) {
> + error_setg(errp, "fid %u already in use", zpci->fid);
> + return;
> + }
> +
> + zpci->state = ZPCI_FS_RESERVED;
> +}
> +
> +static void s390_pci_device_reset(DeviceState *dev)
> +{
> + S390PCIBusDevice *pbdev = S390_PCI_DEVICE(dev);
> +
> + switch (pbdev->state) {
> + case ZPCI_FS_RESERVED:
> + return;
> + case ZPCI_FS_STANDBY:
> + break;
> + default:
> + pbdev->fh &= ~FH_MASK_ENABLE;
> + pbdev->state = ZPCI_FS_DISABLED;
> + break;
> + }
> +
> + if (pbdev->summary_ind) {
> + pci_dereg_irqs(pbdev);
> + }
> + if (pbdev->iommu_enabled) {
> + pci_dereg_ioat(pbdev);
> + }
> +
> + pbdev->fmb_addr = 0;
> +}
> +
> +static void s390_pci_get_fid(Object *obj, Visitor *v, const char *name,
> + void *opaque, Error **errp)
> +{
> + Property *prop = opaque;
> + uint32_t *ptr = qdev_get_prop_ptr(DEVICE(obj), prop);
> +
> + visit_type_uint32(v, name, ptr, errp);
> +}
> +
> +static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name,
> + void *opaque, Error **errp)
> +{
> + DeviceState *dev = DEVICE(obj);
> + S390PCIBusDevice *zpci = S390_PCI_DEVICE(obj);
> + Property *prop = opaque;
> + uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
> +
> + if (dev->realized) {
> + qdev_prop_set_after_realize(dev, name, errp);
> + return;
> + }
> +
> + visit_type_uint32(v, name, ptr, errp);
> + zpci->fid_defined = true;
> +}
> +
> +static PropertyInfo s390_pci_fid_propinfo = {
> + .name = "zpci_fid",
> + .get = s390_pci_get_fid,
> + .set = s390_pci_set_fid,
> +};
> +
> +#define DEFINE_PROP_S390_PCI_FID(_n, _s, _f) \
> + DEFINE_PROP(_n, _s, _f, s390_pci_fid_propinfo, uint32_t)
> +
> +static Property s390_pci_device_properties[] = {
> + DEFINE_PROP_UINT16("uid", S390PCIBusDevice, uid, UID_UNDEFINED),
> + DEFINE_PROP_S390_PCI_FID("fid", S390PCIBusDevice, fid),
> + DEFINE_PROP_STRING("target", S390PCIBusDevice, target),
> + DEFINE_PROP_END_OF_LIST(),
> +};
> +
> +static void s390_pci_device_class_init(ObjectClass *klass, void *data)
> +{
> + DeviceClass *dc = DEVICE_CLASS(klass);
> +
> + dc->desc = "zpci device";
> + dc->reset = s390_pci_device_reset;
> + dc->bus_type = TYPE_S390_PCI_BUS;
> + dc->realize = s390_pci_device_realize;
> + dc->props = s390_pci_device_properties;
> +}
> +
> +static const TypeInfo s390_pci_device_info = {
> + .name = TYPE_S390_PCI_DEVICE,
> + .parent = TYPE_DEVICE,
Hi,
Here we have the same mismatch. TYPE_S390_PCI_DEVICE does not derive
from TYPE_PCI_DEVICE. If I understand correctly the "zpci device"
is a wrapper to the actual PCI device, maybe the name can reflect it.
Thanks,
Marcel
> + .instance_size = sizeof(S390PCIBusDevice),
> + .class_init = s390_pci_device_class_init,
> +};
> +
> static void s390_pci_register_types(void)
> {
> type_register_static(&s390_pcihost_info);
> type_register_static(&s390_pcibus_info);
> + type_register_static(&s390_pci_device_info);
> }
>
> type_init(s390_pci_register_types)
> diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h
> index ea1efcc..658bda5 100644
> --- a/hw/s390x/s390-pci-bus.h
> +++ b/hw/s390x/s390-pci-bus.h
> @@ -22,6 +22,7 @@
>
> #define TYPE_S390_PCI_HOST_BRIDGE "s390-pcihost"
> #define TYPE_S390_PCI_BUS "s390-pcibus"
> +#define TYPE_S390_PCI_DEVICE "zpci"
> #define FH_MASK_ENABLE 0x80000000
> #define FH_MASK_INSTANCE 0x7f000000
> #define FH_MASK_SHM 0x00ff0000
> @@ -29,11 +30,16 @@
> #define FH_SHM_VFIO 0x00010000
> #define FH_SHM_EMUL 0x00020000
> #define S390_PCIPT_ADAPTER 2
> +#define ZPCI_MAX_FID 0xffffffff
> +#define ZPCI_MAX_UID 0xffff
> +#define UID_UNDEFINED 0
>
> #define S390_PCI_HOST_BRIDGE(obj) \
> OBJECT_CHECK(S390pciState, (obj), TYPE_S390_PCI_HOST_BRIDGE)
> #define S390_PCI_BUS(obj) \
> OBJECT_CHECK(S390PCIBus, (obj), TYPE_S390_PCI_BUS)
> +#define S390_PCI_DEVICE(obj) \
> + OBJECT_CHECK(S390PCIBusDevice, (obj), TYPE_S390_PCI_DEVICE)
>
> #define HP_EVENT_TO_CONFIGURED 0x0301
> #define HP_EVENT_RESERVED_TO_STANDBY 0x0302
> @@ -254,11 +260,15 @@ typedef struct S390PCIIOMMU {
> } S390PCIIOMMU;
>
> typedef struct S390PCIBusDevice {
> + DeviceState qdev;
> PCIDevice *pdev;
> ZpciState state;
> bool iommu_enabled;
> + char *target;
> + uint16_t uid;
> uint32_t fh;
> uint32_t fid;
> + bool fid_defined;
> uint64_t g_iota;
> uint64_t pba;
> uint64_t pal;
> @@ -281,7 +291,7 @@ typedef struct S390PCIBus {
> typedef struct S390pciState {
> PCIHostState parent_obj;
> S390PCIBus *bus;
> - S390PCIBusDevice pbdev[PCI_SLOT_MAX];
> + S390PCIBusDevice *pbdev[PCI_SLOT_MAX];
> S390PCIIOMMU *iommu[PCI_SLOT_MAX];
> AddressSpace msix_notify_as;
> MemoryRegion msix_notify_mr;
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [Qemu-devel] [PATCH 00/17] s390x: the big pci update
2016-06-28 14:33 ` [Qemu-devel] [PATCH 00/17] s390x: the big pci update Marcel Apfelbaum
@ 2016-06-28 15:02 ` Cornelia Huck
2016-06-28 16:35 ` Marcel Apfelbaum
0 siblings, 1 reply; 30+ messages in thread
From: Cornelia Huck @ 2016-06-28 15:02 UTC (permalink / raw)
To: Marcel Apfelbaum; +Cc: qemu-devel, mst, borntraeger, agraf, jfrei, zyimin
On Tue, 28 Jun 2016 17:33:58 +0300
Marcel Apfelbaum <marcel@redhat.com> wrote:
> On 06/24/2016 04:28 PM, Cornelia Huck wrote:
> > We had been looking at remodelling the pci representation for s390x
> > to handle our slightly odd architecture correctly some time ago
> > already, but now we have a patchset that we're happy with.
> >
> > There's a bunch of bugfixes, cleanups and architecture conformance
> > changes in there, but the most interesting part is the modelling
> > (which, in some respects, takes a cue from what sPAPR does).
> >
> > We introduce a 'zpci' device to hold s390x-specific properties like
> > the uid and fid. This 'zpci' device is connected to a run-of-the-mill
> > pci device via the 'target' property.
> >
> > Example command line portion:
> >
> > -device zpci,uid=1,fid=1,target=vpci0 \
> > -device vfio-pci,host=0000:00:00.0,id=vpci0 \
> > -device zpci,target=vpci1 \
> > -device vfio-pci,host=0001:00:00.0,id=vpci1 \
> > -device vfio-pci,host=0002:00:00.0,id=vpci2
> >
> > For device vpci0, uid and fid are specified in the associated zpci
> > device.
> > For device vpci1, uid and fid are automatically generated.
> > For device vpci2, first an associated zpci device is generated and
> > then autogenerated values for uid and fid are placed in it.
> >
> > This should accomodate both specifying our special parameters and
> > re-using standard statements for pci devices.
>
> [...]
>
> You can still specify
> > bus/slot/function for the pci device, but it will not be propagated
> > into the guest (as the s390 pci architecture does not allow for it;
> > the guest only sees uid/fid).
> >
>
> Hi,
>
> Please excuse my lack of s390 knowledge, but I find hard to understand
> how it works. If using bus/slot/function is not an option,
> how can one access the configuration space? This configuration is not PCI compliant?
Yes, pci on s390 is... odd. Basically, we have some special
instructions for it.
For device discovery, the guest OS uses an instruction CLP (with a
subfunction) to list the pci functions available: see list_pci() in
hw/s390x/s390-pci-inst.c. This list contains the function handle (fh)
and the fid for each function.
For nearly all subsequent operations that target a pci function (like
config space accesses), the guest OS will use other instructions that
take the fh as an argument (see also hw/s390x/s390-pci-inst.c, for
example pci{lg,stg}_service_call() for reading/writing). The fid is
used for enabling/disabling via yet another instruction.
As an example of how this is used (and how one may construct a pci
"topology" from this), see arch/s390/pci/ in the Linux kernel. That's
why we have bus/slot/function in the host, even though they are
entirely synthetic.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [Qemu-devel] [PATCH 07/17] s390x/pci: introduce S390PCIBus
2016-06-28 14:39 ` Marcel Apfelbaum
@ 2016-06-28 15:20 ` Cornelia Huck
2016-06-28 15:40 ` Marcel Apfelbaum
0 siblings, 1 reply; 30+ messages in thread
From: Cornelia Huck @ 2016-06-28 15:20 UTC (permalink / raw)
To: Marcel Apfelbaum; +Cc: qemu-devel, mst, borntraeger, agraf, jfrei, zyimin
On Tue, 28 Jun 2016 17:39:30 +0300
Marcel Apfelbaum <marcel@redhat.com> wrote:
> On 06/24/2016 04:28 PM, Cornelia Huck wrote:
> > From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
> >
> > To enable S390PCIBusDevice as qdev, there should be a new bus to
> > plug and manage all instances of S390PCIBusDevice. Due to this,
> > S390PCIBus is introduced.
> >
> > Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
> > Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
> > Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> > ---
> > hw/s390x/s390-pci-bus.c | 10 ++++++++++
> > hw/s390x/s390-pci-bus.h | 8 ++++++++
> > 2 files changed, 18 insertions(+)
> >
> > diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> > index 0f6fcef..0c67c1e 100644
> > --- a/hw/s390x/s390-pci-bus.c
> > +++ b/hw/s390x/s390-pci-bus.c
> > @@ -527,6 +527,9 @@ static int s390_pcihost_init(SysBusDevice *dev)
> > bus = BUS(b);
> > qbus_set_hotplug_handler(bus, DEVICE(dev), NULL);
> > phb->bus = b;
> > +
> > + s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL));
> > +
> > QTAILQ_INIT(&s->pending_sei);
> > return 0;
> > }
> > @@ -636,9 +639,16 @@ static const TypeInfo s390_pcihost_info = {
> > }
> > };
> >
> > +static const TypeInfo s390_pcibus_info = {
> > + .name = TYPE_S390_PCI_BUS,
> > + .parent = TYPE_BUS,
>
> Hi,
>
> The type is named TYPE_S390_PCI_BUS, but does not
> derive from PCI_BUS. I find it a little confusing, anyway is just a thought.
> Maybe you should go with TYPE_S390_BUS.
I think that would be even more confusing, as this is not the only bus
on s390 :)
I have trouble thinking of a better name, though. TYPE_S390PCI_BUS?
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [Qemu-devel] [PATCH 09/17] s390x/pci: introduce S390PCIBusDevice qdev
2016-06-28 14:49 ` Marcel Apfelbaum
@ 2016-06-28 15:21 ` Cornelia Huck
2016-06-28 15:43 ` Marcel Apfelbaum
0 siblings, 1 reply; 30+ messages in thread
From: Cornelia Huck @ 2016-06-28 15:21 UTC (permalink / raw)
To: Marcel Apfelbaum; +Cc: qemu-devel, mst, borntraeger, agraf, jfrei, zyimin
On Tue, 28 Jun 2016 17:49:18 +0300
Marcel Apfelbaum <marcel@redhat.com> wrote:
> On 06/24/2016 04:28 PM, Cornelia Huck wrote:
> > From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
> > +static const TypeInfo s390_pci_device_info = {
> > + .name = TYPE_S390_PCI_DEVICE,
> > + .parent = TYPE_DEVICE,
>
> Hi,
>
> Here we have the same mismatch. TYPE_S390_PCI_DEVICE does not derive
> from TYPE_PCI_DEVICE. If I understand correctly the "zpci device"
> is a wrapper to the actual PCI device, maybe the name can reflect it.
TYPE_S390PCI_DEVICE?
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [Qemu-devel] [PATCH 07/17] s390x/pci: introduce S390PCIBus
2016-06-28 15:20 ` Cornelia Huck
@ 2016-06-28 15:40 ` Marcel Apfelbaum
2016-06-28 17:15 ` Cornelia Huck
0 siblings, 1 reply; 30+ messages in thread
From: Marcel Apfelbaum @ 2016-06-28 15:40 UTC (permalink / raw)
To: Cornelia Huck; +Cc: qemu-devel, mst, borntraeger, agraf, jfrei, zyimin
On 06/28/2016 06:20 PM, Cornelia Huck wrote:
> On Tue, 28 Jun 2016 17:39:30 +0300
> Marcel Apfelbaum <marcel@redhat.com> wrote:
>
>> On 06/24/2016 04:28 PM, Cornelia Huck wrote:
>>> From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
>>>
>>> To enable S390PCIBusDevice as qdev, there should be a new bus to
>>> plug and manage all instances of S390PCIBusDevice. Due to this,
>>> S390PCIBus is introduced.
>>>
>>> Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
>>> Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
>>> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>>> ---
>>> hw/s390x/s390-pci-bus.c | 10 ++++++++++
>>> hw/s390x/s390-pci-bus.h | 8 ++++++++
>>> 2 files changed, 18 insertions(+)
>>>
>>> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
>>> index 0f6fcef..0c67c1e 100644
>>> --- a/hw/s390x/s390-pci-bus.c
>>> +++ b/hw/s390x/s390-pci-bus.c
>>> @@ -527,6 +527,9 @@ static int s390_pcihost_init(SysBusDevice *dev)
>>> bus = BUS(b);
>>> qbus_set_hotplug_handler(bus, DEVICE(dev), NULL);
>>> phb->bus = b;
>>> +
>>> + s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL));
>>> +
>>> QTAILQ_INIT(&s->pending_sei);
>>> return 0;
>>> }
>>> @@ -636,9 +639,16 @@ static const TypeInfo s390_pcihost_info = {
>>> }
>>> };
>>>
>>> +static const TypeInfo s390_pcibus_info = {
>>> + .name = TYPE_S390_PCI_BUS,
>>> + .parent = TYPE_BUS,
>>
>> Hi,
>>
>> The type is named TYPE_S390_PCI_BUS, but does not
>> derive from PCI_BUS. I find it a little confusing, anyway is just a thought.
>> Maybe you should go with TYPE_S390_BUS.
>
> I think that would be even more confusing, as this is not the only bus
> on s390 :)
I suppose you mean S390 has a few bus types and this one is associated with PCI.
>
> I have trouble thinking of a better name, though. TYPE_S390PCI_BUS?
>
This would give a hint that we are referring to a special "S390PCI" bus, but is less readable.
I like the previous name better :)
Maybe TYPE_ZPCI_BUS ? Anyway, maybe just being aware of it is enough.
Thanks,
Marcel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [Qemu-devel] [PATCH 09/17] s390x/pci: introduce S390PCIBusDevice qdev
2016-06-28 15:21 ` Cornelia Huck
@ 2016-06-28 15:43 ` Marcel Apfelbaum
0 siblings, 0 replies; 30+ messages in thread
From: Marcel Apfelbaum @ 2016-06-28 15:43 UTC (permalink / raw)
To: Cornelia Huck; +Cc: qemu-devel, mst, borntraeger, agraf, jfrei, zyimin
On 06/28/2016 06:21 PM, Cornelia Huck wrote:
> On Tue, 28 Jun 2016 17:49:18 +0300
> Marcel Apfelbaum <marcel@redhat.com> wrote:
>
>> On 06/24/2016 04:28 PM, Cornelia Huck wrote:
>>> From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
>
>>> +static const TypeInfo s390_pci_device_info = {
>>> + .name = TYPE_S390_PCI_DEVICE,
>>> + .parent = TYPE_DEVICE,
>>
>> Hi,
>>
>> Here we have the same mismatch. TYPE_S390_PCI_DEVICE does not derive
>> from TYPE_PCI_DEVICE. If I understand correctly the "zpci device"
>> is a wrapper to the actual PCI device, maybe the name can reflect it.
>
> TYPE_S390PCI_DEVICE?
>
The same as on prev discussion, maybe TYPE_ZPCI_DEVICE, but is not *that* important.
Thanks,
Marcel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [Qemu-devel] [PATCH 00/17] s390x: the big pci update
2016-06-28 15:02 ` Cornelia Huck
@ 2016-06-28 16:35 ` Marcel Apfelbaum
0 siblings, 0 replies; 30+ messages in thread
From: Marcel Apfelbaum @ 2016-06-28 16:35 UTC (permalink / raw)
To: Cornelia Huck; +Cc: qemu-devel, mst, borntraeger, agraf, jfrei, zyimin
On 06/28/2016 06:02 PM, Cornelia Huck wrote:
> On Tue, 28 Jun 2016 17:33:58 +0300
> Marcel Apfelbaum <marcel@redhat.com> wrote:
>
>> On 06/24/2016 04:28 PM, Cornelia Huck wrote:
>>> We had been looking at remodelling the pci representation for s390x
>>> to handle our slightly odd architecture correctly some time ago
>>> already, but now we have a patchset that we're happy with.
>>>
>>> There's a bunch of bugfixes, cleanups and architecture conformance
>>> changes in there, but the most interesting part is the modelling
>>> (which, in some respects, takes a cue from what sPAPR does).
>>>
>>> We introduce a 'zpci' device to hold s390x-specific properties like
>>> the uid and fid. This 'zpci' device is connected to a run-of-the-mill
>>> pci device via the 'target' property.
>>>
>>> Example command line portion:
>>>
>>> -device zpci,uid=1,fid=1,target=vpci0 \
>>> -device vfio-pci,host=0000:00:00.0,id=vpci0 \
>>> -device zpci,target=vpci1 \
>>> -device vfio-pci,host=0001:00:00.0,id=vpci1 \
>>> -device vfio-pci,host=0002:00:00.0,id=vpci2
>>>
>>> For device vpci0, uid and fid are specified in the associated zpci
>>> device.
>>> For device vpci1, uid and fid are automatically generated.
>>> For device vpci2, first an associated zpci device is generated and
>>> then autogenerated values for uid and fid are placed in it.
>>>
>>> This should accomodate both specifying our special parameters and
>>> re-using standard statements for pci devices.
>>
>> [...]
>>
>> You can still specify
>>> bus/slot/function for the pci device, but it will not be propagated
>>> into the guest (as the s390 pci architecture does not allow for it;
>>> the guest only sees uid/fid).
>>>
>>
>> Hi,
>>
>> Please excuse my lack of s390 knowledge, but I find hard to understand
>> how it works. If using bus/slot/function is not an option,
>> how can one access the configuration space? This configuration is not PCI compliant?
>
> Yes, pci on s390 is... odd. Basically, we have some special
> instructions for it.
>
> For device discovery, the guest OS uses an instruction CLP (with a
> subfunction) to list the pci functions available: see list_pci() in
> hw/s390x/s390-pci-inst.c. This list contains the function handle (fh)
> and the fid for each function.
>
> For nearly all subsequent operations that target a pci function (like
> config space accesses), the guest OS will use other instructions that
> take the fh as an argument (see also hw/s390x/s390-pci-inst.c, for
> example pci{lg,stg}_service_call() for reading/writing). The fid is
> used for enabling/disabling via yet another instruction.
>
> As an example of how this is used (and how one may construct a pci
> "topology" from this), see arch/s390/pci/ in the Linux kernel. That's
> why we have bus/slot/function in the host, even though they are
> entirely synthetic.
>
Thank you for the detailed explanations.
I had a quick look at the kernel bits and it makes more sense now.
The upper layers call the usual PCI API and the s390 pci code "translates"
it to s390 architecture, so the kernel can work as "usual".
Thanks,
Marcel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [Qemu-devel] [PATCH 07/17] s390x/pci: introduce S390PCIBus
2016-06-28 15:40 ` Marcel Apfelbaum
@ 2016-06-28 17:15 ` Cornelia Huck
0 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-06-28 17:15 UTC (permalink / raw)
To: Marcel Apfelbaum; +Cc: qemu-devel, mst, borntraeger, agraf, jfrei, zyimin
On Tue, 28 Jun 2016 18:40:18 +0300
Marcel Apfelbaum <marcel@redhat.com> wrote:
> On 06/28/2016 06:20 PM, Cornelia Huck wrote:
> > On Tue, 28 Jun 2016 17:39:30 +0300
> > Marcel Apfelbaum <marcel@redhat.com> wrote:
> >
> >> On 06/24/2016 04:28 PM, Cornelia Huck wrote:
> >>> From: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
> >>>
> >>> To enable S390PCIBusDevice as qdev, there should be a new bus to
> >>> plug and manage all instances of S390PCIBusDevice. Due to this,
> >>> S390PCIBus is introduced.
> >>>
> >>> Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
> >>> Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
> >>> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> >>> ---
> >>> hw/s390x/s390-pci-bus.c | 10 ++++++++++
> >>> hw/s390x/s390-pci-bus.h | 8 ++++++++
> >>> 2 files changed, 18 insertions(+)
> >>>
> >>> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> >>> index 0f6fcef..0c67c1e 100644
> >>> --- a/hw/s390x/s390-pci-bus.c
> >>> +++ b/hw/s390x/s390-pci-bus.c
> >>> @@ -527,6 +527,9 @@ static int s390_pcihost_init(SysBusDevice *dev)
> >>> bus = BUS(b);
> >>> qbus_set_hotplug_handler(bus, DEVICE(dev), NULL);
> >>> phb->bus = b;
> >>> +
> >>> + s->bus = S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, DEVICE(s), NULL));
> >>> +
> >>> QTAILQ_INIT(&s->pending_sei);
> >>> return 0;
> >>> }
> >>> @@ -636,9 +639,16 @@ static const TypeInfo s390_pcihost_info = {
> >>> }
> >>> };
> >>>
> >>> +static const TypeInfo s390_pcibus_info = {
> >>> + .name = TYPE_S390_PCI_BUS,
> >>> + .parent = TYPE_BUS,
> >>
> >> Hi,
> >>
> >> The type is named TYPE_S390_PCI_BUS, but does not
> >> derive from PCI_BUS. I find it a little confusing, anyway is just a thought.
> >> Maybe you should go with TYPE_S390_BUS.
> >
> > I think that would be even more confusing, as this is not the only bus
> > on s390 :)
>
> I suppose you mean S390 has a few bus types and this one is associated with PCI.
Yes.
>
> >
> > I have trouble thinking of a better name, though. TYPE_S390PCI_BUS?
> >
>
> This would give a hint that we are referring to a special "S390PCI" bus, but is less readable.
> I like the previous name better :)
> Maybe TYPE_ZPCI_BUS ? Anyway, maybe just being aware of it is enough.
Probably yes. I think most people tempted to look at this file already
understand the purpose.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [Qemu-devel] [PATCH 00/17] s390x: the big pci update
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (17 preceding siblings ...)
2016-06-28 14:33 ` [Qemu-devel] [PATCH 00/17] s390x: the big pci update Marcel Apfelbaum
@ 2016-07-01 12:59 ` Cornelia Huck
2016-07-05 13:51 ` Cornelia Huck
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-07-01 12:59 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin
On Fri, 24 Jun 2016 15:28:49 +0200
Cornelia Huck <cornelia.huck@de.ibm.com> wrote:
> We had been looking at remodelling the pci representation for s390x
> to handle our slightly odd architecture correctly some time ago
> already, but now we have a patchset that we're happy with.
>
> There's a bunch of bugfixes, cleanups and architecture conformance
> changes in there, but the most interesting part is the modelling
> (which, in some respects, takes a cue from what sPAPR does).
>
> We introduce a 'zpci' device to hold s390x-specific properties like
> the uid and fid. This 'zpci' device is connected to a run-of-the-mill
> pci device via the 'target' property.
>
> Example command line portion:
>
> -device zpci,uid=1,fid=1,target=vpci0 \
> -device vfio-pci,host=0000:00:00.0,id=vpci0 \
> -device zpci,target=vpci1 \
> -device vfio-pci,host=0001:00:00.0,id=vpci1 \
> -device vfio-pci,host=0002:00:00.0,id=vpci2
>
> For device vpci0, uid and fid are specified in the associated zpci
> device.
> For device vpci1, uid and fid are automatically generated.
> For device vpci2, first an associated zpci device is generated and
> then autogenerated values for uid and fid are placed in it.
>
> This should accomodate both specifying our special parameters and
> re-using standard statements for pci devices. You can still specify
> bus/slot/function for the pci device, but it will not be propagated
> into the guest (as the s390 pci architecture does not allow for it;
> the guest only sees uid/fid).
>
> The "introduce S390PCI<foo>" patches are probably the most interesting
> for those looking at the modelling.
>
> I'd love to see some feedback from a PCI perspective, as I'm happy
> from the s390x perspective (and I'd like to see this in 2.7).
>
> Branch available at git://github.com/cohuck/qemu s390x-pci-update
>
> Yi Min Zhao (17):
> s390x/pci: fix failures of dma map/unmap
> s390x/pci: acceleration for getting S390pciState
> s390x/pci: write fid in CLP_QUERY_PCI_FN
> s390x/pci: unify FH_ macros
> s390x/pci: refactor s390_pci_find_dev_by_fh
> s390x/pci: enforce zPCI state checking
> s390x/pci: introduce S390PCIBus
> s390x/pci: introduce S390PCIIOMMU
> s390x/pci: introduce S390PCIBusDevice qdev
> s390x/pci: enable uid-checking
> s390x/pci: enable zpci hot-plug/hot-unplug
> s390x/pci: add checkings in CLP_SET_PCI_FN
> s390x/pci: refactor s390_pci_find_dev_by_idx
> s390x/pci: refactor list_pci
> s390x/pci: fix stpcifc_service_call
> s390x/pci: replace fid with idx in msg data of msix
> s390x/pci: make hot-unplug handler smoother
>
> hw/s390x/s390-pci-bus.c | 579 +++++++++++++++++++++++++++++++++++------------
> hw/s390x/s390-pci-bus.h | 77 ++++++-
> hw/s390x/s390-pci-inst.c | 266 ++++++++++++++++------
> hw/s390x/s390-pci-inst.h | 7 +-
> include/hw/s390x/sclp.h | 1 +
> target-s390x/kvm.c | 4 +-
> 6 files changed, 718 insertions(+), 216 deletions(-)
>
FWIW: I plan to include this in the next s390x pullreq for 2.7, unless
someone objects.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [Qemu-devel] [PATCH 00/17] s390x: the big pci update
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
` (18 preceding siblings ...)
2016-07-01 12:59 ` Cornelia Huck
@ 2016-07-05 13:51 ` Cornelia Huck
19 siblings, 0 replies; 30+ messages in thread
From: Cornelia Huck @ 2016-07-05 13:51 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, borntraeger, agraf, jfrei, zyimin
On Fri, 24 Jun 2016 15:28:49 +0200
Cornelia Huck <cornelia.huck@de.ibm.com> wrote:
> We had been looking at remodelling the pci representation for s390x
> to handle our slightly odd architecture correctly some time ago
> already, but now we have a patchset that we're happy with.
>
> There's a bunch of bugfixes, cleanups and architecture conformance
> changes in there, but the most interesting part is the modelling
> (which, in some respects, takes a cue from what sPAPR does).
>
> We introduce a 'zpci' device to hold s390x-specific properties like
> the uid and fid. This 'zpci' device is connected to a run-of-the-mill
> pci device via the 'target' property.
>
> Example command line portion:
>
> -device zpci,uid=1,fid=1,target=vpci0 \
> -device vfio-pci,host=0000:00:00.0,id=vpci0 \
> -device zpci,target=vpci1 \
> -device vfio-pci,host=0001:00:00.0,id=vpci1 \
> -device vfio-pci,host=0002:00:00.0,id=vpci2
>
> For device vpci0, uid and fid are specified in the associated zpci
> device.
> For device vpci1, uid and fid are automatically generated.
> For device vpci2, first an associated zpci device is generated and
> then autogenerated values for uid and fid are placed in it.
>
> This should accomodate both specifying our special parameters and
> re-using standard statements for pci devices. You can still specify
> bus/slot/function for the pci device, but it will not be propagated
> into the guest (as the s390 pci architecture does not allow for it;
> the guest only sees uid/fid).
>
> The "introduce S390PCI<foo>" patches are probably the most interesting
> for those looking at the modelling.
>
> I'd love to see some feedback from a PCI perspective, as I'm happy
> from the s390x perspective (and I'd like to see this in 2.7).
>
> Branch available at git://github.com/cohuck/qemu s390x-pci-update
Added to my s390-next branch (on top of the patches I sent today).
>
> Yi Min Zhao (17):
> s390x/pci: fix failures of dma map/unmap
> s390x/pci: acceleration for getting S390pciState
> s390x/pci: write fid in CLP_QUERY_PCI_FN
> s390x/pci: unify FH_ macros
> s390x/pci: refactor s390_pci_find_dev_by_fh
> s390x/pci: enforce zPCI state checking
> s390x/pci: introduce S390PCIBus
> s390x/pci: introduce S390PCIIOMMU
> s390x/pci: introduce S390PCIBusDevice qdev
> s390x/pci: enable uid-checking
> s390x/pci: enable zpci hot-plug/hot-unplug
> s390x/pci: add checkings in CLP_SET_PCI_FN
> s390x/pci: refactor s390_pci_find_dev_by_idx
> s390x/pci: refactor list_pci
> s390x/pci: fix stpcifc_service_call
> s390x/pci: replace fid with idx in msg data of msix
> s390x/pci: make hot-unplug handler smoother
>
> hw/s390x/s390-pci-bus.c | 579 +++++++++++++++++++++++++++++++++++------------
> hw/s390x/s390-pci-bus.h | 77 ++++++-
> hw/s390x/s390-pci-inst.c | 266 ++++++++++++++++------
> hw/s390x/s390-pci-inst.h | 7 +-
> include/hw/s390x/sclp.h | 1 +
> target-s390x/kvm.c | 4 +-
> 6 files changed, 718 insertions(+), 216 deletions(-)
>
^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2016-07-05 13:52 UTC | newest]
Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-24 13:28 [Qemu-devel] [PATCH 00/17] s390x: the big pci update Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 01/17] s390x/pci: fix failures of dma map/unmap Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 02/17] s390x/pci: acceleration for getting S390pciState Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 03/17] s390x/pci: write fid in CLP_QUERY_PCI_FN Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 04/17] s390x/pci: unify FH_ macros Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 05/17] s390x/pci: refactor s390_pci_find_dev_by_fh Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 06/17] s390x/pci: enforce zPCI state checking Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 07/17] s390x/pci: introduce S390PCIBus Cornelia Huck
2016-06-28 14:39 ` Marcel Apfelbaum
2016-06-28 15:20 ` Cornelia Huck
2016-06-28 15:40 ` Marcel Apfelbaum
2016-06-28 17:15 ` Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 08/17] s390x/pci: introduce S390PCIIOMMU Cornelia Huck
2016-06-24 13:28 ` [Qemu-devel] [PATCH 09/17] s390x/pci: introduce S390PCIBusDevice qdev Cornelia Huck
2016-06-28 14:49 ` Marcel Apfelbaum
2016-06-28 15:21 ` Cornelia Huck
2016-06-28 15:43 ` Marcel Apfelbaum
2016-06-24 13:28 ` [Qemu-devel] [PATCH 10/17] s390x/pci: enable uid-checking Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 11/17] s390x/pci: enable zpci hot-plug/hot-unplug Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 12/17] s390x/pci: add checkings in CLP_SET_PCI_FN Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 13/17] s390x/pci: refactor s390_pci_find_dev_by_idx Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 14/17] s390x/pci: refactor list_pci Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 15/17] s390x/pci: fix stpcifc_service_call Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 16/17] s390x/pci: replace fid with idx in msg data of msix Cornelia Huck
2016-06-24 13:29 ` [Qemu-devel] [PATCH 17/17] s390x/pci: make hot-unplug handler smoother Cornelia Huck
2016-06-28 14:33 ` [Qemu-devel] [PATCH 00/17] s390x: the big pci update Marcel Apfelbaum
2016-06-28 15:02 ` Cornelia Huck
2016-06-28 16:35 ` Marcel Apfelbaum
2016-07-01 12:59 ` Cornelia Huck
2016-07-05 13:51 ` Cornelia Huck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).