Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp593683lqd; Wed, 24 Apr 2024 10:55:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVVj8dnrjO/0/0bDR4bZHhqZIprXbSmDm6jJc6ztn9Knd4NxQporInkJ1/Ah4AuHsx4vZaIAXQLomhltRO0kEPvDknTscLXHJZ0xvAWwg== X-Google-Smtp-Source: AGHT+IF3rqnyIxnOutoPu6lOqyJsDArVO5UdxqlDT8kcX9kZ80+IqfsG6q0C4nJVy/avpqi58rOF X-Received: by 2002:a17:902:ce83:b0:1e4:34f5:4021 with SMTP id f3-20020a170902ce8300b001e434f54021mr4244493plg.5.1713981349917; Wed, 24 Apr 2024 10:55:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713981349; cv=pass; d=google.com; s=arc-20160816; b=klVrlHTiCMtqFDKlQVKOKPphno9wKSisfNeULnZ1MMDfeuXUfFJDd3rNzWrqtXHoUi yc/iF2SmWMsHNZv/BYo39xCkbRinMWXDUFe/lW5BnNtS+ttQVU+Els+h2Jns/sEEy02L SfDWlDZLdrA6k7TjZ6cL4h9Nf1dkL45YLrqu2jtJpgQ7gYnH584iI7PwFbNmNyZXd+lD PQtXgOqYyXA6okz5jzMUe1ep2PWC6wBrWUro8L1Fi+6BUttiiLd4yNGu6ey3fV+9EGFK HSiuY/SUkfdaJEaUdO0Gv0EBO7mzoEKaFXY9C2ItOkJ0hCKN2TDJVw/wbc3463dksBr7 PSXA== 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:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=WkAqeeofYCPxeQh31kaltYD1Ooq/W7O8yk5T9HEKuZc=; fh=RQXTm33KvI+1lPyqaP6x9TeC0QZ/hNtrweTtJTWLLdM=; b=lsZhOWhqSUx0hZEnWYiRdqlaZKTCWKwKWBtGCpBkxfUS8YL3vAd73LZlRArhOIxz/O DIiOcuMBHUaBhj4ZZUSJYpN0rvxQnbS+dmF20UHXsEl9+FZ0ADQQ9uLIghrAavo+ulJx NMl6jZkWb+wKiPUAaYJf+8CkA9aIX1YaWwzLJF3ZtRwCa2XrMW6G7NOFQvedy4gb6ly9 S+vNYTtVZAtHG5nCJdvK/OhlVSAOQmstlHC79x1Ax3ujaRR/FWDzF6AVCV8530Y4+UA8 3yU9XlvR8fwYpCm+WzCxh3htTYW7SaA04C8y596js+rye4AIilWyYrQRMiLlQgFjflwq yEUw==; 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-157396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157396-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 d17-20020a170903209100b001e528f373edsi11244140plc.602.2024.04.24.10.55.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 10:55:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157396-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-157396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157396-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 64F88B2C64F for ; Wed, 24 Apr 2024 17:27:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 538DC16F823; Wed, 24 Apr 2024 17:24:56 +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 5A53416EC12; Wed, 24 Apr 2024 17:24:53 +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=1713979495; cv=none; b=IL59b8+N8ryYAjQZeAJG8C2cljknJdVgpwVGLR8x3DQ5Ec8NAydCKIhwkE2XIo27FXSqbc71jR9p66V5QySF0ENMbPYIRe6cnDQFyepv1d5i3LteO8bWvGs6JY/02W/dzstG+9+ULTc5kH64m5aa/tyAMAAHASUdYiCRYu3f2jY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713979495; c=relaxed/simple; bh=LKqpVipEJ5RO7oa344mviLVllKDE6mTQjJzr3s4gB5I=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ndfz/xkRVSZfGvdr0jKWg8ap8eZZ1RVWwBjvtkprlWF+Xjw60qjVs0Kajov3UByuTWOFaSJWHxvvbqG1E4CIBT7Iw/hhGhAuhdEG+4n+BKpPy2RqEwMq2F35CEdM9OgBCQ4wHd3HB6+gDTn7xRM5yY7pJI0j1Uj5QWXanO61aeo= 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 4VPm5J2bxkz6K6Lt; Thu, 25 Apr 2024 01:22:28 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 30DCB140A34; Thu, 25 Apr 2024 01:24:51 +0800 (CST) Received: from localhost (10.202.227.76) 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, 24 Apr 2024 18:24:50 +0100 Date: Wed, 24 Apr 2024 18:24:50 +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: Re: [PATCH v7 14/16] arm64: Kconfig: Enable hotplug CPU on arm64 if ACPI_PROCESSOR is enabled. Message-ID: <20240424182450.0000694f@Huawei.com> In-Reply-To: <20240418135412.14730-15-Jonathan.Cameron@huawei.com> References: <20240418135412.14730-1-Jonathan.Cameron@huawei.com> <20240418135412.14730-15-Jonathan.Cameron@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml100002.china.huawei.com (7.191.160.241) To lhrpeml500005.china.huawei.com (7.191.163.240) On Thu, 18 Apr 2024 14:54:10 +0100 Jonathan Cameron wrote: > 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. > > Signed-off-by: Jonathan Cameron > --- > v7: No change. > --- > arch/arm64/Kconfig | 1 + > arch/arm64/kernel/acpi.c | 16 ++++++++++++++++ > 2 files changed, 17 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..a74e80d58df3 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,21 @@ 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) > +{ There are shipping firmware's in the wild that have DSDT entries for way more CPUs than are actually present and don't bother with niceties like providing _STA() methods. As such, we need to check somewhere that the pcpu after this call is valid. Given today this only applies to arm64 (as the x86 code has an implementation of this function that will replace an invalid ID with a valid one) I'll add a small catch here. if (*pcpu < 0) { pr_warn("Unable to map from CPU ACPI ID to anything useful\n"); return -EINVAL; } I'll have an entirely polite discussion with the relevant team at somepoint, but on the plus side this is a sensible bit of hardening. Jonathan p.s. I want all those other cores!!!! > + return 0; > +} > +EXPORT_SYMBOL(acpi_map_cpu); /* check why */ > + > +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