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....@citrix.com> --- Cc: Jan Beulich <jbeul...@suse.com> Cc: Andrew Cooper <andrew.coop...@citrix.com> --- 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 | 2 +- xen/arch/x86/xen.lds.S | 2 +- xen/drivers/vpci/header.c | 2 +- xen/drivers/vpci/msi.c | 2 +- xen/include/xen/vpci.h | 9 ++++++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index a24d8e913a..a1fef99c76 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -42,7 +42,7 @@ SECTIONS . = ALIGN(PAGE_SIZE); .rodata : { __start_vpci_array = .; - *(.rodata.vpci) + *(SORT(.rodata.vpci.*)) __end_vpci_array = .; _srodata = .; /* Read-only data */ /* Bug frames table */ diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 451e7970da..93f104aaf5 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -77,7 +77,7 @@ SECTIONS __2M_rodata_start = .; /* Start of 2M superpages, mapped RO. */ .rodata : { __start_vpci_array = .; - *(.rodata.vpci) + *(SORT(.rodata.vpci.*)) __end_vpci_array = .; _srodata = .; /* Bug frames table */ diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c index 3c800c4cf7..ae5719ab1a 100644 --- a/xen/drivers/vpci/header.c +++ b/xen/drivers/vpci/header.c @@ -459,7 +459,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_LOW); /* * Local variables: diff --git a/xen/drivers/vpci/msi.c b/xen/drivers/vpci/msi.c index d8f3418616..5261cda5f4 100644 --- a/xen/drivers/vpci/msi.c +++ b/xen/drivers/vpci/msi.c @@ -290,7 +290,7 @@ static int vpci_init_msi(struct pci_dev *pdev) return ret; } -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 2a7d7557b3..ca693f3667 100644 --- a/xen/include/xen/vpci.h +++ b/xen/include/xen/vpci.h @@ -37,9 +37,12 @@ typedef void (vpci_write_t)(struct pci_dev *pdev, unsigned int reg, typedef int (*vpci_register_init_t)(struct pci_dev *dev); -#define REGISTER_VPCI_INIT(x) \ - static const vpci_register_init_t x##_entry \ - __used_section(".rodata.vpci") = x +#define VPCI_PRIORITY_HIGH "1" +#define VPCI_PRIORITY_LOW "9" + +#define REGISTER_VPCI_INIT(x, p) \ + static const vpci_register_init_t x##_entry \ + __used_section(".rodata.vpci." 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@lists.xen.org https://lists.xen.org/xen-devel