|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 7/7] vm-event/arm: implement support for control-register write vm-events
Hello Corneliu, On 17/06/16 11:36, Corneliu ZUZU wrote: On 6/16/2016 7:49 PM, Julien Grall wrote:On 16/06/16 15:13, Corneliu ZUZU wrote: [...] Please mention that PRRR and NMRR are aliased to respectively MAIR0 and MAIR1. This will avoid to spend time trying to understanding why the spec says they are trapped but you don't "handle" them.I mentioned that in traps.h (see "AKA" comments). Will put the same comment here then. I noticed it later. But it was not obvious to find. [...] diff --git a/xen/arch/arm/vm_event.c b/xen/arch/arm/vm_event.c new file mode 100644 index 0000000..3f23fec --- /dev/null +++ b/xen/arch/arm/vm_event.c @@ -0,0 +1,112 @@[...]+#include <xen/vm_event.h> +#include <asm/traps.h> + +#if CONFIG_ARM_64 + +#define MWSINF_SCTLR 32,SCTLR_EL1 +#define MWSINF_TTBR0 64,TTBR0_EL1 +#define MWSINF_TTBR1 64,TTBR1_EL1 +#define MWSINF_TTBCR 64,TCR_EL1 + +#elif CONFIG_ARM_32 + +#define MWSINF_SCTLR 32,SCTLR +#define MWSINF_TTBR0 64,TTBR0 +#define MWSINF_TTBR1 64,TTBR1The values are the same as for arm64 (*_EL1 is aliased to * for arm32). Please avoid duplication.(see comment below about later reply) Your later reply explain why you did not expose TTBR*_32 to ARM64, but does not explain why the 3 define above is the same as the ARM64. +#define MWSINF_TTBR0_32 32,TTBR0_32 +#define MWSINF_TTBR1_32 32,TTBR1_32 +#define MWSINF_TTBCR 32,TTBCR + +#endif + +#define MWS_EMUL_(val, sz, r...) WRITE_SYSREG##sz((uint##sz##_t) (val), r)The cast is not necessary. Why would you want to notify write to TTBR*_32 when Xen is running in AArch32 mode and none in Aaarch64 mode? The vm-events for an AArch32 guests should be exactly the same regardless of Xen mode (i.e AArch32 vs AArch64). [...] @@ -0,0 +1,253 @@[...] Testing will not tell you if a trap will occur or not. The ARM ARM may define it as IMPLEMENTATION DEFINED. From my understanding of the ARMv7 spec (B1.14.1 and B1.14.13 in ARM DDI 0406C.c), the instruction at PL0 (user mode) will not trap to the hypervisor: "Setting HCR.TVM to 1 means that any attempt, to write to a Non-secure memory control register from a Non-secure PL1 or PL0 mode, that this reference manual does not describe as UNDEFINED , generates a Hyp Trap exception." For ARMv8 (See description of HCR_EL2.TVM D7-1971 in ARM DDI 0487A.j), only NS EL1 write to the registers will be trapped. + return inject_undef_exception(regs, hsr); \ + WRITE_SYSREG##sz((uint##sz##_t) (val), r);[...] Your comment says "shouldn't" which I interpret as this would be a bug if VM_EVENT_REASON_MOV_TO_MSR ends up here. If not a BUG_ON, at least returning an error. We should not silently ignore something that shouldn't happen. This has to do with the implementation of vm_event_resume. What I think we should do instead is to surround "case VM_EVENT_REASON_MOV_TO_MSR" there with #ifdef CONFIG_X86. Would that be suitable? x86 vm-event reason should never be accessible on ARM (similarly for ARM vm-event on x86). So the hypervisor should return an error if someone is calling with the wrong vm-event. Regards, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |