Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp178308rdh; Tue, 13 Feb 2024 13:15:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWOmhD4OYsXY2VWni1hJp//hRNLSbgKRA5v9WdB0vJymxDXvhCjESLEMDOnjMnwo76Y/Ap0iswKUepnX680ApiqY/JNaE4C3HhcuPp2LA== X-Google-Smtp-Source: AGHT+IGppZBDcY+3/ZMRTqzMN29gLNVUM4RgzLVOLaG6a23ZLENqo23V/cBcu/geInvEFqaSeUHh X-Received: by 2002:a05:620a:14b0:b0:787:1953:482e with SMTP id x16-20020a05620a14b000b007871953482emr51365qkj.33.1707858954331; Tue, 13 Feb 2024 13:15:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707858954; cv=pass; d=google.com; s=arc-20160816; b=Tt/WLK/IpM/tSMjRNfkzCyiJWlBVTxG3fBSR67+n3OrtJGuch4ufSYzh1SGzz72284 vM3HGpIbpTV1w+ag2yWpLNIEAQCx5XdLHejHBEo35988urqvuIClFVCKWt/QWwEdw3be q4Eggg27yGAoZfpeIoeDJwmKiOWUIDEGdTTCrcfWZec7VByFflmugyMKaYZwMSTq+pQg 7aimtl0Cu1zptoNPbqP5A4078vAyB9RGg5Iz8Xgp/FeD3Wfb/cMH387Q/6Nms4L3b1YA gdixm+mK0GgnCEwyoD6WZvkXWkFE/Vnaj6jG3WeK61T6zrECre4Ntx4J78fM5CE4hbqV NlgA== 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=WyEg5GXY3LJmjjyn4RC8XmGMfovX0Kb3/A8/5cI8e+8=; b=o+4DppwpjwAYRu4p8jIHjFVqwOZvccleEsyp09UWndY5LyjegRHTKNsQT6M6zhclWe ESwwL7EJeglCpV5Oa0Axi9iVNBxvuNVJ9khc+C1mPh6K3Hguvo6sKRXBJ872Z8r03dcg CxJQpBpxikRTES2jD/sFUb6GpOT5Yxs22Sj1F6fZ/uFMq3pCBKUrzGC7iMAgYiHhUk5l GtvtZt/7zg8+sHKoLM1p/gXuOyH6MTuDLfKOVxxp4tlvlsQplhhA774NNANHRcl1el8U h0K9tOVTLZfsYnZBeSH0KnlI6KPxL+32g2m3DOPQ96bvYlholMu/mQgFokfTwpuiVrFb NJ8A==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64288-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=2; AJvYcCUmBcLxdD/OM4z3vf5UlKSOXlKBaE9Rcjpbw9mWzuo6DQL33uLK9UIGJ+CoqFJBxl/E8HbQ4ym6DocpWl2X2m9sqzy3PMYHgiDL9lfWtQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y25-20020a37e319000000b007858ee130d8si9419085qki.657.2024.02.13.13.15.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:15:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64288-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; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64288-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B76F31C24565 for ; Tue, 13 Feb 2024 21:15:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 019EF62817; Tue, 13 Feb 2024 21:05:42 +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 Content-Type: text/plain; charset=UTF-8 Date: Tue, 13 Feb 2024 22:05:37 +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) {