Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2619636rdg; Mon, 16 Oct 2023 09:34:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpOxqBM+L/HDOHHaDvJQzh8cIYOo2aX+jWokNjtnBqNSuBwm5/2HzpPiZLohvcIB+CHPZ0 X-Received: by 2002:a05:6870:4998:b0:1e9:dd69:2fc1 with SMTP id ho24-20020a056870499800b001e9dd692fc1mr11620139oab.7.1697474057586; Mon, 16 Oct 2023 09:34:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697474057; cv=none; d=google.com; s=arc-20160816; b=cuVYZZ3//InrBQHWINlQXPzUt05c4/CU32i3miPdySiGjTILJjGQxVvvXEDNtWeXQp X/+DniH4y4l64K7N3ya8PZyYRgxHIgI2Dsvi1IGmiWmXZc6d8XnXHQDm6PGVJtSFtQPa HSOAAe9LO1MbaA+Qs1xLSb3orwDrelaB5D6HzfJncLuHKIQW4llYwL3j4Hhm9kEgKcIV HlVOa2fQP9pYrznYgPMdNQ8gB2A5+elIO/q/AhcpXwgtBEOs1wbBWB3TsYnApV6VPMQK VNGpytsVWHsFzj8ON7IBuC3xl9d09Gamqb6xKV4qBaXqjMwK4+gtEbnOqPwNf+/vRN4B qCNQ== 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=mMgBjkn4grT61ynPgDXzG4CWgwVMUwCpl7dZH4Ge5n8=; fh=lRdU2Q/1zx5DcPdZuWBjshA5VT5Oc9cEhB1tCFiV0Nw=; b=KyimS37DXTtyCXh+6r42QWd/DpgjDvy832vbgN6vYr8uDIihmKT9OQG4td9A7EN8HL Ur3eeK6dDaIRQMMtrcFPM7knWG11yIpo/OyPlQm4ssCVbOlLBDTA87SH4dCoGnuVUno5 DMRo1mQNg7JCX+C5G7enoHtIet+nokjTG0GUv2fVaW8f/1Fp7guk2rpirG5cenDVSZ/C j6DnVu3aXIWkIGrazakTwWQN7zD4X3mO+LnNwSCU4BJyK1nxWc42brEsKDn+8zDIHG93 Z7Fryd1FAVsAm/BWNgZJn4FvILt6c16Am4tmGbC6E+CKsTqQJmv50AuKuveErJjSPCLx YdnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NrS91KvE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id 78-20020a630151000000b005b4ef9f02desi4314991pgb.796.2023.10.16.09.34.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:34:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NrS91KvE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 7D9828043C19; Mon, 16 Oct 2023 09:34:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232578AbjJPQdq (ORCPT + 99 others); Mon, 16 Oct 2023 12:33:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234238AbjJPQc7 (ORCPT ); Mon, 16 Oct 2023 12:32:59 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AC076FA9; Mon, 16 Oct 2023 09:22:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697473349; x=1729009349; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+/vtrN2qIqpj8iGnK5I8dTPlQxj06iJOkKyNTPVE38I=; b=NrS91KvE+XrSCvu/2qwf3cSwNZ2RATKGFoC4wt626ADbx9/qwFJLvutL 8Ji25iAaog2v3wQ45MhgS5xhHj1EO5gf+rir32pv6dkr2uXQZPNTG9e2v /Sefuv9Sg3Hksass8oyrqGLVYk1+Wee1YmOOvp6eSN52eHj2OirjApJGl fXcNjitEtZsWXUVMq7ipRZE3Tm6eLTM0jcDiuS0OczCSP2Tv4fmY+7Uo6 4ZZYu3QdLidZUsvjaJgByRusf/Zausw4spNbEJXUJqJdCTwEF5O/WZriu z5uyAHnVM91FxLpyoSYlPAU/clIU9IIGE3d9ZS1aXOBwXjjYBXWUXa3KK Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="364922123" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="364922123" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 09:16:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="1003006466" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="1003006466" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 09:16:09 -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, hang.yuan@intel.com, tina.zhang@intel.com Subject: [PATCH v16 104/116] KVM: TDX: Add a method to ignore dirty logging Date: Mon, 16 Oct 2023 09:14:56 -0700 Message-Id: <52f1c63c3891afb42ebe1641e72b1e5057ce24fa.1697471314.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=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 16 Oct 2023 09:34:15 -0700 (PDT) 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 5e4091dbf1e8..06eb0896a87a 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -843,6 +843,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)) @@ -986,7 +994,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