* [PATCH] KVM: riscv: Implement kvm_arch_pre_fault_allowed() [not found] <CABgObfaH4-Ud4VR=GC8giDmWGJWS-tvYSmPOs4TtWg2hm4ocqw@mail.gmail.com> @ 2026-10-22 14:42 ` Sasha Levin 2026-10-22 14:51 ` Paolo Bonzini 0 siblings, 1 reply; 2+ messages in thread From: Sasha Levin @ 2026-10-22 14:42 UTC (permalink / raw) To: Paolo Bonzini, Anup Patel Cc: Mark Brown, Lorenzo Stoakes, Marc Zyngier, Jinyu Tang, Atish Patra, Palmer Dabbelt, Paul Walmsley, Albert Ou, Alexandre Ghiti, kvm, kvm-riscv, linux-riscv, linux-next, linux-kernel Commit caa63620f9e3 ("KVM: Allow architectures to disallow pre-fault") requires every architecture that selects KVM_GENERIC_PRE_FAULT_MEMORY to implement kvm_arch_pre_fault_allowed(), and there is no generic default. Commit e8b32e377951 ("KVM: riscv: Implement KVM_PRE_FAULT_MEMORY") was written before that hook existed, so it selects the option without implementing the hook. With both commits in the same tree, riscv builds with KVM enabled fail to link: ld.lld: error: undefined symbol: kvm_arch_pre_fault_allowed >>> referenced by kvm_main.c >>> virt/kvm/kvm_main.o:(kvm_vcpu_pre_fault_memory) in archive vmlinux.a The riscv implementation does not refuse pre-faulting in any state, so return 0 to keep its current behaviour. Fixes: e8b32e377951 ("KVM: riscv: Implement KVM_PRE_FAULT_MEMORY") Signed-off-by: Sasha Levin <sashal@kernel.org> --- Paolo, this is needed when kvm-riscv-7.4-1 is merged into kvm/next. Feel free to squash it into the merge instead. Mark, next-20261022 already fails to link, so linux-next needs this on top of the kvm-riscv merge. Build-tested with a riscv tinyconfig plus KVM=y on next-20261022 and on kvm/next with kvm-riscv-7.4-1 merged. Not runtime tested. arch/riscv/kvm/mmu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c index e8673cfa69668..738d9ee1eac9d 100644 --- a/arch/riscv/kvm/mmu.c +++ b/arch/riscv/kvm/mmu.c @@ -754,6 +754,11 @@ int kvm_riscv_mmu_map(struct kvm_vcpu *vcpu, struct kvm_memory_slot *memslot, return ret; } +int kvm_arch_pre_fault_allowed(struct kvm_vcpu *vcpu) +{ + return 0; +} + long kvm_arch_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu, struct kvm_pre_fault_memory *range) { -- 2.53.0 ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: riscv: Implement kvm_arch_pre_fault_allowed() 2026-10-22 14:42 ` [PATCH] KVM: riscv: Implement kvm_arch_pre_fault_allowed() Sasha Levin @ 2026-10-22 14:51 ` Paolo Bonzini 0 siblings, 0 replies; 2+ messages in thread From: Paolo Bonzini @ 2026-10-22 14:51 UTC (permalink / raw) To: Sasha Levin Cc: Anup Patel, Mark Brown, Lorenzo Stoakes, Marc Zyngier, Jinyu Tang, Atish Patra, Palmer Dabbelt, Paul Walmsley, Albert Ou, Alexandre Ghiti, kvm, kvm-riscv, linux-riscv, linux-next, linux-kernel On Thu, Oct 22, 2026 at 4:42 PM Sasha Levin <sashal@kernel.org> wrote: > > Commit caa63620f9e3 ("KVM: Allow architectures to disallow pre-fault") > requires every architecture that selects KVM_GENERIC_PRE_FAULT_MEMORY to > implement kvm_arch_pre_fault_allowed(), and there is no generic default. > > Commit e8b32e377951 ("KVM: riscv: Implement KVM_PRE_FAULT_MEMORY") was > written before that hook existed, so it selects the option without > implementing the hook. With both commits in the same tree, riscv builds > with KVM enabled fail to link: > > ld.lld: error: undefined symbol: kvm_arch_pre_fault_allowed > >>> referenced by kvm_main.c > >>> virt/kvm/kvm_main.o:(kvm_vcpu_pre_fault_memory) in archive vmlinux.a > > The riscv implementation does not refuse pre-faulting in any state, so > return 0 to keep its current behaviour. > > Fixes: e8b32e377951 ("KVM: riscv: Implement KVM_PRE_FAULT_MEMORY") > Signed-off-by: Sasha Levin <sashal@kernel.org> > --- > Paolo, this is needed when kvm-riscv-7.4-1 is merged into kvm/next. > Feel free to squash it into the merge instead. Yup, done. It will be in tomorrow's linux-next via kvm/next. I'll send the RISC-V PR to Linus next week, so if he complains it will be there in kvm/next ready for 7.5. :) Paolo ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-22 14:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CABgObfaH4-Ud4VR=GC8giDmWGJWS-tvYSmPOs4TtWg2hm4ocqw@mail.gmail.com>
2026-10-22 14:42 ` [PATCH] KVM: riscv: Implement kvm_arch_pre_fault_allowed() Sasha Levin
2026-10-22 14:51 ` Paolo Bonzini
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®