[PATCH] kvm/i386: declare kvm_filter_msr() static

Ani Sinha posted 1 patch 2 months, 3 weeks ago
target/i386/kvm/kvm.c      | 4 +++-
target/i386/kvm/kvm_i386.h | 3 ---
2 files changed, 3 insertions(+), 4 deletions(-)
[PATCH] kvm/i386: declare kvm_filter_msr() static
Posted by Ani Sinha 2 months, 3 weeks ago
kvm_filer_msr() is only used from i386 kvm module. Make it static so that its
easy for developers to understand that its not used anywhere else.

Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
 target/i386/kvm/kvm.c      | 4 +++-
 target/i386/kvm/kvm_i386.h | 3 ---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 2fa88ef1e3..11c7619bfd 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -93,6 +93,8 @@
 #define MSR_BUF_SIZE 4096
 
 static void kvm_init_msrs(X86CPU *cpu);
+static bool kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDMSRHandler *rdmsr,
+                           QEMUWRMSRHandler *wrmsr);
 
 const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
     KVM_CAP_INFO(SET_TSS_ADDR),
@@ -5728,7 +5730,7 @@ static bool kvm_install_msr_filters(KVMState *s)
     return true;
 }
 
-bool kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDMSRHandler *rdmsr,
+static bool kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDMSRHandler *rdmsr,
                     QEMUWRMSRHandler *wrmsr)
 {
     int i;
diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h
index 34fc60774b..26d7c57512 100644
--- a/target/i386/kvm/kvm_i386.h
+++ b/target/i386/kvm/kvm_i386.h
@@ -74,9 +74,6 @@ typedef struct kvm_msr_handlers {
     QEMUWRMSRHandler *wrmsr;
 } KVMMSRHandlers;
 
-bool kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDMSRHandler *rdmsr,
-                    QEMUWRMSRHandler *wrmsr);
-
 #endif /* CONFIG_KVM */
 
 void kvm_pc_setup_irq_routing(bool pci_enabled);
-- 
2.42.0
Re: [PATCH] kvm/i386: declare kvm_filter_msr() static
Posted by Philippe Mathieu-Daudé 2 months, 3 weeks ago
On 3/9/24 08:50, Ani Sinha wrote:
> kvm_filer_msr() is only used from i386 kvm module. Make it static so that its
> easy for developers to understand that its not used anywhere else.
> 
> Signed-off-by: Ani Sinha <anisinha@redhat.com>
> ---
>   target/i386/kvm/kvm.c      | 4 +++-
>   target/i386/kvm/kvm_i386.h | 3 ---
>   2 files changed, 3 insertions(+), 4 deletions(-)

> diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h
> index 34fc60774b..26d7c57512 100644
> --- a/target/i386/kvm/kvm_i386.h
> +++ b/target/i386/kvm/kvm_i386.h
> @@ -74,9 +74,6 @@ typedef struct kvm_msr_handlers {
>       QEMUWRMSRHandler *wrmsr;
>   } KVMMSRHandlers;

Isn't it also valid for QEMURDMSRHandler,  QEMUWRMSRHandler and
KVMMSRHandlers definitions?

>   
> -bool kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDMSRHandler *rdmsr,
> -                    QEMUWRMSRHandler *wrmsr);
> -
>   #endif /* CONFIG_KVM */