Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2671145rwd; Sun, 28 May 2023 21:51:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7eeJA0X18V+CA8hL446HCwkttBOTfmqw/C0TSICjEfqVNK8x2cmrmnoyrr3Hy6GTxC+xU/ X-Received: by 2002:a17:902:dac1:b0:1b0:7cc:9836 with SMTP id q1-20020a170902dac100b001b007cc9836mr13794565plx.62.1685335916906; Sun, 28 May 2023 21:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685335916; cv=none; d=google.com; s=arc-20160816; b=Ckgcl232VXp2j3V1bg5SybD9/lkV1/2/Jkwcs0ns6mn3i2qs6id6CgFGx3NPQ28Dma S0k8BO29uw4pG+F9fcc6eHSvYdq6l6eFI9/xqfSdlLtrFBuo3h3sYXLcT3HuVFiQcUxs wNz8J9C2LMnUY4PN2JX2Xkw9nJZPINKYlt2xK12H6ih3APXXho7Y9aKNtfZzafFJLs73 PW3PLfrILu3Me526SDyHafKTvFfDIIDM/IADMftbtJZQIwqdFO1Z2TojSgjIfiOHbV1g 17dyXKu8IVytkyiQS5ysdzZ/i9csaqWNax5Hb3cDn0IxSFgR7sfBz7pmdzqEKTtmYMO1 aVjA== 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=86vhYpJOCIpMTZI4eDegYWReXqqdp8T51VvhYul/Wvk=; b=wO+H9pDMJjZh++wsA/1FEBCG1WBUHABXSlnx3zsF3B4uHx33XhqytxQIkpqpY+ea7s MUy4NJyAutGKJ1nLA59VqWUEiWkUVhWAHYZix3MhFDsK+mJmw8P+d5HHnINO4IBVZkss wbVzCq3FocZB4b2ZoZYxJaXtQkZn2DsY8JR2GOIy2AaM2rtf3hFSpHpsIOCLkUyYG5CV FmZrwjHTBdLKQaq292EPwJKOZyEuAeCpN5SWLsoC5xwsk3+T7BlIHXNKBznoP4hSFRa1 G9RRZs5F17ufcbd3aigaez+21sBxVhxuT1Q32IOWicEjn0YwbUDVn6/CrF48opn/wTYR o6yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FUxEsEd0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b21-20020a170902b61500b001b025685062si3624713pls.574.2023.05.28.21.51.43; Sun, 28 May 2023 21:51:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FUxEsEd0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232704AbjE2EfO (ORCPT + 99 others); Mon, 29 May 2023 00:35:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232168AbjE2E27 (ORCPT ); Mon, 29 May 2023 00:28:59 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 108132130; Sun, 28 May 2023 21:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685334322; x=1716870322; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KmVaeJcJiI0A3X/f88ZmhdCGHs9unPup0tYXi6aBhRQ=; b=FUxEsEd0jFHvmdpV+W8ZcNXpwAMCV9eFBkI6uAmWf6IxLpIspCKAL9Vm ZNEUnFrlTWizxqARPa+a3Q5hsdATpqWgMFAeGl3KuhafoWafVQb8S2bOe 7QTufWF7WVCVdKsIqCa6SskiL64+asGOTDTg2YOYofZT/ExiKFF+G5U8H AAnoDmT9OAWLoVS/j9Z1KOTGMPR0QoI0wwIRjE77irz0ZCDinp9mmUh9c DYHbdZZRy3HZmTj+nQRYQVzx/pXJq5lrd4Y3cD2CGbebR4xU/0ANF8m6j UXwh53BWXireOBv8QaCraG9L4rMHm7tn0GcciQ2mnIFtn8TZDr8IfqM0i g==; X-IronPort-AV: E=McAfee;i="6600,9927,10724"; a="356993515" X-IronPort-AV: E=Sophos;i="6.00,200,1681196400"; d="scan'208";a="356993515" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2023 21:21:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10724"; a="830223562" X-IronPort-AV: E=Sophos;i="6.00,200,1681196400"; d="scan'208";a="830223562" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2023 21:21:50 -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 , chen.bo@intel.com Subject: [PATCH v14 103/113] KVM: TDX: Add a method to ignore dirty logging Date: Sun, 28 May 2023 21:20:25 -0700 Message-Id: <6a117c07f01fd1f4fe1727a93f533d381a651e79.1685333728.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 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 9c854b5c856b..12872225af18 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -827,6 +827,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); } +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)) @@ -971,7 +979,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