Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp639492lqb; Wed, 29 May 2024 06:38:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVmi5TzkMfB0IEmBdAFcPefXTTPoDC82hKsZmi7F7TL69teSW46+757gnGi5HDF8N8HiWkWrcFRbWn0iwLbqJOxxZkM39cZJzNuXziRag== X-Google-Smtp-Source: AGHT+IH0KQ+k0/ARjjNFN5YFZPLFwrcQmgew8+JALAui2WJDDofuA6BjQ6PWpeS8nr6GZmrBEgYu X-Received: by 2002:a05:620a:e8f:b0:794:782c:b0af with SMTP id af79cd13be357-794ab0f83b3mr1354860185a.52.1716989918690; Wed, 29 May 2024 06:38:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716989918; cv=pass; d=google.com; s=arc-20160816; b=G4TW/XFU5yXkAxLbVspdzY/PpndBzlMzgDFlxxvfcdRGuM5vrXvWhLwMG2fcBtCI44 z92BdY3MBSMK+IayEeZdOA9KPWeJkp5aazms7XHHqirVNl7R1zhWJ+34BL8LC7jWzoU0 4G+f7ZsDWdnvHlQnCYjeXpATSgAsB0gP4J/zaSkmXbXEVZ2BbMzT+dVGfBrDJvo6eNOi pRRwY04j9BsCzOQqoM9FtV/Zp15pYig+qXkar3+XD7k1fCEfz6Elz1xMALUXTnLudYlf KANqqC1airCe2XgqtazgHOvi3b4sNROXVZcv1E+SQLfOK5LZgnjeFrkS9CgGtRvD2Rwi rHdg== 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; bh=yPiu+0duex+5wVnM6VUYXYyRksG4kdSRDRhyAwrKgvA=; fh=NxmCHexitX7P6x/7ARv3vZBmyAUGQGWkF2RSnxwWsIo=; b=r2LbzBGyD0WKj93YiV7j2N1+CaDcjCkpsWb/eyXT+YvlGrZeA9yE27tyZu3B3IvUGo 9uNDDYfNMuH5gxTurZVhknbhsEqEx+ANb+FDxbvk+GlqtzsnyTUe2C9QAlKzEyImjF6h 5mzwcnk3d139+YL7kNLWvwriIaLSfnfO/u9gtECcqaccb4ANABiKRohiCsUjPUiAe3Ok nm1yd4ZS9MV0Q+SZ4I1JMaWWpT4S+5sAebHtYHupHEGiIa68+DQizIJHyFeti1aY0xBU 8lG2SGs7hzMwCH5b6CH7qdt2JDKQ4PNLy/ZxUtBJdS8mV9+8x+UI3hB1IkOmxZIAxU6h 5Yyw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-194173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-794abd3d73dsi1380663085a.472.2024.05.29.06.38.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 06:38:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-194173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.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 5A62F1C21371 for ; Wed, 29 May 2024 13:38:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B71614AA9; Wed, 29 May 2024 13:38:28 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (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 9447514AA0; Wed, 29 May 2024 13:38:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716989907; cv=none; b=AIlWDXIf1+SfeDgMuk6YbW0Fv9kzl8Y9ClP9akU5pzbkCep72YyWsbbEyOOCkS7+BG/0Fg2Dcoc6fvT4UW90gWQVqco0bqhVvaBvOeERlYUpbnbcjOugFlH4v2NnoR6fIp888S5wSmPObIApV4XuwPMw7SEDwZdXSbwBkQ6aR6A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716989907; c=relaxed/simple; bh=yx6wFWgL+4ZV/IlKvfT0XGMVimYLKMlnFu30z0Q8X98=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MC6MfVSna+9eyF+AVUM4KFWumnbS5RmzF74+UOAvaeQaqj82efdMNqx2Em5B7hKdhFqhH/lZjVTM3QUmW5JvesNd/l69jKXl/xewteb95cLnJmZr50lZpEdUUDe3cpq83GVJADBlcJvQoOKL9p7at3NRvd1DD5NFPb2m+ajx8Tk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Vq9RR0qVbz67PFb; Wed, 29 May 2024 21:37:23 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id CD609140A78; Wed, 29 May 2024 21:38:23 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 29 May 2024 14:38:23 +0100 From: Jonathan Cameron To: Marc Zyngier , Will Deacon , Catalin Marinas , , , , , CC: Mark Rutland , Thomas Gleixner , Peter Zijlstra , , , Russell King , "Rafael J . Wysocki" , Miguel Luis , James Morse , Salil Mehta , Jean-Philippe Brucker , Hanjun Guo , Gavin Shan , Ingo Molnar , Borislav Petkov , Dave Hansen , , , Subject: [PATCH v10 07/19] ACPI: processor: Add acpi_get_processor_handle() helper Date: Wed, 29 May 2024 14:34:34 +0100 Message-ID: <20240529133446.28446-8-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240529133446.28446-1-Jonathan.Cameron@huawei.com> References: <20240529133446.28446-1-Jonathan.Cameron@huawei.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 Content-Type: text/plain X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To lhrpeml500005.china.huawei.com (7.191.163.240) If CONFIG_ACPI_PROCESSOR provide a helper to retrieve the acpi_handle for a given CPU allowing access to methods in DSDT. Tested-by: Miguel Luis Reviewed-by: Gavin Shan Acked-by: Rafael J. Wysocki Signed-off-by: Jonathan Cameron --- drivers/acpi/acpi_processor.c | 11 +++++++++++ include/linux/acpi.h | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 0bc0419adf6b..56592462d2fb 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -35,6 +35,17 @@ EXPORT_PER_CPU_SYMBOL(processors); struct acpi_processor_errata errata __read_mostly; EXPORT_SYMBOL_GPL(errata); +acpi_handle acpi_get_processor_handle(int cpu) +{ + struct acpi_processor *pr; + + pr = per_cpu(processors, cpu); + if (pr) + return pr->handle; + + return NULL; +} + static int acpi_processor_errata_piix4(struct pci_dev *dev) { u8 value1 = 0; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 28c3fb2bef0d..fd45bfab66b8 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -304,6 +304,8 @@ int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id, int acpi_unmap_cpu(int cpu); #endif /* CONFIG_ACPI_HOTPLUG_CPU */ +acpi_handle acpi_get_processor_handle(int cpu); + #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC int acpi_get_ioapic_id(acpi_handle handle, u32 gsi_base, u64 *phys_addr); #endif @@ -1076,6 +1078,11 @@ static inline bool acpi_sleep_state_supported(u8 sleep_state) return false; } +static inline acpi_handle acpi_get_processor_handle(int cpu) +{ + return NULL; +} + #endif /* !CONFIG_ACPI */ extern void arch_post_acpi_subsys_init(void); -- 2.39.2