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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76268C4332F for ; Thu, 15 Dec 2022 00:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nZGxd1EDCbJKGuKfHpTqcORpDLxHLoN33UJIWxQOXB8=; b=UQ0cMBZBD8/QHN hkmDW5TkgKsIPbnEdt6U7k74uWket+HOpRVXOT9iIdTsl11ZumbgikYZ6QZf0LTMzFcRBMU0dQOBc RxIojdP/y9tHZCpB27WYc8xnTSrtTiLTFJ1bdnHGS38/QVRMdlqP/qFOKG0GWGBRMpcQancANEu3S WnAg1T3tRjyEzIni7zV+SAQKDKjd2APLIs9G8xXxxtDlt8tQ8x8cxLnvfyxUurSAik884SF20BCJM TbH4x72NWiIV6ptVSOXE7o2RFZj4OmkvOxObOGeIAd1wm9En0yitkf4ITujnY0HrMjFjz4JP5ccrI UCPrqfRUXFx2SJFL4G+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5cUL-005HEx-3x; Thu, 15 Dec 2022 00:52:41 +0000 Received: from out-145.mta0.migadu.com ([91.218.175.145]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p5cUG-005HCM-T5 for linux-arm-kernel@lists.infradead.org; Thu, 15 Dec 2022 00:52:38 +0000 Date: Thu, 15 Dec 2022 00:52:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1671065553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=W56Kw0JALwEcXuHS6+Lvrx1mQ8hK6mGSL4QamS06KBI=; b=XlqYWeEgw5SD53yZCSMnRc5PdeWN0d7GuYwAzWMEJaDY1z0I3BzxttXqK7ghburrQoYg67 9rA3CH98a8HulGNjwwGrcP9yz1rHSEwwfYbRlHpYkYU0aT9eYSR6GCeQLtwKAB5arPpOJe fODfp8S1BmKABIT9TolQ4zY07bls6qo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Ryan Roberts Cc: Marc Zyngier , Catalin Marinas , Will Deacon , Ard Biesheuvel , Suzuki K Poulose , Anshuman Khandual , James Morse , Alexandru Elisei , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu Subject: Re: [PATCH v1 00/12] KVM: arm64: Support FEAT_LPA2 at hyp s1 and vm s2 Message-ID: References: <20221206135930.3277585-1-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221206135930.3277585-1-ryan.roberts@arm.com> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221214_165237_374831_6315E5F4 X-CRM114-Status: GOOD ( 28.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Dec 06, 2022 at 01:59:18PM +0000, Ryan Roberts wrote: > (appologies, I'm resending this series as I managed to send the cover letter to > all but the following patches only to myself on first attempt). > > This is my first upstream feature submission so please go easy ;-) Welcome :) > Support 52-bit Output Addresses: FEAT_LPA2 changes the format of the PTEs. The > HW advertises support for LPA2 independently for stage 1 and stage 2, and > therefore its possible to have it for one and not the other. I've assumed that > there is a valid case for this if stage 1 is not supported but stage 2 is, KVM > could still then use LPA2 at stage 2 to create a 52 bit IPA space (which could > then be consumed by a 64KB page guest kernel with the help of FEAT_LPA). Because > of this independence and the fact that the kvm pgtable library is used for both > stage 1 and stage 2 tables, this means the library now has to remember the > in-use format on a per-page-table basis. To do this, I had to rework some > functions to take a `struct kvm_pgtable *` parameter, and as a result, there is > a noisy patch to add this parameter. Mismatch between the translation stages is an interesting problem... Given that userspace is responsible for setting up the IPA space, I can't really think of a strong use case for 52 bit IPAs with a 48 bit VA. Sure, the VMM could construct a sparse IPA space or remap the same HVA at multiple IPAs to artificially saturate the address space, but neither seems terribly compelling. Nonetheless, AFAICT we already allow this sort of mismatch on LPA && !LVA systems. A 48 bit userspace could construct a 52 bit IPA space for its guest. Marc, is there any real reason for this or is it just a byproduct of how LPA support was added to KVM? > Support 52-bit Input Addresses: The main difficulty here is that at stage 1 for > 4KB pages, 52-bit IA requires a extra level of lookup, and that level is called > '-1'. (Although stage 2 can use concatenated pages at the first level, and > therefore still only uses 4 levels, the kvm pgtable library deals with both > stage 1 and stage 2 tables). So there is another noisy patch to convert all > level variables to signed. > > This is all tested on the FVP, using a test harness I put together, which does a > host + guest boot test for 180 configurations, built from all the (valid) > combinations of various FVP, host kernel and guest kernel parameters: > > - hw_pa: [48, lpa, lpa2] > - hw_va: [48, 52] > - kvm_mode: [vhe, nvhe, protected] > - host_page_size: [4KB, 16KB, 64KB] > - host_pa: [48, 52] > - host_va: [48, 52] > - host_load_addr: [low, high] > - guest_page_size: [64KB] > - guest_pa: [52] > - guest_va: [52] > - guest_load_addr: [low, high] Wow, what a matrix! In a later revision of this series it might be good to add support for LPA2 guests in KVM selftests. We currently constrain the IPA size to 48bits on !64K kernels. I'll have a deeper look at this series in the coming days. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel