[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 03/25] arm/altp2m: Add struct vttbr.
The struct vttbr introduces a simple way to precisely access the individual fields of the vttbr. --- xen/arch/arm/p2m.c | 8 ++++---- xen/arch/arm/traps.c | 2 +- xen/include/asm-arm/p2m.h | 2 +- xen/include/asm-arm/processor.h | 16 ++++++++++++++++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 40a0b80..cbc64a1 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -122,7 +122,7 @@ void p2m_restore_state(struct vcpu *n) WRITE_SYSREG(hcr & ~HCR_VM, HCR_EL2); isb(); - WRITE_SYSREG64(p2m->vttbr, VTTBR_EL2); + WRITE_SYSREG64(p2m->vttbr.vttbr, VTTBR_EL2); isb(); if ( is_32bit_domain(n->domain) ) @@ -147,10 +147,10 @@ static void p2m_flush_tlb(struct p2m_domain *p2m) * VMID. So switch to the VTTBR of a given P2M if different. */ ovttbr = READ_SYSREG64(VTTBR_EL2); - if ( ovttbr != p2m->vttbr ) + if ( ovttbr != p2m->vttbr.vttbr ) { local_irq_save(flags); - WRITE_SYSREG64(p2m->vttbr, VTTBR_EL2); + WRITE_SYSREG64(p2m->vttbr.vttbr, VTTBR_EL2); isb(); } @@ -1293,7 +1293,7 @@ static int p2m_alloc_table(struct domain *d) p2m->root = page; - p2m->vttbr = page_to_maddr(p2m->root) | ((uint64_t)p2m->vmid & 0xff) << 48; + p2m->vttbr.vttbr = page_to_maddr(p2m->root) | ((uint64_t)p2m->vmid & 0xff) << 48; /* * Make sure that all TLBs corresponding to the new VMID are flushed diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 06f06e3..12be7c9 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -881,7 +881,7 @@ void vcpu_show_registers(const struct vcpu *v) ctxt.ifsr32_el2 = v->arch.ifsr; #endif - ctxt.vttbr_el2 = v->domain->arch.p2m.vttbr; + ctxt.vttbr_el2 = v->domain->arch.p2m.vttbr.vttbr; _show_registers(&v->arch.cpu_info->guest_cpu_user_regs, &ctxt, 1, v); } diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 53c4d78..5c7cd1a 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -33,7 +33,7 @@ struct p2m_domain { uint8_t vmid; /* Current Translation Table Base Register for the p2m */ - uint64_t vttbr; + struct vttbr vttbr; /* * Highest guest frame that's ever been mapped in the p2m diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index 15bf890..f8ca18c 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -529,6 +529,22 @@ union hsr { }; + +/* VTTBR: Virtualization Translation Table Base Register */ +struct vttbr { + union { + struct { + u64 baddr :40, /* variable res0: from 0-(x-1) bit */ + res1 :8, + vmid :8, + res2 :8; + }; + u64 vttbr; + }; +}; + +#define INVALID_VTTBR (0UL) + #endif /* HSR.EC == HSR_CP{15,14,10}_32 */ -- 2.9.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |