Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp642585lqb; Wed, 29 May 2024 06:43:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU+eJ0CK4GocU8BWOeBvc+todlti1+q9fVAld0rohah8qbbTXKBJ3GOAniQu2JIHhyszTuJQD903fQ8M9qKA9ZGNWrJhNjQ0VyD4Qartw== X-Google-Smtp-Source: AGHT+IFENwMf+ZDhm9F+YtHKJfBDK0+4j6mbuz09++u9jAFK0cPwxpdmUa9yoRDX3tdGC3sL+0ZD X-Received: by 2002:ae9:c317:0:b0:794:cdc3:949a with SMTP id af79cd13be357-794cdc39a7emr521469785a.78.1716990226557; Wed, 29 May 2024 06:43:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716990226; cv=pass; d=google.com; s=arc-20160816; b=UZ5pyVvBIvcWt/THNo3+jWunWBJwZzffSQOMI95U9qFiLY/jGNrfKhJJKlxeZeeoZp UcyQBKXyZPJeAxGbFTcWFp7MX4CcqP7IwyUQOmMl0iHSEIISn82VSZcNymV8KhdtX2pc EQyRJtvtYmDwQjUjXS5Dcojre5+Ug9XAKltdIyNMaa75w52/Jne2rgNPL3yg3SESnBs4 jTWI3s+ObYKUdbGlGulpS0VRRv5wNvkwc2MZmzGXGBXn2maqG37VgqPefbMYOJzyV7Sf +AqyWKbtgL97il1Y+1wp2qP+1wkWm9wFZnpbjyrhAbP+hE4BxyMXZkL600zb7B1pVpZI mxbg== 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=lv8BQSShjg4Dz52Mj5aHq9Kg+QBRJU5hl3mk1op9xJw=; fh=NxmCHexitX7P6x/7ARv3vZBmyAUGQGWkF2RSnxwWsIo=; b=Iaf7PA4NRfOiMqEsQCpqlwLdc/AziRDQ9h8iLCdyPkf1u4StGmqGWmWph98bMsYjDg M/tUTADmS2f72AkItZl8TLaLyh0xddnIme4vf76uBotf5AtodtL2uwh6bHvVDxZojL+S o5ApiUEVq7R4TnXOLOtu02aNctFqZZwhUPbfRo33NrfEpO3oGM6CU5yrjQVeIigJwY2C wpQBLjNVm1Xk1funcbk2+Yf6J3guM2X5XfN9XYQWmiL192LaCFbOCHV0XcUlThr2uFxU A9SdPjcZd4sEfNnwehQbUxm8M8A3lrywdzjLpbb216Ga/sKgRpHhatN/oqnZBLkMjfcf w8Hg==; 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-194187-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194187-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 af79cd13be357-794abcac17bsi1259131885a.100.2024.05.29.06.43.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 06:43:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194187-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-194187-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194187-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 4AE341C23E83 for ; Wed, 29 May 2024 13:43:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B15C1B978; Wed, 29 May 2024 13:43:37 +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 9115E18E28; Wed, 29 May 2024 13:43:35 +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=1716990217; cv=none; b=QTbOnYGD3AM0aWz9b5xU76nqfWlnxsAxjF+oJoRs+tzfMy0hpzK6czL/pP/BMi+PBEh07GeJtPd55oaN4Q2MkJzzJNJf/1P7mXi6KTLpBIMPPS4y/YsfKBFECxqCg1M8a8z4nSxmk37FlH6Q8PdwjFtKltmmqmrbUE7Hzy0lzSE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716990217; c=relaxed/simple; bh=ZY3liP69UN7Ja5MApkNeUcus0/69ho7Ta549R0hBqbM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lkoFa/cSIaJM0wWTBK2vHw+aFmnm4kIZPjBIMsPlPL6HTKjjsnNrSB2o1kPHr4nKoKo4Cg0d8Pv3CN2Wr9/64ely64N8qLLtdGEJdkaqwiE22P+QICkEKAWp0u7ntkyzUl2vdMAPW7cCPcEPhKOXO3/Azv39NSD/jIq4RoYWLPY= 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 4Vq9Tg4cqVz6J6qR; Wed, 29 May 2024 21:39:19 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 6EA9D140B3C; Wed, 29 May 2024 21:43:33 +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:43:32 +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 17/19] arm64: Kconfig: Enable hotplug CPU on arm64 if ACPI_PROCESSOR is enabled. Date: Wed, 29 May 2024 14:34:44 +0100 Message-ID: <20240529133446.28446-18-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> 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: lhrpeml100001.china.huawei.com (7.191.160.183) 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 Reviewed-by: Gavin Shan Signed-off-by: Jonathan Cameron --- 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 5d91259ee7b5..e8f2ef2312db 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 e0e7b93c16cc..9360ba86678b 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -423,6 +424,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