From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 1414A1FA1 for ; Sun, 30 Jun 2024 00:39:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719707968; cv=none; b=ee8nWi1n3eA7nv/9+nvxLKTgyhvaGoUix2dHrhpcMXWoLBF/A6ShYGZLsDfR2SHCeSJhYQseZbZXwmqJ0S5rVo0wvNaA16RUVvjxry/6NRTGJtEJLUhQY20n9pSiRQ8QimB3TU1UZNIrWUXHfZUzFHeN3EjenRWHteU0pgA4b2k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719707968; c=relaxed/simple; bh=tRIoatf77wwm0sxL/U2o7B+pzFe98brwQ+ax4MdYMS0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rt9IeUrOfDTz7qPZ36uZHulMpyhCZ4mwZIXWkyEN6jj7y/eoLRqizIcwt57qwxExaRMqVwCg5WYLPzu4w/6uwX9nI7ucIWbxAb8vCVK6cIa5T1GEmkxq2X1VYYWu10IkehG6FE0tFTOJbrWuI/08eApW7HHbrQdwweSJ8Cv2OFw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KfRZK4lc; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KfRZK4lc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719707965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dYIxGuEXpUSy/5Y6UAVKbTkIJVtmPhwJBZMzOU8+q5w=; b=KfRZK4lcSqzRbNr503YQUYQwDJbbfLFF582zoe1ytj9qgCESA9BZnbvL9vOjXIWXFBQB4M nloklyj8GMYEoWQa37/nWuVAuM+GpZGvnRB+kRyv0XhoK1vJ9gohK9PJvPd5b2BZjKfNaO ooiOXKPxlHVEkc1wteN3X8tHj5FEJvI= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-126-i36h06CoNhShIYCUnVeDJg-1; Sat, 29 Jun 2024 20:39:17 -0400 X-MC-Unique: i36h06CoNhShIYCUnVeDJg-1 Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-2c8f8388f60so1222485a91.3 for ; Sat, 29 Jun 2024 17:39:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719707956; x=1720312756; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dYIxGuEXpUSy/5Y6UAVKbTkIJVtmPhwJBZMzOU8+q5w=; b=L4DnVI9sFUFEjYha7XJCjvq6HXGg2UqrCnif2Q5bMWs17ENOW1WrFEbwd3/kMjchHO m0L8L8DUzcafnHHbe4gG/N8dIZXJS0hsMMKOGOaqHJxkUmjRsRJgYgqDB0HdZW5enQKe oIIu4IUVM85/RTlqq42lYzbTr8wYo89l2hwdWXVPQARGI/KnoIIDUv6PuVKUQLznSJf8 TSrZ9L61Xel68L18C21NjuUjBKkjSTDdwfut0nPBXrOUbYdG12ULP2YRQSESt0yubiwH 36gPsnKUWytqO6Rlj8NqRdh0FSeBFxK1N/Dzn3YskGr7MJ9CQ62Loir5Up60YoVYGEId ylEA== X-Forwarded-Encrypted: i=1; AJvYcCX7Jkjw+o+UdXSr6HtnTZnZJvcEcro7sx7pLdn/SAUoiGdoVVUjM0znUzbcy9xoZHb+j5DbZ8UuPrcfkpixpjIIkGEzJQ3K33wFeNvl X-Gm-Message-State: AOJu0YxbxORn3YCS/XKnL4S6v9xElJ2NddTEoj5OS5WKZa20zL+H9HZ5 GIv0/fh2LfF5LEu6NhqrlftchsUw/GEL/D26ITe0SioXDbkIvqzosJFu5PBXGJs1apcmWOhE4XX nnclkO7tu90J4/VuzLwSxnEW+F2FTNF7eOZfGzB8cP0dn9S35oQXbvwSgVPTkag== X-Received: by 2002:a17:902:e5cd:b0:1f9:d99f:61ab with SMTP id d9443c01a7336-1fadbcf410emr12621605ad.62.1719707956596; Sat, 29 Jun 2024 17:39:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/NdzPye3ofsIgF1rsz62eiDjuN05hA7t2+cnE7758DAdfnF9KWdi//koW+PTHyTmfFFAF4Q== X-Received: by 2002:a17:902:e5cd:b0:1f9:d99f:61ab with SMTP id d9443c01a7336-1fadbcf410emr12621455ad.62.1719707956151; Sat, 29 Jun 2024 17:39:16 -0700 (PDT) Received: from [192.168.68.51] ([103.210.27.92]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac15966b1sm37766095ad.262.2024.06.29.17.39.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 Jun 2024 17:39:15 -0700 (PDT) Message-ID: <47a261e0-006d-4c64-9c9b-bc73797b8d6b@redhat.com> Date: Sun, 30 Jun 2024 10:39:04 +1000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 17/19] arm64: Kconfig: Enable hotplug CPU on arm64 if ACPI_PROCESSOR is enabled. To: Jonathan Cameron , Marc Zyngier , Will Deacon , Catalin Marinas , linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Cc: Mark Rutland , Thomas Gleixner , Peter Zijlstra , loongarch@lists.linux.dev, x86@kernel.org, Russell King , "Rafael J . Wysocki" , Miguel Luis , James Morse , Salil Mehta , Jean-Philippe Brucker , Hanjun Guo , Ingo Molnar , Borislav Petkov , Dave Hansen , linuxarm@huawei.com, justin.he@arm.com, jianyong.wu@arm.com References: <20240529133446.28446-1-Jonathan.Cameron@huawei.com> <20240529133446.28446-18-Jonathan.Cameron@huawei.com> Content-Language: en-US From: Gavin Shan In-Reply-To: <20240529133446.28446-18-Jonathan.Cameron@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Jonathan and Catalin, On 5/29/24 11:34 PM, 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. > > 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 ACPI_HOTPLUG_CPU depends on (ACPI_PROCESSOR && HOTPLUG_CPU). It needs to be: select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU Otherwise, we can have compiling error with the following configurations. CONFIG_ACPI_PROCESSOR=y CONFIG_HOTPLUG_CPU=n CONFIG_ACPI_HOTPLUG_CPU=y arch/arm64/kernel/smp.c: In function ‘arch_unregister_cpu’: arch/arm64/kernel/smp.c:563:9: error: implicit declaration of function ‘unregister_cpu’; did you mean ‘register_cpu’? [-Werror=implicit-function-declaration] 563 | unregister_cpu(c); | ^~~~~~~~~~~~~~ | register_cpu Since the series has been queued to Catalin's "for-next/vcpu-hotplug" branch, I guess the easiest way would be to fix it in place with Catalin's help. Thanks, Gavin > 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