Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp956493imm; Wed, 4 Jul 2018 08:51:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpelklgS/alIMSqTwvbfAgc4tHhgD7/pXOjpEYKW8UbGc7igSHAWDT0ET2QAVzEARvjQ+sdR X-Received: by 2002:a17:902:2924:: with SMTP id g33-v6mr2707579plb.26.1530719479372; Wed, 04 Jul 2018 08:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530719479; cv=none; d=google.com; s=arc-20160816; b=Fkk2e0Pe0POGFXQ+dSL/0NRPvpdZ7scAzxrB7D6c+ePCbqWF9TKT0RAHmecnBhtp1J 1WId0CLUWQfXPKYan8+SQzL/EgZvTUne7poAKoDHExawJE8eqfcMo1KNzlwCEFWcaIkv 8KvMIH9ec3pnXN7Kp3xnwjftQVFDXbGDmQHO3iN6lax7IaETbD7V3a4DnD7y3NeZDi4q +ZkCFL7CEydcdqG9LBTIsm7ZIVFjylyxGXpkts9bbpOOtcVqZyITzS7cbHhlExKoOEUI HDI5hxjBCwi8MPCFAWgcy1Eu3bPkNAr3FWzgSYeUWQ1UZ5ieTAoB8zPiT7DoQuyl2ORl zHmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=ruM7bWkkHQJFssQ6Aq15dmjtOOXeCdWqWcFN1cfBYts=; b=IDYOixfpGVLaYoHdXz2WSL56czaJxf7UPk+DE3dtUHjpjwnDjBifPDddk90+yrW3JD 6uyjI1Qyoo1XJkxo5IjHRWdDecPBmd2G0bGnuvC95sB4r/dGDBLBhjhPNLYiMINZMfq/ ScQQ/EyCBt48VyjAYQA/9+NCjst+9/f7GDFpZX58oworNFh9Lj9to+SVxHUG9FjHlt4d JDxSN33Cnk4I77lLw+0LqV6UyZNVOmkNBoTgUNY9vr2Yw/wo4tTq/I+c/WLuxUbqaQIe yExbOXHZk1KAs0QFYJeaBKADZH7GfKF/v/+69gAB1ljaTU2q4Nq45xJtvTvwfHaFQ7B2 oElA== 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 y186-v6si3613192pgb.395.2018.07.04.08.51.04; Wed, 04 Jul 2018 08:51:19 -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 S1752635AbeGDPu0 (ORCPT + 99 others); Wed, 4 Jul 2018 11:50:26 -0400 Received: from foss.arm.com ([217.140.101.70]:39660 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752158AbeGDPuZ (ORCPT ); Wed, 4 Jul 2018 11:50:25 -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 B1B657A9; Wed, 4 Jul 2018 08:50:24 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 823233F5AD; Wed, 4 Jul 2018 08:50:24 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 7B6091AE189D; Wed, 4 Jul 2018 16:51:04 +0100 (BST) Date: Wed, 4 Jul 2018 16:51:04 +0100 From: Will Deacon To: Suzuki K Poulose Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, james.morse@arm.com, marc.zyngier@arm.com, cdall@kernel.org, eric.auger@redhat.com, julien.grall@arm.com, catalin.marinas@arm.com, punit.agrawal@arm.com, qemu-devel@nongnu.org, Peter Maydel , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH v3 15/20] kvm: arm/arm64: Allow tuning the physical address size for VM Message-ID: <20180704155104.GN4828@arm.com> References: <1530270944-11351-1-git-send-email-suzuki.poulose@arm.com> <1530270944-11351-16-git-send-email-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1530270944-11351-16-git-send-email-suzuki.poulose@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Suzuki, On Fri, Jun 29, 2018 at 12:15:35PM +0100, Suzuki K Poulose wrote: > Allow specifying the physical address size for a new VM via > the kvm_type argument for KVM_CREATE_VM ioctl. This allows > us to finalise the stage2 page table format as early as possible > and hence perform the right checks on the memory slots without > complication. The size is encoded as Log2(PA_Size) in the bits[7:0] > of the type field and can encode more information in the future if > required. The IPA size is still capped at 40bits. > > Cc: Marc Zyngier > Cc: Christoffer Dall > Cc: Peter Maydel > Cc: Paolo Bonzini > Cc: Radim Krčmář > Signed-off-by: Suzuki K Poulose > --- > arch/arm/include/asm/kvm_mmu.h | 2 ++ > arch/arm64/include/asm/kvm_arm.h | 10 +++------- > arch/arm64/include/asm/kvm_mmu.h | 2 ++ > include/uapi/linux/kvm.h | 10 ++++++++++ > virt/kvm/arm/arm.c | 24 ++++++++++++++++++++++-- > 5 files changed, 39 insertions(+), 9 deletions(-) [...] > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h > index 4df9bb6..fa4cab0 100644 > --- a/include/uapi/linux/kvm.h > +++ b/include/uapi/linux/kvm.h > @@ -751,6 +751,16 @@ struct kvm_ppc_resize_hpt { > #define KVM_S390_SIE_PAGE_OFFSET 1 > > /* > + * On arm/arm64, machine type can be used to request the physical > + * address size for the VM. Bits [7-0] have been reserved for the > + * PA size shift (i.e, log2(PA_Size)). For backward compatibility, > + * value 0 implies the default IPA size, which is 40bits. > + */ > +#define KVM_VM_TYPE_ARM_PHYS_SHIFT_MASK 0xff > +#define KVM_VM_TYPE_ARM_PHYS_SHIFT(x) \ > + ((x) & KVM_VM_TYPE_ARM_PHYS_SHIFT_MASK) This seems like you're allocating quite a lot of bits in a non-extensible interface to a fairly esoteric parameter. Would it be better to add another ioctl, or condense the number of sizes you support instead? Will