Received: by 10.192.165.156 with SMTP id m28csp721794imm; Fri, 13 Apr 2018 06:47:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx490FmRsx5VwzHYbTfX6JgOs27hBKsHxHBoO6fDmX/zhTbt0OgfSfwRJGv8lOWHZOpjeKieP X-Received: by 10.99.103.67 with SMTP id b64mr4280645pgc.14.1523627240547; Fri, 13 Apr 2018 06:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523627240; cv=none; d=google.com; s=arc-20160816; b=h534TtcFT8RBmESrCYz8iHPoYcdToDM0VWOn7jdXQOwMpyhdV6rIMech19j9bXWlT8 t1ms5nqBZ6bQeFv5CCVYZkN2JdPuq6Da3L3LHk6x1vFKDhDgGD0fh7tbXuOIu81aV0/g I71A0MslSlJ7rBUAuGpqLlKi5X62DRjetEb+ALgppabcsrXzvhlYPyYBVPKbFqC3ihG+ +YK+U7FkILO8m7zPvod4Xn1PPQCBThsn6bNHWwSXPb0saVZVuc37HedmhZJzfSv7JTHh eA8g34+jbA1khIMI8upCcy29/gVBtB1m3uRiBxWr0L5WCoBFMwpwcOeDoB3vZLZlhHrz 2ogw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=oqXwXYSOXUhvCGUoVo3tCJ9ObKpXpvlAmFeZ1whs1j8=; b=sQ/Tox2aq+lEidTqHR+9f/GA4u18W2NCbelEDafEGcYMLqqILVxuzdQJVxKxwiw/E/ 8DqBBmtkkFxTUPS/KhcMoOnSSnMTpw0dQW1OabgOu3LkVO9EkSMV0OH9zgKgcYwd1lro HGEchUo+2ciHuVBL++yLhYRFNdb2v9w+VcZOzqBlwd8xLilOjPfNDA8gyr0yP7Q0PtLP 4gg1ULRdsxz8DAwbl3Xue0eCRr6evBuWgUNEDAwU203zsU7o4LHSi+St/hmMmPjigLl8 rz7Tdf0wJs/B/tFFB2buvfVYsw4Ik4y3hDIzdErkvZ8SJ8d7WQo5SUrbBuCBiBAwOZYJ 6PaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JH+9R6xh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u3-v6si5641399plb.593.2018.04.13.06.47.06; Fri, 13 Apr 2018 06:47:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JH+9R6xh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754297AbeDMNWL (ORCPT + 99 others); Fri, 13 Apr 2018 09:22:11 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:42622 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754091AbeDMNWJ (ORCPT ); Fri, 13 Apr 2018 09:22:09 -0400 Received: by mail-oi0-f68.google.com with SMTP id l190-v6so8334781oig.9 for ; Fri, 13 Apr 2018 06:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=oqXwXYSOXUhvCGUoVo3tCJ9ObKpXpvlAmFeZ1whs1j8=; b=JH+9R6xhytPlV++G84UR6apka6RKcyFlAvFb3poqUtzHjeV8yEPyPZfdCTa7GOcFFM YVKoAAnq1ZzE1ZKqNo3s0jcliQ435+qSZN76efvUY0WYFvcsQqiNGhlZ8cHTrSCmDAV+ 0oivJBqtb960ehBZatS0DHFFnyu7QHP7KZUDE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=oqXwXYSOXUhvCGUoVo3tCJ9ObKpXpvlAmFeZ1whs1j8=; b=mj19trOlSV3ixwCXHRBqdTGrEvHEJa7pNa2lPfbLTwfmiBtfYnDp0H+uvn8QUMrw/2 D99fK34A8PU4rSZYcmcGIq3ZU62s4e61/f6hBTY/q4FFhIZt/WGDYJnoFNHTkoaieAql RzhyuGZF+/8kvor1Zut1/tJO8pKHPqBqRVk4S5yzJJHbZf5hghU7oZk8FYC2eksRlu/L 0l8uMRYy4IcnuevWpuyaV9vpyFAzwDRcODXQVX3C/5INW2Y7a7Zqr5ennxL+CAEGXdfh B6qQMFDh2FX7kquoykQKaUAqXfp1j+D3fLNFzT+UANZiagkcVbkU5B1l5ooX+EawocgW AUjw== X-Gm-Message-State: ALQs6tBhlJs51g23Deypon7AihGG35cY2YSg4eyGfLwtAGbW/CorRqHY EV5jBT9eFz3+/2SM7iz2Z3cImrgCTOprDjGj/1YoCQ== X-Received: by 2002:aca:d455:: with SMTP id l82-v6mr8848616oig.102.1523625729017; Fri, 13 Apr 2018 06:22:09 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:2286:0:0:0:0:0 with HTTP; Fri, 13 Apr 2018 06:21:48 -0700 (PDT) In-Reply-To: <1522156531-28348-13-git-send-email-suzuki.poulose@arm.com> References: <1522156531-28348-1-git-send-email-suzuki.poulose@arm.com> <1522156531-28348-13-git-send-email-suzuki.poulose@arm.com> From: Peter Maydell Date: Fri, 13 Apr 2018 14:21:48 +0100 Message-ID: Subject: Re: [PATCH v2 12/17] kvm: arm/arm64: Expose supported physical address limit for VM To: Suzuki K Poulose Cc: arm-mail-list , lkml - Kernel Mailing List , kvmarm@lists.cs.columbia.edu, kvm-devel , Christoffer Dall , Marc Zyngier , Punit Agrawal , Will Deacon , Catalin Marinas , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Ard Biesheuvel , Kristina Martsenko , Mark Rutland Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27 March 2018 at 14:15, Suzuki K Poulose wrote: > Expose the maximum physical address size supported by the host > for a VM. This could be later used by the userspace to choose the > appropriate size for a given VM. The limit is determined as the > minimum of actual CPU limit, the kernel limit (i.e, either 48 or 52) > and the stage2 page table support limit (which is 40bits at the moment). > For backward compatibility, we support a minimum of 40bits. The limit > will be lifted as we add support for the stage2 to support the host > kernel PA limit. > > This value may be different from what is exposed to the VM via > CPU ID registers. The limit only applies to the stage2 page table. > > Cc: Christoffer Dall > Cc: Marc Zyngier > Cc: Peter Maydel > Signed-off-by: Suzuki K Poulose > --- > Documentation/virtual/kvm/api.txt | 14 ++++++++++++++ > arch/arm/include/asm/kvm_mmu.h | 5 +++++ > arch/arm64/include/asm/kvm_mmu.h | 5 +++++ > include/uapi/linux/kvm.h | 6 ++++++ > virt/kvm/arm/arm.c | 6 ++++++ > 5 files changed, 36 insertions(+) > > diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt > index 792fa87..55908a8 100644 > --- a/Documentation/virtual/kvm/api.txt > +++ b/Documentation/virtual/kvm/api.txt > @@ -3500,6 +3500,20 @@ Returns: 0 on success; -1 on error > This ioctl can be used to unregister the guest memory region registered > with KVM_MEMORY_ENCRYPT_REG_REGION ioctl above. > > +4.113 KVM_ARM_GET_MAX_VM_PHYS_SHIFT > +Capability: basic > +Architectures: arm, arm64 > +Type: system ioctl > +Parameters: none > +Returns: log2(Maximum physical address space size) supported by the > +hyperviosr. typo: "hypervisor". > + > +This ioctl can be used to identify the maximum physical address space size > +supported by the hypervisor. Is that the physical address space on the host, or the physical address space size we present to the guest? > The returned value indicates the maximum size > +of the address that can be resolved by the stage2 translation table on > +arm/arm64. On arm64, the value is decided based on the host kernel > +configuration and the system wide safe value of ID_AA64MMFR0_EL1:PARange. > +This may not match the value exposed to the VM in CPU ID registers. Isn't it likely to confuse the guest if we lie to it about the PA range it sees? When would the two values differ? Do we also need a 'set' operation, so userspace can create a VM that has a 40 bit userspace on a CPU that supports more than that, or does it just work? What's the x86 API for KVM to tell userspace about physical address range restrictions? thanks -- PMM