From: Jan Kiszka <[email protected]> This registers cat as a unit with the Intel-variant of the hypervisor. For AMD, we just leave the non-unit'fied cat_update handler as weak stub behind. cat_update is too special to model it as unit callback.
Signed-off-by: Jan Kiszka <[email protected]> --- hypervisor/arch/x86/Kbuild | 12 ++++++++---- hypervisor/arch/x86/cat-stubs.c | 31 ------------------------------- hypervisor/arch/x86/cat.c | 11 ++++++++--- hypervisor/arch/x86/control.c | 11 ++++------- hypervisor/arch/x86/include/asm/cat.h | 7 ------- hypervisor/arch/x86/setup.c | 7 +------ 6 files changed, 21 insertions(+), 58 deletions(-) delete mode 100644 hypervisor/arch/x86/cat-stubs.c diff --git a/hypervisor/arch/x86/Kbuild b/hypervisor/arch/x86/Kbuild index 0e5a9ffbe..f8560ef6b 100644 --- a/hypervisor/arch/x86/Kbuild +++ b/hypervisor/arch/x86/Kbuild @@ -17,12 +17,16 @@ ccflags-$(CONFIG_JAILHOUSE_GCOV) += -fprofile-arcs -ftest-coverage BUILT_IN_OBJECTS := built-in-amd.o built-in-intel.o -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 always := $(BUILT_IN_OBJECTS) obj-y := $(BUILT_IN_OBJECTS) -built-in-amd-y := $(COMMON_OBJECTS) svm.o amd_iommu.o svm-vmexit.o cat-stubs.o -built-in-intel-y := $(COMMON_OBJECTS) vmx.o vtd.o vmx-vmexit.o cat.o +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 + +# units initialization order as defined by linking order: +# [cat], <generic units> + +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/cat-stubs.c b/hypervisor/arch/x86/cat-stubs.c deleted file mode 100644 index 0087d955f..000000000 --- a/hypervisor/arch/x86/cat-stubs.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Jailhouse, a Linux-based partitioning hypervisor - * - * Copyright (c) Siemens AG, 2015 - * - * Authors: - * Jan Kiszka <[email protected]> - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - */ - -#include <asm/cat.h> - -int cat_init(void) -{ - return 0; -} - -void cat_update(void) -{ -} - -int cat_cell_init(struct cell *cell) -{ - return 0; -} - -void cat_cell_exit(struct cell *cell) -{ -} diff --git a/hypervisor/arch/x86/cat.c b/hypervisor/arch/x86/cat.c index 1769216f1..dc1729b0f 100644 --- a/hypervisor/arch/x86/cat.c +++ b/hypervisor/arch/x86/cat.c @@ -12,6 +12,7 @@ #include <jailhouse/control.h> #include <jailhouse/printk.h> +#include <jailhouse/unit.h> #include <jailhouse/utils.h> #include <asm/cat.h> @@ -134,7 +135,7 @@ static bool shrink_root_cell_mask(u64 cell_mask) return true; } -int cat_cell_init(struct cell *cell) +static int cat_cell_init(struct cell *cell) { const struct jailhouse_cache *cache; @@ -183,7 +184,7 @@ int cat_cell_init(struct cell *cell) return 0; } -void cat_cell_exit(struct cell *cell) +static void cat_cell_exit(struct cell *cell) { /* * Only release the mask of cells with an own partition. @@ -205,7 +206,7 @@ void cat_cell_exit(struct cell *cell) } } -int cat_init(void) +static int cat_init(void) { int err; @@ -220,3 +221,7 @@ int cat_init(void) return err; } + +DEFINE_UNIT_SHUTDOWN_STUB(cat); +DEFINE_UNIT_MMIO_COUNT_REGIONS_STUB(cat); +DEFINE_UNIT(cat, "Cache Allocation Technology"); diff --git a/hypervisor/arch/x86/control.c b/hypervisor/arch/x86/control.c index 2445f3a61..ee7d6000f 100644 --- a/hypervisor/arch/x86/control.c +++ b/hypervisor/arch/x86/control.c @@ -48,10 +48,6 @@ int arch_cell_create(struct cell *cell) if (err) goto error_iommu_exit; - err = cat_cell_init(cell); - if (err) - goto error_ioapic_exit; - comm_region->pm_timer_address = system_config->platform_info.x86.pm_timer_address; comm_region->pci_mmconfig_base = @@ -64,8 +60,6 @@ int arch_cell_create(struct cell *cell) return 0; -error_ioapic_exit: - ioapic_cell_exit(cell); error_iommu_exit: iommu_cell_exit(cell); error_vm_exit: @@ -118,7 +112,6 @@ void arch_flush_cell_vcpu_caches(struct cell *cell) void arch_cell_destroy(struct cell *cell) { - cat_cell_exit(cell); ioapic_cell_exit(cell); iommu_cell_exit(cell); vcpu_cell_exit(cell); @@ -226,6 +219,10 @@ static void x86_enter_wait_for_sipi(struct per_cpu *cpu_data) cpu_data->wait_for_sipi = true; } +void __attribute__((weak)) cat_update(void) +{ +} + void x86_check_events(void) { struct per_cpu *cpu_data = this_cpu_data(); diff --git a/hypervisor/arch/x86/include/asm/cat.h b/hypervisor/arch/x86/include/asm/cat.h index a7c640a19..847c02776 100644 --- a/hypervisor/arch/x86/include/asm/cat.h +++ b/hypervisor/arch/x86/include/asm/cat.h @@ -10,11 +10,4 @@ * the COPYING file in the top-level directory. */ -#include <jailhouse/cell.h> - -int cat_init(void); - void cat_update(void); - -int cat_cell_init(struct cell *cell); -void cat_cell_exit(struct cell *cell); diff --git a/hypervisor/arch/x86/setup.c b/hypervisor/arch/x86/setup.c index dc906ff7e..2d65a247f 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/cat.h> #include <asm/ioapic.h> #include <asm/iommu.h> #include <asm/vcpu.h> @@ -225,11 +224,7 @@ int arch_init_late(void) if (err) return err; - err = ioapic_init(); - if (err) - return err; - - return cat_init(); + return ioapic_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.
