From nobody Mon Sep 15 11:33:05 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2997FC54EBC for ; Thu, 12 Jan 2023 16:43:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240808AbjALQnK (ORCPT ); Thu, 12 Jan 2023 11:43:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232750AbjALQh2 (ORCPT ); Thu, 12 Jan 2023 11:37:28 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D16BB7D1; Thu, 12 Jan 2023 08:33:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673541229; x=1705077229; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ihKGnqJBa7minypALfE9XUALsE00T9ZHzP9R8DlkExM=; b=YtUQU4rK/5v/LExcqL9FtsOOgSBSKoUkyyl5fn9RYh23bBJg9eHEcdmB Mr7auY+75YYnJ9IPUSaFIPSCMxFPuGURFnUtYn6jasYMt/wzpkWU62CpF PYsZcHGfSMm+jbGNF7u/tl3FmHRctEHTCs4WOplGfTs2em+KKhsL5Hb6r JUMAvCtJuGaPJcUk4YFt0jILvJkKhBzeLvcFIuFWyZ4bY1DFPWBaCkfug CQoO/ki9aeOYeRzBgJYEOmYpWk/I6waj3Ees4/e9ZoKDrMhX4vBEq1mmw eu69YVO6L8mNSt31NBDmsSacN5UBC3pXiIolxTSHvoMaCapkZWCZQLsiq w==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="386089797" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="386089797" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:33:38 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="726372609" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="726372609" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:33:38 -0800 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack Subject: [PATCH v11 105/113] KVM: TDX: Add a method to ignore dirty logging Date: Thu, 12 Jan 2023 08:32:53 -0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Isaku Yamahata Currently TDX KVM doesn't support tracking dirty pages (yet). Implement a method to ignore it. Because the flag for kvm memory slot to enable dirty logging isn't accepted for TDX, warn on the method is called for TDX. Signed-off-by: Isaku Yamahata --- arch/x86/kvm/vmx/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c index 47c2b6e1e484..cbac63170cea 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -730,6 +730,14 @@ static u8 vt_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t = gfn, bool is_mmio) return vmx_get_mt_mask(vcpu, gfn, is_mmio); } =20 +static void vt_update_cpu_dirty_logging(struct kvm_vcpu *vcpu) +{ + if (KVM_BUG_ON(is_td_vcpu(vcpu), vcpu->kvm)) + return; + + vmx_update_cpu_dirty_logging(vcpu); +} + static void vt_get_exit_info(struct kvm_vcpu *vcpu, u32 *reason, u64 *info1, u64 *info2, u32 *intr_info, u32 *error_code) { @@ -873,7 +881,7 @@ struct kvm_x86_ops vt_x86_ops __initdata =3D { .sched_in =3D vt_sched_in, =20 .cpu_dirty_log_size =3D PML_ENTITY_NUM, - .update_cpu_dirty_logging =3D vmx_update_cpu_dirty_logging, + .update_cpu_dirty_logging =3D vt_update_cpu_dirty_logging, =20 .nested_ops =3D &vmx_nested_ops, =20 --=20 2.25.1