From nobody Sat Apr 11 03:59:32 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2063CC25B08 for ; Wed, 17 Aug 2022 05:12:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230282AbiHQFMR (ORCPT ); Wed, 17 Aug 2022 01:12:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232403AbiHQFMD (ORCPT ); Wed, 17 Aug 2022 01:12:03 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C4756DFA5 for ; Tue, 16 Aug 2022 22:12:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660713122; x=1692249122; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D80ulUAhbmrV7L9/yOfZt2Tb37WVpYS3nBYfSyUXRLU=; b=AWdNW9ruEInt7Z2b2+PExU05ZuJelHRN2YsPF2qwr3FnAfWT3Wzo6jTT y6dvKlERFY/BJEHQwYumovZ0aiLn3KXDo6muNubT3Dyy+WyDe2rL6I3UR C9Nuh7AOhATVV9voZi8AqniHhGbFU0HwkYA337FaOJRq/Lh2jaJUsln/7 Je9adQ4Afjtamd5oWGAIkNL4P1WwO3nfuRg2d/exRZxxydbUAwglMBIz4 GUr60tlf/8icTDDTU7It524jNsvo6/LIDo7WzcG1IRIt4HXgxBkjzLihx ZLKlGau3tIzh8dU76gmrdmp437eS+B+ldr3VeV0xoKWZs9v5ZbFld/U4Q w==; X-IronPort-AV: E=McAfee;i="6400,9594,10441"; a="289972502" X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="289972502" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2022 22:12:00 -0700 X-IronPort-AV: E=Sophos;i="5.93,242,1654585200"; d="scan'208";a="557976693" Received: from araj-dh-work.jf.intel.com ([10.165.157.158]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2022 22:11:59 -0700 From: Ashok Raj To: Borislav Petkov , Thomas Gleixner Cc: Tony Luck , Dave Hansen , "LKML Mailing List" , X86-kernel , Andy Lutomirski , Tom Lendacky , "Jacon Jun Pan" , Ashok Raj , Jacob Pan Subject: [PATCH v3 4/5] x86/x2apic: Support x2apic self IPI with NMI_VECTOR Date: Wed, 17 Aug 2022 05:11:26 +0000 Message-Id: <20220817051127.3323755-5-ashok.raj@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220817051127.3323755-1-ashok.raj@intel.com> References: <20220817051127.3323755-1-ashok.raj@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" X2APIC architecture introduced a dedicated register for sending self-IPI. Though highly optimized for performance, its semantics limit the delivery mode to fixed mode. NMI vector is not supported, this created an inconsistent behavior between X2APIC and others. This patch adds support for X2APIC NMI_VECTOR by fall back to the slower ICR method. Suggested-by: Ashok Raj Signed-off-by: Jacob Pan Signed-off-by: Ashok Raj --- arch/x86/kernel/apic/x2apic_phys.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2ap= ic_phys.c index 6bde05a86b4e..cf187f1906b2 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c @@ -149,7 +149,11 @@ int x2apic_phys_pkg_id(int initial_apicid, int index_m= sb) =20 void x2apic_send_IPI_self(int vector) { - apic_write(APIC_SELF_IPI, vector); + if (unlikely(vector =3D=3D NMI_VECTOR)) + apic->send_IPI_mask(cpumask_of(smp_processor_id()), + NMI_VECTOR); + else + apic_write(APIC_SELF_IPI, vector); } =20 static struct apic apic_x2apic_phys __ro_after_init =3D { --=20 2.32.0