On Mon, May 13, 2024 at 12:05:35PM -0500, Michael Roth wrote: > On Mon, May 13, 2024 at 06:53:24PM +0200, Paolo Bonzini wrote: > > On 5/13/24 17:19, Nathan Chancellor wrote: > > > > +static int snp_begin_ext_guest_req(struct kvm_vcpu *vcpu) > > > > +{ > > > > + int vmm_ret = SNP_GUEST_VMM_ERR_GENERIC; > > > > + struct vcpu_svm *svm = to_svm(vcpu); > > > > + unsigned long data_npages; > > > > + sev_ret_code fw_err; > > > > + gpa_t data_gpa; > > > > + > > > > + if (!sev_snp_guest(vcpu->kvm)) > > > > + goto abort_request; > > > > + > > > > + data_gpa = vcpu->arch.regs[VCPU_REGS_RAX]; > > > > + data_npages = vcpu->arch.regs[VCPU_REGS_RBX]; > > > > + > > > > + if (!IS_ALIGNED(data_gpa, PAGE_SIZE)) > > > > + goto abort_request; > > > > > > [...] > > > > > > > +abort_request: > > > > + ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, SNP_GUEST_ERR(vmm_ret, fw_err)); > > > > + return 1; /* resume guest */ > > > > +} > > > > > > This patch is now in -next as commit 32fde9e18b3f ("KVM: SEV: Provide > > > support for SNP_EXTENDED_GUEST_REQUEST NAE event"), where it causes a > > > clang warning (or hard error when CONFIG_WERROR is enabled) [...] > > > Seems legitimate to me. What was the intention here? > > > > Mike, I think this should just be 0? > > Hi Paolo, > > Yes, I was just about to submit a patch that does just that: > > https://github.com/mdroth/linux/commit/df55e9c5b97542fe037f5b5293c11a49f7c658ef Submitted a proper patch here: https://lore.kernel.org/kvm/20240513172704.718533-1-michael.roth@xxxxxxx/ and also one for a separate warning: https://lore.kernel.org/kvm/20240513181928.720979-1-michael.roth@xxxxxxx/ I saw my build environment had WARN=0 for the last round of changes, so I re-tested various kernel configs with/without clang and haven't seen any other issues. So I think that should be the last of it. I'll be sure to be a lot more careful about this in the future. Thanks, Mike > > Sorry for the breakage, > > Mike > > > > > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c > > index c7a0971149f2..affb4fb47f91 100644 > > --- a/arch/x86/kvm/svm/sev.c > > +++ b/arch/x86/kvm/svm/sev.c > > @@ -3911,7 +3911,6 @@ static int snp_begin_ext_guest_req(struct kvm_vcpu *vcpu) > > int vmm_ret = SNP_GUEST_VMM_ERR_GENERIC; > > struct vcpu_svm *svm = to_svm(vcpu); > > unsigned long data_npages; > > - sev_ret_code fw_err; > > gpa_t data_gpa; > > if (!sev_snp_guest(vcpu->kvm)) > > @@ -3938,7 +3937,7 @@ static int snp_begin_ext_guest_req(struct kvm_vcpu *vcpu) > > return 0; /* forward request to userspace */ > > abort_request: > > - ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, SNP_GUEST_ERR(vmm_ret, fw_err)); > > + ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, SNP_GUEST_ERR(vmm_ret, 0)); > > return 1; /* resume guest */ > > } > > Paolo > > > > >