From: Jan Kiszka <[email protected]> This registers the ioapic as unit with the core.
Signed-off-by: Jan Kiszka <[email protected]> --- hypervisor/arch/x86/Kbuild | 6 ++++-- hypervisor/arch/x86/control.c | 8 -------- hypervisor/arch/x86/include/asm/ioapic.h | 10 ---------- hypervisor/arch/x86/ioapic.c | 18 ++++++++++++++---- hypervisor/arch/x86/mmio.c | 3 +-- hypervisor/arch/x86/setup.c | 9 +-------- 6 files changed, 20 insertions(+), 34 deletions(-) diff --git a/hypervisor/arch/x86/Kbuild b/hypervisor/arch/x86/Kbuild index f8560ef6b..95d210d17 100644 --- a/hypervisor/arch/x86/Kbuild +++ b/hypervisor/arch/x86/Kbuild @@ -23,10 +23,12 @@ always := $(BUILT_IN_OBJECTS) obj-y := $(BUILT_IN_OBJECTS) COMMON_OBJECTS := apic.o dbg-write.o entry.o setup.o control.o mmio.o iommu.o \ - paging.o pci.o ioapic.o i8042.o vcpu.o vga.o ivshmem.o + paging.o pci.o i8042.o vcpu.o vga.o ivshmem.o # units initialization order as defined by linking order: -# [cat], <generic units> +# ioapic, [cat], <generic units> + +COMMON_OBJECTS += ioapic.o built-in-amd-y := svm.o amd_iommu.o svm-vmexit.o $(COMMON_OBJECTS) built-in-intel-y := vmx.o vtd.o vmx-vmexit.o $(COMMON_OBJECTS) cat.o diff --git a/hypervisor/arch/x86/control.c b/hypervisor/arch/x86/control.c index ee7d6000f..3222b1080 100644 --- a/hypervisor/arch/x86/control.c +++ b/hypervisor/arch/x86/control.c @@ -44,10 +44,6 @@ int arch_cell_create(struct cell *cell) if (err) goto error_vm_exit; - err = ioapic_cell_init(cell); - if (err) - goto error_iommu_exit; - comm_region->pm_timer_address = system_config->platform_info.x86.pm_timer_address; comm_region->pci_mmconfig_base = @@ -60,8 +56,6 @@ int arch_cell_create(struct cell *cell) return 0; -error_iommu_exit: - iommu_cell_exit(cell); error_vm_exit: vcpu_cell_exit(cell); return err; @@ -112,7 +106,6 @@ void arch_flush_cell_vcpu_caches(struct cell *cell) void arch_cell_destroy(struct cell *cell) { - ioapic_cell_exit(cell); iommu_cell_exit(cell); vcpu_cell_exit(cell); } @@ -133,7 +126,6 @@ void arch_shutdown(void) ioapic_prepare_handover(); iommu_shutdown(); - ioapic_shutdown(); } void arch_suspend_cpu(unsigned int cpu_id) diff --git a/hypervisor/arch/x86/include/asm/ioapic.h b/hypervisor/arch/x86/include/asm/ioapic.h index edb71d83c..f58ea2fce 100644 --- a/hypervisor/arch/x86/include/asm/ioapic.h +++ b/hypervisor/arch/x86/include/asm/ioapic.h @@ -86,21 +86,11 @@ struct cell_ioapic { u32 pin_bitmap[(IOAPIC_MAX_PINS + 31) / 32]; }; -static inline unsigned int ioapic_mmio_count_regions(struct cell *cell) -{ - return cell->config->num_irqchips; -} - -int ioapic_init(void); void ioapic_prepare_handover(void); int ioapic_get_or_add_phys(const struct jailhouse_irqchip *irqchip, struct phys_ioapic **phys_ioapic_ptr); -int ioapic_cell_init(struct cell *cell); void ioapic_cell_reset(struct cell *cell); -void ioapic_cell_exit(struct cell *cell); void ioapic_config_commit(struct cell *cell_added_removed); - -void ioapic_shutdown(void); diff --git a/hypervisor/arch/x86/ioapic.c b/hypervisor/arch/x86/ioapic.c index 4a59841eb..72dd8d90a 100644 --- a/hypervisor/arch/x86/ioapic.c +++ b/hypervisor/arch/x86/ioapic.c @@ -14,6 +14,7 @@ #include <jailhouse/mmio.h> #include <jailhouse/printk.h> #include <jailhouse/string.h> +#include <jailhouse/unit.h> #include <asm/apic.h> #include <asm/ioapic.h> #include <asm/iommu.h> @@ -46,6 +47,11 @@ enum ioapic_handover {PINS_ACTIVE, PINS_MASKED}; static struct phys_ioapic phys_ioapics[IOAPIC_MAX_CHIPS]; static unsigned int num_phys_ioapics; +static unsigned int ioapic_mmio_count_regions(struct cell *cell) +{ + return cell->config->num_irqchips; +} + static u32 ioapic_reg_read(struct phys_ioapic *ioapic, unsigned int reg) { u32 value; @@ -328,7 +334,9 @@ invalid_access: return MMIO_ERROR; } -int ioapic_cell_init(struct cell *cell) +static void ioapic_cell_exit(struct cell *cell); + +static int ioapic_cell_init(struct cell *cell) { const struct jailhouse_irqchip *irqchip = jailhouse_cell_irqchips(cell->config); @@ -392,7 +400,7 @@ void ioapic_cell_reset(struct cell *cell) ioapic_mask_cell_pins(ioapic, PINS_MASKED); } -void ioapic_cell_exit(struct cell *cell) +static void ioapic_cell_exit(struct cell *cell) { struct cell_ioapic *ioapic, *root_ioapic; const struct jailhouse_irqchip *irqchip; @@ -446,7 +454,7 @@ void ioapic_config_commit(struct cell *cell_added_removed) } } -int ioapic_init(void) +static int ioapic_init(void) { int err; @@ -459,7 +467,7 @@ int ioapic_init(void) return 0; } -void ioapic_shutdown(void) +static void ioapic_shutdown(void) { union ioapic_redir_entry *shadow_table; struct phys_ioapic *phys_ioapic; @@ -477,3 +485,5 @@ void ioapic_shutdown(void) shadow_table[index / 2].raw[index % 2]); } } + +DEFINE_UNIT(ioapic, "IOAPIC"); diff --git a/hypervisor/arch/x86/mmio.c b/hypervisor/arch/x86/mmio.c index 20b2324d9..c2c69be7a 100644 --- a/hypervisor/arch/x86/mmio.c +++ b/hypervisor/arch/x86/mmio.c @@ -15,7 +15,6 @@ #include <jailhouse/mmio.h> #include <jailhouse/paging.h> #include <jailhouse/printk.h> -#include <asm/ioapic.h> #include <asm/iommu.h> #include <asm/vcpu.h> @@ -224,5 +223,5 @@ error: unsigned int arch_mmio_count_regions(struct cell *cell) { - return ioapic_mmio_count_regions(cell) + iommu_mmio_count_regions(cell); + return iommu_mmio_count_regions(cell); } diff --git a/hypervisor/arch/x86/setup.c b/hypervisor/arch/x86/setup.c index 2d65a247f..1c3e6ca01 100644 --- a/hypervisor/arch/x86/setup.c +++ b/hypervisor/arch/x86/setup.c @@ -18,7 +18,6 @@ #include <jailhouse/processor.h> #include <asm/apic.h> #include <asm/bitops.h> -#include <asm/ioapic.h> #include <asm/iommu.h> #include <asm/vcpu.h> @@ -218,13 +217,7 @@ error_out: int arch_init_late(void) { - int err; - - err = iommu_init(); - if (err) - return err; - - return ioapic_init(); + return iommu_init(); } void __attribute__((noreturn)) arch_cpu_activate_vmm(struct per_cpu *cpu_data) -- 2.13.6 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
