Skip to contentSkip to conversation

Add support for PCI Enhanced Allocation "BARs"

PATCH In review Sean O. Stalley 1 participant 4 messages Jul 1, 2015 – Jul 30, 2015

lore
Share & tools
lore
#0 lore raw

v2 cover Add support for PCI Enhanced Allocation "BARs"

Changes from v1:
- added a cover letter with a change log
- made spelling fixes throughout patch
- no longer add unnecessary whitespace
- removed brackets in return calls
- only add 1 PCI device parameter instead of 2
- don't add definitions to imported include/hw/pci/pci_regs.h

Sean O. Stalley (1):
Add support for PCI Enhanced Allocation "BARs"

 hw/pci/Makefile.objs    |   2 +-
 hw/pci/pci.c            |  95 +++++++++++++++++------
 hw/pci/pci_ea.c         | 202 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/pci/pci.h    |   6 ++
 include/hw/pci/pci_ea.h |  42 ++++++++++
 include/qemu/typedefs.h |   1 +
 6 files changed, 324 insertions(+), 24 deletions(-)
 create mode 100644 hw/pci/pci_ea.c
 create mode 100644 include/hw/pci/pci_ea.h
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 Add support for PCI Enhanced Allocation "BARs"

PCI Enhanced Allocation is a new method of allocating MMIO & IO resources for PCI devices & bridges. It can be used instead of the traditional PCI method of using BARs.

EA entries are hardware-initialized to a fixed address. Unlike BARs, regions described by EA are cannot be moved. Because of this, only devices which are permanently connected to the PCI bus can use EA. A removable PCI card must not use EA.

This patch enables any existing QEMU PCI model to use EA instead of BARs. It adds EA options to the PCI device parameters.

The Enhanced Allocation ECN is publicly available here:
https://www.pcisig.com/specifications/conventional/ECN_Enhanced_Allocation_23_Oct_2014_Final.pdf

---
 hw/pci/Makefile.objs    |   2 +-
 hw/pci/pci.c            |  95 +++++++++++++++++------
 hw/pci/pci_ea.c         | 202 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/pci/pci.h    |   6 ++
 include/hw/pci/pci_ea.h |  42 ++++++++++
 include/qemu/typedefs.h |   1 +
 6 files changed, 324 insertions(+), 24 deletions(-)
 create mode 100644 hw/pci/pci_ea.c
 create mode 100644 include/hw/pci/pci_ea.h
hw/pci/Makefile.objs +1 -1
index 9f905e6..e5d80cf 100644
@@ -3,7 +3,7 @@ common-obj-$(CONFIG_PCI) += msix.o msi.o
 common-obj-$(CONFIG_PCI) += shpc.o
 common-obj-$(CONFIG_PCI) += slotid_cap.o
 common-obj-$(CONFIG_PCI) += pci_host.o pcie_host.o
-common-obj-$(CONFIG_PCI) += pcie.o pcie_aer.o pcie_port.o
+common-obj-$(CONFIG_PCI) += pcie.o pcie_aer.o pcie_port.o pci_ea.o
 
 common-obj-$(call lnot,$(CONFIG_PCI)) += pci-stub.o
 common-obj-$(CONFIG_ALL) += pci-stub.o
hw/pci/pci.c +72 -23

147 lines not on this page · raw message

hw/pci/pci_ea.c new file +202 -0

202 lines not on this page · raw message

include/hw/pci/pci.h +6 -0
index d44bc84..deb453f 100644
@@ -12,6 +12,7 @@
 #include "hw/isa/isa.h"
 
 #include "hw/pci/pcie.h"
+#include "hw/pci/pci_ea.h"
 
 /* PCI bus */
 
@@ -111,6 +112,7 @@ typedef struct PCIIORegion {
     uint8_t type;
     MemoryRegion *memory;
     MemoryRegion *address_space;
+    bool          enhanced;
 } PCIIORegion;
 
 #define PCI_ROM_SLOT 6
@@ -290,6 +292,10 @@ struct PCIDevice {
     /* PCI Express */
     PCIExpressDevice exp;
 
+    /* Enhanced Allocation */
+    uint32_t ea_addr_len;
+    hwaddr *ea_addr;
+
     /* SHPC */
     SHPCDevice *shpc;
 
include/hw/pci/pci_ea.h new file +42 -0

42 lines not on this page · raw message

include/qemu/typedefs.h +1 -0
index 6fdcbcd..85502f7 100644
@@ -50,6 +50,7 @@ typedef struct PcGuestInfo PcGuestInfo;
 typedef struct PCIBridge PCIBridge;
 typedef struct PCIBus PCIBus;
 typedef struct PCIDevice PCIDevice;
+typedef struct PCIEADevice PCIEADevice;
 typedef struct PCIEAERErr PCIEAERErr;
 typedef struct PCIEAERLog PCIEAERLog;
 typedef struct PCIEAERMsg PCIEAERMsg;
Signature · 1 line
1.9.1
#2 lore raw
In reply to Sean O. Stalley

ping

Quoted 30 lines

-----Original Message-----
From: Stalley, Sean
Sent: Wednesday, July 01, 2015 11:20 AM
To: [email protected]
Cc: [email protected]; Stalley, Sean
Subject: [PATCH v2 0/1] Add support for PCI Enhanced Allocation "BARs"

Changes from v1:
- added a cover letter with a change log
- made spelling fixes throughout patch
- no longer add unnecessary whitespace
- removed brackets in return calls
- only add 1 PCI device parameter instead of 2
- don't add definitions to imported include/hw/pci/pci_regs.h

Sean O. Stalley (1):
Add support for PCI Enhanced Allocation "BARs"

 hw/pci/Makefile.objs    |   2 +-
 hw/pci/pci.c            |  95 +++++++++++++++++------
 hw/pci/pci_ea.c         | 202
++++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/pci/pci.h    |   6 ++
 include/hw/pci/pci_ea.h |  42 ++++++++++
 include/qemu/typedefs.h |   1 +
 6 files changed, 324 insertions(+), 24 deletions(-)  create mode 100644

hw/pci/pci_ea.c create mode 100644 include/hw/pci/pci_ea.h

--
1.9.1

#3 lore raw

Ping ping

Quoted 39 lines

-----Original Message-----
From: Stalley, Sean
Sent: Wednesday, July 15, 2015 9:38 AM
To: [email protected]; Michael S. Tsirkin ([email protected])
Subject: RE: [PATCH v2 0/1] Add support for PCI Enhanced Allocation "BARs"

ping

Quoted 30 lines

-----Original Message-----
From: Stalley, Sean
Sent: Wednesday, July 01, 2015 11:20 AM
To: [email protected]
Cc: [email protected]; Stalley, Sean
Subject: [PATCH v2 0/1] Add support for PCI Enhanced Allocation "BARs"

Changes from v1:
- added a cover letter with a change log
- made spelling fixes throughout patch
- no longer add unnecessary whitespace
- removed brackets in return calls
- only add 1 PCI device parameter instead of 2
- don't add definitions to imported include/hw/pci/pci_regs.h

Sean O. Stalley (1):
Add support for PCI Enhanced Allocation "BARs"

 hw/pci/Makefile.objs    |   2 +-
 hw/pci/pci.c            |  95 +++++++++++++++++------
 hw/pci/pci_ea.c         | 202
++++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/pci/pci.h    |   6 ++
 include/hw/pci/pci_ea.h |  42 ++++++++++
 include/qemu/typedefs.h |   1 +
 6 files changed, 324 insertions(+), 24 deletions(-)  create mode

100644 hw/pci/pci_ea.c create mode 100644 include/hw/pci/pci_ea.h

--
1.9.1