Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp1306603pxt; Sat, 7 Aug 2021 06:52:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkinxsTAaCxhVLIPQ6O8EPT04WWUF4s0kuhXdP0Hc7Hfy5oHZQIbZt4J8u3CO9Ltf7C8HP X-Received: by 2002:a05:6602:1848:: with SMTP id d8mr725269ioi.72.1628344327308; Sat, 07 Aug 2021 06:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628344327; cv=none; d=google.com; s=arc-20160816; b=WSnyvcDWoa6Hg7srM+E0gy8Y12M3VnWCl3Elv1sA/ea2EVLT+sOOBEg4pmdGP4Necn IGrfZZtnlABLXy6d6S93yguUzfHBqmJOHcYgQqmoBtO2DSxGQzZjaxM1VFrSNxRgQ3ZO Bi4OFCNMAliC/OcVeZI852EEEDCSa2CMs1Sx2dZNhvxJUfVbPjWgBCX+faUx1KovRb2a LAKG4i6hjwKlTCvKzK0XzZ18xg6/3ixV8VANVW3S8T1vn+L2MGSuw1k7eeUpkTsr8n2e p21gD8ZuaYJDe3Bnqm0zdZ25PJLQdoGEZW4IsFa+z8vpFU6lDIVU00nwRvfpTMGaZdFM wa8g== 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=u96ed5XUQ+QmjxtUQVewX6dCxmvMLN/rCy5beBkLzbE=; b=zLET0V/QqWKyHAyPOm9ctPUFo79jd5UO8qFN64Q+NmjT1JtnaNOPh35QOkTR1nFaPP midhcfy4HS8Tk2qTSOz225pjDJbGoObQtqrxnqJ5LG+3FX7tFHGOTD+500+TA/6XAOT1 4Qh1p/RbspeRXaN0AlIngrVQ3mDH3eTHc1Pnzy3leEZaCmzWN+yaWA6JedNSrXfWV50D aM7iDVB3eUecziaWPgdJtoblRxpssSwpQTPOrlVJgBNFFaaIZO8DQiCfvyvdnq1+ZkQd TM8cfS8JPe2bB23aYLiNnuxeloiwqtNOqUIk/GIoFVhMCjND2grmnGF15F1bqj0kSYPY ezPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cc2hN2T5; 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 x5si12240048ilq.85.2021.08.07.06.51.56; Sat, 07 Aug 2021 06:52:07 -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=Cc2hN2T5; 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 S232321AbhHGNuw (ORCPT + 99 others); Sat, 7 Aug 2021 09:50:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41888 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232443AbhHGNuP (ORCPT ); Sat, 7 Aug 2021 09:50:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628344197; 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=u96ed5XUQ+QmjxtUQVewX6dCxmvMLN/rCy5beBkLzbE=; b=Cc2hN2T5SjHpVatuRwvsxiEtyyozIXLO5i9PLARv+1chxTgE+ykuMtrrQI5gh7p1MhffGp cpcuGADMqgopztlGchuhgacnPjDbbBYu+iCIHSiGmTge7Hb/KaMLU3d9R20BZhMyhvMh58 dQTrMz1ywGNnHFs24D0Fl2vLovrVFdo= 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-426-fijOuF62PzeNSXZuEbEwsw-1; Sat, 07 Aug 2021 09:49:54 -0400 X-MC-Unique: fijOuF62PzeNSXZuEbEwsw-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 9F3321835AC3; Sat, 7 Aug 2021 13:49:53 +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 22C9860C13; Sat, 7 Aug 2021 13:49:53 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: isaku.yamahata@intel.com, David Matlack , seanjc@google.com, peterx@redhat.com Subject: [PATCH 12/16] KVM: MMU: change tdp_mmu_map_handle_target_level() arguments to kvm_page_fault Date: Sat, 7 Aug 2021 09:49:32 -0400 Message-Id: <20210807134936.3083984-13-pbonzini@redhat.com> In-Reply-To: <20210807134936.3083984-1-pbonzini@redhat.com> References: <20210807134936.3083984-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 340ae8a34fe3..d8b1735739c0 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -937,21 +937,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) @@ -965,7 +964,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; kvm_make_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu); } @@ -1073,8 +1072,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