From: Julien Grall Date: Wed, 7 Jun 2017 11:47:54 +0000 (+0100) Subject: Skeleton for registering hostbridge X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8f31c4957d9f782a9f228b50e5b81367947f20e7;p=people%2Fjulieng%2Flinux-arm.git Skeleton for registering hostbridge --- diff --git a/arch/arm/xen/Makefile b/arch/arm/xen/Makefile index 227952103b0b..7ff125e01012 100644 --- a/arch/arm/xen/Makefile +++ b/arch/arm/xen/Makefile @@ -1,2 +1,3 @@ obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o obj-$(CONFIG_XEN_EFI) += efi.o +obj-$(CONFIG_PCI) += pci.o diff --git a/arch/arm/xen/pci.c b/arch/arm/xen/pci.c new file mode 100644 index 000000000000..933b6b33fa59 --- /dev/null +++ b/arch/arm/xen/pci.c @@ -0,0 +1,14 @@ +#include +#include + +void xen_pci_register_host_bridge(struct pci_host_bridge *bridge) +{ +// struct physdev_pci_mmcfg_reserved r; + struct pci_bus *bus = bridge->bus; + + printk("============== Register Hostbridge ================\n"); + + printk("seg %u\n", pci_domain_nr(bus)); + + while (1); +} diff --git a/arch/arm64/include/asm/xen/xen-ops.h b/arch/arm64/include/asm/xen/xen-ops.h index e6e784051932..0a601bd7f740 100644 --- a/arch/arm64/include/asm/xen/xen-ops.h +++ b/arch/arm64/include/asm/xen/xen-ops.h @@ -2,6 +2,12 @@ #ifndef _ASM_XEN_OPS_H #define _ASM_XEN_OPS_H +#include +#include +#include + void xen_efi_runtime_setup(void); +void xen_pci_register_host_bridge(struct pci_host_bridge *bridge); + #endif /* _ASM_XEN_OPS_H */ diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 0e2ea1c78542..179494dc4ce8 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -21,6 +21,7 @@ #include #include #include +#include #ifdef CONFIG_ACPI /* @@ -206,11 +207,20 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) void pcibios_add_bus(struct pci_bus *bus) { acpi_pci_add_bus(bus); + + /* + * XXX This function is also called for child bus. Maybe we should + * hooked up in another function or check if we are registering + * the root parent + */ + if (xen_initial_domain() && !pci_is_root_bus(bus)) + xen_pci_register_host_bridge(pci_find_host_bridge(bus)); } void pcibios_remove_bus(struct pci_bus *bus) { acpi_pci_remove_bus(bus); + /* XXX Implement remove bus */ } #endif diff --git a/arch/arm64/xen/Makefile b/arch/arm64/xen/Makefile index 8ff8aa9c6228..c93c5f8e61b7 100644 --- a/arch/arm64/xen/Makefile +++ b/arch/arm64/xen/Makefile @@ -1,3 +1,4 @@ xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o) obj-y := xen-arm.o hypercall.o obj-$(CONFIG_XEN_EFI) += $(addprefix ../../arm/xen/, efi.o) +obj-$(CONFIG_PCI) += $(addprefix ../../arm/xen/, pci.o)