Skip to contentSkip to conversation

qemu-kvm: Resolve PCI upstream diffs

PATCH Applied Jan Kiszka 3 participants 3 messages Sep 8, 2011 – Sep 9, 2011 KVM

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 qemu-kvm: Resolve PCI upstream diffs

Resolve all unneeded deviations from upstream code. No functional changes.

---
 hw/pci.c |   11 +++++++----
 hw/pci.h |    5 ++++-
 2 files changed, 11 insertions(+), 5 deletions(-)
hw/pci.c +7 -4
index e4c166a..4d8845c 100644
@@ -2106,8 +2106,6 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
     memset(pdev->wmask + offset, 0, size);
     /* Check capability by default */
     memset(pdev->cmask + offset, 0xFF, size);
-
-
     return offset;
 }
 
@@ -2125,9 +2123,14 @@ void pci_del_capability(PCIDevice *pdev, uint8_t cap_id, uint8_t size)
     memset(pdev->cmask + offset, 0, size);
     memset(pdev->used + offset, 0, size);
 
-    if (!pdev->config[PCI_CAPABILITY_LIST]) {
+    if (!pdev->config[PCI_CAPABILITY_LIST])
         pdev->config[PCI_STATUS] &= ~PCI_STATUS_CAP_LIST;
-    }
+}
+
+/* Reserve space for capability at a known offset (to call after load). */
+void pci_reserve_capability(PCIDevice *pdev, uint8_t offset, uint8_t size)
+{
+    memset(pdev->used + offset, 0xff, size);
 }
 
 uint8_t pci_find_capability(PCIDevice *pdev, uint8_t cap_id)
hw/pci.h +4 -1
index da0c2d2..70fcd9c 100644
@@ -147,7 +147,7 @@ struct PCIDevice {
     /* Used to implement RW1C(Write 1 to Clear) bytes */
     uint8_t *w1cmask;
 
-    /* Used to allocate config space and track capabilities. */
+    /* Used to allocate config space for capabilities. */
     uint8_t *used;
 
     /* the following fields are read only */
@@ -230,8 +230,11 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
 
 void pci_del_capability(PCIDevice *pci_dev, uint8_t cap_id, uint8_t cap_size);
 
+void pci_reserve_capability(PCIDevice *pci_dev, uint8_t offset, uint8_t size);
+
 uint8_t pci_find_capability(PCIDevice *pci_dev, uint8_t cap_id);
 
+
 uint32_t pci_default_read_config(PCIDevice *d,
                                  uint32_t address, int len);
 void pci_default_write_config(PCIDevice *d,
Signature · 1 line
1.7.3.4
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Jan Kiszka

Resolve all unneeded deviations from upstream code. No functional changes.

Quoted 62 lines
---
 hw/pci.c |   11 +++++++----
 hw/pci.h |    5 ++++-
 2 files changed, 11 insertions(+), 5 deletions(-)
hw/pci.c +7 -4
index e4c166a..4d8845c 100644
@@ -2106,8 +2106,6 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
     memset(pdev->wmask + offset, 0, size);
     /* Check capability by default */
     memset(pdev->cmask + offset, 0xFF, size);
-
-
     return offset;
 }
 
@@ -2125,9 +2123,14 @@ void pci_del_capability(PCIDevice *pdev, uint8_t cap_id, uint8_t size)
     memset(pdev->cmask + offset, 0, size);
     memset(pdev->used + offset, 0, size);
 
-    if (!pdev->config[PCI_CAPABILITY_LIST]) {
+    if (!pdev->config[PCI_CAPABILITY_LIST])
         pdev->config[PCI_STATUS] &= ~PCI_STATUS_CAP_LIST;
-    }
+}
+
+/* Reserve space for capability at a known offset (to call after load). */
+void pci_reserve_capability(PCIDevice *pdev, uint8_t offset, uint8_t size)
+{
+    memset(pdev->used + offset, 0xff, size);
 }
 
 uint8_t pci_find_capability(PCIDevice *pdev, uint8_t cap_id)
hw/pci.h +4 -1
index da0c2d2..70fcd9c 100644
@@ -147,7 +147,7 @@ struct PCIDevice {
     /* Used to implement RW1C(Write 1 to Clear) bytes */
     uint8_t *w1cmask;
 
-    /* Used to allocate config space and track capabilities. */
+    /* Used to allocate config space for capabilities. */
     uint8_t *used;
 
     /* the following fields are read only */
@@ -230,8 +230,11 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
 
 void pci_del_capability(PCIDevice *pci_dev, uint8_t cap_id, uint8_t cap_size);
 
+void pci_reserve_capability(PCIDevice *pci_dev, uint8_t offset, uint8_t size);
+
 uint8_t pci_find_capability(PCIDevice *pci_dev, uint8_t cap_id);
 
+
 uint32_t pci_default_read_config(PCIDevice *d,
                                  uint32_t address, int len);
 void pci_default_write_config(PCIDevice *d,
Signature · 1 line
1.7.3.4