KVM: arm64: Fix AArch32 handling of DBGD{CCINT,SCRext} and DBGVCR
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Marc Zyngier
maintainerPATCH 5/12 KVM: arm64: Fix AArch32 handling of DBGD{CCINT,SCRext} and DBGVCR
The DBGD{CCINT,SCRext} and DBGVCR register entries in the cp14 array are missing their target register, resulting in all accesses being targetted at the guard sysreg (indexed by __INVALID_SYSREG__).
Point the emulation code at the actual register entries.
--- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/sys_regs.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-)
arch/arm64/include/asm/kvm_host.h +1 -0
@@ -239,6 +239,7 @@ enum vcpu_sysreg {#define cp14_DBGWCR0 (DBGWCR0_EL1 * 2)#define cp14_DBGWVR0 (DBGWVR0_EL1 * 2)#define cp14_DBGDCCINT (MDCCINT_EL1 * 2) +#define cp14_DBGVCR (DBGVCR32_EL2 * 2)#define NR_COPRO_REGS (NR_SYS_REGS * 2)
arch/arm64/kvm/sys_regs.c +3 -3
@@ -1881,9 +1881,9 @@ static const struct sys_reg_desc cp14_regs[] = { { Op1( 0), CRn( 0), CRm( 1), Op2( 0), trap_raz_wi },DBG_BCR_BVR_WCR_WVR (1 ),/* DBGDCCINT */ - { Op1( 0), CRn( 0), CRm( 2), Op2( 0), trap_debug32 }, + { Op1( 0), CRn( 0), CRm( 2), Op2( 0), trap_debug32, NULL, cp14_DBGDCCINT },/* DBGDSCRext */ - { Op1( 0), CRn( 0), CRm( 2), Op2( 2), trap_debug32 }, + { Op1( 0), CRn( 0), CRm( 2), Op2( 2), trap_debug32, NULL, cp14_DBGDSCRext },DBG_BCR_BVR_WCR_WVR (2 ),/* DBGDTR[RT]Xint */ { Op1( 0), CRn( 0), CRm( 3), Op2( 0), trap_raz_wi },
@@ -1898,7 +1898,7 @@ static const struct sys_reg_desc cp14_regs[] = { { Op1( 0), CRn( 0), CRm( 6), Op2( 2), trap_raz_wi },DBG_BCR_BVR_WCR_WVR (6 ),/* DBGVCR */ - { Op1( 0), CRn( 0), CRm( 7), Op2( 0), trap_debug32 }, + { Op1( 0), CRn( 0), CRm( 7), Op2( 0), trap_debug32, NULL, cp14_DBGVCR },DBG_BCR_BVR_WCR_WVR (7 ),DBG_BCR_BVR_WCR_WVR (8 ), DBG_BCR_BVR_WCR_WVR(9),
Signature · 1 line
2.28.0
Marc Zyngier
maintainerPATCH 8/12 KVM: arm64: Force PTE mapping on fault resulting in a device mapping
In reply to a message not in the archiveFrom: Santosh Shukla <[email protected]>
VFIO allows a device driver to resolve a fault by mapping a MMIO range. This can be subsequently result in user_mem_abort() to try and compute a huge mapping based on the MMIO pfn, which is a sure recipe for things to go wrong.
Instead, force a PTE mapping when the pfn faulted in has a device mapping.
--- arch/arm64/kvm/mmu.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kvm/mmu.c +1 -0
@@ -851,6 +851,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,if (kvm_is_device_pfn (pfn)) { device = true; + force_pte = true; }else if (logging_active && !write_fault) {/* * Only actually map the page as writable if this was a write
Signature · 1 line
2.28.0