Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp481774pxf; Wed, 10 Mar 2021 10:03:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCfQs+G1+Du+FepGFzqUEDtSoZ2GKJgm3HCbU26I1EFcGNDZIS+qEWqJchloIBCjC41BEp X-Received: by 2002:aa7:dd99:: with SMTP id g25mr4636249edv.230.1615399428189; Wed, 10 Mar 2021 10:03:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615399428; cv=none; d=google.com; s=arc-20160816; b=aJWogUhf9UvRNnLsuuL6KB4l/AoBSte/PsMwOLQFeiiPv3xFd1gWvViZDdBQDzgoWt W524CrEL/Uq2XcfLgdHAbsPmnvmrN9SFZPXGGv0VUvVE/voa4lL4J3HQQr3Jb8rY95Aq DyMslKDnD8uTxvNOgZqVbKUTSgFCOJdxyYxyLljg+wNcyaErydZ2lGD5eXIblm04V4lS 881QqApjfat6H18VDjZxo8HFXIWwSk8txjw7eFj0afTma3tdXThCeECW0Z8ey4P0X3qa BY75hkQmWQB+7CjAvhH7KOKMqyQ4eGqTVinh7/1Up8XhVFoPomYpdwoQXwHlAuNyZepe LlNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=6iNTe0mF+hjFWLgudHI/zWSf2clb7t9N+GDYgm7EigU=; b=bmZjeKnjmKW52XQAhvkGVM/jl3yhxQVFYb05YCdlxIF/nroDWW0XaMiUfKYpmQ9yiZ VkIA0gNMWRH4yJOu4rBfYxkiO1OLrhh8/ykye5351Rp9Kso4mDM6zwDFIsgoZ1eGmXJ8 mtmhVLjJURglbGAIy0kWi/doZ0I3gVOK9nONnzCT8ozQAksqplkDfKpQE6EvndS47t4H hEhBAGK3cMCAVNN0pWUNq+PUtnzRrq2Hj9M0IIhgrENxsQAic7BgW1C5qolWF3QLxB78 82WSKROMhCU3XfddXMddpNI+lTuD9EiQuA60EGyKg/F9dbtWA3y6f3jbBvbvqIwfcVcR ZqVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uaCdrsKf; 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 q2si98504edw.238.2021.03.10.10.03.26; Wed, 10 Mar 2021 10:03:48 -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=uaCdrsKf; 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 S233946AbhCJR7a (ORCPT + 99 others); Wed, 10 Mar 2021 12:59:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbhCJR67 (ORCPT ); Wed, 10 Mar 2021 12:58:59 -0500 Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8741EC061760 for ; Wed, 10 Mar 2021 09:58:59 -0800 (PST) Received: by mail-qt1-x84a.google.com with SMTP id 16so13557101qtw.1 for ; Wed, 10 Mar 2021 09:58:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=6iNTe0mF+hjFWLgudHI/zWSf2clb7t9N+GDYgm7EigU=; b=uaCdrsKfFSgEFJjwltC9RmF59Ae7yc016S997ZvqjUKBgk8suIeUI8tNo9lXnjVcFu 2TLmSeOAjSDRESJ/NLQB7NEcltJ8lm7/1lgfPzBhrxE0X30r58dk52bDkKiWrJ0U/ly4 RFLMCW7FhB3lzNXpvkxGbEEWw2VsVX/v89kRWom2NPXRitUUuaSEtxub5xzCfAQj/QEv ipn9/xy2+PZHU7mfi6Eelvf9mWH+vr113PBdfw6Sxgv9/ZaPo0n+ZxYF95KSUq8n96zJ 1xkQHpOlRKYCDEukUW/4tZsL1k+hh9mrB1hZ/5M5eDoytop/zTSDu4VEhsAUZqUHU6W7 SHUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=6iNTe0mF+hjFWLgudHI/zWSf2clb7t9N+GDYgm7EigU=; b=nl7omQSs9BCBrp3FPvpWdPNjp4Y/ZYm9vpGv+8ODl/CsXUlppvZKfCXy3VLtRnTjYD YV3Co9ymcFrEnzJML7n+KyT0ymERsUlduDvvSP4sGbt/xH8pV+E4Al/gtBuwGMynfZj2 hmLgp/jAU56Q7VpNahLQBQZVts7OmmGa/lWliHskXzi2mY3yJ3ZPYmTSUUcW4p5mIKA9 fZWCMU+rJ4GXzOxdoTacYBjCoJTU2kmCqrF7pOv3moVYstVy0m4carnxnQz5d+SLlQY4 YdB8AgW2ycaifLLeqbeD5xPDh/NQrTVUPxZHarimAEfm2tG8AkmYk7Xw0JIsemTzOBU9 8oiw== X-Gm-Message-State: AOAM531b5N9p3tH8aQxOc1Aq+JFwHuHn5QiaySZvcoCDnmJq+zY1YfuC eQN5aGGSPnjx14sPSCpHHi67CCnsHtzv X-Received: from r2d2-qp.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:1652]) (user=qperret job=sendgmr) by 2002:a0c:f092:: with SMTP id g18mr4249565qvk.11.1615399138690; Wed, 10 Mar 2021 09:58:58 -0800 (PST) Date: Wed, 10 Mar 2021 17:57:46 +0000 In-Reply-To: <20210310175751.3320106-1-qperret@google.com> Message-Id: <20210310175751.3320106-30-qperret@google.com> Mime-Version: 1.0 References: <20210310175751.3320106-1-qperret@google.com> X-Mailer: git-send-email 2.30.1.766.gb4fecdf3b7-goog Subject: [PATCH v4 29/34] KVM: arm64: Refactor stage2_map_set_prot_attr() From: Quentin Perret To: catalin.marinas@arm.com, will@kernel.org, maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com Cc: 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, qperret@google.com, robh+dt@kernel.org, ardb@kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.30.1.766.gb4fecdf3b7-goog