From patchwork Wed May 29 13:34:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13678874 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28245C25B75 for ; Wed, 29 May 2024 13:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=k9El3YzT9pRdW/baLZAxRhQbe7SJLPwLl4Z80K9Ylaw=; b=HTgNrj2o1nBlJL V4i/QaUNGrTrh24ubYonR4jWII6d/hf0yspNXkF5enpcZ/N6AxearLt9F3IYHoBDIYxJqmk1sTjYY MzoUmBXTWx6mPPKzWq7a5mpF39T7gkVXduOnguji3iodUL6BEglW5GiCFy1PT7M+UtJ3pQZ7abZQh Xf3Dtln+49SWSTy6b95OhQ1zUx4tL0HZFKmYYTfX4DG8pfBddFR3QFefm9xykhfLQxGCc93FOBQT2 x2gXVUbW2B8K0CjicF2bXwqWi4CXppdYTWseTHuI3DajioCYzlHE6OoHTzCUleQmS2+dPeYnhcO0G DoGDDuBnX2XryShm/sqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCJVg-00000004IJK-3dQ7; Wed, 29 May 2024 13:38:32 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCJVd-00000004IIO-1Gf2 for linux-arm-kernel@lists.infradead.org; Wed, 29 May 2024 13:38:30 +0000 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> MIME-Version: 1.0 X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240529_063829_645971_C147C748 X-CRM114-Status: GOOD ( 11.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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);