Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp289942lqf; Fri, 26 Apr 2024 06:59:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVL/ydHFxhMF+JDlPmKnZXSmY3mcbnrzzlm0DRSeNRQeceQGtIPXXh/SHZZJ7SeU8XNjqyxF/3jOiieSBlEqBmg3WXrf/Kt/EQQt7q3HQ== X-Google-Smtp-Source: AGHT+IGboIIlwWnjRHux7H3p21Najc8EXhGBco3ZMf0ZP6jrE9vWwFqRS+yZFIfqkVCZhxjT2wwV X-Received: by 2002:ac8:7d0f:0:b0:439:9447:6ed8 with SMTP id g15-20020ac87d0f000000b0043994476ed8mr3254300qtb.26.1714139977829; Fri, 26 Apr 2024 06:59:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714139977; cv=pass; d=google.com; s=arc-20160816; b=PGwrJ80LQZF6lvRLX8jpujMf5zKzPsuXZxQMDdG8pK8gPTkl2mVL3lC7nKLqGn2l80 V/VMh9rt7b/FJtJARLRiPIXM7J3h/qD7EmLDb3RuSLCX7QZWRq1v6JYyESkb9rj2siUi qgvf2rf3kISoZizUH4rJZODvMRumUYVp/IbB2ArBNMv4zB17/O+vNJlz6/foqMMI6U5m kOoO/4ShGOo7LLoYMC1wJUFl4BhKCh9uyBMzyg8VwQB+tdZfCK6Smxt+YW/CX9UzGTjs QQ6ibuGJrfO1pNa9S5xSQo9ptxnuWEfgqF/+5f6ARxyVnyiP2usclwoB+TvCWiNhoGHg /vlQ== 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=zh8vYyix/cuKwaONxVwEpIgpW+dDWDPyS4y8ZOiPgVg=; fh=QfGN+Nlycv3VEqD8X65neWxvyXXboUCZUO7iSMK6eUk=; b=KM9cY2cGXoRFe3IoxyT43LPwPn+YAWMn+Sdh5/h3t/cbjBLoosV+5sN3MaAQT2rZfR SRAsazlRx+dhUdBwRqtr6k5VJD5hiYkJw1LQz1n77fNWN4YMIBG7FdVVLPV/sLMgIWUu pGW9Op0QYnHCwquF/HNw0nIu5Vixiq31L6VbuRfYn19Ses2fHqpFEH0+ptkKX79lTF3H D//s8pGcT45hBlOd0XcWX1NQ8uVBw1Y4A8BdUkUf+io5/9380plJZygr8msCowXGqE1m nECMuXC/WXQle50hgPxSIugsVTwd2F7H9FfqULD02JMU7P8zpSxa0wMzhMubEhBr6Bxc /yBA==; 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-160115-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160115-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 x4-20020a05622a000400b00439eb8fe51fsi9232406qtw.65.2024.04.26.06.59.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 06:59:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160115-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-160115-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160115-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 858FF1C21571 for ; Fri, 26 Apr 2024 13:59:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCF111494AE; Fri, 26 Apr 2024 13:58:43 +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 BFA58148317; Fri, 26 Apr 2024 13:58:41 +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=1714139923; cv=none; b=Ax+MU30b7+Pn1kqzsP5hP1w2mOW6SB7yPJ13mJ41C7ERjEFgkfDB03YofChufmm/0c95eJf8zLPGVeND0dyK5P1MUXyAxCXZCznFl6b4qY4Q+bPBKiqPctvxPdQDd7KncPM+rMKNHLsi/yvRbRoRuJgkMDb4RLDR78UFUEZKYwc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714139923; c=relaxed/simple; bh=kdlYUCV3Md6Cg91FTWPIeZpb+G6UbOiI5GcDos6hRHc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=i1VAw6bIaaMyPQk4xOAhK4HgyrjftIENTEIxyN/XwYoBT8u20h86EJnKRXHbpjNK4vZTG037VA7WabsFjbS0AFQEiJCbksLaR1hRhuMDPyQxWImD5Z/2+DFnba87Fq2ZILcwU2CS2vHzdv3jRLpOE08nTSHy/oXmsBJOJ8hIIh4= 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 4VQvQM0KKWz67Q7R; Fri, 26 Apr 2024 21:56:11 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id C08B2140A70; Fri, 26 Apr 2024 21:58:39 +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:58:39 +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 14/16] arm64: Kconfig: Enable hotplug CPU on arm64 if ACPI_PROCESSOR is enabled. Date: Fri, 26 Apr 2024 14:51:24 +0100 Message-ID: <20240426135126.12802-15-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) In order to move arch_register_cpu() to be called via the same path for initially present CPUs described by ACPI and hotplugged CPUs ACPI_HOTPLUG_CPU needs to be enabled. The protection against invalid IDs in acpi_map_cpu() is needed as at least one production BIOS is in the wild which reports entries in DSDT (with no _STA method, so assumed enabled and present) that don't match MADT. Tested-by: Miguel Luis Signed-off-by: Jonathan Cameron --- v8: If acpi_map_cpu() stub is passed an error code as pcpu, don't pretend it worked. Note that x86 relies on passing an invalid error code in here to indicate a CPU ID needs to be allocated, on ARM64 if we don't get something valid there is nothing we can do about it. --- arch/arm64/Kconfig | 1 + arch/arm64/kernel/acpi.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 7b11c98b3e84..fed7d0d54179 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -5,6 +5,7 @@ config ARM64 select ACPI_CCA_REQUIRED if ACPI select ACPI_GENERIC_GSI if ACPI select ACPI_GTDT if ACPI + select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR select ACPI_IORT if ACPI select ACPI_REDUCED_HARDWARE_ONLY if ACPI select ACPI_MCFG if (ACPI && PCI) diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index dba8fcec7f33..fb9368197c74 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -413,6 +414,27 @@ void arch_reserve_mem_area(acpi_physical_address addr, size_t size) memblock_mark_nomap(addr, size); } +#ifdef CONFIG_ACPI_HOTPLUG_CPU +int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 apci_id, + int *pcpu) +{ + /* If an error code is passed in this stub can't fix it */ + if (*pcpu < 0) { + pr_warn_once("Unable to map CPU to valid ID\n"); + return *pcpu; + } + + return 0; +} +EXPORT_SYMBOL(acpi_map_cpu); + +int acpi_unmap_cpu(int cpu) +{ + return 0; +} +EXPORT_SYMBOL(acpi_unmap_cpu); +#endif /* CONFIG_ACPI_HOTPLUG_CPU */ + #ifdef CONFIG_ACPI_FFH /* * Implements ARM64 specific callbacks to support ACPI FFH Operation Region as -- 2.39.2