Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp276387rwb; Tue, 25 Jul 2023 15:56:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlHe8zPrsEXztS/q5swuIeS2mqa17bnefJvmnkO+KOoIwz8OQsC1jWYwRM/+lJEn3spveWde X-Received: by 2002:aa7:d0d4:0:b0:522:3a37:bb32 with SMTP id u20-20020aa7d0d4000000b005223a37bb32mr200984edo.1.1690325787033; Tue, 25 Jul 2023 15:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690325787; cv=none; d=google.com; s=arc-20160816; b=yEnBt9a4f//zs+HnNbUe4lDKbKONJmNH2X2kZGXI7mH/BZaNrsQfNd6YOsFb9Ry5Z3 /j82F7utRL26ISvGuV70YV5tSh2oZI5sP8ydy4eiztaF3c/t+XFIZdb3Nuq7wmbeqiwW noC4kdSc/6QQ8YsGX75/l/8HgGOhy9FxZYvyYuuhOvoCxeU69jRtt7iKtndHIPNSLAeE 1wlmQ/jH9JhTCRPmlG6EeQ0G9cPHtTT6aHTjkjsdJuRZdC7wNSPOa5LXaDW+2CCPkBL7 3uJyVZ2tt76x+hy9QuWH5LqKZnOYcyJ0l9YWnkcZ5a1s28lmu6VYhggYOb87xw5VrsvU YdVg== 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=LKo7LmILrv2fizxS+obW9mEWIJdLBAeiU76Hq09B8Mo=; fh=juxwNcA6iKwLISFgUCNwdoIYC0NKLUseq3xZdq25RR4=; b=j+6rUHH9cuATjz+boFg3f3H89xjNB9QJj2iHfF1BM7E34IFDx5q4RuWLz44pp1riqm oWkPY8OSw7xtxchgst1D/amRWNeSvI8E4DEwZDiQTlCuD61Qfjv4DAMs7FMhJUg7n5Y1 YgoMTWXD98jQ7/EUDiooePpXdXeJ2iv7QNDiANvufeE1uA3juPRwBeMu7FLNINYMMd/f aBuhg5WCypfyr5AowubkbVDfQSi/N1vOQIEf3vJsK/NiHithxWZbQ3rX+90vXwm+YXaf 5o3MVzhzYnXiTmA0xi3eBy/h+zl/InYhle3h4LNyqt4kJGUlfCCXQMzanMlgR2jw1Psd bH5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EDgHvTFJ; 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 q26-20020aa7d45a000000b00522561facd7si1171995edr.143.2023.07.25.15.56.02; Tue, 25 Jul 2023 15:56:27 -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=EDgHvTFJ; 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 S231902AbjGYWZ4 (ORCPT + 99 others); Tue, 25 Jul 2023 18:25:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233224AbjGYWXj (ORCPT ); Tue, 25 Jul 2023 18:23:39 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E80041989; Tue, 25 Jul 2023 15:19:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690323543; x=1721859543; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XyzpfNDy09U+StlZT/CFQG86sC3VE7VJAC/TT4mf+pA=; b=EDgHvTFJA+x97pyEmw/oxGrcLpk02rch/PT1MGVlVfn08tbZN/qXDc+d WZN4ejK0JEmE7ZUbPGLKW0O/0l2e4TRlBxBZgpKO3VWXOFAvC4F7QpGA+ F/md6MLUSd43c183JaH2LfsgBhbzxbpI7ngOXolQnMkd/I0w8xROkFEbo 8JgyoLKWwIr81Ef+ltbDIy8YcQfsKecK/PQgcp0RhnMMIu5+DMmBSVIDk C7ySFxR7lwOenUnmgppoCJnwuO8KHEkm3jZgpTJ1blkf5NXe1Gb/TwPhk Vga+k8uIg8R9VxDs3AwKCcC/cCi0J2jrqAQeLjVWjAMW4vHpX9rKy00ou g==; X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="367882758" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="367882758" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 15:16:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="840001949" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="840001949" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 15:16:08 -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 v15 105/115] KVM: TDX: Add a method to ignore dirty logging Date: Tue, 25 Jul 2023 15:14:56 -0700 Message-Id: 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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 fc443afbdbc7..38a782c28b72 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)) @@ -969,7 +977,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