qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Daniel Henrique Barboza" <dbarboza@ventanamicro.com>,
	"Frédéric Barrat" <fbarrat@linux.ibm.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Cameron Esfahani" <dirty@apple.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	kvm@vger.kernel.org, "Alexander Graf" <agraf@csgraf.de>,
	"Paul Durrant" <paul@xen.org>,
	"David Hildenbrand" <david@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	xen-devel@lists.xenproject.org, qemu-arm@nongnu.org,
	"Cédric Le Goater" <clg@redhat.com>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Reinoud Zandijk" <reinoud@netbsd.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	qemu-s390x@nongnu.org, "Riku Voipio" <riku.voipio@iki.fi>,
	"Anthony PERARD" <anthony@xenproject.org>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Sunil Muthuswamy" <sunilmut@microsoft.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Roman Bolshakov" <rbolshakov@ddn.com>,
	"Edgar E . Iglesias" <edgar.iglesias@amd.com>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Phil Dennis-Jordan" <phil@philjordan.eu>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Nina Schoetterl-Glausch" <nsg@linux.ibm.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	qemu-ppc@nongnu.org,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Anton Johansson" <anjo@rev.ng>
Subject: [RFC PATCH 6/7] accel/hvf: Use CPU_FOREACH_HVF()
Date: Mon,  6 Jan 2025 21:02:57 +0100	[thread overview]
Message-ID: <20250106200258.37008-7-philmd@linaro.org> (raw)
In-Reply-To: <20250106200258.37008-1-philmd@linaro.org>

Only iterate over HVF vCPUs when running HVF specific code.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/system/hvf_int.h  | 4 ++++
 accel/hvf/hvf-accel-ops.c | 9 +++++----
 target/arm/hvf/hvf.c      | 4 ++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h
index 42ae18433f0..3cf64faabd1 100644
--- a/include/system/hvf_int.h
+++ b/include/system/hvf_int.h
@@ -11,6 +11,8 @@
 #ifndef HVF_INT_H
 #define HVF_INT_H
 
+#include "system/hw_accel.h"
+
 #ifdef __aarch64__
 #include <Hypervisor/Hypervisor.h>
 typedef hv_vcpu_t hvf_vcpuid;
@@ -74,4 +76,6 @@ int hvf_put_registers(CPUState *);
 int hvf_get_registers(CPUState *);
 void hvf_kick_vcpu_thread(CPUState *cpu);
 
+#define CPU_FOREACH_HVF(cpu) CPU_FOREACH_HWACCEL(cpu)
+
 #endif
diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
index 945ba720513..bbbe2f8d45b 100644
--- a/accel/hvf/hvf-accel-ops.c
+++ b/accel/hvf/hvf-accel-ops.c
@@ -504,7 +504,7 @@ static int hvf_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
         }
     }
 
-    CPU_FOREACH(cpu) {
+    CPU_FOREACH_HVF(cpu) {
         err = hvf_update_guest_debug(cpu);
         if (err) {
             return err;
@@ -543,7 +543,7 @@ static int hvf_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
         }
     }
 
-    CPU_FOREACH(cpu) {
+    CPU_FOREACH_HVF(cpu) {
         err = hvf_update_guest_debug(cpu);
         if (err) {
             return err;
@@ -560,7 +560,7 @@ static void hvf_remove_all_breakpoints(CPUState *cpu)
     QTAILQ_FOREACH_SAFE(bp, &hvf_state->hvf_sw_breakpoints, entry, next) {
         if (hvf_arch_remove_sw_breakpoint(cpu, bp) != 0) {
             /* Try harder to find a CPU that currently sees the breakpoint. */
-            CPU_FOREACH(tmpcpu)
+            CPU_FOREACH_HVF(tmpcpu)
             {
                 if (hvf_arch_remove_sw_breakpoint(tmpcpu, bp) == 0) {
                     break;
@@ -572,7 +572,7 @@ static void hvf_remove_all_breakpoints(CPUState *cpu)
     }
     hvf_arch_remove_all_hw_breakpoints();
 
-    CPU_FOREACH(cpu) {
+    CPU_FOREACH_HVF(cpu) {
         hvf_update_guest_debug(cpu);
     }
 }
@@ -581,6 +581,7 @@ static void hvf_accel_ops_class_init(ObjectClass *oc, void *data)
 {
     AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
 
+    ops->get_cpus_queue = hw_accel_get_cpus_queue;
     ops->create_vcpu_thread = hvf_start_vcpu_thread;
     ops->kick_vcpu_thread = hvf_kick_vcpu_thread;
 
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 0afd96018e0..13400ff0d5f 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -2269,10 +2269,10 @@ static void hvf_arch_set_traps(void)
 
     /* Check whether guest debugging is enabled for at least one vCPU; if it
      * is, enable exiting the guest on all vCPUs */
-    CPU_FOREACH(cpu) {
+    CPU_FOREACH_HVF(cpu) {
         should_enable_traps |= cpu->accel->guest_debug_enabled;
     }
-    CPU_FOREACH(cpu) {
+    CPU_FOREACH_HVF(cpu) {
         /* Set whether debug exceptions exit the guest */
         r = hv_vcpu_set_trap_debug_exceptions(cpu->accel->fd,
                                               should_enable_traps);
-- 
2.47.1



  parent reply	other threads:[~2025-01-06 20:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-06 20:02 [RFC PATCH 0/7] accel: Add per-accelerator vCPUs queue Philippe Mathieu-Daudé
2025-01-06 20:02 ` [RFC PATCH 1/7] cpus: Restrict CPU_FOREACH_SAFE() to user emulation Philippe Mathieu-Daudé
2025-01-06 20:19   ` Daniel Henrique Barboza
2025-01-06 20:02 ` [RFC PATCH 2/7] cpus: Introduce AccelOpsClass::get_cpus_queue() Philippe Mathieu-Daudé
2025-01-06 20:02 ` [RFC PATCH 3/7] accel/tcg: Implement tcg_get_cpus_queue() Philippe Mathieu-Daudé
2025-01-06 20:02 ` [RFC PATCH 4/7] accel/tcg: Use CPU_FOREACH_TCG() Philippe Mathieu-Daudé
2025-01-06 20:02 ` [RFC PATCH 5/7] accel/hw: Implement hw_accel_get_cpus_queue() Philippe Mathieu-Daudé
2025-01-06 20:02 ` Philippe Mathieu-Daudé [this message]
2025-01-06 20:33   ` [RFC PATCH 6/7] accel/hvf: Use CPU_FOREACH_HVF() Daniel Henrique Barboza
2025-01-06 21:08     ` Philippe Mathieu-Daudé
2025-01-07 13:09       ` BALATON Zoltan
2025-01-06 20:02 ` [RFC PATCH 7/7] accel/kvm: Use CPU_FOREACH_KVM() Philippe Mathieu-Daudé
2025-09-02 13:25 ` [RFC PATCH 0/7] accel: Add per-accelerator vCPUs queue Philippe Mathieu-Daudé

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=20250106200258.37008-7-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=agraf@csgraf.de \
    --cc=alistair.francis@wdc.com \
    --cc=anjo@rev.ng \
    --cc=anthony@xenproject.org \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=danielhb413@gmail.com \
    --cc=david@redhat.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=dirty@apple.com \
    --cc=dwmw2@infradead.org \
    --cc=edgar.iglesias@amd.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=fbarrat@linux.ibm.com \
    --cc=harshpb@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=nsg@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=phil@philjordan.eu \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rbolshakov@ddn.com \
    --cc=reinoud@netbsd.org \
    --cc=richard.henderson@linaro.org \
    --cc=riku.voipio@iki.fi \
    --cc=sstabellini@kernel.org \
    --cc=sunilmut@microsoft.com \
    --cc=thuth@redhat.com \
    --cc=wangyanan55@huawei.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=zhao1.liu@intel.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;
as well as URLs for NNTP newsgroup(s).