[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.7] xen/arm: do_trap_hypervisor: Separate hypervisor and guest traps
commit 6c9a9b6d5ca391c4529f9caa4c79a111c9ee6bb7 Author: Julien Grall <julien.grall@xxxxxxx> AuthorDate: Fri May 5 15:30:35 2017 +0100 Commit: Stefano Stabellini <sstabellini@xxxxxxxxxx> CommitDate: Mon Jun 12 13:52:47 2017 -0700 xen/arm: do_trap_hypervisor: Separate hypervisor and guest traps The function do_trap_hypervisor is currently handling both trap coming from the hypervisor and the guest. This makes difficult to get specific behavior when a trap is coming from either the guest or the hypervisor. Split the function into two parts: - do_trap_guest_sync to handle guest traps - do_trap_hyp_sync to handle hypervisor traps On AArch32, the Hyp Trap Exception provides the standard mechanism for trapping Guest OS functions to the hypervisor (see B1.14.1 in ARM DDI 0406C.c). It cannot be generated when generated when the processor is in Hyp Mode, instead other exception will be used. So it is fine to replace the call to do_trap_hypervisor by do_trap_guest_sync. For AArch64, there are two distincts exception depending whether the exception was taken from the current level (hypervisor) or lower level (guest). Note that the unknown traps from guests will lead to panic Xen. This is already behavior and is left unchanged for simplicy. A follow-up patch will address that. Signed-off-by: Julien Grall <julien.grall@xxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> master-commit-id: 5a0ed9a09ebb32b620d9217875bb5206d5ccf4d7 --- xen/arch/arm/arm32/entry.S | 4 ++-- xen/arch/arm/arm64/entry.S | 6 +++--- xen/arch/arm/traps.c | 17 ++++++++++++++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S index d7cd06c..090f049 100644 --- a/xen/arch/arm/arm32/entry.S +++ b/xen/arch/arm/arm32/entry.S @@ -130,7 +130,7 @@ GLOBAL(hyp_traps_vector) b trap_supervisor_call /* 0x08 - Supervisor Call */ b trap_prefetch_abort /* 0x0c - Prefetch Abort */ b trap_data_abort /* 0x10 - Data Abort */ - b trap_hypervisor /* 0x14 - Hypervisor */ + b trap_guest_sync /* 0x14 - Hypervisor */ b trap_irq /* 0x18 - IRQ */ b trap_fiq /* 0x1c - FIQ */ @@ -138,7 +138,7 @@ DEFINE_TRAP_ENTRY(undefined_instruction) DEFINE_TRAP_ENTRY(supervisor_call) DEFINE_TRAP_ENTRY(prefetch_abort) DEFINE_TRAP_ENTRY(data_abort) -DEFINE_TRAP_ENTRY(hypervisor) +DEFINE_TRAP_ENTRY(guest_sync) DEFINE_TRAP_ENTRY_NOIRQ(irq) DEFINE_TRAP_ENTRY_NOIRQ(fiq) diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S index 66ba0cb..0e7ddde 100644 --- a/xen/arch/arm/arm64/entry.S +++ b/xen/arch/arm/arm64/entry.S @@ -219,7 +219,7 @@ hyp_sync: entry hyp=1 msr daifclr, #2 mov x0, sp - bl do_trap_hypervisor + bl do_trap_hyp_sync exit hyp=1 hyp_irq: @@ -238,7 +238,7 @@ guest_sync: cbnz x0, 1f msr daifclr, #2 mov x0, sp - bl do_trap_hypervisor + bl do_trap_guest_sync 1: exit hyp=0, compat=0 @@ -276,7 +276,7 @@ guest_sync_compat: cbnz x0, 1f msr daifclr, #2 mov x0, sp - bl do_trap_hypervisor + bl do_trap_guest_sync 1: exit hyp=0, compat=1 diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 6bac169..7c97e95 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2579,7 +2579,7 @@ static void enter_hypervisor_head(struct cpu_user_regs *regs) gic_clear_lrs(current); } -asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs) +asmlinkage void do_trap_guest_sync(struct cpu_user_regs *regs) { const union hsr hsr = { .bits = regs->hsr }; @@ -2699,6 +2699,21 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs) do_trap_data_abort_guest(regs, hsr); break; + default: + printk("Unknown Guest Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n", + hsr.bits, hsr.ec, hsr.len, hsr.iss); + do_unexpected_trap("Guest", regs); + } +} + +asmlinkage void do_trap_hyp_sync(struct cpu_user_regs *regs) +{ + const union hsr hsr = { .bits = regs->hsr }; + + enter_hypervisor_head(regs); + + switch ( hsr.ec ) + { #ifdef CONFIG_ARM_64 case HSR_EC_BRK: do_trap_brk(regs, hsr); -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.7 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |