[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 10/17] arm64: vgic-v3: Add ICV_BPR0_EL1 handler
This patch is ported to xen from linux commit: 423de85a98c2b50715a0784a74f6124fbc0b1548 (KVM: arm64: vgic-v3: Add ICV_BPR0_EL1 handler) Add a handler for reading/writing the guest's view of the ICC_BPR0_EL1 register, which is located in the ICH_VMCR_EL2.BPR0 field. Signed-off-by: Manish Jaggi <manish.jaggi@xxxxxxxxxx> --- xen/arch/arm/arm64/vgic-v3-sr.c | 41 +++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/arm64/sysregs.h | 1 + 2 files changed, 42 insertions(+) diff --git a/xen/arch/arm/arm64/vgic-v3-sr.c b/xen/arch/arm/arm64/vgic-v3-sr.c index f11c7646da..b938e795a8 100644 --- a/xen/arch/arm/arm64/vgic-v3-sr.c +++ b/xen/arch/arm/arm64/vgic-v3-sr.c @@ -701,6 +701,43 @@ static void vreg_emulate_hppir1(struct cpu_user_regs *regs, vgic_v3_read_hppir1(regs, hsr); } +static void vgic_v3_read_bpr0(struct cpu_user_regs *regs, int regidx) +{ + uint32_t vmcr = READ_SYSREG32(ICH_VMCR_EL2); + + set_user_reg(regs, regidx, vgic_v3_get_bpr0(vmcr)); +} + +static void vgic_v3_write_bpr0(struct cpu_user_regs *regs, int regidx) +{ + register_t val = get_user_reg(regs, regidx); + uint8_t bpr_min = vgic_v3_bpr_min(); + uint32_t vmcr = READ_SYSREG32(ICH_VMCR_EL2); + + if ( vmcr & ICH_VMCR_CBPR_MASK ) + return; + + /* Enforce BPR limiting */ + if ( val < bpr_min ) + val = bpr_min; + + val <<= ICH_VMCR_BPR0_SHIFT; + val &= ICH_VMCR_BPR0_MASK; + vmcr &= ~ICH_VMCR_BPR0_MASK; + vmcr |= val; + + WRITE_SYSREG32(vmcr, ICH_VMCR_EL2); +} + +static void vreg_emulate_bpr0(struct cpu_user_regs *regs, + const union hsr hsr) +{ + if ( hsr.sysreg.read ) + vgic_v3_read_bpr0(regs, hsr.sysreg.reg); + else + vgic_v3_write_bpr0(regs, hsr.sysreg.reg); +} + /* * returns true if the register is emulated. */ @@ -755,6 +792,10 @@ bool vgic_v3_handle_cpuif_access(struct cpu_user_regs *regs) vreg_emulate_hppir1(regs, hsr); break; + case HSR_SYSREG_ICC_BPR0_EL1: + vreg_emulate_bpr0(regs, hsr); + break; + default: ret = false; break; diff --git a/xen/include/asm-arm/arm64/sysregs.h b/xen/include/asm-arm/arm64/sysregs.h index 8a6345c2d2..55e8185f6a 100644 --- a/xen/include/asm-arm/arm64/sysregs.h +++ b/xen/include/asm-arm/arm64/sysregs.h @@ -95,6 +95,7 @@ #define HSR_SYSREG_ICC_IAR1_EL1 HSR_SYSREG(3,0,c12,c12,0) #define HSR_SYSREG_ICC_EOIR1_EL1 HSR_SYSREG(3,0,c12,c12,1) #define HSR_SYSREG_ICC_HPPIR1_EL1 HSR_SYSREG(3,0,c12,c12,2) +#define HSR_SYSREG_ICC_BPR0_EL1 HSR_SYSREG(3,0,c12,c8,3) #define HSR_SYSREG_CONTEXTIDR_EL1 HSR_SYSREG(3,0,c13,c0,1) #define HSR_SYSREG_PMCR_EL0 HSR_SYSREG(3,3,c9,c12,0) -- 2.14.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |