[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 06/18] xen/arm: Introduce a virtual abort injection helper
On Mon, 13 Mar 2017, Wei Chen wrote: > When guest triggers async aborts, in most platform, such aborts > will be routed to hypervisor. But we don't want the hypervisor > to handle such aborts, so we have to route such aborts back to > the guest. > > This helper is using the HCR_EL2.VSE (HCR.VA for aarch32) bit to > route such aborts back to the guest. If the guest PC had been > advanced by SVC/HVC/SMC instructions before we caught the SError > in hypervisor, we have to adjust the guest PC to exact address > while the SError generated. > > About HSR_EC_SVC32/64, even thought we don't trap SVC32/64 today, > we would like them to be handled here. This would be useful when > VM introspection will gain support of SVC32/64 trapping. > > This helper will be used by the later patches in this series, we > use #if 0 to disable it in this patch temporarily to remove the > warning message of unused function from compiler. > > Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx> Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> > --- > xen/arch/arm/traps.c | 32 ++++++++++++++++++++++++++++++++ > xen/include/asm-arm/processor.h | 1 + > 2 files changed, 33 insertions(+) > > diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c > index c11359d..e425832 100644 > --- a/xen/arch/arm/traps.c > +++ b/xen/arch/arm/traps.c > @@ -618,6 +618,38 @@ static void inject_dabt_exception(struct cpu_user_regs > *regs, > #endif > } > > +#if 0 > +/* Inject a virtual Abort/SError into the guest. */ > +static void inject_vabt_exception(struct cpu_user_regs *regs) > +{ > + const union hsr hsr = { .bits = regs->hsr }; > + > + /* > + * SVC/HVC/SMC already have an adjusted PC (See ARM ARM DDI 0487A.j > + * D1.10.1 for more details), which we need to correct in order to > + * return to after having injected the SError. > + */ > + switch ( hsr.ec ) > + { > + case HSR_EC_SVC32: > + case HSR_EC_HVC32: > + case HSR_EC_SMC32: > +#ifdef CONFIG_ARM_64 > + case HSR_EC_SVC64: > + case HSR_EC_HVC64: > + case HSR_EC_SMC64: > +#endif > + regs->pc -= hsr.len ? 4 : 2; > + break; > + > + default: > + break; > + } > + > + current->arch.hcr_el2 |= HCR_VA; > +} > +#endif > + > struct reg_ctxt { > /* Guest-side state */ > uint32_t sctlr_el1; > diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h > index 4b6338b..d7b0711 100644 > --- a/xen/include/asm-arm/processor.h > +++ b/xen/include/asm-arm/processor.h > @@ -252,6 +252,7 @@ > #define HSR_EC_HVC32 0x12 > #define HSR_EC_SMC32 0x13 > #ifdef CONFIG_ARM_64 > +#define HSR_EC_SVC64 0x15 > #define HSR_EC_HVC64 0x16 > #define HSR_EC_SMC64 0x17 > #define HSR_EC_SYSREG 0x18 > -- > 2.7.4 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@xxxxxxxxxxxxx > https://lists.xen.org/xen-devel > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |