[PATCH OLK-6.6 v1 00/14] KVM: arm64: Backport KVM_PRE_FAULT_MEMORY to OLK-6.6
This series backports the upstream ARM64 KVM_PRE_FAULT_MEMORY feature (mainline v7.4-rc1) to the openEuler OLK-6.6 kernel. KVM_PRE_FAULT_MEMORY allows userspace to pre-populate stage-2 page tables for a given GPA range before the guest actually accesses it, reducing the latency of the first guest access. The upstream series is built on a newer arm64 KVM fault-handling infrastructure, so this backport includes the minimal prerequisite changes required by OLK-6.6. Differences from the upstream series: - Only the kvm_s2_fault_desc structure and the user_mem_abort() signature change are backported. The upstream struct kvm_s2_fault split and the gmem_abort()/guest_memfd path are omitted because OLK-6.6 does not have that infrastructure. - The OLK-6.6-specific arguments (struct kvm_s1_trans *result, fault_status, shadow_seq and walk_seq) are kept as separate parameters instead of being folded into kvm_s2_fault_desc. - The PVM shadow stage-1 path is preserved. Shared fault-handling code uses the new ESR-based helpers, while the PVM exec_fault semantics (esr_trap_is_iabt()) remain distinct from the ordinary path (esr_abt_is_exec_fault()). - Nested stage-2 and pKVM paths are not present or not supported in this backport. The pre-fault hook rejects pKVM, PVM and CCA realms that do not use the canonical stage-2 page tables targeted by this implementation. - The arm64 selftest is adapted to the OLK-6.6 selftest tree (pthread usage, u64 instead of gpa_t, TEST_ASSERT messages) and enabled for aarch64. - The synthetic ESR used by pre-fault is a read fault. Pre-faulting therefore establishes read-only mappings and leaves write/exec permission upgrades and COW to the first real guest fault. Validation: - Kernel build: 0 errors. - Booted 6.6.0+ on a 96-CPU arm64 EulerOS 2.0 SP16 machine. - pre_fault_memory_test passes on 10 guest modes with anonymous, THP, shmem, 2M/64K/32M hugetlb backings; 1G hugetlb passes with guest mode 14. - A 2U4G benchmark (2 vCPUs, 4G guest RAM) shows two concurrent 2G pre-faults take about 259 ms versus about 518 ms for a single 4G pre-fault. Jack Thomson (3): KVM: arm64: Pass walk flags to kvm_pgtable_get_leaf() KVM: selftests: Enable pre_fault_memory_test for arm64 KVM: selftests: Add option for different backing in pre-fault tests Lorenzo Stoakes (ARM) (10): KVM: Allow architectures to disallow pre-fault arm64: Add ESR fault helpers KVM: arm64: Use ESR helpers in guest abort handling KVM: arm64: Propagate and use esr in s2fd when handling guest aborts KVM: arm64: Propagate and use mmu in s2fd when handling guest aborts KVM: arm64: Propagate and use kvm_s2_fault_result on S2 fault KVM: arm64: Size the stage-2 memcache from the fault MMU KVM: arm64: Propagate EHWPOISON in kvm_s2_fault_pin_pfn() KVM: arm64: Implement KVM_PRE_FAULT_MEMORY Documentation: KVM: document arm64 KVM_PRE_FAULT_MEMORY Marc Zyngier (1): KVM: arm64: Move fault context to const structure Documentation/virt/kvm/api.rst | 22 +- arch/arm64/include/asm/esr.h | 37 ++ arch/arm64/include/asm/kvm_emulate.h | 61 ++-- arch/arm64/include/asm/kvm_pgtable.h | 5 +- arch/arm64/kvm/Kconfig | 1 + arch/arm64/kvm/arm.c | 3 + arch/arm64/kvm/hyp/nvhe/mem_protect.c | 2 +- arch/arm64/kvm/hyp/pgtable.c | 5 +- arch/arm64/kvm/mmu.c | 243 +++++++++++-- arch/arm64/kvm/virtcca_cvm.c | 2 +- arch/x86/kvm/mmu/mmu.c | 11 +- include/linux/kvm_host.h | 1 + tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/pre_fault_memory_test.c | 324 ++++++++++++++++++ virt/kvm/kvm_main.c | 10 +- 15 files changed, 650 insertions(+), 78 deletions(-) create mode 100644 tools/testing/selftests/kvm/pre_fault_memory_test.c -- 2.43.0
From: Marc Zyngier <maz@kernel.org> mainline inclusion from mainline-v7.1-rc1 commit c6f4d84643498bc855e2f6719a3233ded0e2dc63 category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/c6f4d84643498bc855e2f6719a3233ded0e... -------------------------------- commit c6f4d84643498bc855e2f6719a3233ded0e2dc63 upstream In order to make it clearer what gets updated or not during fault handling, move a set of information that losely represents the fault context. This gets populated early, from handle_mem_abort(), and gets passed along as a const pointer. user_mem_abort()'s signature is majorly improved in doing so, and kvm_s2_fault loses a bunch of fields. gmem_abort() will get a similar treatment down the line. [Backport note] Adapted for OLK-6.6: - Only the kvm_s2_fault_desc structure and the user_mem_abort() signature change are backported. The upstream commit also introduces struct kvm_s2_fault and splits user_mem_abort() into helpers, but OLK-6.6's user_mem_abort() carries vendor-specific handling, so that split is intentionally omitted. - The struct kvm_s1_trans *result argument is kept as a separate parameter and is not part of kvm_s2_fault_desc. PVM-specific data structures and control flow are not restructured by this series. - fault_status, shadow_seq and walk_seq are OLK-6.6-specific and are kept as separate arguments, so user_mem_abort() drops from 8 to 5 parameters (6 once kvm_s2_fault_result is added by a later patch). - This is a pure prerequisite cleanup and has no functional change. Tested-by: Fuad Tabba <tabba@google.com> Reviewed-by: Fuad Tabba <tabba@google.com> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- arch/arm64/kvm/mmu.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index f24c297787a4..c01338229510 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1597,12 +1597,22 @@ static int adjust_shadow_s1_prots(struct kvm_vcpu *vcpu, return 0; } -static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, +struct kvm_s2_fault_desc { + struct kvm_vcpu *vcpu; + phys_addr_t fault_ipa; + struct kvm_memory_slot *memslot; + unsigned long hva; +}; + +static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, struct kvm_s1_trans *result, - struct kvm_memory_slot *memslot, unsigned long hva, unsigned long fault_status, unsigned long shadow_seq, unsigned long walk_seq) { + struct kvm_vcpu *vcpu = s2fd->vcpu; + phys_addr_t fault_ipa = s2fd->fault_ipa; + struct kvm_memory_slot *memslot = s2fd->memslot; + unsigned long hva = s2fd->hva; int ret = 0; bool write_fault, writable, force_pte = false; bool exec_fault, mte_allowed; @@ -2126,8 +2136,14 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) goto out_unlock; } - ret = user_mem_abort(vcpu, fault_ipa, result, memslot, hva, - fault_status, shadow_seq, walk_seq); + const struct kvm_s2_fault_desc s2fd = { + .vcpu = vcpu, + .fault_ipa = fault_ipa, + .memslot = memslot, + .hva = hva, + }; + + ret = user_mem_abort(&s2fd, result, fault_status, shadow_seq, walk_seq); if (ret == 0) ret = 1; out: -- 2.43.0
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org> mainline inclusion from mainline-v7.4-rc1 commit caa63620f9e37a5eec4d0af13534ebd6c0d33f97 category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/caa63620f9e37a5eec4d0af13534ebd6c0d... -------------------------------- commit caa63620f9e37a5eec4d0af13534ebd6c0d33f97 upstream All existing architectures which implement KVM pre-fault (x86, s390) have mechanisms for disallowing pre-faulting. Currently these are open coded as part of kvm_arch_vcpu_pre_fault_memory(). Formalise this by moving them into a new kvm_arch_pre_fault_allowed() hook, which every architecture selecting CONFIG_KVM_GENERIC_PRE_FAULT_MEMORY must implement, returning an error code if the operation is disallowed or 0 otherwise. The hook is called early in the generic code, allowing architectures to disallow the operation prior to vCPU load. This is important, as kvm_vcpu_pre_fault_memory() is the only place where generic code can call vcpu_load() on a vCPU that has not yet been initialised. This lays the foundation for a future change which implements pre-faulting for arm64 which needs to disallow the mechanism for uninitialised vCPUs. [Backport note] Adapted for OLK-6.6: - Only x86 selects CONFIG_KVM_GENERIC_PRE_FAULT_MEMORY in this tree, so the s390 and TDX hunks from the upstream patch are omitted. - OLK-6.6 stores pre_fault_allowed in struct kvm_arch_ext, so the x86 hook checks kvm->arch_ext.pre_fault_allowed instead of kvm->arch.pre_fault_allowed. - The now-redundant check in kvm_arch_vcpu_pre_fault_memory() is dropped, matching the upstream change. Suggested-by: Oliver Upton <oupton@kernel.org> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Acked-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-1-d4b0b4dfa8c3@kernel.... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- arch/x86/kvm/mmu/mmu.c | 11 ++++++++--- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 10 +++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 262317160852..4f879391cf1f 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -4704,6 +4704,14 @@ static int kvm_tdp_map_page(struct kvm_vcpu *vcpu, gpa_t gpa, u64 error_code, } } +int kvm_arch_pre_fault_allowed(struct kvm_vcpu *vcpu) +{ + if (!vcpu->kvm->arch_ext.pre_fault_allowed) + return -EOPNOTSUPP; + + return 0; +} + long kvm_arch_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu, struct kvm_pre_fault_memory *range) { @@ -4712,9 +4720,6 @@ long kvm_arch_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu, u64 end; int r; - if (!vcpu->kvm->arch_ext.pre_fault_allowed) - return -EOPNOTSUPP; - /* * reload is efficient when called repeatedly, so we can do it on * every iteration. diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index e2fbdb6715f3..772265f4b9f1 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -2690,6 +2690,7 @@ void kvm_arch_gmem_invalidate_range(struct kvm *kvm, struct kvm_gfn_range *range #endif #ifdef CONFIG_KVM_GENERIC_PRE_FAULT_MEMORY +int kvm_arch_pre_fault_allowed(struct kvm_vcpu *vcpu); long kvm_arch_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu, struct kvm_pre_fault_memory *range); #endif diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 7ba6e7e2e8e1..7837d2f39d4f 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -4609,7 +4609,7 @@ static int kvm_vcpu_ioctl_get_stats_fd(struct kvm_vcpu *vcpu) static int kvm_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu, struct kvm_pre_fault_memory *range) { - int idx; + int idx, err; long r; u64 full_size; @@ -4621,6 +4621,14 @@ static int kvm_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu, range->gpa + range->size <= range->gpa) return -EINVAL; + /* + * Certain architectures (e.g. arm64) need to reject the ioctl 'early' + * before vcpu_load(). + */ + err = kvm_arch_pre_fault_allowed(vcpu); + if (err) + return err; + vcpu_load(vcpu); idx = srcu_read_lock(&vcpu->kvm->srcu); -- 2.43.0
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org> mainline inclusion from mainline-v7.4-rc1 commit eb2eb48c8d72b19a7163cfc9e4b416e60f5b9e2d category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/eb2eb48c8d72b19a7163cfc9e4b416e60f5... -------------------------------- commit eb2eb48c8d72b19a7163cfc9e4b416e60f5b9e2d upstream Add helper functions which operate directly on an ESR value rather than trying to access the register itself. These mirror equivalent KVM vCPU wrappers in kvm_emulate.h and allow those wrappers and KVM's stage-2 fault handling to operate on a plain ESR value. This is needed to later generate a synthetic fault for the stage-2 page table pre-faulting mechanism. No functional change intended. [Backport note] Adapted for OLK-6.6: - The C helper block is guarded by __ASSEMBLY__ in this tree, so the helpers were inserted there instead of after an __ASSEMBLER__ guard. - OLK-6.6 only defines ESR_ELx_FSC_SEA_TTW0..3 and ESR_ELx_FSC_SECC_TTW0..3. The function-like ESR_ELx_FSC_SEA_TTW(n) and ESR_ELx_FSC_SECC_TTW(n) macros used by esr_abt_is_sea() were added so the upstream switch-range logic can be kept verbatim. - esr_abt_get_fault_level() is added as the ESR-based counterpart of kvm_vcpu_trap_get_fault_level(), which now simply wraps it. Reviewed-by: Oliver Upton <oupton@kernel.org> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-2-d4b0b4dfa8c3@kernel.... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- arch/arm64/include/asm/esr.h | 36 ++++++++++++++++++++++++++++ arch/arm64/include/asm/kvm_emulate.h | 12 +++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h index 0a775cbb3e49..eb32ec325cac 100644 --- a/arch/arm64/include/asm/esr.h +++ b/arch/arm64/include/asm/esr.h @@ -130,6 +130,8 @@ #define ESR_ELx_FSC_SECC_TTW1 (0x1d) #define ESR_ELx_FSC_SECC_TTW2 (0x1e) #define ESR_ELx_FSC_SECC_TTW3 (0x1f) +#define ESR_ELx_FSC_SEA_TTW(n) (0x14 + (n)) +#define ESR_ELx_FSC_SECC_TTW(n) (0x1c + (n)) /* ISS field definitions for Data Aborts */ #define ESR_ELx_ISV_SHIFT (24) @@ -402,6 +404,40 @@ static inline u64 sysreg_to_esr_sys64_iss(u32 reg) #ifndef __ASSEMBLY__ #include <asm/types.h> +static __always_inline bool esr_trap_is_iabt(unsigned long esr) +{ + return ESR_ELx_EC(esr) == ESR_ELx_EC_IABT_LOW; +} + +static __always_inline u8 esr_abt_get_fault_level(unsigned long esr) +{ + return esr & ESR_ELx_FSC_LEVEL; +} + +/* Always check for S1PTW *before* using this. */ +static __always_inline bool esr_dabt_is_write(unsigned long esr) +{ + return esr & ESR_ELx_WNR; +} + +static __always_inline bool esr_dabt_is_cm(unsigned long esr) +{ + return esr & ESR_ELx_CM; +} + +static __always_inline bool esr_abt_is_sea(unsigned long esr) +{ + switch (esr & ESR_ELx_FSC) { + case ESR_ELx_FSC_EXTABT: + case ESR_ELx_FSC_SEA_TTW(-1) ... ESR_ELx_FSC_SEA_TTW(3): + case ESR_ELx_FSC_SECC: + case ESR_ELx_FSC_SECC_TTW(-1) ... ESR_ELx_FSC_SECC_TTW(3): + return true; + default: + return false; + } +} + static inline bool esr_is_data_abort(unsigned long esr) { const unsigned long ec = ESR_ELx_EC(esr); diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h index 11b0314053e3..a36796307680 100644 --- a/arch/arm64/include/asm/kvm_emulate.h +++ b/arch/arm64/include/asm/kvm_emulate.h @@ -443,6 +443,16 @@ static __always_inline u64 kvm_vcpu_get_esr(const struct kvm_vcpu *vcpu) return vcpu->arch.fault.esr_el2; } +static __always_inline bool esr_abt_is_s1ptw(unsigned long esr) +{ + return esr & ESR_ELx_S1PTW; +} + +static __always_inline bool esr_abt_is_exec_fault(unsigned long esr) +{ + return esr_trap_is_iabt(esr) && !esr_abt_is_s1ptw(esr); +} + static __always_inline int kvm_vcpu_get_condition(const struct kvm_vcpu *vcpu) { u64 esr = kvm_vcpu_get_esr(vcpu); @@ -552,7 +562,7 @@ static __always_inline u8 kvm_vcpu_trap_get_fault_type(const struct kvm_vcpu *vc static __always_inline u8 kvm_vcpu_trap_get_fault_level(const struct kvm_vcpu *vcpu) { - return kvm_vcpu_get_esr(vcpu) & ESR_ELx_FSC_LEVEL; + return esr_abt_get_fault_level(kvm_vcpu_get_esr(vcpu)); } static __always_inline bool kvm_vcpu_abt_issea(const struct kvm_vcpu *vcpu) -- 2.43.0
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org> mainline inclusion from mainline-v7.4-rc1 commit 18b94675b1fb22b5ce9b607f9de818d916b3da16 category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/18b94675b1fb22b5ce9b607f9de818d916b... -------------------------------- commit 18b94675b1fb22b5ce9b607f9de818d916b3da16 upstream Convert kvm_vcpu_* ESR wrappers in kvm_emulate.h and the stage-2 abort handling logic in mmu.c to use the newly introduced ESR helpers. kvm_is_write_fault() is split in two, with esr_abt_is_write_fault() handling the esr parts of the operation and kvm_is_write_fault() wrapping it. Introduce/modify kvm_s2_fault_is_{perm,exec,write}(), kvm_s2_perm_fault_granule() so the abort path reads the ESR from a single place. This is to allow a later change to permit stage 2 pre-faulting via a synthetic ESR value. Remove now-unused kvm_vcpu_dabt_is_cm(), kvm_vcpu_trap_is_exec_fault() and kvm_vcpu_trap_get_perm_fault_granule(). No functional change intended. [Backport note] Adapted for OLK-6.6: - OLK-6.6 does not have gmem_abort() or the s2fd helper functions, so the s2fd-specific hunks (kvm_s2_fault_is_*, kvm_s2_perm_fault_granule) are omitted. Only the ESR-helper conversion of the existing abort path is applied. - kvm_vcpu_dabt_is_cm() is kept because OLK-6.6's tmi.c still calls it; kvm_vcpu_trap_is_exec_fault() remains until the next patch converts its last caller. - The existing OLK-6.6 cache-maintenance check in kvm_is_write_fault() is preserved inside esr_abt_is_write_fault(). Reviewed-by: Oliver Upton <oupton@kernel.org> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-3-d4b0b4dfa8c3@kernel.... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- arch/arm64/include/asm/kvm_emulate.h | 41 +++++++++++----------------- arch/arm64/kvm/mmu.c | 30 ++++++++++---------- 2 files changed, 31 insertions(+), 40 deletions(-) diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h index a36796307680..373c20b998b3 100644 --- a/arch/arm64/include/asm/kvm_emulate.h +++ b/arch/arm64/include/asm/kvm_emulate.h @@ -510,18 +510,18 @@ static __always_inline int kvm_vcpu_dabt_get_rd(const struct kvm_vcpu *vcpu) static __always_inline bool kvm_vcpu_abt_iss1tw(const struct kvm_vcpu *vcpu) { - return !!(kvm_vcpu_get_esr(vcpu) & ESR_ELx_S1PTW); + return esr_abt_is_s1ptw(kvm_vcpu_get_esr(vcpu)); } /* Always check for S1PTW *before* using this. */ static __always_inline bool kvm_vcpu_dabt_iswrite(const struct kvm_vcpu *vcpu) { - return kvm_vcpu_get_esr(vcpu) & ESR_ELx_WNR; + return esr_dabt_is_write(kvm_vcpu_get_esr(vcpu)); } static inline bool kvm_vcpu_dabt_is_cm(const struct kvm_vcpu *vcpu) { - return !!(kvm_vcpu_get_esr(vcpu) & ESR_ELx_CM); + return esr_dabt_is_cm(kvm_vcpu_get_esr(vcpu)); } static __always_inline unsigned int kvm_vcpu_dabt_get_as(const struct kvm_vcpu *vcpu) @@ -542,7 +542,7 @@ static __always_inline u8 kvm_vcpu_trap_get_class(const struct kvm_vcpu *vcpu) static inline bool kvm_vcpu_trap_is_iabt(const struct kvm_vcpu *vcpu) { - return kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_IABT_LOW; + return esr_trap_is_iabt(kvm_vcpu_get_esr(vcpu)); } static inline bool kvm_vcpu_trap_is_exec_fault(const struct kvm_vcpu *vcpu) @@ -567,21 +567,7 @@ static __always_inline u8 kvm_vcpu_trap_get_fault_level(const struct kvm_vcpu *v static __always_inline bool kvm_vcpu_abt_issea(const struct kvm_vcpu *vcpu) { - switch (kvm_vcpu_trap_get_fault(vcpu)) { - case ESR_ELx_FSC_EXTABT: - case ESR_ELx_FSC_SEA_TTW0: - case ESR_ELx_FSC_SEA_TTW1: - case ESR_ELx_FSC_SEA_TTW2: - case ESR_ELx_FSC_SEA_TTW3: - case ESR_ELx_FSC_SECC: - case ESR_ELx_FSC_SECC_TTW0: - case ESR_ELx_FSC_SECC_TTW1: - case ESR_ELx_FSC_SECC_TTW2: - case ESR_ELx_FSC_SECC_TTW3: - return true; - default: - return false; - } + return esr_abt_is_sea(kvm_vcpu_get_esr(vcpu)); } static __always_inline int kvm_vcpu_sys_get_rt(struct kvm_vcpu *vcpu) @@ -590,9 +576,9 @@ static __always_inline int kvm_vcpu_sys_get_rt(struct kvm_vcpu *vcpu) return ESR_ELx_SYS64_ISS_RT(esr); } -static inline bool kvm_is_write_fault(struct kvm_vcpu *vcpu) +static inline bool esr_abt_is_write_fault(unsigned long esr) { - if (kvm_vcpu_abt_iss1tw(vcpu)) { + if (esr_abt_is_s1ptw(esr)) { /* * Only a permission fault on a S1PTW should be * considered as a write. Otherwise, page tables baked @@ -605,7 +591,7 @@ static inline bool kvm_is_write_fault(struct kvm_vcpu *vcpu) * first), then a permission fault to allow the flags * to be set. */ - switch (kvm_vcpu_trap_get_fault_type(vcpu)) { + switch (esr & ESR_ELx_FSC_TYPE) { case ESR_ELx_FSC_PERM: return true; default: @@ -613,7 +599,7 @@ static inline bool kvm_is_write_fault(struct kvm_vcpu *vcpu) } } - if (kvm_vcpu_trap_is_iabt(vcpu)) + if (esr_trap_is_iabt(esr)) return false; /* @@ -621,10 +607,15 @@ static inline bool kvm_is_write_fault(struct kvm_vcpu *vcpu) * shadow, even though its abort reports WnR. IVAC traps as UNKNOWN * and its guest write permission is checked by the PVM backend. */ - if (is_pvm_mode() && kvm_vcpu_dabt_is_cm(vcpu)) + if (is_pvm_mode() && esr_dabt_is_cm(esr)) return false; - return kvm_vcpu_dabt_iswrite(vcpu); + return esr_dabt_is_write(esr); +} + +static inline bool kvm_is_write_fault(struct kvm_vcpu *vcpu) +{ + return esr_abt_is_write_fault(kvm_vcpu_get_esr(vcpu)); } static inline unsigned long kvm_vcpu_get_mpidr_aff(struct kvm_vcpu *vcpu) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index c01338229510..3ae04d3d104c 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1960,20 +1960,21 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) struct kvm_s1_trans *result = NULL; unsigned long shadow_seq = 0; unsigned long walk_seq = 0; + unsigned long esr = kvm_vcpu_get_esr(vcpu); - fault_status = kvm_vcpu_trap_get_fault_type(vcpu); + fault_status = esr & ESR_ELx_FSC_TYPE; fault_ipa = is_pvm_mode() ? kvm_vcpu_get_hfar(vcpu) : kvm_vcpu_get_fault_ipa(vcpu); ipa = fault_ipa; - is_iabt = kvm_vcpu_trap_is_iabt(vcpu); + is_iabt = esr_trap_is_iabt(esr); #ifdef CONFIG_ARM64_HDBSS /* * HDBSS buffer already flushed when enter handle_trap_exceptions(). * Nothing to do here. */ - iss2 = ESR_ELx_ISS2(kvm_vcpu_get_esr(vcpu)); + iss2 = ESR_ELx_ISS2(esr); if (fault_status == ESR_ELx_FSC_PERM && (iss2 & ESR_ELx_HDBSSF)) return 1; #endif @@ -1998,34 +1999,33 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) } /* Synchronous External Abort? */ - if (kvm_vcpu_abt_issea(vcpu)) { + if (esr_abt_is_sea(esr)) { /* * For RAS the host kernel may handle this abort. * There is no need to pass the error into the guest. */ - if (kvm_handle_guest_sea(fault_ipa, kvm_vcpu_get_esr(vcpu))) + if (kvm_handle_guest_sea(fault_ipa, esr)) kvm_inject_vabt(vcpu); return 1; } - trace_kvm_guest_fault(*vcpu_pc(vcpu), kvm_vcpu_get_esr(vcpu), + trace_kvm_guest_fault(*vcpu_pc(vcpu), esr, kvm_vcpu_get_hfar(vcpu), fault_ipa); /* PVM also receives stage-1 address-size faults (FSC type 0). */ pvm_size_fault = is_pvm_mode() && fault_status == 0; if (pvm_size_fault && !kvm_pvm_vcpu_mmu_enabled(vcpu)) - return kvm_pvm_inject_s1_fault(vcpu, - kvm_vcpu_trap_get_fault(vcpu)); + return kvm_pvm_inject_s1_fault(vcpu, esr & ESR_ELx_FSC); /* Keep the ordinary stage-2 FSC whitelist. */ if (fault_status != ESR_ELx_FSC_FAULT && fault_status != ESR_ELx_FSC_PERM && fault_status != ESR_ELx_FSC_ACCESS && !pvm_size_fault) { - kvm_err("Unsupported FSC: EC=%#x xFSC=%#lx ESR_EL2=%#lx\n", - kvm_vcpu_trap_get_class(vcpu), - (unsigned long)kvm_vcpu_trap_get_fault(vcpu), - (unsigned long)kvm_vcpu_get_esr(vcpu)); + kvm_err("Unsupported FSC: EC=%#lx xFSC=%#lx ESR_EL2=%#lx\n", + ESR_ELx_EC(esr), + (unsigned long)(esr & ESR_ELx_FSC), + (unsigned long)esr); return -EFAULT; } @@ -2068,7 +2068,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) gfn = kvm_gpa_from_fault(vcpu->kvm, ipa) >> PAGE_SHIFT; memslot = gfn_to_memslot(vcpu->kvm, gfn); hva = gfn_to_hva_memslot_prot(memslot, gfn, &writable); - write_fault = kvm_is_write_fault(vcpu); + write_fault = esr_abt_is_write_fault(esr); if (kvm_is_error_hva(hva) || (write_fault && !writable)) { /* * The guest has put either its instructions or its page-tables @@ -2081,7 +2081,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) goto out; } - if (kvm_vcpu_abt_iss1tw(vcpu)) { + if (esr_abt_is_s1ptw(esr)) { kvm_inject_dabt(vcpu, kvm_vcpu_get_hfar(vcpu)); ret = 1; goto out_unlock; @@ -2097,7 +2097,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) * So let's assume that the guest is just being * cautious, and skip the instruction. */ - if (kvm_is_error_hva(hva) && kvm_vcpu_dabt_is_cm(vcpu)) { + if (kvm_is_error_hva(hva) && esr_dabt_is_cm(esr)) { kvm_incr_pc(vcpu); ret = 1; goto out_unlock; -- 2.43.0
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org> mainline inclusion from mainline-v7.4-rc1 commit 2b8033a99631b744a67a6fa5df46d0d7b3b9ab7c category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/2b8033a99631b744a67a6fa5df46d0d7b3b... -------------------------------- commit 2b8033a99631b744a67a6fa5df46d0d7b3b9ab7c upstream kvm_handle_guest_abort() establishes a kvm_s2_fault_desc data structure, s2fd, to store and propagate state to either pkvm_mem_abort(), gmem_abort() or user_mem_abort() handlers. Each of these, however, examines the Exception Syndrome Register (ESR) via s2fd->vcpu. Introduce an s2fd->esr field to abstract this and propagate it to callers. The value of this (beyond refactoring) is to be able to later generate faults with a synthetic esr, specifically to implement stage 2 page table pre-faulting. Abort handlers which use kvm_s2_fault_desc - gmem_abort() and user_mem_abort() - now only reference s2fd->esr and do not look it up in any other way, which makes it safe to pass a synthetic s2fd->esr value to these functions. No functional change intended. [Backport note] Adapted for OLK-6.6: - The ESR is propagated through the s2fd->esr field added by this patch. - user_mem_abort() now derives fault_level, write_fault and exec_fault from the passed-in esr rather than re-reading the vCPU ESR, which is what makes a synthetic ESR usable by the later pre-fault patch. - fault_level and write_fault are now derived unconditionally from the passed-in esr; esr_abt_is_write_fault() retains the PVM-specific cache-maintenance check. - exec_fault keeps the original PVM distinction: the PVM path uses esr_trap_is_iabt() (equivalent to the old kvm_vcpu_trap_is_iabt()), while the ordinary path uses esr_abt_is_exec_fault(). - The now-unused kvm_vcpu_trap_get_fault_level() and kvm_vcpu_trap_is_exec_fault() wrappers are removed. Reviewed-by: Oliver Upton <oupton@kernel.org> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-4-d4b0b4dfa8c3@kernel.... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- arch/arm64/include/asm/kvm_emulate.h | 10 ---------- arch/arm64/kvm/mmu.c | 11 +++++++---- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h index 373c20b998b3..d8f91faeaf9a 100644 --- a/arch/arm64/include/asm/kvm_emulate.h +++ b/arch/arm64/include/asm/kvm_emulate.h @@ -545,11 +545,6 @@ static inline bool kvm_vcpu_trap_is_iabt(const struct kvm_vcpu *vcpu) return esr_trap_is_iabt(kvm_vcpu_get_esr(vcpu)); } -static inline bool kvm_vcpu_trap_is_exec_fault(const struct kvm_vcpu *vcpu) -{ - return kvm_vcpu_trap_is_iabt(vcpu) && !kvm_vcpu_abt_iss1tw(vcpu); -} - static __always_inline u8 kvm_vcpu_trap_get_fault(const struct kvm_vcpu *vcpu) { return kvm_vcpu_get_esr(vcpu) & ESR_ELx_FSC; @@ -560,11 +555,6 @@ static __always_inline u8 kvm_vcpu_trap_get_fault_type(const struct kvm_vcpu *vc return kvm_vcpu_get_esr(vcpu) & ESR_ELx_FSC_TYPE; } -static __always_inline u8 kvm_vcpu_trap_get_fault_level(const struct kvm_vcpu *vcpu) -{ - return esr_abt_get_fault_level(kvm_vcpu_get_esr(vcpu)); -} - static __always_inline bool kvm_vcpu_abt_issea(const struct kvm_vcpu *vcpu) { return esr_abt_is_sea(kvm_vcpu_get_esr(vcpu)); diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 3ae04d3d104c..eab7ebd0a1d2 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1602,6 +1602,7 @@ struct kvm_s2_fault_desc { phys_addr_t fault_ipa; struct kvm_memory_slot *memslot; unsigned long hva; + unsigned long esr; }; static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, @@ -1613,6 +1614,7 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, phys_addr_t fault_ipa = s2fd->fault_ipa; struct kvm_memory_slot *memslot = s2fd->memslot; unsigned long hva = s2fd->hva; + unsigned long esr = s2fd->esr; int ret = 0; bool write_fault, writable, force_pte = false; bool exec_fault, mte_allowed; @@ -1629,7 +1631,7 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, gfn_t gfn; kvm_pfn_t pfn; bool logging_active = memslot_is_logging(memslot); - unsigned long fault_level = kvm_vcpu_trap_get_fault_level(vcpu); + unsigned long fault_level = esr_abt_get_fault_level(esr); long vma_pagesize, fault_granule; enum kvm_pgtable_prot prot = KVM_PGTABLE_PROT_R; struct kvm_pgtable *pgt; @@ -1638,7 +1640,7 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, fault_granule = result ? PAGE_SIZE : 1UL << ARM64_HW_PGTABLE_LEVEL_SHIFT(fault_level); - write_fault = kvm_is_write_fault(vcpu); + write_fault = esr_abt_is_write_fault(esr); /* * Realms cannot map protected pages read-only @@ -1649,8 +1651,8 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, if (vcpu_is_tec(vcpu)) prot = KVM_PGTABLE_PROT_R | KVM_PGTABLE_PROT_W; - exec_fault = result ? kvm_vcpu_trap_is_iabt(vcpu) : - kvm_vcpu_trap_is_exec_fault(vcpu); + exec_fault = result ? esr_trap_is_iabt(esr) : + esr_abt_is_exec_fault(esr); VM_BUG_ON(write_fault && exec_fault); vcpu->stat.mabt_exit_stat++; @@ -2141,6 +2143,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) .fault_ipa = fault_ipa, .memslot = memslot, .hva = hva, + .esr = esr, }; ret = user_mem_abort(&s2fd, result, fault_status, shadow_seq, walk_seq); -- 2.43.0
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org> mainline inclusion from mainline-v7.4-rc1 commit b477bcdfa0342145084948a079b606e058066d80 category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/b477bcdfa0342145084948a079b606e0580... -------------------------------- commit b477bcdfa0342145084948a079b606e058066d80 upstream kvm_handle_guest_abort() establishes a kvm_s2_fault_desc data structure, s2fd, to store and propagate state to either pkvm_mem_abort(), gmem_abort() or user_mem_abort() handlers. Each of these, however, examines the state of the stage 2 MMU via vcpu->arch.hw_mmu. Introduce an s2fd->mmu field to abstract this and propagate it to callers. Similar to adding the esr field, this allows injection of synthetic faults with the ultimate intention of implementing stage 2 page table pre-faulting. No functional change intended. [Backport note] Adapted for OLK-6.6: - The stage-2 MMU is propagated through the s2fd->mmu field added by this patch. - kvm_handle_guest_abort() caches vcpu->arch.hw_mmu in a local mmu variable and uses it for the IPA-limit check and the canonical page-table selection, matching the upstream intent. - The PVM shadow-stage-1 page-table selection is left unchanged. Reviewed-by: Oliver Upton <oupton@kernel.org> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-5-d4b0b4dfa8c3@kernel.... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- arch/arm64/kvm/mmu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index eab7ebd0a1d2..5279399d3120 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1603,6 +1603,7 @@ struct kvm_s2_fault_desc { struct kvm_memory_slot *memslot; unsigned long hva; unsigned long esr; + struct kvm_s2_mmu *mmu; }; static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, @@ -1615,6 +1616,7 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, struct kvm_memory_slot *memslot = s2fd->memslot; unsigned long hva = s2fd->hva; unsigned long esr = s2fd->esr; + struct kvm_s2_mmu *mmu = s2fd->mmu; int ret = 0; bool write_fault, writable, force_pte = false; bool exec_fault, mte_allowed; @@ -1805,7 +1807,7 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, read_lock(&kvm->mmu_lock); pgt = result ? (kernel_shadow ? vcpu_to_pvm(vcpu)->skern_mmu->mmu.pgt : - vcpu_to_pvm(vcpu)->suser_mmu->mmu.pgt) : vcpu->arch.hw_mmu->pgt; + vcpu_to_pvm(vcpu)->suser_mmu->mmu.pgt) : mmu->pgt; if (mmu_invalidate_retry(kvm, mmu_seq)) goto out_unlock; if (result && mmu_invalidate_retry(kvm, walk_seq)) @@ -1963,6 +1965,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) unsigned long shadow_seq = 0; unsigned long walk_seq = 0; unsigned long esr = kvm_vcpu_get_esr(vcpu); + struct kvm_s2_mmu *mmu = vcpu->arch.hw_mmu; fault_status = esr & ESR_ELx_FSC_TYPE; @@ -1989,7 +1992,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) } /* Falls between the IPA range and the PARange? */ - if (fault_ipa >= BIT_ULL(vcpu->arch.hw_mmu->pgt->ia_bits)) { + if (fault_ipa >= BIT_ULL(mmu->pgt->ia_bits)) { fault_ipa |= kvm_vcpu_get_hfar(vcpu) & GENMASK(11, 0); if (is_iabt) @@ -2144,6 +2147,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) .memslot = memslot, .hva = hva, .esr = esr, + .mmu = mmu, }; ret = user_mem_abort(&s2fd, result, fault_status, shadow_seq, walk_seq); -- 2.43.0
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org> mainline inclusion from mainline-v7.4-rc1 commit f1fbc7ef12caf0785fdb3ea24193dbd9c425d7b7 category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/f1fbc7ef12caf0785fdb3ea24193dbd9c42... -------------------------------- commit f1fbc7ef12caf0785fdb3ea24193dbd9c425d7b7 upstream When stage 2 page tables fault the net result may either be that a page is mapped, an error occurred or the fault should be retried (-EAGAIN). When a fault succeeds it may be upgraded to a PMD size via transparent_hugepage_adjust(). In order to support KVM pre-faulting the outcome of the fault and the mapping size must be recorded. Track the mapping size via new kvm_s2_fault_result struct, which is threaded through gmem_abort(), user_mem_abort() and kvm_s2_fault_map(). PKVM and SEA aren't relevant to synthetic pre-faulting so neither kvm_inject_sea() nor pkvm_mem_abort() are altered. Actual hardware faulting doesn't require this information, so kvm_handle_guest_abort() simply passes NULL kvm_s2_fault_result to gmem_abort() and user_mem_abort(). A non-NULL result also tells the abort handlers that the caller is pre-faulting rather than a vcpu, in which case -EAGAIN is propagated to the caller to allow the pre-fault to be retried. Likewise, only prepare a KVM_EXIT_MEMORY_FAULT in gmem_abort() when a real fault is being handled, as this updates vcpu state. No functional change intended. [Backport note] Adapted for OLK-6.6: - OLK-6.6 has no gmem_abort() or kvm_s2_fault_map(), so the result is threaded through user_mem_abort() only. - The new parameter is named fault_result because user_mem_abort() already has a struct kvm_s1_trans *result argument. - mapping_size is recorded from vma_pagesize, which already reflects any transparent hugepage upgrade performed in this function. Suggested-by: Vincent Donnefort <vdonnefort@google.com> Reviewed-by: Oliver Upton <oupton@kernel.org> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-6-d4b0b4dfa8c3@kernel.... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- arch/arm64/kvm/mmu.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 5279399d3120..67e76e2096bb 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1606,10 +1606,15 @@ struct kvm_s2_fault_desc { struct kvm_s2_mmu *mmu; }; +struct kvm_s2_fault_result { + unsigned long mapping_size; +}; + static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, struct kvm_s1_trans *result, unsigned long fault_status, unsigned long shadow_seq, - unsigned long walk_seq) + unsigned long walk_seq, + struct kvm_s2_fault_result *fault_result) { struct kvm_vcpu *vcpu = s2fd->vcpu; phys_addr_t fault_ipa = s2fd->fault_ipa; @@ -1913,7 +1918,14 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, out_unlock: read_unlock(&kvm->mmu_lock); kvm_release_pfn_clean(pfn); - return ret != -EAGAIN ? ret : 0; + + if (ret == -EAGAIN) + return fault_result ? ret : 0; + + if (fault_result && !ret) + fault_result->mapping_size = vma_pagesize; + + return ret; } /* Resolve the access fault by making the page young again. */ @@ -2150,7 +2162,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu) .mmu = mmu, }; - ret = user_mem_abort(&s2fd, result, fault_status, shadow_seq, walk_seq); + ret = user_mem_abort(&s2fd, result, fault_status, shadow_seq, walk_seq, NULL); if (ret == 0) ret = 1; out: -- 2.43.0
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org> mainline inclusion from mainline-v7.4-rc1 commit d27acc152c62f368d4d4d9d3f0faa891c154e4ce category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/d27acc152c62f368d4d4d9d3f0faa891c15... -------------------------------- commit d27acc152c62f368d4d4d9d3f0faa891c154e4ce upstream topup_mmu_memcache() sizes the page-table cache from vcpu->arch.hw_mmu, which is the MMU that faulted. Pass the target s2fd->mmu instead, so the mmu used can be controlled by the caller. For a guest abort this is vcpu->arch.hw_mmu, so this commit introduces no functional change in practice. However, it's necessary for a future change which introduces stage 2 pre-faulting which must always target the canonical MMU regardless of the vCPU's last-run context. No functional change intended. [Backport note] Adapted for OLK-6.6: - OLK-6.6 has no topup_mmu_memcache() helper and sizes the cache inline in user_mem_abort() via kvm_mmu_cache_min_pages(kvm), which derives the level count from kvm->arch.vtcr rather than from a kvm_s2_mmu. - A small kvm_mmu_cache_min_pages_mmu() wrapper recovers the owning kvm from the target MMU and is used by user_mem_abort(), preserving the upstream intent of sizing the cache from the fault MMU. - The PVM path sizes its cache from the same fault MMU; the existing PVM_PGTABLE_LEVELS() lower bound is still applied afterwards. Reviewed-by: Oliver Upton <oupton@kernel.org> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-7-d4b0b4dfa8c3@kernel.... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- arch/arm64/kvm/mmu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 67e76e2096bb..47c1e6f46af9 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1610,6 +1610,11 @@ struct kvm_s2_fault_result { unsigned long mapping_size; }; +static int kvm_mmu_cache_min_pages_mmu(struct kvm_s2_mmu *mmu) +{ + return kvm_mmu_cache_min_pages(kvm_s2_mmu_to_kvm(mmu)); +} + static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, struct kvm_s1_trans *result, unsigned long fault_status, unsigned long shadow_seq, @@ -1643,7 +1648,7 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, enum kvm_pgtable_prot prot = KVM_PGTABLE_PROT_R; struct kvm_pgtable *pgt; bool kernel_shadow = result && kvm_pvm_is_kernel_va(fault_ipa); - int cache_min_pages = kvm_mmu_cache_min_pages(kvm); + int cache_min_pages = kvm_mmu_cache_min_pages_mmu(mmu); fault_granule = result ? PAGE_SIZE : 1UL << ARM64_HW_PGTABLE_LEVEL_SHIFT(fault_level); -- 2.43.0
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org> mainline inclusion from mainline-v7.4-rc1 commit 33f849d808e2329f569bcd8fdbfe5ce22449466f category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/33f849d808e2329f569bcd8fdbfe5ce2244... -------------------------------- commit 33f849d808e2329f569bcd8fdbfe5ce22449466f upstream Currently kvm_s2_fault_pin_pfn() handles a poisoned page directly by sending a SIGBUS signal itself. This is an odd place to do it, the caller should decide what to do with errors, so move the handling to the sole caller, user_mem_abort(). This lays the foundation for stage 2 pre-faulting which, arising from a synthetic fault, should not send a signal. In order to do so, check to see if user_mem_abort()'s caller has set result - i.e. whether it wants to be informed about the outcome of the fault handling. If it does, then it is implied that it should handle the -EHWPOISON error itself. This is the case for pre-faulting. Otherwise this is real hardware, so send the signal. No functional change intended. [Backport note] Adapted for OLK-6.6: - OLK-6.6 has no kvm_s2_fault_pin_pfn() helper; PFN resolution and the KVM_PFN_ERR_HWPOISON check are inline in user_mem_abort(). The check now returns -EHWPOISON when fault_result is non-NULL and otherwise keeps the existing kvm_send_hwpoison_signal() behaviour. Reviewed-by: Oliver Upton <oupton@kernel.org> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-8-d4b0b4dfa8c3@kernel.... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- arch/arm64/kvm/mmu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 47c1e6f46af9..d78c0509177c 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1773,6 +1773,9 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd, pfn = __gfn_to_pfn_memslot(memslot, gfn, false, false, NULL, write_fault, &writable, NULL); if (pfn == KVM_PFN_ERR_HWPOISON) { + /* If a result is specified, let the caller handle this. */ + if (fault_result) + return -EHWPOISON; kvm_send_hwpoison_signal(hva, vma_shift); return 0; } -- 2.43.0
From: Jack Thomson <jackabt@amazon.com> mainline inclusion from mainline-v7.4-rc1 commit ee26443f3dd70a961ad5e9384d5f41a8675213d1 category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/ee26443f3dd70a961ad5e9384d5f41a8675... -------------------------------- commit ee26443f3dd70a961ad5e9384d5f41a8675213d1 upstream Allow callers of kvm_pgtable_get_leaf() to specify the page-table walk flags, in preparation for performing walks under the MMU read lock. Reading a stage-2 leaf while only holding the read lock requires KVM_PGTABLE_WALK_SHARED: parallel faults (which also only hold the read lock) can unlink table pages and free them via RCU, so the walker must be inside an RCU read-side critical section, which the shared walk flag provides via kvm_pgtable_walk_begin(). All existing callers either hold the write lock, walk with interrupts disabled, or run at hyp where shared walks are rejected; they keep the current behaviour by passing no flags. No functional change intended. [Backport note] Adapted for OLK-6.6: - OLK-6.6 declares the level output as u32 rather than s8; the signature was adapted accordingly. - The caller set differs from upstream: mmu.c, hyp/nvhe/mem_protect.c and the OLK-6.6-specific virtcca_cvm.c are updated with flags 0. The upstream hyp/nvhe/mm.c and nested.c call sites do not exist in this tree. Signed-off-by: Jack Thomson <jackabt@amazon.com> [ljs: fixup new kvm_pgtable_get_leaf() invocation] Reviewed-by: Oliver Upton <oupton@kernel.org> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-9-d4b0b4dfa8c3@kernel.... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- arch/arm64/include/asm/kvm_pgtable.h | 5 ++++- arch/arm64/kvm/hyp/nvhe/mem_protect.c | 2 +- arch/arm64/kvm/hyp/pgtable.c | 5 +++-- arch/arm64/kvm/mmu.c | 2 +- arch/arm64/kvm/virtcca_cvm.c | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h index 741ed67a9f91..56060e76da39 100644 --- a/arch/arm64/include/asm/kvm_pgtable.h +++ b/arch/arm64/include/asm/kvm_pgtable.h @@ -739,6 +739,8 @@ int kvm_pgtable_walk(struct kvm_pgtable *pgt, u64 addr, u64 size, * @addr: Input address for the start of the walk. * @ptep: Pointer to storage for the retrieved PTE. * @level: Pointer to storage for the level of the retrieved PTE. + * @flags: Flags to control the page-table walk + * (see struct kvm_pgtable_visit_ctx). * * The offset of @addr within a page is ignored. * @@ -749,7 +751,8 @@ int kvm_pgtable_walk(struct kvm_pgtable *pgt, u64 addr, u64 size, * Return: 0 on success, negative error code on failure. */ int kvm_pgtable_get_leaf(struct kvm_pgtable *pgt, u64 addr, - kvm_pte_t *ptep, u32 *level); + kvm_pte_t *ptep, u32 *level, + enum kvm_pgtable_walk_flags flags); /** * kvm_pgtable_stage2_pte_prot() - Retrieve the protection attributes of a diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c index 9d703441278b..42396d8156bc 100644 --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c @@ -447,7 +447,7 @@ static int host_stage2_adjust_range(u64 addr, struct kvm_mem_range *range) int ret; hyp_assert_lock_held(&host_mmu.lock); - ret = kvm_pgtable_get_leaf(&host_mmu.pgt, addr, &pte, &level); + ret = kvm_pgtable_get_leaf(&host_mmu.pgt, addr, &pte, &level, 0); if (ret) return ret; diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index a41e97170c4a..c66d97c08ead 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -369,12 +369,13 @@ static int leaf_walker(const struct kvm_pgtable_visit_ctx *ctx, } int kvm_pgtable_get_leaf(struct kvm_pgtable *pgt, u64 addr, - kvm_pte_t *ptep, u32 *level) + kvm_pte_t *ptep, u32 *level, + enum kvm_pgtable_walk_flags flags) { struct leaf_walk_data data; struct kvm_pgtable_walker walker = { .cb = leaf_walker, - .flags = KVM_PGTABLE_WALK_LEAF, + .flags = flags | KVM_PGTABLE_WALK_LEAF, .arg = &data, }; int ret; diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index d78c0509177c..98691166687d 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -842,7 +842,7 @@ static int get_user_mapping_size(struct kvm *kvm, u64 addr) * IPI-ing threads). */ local_irq_save(flags); - ret = kvm_pgtable_get_leaf(&pgt, addr, &pte, &level); + ret = kvm_pgtable_get_leaf(&pgt, addr, &pte, &level, 0); local_irq_restore(flags); if (ret) diff --git a/arch/arm64/kvm/virtcca_cvm.c b/arch/arm64/kvm/virtcca_cvm.c index 6c4ca939687b..9b19cdbb189b 100644 --- a/arch/arm64/kvm/virtcca_cvm.c +++ b/arch/arm64/kvm/virtcca_cvm.c @@ -3522,7 +3522,7 @@ static int virtcca_mig_export_abort(struct kvm *kvm) return 0; while (target_ipa < cvm->swiotlb_end) { - ret = kvm_pgtable_get_leaf(pgt, target_ipa, NULL, &level); + ret = kvm_pgtable_get_leaf(pgt, target_ipa, NULL, &level, 0); if (ret) { pr_err("%s: err=%llu\n", __func__, ret); ret = -EIO; -- 2.43.0
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org> mainline inclusion from mainline-v7.4-rc1 commit 34cfa9b3af17d0554ffd6c655fc1097854b49487 category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/34cfa9b3af17d0554ffd6c655fc1097854b... -------------------------------- commit 34cfa9b3af17d0554ffd6c655fc1097854b49487 upstream Implement KVM stage 2 page table pre-faulting for the arm64 architecture, with the core of the implementation in kvm_arch_vcpu_pre_fault_memory(). Pre-fault by first trying a page table walk under the MMU read lock then, if it fails, injecting a synthetic data abort at the page table level at which the page table walk failed. This is necessarily racey as reclaim might happen at any time. Successfully pre-faulting can therefore only guarantee that each GPA was observed to be mapped at least once. Protected KVM (pKVM) is not supported at all because pKVM creates VMs and vCPUs when first run, meaning any attempt to pre-fault prior to this cannot succeed. Additionally, in pKVM mode, the stage 2 page tables are owned by the hypervisor rather than the host - the host can neither walk them nor populate them directly, so it's not clear that the pre-fault mechanism correctly maps onto pKVM. Reject both pKVM hosts and uninitialised vCPUs, which are not in a safe state to be loaded, from the kvm_arch_pre_fault_allowed() hook so they are refused before the vCPU is loaded. A retry mechanic is implemented when user_mem_abort() or gmem_abort() fail to map memory due to a benign failure where a hardware abort would not result in an error. An invalid memslot (i.e. a memslot with the KVM_MEMSLOT_INVALID flag set) results in the operation returning -EAGAIN without a retry mechanic, because an invalid memslot means the pre-fault operation raced with memslot reclaim, and since the SRCU lock is held, progress cannot be made, and the user must retry. This work is based with gratitude on Jack Thomson's original series, its previous revisions and the feedback they received. [Backport note] Adapted for OLK-6.6: - OLK-6.6 has no gmem_abort() or kvm_s2_fault_map(). The pre-fault path calls the existing user_mem_abort() with a synthetic ESR and the canonical kvm_s2_mmu in kvm_s2_fault_desc, plus a kvm_s2_fault_result, which is the equivalent of the upstream s2fd plumbing. - Only the non-gmem user_mem_abort() path exists in this tree, so the gmem handling is omitted. - kvm_pgtable_get_leaf() takes a u32 level and the shared walk flag was added by the previous patch; kvm_walk_s2() uses it under the MMU read lock. - ESR_ELx_FSC_FAULT_L() is not defined in OLK-6.6 and was added to esr.h for the synthetic abort encoding. - The hook also rejects pKVM, PVM and CCA realms, which do not use the canonical stage-2 page tables targeted by this implementation. This work is based with gratitude on Jack Thomson's original series, its previous revisions and the feedback they received. Link: https://patch.msgid.link/20260612162354.73378-1-jackabt.amazon@gmail.com/ Reviewed-by: Oliver Upton <oupton@kernel.org> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-10-d4b0b4dfa8c3@kernel... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- arch/arm64/include/asm/esr.h | 1 + arch/arm64/kvm/Kconfig | 1 + arch/arm64/kvm/arm.c | 3 + arch/arm64/kvm/mmu.c | 140 +++++++++++++++++++++++++++++++++++ 4 files changed, 145 insertions(+) diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h index eb32ec325cac..f4b88197e4ce 100644 --- a/arch/arm64/include/asm/esr.h +++ b/arch/arm64/include/asm/esr.h @@ -120,6 +120,7 @@ #define ESR_ELx_FSC_FAULT_L1 (0x05) #define ESR_ELx_FSC_FAULT_L2 (0x06) #define ESR_ELx_FSC_FAULT_L3 (0x07) +#define ESR_ELx_FSC_FAULT_L(level) (ESR_ELx_FSC_FAULT + (level)) #define ESR_ELx_FSC_PERM (0x0C) #define ESR_ELx_FSC_SEA_TTW0 (0x14) #define ESR_ELx_FSC_SEA_TTW1 (0x15) diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig index 2a71109ce082..5669e68e9af7 100644 --- a/arch/arm64/kvm/Kconfig +++ b/arch/arm64/kvm/Kconfig @@ -28,6 +28,7 @@ menuconfig KVM select HAVE_KVM_CPU_RELAX_INTERCEPT select KVM_MMIO select KVM_GENERIC_DIRTYLOG_READ_PROTECT + select KVM_GENERIC_PRE_FAULT_MEMORY select KVM_XFER_TO_GUEST_WORK select KVM_VFIO select HAVE_KVM_EVENTFD diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 978b0a3f2794..17632496ed30 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -606,6 +606,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) case KVM_CAP_COUNTER_OFFSET: r = !kvm_is_realm(kvm) && !is_pvm_mode(); break; + case KVM_CAP_PRE_FAULT_MEMORY: + r = 1; + break; case KVM_CAP_SET_GUEST_DEBUG2: return is_pvm_mode() ? 0 : KVM_GUESTDBG_VALID_MASK; case KVM_CAP_ARM_SET_DEVICE_ADDR: diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 98691166687d..653639c8debe 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -2738,3 +2738,143 @@ int kvm_mmu_mark_touched_log(struct kvm *kvm) return 0; } + +/* + * Try to walk to the specified GPA in canonical mmu - if unmapped returns 0, if + * mapped returns the granule size, otherwise returns an error. + */ +static long kvm_walk_s2(struct kvm_pgtable *pgt, gpa_t gpa, u32 *level) +{ + struct kvm *kvm = kvm_s2_mmu_to_kvm(pgt->mmu); + kvm_pte_t pte; + long ret; + + read_lock(&kvm->mmu_lock); + ret = kvm_pgtable_get_leaf(pgt, gpa, &pte, level, + KVM_PGTABLE_WALK_SHARED); + read_unlock(&kvm->mmu_lock); + if (ret) + return ret; + /* Unpopulated, must fault. */ + if (!kvm_pte_valid(pte)) + return 0; + return kvm_granule_size(*level); +} + +/* Synthesised data abort at specified page table level. */ +#define PRE_FAULT_ESR(level) \ + ((ESR_ELx_EC_DABT_LOW << ESR_ELx_EC_SHIFT) | \ + ESR_ELx_IL | ESR_ELx_FSC_FAULT_L(level)) + +/* Retrieve either a read-only or a read/write hva. */ +static hva_t gfn_to_hva_memslot_read(struct kvm_memory_slot *slot, gfn_t gfn) +{ + return gfn_to_hva_memslot_prot(slot, gfn, /*writable=*/NULL); +} + +static long __pre_fault_s2(struct kvm_s2_mmu *mmu, struct kvm_vcpu *vcpu, + gpa_t gpa, struct kvm_memory_slot *memslot, u32 level) +{ + const gfn_t gfn = gpa_to_gfn(gpa); + const hva_t hva = gfn_to_hva_memslot_read(memslot, gfn); + struct kvm_s2_fault_result result = {}; + unsigned long esr = PRE_FAULT_ESR(level); + long ret; + + if (kvm_is_error_hva(hva)) + return -EFAULT; + + const struct kvm_s2_fault_desc s2fd = { + .vcpu = vcpu, + .fault_ipa = gpa, + .memslot = memslot, + .hva = hva, + .esr = esr, + .mmu = mmu, + }; + + ret = user_mem_abort(&s2fd, NULL, ESR_ELx_FSC_FAULT, 0, 0, &result); + if (IS_ERR_VALUE(ret)) + return ret; + return result.mapping_size; +} + +static long pre_fault_s2(struct kvm_s2_mmu *mmu, struct kvm_vcpu *vcpu, + gpa_t gpa, struct kvm_memory_slot *memslot) +{ + u32 level; + long ret; + + /* Try a walk first. */ + ret = kvm_walk_s2(mmu->pgt, gpa, &level); + if (ret) + return ret; + /* OK, have to fault page in. */ + return __pre_fault_s2(mmu, vcpu, gpa, memslot, level); +} + +static unsigned long +pre_fault_bytes_consumed(gpa_t gpa, unsigned long granule_size, + unsigned long bytes_remaining) +{ + /* Granules are always a power-of-2. */ + const unsigned long granule_bytes_remaining = + granule_size - (gpa % granule_size); + + return min(granule_bytes_remaining, bytes_remaining); +} + +/* If you lose the race this many times, time to give up. */ +#define MAX_PRE_FAULT_RETRIES 3 + +int kvm_arch_pre_fault_allowed(struct kvm_vcpu *vcpu) +{ + if (is_protected_kvm_enabled() || is_pvm_mode() || + _kvm_is_realm(vcpu->kvm)) + return -EOPNOTSUPP; + if (!kvm_vcpu_initialized(vcpu)) + return -ENOEXEC; + + return 0; +} + +/** + * kvm_arch_vcpu_pre_fault_memory - pre-fault stage-2 page tables for the + * specified GPA. + * @vcpu: The VCPU pointer + * @range: {gpa, size, flags} tuple + * + * The mapping performed is always best-effort - faulting in is necessarily + * racey. The ranges faulted in are canonical, nested page tables are ignored. + * + * @range->gpa specifies the GPA to pre-fault, @range->size specifies how many + * bytes remain to be pre-faulted and @range->flags is reserved and must be 0. + * + * Returns: the number of bytes the pre-fault consumed, or an error. + */ +long kvm_arch_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu, + struct kvm_pre_fault_memory *range) +{ + struct kvm *kvm = vcpu->kvm; + const u64 bytes_remaining = range->size; + struct kvm_s2_mmu *mmu = &kvm->arch.mmu; /* Canonical. */ + struct kvm_memory_slot *memslot; + const gpa_t gpa = range->gpa; + int num_retries = 0; + long ret; + + memslot = gfn_to_memslot(kvm, gpa_to_gfn(gpa)); + if (!memslot) + return -ENOENT; + /* SRCU must be released for progress and only userland can do that. */ + if (memslot->flags & KVM_MEMSLOT_INVALID) + return -EAGAIN; + + do { + ret = pre_fault_s2(mmu, vcpu, gpa, memslot); + } while (ret == -EAGAIN && num_retries++ < MAX_PRE_FAULT_RETRIES); + + if (IS_ERR_VALUE(ret)) + return ret; + return pre_fault_bytes_consumed(gpa, ret, bytes_remaining); +} -- 2.43.0
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org> mainline inclusion from mainline-v7.4-rc1 commit 28187f51e4c470c473350905141a8054ec0f1f2d category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/28187f51e4c470c473350905141a8054ec0... -------------------------------- commit 28187f51e4c470c473350905141a8054ec0f1f2d upstream Update the KVM API documentation to reflect the fact that arm64 now supports this functionality. Also document error values and arm64-specific behaviour. [Backport note] Adapted for OLK-6.6: - The surrounding api.rst text differs slightly from the upstream base (the original paragraph did not mention s390 and used a generic "However, KVM does not mark ..." sentence). The new arm64/x86/s390 wording was applied on top of the OLK-6.6 text. Reviewed-by: Oliver Upton <oupton@kernel.org> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-11-d4b0b4dfa8c3@kernel... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- Documentation/virt/kvm/api.rst | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 8492aedf600a..f4c76eb3ca0e 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -6368,7 +6368,7 @@ See KVM_SET_USER_MEMORY_REGION2 for additional details. ------------------------ :Capability: KVM_CAP_PRE_FAULT_MEMORY -:Architectures: none +:Architectures: x86, s390, arm64 :Type: vcpu ioctl :Parameters: struct kvm_pre_fault_memory (in/out) :Returns: 0 if at least one page is processed, < 0 on error @@ -6376,11 +6376,15 @@ See KVM_SET_USER_MEMORY_REGION2 for additional details. Errors: ========== =============================================================== + EAGAIN A race occurred before progress was made, but a retry may succeed. EINVAL The specified `gpa` and `size` were invalid (e.g. not - page aligned, causes an overflow, or size is zero). + page aligned, causes an overflow, or size is zero), or the VM + is UCONTROL (s390). ENOENT The specified `gpa` is outside defined memslots. + ENOEXEC The vCPU has not been initialised (arm64). EINTR An unmasked signal is pending and no page was processed. EFAULT The parameter address was invalid. + EHWPOISON A poisoned host page was encountered. EOPNOTSUPP Mapping memory for a GPA is unsupported by the hypervisor, and/or for the current vCPU state/mode. EIO unexpected error conditions (also causes a WARN) @@ -6400,7 +6404,17 @@ Errors: KVM_PRE_FAULT_MEMORY populates KVM's stage-2 page tables used to map memory for the current vCPU state. KVM maps memory as if the vCPU generated a stage-2 read page fault, e.g. faults in memory as needed, but doesn't break -CoW. However, KVM does not mark any newly created stage-2 PTE as Accessed. +CoW. On arm64, KVM marks newly created stage-2 PTEs as Accessed, as it +does for any stage-2 fault, but leaves the Accessed state of existing PTEs +unchanged. On x86, KVM does not mark any newly created stage-2 PTE as +Accessed, and for s390 it is not applicable. + +On arm64, a GPA is interpreted as an IPA, and never interpreted as the IPA +of a nested guest. Pre-faulting only populates canonical stage-2 page +tables. + +The feature is not supported on arm64 if the protected KVM (pKVM) feature +is enabled. In the case of confidential VM types where there is an initial set up of private guest memory before the guest is 'finalized'/measured, this ioctl @@ -6415,7 +6429,7 @@ When the ioctl returns, the input values are updated to point to the remaining range. If `size` > 0 on return, the caller can just issue the ioctl again with the same `struct kvm_map_memory` argument. -Shadow page tables cannot support this ioctl because they +On x86, shadow page tables cannot support this ioctl because they are indexed by virtual address or nested guest physical address. Calling this ioctl when the guest is using shadow page tables (for example because it is running a nested guest with nested page tables) -- 2.43.0
From: Jack Thomson <jackabt@amazon.com> mainline inclusion from mainline-v7.4-rc1 commit 8ab194f836391fdcb1a8328d5ff0f0c7f0afe557 category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/8ab194f836391fdcb1a8328d5ff0f0c7f0a... -------------------------------- commit 8ab194f836391fdcb1a8328d5ff0f0c7f0afe557 upstream Enable the pre_fault_memory_test to run on arm64 by making it work with different guest page sizes and testing multiple guest configurations. Add an assert on the exit reason, comparing against UCALL_EXIT_REASON so the check is portable, as arm64 exits with KVM_EXIT_MMIO while x86 uses KVM_EXIT_IO. [ljs: merge conflict resolution with commit c847704619da ("KVM: selftests: Fix pre_fault_memory_test to run on s390"), commit message accuracy fixup] [Backport note] Adapted for OLK-6.6: - OLK-6.6 does not contain pre_fault_memory_test.c at all, so the pre-series upstream version of the test was imported first and this arm64-enablement change was then applied on top of it. - OLK-6.6 does not provide the kvm_pthread_create()/kvm_pthread_join() wrappers; the test now uses pthread_create() with TEST_ASSERT() and pthread_join() directly. - The test is registered in the existing Makefile (OLK-6.6 has no Makefile.kvm split) under TEST_GEN_PROGS_aarch64. Signed-off-by: Jack Thomson <jackabt@amazon.com> Reviewed-by: Oliver Upton <oupton@kernel.org> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-12-d4b0b4dfa8c3@kernel... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/pre_fault_memory_test.c | 303 ++++++++++++++++++ 2 files changed, 304 insertions(+) create mode 100644 tools/testing/selftests/kvm/pre_fault_memory_test.c diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index bd2bd1dc7ff2..797d79b35ab1 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -165,6 +165,7 @@ TEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus TEST_GEN_PROGS_aarch64 += kvm_page_table_test TEST_GEN_PROGS_aarch64 += memslot_modification_stress_test TEST_GEN_PROGS_aarch64 += memslot_perf_test +TEST_GEN_PROGS_aarch64 += pre_fault_memory_test TEST_GEN_PROGS_aarch64 += rseq_test TEST_GEN_PROGS_aarch64 += set_memory_region_test TEST_GEN_PROGS_aarch64 += steal_time diff --git a/tools/testing/selftests/kvm/pre_fault_memory_test.c b/tools/testing/selftests/kvm/pre_fault_memory_test.c new file mode 100644 index 000000000000..5e6e85467d7c --- /dev/null +++ b/tools/testing/selftests/kvm/pre_fault_memory_test.c @@ -0,0 +1,303 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2024, Intel, Inc + * + * Author: + * Isaku Yamahata <isaku.yamahata at gmail.com> + */ +#include <linux/sizes.h> + +#include <test_util.h> +#include <kvm_util.h> +#include <processor.h> +#include <pthread.h> +#include <ucall_common.h> +#include <guest_modes.h> + +/* Arbitrarily chosen values */ +#define TEST_BASE_SIZE SZ_2M +#define TEST_SLOT 10 + +/* Storage of test info to share with guest code */ +struct test_config { + u64 page_size; + u64 test_size; + u64 test_num_pages; +}; + +static struct test_config test_config; + +static void guest_code(u64 base_gva) +{ + volatile u64 val __used; + struct test_config *config = &test_config; + int i; + + for (i = 0; i < config->test_num_pages; i++) { + u64 *src = (u64 *)(base_gva + i * config->page_size); + + val = *src; + } + + GUEST_DONE(); +} + +struct slot_worker_data { + struct kvm_vm *vm; + u64 gpa; + u32 flags; + bool worker_ready; + bool prefault_ready; + bool recreate_slot; +}; + +static void *delete_slot_worker(void *__data) +{ + struct slot_worker_data *data = __data; + struct kvm_vm *vm = data->vm; + + WRITE_ONCE(data->worker_ready, true); + + while (!READ_ONCE(data->prefault_ready)) + cpu_relax(); + + vm_mem_region_delete(vm, TEST_SLOT); + + while (!READ_ONCE(data->recreate_slot)) + cpu_relax(); + + vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, data->gpa, + TEST_SLOT, test_config.test_num_pages, data->flags); + + return NULL; +} + +static void pre_fault_memory(struct kvm_vcpu *vcpu, u64 base_gpa, u64 offset, + u64 size, u64 expected_left, bool private) +{ + struct kvm_pre_fault_memory range = { + .gpa = base_gpa + offset, + .size = size, + .flags = 0, + }; + struct slot_worker_data data = { + .vm = vcpu->vm, + .gpa = base_gpa, + .flags = private ? KVM_MEM_GUEST_MEMFD : 0, + }; + bool slot_recreated = false; + pthread_t slot_worker; + int ret, save_errno; + u64 prev; + + /* + * Concurrently delete (and recreate) the slot to test KVM's handling + * of a racing memslot deletion with prefaulting. + */ + TEST_ASSERT(!pthread_create(&slot_worker, NULL, delete_slot_worker, &data), "pthread_create failed"); + + while (!READ_ONCE(data.worker_ready)) + cpu_relax(); + + WRITE_ONCE(data.prefault_ready, true); + + for (;;) { + prev = range.size; + ret = __vcpu_ioctl(vcpu, KVM_PRE_FAULT_MEMORY, &range); + save_errno = errno; + TEST_ASSERT((range.size < prev) ^ (ret < 0), + "%sexpecting range.size to change on %s", + ret < 0 ? "not " : "", + ret < 0 ? "failure" : "success"); + + /* + * Immediately retry prefaulting if KVM was interrupted by an + * unrelated signal/event. + */ + if (ret < 0 && save_errno == EINTR) + continue; + + /* + * Tell the worker to recreate the slot in order to complete + * prefaulting (if prefault didn't already succeed before the + * slot was deleted) and/or to prepare for the next testcase. + * Wait for the worker to exit so that the next invocation of + * prefaulting is guaranteed to complete (assuming no KVM bugs). + */ + if (!slot_recreated) { + WRITE_ONCE(data.recreate_slot, true); + pthread_join(slot_worker, NULL); + slot_recreated = true; + + /* + * Retry prefaulting to get a stable result, i.e. to + * avoid seeing random EAGAIN failures. Don't retry if + * prefaulting already succeeded, as KVM disallows + * prefaulting with size=0, i.e. blindly retrying would + * result in test failures due to EINVAL. KVM should + * always return success if all bytes are prefaulted, + * i.e. there is no need to guard against EAGAIN being + * returned. + */ + if (range.size) + continue; + } + + /* + * All done if there are no remaining bytes to prefault, or if + * prefaulting failed (EINTR was handled above, and EAGAIN due + * to prefaulting a memslot that's being actively deleted should + * be impossible since the memslot has already been recreated). + */ + if (!range.size || ret < 0) + break; + } + + TEST_ASSERT(range.size == expected_left, + "Completed with %llu bytes left, expected %lu", + range.size, expected_left); + + /* + * Assert success if prefaulting the entire range should succeed, i.e. + * complete with no bytes remaining. Otherwise prefaulting should have + * failed due to ENOENT (no memslot exists for the GPA; on x86 this + * surfaces via RET_PF_EMULATE). + */ + if (!expected_left) + TEST_ASSERT_VM_VCPU_IOCTL(!ret, KVM_PRE_FAULT_MEMORY, ret, vcpu->vm); + else + TEST_ASSERT_VM_VCPU_IOCTL(ret && save_errno == ENOENT, + KVM_PRE_FAULT_MEMORY, ret, vcpu->vm); +} + +struct test_params { + unsigned long vm_type; + bool private; +}; + +static void __test_pre_fault_memory(enum vm_guest_mode guest_mode, void *arg) +{ + gpa_t gpa, gva, alignment, guest_page_size, host_page_size; + struct test_params *p = arg; + const struct vm_shape shape = { + .mode = guest_mode, + .type = p->vm_type, + }; + struct kvm_vcpu *vcpu; + struct kvm_run *run; + struct kvm_vm *vm; + struct ucall uc; + + pr_info("Testing guest mode: %s\n", vm_guest_mode_string(guest_mode)); + + vm = vm_create_shape_with_one_vcpu(shape, &vcpu, guest_code); + + guest_page_size = vm_guest_mode_params[guest_mode].page_size; + host_page_size = getpagesize(); + + test_config.page_size = guest_page_size; + test_config.test_size = align_up(TEST_BASE_SIZE + test_config.page_size, + host_page_size); + test_config.test_num_pages = vm_calc_num_guest_pages(vm->mode, test_config.test_size); + + gpa = (vm->max_gfn - test_config.test_num_pages) * test_config.page_size; + alignment = SZ_2M; + alignment = max(alignment, host_page_size); + gpa = align_down(gpa, alignment); + gva = gpa & ((1ULL << (vm->va_bits - 1)) - 1); + + vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, + gpa, TEST_SLOT, test_config.test_num_pages, + p->private ? KVM_MEM_GUEST_MEMFD : 0); + virt_map(vm, gva, gpa, test_config.test_num_pages); + + if (p->private) + vm_mem_set_private(vm, gpa, test_config.test_size); + + pre_fault_memory(vcpu, gpa, 0, test_config.test_size, 0, p->private); + /* Retry the same range after the first prefault attempt. */ + pre_fault_memory(vcpu, gpa, 0, test_config.test_size, 0, p->private); + pre_fault_memory(vcpu, gpa, + test_config.test_size - host_page_size, + host_page_size * 2, host_page_size, p->private); + pre_fault_memory(vcpu, gpa, test_config.test_size, + host_page_size, host_page_size, p->private); + + vcpu_args_set(vcpu, 1, gva); + + /* Export the shared variables to the guest. */ + sync_global_to_guest(vm, test_config); + + vcpu_run(vcpu); + + run = vcpu->run; + TEST_ASSERT(run->exit_reason == UCALL_EXIT_REASON, + "Wanted %s, got exit reason: %u (%s)", + exit_reason_str(UCALL_EXIT_REASON), + run->exit_reason, exit_reason_str(run->exit_reason)); + + switch (get_ucall(vcpu, &uc)) { + case UCALL_ABORT: + REPORT_GUEST_ASSERT(uc); + break; + case UCALL_DONE: + break; + default: + TEST_FAIL("Unknown ucall 0x%lx.", uc.cmd); + break; + } + + kvm_vm_free(vm); +} + +static void test_pre_fault_memory(unsigned long vm_type, bool private) +{ + struct test_params p = { + .vm_type = vm_type, + .private = private, + }; + + if (vm_type && !(kvm_check_cap(KVM_CAP_VM_TYPES) & BIT(vm_type))) { + pr_info("Skipping tests for vm_type 0x%lx\n", vm_type); + return; + } + + for_each_guest_mode(__test_pre_fault_memory, &p); +} + +static void help(char *name) +{ + puts(""); + printf("usage: %s [-h] [-m mode]\n", name); + puts(""); + guest_modes_help(); + puts(""); +} + +int main(int argc, char *argv[]) +{ + int opt; + + guest_modes_append_default(); + + while ((opt = getopt(argc, argv, "hm:")) != -1) { + switch (opt) { + case 'm': + guest_modes_cmdline(optarg); + break; + case 'h': + default: + help(argv[0]); + exit(0); + } + } + + TEST_REQUIRE(kvm_check_cap(KVM_CAP_PRE_FAULT_MEMORY)); + + test_pre_fault_memory(0, false); +#ifdef __x86_64__ + test_pre_fault_memory(KVM_X86_SW_PROTECTED_VM, false); + test_pre_fault_memory(KVM_X86_SW_PROTECTED_VM, true); +#endif + return 0; +} -- 2.43.0
From: Jack Thomson <jackabt@amazon.com> mainline inclusion from mainline-v7.4-rc1 commit c4560edbaa81291ee79a97b5e793934cea88500b category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10374 CVE: NA Reference: https://github.com/torvalds/linux/commit/c4560edbaa81291ee79a97b5e793934cea8... -------------------------------- commit c4560edbaa81291ee79a97b5e793934cea88500b upstream Add a -s option to specify different memory backing types for the pre-fault tests (e.g. anonymous, hugetlb), allowing testing of the pre-fault functionality across different memory configurations. [Backport note] Additional build fix: OLK-6.6's KVM selftests do not provide the gpa_t typedef (kvm_util_types.h is absent), so u64 is used for the guest physical address variables introduced here. Signed-off-by: Jack Thomson <jackabt@amazon.com> Reviewed-by: Oliver Upton <oupton@kernel.org> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-13-d4b0b4dfa8c3@kernel... Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> --- .../selftests/kvm/pre_fault_memory_test.c | 53 +++++++++++++------ 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/tools/testing/selftests/kvm/pre_fault_memory_test.c b/tools/testing/selftests/kvm/pre_fault_memory_test.c index 5e6e85467d7c..f4286d7d1eef 100644 --- a/tools/testing/selftests/kvm/pre_fault_memory_test.c +++ b/tools/testing/selftests/kvm/pre_fault_memory_test.c @@ -46,6 +46,7 @@ struct slot_worker_data { struct kvm_vm *vm; u64 gpa; u32 flags; + enum vm_mem_backing_src_type mem_backing_src; bool worker_ready; bool prefault_ready; bool recreate_slot; @@ -66,14 +67,16 @@ static void *delete_slot_worker(void *__data) while (!READ_ONCE(data->recreate_slot)) cpu_relax(); - vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, data->gpa, + vm_userspace_mem_region_add(vm, data->mem_backing_src, data->gpa, TEST_SLOT, test_config.test_num_pages, data->flags); return NULL; } static void pre_fault_memory(struct kvm_vcpu *vcpu, u64 base_gpa, u64 offset, - u64 size, u64 expected_left, bool private) + u64 size, u64 expected_left, + enum vm_mem_backing_src_type mem_backing_src, + bool private) { struct kvm_pre_fault_memory range = { .gpa = base_gpa + offset, @@ -84,6 +87,7 @@ static void pre_fault_memory(struct kvm_vcpu *vcpu, u64 base_gpa, u64 offset, .vm = vcpu->vm, .gpa = base_gpa, .flags = private ? KVM_MEM_GUEST_MEMFD : 0, + .mem_backing_src = mem_backing_src, }; bool slot_recreated = false; pthread_t slot_worker; @@ -173,11 +177,13 @@ static void pre_fault_memory(struct kvm_vcpu *vcpu, u64 base_gpa, u64 offset, struct test_params { unsigned long vm_type; bool private; + enum vm_mem_backing_src_type mem_backing_src; }; static void __test_pre_fault_memory(enum vm_guest_mode guest_mode, void *arg) { - gpa_t gpa, gva, alignment, guest_page_size, host_page_size; + u64 gpa, gva, alignment, guest_page_size, host_page_size; + u64 backing_src_pagesz, mem_page_size; struct test_params *p = arg; const struct vm_shape shape = { .mode = guest_mode, @@ -189,24 +195,28 @@ static void __test_pre_fault_memory(enum vm_guest_mode guest_mode, void *arg) struct ucall uc; pr_info("Testing guest mode: %s\n", vm_guest_mode_string(guest_mode)); + pr_info("Testing memory backing src type: %s\n", + vm_mem_backing_src_alias(p->mem_backing_src)->name); vm = vm_create_shape_with_one_vcpu(shape, &vcpu, guest_code); guest_page_size = vm_guest_mode_params[guest_mode].page_size; host_page_size = getpagesize(); + backing_src_pagesz = get_backing_src_pagesz(p->mem_backing_src); + mem_page_size = max(host_page_size, backing_src_pagesz); test_config.page_size = guest_page_size; test_config.test_size = align_up(TEST_BASE_SIZE + test_config.page_size, - host_page_size); + mem_page_size); test_config.test_num_pages = vm_calc_num_guest_pages(vm->mode, test_config.test_size); gpa = (vm->max_gfn - test_config.test_num_pages) * test_config.page_size; alignment = SZ_2M; - alignment = max(alignment, host_page_size); + alignment = max(alignment, mem_page_size); gpa = align_down(gpa, alignment); gva = gpa & ((1ULL << (vm->va_bits - 1)) - 1); - vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, + vm_userspace_mem_region_add(vm, p->mem_backing_src, gpa, TEST_SLOT, test_config.test_num_pages, p->private ? KVM_MEM_GUEST_MEMFD : 0); virt_map(vm, gva, gpa, test_config.test_num_pages); @@ -214,14 +224,18 @@ static void __test_pre_fault_memory(enum vm_guest_mode guest_mode, void *arg) if (p->private) vm_mem_set_private(vm, gpa, test_config.test_size); - pre_fault_memory(vcpu, gpa, 0, test_config.test_size, 0, p->private); + pre_fault_memory(vcpu, gpa, 0, test_config.test_size, 0, + p->mem_backing_src, p->private); /* Retry the same range after the first prefault attempt. */ - pre_fault_memory(vcpu, gpa, 0, test_config.test_size, 0, p->private); + pre_fault_memory(vcpu, gpa, 0, test_config.test_size, 0, + p->mem_backing_src, p->private); pre_fault_memory(vcpu, gpa, test_config.test_size - host_page_size, - host_page_size * 2, host_page_size, p->private); + host_page_size * 2, host_page_size, + p->mem_backing_src, p->private); pre_fault_memory(vcpu, gpa, test_config.test_size, - host_page_size, host_page_size, p->private); + host_page_size, host_page_size, + p->mem_backing_src, p->private); vcpu_args_set(vcpu, 1, gva); @@ -250,11 +264,13 @@ static void __test_pre_fault_memory(enum vm_guest_mode guest_mode, void *arg) kvm_vm_free(vm); } -static void test_pre_fault_memory(unsigned long vm_type, bool private) +static void test_pre_fault_memory(unsigned long vm_type, enum vm_mem_backing_src_type backing_src, + bool private) { struct test_params p = { .vm_type = vm_type, .private = private, + .mem_backing_src = backing_src, }; if (vm_type && !(kvm_check_cap(KVM_CAP_VM_TYPES) & BIT(vm_type))) { @@ -268,23 +284,28 @@ static void test_pre_fault_memory(unsigned long vm_type, bool private) static void help(char *name) { puts(""); - printf("usage: %s [-h] [-m mode]\n", name); + printf("usage: %s [-h] [-m mode] [-s mem-type]\n", name); puts(""); guest_modes_help(); + backing_src_help("-s"); puts(""); } int main(int argc, char *argv[]) { + enum vm_mem_backing_src_type backing = DEFAULT_VM_MEM_SRC; int opt; guest_modes_append_default(); - while ((opt = getopt(argc, argv, "hm:")) != -1) { + while ((opt = getopt(argc, argv, "hm:s:")) != -1) { switch (opt) { case 'm': guest_modes_cmdline(optarg); break; + case 's': + backing = parse_backing_src_type(optarg); + break; case 'h': default: help(argv[0]); @@ -294,10 +315,10 @@ int main(int argc, char *argv[]) TEST_REQUIRE(kvm_check_cap(KVM_CAP_PRE_FAULT_MEMORY)); - test_pre_fault_memory(0, false); + test_pre_fault_memory(0, backing, false); #ifdef __x86_64__ - test_pre_fault_memory(KVM_X86_SW_PROTECTED_VM, false); - test_pre_fault_memory(KVM_X86_SW_PROTECTED_VM, true); + test_pre_fault_memory(KVM_X86_SW_PROTECTED_VM, backing, false); + test_pre_fault_memory(KVM_X86_SW_PROTECTED_VM, backing, true); #endif return 0; } -- 2.43.0
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,转换为PR失败! 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/4IJ... 失败原因:应用补丁/补丁集失败,Patch failed at 0007 KVM: arm64: Propagate and use kvm_s2_fault_result on S2 fault 建议解决方法:请查看失败原因, 确认补丁是否可以应用在当前期望分支的最新代码上 FeedBack: The patch(es) which you have sent to kernel@openeuler.org has been converted to PR failed! Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/4IJ... Failed Reason: apply patch(es) failed, Patch failed at 0007 KVM: arm64: Propagate and use kvm_s2_fault_result on S2 fault Suggest Solution: please checkout if the failed patch(es) can work on the newest codes in expected branch
participants (2)
-
patchwork bot -
Yanan Wang