Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch kvm-arm64/misc-7.1 into kvmarm-master/next

* kvm-arm64/misc-7.1:
KVM: arm64: selftests: Avoid testing the IMPDEF behavior
KVM: arm64: Destroy stage-2 page-table in kvm_arch_destroy_vm()
KVM: arm64: Don't leave mmu->pgt dangling on kvm_init_stage2_mmu() error
KVM: arm64: Prevent the host from using an smc with imm16 != 0

Signed-off-by: Marc Zyngier <maz@kernel.org>

+11 -12
+1
arch/arm64/kvm/arm.c
··· 314 314 if (is_protected_kvm_enabled()) 315 315 pkvm_destroy_hyp_vm(kvm); 316 316 317 + kvm_uninit_stage2_mmu(kvm); 317 318 kvm_destroy_mpidr_data(kvm); 318 319 319 320 kfree(kvm->arch.sysreg_masks);
+7
arch/arm64/kvm/hyp/nvhe/hyp-main.c
··· 796 796 static void handle_host_smc(struct kvm_cpu_context *host_ctxt) 797 797 { 798 798 DECLARE_REG(u64, func_id, host_ctxt, 0); 799 + u64 esr = read_sysreg_el2(SYS_ESR); 799 800 bool handled; 801 + 802 + if (esr & ESR_ELx_xVC_IMM_MASK) { 803 + cpu_reg(host_ctxt, 0) = SMCCC_RET_NOT_SUPPORTED; 804 + goto exit_skip_instr; 805 + } 800 806 801 807 func_id &= ~ARM_SMCCC_CALL_HINTS; 802 808 ··· 812 806 if (!handled) 813 807 default_host_smc_handler(host_ctxt); 814 808 809 + exit_skip_instr: 815 810 /* SMC was trapped, move ELR past the current PC. */ 816 811 kvm_skip_host_instr(); 817 812 }
+1
arch/arm64/kvm/mmu.c
··· 1013 1013 1014 1014 out_destroy_pgtable: 1015 1015 kvm_stage2_destroy(pgt); 1016 + mmu->pgt = NULL; 1016 1017 out_free_pgtable: 1017 1018 kfree(pgt); 1018 1019 return err;
+2 -12
tools/testing/selftests/kvm/arm64/at.c
··· 13 13 14 14 enum { 15 15 CLEAR_ACCESS_FLAG, 16 - TEST_ACCESS_FLAG, 17 16 }; 18 17 19 18 static u64 *ptep_hva; ··· 48 49 GUEST_ASSERT_EQ(FIELD_GET(SYS_PAR_EL1_ATTR, par), MAIR_ATTR_NORMAL); \ 49 50 GUEST_ASSERT_EQ(FIELD_GET(SYS_PAR_EL1_SH, par), PTE_SHARED >> 8); \ 50 51 GUEST_ASSERT_EQ(par & SYS_PAR_EL1_PA, TEST_ADDR); \ 51 - GUEST_SYNC(TEST_ACCESS_FLAG); \ 52 52 } \ 53 53 } while (0) 54 54 ··· 83 85 if (!SYS_FIELD_GET(ID_AA64MMFR1_EL1, HAFDBS, read_sysreg(id_aa64mmfr1_el1))) 84 86 GUEST_DONE(); 85 87 86 - /* 87 - * KVM's software PTW makes the implementation choice that the AT 88 - * instruction sets the access flag. 89 - */ 90 88 sysreg_clear_set(tcr_el1, 0, TCR_HA); 91 89 isb(); 92 90 test_at(false); ··· 96 102 case CLEAR_ACCESS_FLAG: 97 103 /* 98 104 * Delete + reinstall the memslot to invalidate stage-2 99 - * mappings of the stage-1 page tables, forcing KVM to 100 - * use the 'slow' AT emulation path. 105 + * mappings of the stage-1 page tables, allowing KVM to 106 + * potentially use the 'slow' AT emulation path. 101 107 * 102 108 * This and clearing the access flag from host userspace 103 109 * ensures that the access flag cannot be set speculatively ··· 105 111 */ 106 112 clear_bit(__ffs(PTE_AF), ptep_hva); 107 113 vm_mem_region_reload(vcpu->vm, vcpu->vm->memslots[MEM_REGION_PT]); 108 - break; 109 - case TEST_ACCESS_FLAG: 110 - TEST_ASSERT(test_bit(__ffs(PTE_AF), ptep_hva), 111 - "Expected access flag to be set (desc: %lu)", *ptep_hva); 112 114 break; 113 115 default: 114 116 TEST_FAIL("Unexpected SYNC arg: %lu", uc->args[1]);