[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v5 10/11] vpci: add a priority parameter to the vPCI register initializer



This is needed for MSI-X, since MSI-X will need to be initialized
before parsing the BARs, so that the header BAR handlers are aware of
the MSI-X related holes and make sure they are not mapped in order for
the trap handlers to work properly.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
Changes since v4:
 - Add a middle priority and add the PCI header to it.

Changes since v3:
 - Add a numerial suffix to the section used to store the pointer to
   each initializer function, and sort them at link time.
---
 xen/arch/arm/xen.lds.S    |  4 ++--
 xen/arch/x86/xen.lds.S    |  4 ++--
 xen/drivers/vpci/header.c |  2 +-
 xen/drivers/vpci/msi.c    |  2 +-
 xen/include/xen/vpci.h    | 12 ++++++++----
 5 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 6690516ff1..781ea39ecc 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -43,7 +43,7 @@ SECTIONS
   .rodata : {
 #if defined(CONFIG_HAS_PCI) && defined(CONFIG_LATE_HWDOM)
        __start_vpci_array = .;
-       *(.rodata.vpci)
+       *(SORT(.rodata.vpci.*))
        __end_vpci_array = .;
 #endif
         _srodata = .;          /* Read-only data */
@@ -138,7 +138,7 @@ SECTIONS
   .init.data : {
 #if defined(CONFIG_HAS_PCI) && !defined(CONFIG_LATE_HWDOM)
        __start_vpci_array = .;
-       *(.init.rodata.vpci)
+       *(SORT(.init.rodata.vpci.*))
        __end_vpci_array = .;
 #endif
        *(.init.rodata)
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index af1b30cb2b..4ed1fe5aff 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -78,7 +78,7 @@ SECTIONS
   .rodata : {
 #if defined(CONFIG_HAS_PCI) && defined(CONFIG_LATE_HWDOM)
        __start_vpci_array = .;
-       *(.rodata.vpci)
+       *(SORT(.rodata.vpci.*))
        __end_vpci_array = .;
 #endif
        _srodata = .;
@@ -174,7 +174,7 @@ SECTIONS
   .init.data : {
 #if defined(CONFIG_HAS_PCI) && !defined(CONFIG_LATE_HWDOM)
        __start_vpci_array = .;
-       *(.init.rodata.vpci)
+       *(SORT(.init.rodata.vpci.*))
        __end_vpci_array = .;
 #endif
        *(.init.rodata)
diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 9b44c8441a..1533c36470 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -440,7 +440,7 @@ static int vpci_init_bars(struct pci_dev *pdev)
     return 0;
 }
 
-REGISTER_VPCI_INIT(vpci_init_bars);
+REGISTER_VPCI_INIT(vpci_init_bars, VPCI_PRIORITY_MIDDLE);
 
 /*
  * Local variables:
diff --git a/xen/drivers/vpci/msi.c b/xen/drivers/vpci/msi.c
index 1e36b9779a..181599241a 100644
--- a/xen/drivers/vpci/msi.c
+++ b/xen/drivers/vpci/msi.c
@@ -311,7 +311,7 @@ static int vpci_init_msi(struct pci_dev *pdev)
     return 0;
 }
 
-REGISTER_VPCI_INIT(vpci_init_msi);
+REGISTER_VPCI_INIT(vpci_init_msi, VPCI_PRIORITY_LOW);
 
 void vpci_dump_msi(void)
 {
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 21da73df16..66d8ae8b5f 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -34,14 +34,18 @@ typedef void vpci_write_t(struct pci_dev *pdev, unsigned 
int reg,
 typedef int vpci_register_init_t(struct pci_dev *dev);
 
 #ifdef CONFIG_LATE_HWDOM
-#define VPCI_SECTION ".rodata.vpci"
+#define VPCI_SECTION ".rodata.vpci."
 #else
-#define VPCI_SECTION ".init.rodata.vpci"
+#define VPCI_SECTION ".init.rodata.vpci."
 #endif
 
-#define REGISTER_VPCI_INIT(x)                   \
+#define VPCI_PRIORITY_HIGH      "1"
+#define VPCI_PRIORITY_MIDDLE    "5"
+#define VPCI_PRIORITY_LOW       "9"
+
+#define REGISTER_VPCI_INIT(x, p)                \
   static vpci_register_init_t *const x##_entry  \
-               __used_section(VPCI_SECTION) = x
+               __used_section(VPCI_SECTION p) = x
 
 /* Add vPCI handlers to device. */
 int __must_check vpci_add_handlers(struct pci_dev *dev);
-- 
2.11.0 (Apple Git-81)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.