[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [kvmtool test PATCH 24/24] kvmtool: arm: Add support fo

From: Suzuki K Poulose
Subject: Re: [Qemu-devel] [kvmtool test PATCH 24/24] kvmtool: arm: Add support for creating VM with PA size
Date: Wed, 4 Jul 2018 16:58:12 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

Hi Will,

On 07/04/2018 03:22 PM, Will Deacon wrote:
On Fri, Jun 29, 2018 at 12:15:44PM +0100, Suzuki K Poulose wrote:
diff --git a/arm/kvm.c b/arm/kvm.c
index 5701d41..b1969be 100644
--- a/arm/kvm.c
+++ b/arm/kvm.c
@@ -11,6 +11,8 @@
  #include <linux/kvm.h>
  #include <linux/sizes.h>
+unsigned long kvm_arm_type;
  struct kvm_ext kvm_req_ext[] = {
@@ -18,6 +20,26 @@ struct kvm_ext kvm_req_ext[] = {
        { 0, 0 },
+#define KVM_ARM_GET_MAX_VM_PHYS_SHIFT          _IO(KVMIO, 0x0b)
+void kvm__arch_init_hyp(struct kvm *kvm)
+       int max_ipa;
+       max_ipa = ioctl(kvm->sys_fd, KVM_ARM_GET_MAX_VM_PHYS_SHIFT);
+       if (max_ipa < 0)
+               max_ipa = 40;
+       if (!kvm->cfg.arch.phys_shift)
+               kvm->cfg.arch.phys_shift = 40;
+       if (kvm->cfg.arch.phys_shift > max_ipa)
+               die("Requested PA size (%u) is not supported by the host 
+                   kvm->cfg.arch.phys_shift, max_ipa);
+       if (kvm->cfg.arch.phys_shift != 40)
+               kvm_arm_type = kvm->cfg.arch.phys_shift;

Seems a bit weird that the "machine type identifier" to KVM_CREATE_VM is
dedicated entirely to holding the physical address shift verbatim. Is this
really the ABI?

The bits[7:0] of the machine type has been reserved for the IPA shift.
This version is missing the updates to the ABI documentation, I have it
for the next version.

Also, couldn't KVM figure it out automatically if you add memslots at high
addresses, making this a niche tunable outside of testing?

The stage2 pgd size is really dependent on the max IPA. Also, unlike the stage1 (where the maximum size will be 1 page), the size can go upto 16
pages (and different number of levels due to concatenation), so we need
to finalize this at least before the first memory gets mapped (RAM or Device). That implies, we cannot wait until all the memory slots are

The first version of the series added a separate ioctl for specifying
the limit, which had its own complexities. So, this ABI was suggested
to keep things simpler.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]