All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/arm: Catch invalid kvm state also for hvf
@ 2022-06-20 16:08 Alexander Graf
  2022-06-20 17:09 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Graf @ 2022-06-20 16:08 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-arm, qemu-devel

Some features such as running in EL3 or running M profile code are
incompatible with virtualization as QEMU implements it today. To prevent
users from picking invalid configurations on Hvf as well, let's run the
same checks there as well.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1073
Signed-off-by: Alexander Graf <agraf@csgraf.de>
---
 target/arm/cpu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 1b5d535788..03510f29f9 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1490,7 +1490,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
         }
     }
 
-    if (kvm_enabled()) {
+    if (kvm_enabled() || hvf_enabled()) {
         /*
          * Catch all the cases which might cause us to create more than one
          * address space for the CPU (otherwise we will assert() later in
@@ -1498,17 +1498,17 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
          */
         if (arm_feature(env, ARM_FEATURE_M)) {
             error_setg(errp,
-                       "Cannot enable KVM when using an M-profile guest CPU");
+                       "Cannot enable KVM or HVF when using an M-profile guest CPU");
             return;
         }
         if (cpu->has_el3) {
             error_setg(errp,
-                       "Cannot enable KVM when guest CPU has EL3 enabled");
+                       "Cannot enable KVM or HVF when guest CPU has EL3 enabled");
             return;
         }
         if (cpu->tag_memory) {
             error_setg(errp,
-                       "Cannot enable KVM when guest CPUs has MTE enabled");
+                       "Cannot enable KVM or HVF when guest CPUs has MTE enabled");
             return;
         }
     }
-- 
2.32.1 (Apple Git-133)



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] target/arm: Catch invalid kvm state also for hvf
  2022-06-20 16:08 [PATCH] target/arm: Catch invalid kvm state also for hvf Alexander Graf
@ 2022-06-20 17:09 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2022-06-20 17:09 UTC (permalink / raw)
  To: Alexander Graf, Peter Maydell; +Cc: qemu-arm, qemu-devel

On 6/20/22 09:08, Alexander Graf wrote:
> -    if (kvm_enabled()) {
> +    if (kvm_enabled() || hvf_enabled()) {

I think this should be !tcg_enabled().  No hw virtualization can use EL3 (or M-profile), 
only full emulation from TCG.  There is such a thing as ARM on Windows, so I can imagine 
that WHPX may make a future appearance here.

(MTE may eventually be supported by virtualization, but it's not there yet.)


>          if (arm_feature(env, ARM_FEATURE_M)) {
>              error_setg(errp,
> -                       "Cannot enable KVM when using an M-profile guest CPU");
> +                       "Cannot enable KVM or HVF when using an M-profile guest CPU");
>              return;
>          }

You can get the accelerator name from

     AccelClass *ac = ACCEL_GET_CLASS(current_accel());
     const char *name = ac->name;


r~


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-20 17:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-20 16:08 [PATCH] target/arm: Catch invalid kvm state also for hvf Alexander Graf
2022-06-20 17:09 ` Richard Henderson

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.