From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 07/23] hw/arm/virt: KVM: Probe for KVM_CAP_ARM_VM_IPA_SIZE when creating scratch VM
Date: Mon, 13 Sep 2021 17:11:28 +0100 [thread overview]
Message-ID: <20210913161144.12347-8-peter.maydell@linaro.org> (raw)
In-Reply-To: <20210913161144.12347-1-peter.maydell@linaro.org>
From: Marc Zyngier <maz@kernel.org>
Although we probe for the IPA limits imposed by KVM (and the hardware)
when computing the memory map, we still use the old style '0' when
creating a scratch VM in kvm_arm_create_scratch_host_vcpu().
On systems that are severely IPA challenged (such as the Apple M1),
this results in a failure as KVM cannot use the default 40bit that
'0' represents.
Instead, probe for the extension and use the reported IPA limit
if available.
Cc: Andrew Jones <drjones@redhat.com>
Cc: Eric Auger <eric.auger@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Message-id: 20210822144441.1290891-2-maz@kernel.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/kvm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 5d55de1a493..94b970bbf9b 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -70,12 +70,17 @@ bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try,
struct kvm_vcpu_init *init)
{
int ret = 0, kvmfd = -1, vmfd = -1, cpufd = -1;
+ int max_vm_pa_size;
kvmfd = qemu_open_old("/dev/kvm", O_RDWR);
if (kvmfd < 0) {
goto err;
}
- vmfd = ioctl(kvmfd, KVM_CREATE_VM, 0);
+ max_vm_pa_size = ioctl(kvmfd, KVM_CHECK_EXTENSION, KVM_CAP_ARM_VM_IPA_SIZE);
+ if (max_vm_pa_size < 0) {
+ max_vm_pa_size = 0;
+ }
+ vmfd = ioctl(kvmfd, KVM_CREATE_VM, max_vm_pa_size);
if (vmfd < 0) {
goto err;
}
--
2.20.1
next prev parent reply other threads:[~2021-09-13 16:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 16:11 [PULL 00/23] target-arm queue Peter Maydell
2021-09-13 16:11 ` [PULL 01/23] hw/misc: zynq_slcr: Correctly compute output clocks in the reset exit phase Peter Maydell
2021-09-13 16:11 ` [PULL 02/23] hw/char: cadence_uart: Disable transmit when input clock is disabled Peter Maydell
2021-09-13 16:11 ` [PULL 03/23] hw/char: cadence_uart: Move clock/reset check to uart_can_receive() Peter Maydell
2021-09-13 16:11 ` [PULL 04/23] hw/char: cadence_uart: Convert to memop_with_attrs() ops Peter Maydell
2021-09-13 16:11 ` [PULL 05/23] hw/char: cadence_uart: Ignore access when unclocked or in reset for uart_{read, write}() Peter Maydell
2021-09-13 16:11 ` [PULL 06/23] hw/char: cadence_uart: Log a guest error when device is unclocked or in reset Peter Maydell
2021-09-13 16:11 ` Peter Maydell [this message]
2021-09-13 16:11 ` [PULL 08/23] hw/arm: Add support for kudo-bmc board Peter Maydell
2021-09-13 16:11 ` [PULL 09/23] hw/intc: GICv3 ITS initial framework Peter Maydell
2021-09-13 16:11 ` [PULL 10/23] hw/intc: GICv3 ITS register definitions added Peter Maydell
2021-09-13 16:11 ` [PULL 11/23] hw/intc: GICv3 ITS command queue framework Peter Maydell
2021-09-13 16:11 ` [PULL 12/23] hw/intc: GICv3 ITS Command processing Peter Maydell
2021-09-13 16:11 ` [PULL 13/23] hw/intc: GICv3 ITS Feature enablement Peter Maydell
2021-09-13 16:11 ` [PULL 14/23] hw/intc: GICv3 redistributor ITS processing Peter Maydell
2021-09-13 16:11 ` [PULL 15/23] tests/data/acpi/virt: Add IORT files for ITS Peter Maydell
2021-09-13 16:11 ` [PULL 16/23] hw/arm/virt: add ITS support in virt GIC Peter Maydell
2021-09-13 16:11 ` [PULL 17/23] tests/data/acpi/virt: Update IORT files for ITS Peter Maydell
2021-09-13 16:11 ` [PULL 18/23] target/arm: Take an exception if PSTATE.IL is set Peter Maydell
2021-09-13 16:11 ` [PULL 19/23] target/arm: Merge disas_a64_insn into aarch64_tr_translate_insn Peter Maydell
2021-09-13 16:11 ` [PULL 20/23] qdev: Support marking individual buses as 'full' Peter Maydell
2021-09-13 16:11 ` [PULL 21/23] hw/arm/mps2-tz.c: Add extra data parameter to MakeDevFn Peter Maydell
2021-09-13 16:11 ` [PULL 22/23] hw/arm/mps2-tz.c: Mark internal-only I2C buses as 'full' Peter Maydell
2021-09-13 16:11 ` [PULL 23/23] hw/arm/mps2.c: " 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=20210913161144.12347-8-peter.maydell@linaro.org \
--to=peter.maydell@linaro.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).