From patchwork Tue Feb 13 21:05:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 200631 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp812939dyb; Tue, 13 Feb 2024 13:16:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWV+h+Gk33Y9oNxBF9FskwdjwDzDKwB1oKpbZZZ5pr4ZPDYF/9UmlKwLG5xPUFrt+izvVC+EMGtZL1KDcyLFS6fTyjPZg== X-Google-Smtp-Source: AGHT+IGBHyLOaBRa3csl9DsT6aAnLyBgNORENF/LYVAFF5INSfguhcsoA5pjqhyC1+UIIR7JOaGz X-Received: by 2002:a17:902:d484:b0:1d9:65e6:4af7 with SMTP id c4-20020a170902d48400b001d965e64af7mr26140plg.30.1707858976764; Tue, 13 Feb 2024 13:16:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707858976; cv=pass; d=google.com; s=arc-20160816; b=FzQZqkaGtZQ10fAyA4cXxa1ztAc9fYgNtT6QX+qHwmewi1HT6yvOdkM2j6+BvrbL/4 ORgCeGE0l2z8rI1ujBBILMNL39TGOJNRCn6XTMyooIeTo9J5tPJrvhlETUmMz2iRpYvR p/k14/W4Uj7KJ6sPbuxnK6XoHSdlK5jG5ameQeQx8DIId194qD98LNJjyQbbDJRRkwfn ZSNV1MGbUyv8erYtxv1BzeAvzi4vbvy2X0T3lZScb97dOTyInAv/JwUzKJsXQAKAw4QO dp/SQe65UEp1Yk0CnuMJahbwW8Kew0u/tt9G1eVde6RvKfycgQ6rNRi71ejWq5A16AP4 fGsA== 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=60uaXjzkNtRqK9qiefJswJS4h5SaG8mwJ8oA6CldzTE=; fh=WG+hyMrTtI+25k4RE/DMVkGnWJvvkxuRBKIOGlwjfoE=; b=GbI459KsMmMiqzWBkU2wdv1bkxF4GdGHWXUdw+RcXi+LDLq/4AzHToekFXI0PUiRvm bvg8G0rJr38NSzz/Tv1wyp+5YeQUuiDgjjb92tx6saGc5+4kEGkhpQ8ojcbmzyemFAis LjUq2v33GIJd+TgRoianUZ50/h68e50rRaFMRqcwP9NVDd1GEN933c5ClNZHNaa8sPhy MES/kQ6v6BYueM5QAqK0aJE0bJgisjfBuECkWYetUKfWhxrHELd3Cx+bSoBjbuvjbMzC SIX3vVtDTlI2jk9FIj5wtogerJ4FDE40UfW60ZYefEteXHrpfZ0iHbo+2MNahg9Vurw4 OaKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ce3LpaRN; 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-64288-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64288-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=2; AJvYcCUM3GdM7C+NJbk+Bi+xemZJk+cAkF7X1kxdZZ3uPJ0i5q62ryhfO8zWOmk8OOywKJd5IyfrwB8pkBqkQ6uEI/sCiN9o3g== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z2-20020a170902d54200b001d9b59a5bb6si2584925plf.15.2024.02.13.13.16.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:16:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64288-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ce3LpaRN; 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-64288-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64288-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6B4272895C4 for ; Tue, 13 Feb 2024 21:15:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C2CE17C087; Tue, 13 Feb 2024 21:05:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ce3LpaRN"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="64BvwSJU" 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 9ED8462810 for ; Tue, 13 Feb 2024 21:05:39 +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=1707858341; cv=none; b=blOOjGTyWJS4ENibPDv5I396yvstWs09BswbD/tqNlrgYEfUkj9olA72niQPgF6Tk3IkzNFtcz/AJkhgi5d7JBcJgfnehul/+HhffnkfVDDQiVGg9JfIH9IlMJw5RtNdCoCgWVLXNVbMmLsZZPmt2hlwq8g5oYZKNZUTG9fSlB0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707858341; c=relaxed/simple; bh=S0168uuAgX+OrtNzHUht82jJ6HfNesiRsOyCjpNYZ7E=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=k2g7anb0A8ztHcom/Hx3JWKwQ7b3jrf/hwdCUAnozVg/mYEo3SrqYZFMirt5udH19pUmSsenV90T8+BQMBAuObdmpPI497Sj0bjsjkPrsGmG1L2Q+Ag5x+QzZPswsJrfGVn7U/TWoOeO2uuHXZmhoSHYVLLfeTrDYrzHT+VMxT4= 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=ce3LpaRN; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=64BvwSJU; 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: <20240213210251.664738831@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1707858338; 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=60uaXjzkNtRqK9qiefJswJS4h5SaG8mwJ8oA6CldzTE=; b=ce3LpaRNnfo33v7j673mjkQr97RSvDyOzY62Hs4KuE8ZAYsa2mwM/GlZnXsQzYx9HR9bTa L1ONPZyUjUedLdg9p948l2Tad2nSvIM96L1kGRtw7MDKTBn46eCOrFr0+7/VUSQNpOR93L u9b0mstk4XSBvr4gXnHehd+iIk5bFHnW5eBocSmIw2jyTOKjZghCKnEVd+DHJv5xSeVg8s E3/JG0SmT63I6kzkQVwJT93M4RIVS+hvAjMwg0uWPo66QGjoipJAgUZ7Yx3aRgarIQCkm5 KQFEAKdU923g+5I0fx/T3LcFDXUXygw34YXVD1QxbrxjZK32ZWi8SIoneUprhw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1707858338; 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=60uaXjzkNtRqK9qiefJswJS4h5SaG8mwJ8oA6CldzTE=; b=64BvwSJUP0ZVY7lHZRMW/pKRyHRncODWW73ez6S9h/kTlUB+6Glp8u6m7bSfuBspon8H7w zlzi/sSdnHMlKZBA== 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 03/30] x86/acpi: Use new APIC registration functions References: <20240213205415.307029033@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Tue, 13 Feb 2024 22:05:37 +0100 (CET) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790819934341481712 X-GMAIL-MSGID: 1790819934341481712 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) {