Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2073615lqa; Tue, 30 Apr 2024 07:33:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUdLMrx3heYHxXlAmPskU+itZeUTeJ9RpSZaXwsdoTZ8QTCupWm/XEEiVFAPzeYOCFDDENwoQWMoncgJ2hOsOE9/vjWbWNkMSxazSInNg== X-Google-Smtp-Source: AGHT+IGyTNCXJ4FoBGRevyhNKgj+A/mEzrp9QRK7nWCD5jwJ4rEYfR8SSphFKzxChZoXjOZ+49Ia X-Received: by 2002:a05:6808:bc5:b0:3c8:63a6:eb5c with SMTP id o5-20020a0568080bc500b003c863a6eb5cmr11108243oik.51.1714487581409; Tue, 30 Apr 2024 07:33:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714487581; cv=pass; d=google.com; s=arc-20160816; b=AdSh2aVTSzT368oupo9At/dHXTXcrRI0jcnFNtaYV8/cODmgvY+3IZVvvsmxJDdfkJ 0en0b2nnB/0wWpcYOZd5VMCKJ3/+bpwJs3BX3pI5VDe9U+dMBUES54wRxnZ1rD/2zlUH yugUQkD+NhjMcGrNzdcx6bvu5U2zkeLTVWTCc5INbpQYeZJknarg2gxe+KRfuR7lgZcT FKdyqq1f5fdVVRCoYT8DDhGLAPwA8fMlY2wRLfHf0bsNta/nEJ+h3qCy696P8G+s35Vq Nyx5bG6SFvTFmePdPArFfs8DkLCnbgU1181NlqT54DAG/2FfbDoymjpc53wvXbyawHI6 CwFQ== 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=1M6i3HGXMcEIc1Dz/K6YTPeXgNdjmz821N7blH5VACk=; fh=25IklNjpQtm3+ZI4w1ifckV22BkO2b6a/wyTwiBBJrk=; b=MbUeKETnGPKI2UMCcp8tB+XkrauMDOXmThgEOfHemdxTD/D2DhtslpxUbBe/h/hcI7 Pij/u7VdvjNO3wzmdzvtGhXxHb/PUPVqbNWLc7GT12VB8LeuJgS/fDi0ifGFNCq/KpCW ReAk6D9DwAgvpedXkMiEXQkwQJdthk9nXn/DUNzHUZtZ1WPSNRdyzwTbPwXYu4v9ASrb CTtj4hhKv9s2JvFE+6uA9N4u2fdP+5xraY32AZhd/FYDrhfRetd2QM8US9nAQ0cNjYmv 0eO/u8E3BUS71ELo6Bw66wREvQcG/5pPigXBYRAuahgsWiYBEyBXSY//2/OS3rXmWnpu jNNw==; 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-164141-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164141-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. [147.75.199.223]) by mx.google.com with ESMTPS id ej13-20020a056122270d00b004d3db398b1asi5040242vkb.282.2024.04.30.07.33.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 07:33:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164141-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-164141-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164141-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 0780A1C22638 for ; Tue, 30 Apr 2024 14:33:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D3C14180A69; Tue, 30 Apr 2024 14:28:15 +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 098A917A937; Tue, 30 Apr 2024 14:28:13 +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=1714487295; cv=none; b=kng3+hRGRfOYgePQOnkRu+gmq7l/7xABYPPvhAwVIa1FT31VD6SqiaYl/4B+8EuPljwL5O7o7SMCHXUo8oEhdxBHwkM7wIwHyeaYZVAsPyrkITGCB/XcuDkGhONDJzugdqDZyFbzGKbmpi/P3nLmKgfaer41/hcgQoeFpLR0j5c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714487295; c=relaxed/simple; bh=qDUzDEvOwALFMplHXhr6s2QRgw6hWlnhN9uiwfU6bvQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fXDSRVbLISxTtE1VutgBUa1L36Y1yrzJvkwTXDjxAB9B7c+IWiAO7fEZkATKZiXogiFQYqg7BSwaoEcTfvIe0lw5hdM4Tc1Bf9VSJE1fpjdGgJoffs5jicYzYWPgf2ugY/akJ2TLbiG5O64+twOk9z6BMws2tGh+qphGJu1bd/U= 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 4VTMtL6yc3z6J7Mx; Tue, 30 Apr 2024 22:25:30 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id C3DED140A86; Tue, 30 Apr 2024 22:28:11 +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; Tue, 30 Apr 2024 15:28:10 +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 , Gavin Shan CC: Ingo Molnar , Borislav Petkov , Dave Hansen , , , Subject: [PATCH v9 07/19] ACPI: processor: Add acpi_get_processor_handle() helper Date: Tue, 30 Apr 2024 15:24:22 +0100 Message-ID: <20240430142434.10471-8-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240430142434.10471-1-Jonathan.Cameron@huawei.com> References: <20240430142434.10471-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: lhrpeml100003.china.huawei.com (7.191.160.210) 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 Signed-off-by: Jonathan Cameron --- v9: Tags --- 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 4a79b42d649e..e8cbe0e40dd0 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