From nobody Sat Feb 7 08:27:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=sony.com ARC-Seal: i=1; a=rsa-sha256; t=1770026276; cv=none; d=zohomail.com; s=zohoarc; b=UzRaBLdF5sVdkx4GDV47PhKO3HNYJEoIc+xHsudi6sIZRkw+3ykGCG1IqtGQIIceiLzmnIvZxpMYtcOJ6xsEbkBj80CJqzE0eLp7XQDqzdXjFsLxq2Gxz/iRfW3ifSYscWSpIWJKc3BAUcbQGDt9cQSa3XHB74HlWPJpxFzNRCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770026276; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4/LXZGnNgY5t+nsrdXbfktyTBcde00tw0WwNVU5EQeQ=; b=T6ZMJ1+0410sNrzkUS8JT6BdpJQz1bCdGY+eHmZ6y56E0zwcshkNYd0YyJEjv0w7YZsGkeRqL8zaMLoCEKB5qwxxkvRv+mif1GSQu3jCRD0WgQK7O7Cewi2HMchUHy12ZCdT1Ar9uMd/Vw+GChHlnZujJ1L1f0TcCGrLSYhYWYE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1770026276723986.2414748420483; Mon, 2 Feb 2026 01:57:56 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1218461.1527204 (Exim 4.92) (envelope-from ) id 1vmqgT-0001Z4-RW; Mon, 02 Feb 2026 09:57:29 +0000 Received: by outflank-mailman (output) from mailman id 1218461.1527204; Mon, 02 Feb 2026 09:57:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vmqgT-0001YC-Od; Mon, 02 Feb 2026 09:57:29 +0000 Received: by outflank-mailman (input) for mailman id 1218461; Mon, 02 Feb 2026 09:52:02 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vmqbB-0001Il-Vv for xen-devel@lists.xenproject.org; Mon, 02 Feb 2026 09:52:01 +0000 Received: from jpms-ob01.noc.sony.co.jp (jpms-ob01.noc.sony.co.jp [2001:cf8:ace:41::4]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d121b1ab-001c-11f1-9ccf-f158ae23cfc8; Mon, 02 Feb 2026 10:51:59 +0100 (CET) Received: from unknown (HELO jpmta-ob1.noc.sony.co.jp) ([IPv6:2001:cf8:0:6e7::6]) by jpms-ob01.noc.sony.co.jp with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2026 18:51:38 +0900 Received: from unknown (HELO [127.0.1.1]) ([IPv6:2001:cf8:1:573:0:dddd:6b3e:119e]) by jpmta-ob1.noc.sony.co.jp with ESMTP; 02 Feb 2026 18:51:38 +0900 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d121b1ab-001c-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; s=s1jp; t=1770025920; x=1801561920; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=4/LXZGnNgY5t+nsrdXbfktyTBcde00tw0WwNVU5EQeQ=; b=nI6A7Ytwa1+zLh8IWECSnhLfuTcw4lqBn+HE9NyTzMST2ejWcv/0885i bTphFfjN08hVCUeoZAOE0EzeJREtl4uhiNSonsGqcqWEDvSz3lSXyl9il kCroDYD+AJfjEwynf9Os7NyNE4mOmUWHbpB8KhpFljpEoQbSqMerrIh04 AaQqpxAFGmxeBvSlpT0xL/QFwy8O0wGOZm9RTvk3W33wtQp+XJTOobQCv ez1PLsvIjuQ9BBALQdp0icSXXp7Vu6xil43egXNmHWYY/7WgCtdDnY9fZ l9V+C4CXNxlWqVzJ8EDWE4beYS17MnLNWhTjezCZmv9yyV7GDK60pIxfR g==; X-IronPort-AV: E=Sophos;i="6.21,268,1763391600"; d="scan'208";a="607384935" From: Shashank Balaji Date: Mon, 02 Feb 2026 18:51:02 +0900 Subject: [PATCH 1/3] x86/x2apic: disable x2apic on resume if the kernel expects so MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260202-x2apic-fix-v1-1-71c8f488a88b@sony.com> References: <20260202-x2apic-fix-v1-0-71c8f488a88b@sony.com> In-Reply-To: <20260202-x2apic-fix-v1-0-71c8f488a88b@sony.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Suresh Siddha , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Ajay Kaher , Alexey Makhalov , Broadcom internal kernel review list , Jan Kiszka , Paolo Bonzini , Vitaly Kuznetsov , Juergen Gross , Boris Ostrovsky Cc: Ingo Molnar , linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, jailhouse-dev@googlegroups.com, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, Rahul Bukte , Shashank Balaji , Daniel Palmer , Tim Bird , stable@vger.kernel.org X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1476; i=shashank.mahadasyam@sony.com; h=from:subject:message-id; bh=paULGXp6rwtbR4pGaBXqE9RYtLD7iRkEUs2lKCF5e4o=; b=owGbwMvMwCU2bX1+URVTXyjjabUkhsyG4hUGCzw4VzFOfPGnVC7+kcNGzhiLW3NYOT9WyZ0Rv y9psSK2o5SFQYyLQVZMkaVUqfrX3hVBS3rOvFaEmcPKBDKEgYtTACaytoXhv9Nrfese5QfJMkqT Qxp2Whn+q/TjDzf7xqHB/8O9W3/eVob/iW1Xy2aecbmXM6u73+ju1V8pak2+7/wsF/ZYNW4wOtz NCwA= X-Developer-Key: i=shashank.mahadasyam@sony.com; a=openpgp; fpr=75227BFABDA852A48CCCEB2196AF6F727A028E55 X-ZohoMail-DKIM: pass (identity @sony.com) X-ZM-MESSAGEID: 1770026278522158500 In lapic_resume, ensure x2apic is actually disabled when the kernel expects= it to be disabled, i.e. when x2apic_mode =3D 0. x2apic_mode is set to 0 and x2apic is disabled on boot if the kernel doesn't support irq remapping or for other reasons. On resume from s2ram (/sys/power/mem_sleep =3D deep), firmware can re-enable x2apic, but the ker= nel continues using the xapic interface because it didn't check to see if someo= ne enabled x2apic behind its back, which causes hangs. This situation happens = on defconfig + bare metal + s2ram, on which this fix has been tested. Fixes: 6e1cb38a2aef ("x64, x2apic/intr-remap: add x2apic support, including= enabling interrupt-remapping") Cc: stable@vger.kernel.org Co-developed-by: Rahul Bukte Signed-off-by: Rahul Bukte Signed-off-by: Shashank Balaji --- arch/x86/kernel/apic/apic.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index d93f87f29d03..cc64d61f82cf 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -2456,6 +2456,12 @@ static void lapic_resume(void *data) if (x2apic_mode) { __x2apic_enable(); } else { + /* + * x2apic may have been re-enabled by the + * firmware on resuming from s2ram + */ + __x2apic_disable(); + /* * Make sure the APICBASE points to the right address * --=20 2.43.0 From nobody Sat Feb 7 08:27:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=sony.com ARC-Seal: i=1; a=rsa-sha256; t=1770026276; cv=none; d=zohomail.com; s=zohoarc; b=DZckiBtecl30QrVeeC2ed4JRj5wLhgqogeo63GFdPLVfXwtGXbVna36r0pqBQfJN8NU0D2YDO5DQieWKQZMV1mjnL58+uBFQvIm46blbVfEnOM5ojrqm4PwOTPuV+0rO3w+gV2vsxCgaGNchwF1H54HlP+kMch5TBd5JKd7htAo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770026276; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GI9OPx+uxZW/9+u+5es0pePWKf46Zy6n4IWktANHhfk=; b=fXR0ypWcBUK/g5wHkNeotmKVBq/sjxknHrmcGBnVT9MpQBLDRc2G84JKDiep8a4JtGUTrpT/1ungjVEqASRPyW8Z28/kJ1nPVMiZwrjPXRAlg1WDReLoR8L6Z6EweUShr/Uo0tU4NapSh2M6Y22ykKwLxS7a/ar61Slc//sJXd0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1770026276071861.8155759739867; Mon, 2 Feb 2026 01:57:56 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1218465.1527216 (Exim 4.92) (envelope-from ) id 1vmqgU-0001iM-CZ; Mon, 02 Feb 2026 09:57:30 +0000 Received: by outflank-mailman (output) from mailman id 1218465.1527216; Mon, 02 Feb 2026 09:57:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vmqgU-0001hX-8T; Mon, 02 Feb 2026 09:57:30 +0000 Received: by outflank-mailman (input) for mailman id 1218465; Mon, 02 Feb 2026 09:52:07 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vmqbH-0001Jw-EQ for xen-devel@lists.xenproject.org; Mon, 02 Feb 2026 09:52:07 +0000 Received: from jpms-ob01.noc.sony.co.jp (jpms-ob01.noc.sony.co.jp [2001:cf8:ace:41::4]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d14876f9-001c-11f1-b161-2bf370ae4941; Mon, 02 Feb 2026 10:52:02 +0100 (CET) Received: from unknown (HELO jpmta-ob1.noc.sony.co.jp) ([IPv6:2001:cf8:0:6e7::6]) by jpms-ob01.noc.sony.co.jp with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2026 18:51:38 +0900 Received: from unknown (HELO [127.0.1.1]) ([IPv6:2001:cf8:1:573:0:dddd:6b3e:119e]) by jpmta-ob1.noc.sony.co.jp with ESMTP; 02 Feb 2026 18:51:38 +0900 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d14876f9-001c-11f1-b161-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; s=s1jp; t=1770025922; x=1801561922; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=GI9OPx+uxZW/9+u+5es0pePWKf46Zy6n4IWktANHhfk=; b=e0byH80zs8rrbQ+SG/yAl5pVranguTJiTv2KWDsjEGqSkO0OssSgf3fK xLzgSY2byQDmZEO4/gMmtjRIcIrv2X6uzjUHJw77nRIxKz6zZi3K55kuO 38sboMnzWKGwEVC0Zp2KqjPEJLlHec1DN8AtGEPooANNGGJtI6coTmKye 5hIKBQTElzNhrXwgQOfvEpHM1OIIwfjdq1yl7+F60z6UYNgiQVOQnwjXj TvdVB5woj9IHUULn1vhdFdW7zWl1CVTL6qjcg2C/PMXGBcbnYXMGpbUti HU5HUQYXh7YyUpPOeZeRJyOI/VdGYcQrYiwlb3Do/Hh/Ox5hYn8ib/1Vc w==; X-IronPort-AV: E=Sophos;i="6.21,268,1763391600"; d="scan'208";a="607384937" From: Shashank Balaji Date: Mon, 02 Feb 2026 18:51:03 +0900 Subject: [PATCH 2/3] x86/defconfig: add CONFIG_IRQ_REMAP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260202-x2apic-fix-v1-2-71c8f488a88b@sony.com> References: <20260202-x2apic-fix-v1-0-71c8f488a88b@sony.com> In-Reply-To: <20260202-x2apic-fix-v1-0-71c8f488a88b@sony.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Suresh Siddha , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Ajay Kaher , Alexey Makhalov , Broadcom internal kernel review list , Jan Kiszka , Paolo Bonzini , Vitaly Kuznetsov , Juergen Gross , Boris Ostrovsky Cc: Ingo Molnar , linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, jailhouse-dev@googlegroups.com, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, Rahul Bukte , Shashank Balaji , Daniel Palmer , Tim Bird X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=897; i=shashank.mahadasyam@sony.com; h=from:subject:message-id; bh=WGBqeRf3m3q38dcFfIzoZC7KITAdIHJXG+fCWgOOD40=; b=owGbwMvMwCU2bX1+URVTXyjjabUkhsyG4hWJ5ZPesy10dLqdVPT13NLfdzYoem+Z+6FTrppr+ 3YRUxvJjlIWBjEuBlkxRZZSpepfe1cELek581oRZg4rE8gQBi5OAZiI71yG/3G5dneW7G7keJnx 4Wd+z+9zOUtZjcKVjm+qm6rqVBCX9Jnhf+n3kx2OkYsNn+1Qe6/XFrn9pXSWzssdU98b3/BZ2S2 XyAQA X-Developer-Key: i=shashank.mahadasyam@sony.com; a=openpgp; fpr=75227BFABDA852A48CCCEB2196AF6F727A028E55 X-ZohoMail-DKIM: pass (identity @sony.com) X-ZM-MESSAGEID: 1770026277739154100 Interrupt remapping is an architectural dependency of x2apic, which is alre= ady enabled in the defconfig. Enable CONFIG_IRQ_REMAP so that a defconfig kerne= l on bare metal actually uses x2apic. Co-developed-by: Rahul Bukte Signed-off-by: Rahul Bukte Signed-off-by: Shashank Balaji --- arch/x86/configs/x86_64_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_de= fconfig index 7d7310cdf8b0..269f7d808be4 100644 --- a/arch/x86/configs/x86_64_defconfig +++ b/arch/x86/configs/x86_64_defconfig @@ -230,6 +230,7 @@ CONFIG_EEEPC_LAPTOP=3Dy CONFIG_AMD_IOMMU=3Dy CONFIG_INTEL_IOMMU=3Dy # CONFIG_INTEL_IOMMU_DEFAULT_ON is not set +CONFIG_IRQ_REMAP=3Dy CONFIG_EXT4_FS=3Dy CONFIG_EXT4_FS_POSIX_ACL=3Dy CONFIG_EXT4_FS_SECURITY=3Dy --=20 2.43.0 From nobody Sat Feb 7 08:27:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=sony.com ARC-Seal: i=1; a=rsa-sha256; t=1770026268; cv=none; d=zohomail.com; s=zohoarc; b=E3LwnCVkWNay3F0KvFSiuezLx6h4ipZxevc39p9OR41OmoNVZ7ZSTtoy7htkY7Czhpr1MAcBkAlKBmfQG90Bmo/21mkzlGk47zV3jgVfF6b2gJRtNwXlv2fY7kfgYzqmW1E/ZAre14G7TADSxtHUcoC+uV77RUxHWi8HvP5DaIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770026268; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UGbV0HlypAsqDyqCwF4KKZshjhbYqkotn40a85H3Q7U=; b=XDAamUSpROEsvbSM0rWGvfmfC4Bt9hK0FSDswsr6TTTCRsQmstp+Wiy99ewKcPy+Sox8HzYez+JdjSDWSB31RVJsRLytYjaMU2wp7XAJac4ghesqXEKbWYQUnYfMaVLvEjgx6AqhIo0rOuV5X/aaRMwlkCzbOauuqTYjQo0ow9k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1770026268043350.9631019656499; Mon, 2 Feb 2026 01:57:48 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1218463.1527212 (Exim 4.92) (envelope-from ) id 1vmqgU-0001eN-6u; Mon, 02 Feb 2026 09:57:30 +0000 Received: by outflank-mailman (output) from mailman id 1218463.1527212; Mon, 02 Feb 2026 09:57:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vmqgU-0001cy-08; Mon, 02 Feb 2026 09:57:30 +0000 Received: by outflank-mailman (input) for mailman id 1218463; Mon, 02 Feb 2026 09:52:05 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vmqbE-0001Il-Va for xen-devel@lists.xenproject.org; Mon, 02 Feb 2026 09:52:04 +0000 Received: from jpms-ob01.noc.sony.co.jp (jpms-ob01.noc.sony.co.jp [2001:cf8:ace:41::4]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d2cc2a73-001c-11f1-9ccf-f158ae23cfc8; Mon, 02 Feb 2026 10:52:02 +0100 (CET) Received: from unknown (HELO jpmta-ob1.noc.sony.co.jp) ([IPv6:2001:cf8:0:6e7::6]) by jpms-ob01.noc.sony.co.jp with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2026 18:51:38 +0900 Received: from unknown (HELO [127.0.1.1]) ([IPv6:2001:cf8:1:573:0:dddd:6b3e:119e]) by jpmta-ob1.noc.sony.co.jp with ESMTP; 02 Feb 2026 18:51:38 +0900 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d2cc2a73-001c-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; s=s1jp; t=1770025922; x=1801561922; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=UGbV0HlypAsqDyqCwF4KKZshjhbYqkotn40a85H3Q7U=; b=Fsk8atP8nOli3A/kdU1FTFujNMxydunfy/0QabsYe7jNJhGm6H88rUTl inKAlL/r973SUJg9eT/QLvQ6XUQ5Z1zzVR3WfUx82Bh/+OVteJj5i9c0c i9g8QYmd1M2Fj6GWZ0zQGLNBVz7vA8wVOPX0KiVqO3vhAXRtayG1s6aam JyXxACjk15x5b0CeL9dCyap3V5e5y9+P4V5uVk2lZ9ONogp1rfsnTlbDL nFVA8cTmEmXDW5zHMNTWZ8HLFoZDQMYuHpAsQWRS6QQZHtlDkpL+jif+G i+LoAuD8joUkr/+y1Qm+QfGxsdGCUdd3H8PsWEFMyX0QDGANlaggsztfq w==; X-IronPort-AV: E=Sophos;i="6.21,268,1763391600"; d="scan'208";a="607384938" From: Shashank Balaji Date: Mon, 02 Feb 2026 18:51:04 +0900 Subject: [PATCH 3/3] x86/virt: rename x2apic_available to x2apic_without_ir_available MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260202-x2apic-fix-v1-3-71c8f488a88b@sony.com> References: <20260202-x2apic-fix-v1-0-71c8f488a88b@sony.com> In-Reply-To: <20260202-x2apic-fix-v1-0-71c8f488a88b@sony.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Suresh Siddha , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Ajay Kaher , Alexey Makhalov , Broadcom internal kernel review list , Jan Kiszka , Paolo Bonzini , Vitaly Kuznetsov , Juergen Gross , Boris Ostrovsky Cc: Ingo Molnar , linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, jailhouse-dev@googlegroups.com, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, Rahul Bukte , Shashank Balaji , Daniel Palmer , Tim Bird X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=8661; i=shashank.mahadasyam@sony.com; h=from:subject:message-id; bh=40ywH2ksTo16iKGC5c7aKcdzHSb3M0fEznHdLx5ChZY=; b=owGbwMvMwCU2bX1+URVTXyjjabUkhsyG4pV73BSkW2t+bFj8lP/axHMSXQ/nLg+dcOZBrWq1l IycyNnlHaUsDGJcDLJiiiylStW/9q4IWtJz5rUizBxWJpAhDFycAjAR/UqGn4xiaRxyy02Nn4be 9Xesdnx9Matg+r2d2y7WH5tzzWHmuTSG/4lN6178i2r5JLaG8/tKKYYCxeYn2uGibz7WxSq6yev mMAAA X-Developer-Key: i=shashank.mahadasyam@sony.com; a=openpgp; fpr=75227BFABDA852A48CCCEB2196AF6F727A028E55 X-ZohoMail-DKIM: pass (identity @sony.com) X-ZM-MESSAGEID: 1770026271105158500 No functional change. x86_init.hyper.x2apic_available is used only in try_to_enable_x2apic to che= ck if x2apic needs to be disabled if interrupt remapping support isn't present. B= ut the name x2apic_available doesn't reflect that usage. This is what x2apic_available is set to for various hypervisors: acrn boot_cpu_has(X86_FEATURE_X2APIC) mshyperv boot_cpu_has(X86_FEATURE_X2APIC) xen boot_cpu_has(X86_FEATURE_X2APIC) or false vmware vmware_legacy_x2apic_available kvm kvm_cpuid_base() !=3D 0 jailhouse x2apic_enabled() bhyve true default false Bare metal and vmware correctly check if x2apic is available without interr= upt remapping. The rest of them check if x2apic is enabled/supported, and kvm j= ust checks if the kernel is running on kvm. The other hypervisors may have to h= ave their checks audited. Also fix the backwards pr_info message printed on disabling x2apic because = of lack of irq remapping support. Compile tested with all the hypervisor guest support enabled. Co-developed-by: Rahul Bukte Signed-off-by: Rahul Bukte Signed-off-by: Shashank Balaji --- arch/x86/include/asm/x86_init.h | 4 ++-- arch/x86/kernel/apic/apic.c | 4 ++-- arch/x86/kernel/cpu/acrn.c | 2 +- arch/x86/kernel/cpu/bhyve.c | 2 +- arch/x86/kernel/cpu/mshyperv.c | 2 +- arch/x86/kernel/cpu/vmware.c | 2 +- arch/x86/kernel/jailhouse.c | 2 +- arch/x86/kernel/kvm.c | 2 +- arch/x86/kernel/x86_init.c | 12 ++++++------ arch/x86/xen/enlighten_hvm.c | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_ini= t.h index 6c8a6ead84f6..b270d9eed755 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h @@ -116,7 +116,7 @@ struct x86_init_pci { * struct x86_hyper_init - x86 hypervisor init functions * @init_platform: platform setup * @guest_late_init: guest late init - * @x2apic_available: X2APIC detection + * @x2apic_without_ir_available: is x2apic available without irq remap? * @msi_ext_dest_id: MSI supports 15-bit APIC IDs * @init_mem_mapping: setup early mappings during init_mem_mapping() * @init_after_bootmem: guest init after boot allocator is finished @@ -124,7 +124,7 @@ struct x86_init_pci { struct x86_hyper_init { void (*init_platform)(void); void (*guest_late_init)(void); - bool (*x2apic_available)(void); + bool (*x2apic_without_ir_available)(void); bool (*msi_ext_dest_id)(void); void (*init_mem_mapping)(void); void (*init_after_bootmem)(void); diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index cc64d61f82cf..8820b631f8a2 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1836,8 +1836,8 @@ static __init void try_to_enable_x2apic(int remap_mod= e) * Using X2APIC without IR is not architecturally supported * on bare metal but may be supported in guests. */ - if (!x86_init.hyper.x2apic_available()) { - pr_info("x2apic: IRQ remapping doesn't support X2APIC mode\n"); + if (!x86_init.hyper.x2apic_without_ir_available()) { + pr_info("x2apic: Not supported without IRQ remapping\n"); x2apic_disable(); return; } diff --git a/arch/x86/kernel/cpu/acrn.c b/arch/x86/kernel/cpu/acrn.c index 2c5b51aad91a..9204b98d4786 100644 --- a/arch/x86/kernel/cpu/acrn.c +++ b/arch/x86/kernel/cpu/acrn.c @@ -77,5 +77,5 @@ const __initconst struct hypervisor_x86 x86_hyper_acrn = =3D { .detect =3D acrn_detect, .type =3D X86_HYPER_ACRN, .init.init_platform =3D acrn_init_platform, - .init.x2apic_available =3D acrn_x2apic_available, + .init.x2apic_without_ir_available =3D acrn_x2apic_available, }; diff --git a/arch/x86/kernel/cpu/bhyve.c b/arch/x86/kernel/cpu/bhyve.c index f1a8ca3dd1ed..91a90a7459ce 100644 --- a/arch/x86/kernel/cpu/bhyve.c +++ b/arch/x86/kernel/cpu/bhyve.c @@ -61,6 +61,6 @@ const struct hypervisor_x86 x86_hyper_bhyve __refconst = =3D { .name =3D "Bhyve", .detect =3D bhyve_detect, .init.init_platform =3D x86_init_noop, - .init.x2apic_available =3D bhyve_x2apic_available, + .init.x2apic_without_ir_available =3D bhyve_x2apic_available, .init.msi_ext_dest_id =3D bhyve_ext_dest_id, }; diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index 579fb2c64cfd..61458855094a 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -760,7 +760,7 @@ const __initconst struct hypervisor_x86 x86_hyper_ms_hy= perv =3D { .name =3D "Microsoft Hyper-V", .detect =3D ms_hyperv_platform, .type =3D X86_HYPER_MS_HYPERV, - .init.x2apic_available =3D ms_hyperv_x2apic_available, + .init.x2apic_without_ir_available =3D ms_hyperv_x2apic_available, .init.msi_ext_dest_id =3D ms_hyperv_msi_ext_dest_id, .init.init_platform =3D ms_hyperv_init_platform, .init.guest_late_init =3D ms_hyperv_late_init, diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c index cb3f900c46fc..46d325818797 100644 --- a/arch/x86/kernel/cpu/vmware.c +++ b/arch/x86/kernel/cpu/vmware.c @@ -585,7 +585,7 @@ const __initconst struct hypervisor_x86 x86_hyper_vmwar= e =3D { .detect =3D vmware_platform, .type =3D X86_HYPER_VMWARE, .init.init_platform =3D vmware_platform_setup, - .init.x2apic_available =3D vmware_legacy_x2apic_available, + .init.x2apic_without_ir_available =3D vmware_legacy_x2apic_available, #ifdef CONFIG_AMD_MEM_ENCRYPT .runtime.sev_es_hcall_prepare =3D vmware_sev_es_hcall_prepare, .runtime.sev_es_hcall_finish =3D vmware_sev_es_hcall_finish, diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c index 9e9a591a5fec..84a0bbe15989 100644 --- a/arch/x86/kernel/jailhouse.c +++ b/arch/x86/kernel/jailhouse.c @@ -291,6 +291,6 @@ const struct hypervisor_x86 x86_hyper_jailhouse __refco= nst =3D { .name =3D "Jailhouse", .detect =3D jailhouse_detect, .init.init_platform =3D jailhouse_init_platform, - .init.x2apic_available =3D jailhouse_x2apic_available, + .init.x2apic_without_ir_available =3D jailhouse_x2apic_available, .ignore_nopv =3D true, }; diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 37dc8465e0f5..709eba87d58e 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -1042,7 +1042,7 @@ const __initconst struct hypervisor_x86 x86_hyper_kvm= =3D { .detect =3D kvm_detect, .type =3D X86_HYPER_KVM, .init.guest_late_init =3D kvm_guest_init, - .init.x2apic_available =3D kvm_para_available, + .init.x2apic_without_ir_available =3D kvm_para_available, .init.msi_ext_dest_id =3D kvm_msi_ext_dest_id, .init.init_platform =3D kvm_init_platform, #if defined(CONFIG_AMD_MEM_ENCRYPT) diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index ebefb77c37bb..9ddf8c901ac6 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c @@ -112,12 +112,12 @@ struct x86_init_ops x86_init __initdata =3D { }, =20 .hyper =3D { - .init_platform =3D x86_init_noop, - .guest_late_init =3D x86_init_noop, - .x2apic_available =3D bool_x86_init_noop, - .msi_ext_dest_id =3D bool_x86_init_noop, - .init_mem_mapping =3D x86_init_noop, - .init_after_bootmem =3D x86_init_noop, + .init_platform =3D x86_init_noop, + .guest_late_init =3D x86_init_noop, + .x2apic_without_ir_available =3D bool_x86_init_noop, + .msi_ext_dest_id =3D bool_x86_init_noop, + .init_mem_mapping =3D x86_init_noop, + .init_after_bootmem =3D x86_init_noop, }, =20 .acpi =3D { diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c index fe57ff85d004..42f3d21f313d 100644 --- a/arch/x86/xen/enlighten_hvm.c +++ b/arch/x86/xen/enlighten_hvm.c @@ -311,7 +311,7 @@ static uint32_t __init xen_platform_hvm(void) * detect PVH and panic there. */ h->init_platform =3D x86_init_noop; - h->x2apic_available =3D bool_x86_init_noop; + h->x2apic_without_ir_available =3D bool_x86_init_noop; h->init_mem_mapping =3D x86_init_noop; h->init_after_bootmem =3D x86_init_noop; h->guest_late_init =3D xen_hvm_guest_late_init; @@ -325,7 +325,7 @@ struct hypervisor_x86 x86_hyper_xen_hvm __initdata =3D { .detect =3D xen_platform_hvm, .type =3D X86_HYPER_XEN_HVM, .init.init_platform =3D xen_hvm_guest_init, - .init.x2apic_available =3D xen_x2apic_available, + .init.x2apic_without_ir_available =3D xen_x2apic_available, .init.init_mem_mapping =3D xen_hvm_init_mem_mapping, .init.guest_late_init =3D xen_hvm_guest_late_init, .init.msi_ext_dest_id =3D msi_ext_dest_id, --=20 2.43.0