Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3054330rwb; Mon, 7 Aug 2023 07:36:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6p5e7Ani84+ccHvEkTFHQ0AHR8Q7q5IyZdkTQleAK5A/Wc5MDU1ZzlHUVTe9psw59V4n3 X-Received: by 2002:a05:6a20:6a0f:b0:140:324c:124c with SMTP id p15-20020a056a206a0f00b00140324c124cmr7397214pzk.62.1691419018090; Mon, 07 Aug 2023 07:36:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691419018; cv=none; d=google.com; s=arc-20160816; b=Wu0RIbn4+8/KdgwuimQ18nE6+ZwROiQJmTjZ6sOFltSYo/KZHiv26cS/mXrgiBjmAr ipXrHKYUrvgWev8YH6HXuHAEiVVDhdVrdEUQBoXm/KIY5eZG2dFgPWaoxjuiAmzBFm53 HNbLxxxTrxHpyTs4dmQdKRvcnyWpIrqTWGktGXYeEoB+VLSPclu28KWTM8B1h20XLYo8 GVTbkZpgXDRIv+m6SMXtTwDTvj+/frAXW25uEu2I1wtubWQ1KIxLFxEdtkZRcN4h5+IY 8D6WfEAQeWMf/vQZCe2GObfY/NVwo5580gvXbUaIsc0FYPAl6JZOmK4EiTcfi6xu96G4 KUvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=ywrW7M6Fms0CIM+WhzKuJj3dJ+Q03lWwDFSQkWbNJj4=; fh=/92WVKYrcN3rA268QXyKzVtm/UtxHeI2lnbU295XDiQ=; b=JzD+A9YtqcA/slxfy4nqPPGNuwftv9Q8b6YoAb8LHNoi3t/Vi4hAMSRNOVO+0o8Ygz vLrZzbKPQ/fv/X1Mj8BnVZ/sHjqWHaAQTp3TQnV2YYsrEOHZEkHfbzUeDagb1f2SlLt7 Zd1/OittQ+02R/njtAXYZyhz7lC/+rFTB5EGSmIicBSkuw0+qO2v54L7ew0HYn1LACX3 EmVUdF9glE6eu7JazxkQ2jF3sTcbLGzVBzazjAiot+HVJA6pmBgGUnXdllLJlF9YfYfU 75gNpJuXH40okkZE8sWUkZNHZZ2iihM4AwlGPETdXdc/lKZupAhDMcEncT//9dsw43Uk o03g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=duVsiKR3; dkim=neutral (no key) header.i=@linutronix.de header.b="z/LJe82I"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 81-20020a630154000000b005645fcc15absi5711297pgb.266.2023.08.07.07.36.45; Mon, 07 Aug 2023 07:36:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=duVsiKR3; dkim=neutral (no key) header.i=@linutronix.de header.b="z/LJe82I"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232081AbjHGNzJ (ORCPT + 99 others); Mon, 7 Aug 2023 09:55:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234488AbjHGNwq (ORCPT ); Mon, 7 Aug 2023 09:52:46 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB4D410EF for ; Mon, 7 Aug 2023 06:52:44 -0700 (PDT) Message-ID: <20230807135026.750360590@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691416363; 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=ywrW7M6Fms0CIM+WhzKuJj3dJ+Q03lWwDFSQkWbNJj4=; b=duVsiKR3IhfLqm1YxgowBgn9OsTg7/0Em3YJSm/4NOr/GAa1YAq3Zl62aXNCjUhXG7gXCw 9JkbKk1zt6fH103uC6AeyBWd0ltnnPU5RKtOl87wdUMLN8WQCNccbrXMI2GvXRBCFO1vox QmbRnJ/oEMYVDiefiE7q9G6hMR2zADvgwG/pQZgDT815jTOlk8dv4ZMzCvEWBaYxeIgel8 E9Nl6okjjmNsU59T1njcSoM/ZtI1s4c4t50iH9FUBtif569Si55sE/NUBA0mTy0x0L4TBM Hm1NPILRCRuSXHYfMlcz5/GIdvSAH1pcKhP8XYxBRQM0zH78JjrtW2rMpJzruw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691416363; 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=ywrW7M6Fms0CIM+WhzKuJj3dJ+Q03lWwDFSQkWbNJj4=; b=z/LJe82IgSIz5k4djTUhMxGR5alkqU8dX/ygjvlLM9X9uYOcnyFJVM266DrIoMtCxFacUQ /aCl7d38FjGQZODg== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Michael Kelley , Sohil Mehta , K Prateek Nayak , Kan Liang , Zhang Rui , "Paul E. McKenney" , Feng Tang , Andy Shevchenko Subject: [patch 06/53] x86/ioapic: Make io_apic_get_unique_id() simpler References: <20230807130108.853357011@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Mon, 7 Aug 2023 15:52:42 +0200 (CEST) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; }