From: Isaku Yamahata <isaku.yamahata@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
seanjc@google.com, michael.roth@amd.com, aik@amd.com,
isaku.yamahata@intel.com,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
isaku.yamahata@linux.intel.com
Subject: Re: [PATCH v3 04/15] KVM: SVM: Compile sev.c if and only if CONFIG_KVM_AMD_SEV=y
Date: Mon, 18 Mar 2024 15:55:05 -0700 [thread overview]
Message-ID: <20240318225505.GB1645738@ls.amr.corp.intel.com> (raw)
In-Reply-To: <20240226190344.787149-5-pbonzini@redhat.com>
On Mon, Feb 26, 2024 at 02:03:33PM -0500,
Paolo Bonzini <pbonzini@redhat.com> wrote:
> diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h
> index 8ef95139cd24..52bc955ed06f 100644
> --- a/arch/x86/kvm/svm/svm.h
> +++ b/arch/x86/kvm/svm/svm.h
> @@ -664,13 +664,10 @@ void avic_refresh_virtual_apic_mode(struct kvm_vcpu *vcpu);
>
> /* sev.c */
>
> +#ifdef CONFIG_KVM_AMD_SEV
> #define GHCB_VERSION_MAX 1ULL
> #define GHCB_VERSION_MIN 1ULL
>
> -
> -extern unsigned int max_sev_asid;
> -
> -void sev_vm_destroy(struct kvm *kvm);
> int sev_mem_enc_ioctl(struct kvm *kvm, void __user *argp);
> int sev_mem_enc_register_region(struct kvm *kvm,
> struct kvm_enc_region *range);
> @@ -681,19 +678,30 @@ int sev_vm_move_enc_context_from(struct kvm *kvm, unsigned int source_fd);
> void sev_guest_memory_reclaimed(struct kvm *kvm);
>
> void pre_sev_run(struct vcpu_svm *svm, int cpu);
> -void __init sev_set_cpu_caps(void);
> -void __init sev_hardware_setup(void);
> -void sev_hardware_unsetup(void);
> -int sev_cpu_init(struct svm_cpu_data *sd);
> void sev_init_vmcb(struct vcpu_svm *svm);
> void sev_vcpu_after_set_cpuid(struct vcpu_svm *svm);
> -void sev_free_vcpu(struct kvm_vcpu *vcpu);
> int sev_handle_vmgexit(struct kvm_vcpu *vcpu);
> int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in);
> void sev_es_vcpu_reset(struct vcpu_svm *svm);
> void sev_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector);
> void sev_es_prepare_switch_to_guest(struct sev_es_save_area *hostsa);
> void sev_es_unmap_ghcb(struct vcpu_svm *svm);
> +void sev_free_vcpu(struct kvm_vcpu *vcpu);
> +void sev_vm_destroy(struct kvm *kvm);
> +void __init sev_set_cpu_caps(void);
> +void __init sev_hardware_setup(void);
> +void sev_hardware_unsetup(void);
> +int sev_cpu_init(struct svm_cpu_data *sd);
> +extern unsigned int max_sev_asid;
> +#else
> +static inline void sev_free_vcpu(struct kvm_vcpu *vcpu) {}
> +static inline void sev_vm_destroy(struct kvm *kvm) {}
> +static inline void __init sev_set_cpu_caps(void) {}
> +static inline void __init sev_hardware_setup(void) {}
> +static inline void sev_hardware_unsetup(void) {}
> +static inline int sev_cpu_init(struct svm_cpu_data *sd) { return 0; }
> +#define max_sev_asid 0
> +#endif
>
> /* vmenter.S */
>
> --
This causes compile errors with -Werror=implicit-function-declaration when
CONFIG_KVM_AMD=y and CONFIG_KVM_AMD_SEV=n. As discussed in [1], the stubs
aren't needed due to dead code elimination, but the declarations are needed.
[1] https://lore.kernel.org/kvm/ZdjCpX4LMCCyYev9@google.com/
Please feel free to squash the fix.
CC arch/x86/kvm/svm/svm.o
/linux/arch/x86/kvm/svm/svm.c: In function 'init_vmcb':
/linux/arch/x86/kvm/svm/svm.c:1367:17: error: implicit declaration of function 'sev_init_vmcb'; did you mean 'init_vmcb'? [-Werror=implicit-function-declaration]
1367 | sev_init_vmcb(svm);
| ^~~~~~~~~~~~~
| init_vmcb
Similar warnings for sev_es_vcpu_reset(), sev_es_unmap_ghcb(),
sev_es_prepare_switch_to_guest(), sev_es_string_io(), pre_sev_run(),
sev_vcpu_after_set_cpuid(), and sev_vcpu_deliver_sipi_vector().
Reported-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
---
arch/x86/kvm/svm/svm.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h
index 52bc955ed06f..eff9f19e5bcc 100644
--- a/arch/x86/kvm/svm/svm.h
+++ b/arch/x86/kvm/svm/svm.h
@@ -663,6 +663,14 @@ void avic_refresh_virtual_apic_mode(struct kvm_vcpu *vcpu);
/* sev.c */
+void pre_sev_run(struct vcpu_svm *svm, int cpu);
+void sev_init_vmcb(struct vcpu_svm *svm);
+void sev_vcpu_after_set_cpuid(struct vcpu_svm *svm);
+int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in);
+void sev_es_vcpu_reset(struct vcpu_svm *svm);
+void sev_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector);
+void sev_es_prepare_switch_to_guest(struct sev_es_save_area *hostsa);
+void sev_es_unmap_ghcb(struct vcpu_svm *svm);
#ifdef CONFIG_KVM_AMD_SEV
#define GHCB_VERSION_MAX 1ULL
@@ -677,15 +685,7 @@ int sev_vm_copy_enc_context_from(struct kvm *kvm, unsigned int source_fd);
int sev_vm_move_enc_context_from(struct kvm *kvm, unsigned int source_fd);
void sev_guest_memory_reclaimed(struct kvm *kvm);
-void pre_sev_run(struct vcpu_svm *svm, int cpu);
-void sev_init_vmcb(struct vcpu_svm *svm);
-void sev_vcpu_after_set_cpuid(struct vcpu_svm *svm);
int sev_handle_vmgexit(struct kvm_vcpu *vcpu);
-int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in);
-void sev_es_vcpu_reset(struct vcpu_svm *svm);
-void sev_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector);
-void sev_es_prepare_switch_to_guest(struct sev_es_save_area *hostsa);
-void sev_es_unmap_ghcb(struct vcpu_svm *svm);
void sev_free_vcpu(struct kvm_vcpu *vcpu);
void sev_vm_destroy(struct kvm *kvm);
void __init sev_set_cpu_caps(void);
--
2.43.2
--
Isaku Yamahata <isaku.yamahata@intel.com>
next prev parent reply other threads:[~2024-03-18 22:55 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-26 19:03 [PATCH v3 00/15] KVM: SEV: allow customizing VMSA features Paolo Bonzini
2024-02-26 19:03 ` [PATCH v3 01/15] KVM: SEV: fix compat ABI for KVM_MEMORY_ENCRYPT_OP Paolo Bonzini
2024-02-26 19:03 ` [PATCH v3 02/15] KVM: x86: use u64_to_user_addr() Paolo Bonzini
2024-03-04 9:08 ` Xu Yilun
2024-02-26 19:03 ` [PATCH v3 03/15] KVM: SVM: Invert handling of SEV and SEV_ES feature flags Paolo Bonzini
2024-03-12 15:19 ` Michael Roth
2024-02-26 19:03 ` [PATCH v3 04/15] KVM: SVM: Compile sev.c if and only if CONFIG_KVM_AMD_SEV=y Paolo Bonzini
2024-03-18 22:55 ` Isaku Yamahata [this message]
2024-02-26 19:03 ` [PATCH v3 05/15] Documentation: kvm/sev: separate description of firmware Paolo Bonzini
2024-02-28 9:34 ` Bagas Sanjaya
2024-02-26 19:03 ` [PATCH v3 06/15] KVM: introduce new vendor op for KVM_GET_DEVICE_ATTR Paolo Bonzini
2024-02-26 19:03 ` [PATCH v3 07/15] KVM: SEV: publish supported VMSA features Paolo Bonzini
2024-02-26 19:03 ` [PATCH v3 08/15] KVM: SEV: store VMSA features in kvm_sev_info Paolo Bonzini
2024-02-26 19:03 ` [PATCH v3 09/15] KVM: SEV: disable DEBUG_SWAP by default Paolo Bonzini
2024-02-26 19:03 ` [PATCH v3 10/15] KVM: x86: add fields to struct kvm_arch for CoCo features Paolo Bonzini
2024-03-14 2:49 ` Michael Roth
2024-03-14 22:09 ` Michael Roth
2024-03-14 22:56 ` Sean Christopherson
2024-03-14 23:48 ` Michael Roth
2024-03-15 14:56 ` Sean Christopherson
2024-03-18 16:48 ` Paolo Bonzini
2024-03-18 22:01 ` Paolo Bonzini
2024-02-26 19:03 ` [PATCH v3 11/15] KVM: x86: Add supported_vm_types to kvm_caps Paolo Bonzini
2024-02-26 19:03 ` [PATCH v3 12/15] KVM: SEV: introduce to_kvm_sev_info Paolo Bonzini
2024-02-26 19:03 ` [PATCH v3 13/15] KVM: SEV: define VM types for SEV and SEV-ES Paolo Bonzini
2024-02-28 1:00 ` Isaku Yamahata
2024-03-04 15:32 ` Xu Yilun
2024-03-04 16:37 ` Sean Christopherson
2024-03-05 13:34 ` Paolo Bonzini
2024-02-26 19:03 ` [PATCH v3 14/15] KVM: SEV: introduce KVM_SEV_INIT2 operation Paolo Bonzini
2024-03-04 15:35 ` Xu Yilun
2024-02-26 19:03 ` [PATCH v3 15/15] selftests: kvm: add tests for KVM_SEV_INIT2 Paolo Bonzini
2024-02-27 3:50 ` [PATCH v3 00/15] KVM: SEV: allow customizing VMSA features Bagas Sanjaya
2024-02-27 17:49 ` Sean Christopherson
2024-02-28 3:22 ` Bagas Sanjaya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240318225505.GB1645738@ls.amr.corp.intel.com \
--to=isaku.yamahata@intel.com \
--cc=aik@amd.com \
--cc=isaku.yamahata@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®