From mboxrd@z Thu Jan 1 00:00:00 1970 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 98010C6FD19 for ; Sun, 12 Mar 2023 18:07:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232272AbjCLSH4 (ORCPT ); Sun, 12 Mar 2023 14:07:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232167AbjCLSFO (ORCPT ); Sun, 12 Mar 2023 14:05:14 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42D8E3B668; Sun, 12 Mar 2023 11:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678644068; x=1710180068; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QVO5JAqeGqgmVL7v4Ba8+MaKbkXoTcWGM7v1hgKkUYc=; b=QNE0i0hoWaWTNIjHLYSwtd+6F7ffSJad21JJ67C7M+ulLD3dZ6N0Zcm8 FAEjKCeYcM4Eg0LscBz+QYGn2t6UryODvZub5hwMj4a1EbdVadjWQlyws S8XU28AKuEr7aqYrytuLuA1n6bR9U1ARYaEgYOHwBadyxM9o222j8xIo/ 8w5phoCgfG+VymkKMv2xDVPnh6yLmZlFDGvuIAnEp0mr60FZ4NzNDKS7M eu/DW7VLPXoe1xgzrz8fca9znNHQxpErdfD6MZYRVlybHmb9KiIaTdBnD umoeRM3vmpQ3XhvyWTNOTEaq142j7QzhLW5nL3ApDLNioirURfzZiVgdv Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10647"; a="316660119" X-IronPort-AV: E=Sophos;i="5.98,254,1673942400"; d="scan'208";a="316660119" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2023 10:58:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10647"; a="742596848" X-IronPort-AV: E=Sophos;i="5.98,254,1673942400"; d="scan'208";a="742596848" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2023 10:58:16 -0700 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 v13 104/113] KVM: TDX: Add a method to ignore dirty logging Date: Sun, 12 Mar 2023 10:57:08 -0700 Message-Id: <6dff4dcc9843f5bf6d85bdabaf439d670c154fde.1678643052.git.isaku.yamahata@intel.com> 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 59fa63146c8d..c9bbee1b69e9 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -828,6 +828,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)) @@ -972,7 +980,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