Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5569457rwb; Tue, 1 Aug 2023 05:00:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlHkNdFXztbOLmhIe2wBlieZYtF8/8Qp2PqgKtVS7b2nUaZ1qrEFBNKOk40SKpn7+xuuKObJ X-Received: by 2002:a17:902:b202:b0:1bb:cd5a:ba53 with SMTP id t2-20020a170902b20200b001bbcd5aba53mr12129947plr.14.1690891239224; Tue, 01 Aug 2023 05:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690891239; cv=none; d=google.com; s=arc-20160816; b=SkdeP8xHz/LuVqKCz9oto8mO6Pz8nbm1uLRvioxtCxuo0QI+m54ihyjJ4VZtS4fEDG O48ZfAQsl35CGwscaxjMPBiru9MFPEGg6Cvy/7HrqF4Id1RP5cAqPoJsAOnqIBEnVMSs zvonwwiw/zQ010aOkO/ELXyDP2tYA+33ClijDWq0p5twNdPa5jfE+fxZ01qdeFWH91wy v3p3kaxtveFuYawAfvB8gnuGtdwEfVxeRT2aU3PNaVUjh1yENKYthC06LnSLUCTJngoM h8dxSSW0jCEz2wT5zX7ME1pH251PYA9PwesGKc0Ps/adC33tKhx/BShTv5oMkFwQHyAY b4gQ== 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=QxJCd5EJ/bsG/9bO98P8hnP2UT09lEdt9hSBI73j59Y=; fh=mE3iieUIZLcDfOLIULj9X6/p0bMDPZGFSVRsnyRUnTc=; b=adOs6R4VBXhtkQIO/kN/MrTPrOPdudLE9rSMVPFbqgl4O61pFuUuWc8M3xDXVWG3qP e0/Gtl6e9NOGpyXl+TwP6OdvXc6zTcqEeH3vVUwJ65MC0830u2BQX2HgepG49YkGWKtL PkLITLRzsMqTvKG/NZCDTEtM5BiaYN7hzcc2B1UtijIOGXeO4YH3Q6WRYGxW8ono3469 UgbjBwIOqPWaFmD1YuxD37mXWbkbQZTM2s1d3dspJHXrxP+4EkD1NZ+o/KZ4eMmDnfbm BZLJ+xwM+fzRFJ4pWMudjY0dyQlXh0KUrjHDePbGf96HJQQcTsbiWPjMEV3y+1vCjXBq Ao6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="xp5095/w"; dkim=neutral (no key) header.i=@linutronix.de header.b=haGigiuL; 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 q18-20020a17090311d200b001b9c1821f6bsi9326049plh.98.2023.08.01.05.00.24; Tue, 01 Aug 2023 05:00:39 -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="xp5095/w"; dkim=neutral (no key) header.i=@linutronix.de header.b=haGigiuL; 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 S234222AbjHAKuc (ORCPT + 99 others); Tue, 1 Aug 2023 06:50:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234139AbjHAKto (ORCPT ); Tue, 1 Aug 2023 06:49:44 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75BCD3C20 for ; Tue, 1 Aug 2023 03:48:02 -0700 (PDT) Message-ID: <20230801103817.732266247@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690886859; 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=QxJCd5EJ/bsG/9bO98P8hnP2UT09lEdt9hSBI73j59Y=; b=xp5095/wWIPT22pF6/LFAAyotE258cjR4zwJfjj/YUVo006GYifD3GnBpYK2zCoNcEioeK yZJn5e1UgrIrmYAz4xZluJAHEuh6PF9+PEUZPZXQBJoCKApm8waL8JhmzzFEKmI5FmRxLo 3pNE94sx9L9vfL5h21rWJhrbS2oAOhBprpZsbHSSUdz+qPmk20ibMJ037cFQTOMLNh2mNV JYp1C5E5XCUuDiKB1JMmFQ9pxdhyseH75TzHcciDYP474DanCCeDmva/LhW8JDZSlnihnd bGki4HiVMS3Oyram5TtD7ijnnJG08b+Q58QdC1YlomvtH7fjdPG5x8f19QjKsA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690886859; 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=QxJCd5EJ/bsG/9bO98P8hnP2UT09lEdt9hSBI73j59Y=; b=haGigiuLETeD/qzVpJCPStVNkd4JV8b1h/TNTLf4Ov9dTqFKxI/o7eQZjvBV5/URgSTALs 1XF7SaLGCcXRpFAQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Andrew Cooper , Tom Lendacky , Paolo Bonzini , Wei Liu , Arjan van de Ven , Juergen Gross , Michael Kelley , Peter Keresztes Schmidt , "Peter Zijlstra (Intel)" Subject: [patch V3 47/60] x86/apic/noop: Tidy up the code References: <20230801103042.936020332@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Tue, 1 Aug 2023 12:47:39 +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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 First of all apic_noop can't be probed because it's not registered. So there is no point for implementing a probe callback. The machine is rightfully to die when that is invoked. Remove the gunk and tidy up the other space consuming dummy callbacks. This gunk should simply die. Nothing should ever invoke APIC callbacks once this is installed, But that's a differrent story for another round of cleanups. The comment on top of this file which was intentionally left in place tells exactly why this is needed: voodoo programming. In fact the kernel of today should just outright refuse to boot on a system with no (functional) local APIC. That would spare tons of #ifdeffery and other nonsense. Signed-off-by: Thomas Gleixner Acked-by: Peter Zijlstra (Intel) --- arch/x86/kernel/apic/apic_noop.c | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) --- a/arch/x86/kernel/apic/apic_noop.c +++ b/arch/x86/kernel/apic/apic_noop.c @@ -8,6 +8,10 @@ * Though in case if apic is disabled (for some reason) we try * to not uglify the caller's code and allow to call (some) apic routines * like self-ipi, etc... + * + * FIXME: Remove this gunk. The above argument which was intentionally left + * in place is silly to begin with because none of the callbacks except for + * APIC::read/write() have a WARN_ON_ONCE() in them. Sigh... */ #include #include @@ -21,35 +25,10 @@ static void noop_send_IPI_allbutself(int static void noop_send_IPI_all(int vector) { } static void noop_send_IPI_self(int vector) { } static void noop_apic_icr_write(u32 low, u32 id) { } - -static int noop_wakeup_secondary_cpu(int apicid, unsigned long start_eip) -{ - return -1; -} - -static u64 noop_apic_icr_read(void) -{ - return 0; -} - -static int noop_phys_pkg_id(int cpuid_apic, int index_msb) -{ - return 0; -} - -static unsigned int noop_get_apic_id(unsigned long x) -{ - return 0; -} - -static int noop_probe(void) -{ - /* - * NOOP apic should not ever be - * enabled via probe routine - */ - return 0; -} +static int noop_wakeup_secondary_cpu(int apicid, unsigned long start_eip) { return -1; } +static u64 noop_apic_icr_read(void) { return 0; } +static int noop_phys_pkg_id(int cpuid_apic, int index_msb) { return 0; } +static unsigned int noop_get_apic_id(unsigned long x) { return 0; } static u32 noop_apic_read(u32 reg) { @@ -64,7 +43,6 @@ static void noop_apic_write(u32 reg, u32 struct apic apic_noop __ro_after_init = { .name = "noop", - .probe = noop_probe, .delivery_mode = APIC_DELIVERY_MODE_FIXED, .dest_mode_logical = true,