All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Rosato <mjrosato@linux.ibm.com>
To: cohuck@redhat.com, thuth@redhat.com
Cc: pmorel@linux.ibm.com, schnelle@linux.ibm.com, rth@twiddle.net,
	david@redhat.com, pasic@linux.ibm.com, borntraeger@de.ibm.com,
	mst@redhat.com, pbonzini@redhat.com, alex.williamson@redhat.com,
	qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
	kvm@vger.kernel.org
Subject: [PATCH v3 07/10] s390x/pci: clean up s390 PCI groups
Date: Wed,  7 Oct 2020 15:04:12 -0400	[thread overview]
Message-ID: <1602097455-15658-8-git-send-email-mjrosato@linux.ibm.com> (raw)
In-Reply-To: <1602097455-15658-1-git-send-email-mjrosato@linux.ibm.com>

Add a step to remove all stashed PCI groups to avoid stale data between
machine resets.

Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
---
 hw/s390x/s390-pci-bus.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index c99f2f0..c34f14a 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -811,6 +811,17 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
                              S390_ADAPTER_SUPPRESSIBLE, errp);
 }
 
+static void s390_pcihost_unrealize(DeviceState *dev)
+{
+    S390PCIGroup *group;
+    S390pciState *s = S390_PCI_HOST_BRIDGE(dev);
+
+    while (!QTAILQ_EMPTY(&s->zpci_groups)) {
+        group = QTAILQ_FIRST(&s->zpci_groups);
+        QTAILQ_REMOVE(&s->zpci_groups, group, link);
+    }
+}
+
 static int s390_pci_msix_init(S390PCIBusDevice *pbdev)
 {
     char *name;
@@ -1165,6 +1176,7 @@ static void s390_pcihost_class_init(ObjectClass *klass, void *data)
 
     dc->reset = s390_pcihost_reset;
     dc->realize = s390_pcihost_realize;
+    dc->unrealize = s390_pcihost_unrealize;
     hc->pre_plug = s390_pcihost_pre_plug;
     hc->plug = s390_pcihost_plug;
     hc->unplug_request = s390_pcihost_unplug_request;
-- 
1.8.3.1


WARNING: multiple messages have this Message-ID (diff)
From: Matthew Rosato <mjrosato@linux.ibm.com>
To: cohuck@redhat.com, thuth@redhat.com
Cc: kvm@vger.kernel.org, pmorel@linux.ibm.com, david@redhat.com,
	schnelle@linux.ibm.com, qemu-s390x@nongnu.org,
	qemu-devel@nongnu.org, pasic@linux.ibm.com,
	borntraeger@de.ibm.com, alex.williamson@redhat.com,
	mst@redhat.com, pbonzini@redhat.com, rth@twiddle.net
Subject: [PATCH v3 07/10] s390x/pci: clean up s390 PCI groups
Date: Wed,  7 Oct 2020 15:04:12 -0400	[thread overview]
Message-ID: <1602097455-15658-8-git-send-email-mjrosato@linux.ibm.com> (raw)
In-Reply-To: <1602097455-15658-1-git-send-email-mjrosato@linux.ibm.com>

Add a step to remove all stashed PCI groups to avoid stale data between
machine resets.

Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
---
 hw/s390x/s390-pci-bus.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index c99f2f0..c34f14a 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -811,6 +811,17 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
                              S390_ADAPTER_SUPPRESSIBLE, errp);
 }
 
+static void s390_pcihost_unrealize(DeviceState *dev)
+{
+    S390PCIGroup *group;
+    S390pciState *s = S390_PCI_HOST_BRIDGE(dev);
+
+    while (!QTAILQ_EMPTY(&s->zpci_groups)) {
+        group = QTAILQ_FIRST(&s->zpci_groups);
+        QTAILQ_REMOVE(&s->zpci_groups, group, link);
+    }
+}
+
 static int s390_pci_msix_init(S390PCIBusDevice *pbdev)
 {
     char *name;
@@ -1165,6 +1176,7 @@ static void s390_pcihost_class_init(ObjectClass *klass, void *data)
 
     dc->reset = s390_pcihost_reset;
     dc->realize = s390_pcihost_realize;
+    dc->unrealize = s390_pcihost_unrealize;
     hc->pre_plug = s390_pcihost_pre_plug;
     hc->plug = s390_pcihost_plug;
     hc->unplug_request = s390_pcihost_unplug_request;
-- 
1.8.3.1



  parent reply	other threads:[~2020-10-07 19:04 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 19:04 [PATCH v3 00/10] Retrieve zPCI hardware information from VFIO Matthew Rosato
2020-10-07 19:04 ` Matthew Rosato
2020-10-07 19:04 ` [PATCH v3 01/10] s390x/pci: Move header files to include/hw/s390x Matthew Rosato
2020-10-07 19:04   ` Matthew Rosato
2020-10-09  9:50   ` Cornelia Huck
2020-10-09  9:50     ` Cornelia Huck
2020-10-07 19:04 ` [PATCH v3 02/10] vfio: Create shared routine for scanning info capabilities Matthew Rosato
2020-10-07 19:04   ` Matthew Rosato
2020-10-07 19:04 ` [PATCH v3 03/10] update-linux-headers: Add vfio_zdev.h Matthew Rosato
2020-10-07 19:04   ` Matthew Rosato
2020-10-07 19:04 ` [PATCH v3 04/10] linux-headers: update against 5.9-rc8 Matthew Rosato
2020-10-07 19:04   ` Matthew Rosato
2020-10-07 19:04 ` [PATCH v3 05/10] s390x/pci: create a header dedicated to PCI CLP Matthew Rosato
2020-10-07 19:04   ` Matthew Rosato
2020-10-07 19:04 ` [PATCH v3 06/10] s390x/pci: use a PCI Group structure Matthew Rosato
2020-10-07 19:04   ` Matthew Rosato
2020-10-09 10:53   ` Cornelia Huck
2020-10-09 10:53     ` Cornelia Huck
2020-10-07 19:04 ` Matthew Rosato [this message]
2020-10-07 19:04   ` [PATCH v3 07/10] s390x/pci: clean up s390 PCI groups Matthew Rosato
2020-10-09 10:54   ` Cornelia Huck
2020-10-09 10:54     ` Cornelia Huck
2020-10-07 19:04 ` [PATCH v3 08/10] s390x/pci: use a PCI Function structure Matthew Rosato
2020-10-07 19:04   ` Matthew Rosato
2020-10-09 10:56   ` Cornelia Huck
2020-10-09 10:56     ` Cornelia Huck
2020-10-07 19:04 ` [PATCH v3 09/10] vfio: Add routine for finding VFIO_DEVICE_GET_INFO capabilities Matthew Rosato
2020-10-07 19:04   ` Matthew Rosato
2020-10-09  9:53   ` Cornelia Huck
2020-10-09  9:53     ` Cornelia Huck
2020-10-07 19:04 ` [PATCH v3 10/10] s390x/pci: get zPCI function info from host Matthew Rosato
2020-10-07 19:04   ` Matthew Rosato
2020-10-09 15:48   ` Cornelia Huck
2020-10-09 15:48     ` Cornelia Huck
2020-10-09 16:10     ` Matthew Rosato
2020-10-09 16:10       ` Matthew Rosato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1602097455-15658-8-git-send-email-mjrosato@linux.ibm.com \
    --to=mjrosato@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=pmorel@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=schnelle@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.