KVM: x86: Fix kvm/queue breakage on clang
Sean Christopherson
maintainercover KVM: x86: Fix kvm/queue breakage on clang
Fix clang build errors for patches sitting kvm/queue. Ideally, these fixes will be squashed before the buggy commits make their way to kvm/next. If you do fixup kvm/queue, the VMX commit also has a bad SOB chain; Jim either needs to be listed as the author or his SOB needs to be deleted.
Sean Christopherson (2):
KVM: VMX: Drop unprotected-by-braces variable declaration in
case-statement
KVM: SVM: Drop unprotected-by-braces variable declaration in
case-statement
arch/x86/kvm/svm/svm.c | 5 ++--- arch/x86/kvm/vmx/vmx.c | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-)
base-commit: 95b9779c1758f03cf494e8550d6249a40089ed1c
Signature · 1 line
2.40.0.rc2.332.ga46443480c-goog
Sean Christopherson
maintainerPATCH 1/2 KVM: VMX: Drop unprotected-by-braces variable declaration in case-statement
Remove the intermediate "guest_flush_l1d" boolean to fix a build error on clang due to the variable being declared inside a case-statement without curly braces to create a proper code block.
--- arch/x86/kvm/vmx/vmx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/kvm/vmx/vmx.c +1 -3
@@ -2325,10 +2325,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) X86_FEATURE_IBPB);break ;case MSR_IA32_FLUSH_CMD : -bool guest_flush_l1d =guest_cpuid_has (vcpu, -X86_FEATURE_FLUSH_L1D ); ret =vmx_set_msr_ia32_cmd (vcpu, msr_info, - guest_flush_l1d, +guest_cpuid_has (vcpu,X86_FEATURE_FLUSH_L1D ),L1D_FLUSH ,X86_FEATURE_FLUSH_L1D );break ;
Signature · 1 line
2.40.0.rc2.332.ga46443480c-goog
Sean Christopherson
maintainerPATCH 2/2 KVM: SVM: Drop unprotected-by-braces variable declaration in case-statement
In reply to Sean ChristophersonRemove the intermediate "guest_flush_l1d" boolean to fix a build error on clang due to the variable being declared inside a case-statement without curly braces to create a proper code block.
--- arch/x86/kvm/svm/svm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kvm/svm/svm.c +2 -3
@@ -2970,9 +2970,8 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) PRED_CMD_IBPB, X86_FEATURE_IBPB);break ;case MSR_IA32_FLUSH_CMD : -bool guest_flush_l1d =guest_cpuid_has (vcpu, -X86_FEATURE_FLUSH_L1D ); - r =svm_set_msr_ia32_cmd (vcpu, msr, guest_flush_l1d, + r =svm_set_msr_ia32_cmd (vcpu, msr, +guest_cpuid_has (vcpu,X86_FEATURE_FLUSH_L1D ),L1D_FLUSH ,X86_FEATURE_FLUSH_L1D );break ;case MSR_AMD64_VIRT_SPEC_CTRL :
Signature · 1 line
2.40.0.rc2.332.ga46443480c-goog
Am 15/03/2023 um 20:11 schrieb Sean Christopherson:
Quoted 11 lines
Fix clang build errors for patches sitting kvm/queue. Ideally, these fixes will be squashed before the buggy commits make their way to kvm/next. If you do fixup kvm/queue, the VMX commit also has a bad SOB chain; Jim either needs to be listed as the author or his SOB needs to be deleted.
Sean Christopherson (2):
KVM: VMX: Drop unprotected-by-braces variable declaration in
case-statement
KVM: SVM: Drop unprotected-by-braces variable declaration in
case-statement
Quoted 6 lines
arch/x86/kvm/svm/svm.c | 5 ++--- arch/x86/kvm/vmx/vmx.c | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-)base-commit:
95b9779c1758f03cf494e8550d6249a40089ed1c
Note to self: compile patches also with clang, since gcc didn't complain about missing brackets in a switch case.
Paolo Bonzini
maintainerQuoted 4 lines · Sean Christopherson
Fix clang build errors for patches sitting kvm/queue. Ideally, these fixes will be squashed before the buggy commits make their way to kvm/next. If you do fixup kvm/queue, the VMX commit also has a bad SOB chain; Jim either needs to be listed as the author or his SOB needs to be deleted.
I added it as Co-developed-by and squashed the patches.
Paolo