All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Miguel Luis" <miguel.luis@oracle.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	kvm@vger.kernel.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Haibo Xu" <haibo.xu@linaro.org>,
	"Mohamed Mediouni" <mohamed@unpredictable.fr>,
	"Mark Burton" <mburton@qti.qualcomm.com>,
	"Alexander Graf" <agraf@csgraf.de>,
	"Claudio Fontana" <cfontana@suse.de>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Mads Ynddal" <mads@ynddal.dk>,
	"Eric Auger" <eric.auger@redhat.com>,
	qemu-arm@nongnu.org, "Cameron Esfahani" <dirty@apple.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>
Subject: [RFC PATCH 02/11] target/arm: Use generic hwaccel_enabled() to check 'host' cpu type
Date: Mon, 11 Aug 2025 19:06:02 +0200	[thread overview]
Message-ID: <20250811170611.37482-3-philmd@linaro.org> (raw)
In-Reply-To: <20250811170611.37482-1-philmd@linaro.org>

We should be able to use the 'host' CPU with any hardware accelerator.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 target/arm/arm-qmp-cmds.c |  5 +++--
 target/arm/cpu.c          |  5 +++--
 target/arm/cpu64.c        | 11 ++++++-----
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c
index d292c974c44..1142e28cb76 100644
--- a/target/arm/arm-qmp-cmds.c
+++ b/target/arm/arm-qmp-cmds.c
@@ -31,6 +31,7 @@
 #include "qapi/qapi-commands-misc-arm.h"
 #include "qobject/qdict.h"
 #include "qom/qom-qobject.h"
+#include "system/hw_accel.h"
 #include "cpu.h"
 
 static GICCapability *gic_cap_new(int version)
@@ -117,8 +118,8 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
         return NULL;
     }
 
-    if (!kvm_enabled() && !strcmp(model->name, "host")) {
-        error_setg(errp, "The CPU type '%s' requires KVM", model->name);
+    if (!hwaccel_enabled() && !strcmp(model->name, "host")) {
+        error_setg(errp, "The CPU type 'host' requires hardware accelerator");
         return NULL;
     }
 
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index e2b2337399c..d9a8f62934d 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1984,8 +1984,9 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
      * this is the first point where we can report it.
      */
     if (cpu->host_cpu_probe_failed) {
-        if (!kvm_enabled() && !hvf_enabled()) {
-            error_setg(errp, "The 'host' CPU type can only be used with KVM or HVF");
+        if (!hwaccel_enabled()) {
+            error_setg(errp, "The 'host' CPU type can only be used with "
+                             "hardware accelator such KVM/HVF");
         } else {
             error_setg(errp, "Failed to retrieve host CPU features");
         }
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index 26cf7e6dfa2..034bbc504cd 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -26,6 +26,7 @@
 #include "qemu/units.h"
 #include "system/kvm.h"
 #include "system/hvf.h"
+#include "system/hw_accel.h"
 #include "system/qtest.h"
 #include "system/tcg.h"
 #include "kvm_arm.h"
@@ -522,7 +523,7 @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp)
     isar2 = FIELD_DP64(isar2, ID_AA64ISAR2, APA3, 0);
     isar2 = FIELD_DP64(isar2, ID_AA64ISAR2, GPA3, 0);
 
-    if (kvm_enabled() || hvf_enabled()) {
+    if (hwaccel_enabled()) {
         /*
          * Exit early if PAuth is enabled and fall through to disable it.
          * The algorithm selection properties are not present.
@@ -599,10 +600,10 @@ void aarch64_add_pauth_properties(Object *obj)
 
     /* Default to PAUTH on, with the architected algorithm on TCG. */
     qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property);
-    if (kvm_enabled() || hvf_enabled()) {
+    if (hwaccel_enabled()) {
         /*
          * Mirror PAuth support from the probed sysregs back into the
-         * property for KVM or hvf. Is it just a bit backward? Yes it is!
+         * property for HW accel. Is it just a bit backward? Yes it is!
          * Note that prop_pauth is true whether the host CPU supports the
          * architected QARMA5 algorithm or the IMPDEF one. We don't
          * provide the separate pauth-impdef property for KVM or hvf,
@@ -780,8 +781,8 @@ static void aarch64_host_initfn(Object *obj)
 
 static void aarch64_max_initfn(Object *obj)
 {
-    if (kvm_enabled() || hvf_enabled()) {
-        /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */
+    if (hwaccel_enabled()) {
+        /* When hardware acceleration enabled, '-cpu max' is identical to '-cpu host' */
         aarch64_host_initfn(obj);
         return;
     }
-- 
2.49.0


  parent reply	other threads:[~2025-08-11 17:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11 17:06 [RFC PATCH 00/11] target/arm: Introduce host_cpu_feature_supported() API Philippe Mathieu-Daudé
2025-08-11 17:06 ` [RFC PATCH 01/11] accel/system: Introduce hwaccel_enabled() helper Philippe Mathieu-Daudé
2025-08-11 17:06 ` Philippe Mathieu-Daudé [this message]
2025-08-11 17:06 ` [RFC PATCH 03/11] target/arm: Restrict PMU to system mode Philippe Mathieu-Daudé
2025-08-12  0:02   ` Richard Henderson
2025-08-11 17:06 ` [RFC PATCH 04/11] target/arm: Factor hvf_psci_get_target_el() out Philippe Mathieu-Daudé
2025-08-12  0:26   ` Richard Henderson
2025-08-11 17:06 ` [RFC PATCH 05/11] target/arm: Introduce arm_hw_accel_cpu_feature_supported() Philippe Mathieu-Daudé
2025-08-12  0:35   ` Richard Henderson
2025-08-12  4:06     ` Philippe Mathieu-Daudé
2025-08-12  4:58     ` Philippe Mathieu-Daudé
2025-08-11 17:06 ` [RFC PATCH 06/11] target/arm: Introduce host_cpu_feature_supported() Philippe Mathieu-Daudé
2025-08-12  0:44   ` Richard Henderson
2025-08-12  4:30     ` Philippe Mathieu-Daudé
2025-08-11 17:06 ` [RFC PATCH 07/11] target/arm: Replace kvm_arm_pmu_supported by host_cpu_feature_supported Philippe Mathieu-Daudé
2025-08-12  0:48   ` Richard Henderson
2025-08-12  4:49     ` Philippe Mathieu-Daudé
2025-08-12  6:03       ` Philippe Mathieu-Daudé
2025-08-12  7:33         ` Philippe Mathieu-Daudé
2025-08-12 12:42           ` Richard Henderson
2025-08-12 13:12             ` Philippe Mathieu-Daudé
2025-08-11 17:06 ` [RFC PATCH 08/11] target/arm: Replace kvm_arm_el2_supported " Philippe Mathieu-Daudé
2025-08-11 17:06 ` [RFC PATCH 09/11] target/arm/hvf: Sync registers used at EL2 Philippe Mathieu-Daudé
2025-08-12  0:20   ` Richard Henderson
2025-08-13  7:20     ` Philippe Mathieu-Daudé
2025-08-11 17:06 ` [RFC PATCH 10/11] target/arm/hvf: Consider EL2 acceleration for Silicon M3+ chipsets Philippe Mathieu-Daudé
2025-08-11 17:06 ` [RFC PATCH 11/11] target/arm/hvf: Allow EL2/EL3 emulation on Silicon M1 / M2 Philippe Mathieu-Daudé
2025-08-12  0:23   ` Richard Henderson
2025-08-12  3:56     ` 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=20250811170611.37482-3-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=agraf@csgraf.de \
    --cc=alex.bennee@linaro.org \
    --cc=cfontana@suse.de \
    --cc=dirty@apple.com \
    --cc=eric.auger@redhat.com \
    --cc=haibo.xu@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=mads@ynddal.dk \
    --cc=mburton@qti.qualcomm.com \
    --cc=miguel.luis@oracle.com \
    --cc=mohamed@unpredictable.fr \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.