Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp175808rdh; Tue, 13 Feb 2024 13:10:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVKcBg0HxW/ftNl6HsF1uditK91M4h05W0HArgKPoDSBuCZ06EPYVNMx4UMAiI0509PZ/CxgQ9PJbA0zYTjX9tfznGD8c+OG1D0EKUBUQ== X-Google-Smtp-Source: AGHT+IFfbb18wcpS8wdDkSznwQanOH9JQcty2U8oTm5FpvuGm+/2RemI5IycQjTSS+L5mMnrZsmd X-Received: by 2002:a05:6a20:d39a:b0:19e:4e58:b251 with SMTP id iq26-20020a056a20d39a00b0019e4e58b251mr74529pzb.10.1707858646692; Tue, 13 Feb 2024 13:10:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707858646; cv=pass; d=google.com; s=arc-20160816; b=DnN+SOADcv8rA2Qq85UUm1FEoIuMXLkhd8pG2/nMwiatjo4seAhvMUkBg/a1DvUmO5 m9vSQeKwKASoz/szB3rAMTmUpH4U14TNZeiRWl0F05tcaFUjsJD/3NuuEdfq1bF4j8yv EB+Xe2xC7H1KVHWZLHEteb4R1dqeqlNORGjEuDMTtrI0Y27XorCLmmsDDi3+GJ6pHq2F oKi5bl2HrLC5jJssqDIiu2Z1h2DHJITm8wdfjdT3Fx/BAIVk3KFRPzhtyXs2nM0IugRp 6B5lOxJrgE+Xj6mAV0ENVTMpRRRQMJFm37ltJ49x2aolgTfZOnEVCpr4mSWFqg+UxPxT vulg== 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=haICUt9LrjF7nxtQU8l5bRkX2rhfO5LbZBYhZ3D/9T8=; fh=3s/bfJnne68tm3KURS/ikR0DRnF42kmkhIb15erfA8M=; b=0JQjBqZo/CmlwoV86ibwcFYok3xZB2wSuq89Sm+g3fbXcou0lUmXViwKkfRjteKR1c rEvwfO69PThIubtL+Int4SPZWURFEFp5EHLr3Hxp1hdPaksBomH4iHofCV1uQGu7Ywmk q2PN7nFR3n27QQRaY3kHzYsuMoqUcUN9+XlChA7p2llNIG9Sr6kREmFuOcLV+nf7coKA OlWekLJywKdGSK0rjvum/ncZEyETeJata9atDbpVp3O42hTLHjB5J85QgtQf9Ip+uEE1 kHo9iktkxJQ1bOkfQWwDkPwGDACFUrWNG75M0OSyJtwX+j/nML66t3BM5WYkN1OBAUMv z4+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EpQWCPDU; 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-64266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64266-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; AJvYcCUzsVyOaIIZScPh9Yk8FCCRBDKBeeGvJvW1CYywJmIqMU9nRD6Y8eV31gchEPC4ZpcEuo2S5DP5wDejLhJ+7/at3Y0wGZoRtDYS2wI+sg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x22-20020a656ab6000000b005dc858b5b75si1580288pgu.848.2024.02.13.13.10.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:10:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EpQWCPDU; 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-64266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64266-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3BA8B28D464 for ; Tue, 13 Feb 2024 21:10:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06C6669D1C; Tue, 13 Feb 2024 21:05:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="EpQWCPDU"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zwzJmjOR" 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 ADA40692E1 for ; Tue, 13 Feb 2024 21:04:59 +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=1707858301; cv=none; b=c2rmRQFHB53EyTBXTuGdd5hA1XRH7hJzy+ndS9/eZ1OzA9wltzKoIu1B9KMA+kArKZGG7KMj3xI9W6u/ro0c8ak99ocfDPQchAZezyzbE0PxWkNJTyN30YQW09tunAcmLpY7z19qF8tuLS0ODbjY2DSSSfLGFoy00eMvEN6O6mQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707858301; c=relaxed/simple; bh=3S7tYc3YVI4mPW2sr3ZiAQ0I85cBTTIGxfAhE8dJpE8=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=tg+kE6yckUXfUO/8/NhKjQLJocLeyYsSHgBa1c+xEVHtqms+rrHnLHRNqCb/7cz0Kj+DiDndPb62uUkYrcgvSSqAs8bv4W39aB+VXoltOwRwwsbrQGSjD5HDnxvq2RktI5BaMePw6lLRz49KHzsBLqXxUhtfo99/ayfqFSa4W2k= 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=EpQWCPDU; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=zwzJmjOR; 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: <20240212154639.119261725@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1707858298; 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=haICUt9LrjF7nxtQU8l5bRkX2rhfO5LbZBYhZ3D/9T8=; b=EpQWCPDUlnOt3UhzvowTPViGVcLxcaB+M91EqvxnUv/Aov4gY9rAh2INHsPuDl6DoYXMlW qW7S2vZd8SZ8RMu7t1IdHmaEL7NtgJJ/F8VIvZA64OAiCJTamtD5gjRdtibYpfSmBJf0B8 4VwCx1xv/NR38h6SpdhAzmoYNriHUuWA0y77vqUIUPnDFG85n/juENgC0Ew2J2vKNpq7St Z/QKG/LEqRKFIHRBjVCodVassOK6pNdfG4t3vrYDz9zozAP6ZP4j4S7v+B377qGWAlJu64 pUhKPmpoLwq2HXionKVmo3j+Us5wd/bMSldZa6m+lFh/r8kOMLTW1ySI5+Jm3Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1707858298; 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=haICUt9LrjF7nxtQU8l5bRkX2rhfO5LbZBYhZ3D/9T8=; b=zwzJmjORZVhOZBlMY/12GPGom7oXdqNWjLjs9RNHf/1Tz+Wr8sJl5MJdU+NzUPyMgM+V8I MWJ6nzgfbd8gI9AA== 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)" , Andy Shevchenko , Wei Liu Subject: [patch V3 05/22] x86/ioapic: Make io_apic_get_unique_id() simpler References: <20240212154529.402604963@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:04:57 +0100 (CET) From: Thomas Gleixner No need to go through APIC callbacks. It's already established that this is an ancient APIC. So just copy the present mask and use the direct physid* functions all over the place. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/apic/io_apic.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) --- --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -2498,17 +2498,9 @@ static int io_apic_get_unique_id(int ioa unsigned long flags; int i = 0; - /* - * The P4 platform supports up to 256 APIC IDs on two separate APIC - * buses (one for LAPICs, one for IOAPICs), where predecessors only - * supports up to 16 on one shared APIC bus. - * - * TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full - * advantage of new APIC bus architecture. - */ - + /* Initialize the ID map */ if (physids_empty(apic_id_map)) - apic->ioapic_phys_id_map(&phys_cpu_present_map, &apic_id_map); + apic_id_map = phys_cpu_present_map; raw_spin_lock_irqsave(&ioapic_lock, flags); reg_00.raw = io_apic_read(ioapic, 0); @@ -2520,14 +2512,10 @@ static int io_apic_get_unique_id(int ioa apic_id = reg_00.bits.ID; } - /* - * Every APIC in a system must have a unique ID or we get lots of nice - * 'stuck on smp_invalidate_needed IPI wait' messages. - */ - if (apic->check_apicid_used(&apic_id_map, apic_id)) { - + /* Every APIC in a system must have a unique ID */ + if (physid_isset(apic_id, apic_id_map)) { for (i = 0; i < broadcast_id; i++) { - if (!apic->check_apicid_used(&apic_id_map, i)) + if (!physid_isset(i, apic_id_map)) break; }