Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp290131lqf; Fri, 26 Apr 2024 07:00:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXQk/8oZ9IwG6Evps4XeveBl5kHkBcnLd61gHqVWADxusXYa0J5lSGr4hrog0FDLmFO1NFTeU0zWHPXqedVaZC4ya+MgnkEkddRZ2hstw== X-Google-Smtp-Source: AGHT+IHS1Fb7hoM3vqySI28Gpr1f788izoOo+LvGdXvnxGcRZlV+d0FzFrBF9SGwMbXm2CoxsHbW X-Received: by 2002:a17:902:ec8b:b0:1e5:8175:4968 with SMTP id x11-20020a170902ec8b00b001e581754968mr3291041plg.9.1714139999938; Fri, 26 Apr 2024 06:59:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714139999; cv=pass; d=google.com; s=arc-20160816; b=VZB18t940t/ubzUg44E8XgUogMEPgGrR2H3Jc8EKPGgW8WyAXT/+2jHQLScFe3f/IZ JQGWVEdyxqrJvy+cp1ZMOdz3zGDuQQ7lqkmntAaIBmIBqslOcedHraN1i+Be6wiHFZHb kH0YWDrq3qyV6v32g8FWGuenva6KccSiUK8J/zYSwUAQxxtL2TBrpXJyUH06nq01WP/t hs3hP3QyGwMi6TffXH59TlONssK53QfD7g3mM32fP0YsFXlePHyfvP+jhCOHscCbRz6Y 7+18BzGw66oJG56TSAPSkLQacsYjG1bGC+WPWvFD+347UmdWluqNh1uveR8olCph82F4 002w== 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=D3SUrACPCL5Z6LNDR7Gr9PPJOkynx/bZDA2J3jsol5o=; fh=QfGN+Nlycv3VEqD8X65neWxvyXXboUCZUO7iSMK6eUk=; b=Q2FDSOlvmq5L5yp67YvkNMK+Vh17CMYKQ/f4DjQDFg/EqaeT51JU0zIhyomXdsxA0U IgcAvT0Bvb3tiZ6arWvyJQphE2CA59klbwH2fOcZy2rTdzmQJXcx2rAHZ/Q4HZITVEWc NwCIgQkvY0uHCxsXPlDRJdLlFYYqup2c0/HhGcIPu8jvoDR8KvBDPDjtcFToXLDuEiCX rA+CYSVnTjUgX+xHvBSJZJ8vHB7pYPH4gxcl9Ncs92+MX3RzGYWPLBcOOmGpXh6awOho Wnjf5Fe1c7naR1KKzbYamgy83eLDfQi169aMKomClzgvED1kuSQqo7mgVwHtZmf/Ir7u ESjA==; 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-160102-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160102-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b7-20020a170902b60700b001e29ac24838si15084837pls.177.2024.04.26.06.59.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 06:59:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160102-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-160102-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160102-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5DCDDB218B6 for ; Fri, 26 Apr 2024 13:56:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2141615219E; Fri, 26 Apr 2024 13:54:04 +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 4938B14D6F8; Fri, 26 Apr 2024 13:54:02 +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=1714139643; cv=none; b=FlamILIcdV6xpx23ZEn8XHl8d+xeXM9OgF5rgdeuVmc9zDbUCbuQ5ZAYXGS3lEIN+I6nmrsD9QOd6h92bLXVHAAyLZChWGZ/9Rd7tjahDJUwVYhjurSSCUlWlgRPCOh00ndS0wUleUmgph4ub+wU1dl+8hSJYAFb5oJ6zLTvu80= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714139643; c=relaxed/simple; bh=665Art0HiBiadNighBepUpAUtXWYFjHh2RUYuiuQ/w4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C0mSIwv6oZRU1vTCUsdFyvF/SurDETqHBtqI58P4uTcitpvkYNrQKtADBJK0vW3NsjNcrFYp2aqDLZwOOO89TXrLeAWlIsvVP/Zd2jluiDU53wfedt8HRZJJYbAYuABB8cM9TSQW2O+wOqb/G24Qh2R7pTuUqvKxZVLtMWdwrSE= 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.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VQvJz2Vtkz6K6QK; Fri, 26 Apr 2024 21:51:31 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 12BD2140B2A; Fri, 26 Apr 2024 21:54:00 +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.35; Fri, 26 Apr 2024 14:53:59 +0100 From: Jonathan Cameron To: Thomas Gleixner , Peter Zijlstra , , , , , , , , , Russell King , "Rafael J . Wysocki" , Miguel Luis , James Morse , Salil Mehta , Jean-Philippe Brucker , Catalin Marinas , Will Deacon , Marc Zyngier , Hanjun Guo CC: Ingo Molnar , Borislav Petkov , Dave Hansen , , , , Lorenzo Pieralisi , Sudeep Holla Subject: [PATCH v8 05/16] ACPI: processor: Add acpi_get_processor_handle() helper Date: Fri, 26 Apr 2024 14:51:15 +0100 Message-ID: <20240426135126.12802-6-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240426135126.12802-1-Jonathan.Cameron@huawei.com> References: <20240426135126.12802-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: lhrpeml500002.china.huawei.com (7.191.160.78) 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 Signed-off-by: Jonathan Cameron --- v8: Code simplification suggested by Rafael. Fixup ;; spotted by Gavin --- 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 3b180e21f325..ecc2721fecae 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 34829f2c517a..9844a3f9c4e5 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -309,6 +309,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 @@ -1077,6 +1079,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