Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp879472imm; Fri, 29 Jun 2018 07:52:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdWPIdqLl4qsHknfHZHMTvT7sF8RDwjbUZzgyFvzmz5g/2cS2y2w4Ec0i6xmrB3TR5ldXGB X-Received: by 2002:a62:ccd0:: with SMTP id j77-v6mr9956944pfk.22.1530283977799; Fri, 29 Jun 2018 07:52:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530283977; cv=none; d=google.com; s=arc-20160816; b=0qNQZVCFHIY9QLc7aj0amqePWWww3O9yOEyqjDLi5Mn96ALZE/GHMg41q4cJJW5WIY b+ufA6wOa7KPjaNGh3vCPARux9CHe/BgRkaopibJPDDnZC5JZIrHDBbsU9/p9PFv7lYp uIWcEXiavnvnc8KrVpCI43frHBngXRLx/b9hp6USwsbIfEd9kJmz0PO4yV0BOPtLqCTi S63zQ0jm1rAvfrvqyqZO0vkil0mrxmjccmpWuDNBxQayKmiye8OHhmw5UJxuM/dsuox0 KCwlvXun7gOCIFhdl5Uv2Rr+sAkgA0ehTGvrSVnRrA40YB6BSNe4X0roIeL8zoyqwqON /MVw== 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:in-reply-to :mime-version:user-agent:date:message-id:cc:references:to:subject :from:arc-authentication-results; bh=fhdWeoh7bnG3irOteaW/oZNh/i3FJ1SpqhAgLj8YGo8=; b=OrrVJ306SQK9cMi1wcJUIIATAri4o1t5L/QSNlBdbRw9DkWHpMrDcssbbooSaY1sGn nSWJUNmxLRU5XvH2PYljLnhPf693fsMkF/i4v6Miv7w4ntZG4rBk5iAUwOGuC9Q/nLaf OKBcR+BH7k3xwtzRxhl4TLu3nmso/8GqIyj9os2FQ8r3fHiyIkQjJIBZnsEF/w1DqlC6 twm7BzepYkpXkjbUV7YH69/ehDBL6BbKpZxtpZQr7PCnQOtOdg87H8bqAX8lxJVl/0z9 7POJf+77DUhJd7gYZzl3PbDEjpDn4w4SmBYjrvVWI3FQhf++yNc75jKPN+4Y8i3lFzsX 7gTg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9-v6si9632997pfg.323.2018.06.29.07.52.43; Fri, 29 Jun 2018 07:52:57 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936401AbeF2Oum (ORCPT + 99 others); Fri, 29 Jun 2018 10:50:42 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:32816 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932254AbeF2Ouk (ORCPT ); Fri, 29 Jun 2018 10:50:40 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1832F81A8B7E; Fri, 29 Jun 2018 14:50:40 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-106.ams2.redhat.com [10.36.117.106]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 982982026D68; Fri, 29 Jun 2018 14:50:37 +0000 (UTC) From: Auger Eric Subject: Re: [PATCH v3 03/20] arm64: Add a helper for PARange to physical shift conversion To: Suzuki K Poulose , linux-arm-kernel@lists.infradead.org References: <1530270944-11351-1-git-send-email-suzuki.poulose@arm.com> <1530270944-11351-4-git-send-email-suzuki.poulose@arm.com> Cc: cdall@kernel.org, kvm@vger.kernel.org, marc.zyngier@arm.com, catalin.marinas@arm.com, punit.agrawal@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, julien.grall@arm.com, james.morse@arm.com, kvmarm@lists.cs.columbia.edu Message-ID: <163cca54-3e0d-750d-a203-c97b2e3f2f29@redhat.com> Date: Fri, 29 Jun 2018 16:50:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1530270944-11351-4-git-send-email-suzuki.poulose@arm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 29 Jun 2018 14:50:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 29 Jun 2018 14:50:40 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eric.auger@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Suzuki, On 06/29/2018 01:15 PM, Suzuki K Poulose wrote: > On arm64, ID_AA64MMFR0_EL1.PARange encodes the maximum Physical > Address range supported by the CPU. Add a helper to decode this > to actual physical shift. If we hit an unallocated value, return > the maximum range supported by the kernel. > This is will be used by the KVM to set the VTCR_EL2.T0SZ, as it s/is// and s/the KVM/KVM > is about to move its place. Having this helper keeps the code > movement cleaner. > > Cc: Catalin Marinas > Cc: Marc Zyngier > Cc: James Morse > Cc: Christoffer Dall > Signed-off-by: Suzuki K Poulose > --- > Changes since V2: > - Split the patch > - Limit the physical shift only for values unrecognized. > --- > arch/arm64/include/asm/cpufeature.h | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h > index 1717ba1..855cf0e 100644 > --- a/arch/arm64/include/asm/cpufeature.h > +++ b/arch/arm64/include/asm/cpufeature.h > @@ -530,6 +530,19 @@ void arm64_set_ssbd_mitigation(bool state); > static inline void arm64_set_ssbd_mitigation(bool state) {} > #endif > > +static inline u32 id_aa64mmfr0_parange_to_phys_shift(int parange) > +{ > + switch (parange) { > + case 0: return 32; > + case 1: return 36; > + case 2: return 40; > + case 3: return 42; > + case 4: return 44; > + case 5: return 48; > + case 6: return 52; > + default: return CONFIG_ARM64_PA_BITS; > + } > +} > #endif /* __ASSEMBLY__ */ > > #endif > Reviewed-by: Eric Auger Thanks Eric