Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6921152rdb; Tue, 2 Jan 2024 20:13:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IHM6/NYpg34msHcAunDY6Kr1VX0XucWh4Pt7EqTCwFrOtYdX4fNf9FuxrqjBAhgBfcFe0GM X-Received: by 2002:a17:906:189:b0:a27:edcb:b3c4 with SMTP id 9-20020a170906018900b00a27edcbb3c4mr2243743ejb.137.1704255231352; Tue, 02 Jan 2024 20:13:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704255231; cv=none; d=google.com; s=arc-20160816; b=CYZuN3FPvOfNXu8soOzYhcl1BghuQ8VBbdoCMc4KdSFWGlpCAuRrtWF8nkDXlKAqSx ZeOt3gWrXXcYcwv9Tq64eKGWDYuOkqRDz3hkO+xqJ8VgRRp0JqH0h9WAzxqQzT6PEzXs vukYlFSLapUYHxqFpKSBSXHUpvTEWGxQqsDm9Q+GKN/hfjhv9yB7sR0ftYOTp0/vYGTp 9IvoHeMidWMct1I5cyGvHSmidkLBsnk8Jcn2xhhvbW6iMCl5bwMuC8zII3jgoNfu72wk 0Exw6j64A3t4cn0XpNcV3YsjhaenbRRx2T8HyN0vAbm56x5iElBvgn9HtZAWnDvy2kCK LPTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=CE1qY2bjOxNOx1aYrgCwGka4Gga0z6Y3uQBSTLgkFx0=; fh=Nd6TWr59jSdh9420JNCyllzWGVT8apl3jMyvM+mDi0k=; b=TAGAqDdsE9Qug/aDde4gtfzyBsduuvt1Re2F9GU8A/sXgiQ4Bci/Vpmvpn0e39NVBB acroG8xmX0KTvX3bPcWz1Bp/0WsU6txmj4BaaSGalaUv5up6UWmtbj6J19RFyPYpAlrf q6FVfQXogmu4OUw4J0cM14KBnH8lXxZN2pwQmzXDVkh8e/Fseh5ldsZnkoShC2HEav9V cXsEskExccOif/iHyb7z846kAduXXb+KkxjzqeyzAYLdVyABE78c03ZyxOoWJoK3EIxf XMM8+XslvUdT1KjtieVpqvhuP66C3nl+h/OkMG7vk4R1yR8o+O3ZInZ3Yu0ysJpHzwXy nIEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=im7aiPi3; spf=pass (google.com: domain of linux-kernel+bounces-15147-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15147-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id fp17-20020a1709069e1100b00a26d564a679si8344208ejc.398.2024.01.02.20.13.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 20:13:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15147-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=im7aiPi3; spf=pass (google.com: domain of linux-kernel+bounces-15147-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15147-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 1E67D1F239B7 for ; Wed, 3 Jan 2024 04:13:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3126D179AA; Wed, 3 Jan 2024 04:13:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="im7aiPi3" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) (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 EFC4A156E3; Wed, 3 Jan 2024 04:13:23 +0000 (UTC) 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=1704255203; x=1735791203; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=CMWiWQHsGMeXJZcs0I9WskDpudEecU/JyNdOptgKYhM=; b=im7aiPi3WLW9Pc925krT2FdwOJ6GUePucUt2vFej4lASF0CG5tWyPudI Ej7XAD9It1747SEyPWGdLu6fAfvOU3dDQlgGPk/ehmdiB3XmELtVRdFMD n1DqqC75mdNsihd6i0sgPNXW6Hi9AU+ZQHsEkzZsVtKdGJp7/6NPMqiKw VFKt8yGYEGPh5QfkZG9n9PgrQxPnb7FDNjl7pBEuihbQ0QV/WJ6b5VkHZ kqBuyJHa4lbwrVn+uHTDwazM/VfUfQWwzsWvfMrM1zFWtaA/hBUYYtWXB eQ0BY18W5eVWaRUnaqlPjtkyyVj6BPuM/f2qR776ch/i4Xw8RYPtie56P Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="463357397" X-IronPort-AV: E=Sophos;i="6.04,326,1695711600"; d="scan'208";a="463357397" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2024 20:13:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1026957006" X-IronPort-AV: E=Sophos;i="6.04,326,1695711600"; d="scan'208";a="1026957006" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga006.fm.intel.com with ESMTP; 02 Jan 2024 20:13:21 -0800 From: Ricardo Neri To: "Rafael J. Wysocki" Cc: Chen Yu , Len Brown , Srinivas Pandruvada , Stanislaw Gruszka , Zhang Rui , Zhao Liu , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] thermal: intel: hfi: Enable an HFI instance from its first online CPU Date: Tue, 2 Jan 2024 20:14:57 -0800 Message-Id: <20240103041459.11113-3-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240103041459.11113-1-ricardo.neri-calderon@linux.intel.com> References: <20240103041459.11113-1-ricardo.neri-calderon@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Previously, HFI instances were never disabled once enabled. A CPU in an instance only had to check during boot whether another CPU had previously initialized the instance and its corresponding data structure. A subsequent changeset will add functionality to disable instances to support hibernation. Such change will also make possible to disable an HFI instance during runtime via CPU hotplug. Enable an HFI instance from the first of its CPUs that comes online. This covers the boot, CPU hotplug, and resume-from-suspend cases. It also covers systems with one or more HFI instances (i.e., packages). Cc: Chen Yu Cc: Len Brown Cc: Srinivas Pandruvada Cc: Stanislaw Gruszka Cc: Zhang Rui Cc: Zhao Liu Cc: linux-pm@vger.kernel.org Cc: stable@vger.kernel.org # 6.1 Signed-off-by: Ricardo Neri --- Changes since v1: * None --- drivers/thermal/intel/intel_hfi.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c index 820613e293cd..713da8befd40 100644 --- a/drivers/thermal/intel/intel_hfi.c +++ b/drivers/thermal/intel/intel_hfi.c @@ -410,13 +410,12 @@ void intel_hfi_online(unsigned int cpu) /* * Now check if the HFI instance of the package/die of @cpu has been * initialized (by checking its header). In such case, all we have to - * do is to add @cpu to this instance's cpumask. + * do is to add @cpu to this instance's cpumask and enable the instance + * if needed. */ mutex_lock(&hfi_instance_lock); - if (hfi_instance->hdr) { - cpumask_set_cpu(cpu, hfi_instance->cpus); - goto unlock; - } + if (hfi_instance->hdr) + goto enable; /* * Hardware is programmed with the physical address of the first page @@ -442,10 +441,14 @@ void intel_hfi_online(unsigned int cpu) raw_spin_lock_init(&hfi_instance->table_lock); raw_spin_lock_init(&hfi_instance->event_lock); +enable: cpumask_set_cpu(cpu, hfi_instance->cpus); - hfi_set_hw_table(hfi_instance); - hfi_enable(); + /* Enable this HFI instance if this is its first online CPU. */ + if (cpumask_weight(hfi_instance->cpus) == 1) { + hfi_set_hw_table(hfi_instance); + hfi_enable(); + } unlock: mutex_unlock(&hfi_instance_lock); -- 2.25.1