qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jing Liu <jing2.liu@linux.intel.com>
To: qemu-devel@nongnu.org
Cc: anthony.xu@intel.com, mst@redhat.com, marcel.apfelbaum@gmail.com,
	lersek@redhat.com, pbonzini@redhat.com,
	Jing Liu <jing2.liu@linux.intel.com>
Subject: [Qemu-devel] [PATCH v2 2/3] hw/pci: add teardown function for PCI resource reserve capability
Date: Thu, 16 Aug 2018 17:28:15 +0800	[thread overview]
Message-ID: <1534411696-6454-3-git-send-email-jing2.liu@linux.intel.com> (raw)
In-Reply-To: <1534411696-6454-1-git-send-email-jing2.liu@linux.intel.com>

Clean up the PCI config space of resource reserve capability.

Signed-off-by: Jing Liu <jing2.liu@linux.intel.com>
---
 hw/pci/pci_bridge.c         | 9 +++++++++
 include/hw/pci/pci_bridge.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 15b055e..dbcee90 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -465,6 +465,15 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset,
     return 0;
 }
 
+void pci_bridge_qemu_reserve_cap_uninit(PCIDevice *dev)
+{
+    uint8_t pos = pci_find_capability(dev, PCI_CAP_ID_VNDR);
+
+    pci_del_capability(dev, PCI_CAP_ID_VNDR, sizeof(PCIBridgeQemuCap));
+    memset(dev->config + pos + PCI_CAP_FLAGS, 0,
+           sizeof(PCIBridgeQemuCap) - PCI_CAP_FLAGS);
+}
+
 static const TypeInfo pci_bridge_type_info = {
     .name = TYPE_PCI_BRIDGE,
     .parent = TYPE_PCI_DEVICE,
diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
index 6186a32..b1e25ad 100644
--- a/include/hw/pci/pci_bridge.h
+++ b/include/hw/pci/pci_bridge.h
@@ -147,4 +147,5 @@ typedef struct PCIResReserve {
 int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset,
                                PCIResReserve res_reserve, Error **errp);
 
+void pci_bridge_qemu_reserve_cap_uninit(PCIDevice *dev);
 #endif /* QEMU_PCI_BRIDGE_H */
-- 
1.8.3.1

  parent reply	other threads:[~2018-08-16  9:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-16  9:28 [Qemu-devel] [PATCH v2 0/3] hw/pci: PCI resource reserve capability Jing Liu
2018-08-16  9:28 ` [Qemu-devel] [PATCH v2 1/3] hw/pci: factor PCI reserve resources to a separate structure Jing Liu
2018-08-17 15:49   ` Marcel Apfelbaum
2018-08-20  6:00     ` Liu, Jing2
2018-08-16  9:28 ` Jing Liu [this message]
2018-08-17 16:10   ` [Qemu-devel] [PATCH v2 2/3] hw/pci: add teardown function for PCI resource reserve capability Marcel Apfelbaum
2018-08-20  2:58     ` Liu, Jing2
2018-08-20 13:38       ` Marcel Apfelbaum
2018-08-21  2:39         ` Liu, Jing2
2018-08-16  9:28 ` [Qemu-devel] [PATCH v2 3/3] hw/pci: add PCI resource reserve capability to legacy PCI bridge Jing Liu
2018-08-17 16:16   ` Marcel Apfelbaum
2018-08-16 16:17 ` [Qemu-devel] [PATCH v2 0/3] hw/pci: PCI resource reserve capability Laszlo Ersek
2018-08-17  3:39   ` Liu, Jing2
2018-08-17 16:18 ` Marcel Apfelbaum
2018-08-20  2:39   ` Liu, Jing2

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=1534411696-6454-3-git-send-email-jing2.liu@linux.intel.com \
    --to=jing2.liu@linux.intel.com \
    --cc=anthony.xu@intel.com \
    --cc=lersek@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 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).