Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1185764rbb; Mon, 26 Feb 2024 01:07:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUmPbaubYOfckPCighUAv29wAwRaKT/+U2lNqjWjJighlcZPF8U4+dmeU4vDS4vT+99tuWX5NUrPry22BU2cNmiaaqVUlBCU/oUHqTMow== X-Google-Smtp-Source: AGHT+IFmB+dfLncnKN3pZ4ckwoPNnsudcdxI3eCF6QQqkFsWL9EYkz9qhTs3feoG1BbttfoLnnAy X-Received: by 2002:a05:6a00:2da2:b0:6e4:c5a1:e41d with SMTP id fb34-20020a056a002da200b006e4c5a1e41dmr6668024pfb.29.1708938471860; Mon, 26 Feb 2024 01:07:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708938471; cv=pass; d=google.com; s=arc-20160816; b=vsRLE9P7U57XMfSd7KKfijZKZMlK+wQ1m+fs5/XxD65V+lcyqqHY6qFowMyeQpS1I3 X/MjD9lqw/Ej/+hNfzvooZP/gJ6njrmzPjuDzWcPasDr5/kP83Qh2HinwlaQ4ID8hAF4 FktkfXRZ4Gt2IHTSFV2zhe2FU7BhVq1pLdNt95ZYxO7jsn63tAH/q1PL6zMK1YnUc3Q/ Mpx4X0ildUL5S8I6nOarlss8hAGnWKPpfTjUsvihZmCxUw8s5enLfApdkjFfvalqB2SV 4Sppb2s4JXdKQd6Ud2znfrsEJmO+NZQFhrDKFHEmuopHVk91J8HkdiMROWq6yZMtP/Dp wM/w== 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=eVVWxdeAoBT/mYbPU7fUY/7nYVKN5Fu9rIrME/BfJJ4=; fh=Itbyk7CEvizIrzGEESCqq3I2tZgG1kc/GkVOa3S7Hsg=; b=DCI/vMz2MoHMEXz66l2L7t3k2F3OBy1CV9jAMZ4F0BHOyQeoN7eVdik6hEEMDjhdJC a2Fi6W/i7A6ueS+Y+1Kl3BHDQAZPi25LIKYEf8o6LbRdOlfxqwQprbiT1bzI/oq1OoAb o9ABQDuKlxLkXPDLSLXfbr06P4gTYvFQpYZN6rCYciapjKsrqjNYr4wzEmKGTm1vZQhL 1J44m7QSGH8Rix3AAKGN11+55qsXvfcJmOGPAtqzXsIudrLe5MJeJ5awuUuil5dmWNuh Dpuddfwaqyf+49EwuaQIlj3tGhKlgE61JBFDEWc9lYPmf0JhqDVknfOrrYqxJfXqaxfK r8gQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YXl9J4E0; 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-80883-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80883-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f2-20020a056a00238200b006e4df2c9b0dsi3420429pfc.329.2024.02.26.01.07.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:07:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80883-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YXl9J4E0; 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-80883-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80883-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9052F285521 for ; Mon, 26 Feb 2024 09:07:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D446F12EBFA; Mon, 26 Feb 2024 08:29:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YXl9J4E0" Received: from mgamail.intel.com (unknown [192.198.163.8]) (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 C152B12CDB6; Mon, 26 Feb 2024 08:29:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936156; cv=none; b=tGxRkKGUZSucO1Ky80xu3qxjmjgL53ZIx+RrDd2Igafzu4BiBnksw6pbDJFHrfilzjNMMed0OB5GFLarPcvJmOHv/f+q2r0N9tVuG7nLmvtborJPhyZa2Na8MV6kl+Da2ALpfDtUIzx6/S5kVmhCwE0EgX/AOXzaiaXfIInIwD0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936156; c=relaxed/simple; bh=TGyv4NcpisLqfQGp5DS6OP4mOwYZXVYUosr40c4DaB8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pGL7mOF3taQEW5odsgYbkwrvc4toHZezfVEbmlL12UJhHXUjPOIoAbFU2x3xKG3qVvZxdVgdyQ6rN9vs3K6o5kO4XHEGZW2bfIvvqA30t8N+QrhsX6dPboBea+L8vTEQbWCy4ubr2zLwtS73yX46YbRY0OXz6XgsrBl/0gflBaA= 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=YXl9J4E0; arc=none smtp.client-ip=192.198.163.8 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=1708936155; x=1740472155; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TGyv4NcpisLqfQGp5DS6OP4mOwYZXVYUosr40c4DaB8=; b=YXl9J4E0ymHwNWqQG5EXaIl5CRCVWLYXWp6/32LgwB2ktOnl8RJt1lEv xxwNs/y2GqMj2NAd/cnU760vDji553ees3Z3aJKFlAoctBg6vYQNiN9ED +hNUCjuByAz5sHT2OmHsaZGY4CO3E+do/oqjJHW3tNh3MiktuU14s9r9L C/D0vZ5cnIuvaNNg/EvbP/B7uklsYDMIX63WYJrHLgVHsrBMDmt6Yh05p +Lcq8ts1TIJrqJVEoF/dnuLudAV0BGcCHTMw7EWeoa2qvFN4mJ9CBp/v+ 3LF3j6HqZhQGPvkXE+0qX6CVytOojSL0WjCj8/XvwUSSjvgeQE54qJxUL A==; X-IronPort-AV: E=McAfee;i="6600,9927,10995"; a="20751387" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="20751387" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 00:29:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="6735120" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 00:29:09 -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 v19 120/130] KVM: TDX: Add a method to ignore dirty logging Date: Mon, 26 Feb 2024 00:27:02 -0800 Message-Id: <1491dd247829bf1a29df1904aeed5ed6b464d29c.1708933498.git.isaku.yamahata@intel.com> 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 9aaa9bd7abf3..991bfdecaed2 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -834,6 +834,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)) @@ -1008,7 +1016,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