qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Leif Lindholm <leif@nuviainc.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: kvm_target, QEMU_KVM_ARM_TARGET_GENERIC_V8 questions
Date: Thu, 4 Jun 2020 13:55:44 +0100	[thread overview]
Message-ID: <20200604125544.GW28566@vanye> (raw)

Hi there,

(all this done on current HEAD: 66234fee9c)

I was looking through the definition of the aarch64 "max" cpu, and
noticed it invokes aarch64_a57_initfn as a template, followed by
overriding some feature and ID fields to enable additional
functionality.

I then noticed it does not override kvm_target, which hence remains
set as QEMU_KVM_ARM_TARGET_CORTEX_A57. Of course, this only happens on
the else side of the if (kvm_enabled()) branch, so doesn't affect it.

However, while looking at this, I noticed aarch64_a72_initfn doesn't
initialise kvm_target at all.

Then I looked at the definition of QEMU_KVM_ARM_TARGET_CORTEX_A57,
found there was also a KVM_ARM_TARGET_CORTEX_A57, and then I noticed
there exists a KVM_ARM_TARGET_CORTEX_A57 (in
linux-headers/asm-arm64/kvm.h), and *then* I noticed there exists a
KVM_ARM_TARGET_GENERIC_V8 definition there as well - plus a comment
saying "please don't add any more targets unless you really need to".
Then I noticed there isn't a corresponding
QEMU_KVM_ARM_TARGET_GENERIC_V8 in target/arm/kvm-consts.h.

So, then I decided to actually test things, and found that
(with -enable-kvm):
- on Cortex-A53 hardware
  - "max" kvm_target gets initialized to 4 (KVM_ARM_TARGET_CORTEX_A53)
    by kvm_arm_get_host_cpu_features (as returned from the kernel for
    vm_arm_create_scratch_host_vcpu)
  - cortex-A72 fails to start with "KVM is not supported for this guest
    CPU type"
  (fair enough, it's later than A53)
- on Cortex-A72 hardware
  - "max" kvm_target gets initialized to 5 (KVM_ARM_TARGET_GENERIC_V8)
    by kvm_arm_get_host_cpu_features
  - "cortex-A72" fails to start (umm...)

However ... if I haven't managed to confuse myself somewhere in here
(which is completely possible), would it be OK if I submitted a set of
patches that:
- add a QEMU_KVM_ARM_TARGET_GENERIC_V8 to match the kernel one
- set kvm_target for Cortex-A72 to QEMU_KVM_ARM_TARGET_GENERIC_V8
  - alternatively drop the explicit settings for A57/A53
- drop the call from aarch64_max_initfn to aarch64_a57_initfn, and
  copy the relevant bits into the former for the !kvm case

?

/
    Leif


             reply	other threads:[~2020-06-04 12:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04 12:55 Leif Lindholm [this message]
2020-06-04 13:10 ` kvm_target, QEMU_KVM_ARM_TARGET_GENERIC_V8 questions Peter Maydell
2020-06-04 13:32   ` Andrew Jones
2020-06-04 13:37     ` Peter Maydell
2020-06-04 15:38   ` Leif Lindholm
2020-06-04 15:59     ` Peter Maydell
2020-06-04 13:18 ` Andrew Jones
2020-06-04 16:03   ` Leif Lindholm
2020-06-04 16:09     ` Peter Maydell
2020-06-04 16:26       ` Leif Lindholm
2020-06-04 18:43         ` Peter Maydell
2020-06-08 12:02           ` Leif Lindholm
2020-06-08 12:42             ` Peter Maydell

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=20200604125544.GW28566@vanye \
    --to=leif@nuviainc.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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 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).