All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Alexander Graf <agraf@csgraf.de>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
	 Richard Henderson <richard.henderson@linaro.org>
Subject: Re: [PATCH v2 2/2] target/arm: Catch invalid kvm state also for hvf
Date: Tue, 21 Jun 2022 18:34:07 +0100	[thread overview]
Message-ID: <CAFEAcA9kRP+dHj=a2OFnx0k+d9FSnQShjr+5Ff85tLQNZXZoyw@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA8=ThZ_texhcH2vqMicpAxOR9G1jtpCyBDbz9gbk5yg=w@mail.gmail.com>

On Tue, 21 Jun 2022 at 12:41, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Mon, 20 Jun 2022 at 20:22, Alexander Graf <agraf@csgraf.de> wrote:
> >
> > 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 other virt solutions like
> > Hvf, let's run the same checks there too.
> >
> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1073
> > Signed-off-by: Alexander Graf <agraf@csgraf.de>
>
>
> > --- 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 (!tcg_enabled()) {
>
> I'm a bit surprised we don't need to also have "&& !qtest_enabled()",
> but I guess if "make check" works then we're fine :-)

In fact you do need to handle qtest here too, otherwise
lots of tests in 'make check' barf on the unexpected error...

I'm going to squash the following fix in and take the patchset into
target-arm.next. (PS: you forgot the cover letter, I think ?)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 0862dcd63cb..d9c4a9f56d2 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -39,6 +39,7 @@
 #include "hw/boards.h"
 #endif
 #include "sysemu/tcg.h"
+#include "sysemu/qtest.h"
 #include "sysemu/hw_accel.h"
 #include "kvm_arm.h"
 #include "disas/capstone.h"
@@ -1490,8 +1491,12 @@ static void arm_cpu_realizefn(DeviceState *dev,
Error **errp)
         }
     }

-    if (!tcg_enabled()) {
+    if (!tcg_enabled() && !qtest_enabled()) {
         /*
+         * We assume that no accelerator except TCG (and the "not really an
+         * accelerator" qtest) can handle these features, because Arm hardware
+         * virtualization can't virtualize them.
+         *
          * Catch all the cases which might cause us to create more than one
          * address space for the CPU (otherwise we will assert() later in
          * cpu_address_space_init()).


thanks
-- PMM


  reply	other threads:[~2022-06-21 17:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 19:22 [PATCH v2 1/2] accel: Introduce current_accel_name() Alexander Graf
2022-06-20 19:22 ` [PATCH v2 2/2] target/arm: Catch invalid kvm state also for hvf Alexander Graf
2022-06-20 19:46   ` Richard Henderson
2022-06-21 11:41   ` Peter Maydell
2022-06-21 17:34     ` Peter Maydell [this message]
2022-06-20 19:46 ` [PATCH v2 1/2] accel: Introduce current_accel_name() Richard Henderson

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='CAFEAcA9kRP+dHj=a2OFnx0k+d9FSnQShjr+5Ff85tLQNZXZoyw@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=agraf@csgraf.de \
    --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.