Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2312314pxp; Mon, 21 Mar 2022 16:38:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyJpxgJBMuSPTc5qWdvjvXfcCI57ZHB79BsHmf8YKeGrGVTHgQ3sDMMQI/solxRKzAqNGj X-Received: by 2002:a17:90b:4ac1:b0:1c6:adfe:322a with SMTP id mh1-20020a17090b4ac100b001c6adfe322amr1655538pjb.189.1647905890180; Mon, 21 Mar 2022 16:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647905890; cv=none; d=google.com; s=arc-20160816; b=SnyxquZt1hjUir5aqRovlMvkXgU/vHfAoylzs0vhQDC15lOVjfbV1UDWD5MicDfLGe nEqguSLs4oRE4bHgq3hruo7Q7YziwIidiKQp3hx8f6Jjqk+oSVQH5q99KfCbtkbErK9S ZPaej2nSwvKf+0wXcnUXVMPcZNipy7R1ekNVqA0B7RRRdamV4nqFNG7oGDbMKGmXg4pj +RK2m7AsXDRNC2F0rlQ1zm/oLB6TLMaSHajDDtXa3uYoh4eUt/+pqQqO1k2N86Csk7Rh 9OGv9L+GrvHDRH5q3BJdgJ+MYzy7xCJD8cejZPhg/R9lL/Z2xIzUZzBoqJ2thvQ0KHs4 A5tA== 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=N/VqAqp6gLrZv99t4Njzo2cELtOAzHXSK8UPoavhuKQ=; b=XrsMla96BZ5deHgxUtAk5j7cmNPAYAIcVpapewy1zE4/7MKoltbhSQ91W5Xd5yxjtw OU03gW6jvsUZl8AIB1/19ZavYNNTTKnYWqugVSiSTtYn9HC7k+Z8KxN4hXummjgSOp2D muB++6YQLHeeCeduUzGFvQIVGESwIK2plPVjyq1YpXNj/4P1cRbaJKIF/deLo5RaOfWc FITikmMcMztsyeri9ymbL+FSk0odmh+DCsOFjPAVs1dt9r/OucT/VVGqwxijnBWgp2gN QNUZDbvSWNyYHqYy2VnqD5sa6sJSHsiHh2KaPKpL7+mJdlJ97NzP9Q8jNc+D2FmouKAq D/ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mcmZRlLu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id x10-20020a170902ea8a00b00153b2d16435si12806144plb.61.2022.03.21.16.38.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:38:10 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mcmZRlLu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 BDC853E45E8; Mon, 21 Mar 2022 15:49:00 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbiCUWtu (ORCPT + 99 others); Mon, 21 Mar 2022 18:49:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230033AbiCUWt0 (ORCPT ); Mon, 21 Mar 2022 18:49:26 -0400 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 819C656203 for ; Mon, 21 Mar 2022 15:44:12 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id t12-20020a17090a448c00b001b9cbac9c43so266884pjg.2 for ; Mon, 21 Mar 2022 15:44:12 -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=N/VqAqp6gLrZv99t4Njzo2cELtOAzHXSK8UPoavhuKQ=; b=mcmZRlLuczmyzx0s2+txXbdamltCrph70eCBEhtFHOvXlDp5ARTOrdpARtK5XjDuq/ /QSyThdWNlgl09K6ie4aoRZsa9DnMIO4AUf1aB5quXDa++jLJLuDaq0r6RLOITOehL2G UxAyo1V2O2hF8uzY1cZAenEmg1GuRJK5040lKh/i24X9VFRn9j0DAufUUwfQcBbFP3la Z88KuHe2CPCmRF18dpZ3xHoVXM91Iibz0NcgSyPUGj9P6QvDko1CuxZd6bGhECq/uC4r 8il+WcQub0GJ8/Sk8ATiI8TzN3XzIzg2blaYqcoRuenSpyio1nFgqwl+rbBRpHoV5kfc eeNw== 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=N/VqAqp6gLrZv99t4Njzo2cELtOAzHXSK8UPoavhuKQ=; b=4IBQAqGjlDmTcdoNBaYUI5xSUVXUXkWGNKd1WXT7Dd3CWY58NAKJ2at0cMRUCpc8mS QtWPn6SUnaBu5lrIcguEqcZ0vRhPh88rUgqn6U5+tKndJEp9Md/xd3HR4MUpDu12h31d e1b0503gxNVBmMuucAjuxXqqFRAoy3a2GN/IuA76j7EiF+cmzcBpgdrj71OChVLBgnYk cMY3w2HJPTAmQzn/PjgLrFnW7SDJlcpOusIk7MESMUMU4+Mb/jZL13gxIy5iFMBdTrES PfKnktMIEQTSLm6YlbJlFRfvQCmCh/zKDcLRlFl+v4bY/DOER7dP4/v7eMPr4Xlmipfn 3yGw== X-Gm-Message-State: AOAM531ofLDuBlyWCoKY9S3H23XvJE3TnsJREYNIiE6yGuZp+5p6SVbX X4cBaaB7ka0sK2OQCVQ0CYhD+EfjiOpGXswBQ8YbWpW7S/s1EICxxiVtBjmTe4XyhmdLVbpHi/S KUBH+WfIDtLuEAReYp/WkIEhSGR6fZfC0w8VQ76R/JS+wgX/07BoANyFf+yO0P5g8uGb9IeWq X-Received: from bgardon.sea.corp.google.com ([2620:15c:100:202:b76a:f152:cb5e:5cd2]) (user=bgardon job=sendgmr) by 2002:a17:902:6b89:b0:154:623c:9517 with SMTP id p9-20020a1709026b8900b00154623c9517mr5803697plk.45.1647902651774; Mon, 21 Mar 2022 15:44:11 -0700 (PDT) Date: Mon, 21 Mar 2022 15:43:53 -0700 In-Reply-To: <20220321224358.1305530-1-bgardon@google.com> Message-Id: <20220321224358.1305530-5-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 4/9] KVM: x86/mmu: Replace vcpu argument with kvm pointer in make_spte 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 No that nothing in make_spte actually needs the vCPU argument, just pass in a pointer to the struct kvm. This allows the function to be used in situations where there is no relevant struct vcpu. No functional change intended. Signed-off-by: Ben Gardon --- arch/x86/kvm/mmu/spte.c | 9 ++++----- arch/x86/kvm/mmu/spte.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu/spte.c b/arch/x86/kvm/mmu/spte.c index ef2d85577abb..45e9c0c3932e 100644 --- a/arch/x86/kvm/mmu/spte.c +++ b/arch/x86/kvm/mmu/spte.c @@ -90,7 +90,7 @@ 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, +bool __make_spte(struct kvm *kvm, 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 mt_mask, @@ -161,7 +161,7 @@ bool __make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, * e.g. it's write-tracked (upper-level SPs) or has one or more * shadow pages and unsync'ing pages is not allowed. */ - if (mmu_try_to_unsync_pages(vcpu->kvm, slot, gfn, can_unsync, prefetch)) { + if (mmu_try_to_unsync_pages(kvm, slot, gfn, can_unsync, prefetch)) { pgprintk("%s: found shadow page for %llx, marking ro\n", __func__, gfn); wrprot = true; @@ -184,7 +184,7 @@ bool __make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, if ((spte & PT_WRITABLE_MASK) && kvm_slot_dirty_track_enabled(slot)) { /* Enforced by kvm_mmu_hugepage_adjust. */ WARN_ON(level > PG_LEVEL_4K); - mark_page_dirty_in_slot(vcpu->kvm, slot, gfn); + mark_page_dirty_in_slot(kvm, slot, gfn); } *new_spte = spte; @@ -202,10 +202,9 @@ bool make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, struct rsvd_bits_validate *shadow_zero_check = &vcpu->arch.mmu->shadow_zero_check; - return __make_spte(vcpu, sp, slot, pte_access, gfn, pfn, old_spte, + return __make_spte(vcpu->kvm, sp, slot, pte_access, gfn, pfn, old_spte, prefetch, can_unsync, host_writable, mt_mask, shadow_zero_check, new_spte); - } static u64 make_spte_executable(u64 spte) diff --git a/arch/x86/kvm/mmu/spte.h b/arch/x86/kvm/mmu/spte.h index e8a051188eb6..cee02fe63429 100644 --- a/arch/x86/kvm/mmu/spte.h +++ b/arch/x86/kvm/mmu/spte.h @@ -410,7 +410,7 @@ static inline u64 get_mmio_spte_generation(u64 spte) return gen; } -bool __make_spte(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, +bool __make_spte(struct kvm *kvm, 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 mt_mask, -- 2.35.1.894.gb6a874cedc-goog