Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp476270rdb; Tue, 23 Jan 2024 05:39:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCVmPGooencT04BJ95/7K6XYBDioKB+6fCmLU2VSZPbz/Mrblr3VeF+YsZLibCWN0XyzDm X-Received: by 2002:a05:6a21:6daa:b0:196:3829:561d with SMTP id wl42-20020a056a216daa00b001963829561dmr3754263pzb.7.1706017156661; Tue, 23 Jan 2024 05:39:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706017156; cv=pass; d=google.com; s=arc-20160816; b=eIu18ZzYv63KPDbEHk8Z8VNyGxTnL5yQK8EfBhly76joIIDUpzG/eddga4b/RFT6d5 d0kLl/smWwEzqPv06W1wXg7LS28C69Ex6u2VpZv6JRyRg+CC/45qrmC7IyAVWkncjpJB dinGIuJwiLJxXdIhF+bkCwdgdK9VnDFS/KoagfuF8XlmusnFIOEwAcU+Hv7F8wfJ2ZvW ky6Im00enfZQ8mLAQ6CA/VCfOB+rvGYgckvXnOdwJKSaBJgiZDrbB+8XZ7PooTk1084x 9lYSL8I8Npb0zSlNauJoVjg6bGTCMRKyex3GGgebu1QVjhlfCGheP8xZQvLcjyH4NKzS oBDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:subject:cc:to:from:dkim-signature :dkim-signature:message-id; bh=u90NYRT/ZphVmVk3QeLAx65kqZq+Kn/J4FFlTTjOKYY=; fh=Te0fDPJ/sd+7p881M6fa/oF213lBbJvGdEFWr/TLqNA=; b=fYMpznC/Wi6715krFt8G3e1ednjwO5UUbkN7gR5z8bO1ic7tufTLfA58qwDQElo94n UkDJYpp88JSKOXE6eeIhAvl+rIJfBCrfZdROi6iYjAH3eec/BkJm2dvIJDA0P4a5iH4x /B0bzpcq1ljst+BejR7g4NVYmYdFoc0PQ6voHinE4agak3f9TgZjVqSZ1URPwaOrYKBW nMD/mC32+4o5B2GIjDIIzukHwcMHxqpdO9PQE7s1h72Wx6FIM8kgwPwwO6sKHKKAAgMC wFY4qcc2KJH9tOLxmTdk9LguI+zQRdIysevu1DIszzPAMt9UrEaslf1kpA/8AAJIh2ZK +wzQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="kxDs/roc"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-35345-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35345-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id kp3-20020a056a00464300b006dadc44566bsi12515602pfb.58.2024.01.23.05.39.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 05:39:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35345-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="kxDs/roc"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-35345-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35345-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 DBD20B29138 for ; Tue, 23 Jan 2024 13:16:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FBDE6280A; Tue, 23 Jan 2024 13:10:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kxDs/roc"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="XjfiEL4S" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 47EE661694 for ; Tue, 23 Jan 2024 13:10:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706015457; cv=none; b=LYTMiH8PSevRQqWXTFp6miARbXvCSehxsblnXbcoCu/yowrxV7ujNKGlAiCffKWB592KBKeL87bgljMTusFD1JVQga5gVEBQ29JsewY2/2VsFHOC1EM+v0NL07D3Tt9wr2iM9UoGrZKr3nJszmKlnA4cpVdB2ZWTh9FY3nuCBc4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706015457; c=relaxed/simple; bh=PwaE2HACFCDykj/yrcUgOvhSX8G9pW7cBDNkwdCX7Zs=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=rKwDH5+lYTA1EMs9Zyhl4tk3anmexaViC7yyB+caX52GPt4HkyfQkJZXopiTceNVpN3QgB4JsYBlawJArGorL4qTELWUPp4l35FtDZ9u0rRQ2o9fmZntO/B1lgF59PQCktE9GTo2voP20QPc9XdEMP5NYXQnLPY87rS6W4uIOk0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=kxDs/roc; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=XjfiEL4S; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Message-ID: <20240118123648.722879332@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706015454; 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: references:references; bh=u90NYRT/ZphVmVk3QeLAx65kqZq+Kn/J4FFlTTjOKYY=; b=kxDs/rocR0TOrKjLmasrpQ+VJegqjYOGjvJ2NmtacOW/fuGynZWyCQDiv5YvZDIpWh0osa zrCb2cx/lO9ZJWtPapNA1yiqnxNhbuBehpoBJDd8M44IgZQEFk02wlYfxfGz3F37hUoafe kXQXkpGitGE4PSWGy1ftW4GNV0RIzN9sV4ywChVahLAFYoGQD3WD9MlCf+anjyj34h4ow1 ICCNWRf1UEgoZsp7VVnkgdEMFuAGvWjeyBZC9phJf92tl4GY3EX8mvP9M3l0YnLJKXEiU0 qnPy6gBq392UFp0zDthhZUMz+eP3eZNErtswHm/m+qvAhBfoT3lBAKXvUCgabA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706015454; 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: references:references; bh=u90NYRT/ZphVmVk3QeLAx65kqZq+Kn/J4FFlTTjOKYY=; b=XjfiEL4SILgkYyJFEDNYXY95Bykqjalwo2YJ8aWpBkvhT1DcN2PONkttEvnB8DvtsiIG2I 7tl5zgxFrk/Ax5BQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Sohil Mehta , K Prateek Nayak , Kan Liang , Zhang Rui , "Paul E. McKenney" , Feng Tang , Andy Shevchenko , Michael Kelley , "Peter Zijlstra (Intel)" Subject: [patch v2 03/30] x86/acpi: Use new APIC registration functions References: <20240118123127.055361964@linutronix.de> 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=UTF-8 Date: Tue, 23 Jan 2024 14:10:53 +0100 (CET) From: Thomas Gleixner Use the new topology registration functions and make the early boot code path __init. No functional change intended. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/acpi/boot.c | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) --- --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -164,33 +164,9 @@ static int __init acpi_parse_madt(struct return 0; } -/** - * acpi_register_lapic - register a local apic and generates a logic cpu number - * @id: local apic id to register - * @acpiid: ACPI id to register - * @enabled: this cpu is enabled or not - * - * Returns the logic cpu number which maps to the local apic - */ -static int acpi_register_lapic(int id, u32 acpiid, u8 enabled) +static __init void acpi_register_lapic(u32 apic_id, u32 acpi_id, bool present) { - int cpu; - - if (id >= MAX_LOCAL_APIC) { - pr_info("skipped apicid that is too big\n"); - return -EINVAL; - } - - if (!enabled) { - ++disabled_cpus; - return -EINVAL; - } - - cpu = generic_processor_info(id); - if (cpu >= 0) - early_per_cpu(x86_cpu_to_acpiid, cpu) = acpiid; - - return cpu; + topology_register_apic(apic_id, acpi_id, present); } static bool __init acpi_is_processor_usable(u32 lapic_flags) @@ -844,12 +820,10 @@ static int acpi_map_cpu2node(acpi_handle return 0; } -int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id, - int *pcpu) +int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id, int *pcpu) { - int cpu; + int cpu = topology_hotplug_apic(physid, acpi_id); - cpu = acpi_register_lapic(physid, acpi_id, ACPI_MADT_ENABLED); if (cpu < 0) { pr_info("Unable to map lapic to logical cpu number\n"); return cpu; @@ -868,15 +842,11 @@ int acpi_unmap_cpu(int cpu) #ifdef CONFIG_ACPI_NUMA set_apicid_to_node(per_cpu(x86_cpu_to_apicid, cpu), NUMA_NO_NODE); #endif - - per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID; - set_cpu_present(cpu, false); - num_processors--; - - return (0); + topology_hotunplug_apic(cpu); + return 0; } EXPORT_SYMBOL(acpi_unmap_cpu); -#endif /* CONFIG_ACPI_HOTPLUG_CPU */ +#endif /* CONFIG_ACPI_HOTPLUG_CPU */ int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base) {