Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2312349pxp; Mon, 21 Mar 2022 16:38:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw15j+/kQi0vFq3bQ379r61c/q/xbP7taRQ+wSD5/8fole4vW0fnLf9kScymwoCTOaQL5yS X-Received: by 2002:aa7:92cf:0:b0:4fa:3b47:7408 with SMTP id k15-20020aa792cf000000b004fa3b477408mr24930078pfa.72.1647905893875; Mon, 21 Mar 2022 16:38:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647905893; cv=none; d=google.com; s=arc-20160816; b=wIewbw2rFMh89TLh5MLBkN1nscuZ5HSOoRC1PY8Ap4YCuzphzVfPlkG7jIPyLsZYGw al4eSuAn7REDH7VI+7LJT5KhDep972IMD/P1Kz/AGFJrDuVZtBdDsi1XAllv8cuKT/rT lz2b2oTzvhR5oxvazwUtwU8DtSvNU35I5X8Yi2gpEiqR51Hxoi+Bvv+m0KIEbOvBP3vQ D2p94Kt9bOX0f8dn86vB7oqqvHSfqzHVa8bXvT3fYIbBkOCV8Zdc5b4YvqFky5w9BPYT FVnGiIjqxHPipzlNiewR0LejwWX8btBFhVGxoPfNpCfwBXzHoxjSpbKJFGESJuUiKZzF 2D/A== 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=hRh/aDRf4TFZL6zvr1bxrdAuUBcTWbp/rzavH8BxDmc=; b=ZEmb3uDqk1nmbxP6dfj3qLy2/vRFGk+1VdLIcHYz2g5DdABSjb4XL/VvK+/o73mq9t O2s61k2U+vmfpVLdh5oHlSx2eBu0ch+0IJ2//Qh6vvBegYngdGm8fH1FvFObVuWKLk2/ bkKg2mJ4H1lgk3qdtLIaEz8fImBS55+4876I+4OALHV8Tb4jSd/FxBy23iWB+d2MO2qY Q495KTCGbjCC/ZUJ+RliKHabBSVSlG/ijCEUYOMjEDe8unvYTLAm51JwKFpnFUhprW2p 1XK25DhohiGm3x0qQx/zSRCcWBlKfGECxYc/bIpiiabFFhbnNSf+QsoZk3S5rEXRRNLq DjlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=N7QoakYl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s13-20020a17090aa10d00b001bd14e0308fsi613389pjp.103.2022.03.21.16.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:38:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=N7QoakYl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5315348E55; Mon, 21 Mar 2022 15:49:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbiCUWtx (ORCPT + 99 others); Mon, 21 Mar 2022 18:49:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbiCUWtV (ORCPT ); Mon, 21 Mar 2022 18:49:21 -0400 Received: from mail-oo1-xc49.google.com (mail-oo1-xc49.google.com [IPv6:2607:f8b0:4864:20::c49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0763A3FB90A for ; Mon, 21 Mar 2022 15:44:05 -0700 (PDT) Received: by mail-oo1-xc49.google.com with SMTP id t2-20020a4a7442000000b003245b0660afso8854930ooe.10 for ; Mon, 21 Mar 2022 15:44:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=hRh/aDRf4TFZL6zvr1bxrdAuUBcTWbp/rzavH8BxDmc=; b=N7QoakYla67hg2YwGMLs+8CQiTvN1le0Y1szw2+lTeF6J0oD3TknBPWha0WZdUSHBi vzJTf6ft6Z5Ecn9+Z5SLXjBG1V8G8zN+RUSvgOXdZzemZFwR+yb35QVxC7R8kFmswS+o eSAJeclif2PWNQXWk9ewedIX8yZxa8+2O7YNRS6KiQNb/g8IMlUY0bPgzWnWw00i6s/0 8dwobgEeVzQ28Jq4sh8tAq54i6xRF32OHBlHqZF3dlFNdwLW7V/bS4HUBSpdFPNo0OFI U5Y1NQoL+Be8GUIwbsmJqSuBnlEF5HD7Ym5s4s4XKS+4aeBV86GzokV7jBmfBmfKjy4T a9xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=hRh/aDRf4TFZL6zvr1bxrdAuUBcTWbp/rzavH8BxDmc=; b=h4ZAk9fnbCNdanULYxMlKGUPZO288kpZUWFGMb+JxvuwFrvkbOnqCDQZBAiP6Rqop4 1RRUrd5YUVoYgGxjgxwmHL5mdsw2Cbd/TqTcNTedd067lOcMqzmh/xjV/lW1jZ6DiVpB F/8NevjZSU9ldEIOg/1jdr77uL67O247pdBuClFO15lK1yGxMeZq0oW4HHxh7sNCXb+V wdhSdhtkkMYw5QOVjnRAt1LkJtyi71CSbLodEAUVh7qNIQm9Nb0vkNBTe3ssxmxiHEF6 gBixl392M7B+HSuQ7cg+1TF10NS4u9jrVxU/xfe1QP+AkjbvPGtt8fm9mb+CdAYLG57f JOmA== X-Gm-Message-State: AOAM531XFyipnBe9QP7ZIIR6omGUCPOuypGHt44ReeN4GdgTGbPiROrL Z1Przv94BlfOdV2Ou9UNF4IZdkHuoCbn9BV6WBdwVZSxXuv0FqzPevlWspQLvAcEoVjpK365KtI hSCoh9KodWR4rqq7CtJoa/jIZTiV2qHYAtNunun8mhZlOlaM4RNuehEvs8mKHxOZ/VEkvT+do X-Received: from bgardon.sea.corp.google.com ([2620:15c:100:202:b76a:f152:cb5e:5cd2]) (user=bgardon job=sendgmr) by 2002:aca:2311:0:b0:2ec:cb84:c5bb with SMTP id e17-20020aca2311000000b002eccb84c5bbmr721672oie.246.1647902643700; Mon, 21 Mar 2022 15:44:03 -0700 (PDT) Date: Mon, 21 Mar 2022 15:43:50 -0700 In-Reply-To: <20220321224358.1305530-1-bgardon@google.com> Message-Id: <20220321224358.1305530-2-bgardon@google.com> Mime-Version: 1.0 References: <20220321224358.1305530-1-bgardon@google.com> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog Subject: [PATCH v2 1/9] KVM: x86/mmu: Move implementation of make_spte to a helper From: Ben Gardon To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Peter Xu , Sean Christopherson , David Matlack , Jim Mattson , David Dunn , Jing Zhang , Junaid Shahid , Ben Gardon Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the implementation of make_spte to a helper function. This will facilitate factoring out all uses of the vCPU pointer from the helper in subsequent commits. No functional change intended. Signed-off-by: Ben Gardon --- arch/x86/kvm/mmu/spte.c | 20 +++++++++++++++----- arch/x86/kvm/mmu/spte.h | 4 ++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/mmu/spte.c b/arch/x86/kvm/mmu/spte.c index 4739b53c9734..d3da0d3d41cb 100644 --- a/arch/x86/kvm/mmu/spte.c +++ b/arch/x86/kvm/mmu/spte.c @@ -90,11 +90,10 @@ static bool kvm_is_mmio_pfn(kvm_pfn_t pfn) E820_TYPE_RAM); } -bool make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, - const struct kvm_memory_slot *slot, - unsigned int pte_access, gfn_t gfn, kvm_pfn_t pfn, - u64 old_spte, bool prefetch, bool can_unsync, - bool host_writable, u64 *new_spte) +bool __make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, + const struct kvm_memory_slot *slot, unsigned int pte_access, + gfn_t gfn, kvm_pfn_t pfn, u64 old_spte, bool prefetch, + bool can_unsync, bool host_writable, u64 *new_spte) { int level = sp->role.level; u64 spte = SPTE_MMU_PRESENT_MASK; @@ -192,6 +191,17 @@ bool make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, return wrprot; } +bool make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, + const struct kvm_memory_slot *slot, + unsigned int pte_access, gfn_t gfn, kvm_pfn_t pfn, + u64 old_spte, bool prefetch, bool can_unsync, + bool host_writable, u64 *new_spte) +{ + return __make_spte(vcpu, sp, slot, pte_access, gfn, pfn, old_spte, + prefetch, can_unsync, host_writable, new_spte); + +} + static u64 make_spte_executable(u64 spte) { bool is_access_track = is_access_track_spte(spte); diff --git a/arch/x86/kvm/mmu/spte.h b/arch/x86/kvm/mmu/spte.h index 73f12615416f..3fae3c3124f7 100644 --- a/arch/x86/kvm/mmu/spte.h +++ b/arch/x86/kvm/mmu/spte.h @@ -410,6 +410,10 @@ static inline u64 get_mmio_spte_generation(u64 spte) return gen; } +bool __make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, + const struct kvm_memory_slot *slot, unsigned int pte_access, + gfn_t gfn, kvm_pfn_t pfn, u64 old_spte, bool prefetch, + bool can_unsync, bool host_writable, u64 *new_spte); bool make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, const struct kvm_memory_slot *slot, unsigned int pte_access, gfn_t gfn, kvm_pfn_t pfn, -- 2.35.1.894.gb6a874cedc-goog