Skip to contentSkip to conversation

kvm/kvm-all: make kvm_park/unpark_vcpu local to kvm-all.c

PATCH Applied Ani Sinha 6 participants 7 messages Aug 15, 2025 – Aug 27, 2025 KVM

lore
Share & tools
lore

Ani Sinha

author
#0 lore raw

PATCH v2 1/1 kvm/kvm-all: make kvm_park/unpark_vcpu local to kvm-all.c

kvm_park_vcpu() and kvm_unpark_vcpu() is only used in kvm-all.c. Declare it static, remove it from common header file and make it local to kvm-all.c

---
 accel/kvm/kvm-all.c  |  4 ++--
 include/system/kvm.h | 17 -----------------
 2 files changed, 2 insertions(+), 19 deletions(-)

changelog:
unexport kvm_unpark_vcpu() as well and remove unnecessary forward declarations.

accel/kvm/kvm-all.c +2 -2
index 890d5ea9f8..f36dfe3349 100644
@@ -414,7 +414,7 @@ err:
     return ret;
 }
 
-void kvm_park_vcpu(CPUState *cpu)
+static void kvm_park_vcpu(CPUState *cpu)
 {
     struct KVMParkedVcpu *vcpu;
 
@@ -426,7 +426,7 @@ void kvm_park_vcpu(CPUState *cpu)
     QLIST_INSERT_HEAD(&kvm_state->kvm_parked_vcpus, vcpu, node);
 }
 
-int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
+static int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
 {
     struct KVMParkedVcpu *cpu;
     int kvm_fd = -ENOENT;
include/system/kvm.h +0 -17
index 3c7d314736..4fc09e3891 100644
@@ -317,23 +317,6 @@ int kvm_create_device(KVMState *s, uint64_t type, bool test);
  */
 bool kvm_device_supported(int vmfd, uint64_t type);
 
-/**
- * kvm_park_vcpu - Park QEMU KVM vCPU context
- * @cpu: QOM CPUState object for which QEMU KVM vCPU context has to be parked.
- *
- * @returns: none
- */
-void kvm_park_vcpu(CPUState *cpu);
-
-/**
- * kvm_unpark_vcpu - unpark QEMU KVM vCPU context
- * @s: KVM State
- * @vcpu_id: Architecture vCPU ID of the parked vCPU
- *
- * @returns: KVM fd
- */
-int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id);
-
 /**
  * kvm_create_and_park_vcpu - Create and park a KVM vCPU
  * @cpu: QOM CPUState object for which KVM vCPU has to be created and parked.
Signature · 1 line
2.50.1
Reviewed-by Ani Sinha on v2 1/1
#1 lore raw
Quoted 4 lines · On Fri, 15 Aug 2025 12:24:45 +0530 Ani Sinha <[email protected]> wrote:

kvm_park_vcpu() and kvm_unpark_vcpu() is only used in kvm-all.c. Declare it static, remove it from common header file and make it local to kvm-all.c

Quoted 59 lines
---
 accel/kvm/kvm-all.c  |  4 ++--
 include/system/kvm.h | 17 -----------------
 2 files changed, 2 insertions(+), 19 deletions(-)

changelog:
unexport kvm_unpark_vcpu() as well and remove unnecessary forward declarations.

accel/kvm/kvm-all.c +2 -2
index 890d5ea9f8..f36dfe3349 100644
@@ -414,7 +414,7 @@ err:
     return ret;
 }
 
-void kvm_park_vcpu(CPUState *cpu)
+static void kvm_park_vcpu(CPUState *cpu)
 {
     struct KVMParkedVcpu *vcpu;
 
@@ -426,7 +426,7 @@ void kvm_park_vcpu(CPUState *cpu)
     QLIST_INSERT_HEAD(&kvm_state->kvm_parked_vcpus, vcpu, node);
 }
 
-int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
+static int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
 {
     struct KVMParkedVcpu *cpu;
     int kvm_fd = -ENOENT;
include/system/kvm.h +0 -17
index 3c7d314736..4fc09e3891 100644
@@ -317,23 +317,6 @@ int kvm_create_device(KVMState *s, uint64_t type, bool test);
  */
 bool kvm_device_supported(int vmfd, uint64_t type);
 
-/**
- * kvm_park_vcpu - Park QEMU KVM vCPU context
- * @cpu: QOM CPUState object for which QEMU KVM vCPU context has to be parked.
- *
- * @returns: none
- */
-void kvm_park_vcpu(CPUState *cpu);
-
-/**
- * kvm_unpark_vcpu - unpark QEMU KVM vCPU context
- * @s: KVM State
- * @vcpu_id: Architecture vCPU ID of the parked vCPU
- *
- * @returns: KVM fd
- */
-int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id);
-
 /**
  * kvm_create_and_park_vcpu - Create and park a KVM vCPU
  * @cpu: QOM CPUState object for which KVM vCPU has to be created and parked.
#2 lore raw
Quoted 9 lines · Igor Mammedov
Quoted 4 lines · On Fri, 15 Aug 2025 12:24:45 +0530 Ani Sinha <[email protected]> wrote:

kvm_park_vcpu() and kvm_unpark_vcpu() is only used in kvm-all.c. Declare it static, remove it from common header file and make it local to kvm-all.c

?

I assume you meant reviewed by Igor but I'm not sure what b4 will do now.

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#3 lore raw
In reply to Igor Mammedov
Quoted 9 lines · Igor Mammedov
Quoted 4 lines · On Fri, 15 Aug 2025 12:24:45 +0530 Ani Sinha <[email protected]> wrote:

kvm_park_vcpu() and kvm_unpark_vcpu() is only used in kvm-all.c. Declare it static, remove it from common header file and make it local to kvm-all.c

Do you mean Igor Mammedov <[email protected]>?

Quoted 62 lines
Quoted 60 lines
---
  accel/kvm/kvm-all.c  |  4 ++--
  include/system/kvm.h | 17 -----------------
  2 files changed, 2 insertions(+), 19 deletions(-)

changelog:
unexport kvm_unpark_vcpu() as well and remove unnecessary forward declarations.

accel/kvm/kvm-all.c +2 -2
index 890d5ea9f8..f36dfe3349 100644
@@ -414,7 +414,7 @@ err:
      return ret;
  }
 
-void kvm_park_vcpu(CPUState *cpu)
+static void kvm_park_vcpu(CPUState *cpu)
  {
      struct KVMParkedVcpu *vcpu;
 
@@ -426,7 +426,7 @@ void kvm_park_vcpu(CPUState *cpu)
      QLIST_INSERT_HEAD(&kvm_state->kvm_parked_vcpus, vcpu, node);
  }
 
-int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
+static int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
  {
      struct KVMParkedVcpu *cpu;
      int kvm_fd = -ENOENT;
include/system/kvm.h +0 -17
index 3c7d314736..4fc09e3891 100644
@@ -317,23 +317,6 @@ int kvm_create_device(KVMState *s, uint64_t type, bool test);
   */
  bool kvm_device_supported(int vmfd, uint64_t type);
 
-/**
- * kvm_park_vcpu - Park QEMU KVM vCPU context
- * @cpu: QOM CPUState object for which QEMU KVM vCPU context has to be parked.
- *
- * @returns: none
- */
-void kvm_park_vcpu(CPUState *cpu);
-
-/**
- * kvm_unpark_vcpu - unpark QEMU KVM vCPU context
- * @s: KVM State
- * @vcpu_id: Architecture vCPU ID of the parked vCPU
- *
- * @returns: KVM fd
- */
-int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id);
-
  /**
   * kvm_create_and_park_vcpu - Create and park a KVM vCPU
   * @cpu: QOM CPUState object for which KVM vCPU has to be created and parked.
#4 lore raw
Quoted 4 lines · On Tue, 26 Aug 2025 17:09:27 +0200 Philippe Mathieu-Daudé <[email protected]>…
Quoted 3 lines · Igor Mammedov

On Fri, 15 Aug 2025 12:24:45 +0530
Ani Sinha <[email protected]> wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

kvm_park_vcpu() and kvm_unpark_vcpu() is only used in kvm-all.c. Declare it static, remove it from common header file and make it local to kvm-all.c

Do you mean Igor Mammedov <[email protected]>?

sorry for mistake,
I've surely meant myself

Quoted 64 lines
Quoted 63 lines
Quoted 61 lines
  
---
  accel/kvm/kvm-all.c  |  4 ++--
  include/system/kvm.h | 17 -----------------
  2 files changed, 2 insertions(+), 19 deletions(-)

changelog:
unexport kvm_unpark_vcpu() as well and remove unnecessary forward declarations.

accel/kvm/kvm-all.c +2 -2
index 890d5ea9f8..f36dfe3349 100644
@@ -414,7 +414,7 @@ err:
      return ret;
  }
 
-void kvm_park_vcpu(CPUState *cpu)
+static void kvm_park_vcpu(CPUState *cpu)
  {
      struct KVMParkedVcpu *vcpu;
 
@@ -426,7 +426,7 @@ void kvm_park_vcpu(CPUState *cpu)
      QLIST_INSERT_HEAD(&kvm_state->kvm_parked_vcpus, vcpu, node);
  }
 
-int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
+static int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
  {
      struct KVMParkedVcpu *cpu;
      int kvm_fd = -ENOENT;
include/system/kvm.h +0 -17
index 3c7d314736..4fc09e3891 100644
@@ -317,23 +317,6 @@ int kvm_create_device(KVMState *s, uint64_t type, bool test);
   */
  bool kvm_device_supported(int vmfd, uint64_t type);
 
-/**
- * kvm_park_vcpu - Park QEMU KVM vCPU context
- * @cpu: QOM CPUState object for which QEMU KVM vCPU context has to be parked.
- *
- * @returns: none
- */
-void kvm_park_vcpu(CPUState *cpu);
-
-/**
- * kvm_unpark_vcpu - unpark QEMU KVM vCPU context
- * @s: KVM State
- * @vcpu_id: Architecture vCPU ID of the parked vCPU
- *
- * @returns: KVM fd
- */
-int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id);
-
  /**
   * kvm_create_and_park_vcpu - Create and park a KVM vCPU
   * @cpu: QOM CPUState object for which KVM vCPU has to be created and parked.  
Reviewed-by on v2 1/1
#5 lore raw
In reply to Ani Sinha
Quoted 10 lines · Ani Sinha

Date: Fri, 15 Aug 2025 12:24:45 +0530
From: Ani Sinha <[email protected]>
Subject: [PATCH v2] kvm/kvm-all: make kvm_park/unpark_vcpu local to
kvm-all.c
X-Mailer: git-send-email 2.50.1

kvm_park_vcpu() and kvm_unpark_vcpu() is only used in kvm-all.c. Declare it static, remove it from common header file and make it local to kvm-all.c

Quoted 8 lines
---
 accel/kvm/kvm-all.c  |  4 ++--
 include/system/kvm.h | 17 -----------------
 2 files changed, 2 insertions(+), 19 deletions(-)

changelog:
unexport kvm_unpark_vcpu() as well and remove unnecessary forward declarations.