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 3F8D3C64ED6 for ; Mon, 27 Feb 2023 08:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232171AbjB0Ic3 (ORCPT ); Mon, 27 Feb 2023 03:32:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231955AbjB0IaP (ORCPT ); Mon, 27 Feb 2023 03:30:15 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CE9A1D904; Mon, 27 Feb 2023 00:27:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677486420; x=1709022420; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Sb3GhmOVq7LbIqC0EdKDOcQ7oJ/c//lx2iSy3QD7UPI=; b=j67oXbEn+NPne1zv/c7NXDSaV9cuLWouvlhT2T82e/PY1bU4kiK9BAB/ VijeojBVI+PNO8/TNJvfL5aDWjtFtWGXe/5MqSP+buoThlxMR4XShttVh wgukaYcPTRzzls109HAXnigco7K7pDlgXjCMaXNf0Jxn5bKhn4BFAIOsy bIi2EeCe6u/87JxAGaLelg3lipvYOj67GN9Afoy4wbRtju02MlFV4d6+3 T/MU3P/EvwAhtT8/Q8oShZmlxD0GmPnsqHrl5bBGQ/NDSAXnoJj1FbvZl Ygj3Ofr5KQDYal3tH3e+m6D7dgkXSqlQg2w3UpB60pNV4nO4siC+Sud/c g==; X-IronPort-AV: E=McAfee;i="6500,9779,10633"; a="317609095" X-IronPort-AV: E=Sophos;i="5.97,331,1669104000"; d="scan'208";a="317609095" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2023 00:24:20 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10633"; a="783242435" X-IronPort-AV: E=Sophos;i="5.97,331,1669104000"; d="scan'208";a="783242435" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2023 00:24:20 -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 , Kai Huang , Zhi Wang Subject: [PATCH v12 097/106] KVM: TDX: Add a method to ignore dirty logging Date: Mon, 27 Feb 2023 00:23:36 -0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 d15056666311..79a3c623bccf 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -806,6 +806,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, true); } +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 int vt_mem_enc_ioctl(struct kvm *kvm, void __user *argp) { if (!is_td(kvm)) @@ -950,7 +958,7 @@ struct kvm_x86_ops vt_x86_ops __initdata = { .sched_in = vt_sched_in, .cpu_dirty_log_size = PML_ENTITY_NUM, - .update_cpu_dirty_logging = vmx_update_cpu_dirty_logging, + .update_cpu_dirty_logging = vt_update_cpu_dirty_logging, .nested_ops = &vmx_nested_ops, -- 2.25.1