From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F718C433E7 for ; Thu, 3 Sep 2020 05:11:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4842020665 for ; Thu, 3 Sep 2020 05:11:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JtxKo17C"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fwGJonlf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4842020665 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:Reply-To:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=P6DSn26wqKAA7k9h0rYZ41nxxKBzz4p2lkcjhitjQEA=; b=JtxKo17Cmwm9Pf G+cVmXJtovwJ6KGjShP8nXir9L25z85T8jtPPmeEM1SEN3btVUR2nfYRqYe7Ra8ZY4i4IzwKc1yz0 jTE0/UhGw2YWqeeJ+GjqlZitQVUf71t+BTE0lry8xl/guBw1DSWkCm90R/es7r9DL3co9GrrSYYnF RcpZbXNdNoCY2bWTIYZdFfwVC/D2l2v2fmrCxVCzKaAa5e13E2TMsrzt/jtKKYDGmzaflWZ/ZpymT xMa+wmoVAfXfSG/a59ib6uTjKqsv7jLpXqKNRw/G2hoakOtaqFV+oRfO86iQ8T+1nqWQbu67BkRKt 5gi2azXlCHNeYcJfGcig==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDhVa-0007HU-Fu; Thu, 03 Sep 2020 05:10:02 +0000 Received: from us-smtp-2.mimecast.com ([207.211.31.81] helo=us-smtp-delivery-1.mimecast.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDhVX-0007Gv-H3 for linux-arm-kernel@lists.infradead.org; Thu, 03 Sep 2020 05:10:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599109798; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EijqDN/r5sSiZpHtNIn2jyZiuE6aC7OPRYlm92JjbJ8=; b=fwGJonlf5Zbe0gzh7/EHujLABRqlOVS5ROYicvWZ3FLm7jNiLdoL64kEFZJ0KXExq816nh lxvzOddMShixmu1Fctk8r7tPOmQdBp3PZpwSKwFqkpDd8x2JNexbVACWwepDDCaotPclOX tHBS17Xg5N1q5AhUKUrbtaCBeJ833nA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-51-D2lPaIvUNnCWupM6cKVaTw-1; Thu, 03 Sep 2020 01:09:56 -0400 X-MC-Unique: D2lPaIvUNnCWupM6cKVaTw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 554A110ABDB1; Thu, 3 Sep 2020 05:09:55 +0000 (UTC) Received: from [10.64.54.159] (vpn2-54-159.bne.redhat.com [10.64.54.159]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B0D8196F3; Thu, 3 Sep 2020 05:09:52 +0000 (UTC) Subject: Re: [PATCH v3 21/21] KVM: arm64: Don't constrain maximum IPA size based on host configuration To: Will Deacon , kvmarm@lists.cs.columbia.edu References: <20200825093953.26493-1-will@kernel.org> <20200825093953.26493-22-will@kernel.org> From: Gavin Shan Message-ID: <492420d8-91d7-a258-cf8a-17da29719d86@redhat.com> Date: Thu, 3 Sep 2020 15:09:50 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20200825093953.26493-22-will@kernel.org> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=gshan@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200903_010959_614312_FE352EE7 X-CRM114-Status: GOOD ( 22.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Gavin Shan Cc: Suzuki Poulose , Marc Zyngier , Quentin Perret , James Morse , Catalin Marinas , kernel-team@android.com, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Will, On 8/25/20 7:39 PM, Will Deacon wrote: > Now that the guest stage-2 page-tables are managed independently from > the host stage-1 page-tables, we can avoid constraining the IPA size > based on the host and instead limit it only based on the PARange field > of the ID_AA64MMFR0 register. > > Cc: Marc Zyngier > Cc: Quentin Perret > Signed-off-by: Will Deacon > --- > arch/arm64/kvm/reset.c | 38 +++++--------------------------------- > 1 file changed, 5 insertions(+), 33 deletions(-) > Reviewed-by: Gavin Shan > diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c > index ee33875c5c2a..471ee9234e40 100644 > --- a/arch/arm64/kvm/reset.c > +++ b/arch/arm64/kvm/reset.c > @@ -339,7 +339,7 @@ u32 get_kvm_ipa_limit(void) > > int kvm_set_ipa_limit(void) > { > - unsigned int ipa_max, pa_max, va_max, parange, tgran_2; > + unsigned int parange, tgran_2; > u64 mmfr0; > > mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); > @@ -376,38 +376,10 @@ int kvm_set_ipa_limit(void) > break; > } > > - pa_max = id_aa64mmfr0_parange_to_phys_shift(parange); > - > - /* Clamp the IPA limit to the PA size supported by the kernel */ > - ipa_max = (pa_max > PHYS_MASK_SHIFT) ? PHYS_MASK_SHIFT : pa_max; > - /* > - * Since our stage2 table is dependent on the stage1 page table code, > - * we must always honor the following condition: > - * > - * Number of levels in Stage1 >= Number of levels in Stage2. > - * > - * So clamp the ipa limit further down to limit the number of levels. > - * Since we can concatenate upto 16 tables at entry level, we could > - * go upto 4bits above the maximum VA addressable with the current > - * number of levels. > - */ > - va_max = PGDIR_SHIFT + PAGE_SHIFT - 3; > - va_max += 4; > - > - if (va_max < ipa_max) > - ipa_max = va_max; > - > - /* > - * If the final limit is lower than the real physical address > - * limit of the CPUs, report the reason. > - */ > - if (ipa_max < pa_max) > - pr_info("kvm: Limiting the IPA size due to kernel %s Address limit\n", > - (va_max < pa_max) ? "Virtual" : "Physical"); > - > - WARN(ipa_max < KVM_PHYS_SHIFT, > - "KVM IPA limit (%d bit) is smaller than default size\n", ipa_max); > - kvm_ipa_limit = ipa_max; > + kvm_ipa_limit = id_aa64mmfr0_parange_to_phys_shift(parange); > + WARN(kvm_ipa_limit < KVM_PHYS_SHIFT, > + "KVM IPA limit (%d bit) is smaller than default size\n", > + kvm_ipa_limit); > kvm_info("IPA Size Limit: %dbits\n", kvm_ipa_limit); > > return 0; > Thanks, Gavin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel