Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp614172lqb; Wed, 17 Apr 2024 06:23:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUWDBJuW4yOYZSVCyhitT+VKoS4b4JK5XpYewRH+r2rqh1tJVuqJ05fTjeOD2tdRBlupTEmI6xcKK/i3ZH9VmN6MBEUfFtvW6q25yKWsg== X-Google-Smtp-Source: AGHT+IFILzA6KFXTrLMXPQo/lbBJDvexvx1VsAoh+45yHTrlOwo0MKTWMaSHcvvIACSjTu4wB7cA X-Received: by 2002:a05:6870:c095:b0:22e:44c:4451 with SMTP id c21-20020a056870c09500b0022e044c4451mr19323033oad.6.1713360206989; Wed, 17 Apr 2024 06:23:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713360206; cv=pass; d=google.com; s=arc-20160816; b=um7XhPfJHCqISjom/VYBBqBqqEuRn0V7oxMeObYVjhmQKxT2yIUIaSKjywYFAxUfSM 0XxzjxGqCtoxKOtrWJi/zqm1UZIzNk1kszl8xYBeNgCg/yenle+5LwhLgq8QojXsDSfo OF02gMYiGWohEuChyMzp+20SufEpkQVCUnbPBrMTMGbfWRbXlzYGkJdlA35pf6JhY7LB VqY59SWtHMX0lo6T4vA2ZP8KRDApRZz/4O+t/Huvw8pw5bg3y1ha6YQctFdqRfgUmiH5 u0wzMmzNVcq0arcFjI/MK0UlPNvE1h3OXTUXIi3ucM96zN54kLIpMKkTeJZrQJu4Iajv faOA== 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=hzUBvCjRstC6BhhghAX1BfpFwhVm+fkpAs2zWj1jytA=; fh=wmH6eZgtoFCyes/zVTYi+VaxxdPmNW9hqdNd8ZTZ4XU=; b=bzey4c6Q07P4PLSXMxQqhsLk8yKWgGoY3hgTr0xQ5bdcfQpOeHIBKilu564U/zA/Vk A7B9MAvVwQOHlODAW8VulWIcaJBR1K7c9Rlv7H0A8fASnZz4hmEYuplieABvbFST330o PQUFtnFbOhPkB/AdsV9E2cI3DaxCf2OTW1cyvG1yXpVFp9Md8MYkGGP/eG0nglQo9i1D V/YPnPeGem8NLwJYGFMW087Le7BhIkJXWwvt3SStLaKsGIyNxDM95ZgW74xLlHo45kVl eAAazqfapAF6Ut/YiDR4LNKY0YHz6wRaCqgKVM0YijTyi0EO5kCMAB7gYbSiOhQ+VMU5 AJYQ==; 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-148551-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148551-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q10-20020a63e94a000000b005dccfa9a75asi11348729pgj.845.2024.04.17.06.23.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 06:23:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148551-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::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-148551-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148551-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C3F5628540B for ; Wed, 17 Apr 2024 13:22:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C8D27140E47; Wed, 17 Apr 2024 13:21:49 +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 9F8D713EFEC; Wed, 17 Apr 2024 13:21:46 +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=1713360109; cv=none; b=NdUAWRs37qMHqeMcKlFiCdD8wGx8+a4VHH9sDKlZCBrJ+urqSOLvvVqmHR+5lsQJWQSJHaSomKSbbLr20QoJNFC0Y29u1auKYLxA3tGKHQW8+1Xe8b6NI5BAJflvuQdoDrf36KHS3LeA6ML5Ay1VSqlKrT+VCYB3GiKPNSEwRpw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713360109; c=relaxed/simple; bh=eKBYCEzsU41Xo7w+LoEtv+RyLGHoOc4XkmKqALxnhfQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cT7RuC0XC+KTlRZQnipIUCdmNLQV4l1MQRk1xFShSFLgURr8fzi0nboxvhpciKH11hzGVUsPEMPi5Gc5ctbKntuNsIwwEP6TQb+L2j3lXN7aEfa+ML8MhfAyAWef9d6RqjOovIGxfEaI0U84nwxsVIXiwMR0Bt1qHnOHj+nu4fY= 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.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VKM2S48bZz6JBLj; Wed, 17 Apr 2024 21:19:44 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 7C0FD140A08; Wed, 17 Apr 2024 21:21:44 +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; Wed, 17 Apr 2024 14:21:43 +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 CC: Ingo Molnar , Borislav Petkov , Dave Hansen , , , Subject: [PATCH v6 05/16] ACPI: processor: Add acpi_get_processor_handle() helper Date: Wed, 17 Apr 2024 14:18:58 +0100 Message-ID: <20240417131909.7925-6-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240417131909.7925-1-Jonathan.Cameron@huawei.com> References: <20240417131909.7925-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: lhrpeml500001.china.huawei.com (7.191.163.213) To lhrpeml500005.china.huawei.com (7.191.163.240) If CONFIG_ACPI_PROCESSOR provide a helper to retriever the acpi_handle for a given CPU allowing access to methods in DSDT. Signed-off-by: Jonathan Cameron --- v6: New patch --- drivers/acpi/acpi_processor.c | 10 ++++++++++ include/linux/acpi.h | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 2c164451ab53..7ecb13775d7f 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -35,6 +35,16 @@ EXPORT_PER_CPU_SYMBOL(processors); struct acpi_processor_errata errata __read_mostly; EXPORT_SYMBOL_GPL(errata); +acpi_handle acpi_get_processor_handle(int cpu) +{ + acpi_handle handle = NULL; + struct acpi_processor *pr = per_cpu(processors, cpu);; + + if (pr) + handle = pr->handle; + + return handle; +} 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