Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1886946pxb; Fri, 24 Sep 2021 14:27:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNCMY80HNYT6jgaXSKmvNAVs0JXErClFxFuCyd8Q3JXOM6afozrpXe6xtHnR2T5rZ3jJ9k X-Received: by 2002:a05:6402:34c:: with SMTP id r12mr7692610edw.390.1632518830495; Fri, 24 Sep 2021 14:27:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632518830; cv=none; d=google.com; s=arc-20160816; b=p7KGWsfYdeOY5cZjH9Can6CK/MypoFhiNwoo1golQLPCxD9vWlOBBaMRl1dRGNFPri oBOAG1y3ML4BUyjjNlLwKnxUVSEwFZPyq6UiwH7HSD0jLV+i1Ue17nRBhpC8vA/SChef sEjvsp9NmLl4IE1usvuE3LiYKKXln7nGvBGwyMkWGT/0iHjsv73x3YViAM5nfnlJAL8h 4/S3LRlJsDCNf44Dic+ImNAtxq3DofQP6V0hXmOIh2OEzwCpGLbZnTiaIVsJBV6W8gVQ awPP1UKPlRjujEqUlpDFo8CstKgoTOmgmwkGUGftcd42gOfb6Kp3D0pZxb0bRmK8l1e2 8G2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=J0oBXEA2ewwfwa5QNevePAfo75fkcq/4Rn3rSv4/dRA=; b=ywUjiyLEy+Fyl8c8JXNo6AvzMgdQo44DjBbwtbt/yjC6GCeLw70W7NXxKQ8FOmc9OP 6S1SrnQUmnnWF+s+uNKauTfYSvilkWcV33QLsCDiK8dJOeO3uKIp7S1zn4ytDsIokb8d UgsEu+7vluFV9Iih5cFiDnwW/esUz/GGIFtqJEC1JrsAv5ycHtLbPtbpg9fA9Jbeinfw hydcoUY/hyRu/N00XyrJstKmORJE8IViVmEw8WJZIN5K6X12LyF3dMUisMZM1o8Gd9mE 2GosX0YH+ggvJvuow0aKYZZQmgcDjrhWV2FQG1JJ29fNecDS3pgxX5E0MwSwBHGXRF0M /2Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MUWNX46L; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x17si10555223edi.396.2021.09.24.14.26.46; Fri, 24 Sep 2021 14:27:10 -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=@redhat.com header.s=mimecast20190719 header.b=MUWNX46L; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347875AbhIXQeU (ORCPT + 99 others); Fri, 24 Sep 2021 12:34:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37679 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347452AbhIXQdg (ORCPT ); Fri, 24 Sep 2021 12:33:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632501122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J0oBXEA2ewwfwa5QNevePAfo75fkcq/4Rn3rSv4/dRA=; b=MUWNX46LS5TC2QG88bMq+CQHv/JeMA0ilWoExzSCnuspujwCB5B1Nhw6JKMAzMfLhZBKbW a/vCbvXHxD+AE7C1pkVLr5fcs4QTIYmJCwV0zMxJW5mL4mrXaqZaiU8vzuiVtqMa9lyjZe vu0uRbSt4N6FUFxorkdeHKVPPHkCWg4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-588-5tjOYHzzOm-Aba6ZfTE8kg-1; Fri, 24 Sep 2021 12:32:01 -0400 X-MC-Unique: 5tjOYHzzOm-Aba6ZfTE8kg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EF2D010168D3; Fri, 24 Sep 2021 16:31:59 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F4595FCAE; Fri, 24 Sep 2021 16:31:59 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: dmatlack@google.com, seanjc@google.com Subject: [PATCH v3 11/31] KVM: MMU: change tdp_mmu_map_handle_target_level() arguments to kvm_page_fault Date: Fri, 24 Sep 2021 12:31:32 -0400 Message-Id: <20210924163152.289027-12-pbonzini@redhat.com> In-Reply-To: <20210924163152.289027-1-pbonzini@redhat.com> References: <20210924163152.289027-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pass struct kvm_page_fault to tdp_mmu_map_handle_target_level() instead of extracting the arguments from the struct. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/mmu/tdp_mmu.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index 4a5bb0b5b639..6cfba8c28ea2 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -929,21 +929,20 @@ void kvm_tdp_mmu_invalidate_all_roots(struct kvm *kvm) * Installs a last-level SPTE to handle a TDP page fault. * (NPT/EPT violation/misconfiguration) */ -static int tdp_mmu_map_handle_target_level(struct kvm_vcpu *vcpu, int write, - int map_writable, - struct tdp_iter *iter, - kvm_pfn_t pfn, bool prefault) +static int tdp_mmu_map_handle_target_level(struct kvm_vcpu *vcpu, + struct kvm_page_fault *fault, + struct tdp_iter *iter) { u64 new_spte; int ret = RET_PF_FIXED; int make_spte_ret = 0; - if (unlikely(is_noslot_pfn(pfn))) + if (unlikely(is_noslot_pfn(fault->pfn))) new_spte = make_mmio_spte(vcpu, iter->gfn, ACC_ALL); else make_spte_ret = make_spte(vcpu, ACC_ALL, iter->level, iter->gfn, - pfn, iter->old_spte, prefault, true, - map_writable, !shadow_accessed_mask, + fault->pfn, iter->old_spte, fault->prefault, true, + fault->map_writable, !shadow_accessed_mask, &new_spte); if (new_spte == iter->old_spte) @@ -957,7 +956,7 @@ static int tdp_mmu_map_handle_target_level(struct kvm_vcpu *vcpu, int write, * the vCPU would have the same fault again. */ if (make_spte_ret & SET_SPTE_WRITE_PROTECTED_PT) { - if (write) + if (fault->write) ret = RET_PF_EMULATE; } @@ -1064,8 +1063,7 @@ int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault) return RET_PF_RETRY; } - ret = tdp_mmu_map_handle_target_level(vcpu, fault->write, fault->map_writable, &iter, - fault->pfn, fault->prefault); + ret = tdp_mmu_map_handle_target_level(vcpu, fault, &iter); rcu_read_unlock(); return ret; -- 2.27.0