Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1378230rdb; Sat, 3 Feb 2024 04:11:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEd3DwuKSs+nI2nrvuky/M1OOGNv7zah25NBkWsHPfC+8dIDE/SIfry+JZE/pLGbjEcCFud X-Received: by 2002:a17:906:190a:b0:a36:7608:8f91 with SMTP id a10-20020a170906190a00b00a3676088f91mr8301100eje.6.1706962276691; Sat, 03 Feb 2024 04:11:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706962276; cv=pass; d=google.com; s=arc-20160816; b=PARd/CiuHKKn7V7EXg5f7hKRtIea+hNVLqX0RWM8M0S/nYDfekFnQvwk2ZNxoGJOt7 kbFyBUcytKf4CiYxPOiIsKa5cr/XI81lpyyAT6gomw/veD7EFTosIccj/xi5I4QUyViU 7cXYMxWP4AUzYidlwhsGJr+OQQ30268/viSkvE+Sh48n+umqhjWygJnp9Ei12Rb5nK0K ZzfsL5LchWV1GhEYWqY5rpHD7BhQ8DjPLfg478RB8FhJU+AylMm25GxoqAD9fqCyS1cN pBHYZFnlc/5b1ZnZgU+Ml6P8jtGjkxBENKln3FSpAmK00P4a1GCtZPEfyeO+sRLvcS+M C7Zw== 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=u7iQHIbBvtTKzSPzobrhjZTLXH+UzZsELcRawFJp4Ck=; fh=12r9kjpQahKzVz6c/PicB0A81Et5VnM0tIZC+3GYbSg=; b=S4ZDHUaeJOeYgC7xM5x1p5Vc+kZdRCDIZQiov4P/xpgMS+lyOZeW4/c/XB6RVNsT8V 01XE9gy+nvuaYqjoqMRIams+Bey86CH0mWTxrrUvbKU8Bs9cIjmwsWUUgpAgp2Nvcb9U ae8w7qcR2SIweU4COILQpUD2ZI5SrScg5kCOQn5fJOb2H7/N/rGJljO3nCs3FSmJMo3y PWljacQAdrMXR4JTS171CAfjnIgtm9yaHVVKbsWypyIBXOPTMtkXwc3bHhQ7R0wfeSEI LOqvWXhPd08lgIr19rPZOe844/yQTpSBdfsUjKZhwwqAxIpvZD9gQ8jAVkFys3wQwvI1 4qaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AWRm4P9l; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-50995-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50995-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCVBB5YmBiO4rtj6gkLIwgPDjX3K7RjjQ1G8gPRvLKf+a27rYNtFg3QqYwqt3ccCnYgUi4mZ7sUatND9LbrVovMm11+RTvxno89zIcPXEw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id fy26-20020a170906b7da00b00a36679a1f05si1826144ejb.934.2024.02.03.04.11.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 04:11:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50995-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AWRm4P9l; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-50995-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50995-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 86C1E1F22E03 for ; Sat, 3 Feb 2024 09:06:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 45BDE60ECD; Sat, 3 Feb 2024 09:01:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AWRm4P9l" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 EB9C45D489; Sat, 3 Feb 2024 09:01:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706950886; cv=none; b=hqfQireyjwqG8rMVmn70vqkSPtYmPr6+y95c9cC4zpNyPlqkPI8pteJ5dtfA1y3eqc1aOY3a8jWcabAKRwsT6Sd1zU/puyTFivwdAQWiflqF3eTyYw7uDHxnbN/1kBKtzRvbk5594gUDcCJCrb6B7lhh6tCUtq6eOOG9bdubNtY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706950886; c=relaxed/simple; bh=SMoF3nIPJhY2CvvIts5nS/Mk2TwIlNjiRdux5w3q9k8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=L7e0QZd/iimOaJ4hsH9HHb+Kw7D9wWlFTsHEcEbf7RmGAreprzaUFaInu8pGbog5L844+lHDd+uSHwSEK1ouAifXE7iOs4KsGTOc/ixm5fjMkK77ZsU1bIy0k/DOUR18r4aCT92d42zF9BqNyjJu6QfQBEDlHQ3p/pjoIfq5xGs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AWRm4P9l; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706950885; x=1738486885; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SMoF3nIPJhY2CvvIts5nS/Mk2TwIlNjiRdux5w3q9k8=; b=AWRm4P9lOt9jckK0W6gew+9NvQoJCEKUaNX1QZvA+GPVwjjGfwPc3xeF Bmuq7/zV05gFQQJ8S0ZoER1p0C77FBuQ+7LWgh1gMgXFvaMh/qHKgdm8o NE2qS4A/HESDHIQPVfXSmIBjkFqKpf4oNTT+Y5p6xjSo0r/zrGtvW9zZJ ej0ueyTlte1W+ROoNk27EhYW6uKxwNZVKSExFSl1mdpCADYgNOcHa7V/W lTdCaUknK8FuwX+djLi0oBdZzjcUfpZDfwEiLZCadmHntxdmzZ6HagHp0 Rlpny6jWxckhzUdAr19vGRC3++m4Xb0q2lskJ1P+ZCl+CQWqBL15D31bC A==; X-IronPort-AV: E=McAfee;i="6600,9927,10971"; a="4132070" X-IronPort-AV: E=Sophos;i="6.05,240,1701158400"; d="scan'208";a="4132070" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2024 01:01:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,240,1701158400"; d="scan'208";a="291478" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa009.fm.intel.com with ESMTP; 03 Feb 2024 01:01:17 -0800 From: Zhao Liu To: Paolo Bonzini , Sean Christopherson , "Rafael J . Wysocki" , Daniel Lezcano , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , kvm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org Cc: Ricardo Neri , Len Brown , Zhang Rui , Zhenyu Wang , Zhuocheng Ding , Dapeng Mi , Yanting Jiang , Yongwei Ma , Vineeth Pillai , Suleiman Souhlal , Masami Hiramatsu , David Dai , Saravana Kannan , Zhao Liu Subject: [RFC 17/26] KVM: VMX: Allow to inject thermal interrupt without HFI update Date: Sat, 3 Feb 2024 17:12:05 +0800 Message-Id: <20240203091214.411862-18-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240203091214.411862-1-zhao1.liu@linux.intel.com> References: <20240203091214.411862-1-zhao1.liu@linux.intel.com> 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: Zhao Liu When the HFI table memory address is set by MSR_IA32_HW_FEEDBACK_PTR or when MSR_IA32_HW_FEEDBACK_CONFIG enables the HFI feature, the hardware sends an initial HFI notification via thermal interrupt and sets the thermal status bit. To prepare for the above cases, extend vmx_update_hfi_table() to allow the forced thermal interrupt injection (with the thermal status bit set) regardless of whether there is the HFI table change to be updated. Tested-by: Yanting Jiang Signed-off-by: Zhao Liu --- arch/x86/kvm/vmx/vmx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 44c09c995120..97bb7b304213 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -1616,7 +1616,7 @@ static int vmx_build_hfi_table(struct kvm *kvm) return 1; } -static void vmx_update_hfi_table(struct kvm *kvm) +static void vmx_update_hfi_table(struct kvm *kvm, bool forced_int) { struct kvm_vmx *kvm_vmx = to_kvm_vmx(kvm); struct hfi_desc *kvm_vmx_hfi = &kvm_vmx->pkg_therm.hfi_desc; @@ -1635,7 +1635,7 @@ static void vmx_update_hfi_table(struct kvm *kvm) } ret = vmx_build_hfi_table(kvm); - if (ret <= 0) + if (ret < 0 || (!ret && !forced_int)) return; kvm_vmx_hfi->hfi_update_status = true; @@ -1731,7 +1731,7 @@ static void vmx_dynamic_update_hfi_table(struct kvm_vcpu *vcpu) * of the same VM are sharing the one HFI table. Therefore, one * vCPU can update the HFI table for the whole VM. */ - vmx_update_hfi_table(vcpu->kvm); + vmx_update_hfi_table(vcpu->kvm, false); mutex_unlock(&kvm_vmx->pkg_therm.pkg_therm_lock); } -- 2.34.1