Received: by 10.213.65.68 with SMTP id h4csp1584846imn; Thu, 15 Mar 2018 04:07:26 -0700 (PDT) X-Google-Smtp-Source: AG47ELtscbnN5/NL0Xyn29XqHWXbPXCOrQqe/p5e+kclkoZUIlEJ5DcZ1jPTWvx13wfPjivBb7PC X-Received: by 10.99.66.65 with SMTP id p62mr6356077pga.378.1521112046358; Thu, 15 Mar 2018 04:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521112046; cv=none; d=google.com; s=arc-20160816; b=Au5Y2LTkGmy0NvXTROz5UNicUS9uMFrIulenePWuYLtvyzpvl/Genpp+FC6PYHeUvf Ca+VXME3j8AyVT+SSclifFUDHrZhX+bskQJA5052KN9chmzVv6OY4pWntYfXgVyW0KTi 4U+eygAlo/6pRRxXfu6EoJ54zVfwknHhevzNBMSfrngudVC5A1n6onjR6reLk/UnNRqY 1NK+WR2g809zIRz9XgCdVKZuh9X0h0KBoKkeE7r2dw3S/krJJXfuoJePm1sxxRW0Oxlp gHH8SG7h4DExJsix2Or7Pk07XIuqANbjTN1vXKU4RkNSWmAEf+vIYX2Rx1mqX5AL5Elq exBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=ea8gwEtZQQf82MLBiJ8hdQhxBD5bVezdQpsR2dAHDz8=; b=IU3YwxMs9kqSjZ3QdfegJXV4LE79oOVIrmnyON8m7Sp2avaaihRivb5IDJkuYp9I8O UTP7DiQ0MNyY6mzZqw1QvOg0gmwZlVenTjC6p5eEbK4LVC6sPjyXSHHA+VaS2+VqHnLj Ue9TrbHzXI7yJby7H/yMPkLVK5ifXsXgfs6wrHzbtZVILTp3605waCTc1L6MPtLTO6t0 yIcKCONCOKGjY32nEnjiN2qkMrPnWAistDPwV/wL2K5axfmTs9D3llj5CxfQ0ZBuy97P PNe0eRhRjX3Juo7xfn52H89EYrunDq0Insln8xhEIffG1F7hunCJlkLqX3bbYfkTchYx 3QGQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y16-v6si1820975plr.174.2018.03.15.04.07.11; Thu, 15 Mar 2018 04:07:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751999AbeCOLGP (ORCPT + 99 others); Thu, 15 Mar 2018 07:06:15 -0400 Received: from foss.arm.com ([217.140.101.70]:37022 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751600AbeCOLGO (ORCPT ); Thu, 15 Mar 2018 07:06:14 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E43F480D; Thu, 15 Mar 2018 04:06:13 -0700 (PDT) Received: from [10.1.206.73] (en101.cambridge.arm.com [10.1.206.73]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 858BB3F25D; Thu, 15 Mar 2018 04:06:11 -0700 (PDT) Subject: Re: [PATCH v1 15/16] kvm: arm64: Allow configuring physical address space size To: Christoffer Dall Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, marc.zyngier@arm.com, linux-kernel@vger.kernel.org, kristina.martsenko@arm.com, peter.maydell@linaro.org, pbonzini@redhat.com, rkrcmar@redhat.com, will.deacon@arm.com, ard.biesheuvel@linaro.org, mark.rutland@arm.com, catalin.marinas@arm.com, Christoffer Dall References: <20180109190414.4017-1-suzuki.poulose@arm.com> <20180109190414.4017-16-suzuki.poulose@arm.com> <20180208111414.GM29286@cbox> <31e5bf40-4fcb-934e-6036-ff2670f793df@arm.com> <20180209081606.GC7339@cbox> From: Suzuki K Poulose Message-ID: Date: Thu, 15 Mar 2018 11:06:09 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180209081606.GC7339@cbox> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/02/18 08:16, Christoffer Dall wrote: > On Thu, Feb 08, 2018 at 05:53:17PM +0000, Suzuki K Poulose wrote: >> On 08/02/18 11:14, Christoffer Dall wrote: >>> On Tue, Jan 09, 2018 at 07:04:10PM +0000, Suzuki K Poulose wrote: >>>> Allow the guests to choose a larger physical address space size. >>>> The default and minimum size is 40bits. A guest can change this >>>> right after the VM creation, but before the stage2 entry page >>>> tables are allocated (i.e, before it registers a memory range >>>> or maps a device address). The size is restricted to the maximum >>>> supported by the host. Also, the guest can only increase the PA size, >>> >from the existing value, as reducing it could break the devices which >>>> may have verified their physical address for validity and may do a >>>> lazy mapping(e.g, VGIC). >>>> >>>> Cc: Marc Zyngier >>>> Cc: Christoffer Dall >>>> Cc: Peter Maydell >>>> Signed-off-by: Suzuki K Poulose >>>> + >>>> +4.109 KVM_ARM_SET_PHYS_SHIFT >>>> + >>>> +Capability: KVM_CAP_ARM_CONFIG_PHYS_SHIFT >>>> +Architectures: arm64 >>>> +Type: vm ioctl >>>> +Parameters: __u32 (in) >>>> +Returns: 0 on success, a negative value on error >>>> + >>>> +This ioctl is used to set the maximum physical address size for >>>> +the VM. The value is Log2(Maximum_Physical_Address). The value can only >>>> +be increased from the existing setting. The value cannot be changed >>>> +after the stage-2 page tables are allocated and will return an error. >>>> + >>> >>> Is there a way for userspace to discover what the underlying hardware >>> can actually support, beyond trial-and-error on this ioctl? >> >> Unfortunately, there is none. We don't expose ID_AA64MMFR0 via mrs emulation. >> > > We should probably think about that. Perhaps it could be tied to the > return value of KVM_CAP_ARM_CONFIG_PHYS_SHIFT ? See below. >>> >>> Have you considered making this capability a generic capability and >>> encoding this in the 'type' argument to KVM_CREATE_VM? This would >>> significantly simplify all the above and would allow you to drop patch 8 >>> and 9 I think. >>>> No. I will take a look. We could add a KVM dev capability hooked to the kvm_arch_dev_ioctl() for ARM to give out the maximum supported physical shift. And then the user could request the physical shift via the type argument (of course, encoded to allow future uses) to KVM_CREATE_VM. Cheers Suzuki