Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp172520rdb; Mon, 22 Jan 2024 16:19:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYXlZaGGwOo0KdlKI2HAn485L+1lUJwDs/mrfJG3HGsBNbRXDC/AqpA3VFOBUqXaZx5aUO X-Received: by 2002:a05:620a:4511:b0:783:81cf:182 with SMTP id t17-20020a05620a451100b0078381cf0182mr6717261qkp.105.1705969191587; Mon, 22 Jan 2024 16:19:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705969191; cv=pass; d=google.com; s=arc-20160816; b=VfbGzfmXNBoIzcM0tf9PAJ9Ab4dZgucyeKB4DJllDX1KKlH7Qc/Xw2yb8Ir+1yjvM9 8RPXNj5PHT5fdQvy5AZqcUmFkC55HfklD32lO0dqgScXw55r+tbrL+P4qL80t6VfwHTo RspI9aP23Oyct/wvj4EHNQTXQCciPBBAIUt/IaIZ6iYeXp+Xbya68sKLxH9ks1ixuolz 0ulgPLCIwYnMojGprPAW/0T5MUyfxewDXHu+w3W2EP/95po+ZCRn5jGqqxDVdhtywbEU vXFyry0/qtab/FKoiRDs+z9qi1VgXuMc2idJxJu2+D3btfXCW8p9RBKShYrFa9L7xi5/ mIsw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=i7opXquske8aLT6RbFSQROKXwT6ypXl+yKZ0WIj1rq4=; fh=Itbyk7CEvizIrzGEESCqq3I2tZgG1kc/GkVOa3S7Hsg=; b=tV3YQp3VnAwe/oKTb3wtE8taFc2N/lU+ahqQ0/S3cqueFQZJRY1H8MgfVc1L1SnMwK fAXB07N6L5gMKZwdT0HP5e/f3gXGBYFed6/bGh5Uc1xVGXuoFq5LeyXwsBC6KZ8RksL7 C2kdmYsSOLmnRPn7sxz4MVpYCPRmOvdMVHvjZ5ZCnE3VpOidozJ3AO30C5X2JwKWScrs ENsu7GiHpYx+RX8bMVXtPCmyBc7qCFfa3K5ZcbLvFBt6Pd2Gr/+GGDzlIf3XC+ijgt3i ftWs2pzkL7foy835Sj18eM/gwoXM65dGCg36JRnnzDSyhRYDuz7WGEDVtHzh6vxnuEju R6Pw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZLpk6URk; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-34420-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bp15-20020a05620a458f00b0078388963630si7288378qkb.515.2024.01.22.16.19.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 16:19:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34420-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZLpk6URk; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-34420-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 571FB1C26A1B for ; Tue, 23 Jan 2024 00:19:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD36680052; Mon, 22 Jan 2024 23:56:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZLpk6URk" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C467F7E782; Mon, 22 Jan 2024 23:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.55.52.120 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705967773; cv=none; b=aKhjqHtxVMPVZwePH3TBOajgsJsKI6EdXqVJ6LZE9R9eI+56mcpH7rKTFk9Lz7JUhbAl4oYE5ZqFGOqULFrJc39R4e+TGC+iQWswI7hjptnSfL5vyw/KmAIoE+U5RguZF+OoREpqFCX/eu2MmpD3HUH9pEFnJwtgR6bUOmgc7ck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705967773; c=relaxed/simple; bh=b4HChfS3CX9Tl5Kt2Ghy8PbdVyNqBLVx0mpCgM8SJc0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nRU3O/oBX/hgNE6e6hoKUT0M8wv4lrVhQvIzmg5CkMy5DHKMTsgxZpYr9d1rbW/3HloFZ1gFbJtIQG05kMcB+Ti9Kpn8PmWxnT4tAjR8wMvJAuDOOURHWqSsYdSkunF7yAoyebfa/cxiP0Am+8G7OwsKtE2zQS/cfCYjkTF6HaQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZLpk6URk; arc=none smtp.client-ip=192.55.52.120 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705967770; x=1737503770; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b4HChfS3CX9Tl5Kt2Ghy8PbdVyNqBLVx0mpCgM8SJc0=; b=ZLpk6URk9lVRrpt9ubH0HngVuyMHnPCTwZ3TX8boQt7rABAX5efrtN2F fEoEVKa+45tYRjzANhKnNz9wBSL8lqscZ7BDOgdTuSt0YUKfE8fYFlQbx YawNBbifUy4ro8IkfpxiPb1kiubNWceOumdKmJ1nJtHf1UA/F095+ll9z awnLbrPLBpEH9a0sGPFBhpBVyMBt0qXFMHNRG2IJg+Fh/NhiwanYVQaFD e7KbGZy8JrCJn/d+CtFyeZ81DwqqHdTWis7gafFevF2eDbKEITTgUgnV4 XhUlkDf2XgxZOcEXHQkHe8twiQFTTN3WN5qcDsnbzkJE5BRZVJXgLLE5J Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10961"; a="400217921" X-IronPort-AV: E=Sophos;i="6.05,212,1701158400"; d="scan'208";a="400217921" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 15:55:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,212,1701158400"; d="scan'208";a="27818014" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 15:55:56 -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 , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com Subject: [PATCH v18 109/121] KVM: TDX: Add a method to ignore dirty logging Date: Mon, 22 Jan 2024 15:54:25 -0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 420c68330e61..c9f72c383eee 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -847,6 +847,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)) @@ -990,7 +998,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