Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp970226pxf; Thu, 11 Mar 2021 21:27:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJydxV7VZRRwZGrQ3xjkLiPU5sSTInAABNtvSuUYMg1/3Me2G16raj1XLA1XpPZf8XlYSP10 X-Received: by 2002:a17:907:20e4:: with SMTP id rh4mr6760253ejb.369.1615526826573; Thu, 11 Mar 2021 21:27:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615526826; cv=none; d=google.com; s=arc-20160816; b=Pn+/cMpFQmdPkVSwLEmuZaTzzrr2gTjWIt08KV/mpyyrRD/ihH19r3brBld5Sx6FKs 5QBLrcwd2iCmHCgpaOEShEEHaqw9QWQHpA2W+EX3rkhM15c7zxPdn4FX3kuKPLqrFun9 wrsD8yKZoMMGTvMBEAgufbjpZFmof9SB3P/OCs3SueCKOS+jOTorP2rVZZXqkLdXvdH+ DUqogoan9CVUv604Njy8stZkdmpR7knm5nzUD74+lISZrHPiYbLTC5tTIvMOa6IHNfGj fuSvrJun7dW6l4de3oR6s+YT1NiLEaHzDou6gSsWWuTf4IQqKxZgRAc8d/Amr2s6nI/F OqSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=8rin+aXdpiE+90osiPBBCiB/kzC/wvTFDlufzLkieLY=; b=XK2NappszB+PVJSl/wHWbIqAMF92omSpmy34xeOCWrPa1gZfy85pU3gWR0GVVzTxTO rC3hfdLBX4wtEu4C0Mq0c8ej3aierJG40hIIH6t1c+0zyCAp3m0cZzmvVSybax8pdi8y QnPz6MtO4xIemKYIRHvzFMQAuNjsdWciCD2kEUJzBlLTjUe6xg5JDP5nu1biCQzqMAGU 9IReC4br+c77jmhsvxJiQrS72Npd8EUde7hOchIsNF9U9fBfvZAvOVJ8DRSjnVOgL0vm 46mTyWFantt4487i0xTB4kuRB3hIVlpYdKdnsq0FGkankuSM5+yzza5yYar5mz8bfL0v PDOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RLh9oG+E; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c23si3299663edv.312.2021.03.11.21.26.44; Thu, 11 Mar 2021 21:27:06 -0800 (PST) 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=@google.com header.s=20161025 header.b=RLh9oG+E; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231179AbhCLFKp (ORCPT + 99 others); Fri, 12 Mar 2021 00:10:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230500AbhCLFKO (ORCPT ); Fri, 12 Mar 2021 00:10:14 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A42EDC061574 for ; Thu, 11 Mar 2021 21:10:13 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id g8so3028020wmd.4 for ; Thu, 11 Mar 2021 21:10:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=8rin+aXdpiE+90osiPBBCiB/kzC/wvTFDlufzLkieLY=; b=RLh9oG+E0NRrQf3D4jDx/361FM3yrK1EmWOIlmVfSLVlQ+cwHf8/nT+4l2Ked5A0jn rPXhwUvZI8dZFd+C9S0oLI35nPymHdflaDiaKvMxBRzS9+7b2Rc7Wc0TED6EGeaxElzU fuJDo6skHJcy8k+l0WkEvRYlNZW0yzvWkTmFTXZfa7dNNDtB8cfNhHFYqIJSFnKEaE7S eknHTHSYo9aefxdnodvlaAGCvIGEq+///KeqOBK3+/RP8HIQ/8X78lRz7lcrdQpdBw3Z UvcHOPEkT27Cpm0ySKV+1Z2QjbVJOd/YCDYoKUme+3IM6dUGRZir3YPt/iSDmXGquFSR 6D2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8rin+aXdpiE+90osiPBBCiB/kzC/wvTFDlufzLkieLY=; b=B9j8GskQOvfB6OAazyLTwj3XoGag9rw6+eFL7j+Eme8eKPWIIpDTMPZJuyxiORR0Xv 2f0Vc2Mv5wSvZHSFrMuGQvkFjlA2XaCfRE8Rk5kHbCp5YRe1FUpvvAXgH50LGCayq0Qm eguiLU7atuiU4teQ/YoDkkUBIHR1cL8A1GTA/NHThaliEgv4mpi/imlM/Uqr7Rcmaj2N qVABTOYj6LWQtl3UcPwnNDzcP3Wmt3I7y5TydS4S6z796vEmibhS4hknVrdGOYVmsbkF X2CsZy7SUrpO643SQazyRNMoCywtOHAK38umTbG7QVuSppt64V8tR5kLWA7SS/FAkDRB 9YVQ== X-Gm-Message-State: AOAM531ChTocscyv6bbigjgHAB7A9Eco2T3vv4pbaPGfHp2Z5GZxFDrL zCTWe74Ta089HpIuknktHokFWg== X-Received: by 2002:a1c:a985:: with SMTP id s127mr10952353wme.158.1615525812255; Thu, 11 Mar 2021 21:10:12 -0800 (PST) Received: from google.com (230.69.233.35.bc.googleusercontent.com. [35.233.69.230]) by smtp.gmail.com with ESMTPSA id d85sm871075wmd.15.2021.03.11.21.10.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 21:10:11 -0800 (PST) Date: Fri, 12 Mar 2021 05:10:09 +0000 From: Quentin Perret To: Will Deacon 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, linux-kernel@vger.kernel.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, tabba@google.com, mark.rutland@arm.com, dbrazdil@google.com, mate.toth-pal@arm.com, seanjc@google.com, robh+dt@kernel.org, ardb@kernel.org Subject: Re: [PATCH v4 29/34] KVM: arm64: Refactor stage2_map_set_prot_attr() Message-ID: References: <20210310175751.3320106-1-qperret@google.com> <20210310175751.3320106-30-qperret@google.com> <20210311184836.GA31586@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210311184836.GA31586@willie-the-truck> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 11 Mar 2021 at 18:48:36 (+0000), Will Deacon wrote: > On Wed, Mar 10, 2021 at 05:57:46PM +0000, Quentin Perret wrote: > > In order to ease its re-use in other code paths, refactor > > stage2_map_set_prot_attr() to not depend on a stage2_map_data struct. > > No functional change intended. > > > > Signed-off-by: Quentin Perret > > --- > > arch/arm64/kvm/hyp/pgtable.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c > > index e4670b639726..c16e0306dd9a 100644 > > --- a/arch/arm64/kvm/hyp/pgtable.c > > +++ b/arch/arm64/kvm/hyp/pgtable.c > > @@ -489,8 +489,7 @@ u64 kvm_get_vtcr(u64 mmfr0, u64 mmfr1, u32 phys_shift) > > return vtcr; > > } > > > > -static int stage2_map_set_prot_attr(enum kvm_pgtable_prot prot, > > - struct stage2_map_data *data) > > +static int stage2_set_prot_attr(enum kvm_pgtable_prot prot, kvm_pte_t *ptep) > > { > > bool device = prot & KVM_PGTABLE_PROT_DEVICE; > > kvm_pte_t attr = device ? PAGE_S2_MEMATTR(DEVICE_nGnRE) : > > @@ -510,7 +509,8 @@ static int stage2_map_set_prot_attr(enum kvm_pgtable_prot prot, > > > > attr |= FIELD_PREP(KVM_PTE_LEAF_ATTR_LO_S2_SH, sh); > > attr |= KVM_PTE_LEAF_ATTR_LO_S2_AF; > > - data->attr = attr; > > + *ptep = attr; > > + > > return 0; > > } > > > > @@ -728,7 +728,7 @@ int kvm_pgtable_stage2_map(struct kvm_pgtable *pgt, u64 addr, u64 size, > > .arg = &map_data, > > }; > > > > - ret = stage2_map_set_prot_attr(prot, &map_data); > > + ret = stage2_set_prot_attr(prot, &map_data.attr); > > if (ret) > > return ret; > > (nit: this is now different to hyp_map_set_prot_attr() -- can we do the same > thing there, please?) Will do. Thanks, Quentin