Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6209161rwp; Mon, 17 Jul 2023 17:31:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlEolmH2nf57GYpGbVp7hcgqmBX4Ipef7mKVGMlvOGdOb5CX62XNJ/VHPuT/+tmMWGzhLukH X-Received: by 2002:a17:903:1cf:b0:1b1:9233:bbf5 with SMTP id e15-20020a17090301cf00b001b19233bbf5mr17039720plh.57.1689640268655; Mon, 17 Jul 2023 17:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689640268; cv=none; d=google.com; s=arc-20160816; b=w69d3J0yvpCnyXpp2sNxQHOkouRY4OE84mbIBtdObXd66ebNE3lnzyHlzAV3Iu24Vd G2gYYSwNTFw9bUIXoCAf3XqNmGeN6jCKj8vkV8Y19M8wqUYwAoXELSPG7H1Nfy87MVR7 24ME25SU4pFpzeL+qdf504wtK8I4kFfB0pJBXZMu8OQvE14D12AzNADhGC1q2nYg1X4K MpI7HmmI1zQ95DKkzlrZDTZBk7nHnWTHDcmv1hNCnvjJeeCrHjikQhocMsxRELVkKtt3 fQrPpMBpELLwl5hzMcPkmZJw1vSnGI2uvLbyfSaa0/msUen/6RZ1etMXIseLOfT/F0fw L79g== 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=tK1J3NRXP+lZRakGxXxjlSskh2I2ErwFZpn4/I2Qug8=; fh=MJzvnywV9/WrN/ASipmGkNx/7jKFHnq83nsgXe/obdc=; b=HoejzCjgHwdy+B6TQW71urTqITP0kvg6AfLHVSHhTKAYuWwcWKkVvK8898rpk7LnvT 2g0dDGGGlSSlWcs7Ss7oldbzB7OBxLtbESrfulSYp4Gt6ey5brGeA2Vu/jJlFfS7lhy/ 9kq21wJOa9lOl78Qguh+JZ20+EA3+uMk+2vJgD7zyDJDxk2DOqSte8W2BE5WkQ1ZgWjc BQQC0WpifqCy3tVp69bwlz/455P9dNykJ09tpBGeTl+ccKqXT7XHQlCEvFd6xIwxFw+h 710qqsqSSCzYYkUlmS5Jf+ulXjGFT5piZBEaA8SWmPUOPb1f00q3j4dsck36LNeqRqv/ afLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="z+8xD/Fi"; dkim=neutral (no key) header.i=@linutronix.de; 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 lg7-20020a170902fb8700b001b86dd825e5si650446plb.243.2023.07.17.17.30.55; Mon, 17 Jul 2023 17:31:08 -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="z+8xD/Fi"; dkim=neutral (no key) header.i=@linutronix.de; 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 S231672AbjGQXcf (ORCPT + 99 others); Mon, 17 Jul 2023 19:32:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231649AbjGQXcZ (ORCPT ); Mon, 17 Jul 2023 19:32:25 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C035C173A for ; Mon, 17 Jul 2023 16:31:27 -0700 (PDT) Message-ID: <20230717223225.815511531@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1689635746; 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=tK1J3NRXP+lZRakGxXxjlSskh2I2ErwFZpn4/I2Qug8=; b=z+8xD/FiHJ9sr/IZ44QFKo65qGiyCig5Yc9pVVKeRxKO5Om5Susr9bNe7gA/wQoR+WSXo1 sIkwkb2ciVPCECWtrGSkoKg4j15iGKWvESRI0sf1I79+p8I/tHGy9OQHO38rLLhgvwFqhP qhPpCBWARB3+wFKelnZ8IVeRQwPYPsrEQpzBpAe985A5er13fJ0f8z/0eiWtYif/HYaCkm yqw+iMUa0PzuwnqtoBEHqlbPlE1YyGjPKvb5RUdDGt9gT/9TXVKR+GzZCGULxJsSlY62Ri MSgWRww7o0hy7eJd4Xi5Mz76uYfVNtZ6gh6r0FnH2NkPmGG7wftxpgNfDce+4A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1689635746; 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=tK1J3NRXP+lZRakGxXxjlSskh2I2ErwFZpn4/I2Qug8=; b=qQ7Hm4RcJivTCfhDxjNKiu6l+PxZgwY9s/INSRHRjcQSHhxJnOCdVav5b4/dGHJIE4wQhO w4PkOGEA+hvCNEAg== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Linus Torvalds , Andrew Cooper , Tom Lendacky , Paolo Bonzini , Wei Liu , Arjan van de Ven , Juergen Gross Subject: [patch 46/58] x86/apic/noop: Tidy up the code References: <20230717223049.327865981@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Tue, 18 Jul 2023 01:15:46 +0200 (CEST) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 --- 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,