Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3387536pxf; Mon, 22 Mar 2021 05:22:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoB2PDWrhI7p4H6BjbC9G+O5QS/BtGekpGDJbUA1xEMISx9gbJKNBVyUq1ucjNRH2dN4Jm X-Received: by 2002:a17:906:7d48:: with SMTP id l8mr18773849ejp.108.1616415772448; Mon, 22 Mar 2021 05:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616415772; cv=none; d=google.com; s=arc-20160816; b=MX+/eWGyI7FQfT4Zerp8LYSxkjw1rStbuUx1BglITHcooImlEhMsMwKDnr81YZdqF3 lc0e/PN6uLhFC4dhvOD6Y1lnIp57qKALnGnUHRQMMS1gEK9d/nH+DZKYRmuNBdW0EmsG Qhs+zDhYz2ZMN7nWhmu68gRf3AyVexLhmMCYU++sjC4zPApXZ4zxcmRggebd5PuO46wU HjQJbUPzydLtszkZ9PVbqEzS0LwrKiWafdgRg1ovSVs+W2jmZaO4jd2vaWW5VQWVTg+U 8NFeLYB8uI5+UIxC5pITguZz0kA3ssjDNG6hq//SfitIGIapvTFCoi+Z4CnmhctB2B39 V2Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=BN2kv66+tGPsbVhM5iG5uZu1ambeMwXsKmypA6FAuz4=; b=Hk6zSrzJipsP6AlEtSce+59GiDbZn+kO7BvgrH13+sw/MgwG9CI2Ju/HL7K4dRAngN ge6trtrK1ix3LY0BF6KWTJyVBwVy3Y6xW3Y/icX1cxncgPQNEHGKfbcf5w3mxNovbfdm wQloJvRm/nGUMqUt12ngBrRnKNBDJX8eqxK6snpXIZKN4h3ffpaKovTh6WHVBF+SPfEA n7rdluslwK2BO23I+p+RcaA+JNSYRsB05TQzWfRC6unC2bbmFi+mnqBFdqag4CUbRK+G 3kTfJhqnrTFOQI7qtqo3eUiBr6QZiM9BcsIC0Dqq2JuXuINwkE2Qi/il6151Mws4aWKs 2NDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VfH7sTai; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si11481963ejv.689.2021.03.22.05.22.29; Mon, 22 Mar 2021 05:22:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VfH7sTai; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230012AbhCVMUS (ORCPT + 99 others); Mon, 22 Mar 2021 08:20:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:49942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230181AbhCVMTl (ORCPT ); Mon, 22 Mar 2021 08:19:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ABA2561931; Mon, 22 Mar 2021 12:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616415580; bh=zxvtl3PRlnpYihKBjGGbYEnphB4RPLOnR1v6ZTzVfpw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VfH7sTai0KRWXoYiOFlksoJNw2XBUTqCsY5sDJ57R/rIs8d8BzPDnd1zjO+7LhXfy xEr4VQVWnMUbPpwjhlNewaBCrJzcJtRCjVn7QxsW8c0SHdelUCqgJaN6wcwXV42ZGm PE0VViNDkQIL5F+jt3Uqz+8ifWlxrGPA0BIX+wNS9P8OBZaipqo2zu+uCh1Iijbkn0 CqYlZFhG4HVQormI3akb+jctDHE5rWt7+pQtPDj41pVNDgnZH4RqnGtljpkwFxvyU8 6WBAKVnmHYuBAlecMcHswKfQzTCtYNTt2JuMGIFUc9orDb5ZWXOr32lj0t1HfVxf2n q2Obv5gOY9Gzg== Date: Mon, 22 Mar 2021 12:19:34 +0000 From: Will Deacon To: Quentin Perret Cc: catalin.marinas@arm.com, maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, android-kvm@google.com, seanjc@google.com, mate.toth-pal@arm.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, tabba@google.com, ardb@kernel.org, mark.rutland@arm.com, dbrazdil@google.com Subject: Re: [PATCH v6 32/38] KVM: arm64: Introduce KVM_PGTABLE_S2_NOFWB stage 2 flag Message-ID: <20210322121934.GE10318@willie-the-truck> References: <20210319100146.1149909-1-qperret@google.com> <20210319100146.1149909-33-qperret@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210319100146.1149909-33-qperret@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 19, 2021 at 10:01:40AM +0000, Quentin Perret wrote: > In order to further configure stage 2 page-tables, pass flags to the > init function using a new enum. > > The first of these flags allows to disable FWB even if the hardware > supports it as we will need to do so for the host stage 2. > > Signed-off-by: Quentin Perret > --- > arch/arm64/include/asm/kvm_pgtable.h | 43 +++++++++++++------- > arch/arm64/include/asm/pgtable-prot.h | 4 +- > arch/arm64/kvm/hyp/pgtable.c | 56 +++++++++++++++------------ > 3 files changed, 62 insertions(+), 41 deletions(-) [...] > diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h > index 9a65fb528110..079f4e9a3e84 100644 > --- a/arch/arm64/include/asm/pgtable-prot.h > +++ b/arch/arm64/include/asm/pgtable-prot.h > @@ -71,10 +71,10 @@ extern bool arm64_use_ng_mappings; > #define PAGE_KERNEL_EXEC __pgprot(PROT_NORMAL & ~PTE_PXN) > #define PAGE_KERNEL_EXEC_CONT __pgprot((PROT_NORMAL & ~PTE_PXN) | PTE_CONT) > > -#define PAGE_S2_MEMATTR(attr) \ > +#define PAGE_S2_MEMATTR(attr, has_fwb) \ > ({ \ > u64 __val; \ > - if (cpus_have_const_cap(ARM64_HAS_STAGE2_FWB)) \ > + if (has_fwb) \ > __val = PTE_S2_MEMATTR(MT_S2_FWB_ ## attr); \ > else \ > __val = PTE_S2_MEMATTR(MT_S2_ ## attr); \ Given that this isn't used outside of pgtable.c, I wonder if we should move it in there, as it's a pretty low-level thing to do now that it takes the 'has_fwb' parameter. But regardless, Acked-by: Will Deacon Will