From nobody Thu Oct 30 22:51:09 2025 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=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1756484259; cv=none; d=zohomail.com; s=zohoarc; b=E7ms2jLVu0f8akf4UG41itEQmjROkP7H/c5L6IEPYjXtBHTixTbTy4FC1jeEPnKWubyrrxbFB3CjM5lGRvQTqVrq2uAwxK7zurVcTFBALfJFFtIseN2Up947l6Fg5rh3UwicvvD/xABYQ/rozzKEqc1S297RHk3rQyUYOWpiyWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756484259; 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=HF/T7+4Ls9F6d44sa/t+0TCDlA7JApHmbmQIrgANsEw=; b=ZPJsoCK1xwSaE5nkIcxj6CS/FR87mrveBqgsrnl8kC4rKk5aqD6ABw8JyLPZs/gZARkjF1HUNM+MC2XpTDTxueXYgv3foCAhkNtzP97lZKgK/+CUq5sy9j/P3fJlTZVYUHUqA/4pDHASNbiZIcgL5eCmU/unD5gdxY5Bl2CzfZo= 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=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1756484259713206.48338619737365; Fri, 29 Aug 2025 09:17:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1101820.1454763 (Exim 4.92) (envelope-from ) id 1us1mw-0007Dt-BO; Fri, 29 Aug 2025 16:17:18 +0000 Received: by outflank-mailman (output) from mailman id 1101820.1454763; Fri, 29 Aug 2025 16:17:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1us1mw-0007Cy-7f; Fri, 29 Aug 2025 16:17:18 +0000 Received: by outflank-mailman (input) for mailman id 1101820; Fri, 29 Aug 2025 16:17:17 +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 1us1mv-0006Z8-9m for xen-devel@lists.xenproject.org; Fri, 29 Aug 2025 16:17:17 +0000 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [2a00:1450:4864:20::42b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a07cdd40-84f3-11f0-8dd7-1b34d833f44b; Fri, 29 Aug 2025 18:17:15 +0200 (CEST) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3ce772ce0dbso1302517f8f.0 for ; Fri, 29 Aug 2025 09:17:15 -0700 (PDT) Received: from localhost.localdomain (host-195-149-20-212.as13285.net. [195.149.20.212]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3d0a7691340sm2973328f8f.39.2025.08.29.09.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Aug 2025 09:17:13 -0700 (PDT) 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: a07cdd40-84f3-11f0-8dd7-1b34d833f44b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1756484234; x=1757089034; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HF/T7+4Ls9F6d44sa/t+0TCDlA7JApHmbmQIrgANsEw=; b=D9LnL7ULRBfQMINODDDXcIJdHZIosy8ennavZQAG2NvI8E7OeRYzBKdZpw0x4XPPmk kLb+vAOP+vl3qfx61uecPSvHo5KEnR9h4Yyj0WVoKxP1tbMVBmHk9ufXSA2Fzotfgj6V GqTP+/inVGf4wkFD2iB5iU7JVIMQ7CmeK3qEE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756484234; x=1757089034; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HF/T7+4Ls9F6d44sa/t+0TCDlA7JApHmbmQIrgANsEw=; b=k1r6MpspBSQgNHKInZGrXgVU6feNNM5EZ628dJuhbOZ/xNdjA6PkTXMS0PMvW+Rqyg QoU4avgmRfE8G9Qo598Shbe5KyRcTZOwvDQiqNdOkvDIR1lyfZh1bBQcZz582K+Fpzrr okk/KpUQ4583Bc665gJtT6cTZyBN9yAkB9ZFAXFEIzdFhPlZ8T+2vYQU0BufQYwM9YKJ k90K5/qHoRh7NNkRXzOTxRBCs970WeWXTA6uk8hlMlueTyLPxuuFATXx4jzLb3Jas7pM CY9rzNSG8c7c9dUv9fOmPCHXnGRpLqX2iEAeLs13qHWmUEjtIGwACJznjLtthC4OVQdZ nZfw== X-Gm-Message-State: AOJu0YxJd/8hrKAHn+55aO4FtDtj4FTj1yk2e9fuRfQF0dzzhD0yi9eW Qk/+sQuDmfFg1WWAkEAxBgFkhe/WLme4NNo3650nwv7QUBwQFH3i2bB3hJH/DeBvPu4ESPLfjaw 6x4bt X-Gm-Gg: ASbGncsYqQEJ/rlxU3p3pqkA6O7xt6cufmDGMJeds+HP9HAZhmlz8wkppL7KWNbxvMw DVPDoKqCs1tydqDf/LzOjqYkQKtgJVsoaeB0xhKezubdKpxMq6XzteD5B0XERgXDOhcq8sRxczG k+4V1vdsJcDbaRTsbh3bIWU/E5dy48QVITy3TIVLnnqgJgBPgNVPazenIMmQCj4NoueAlunk1e0 vAy2xqra8ZlTu2+H46zRLKWljvAipHALs3xdH5nM9GEjF6ONa4GvpYSA/kv+ALhOMn1h1YjVEH1 w/ijoOnGkh03HE6TfcOqRWjEP0odFi+49lUBFEjqqL6mGcVz04qJGiV1SUS609Pipr6TwnoVu1p syThzIVF5gVRpwPM76T6v/f5Alb0LtwA9ufS4U5rkmRO7iL7Fy0HhoHuc5D5ve8UAXZVptAa4F0 h0 X-Google-Smtp-Source: AGHT+IF9xRJfxl753+olKdRsofxIAWst2inT+AZXQPO1seRioepAvcNi36LHwQq0fGvYrHotlLjlfw== X-Received: by 2002:a5d:5f8d:0:b0:3c8:89e9:6ab3 with SMTP id ffacd0b85a97d-3c889e96d40mr17411778f8f.46.1756484234445; Fri, 29 Aug 2025 09:17:14 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 1/2] x86/apic: Get rid of get_physical_broadcast() Date: Fri, 29 Aug 2025 17:17:09 +0100 Message-Id: <20250829161710.1056772-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250829161710.1056772-1-andrew.cooper3@citrix.com> References: <20250829161710.1056772-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1756484261569124100 This is a port of Linux commit 517234446c1a ("x86/apic: Get rid of get_physical_broadcast()") to Xen. Thomas Gleixner notes: There is no point for this function. The only case where this is used is when there is no XAPIC available, which means the broadcast address is 0x= F. In Linux, users of get_physical_broadcast() have already been hidden behind CONFIG_X86_32 suggesting we can drop all of this, but that's a task for some other time. In Xen as with Linux, setup_ioapic_ids_from_mpc() and io_apic_get_unique_id= () are only called in pre-xAPIC cases, so can use a broadcast ID of 0xf. The only other user is __print_IO_APIC() for diagnostics, which can simply drop the check. No functional change. Link: https://lore.kernel.org/r/20240212154639.057209154@linutronix.de Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 add/remove: 0/1 grow/shrink: 0/3 up/down: 0/-165 (-165) Function old new delta __print_IO_APIC 980 975 -5 setup_IO_APIC 3018 2992 -26 io_apic_get_unique_id 719 686 -33 get_physical_broadcast 101 - -101 --- xen/arch/x86/apic.c | 8 -------- xen/arch/x86/include/asm/apic.h | 2 -- xen/arch/x86/io_apic.c | 16 ++++++++-------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index e3a2b84f1aae..70636b0bb585 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -133,14 +133,6 @@ static bool __read_mostly using_apic_timer; =20 static bool __read_mostly enabled_via_apicbase; =20 -int get_physical_broadcast(void) -{ - if (modern_apic()) - return 0xff; - else - return 0xf; -} - int get_maxlvt(void) { unsigned int v =3D apic_read(APIC_LVR); diff --git a/xen/arch/x86/include/asm/apic.h b/xen/arch/x86/include/asm/api= c.h index d8eda6df6d86..d22854953689 100644 --- a/xen/arch/x86/include/asm/apic.h +++ b/xen/arch/x86/include/asm/apic.h @@ -153,8 +153,6 @@ static inline u32 get_apic_id(void) =20 void apic_wait_icr_idle(void); =20 -int get_physical_broadcast(void); - static inline void ack_APIC_irq(void) { /* Docs say use 0 for future compatibility */ diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index 1816e1c0b9f4..42a9b653d397 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -1217,8 +1217,6 @@ static void /*__init*/ __print_IO_APIC(bool boot) printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID= ); printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.deliver= y_type); printk(KERN_DEBUG "....... : LTS : %X\n", reg_00.bits.LTS); - if (reg_00.bits.ID >=3D get_physical_broadcast()) - UNEXPECTED_IO_APIC(); if (reg_00.bits.__reserved_1 || reg_00.bits.__reserved_2) UNEXPECTED_IO_APIC(); =20 @@ -1475,6 +1473,7 @@ static void __init setup_ioapic_ids_from_mpc(void) int i; unsigned char old_id; unsigned long flags; + const uint32_t broadcast_id =3D 0xf; =20 /* * Don't check I/O APIC IDs for xAPIC systems. They have @@ -1504,7 +1503,7 @@ static void __init setup_ioapic_ids_from_mpc(void) =09 old_id =3D mp_ioapics[apic].mpc_apicid; =20 - if (mp_ioapics[apic].mpc_apicid >=3D get_physical_broadcast()) { + if (mp_ioapics[apic].mpc_apicid >=3D broadcast_id) { printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC tabl= e!...\n", apic, mp_ioapics[apic].mpc_apicid); printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", @@ -1521,10 +1520,10 @@ static void __init setup_ioapic_ids_from_mpc(void) { printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!..= .\n", apic, mp_ioapics[apic].mpc_apicid); - for (i =3D 0; i < get_physical_broadcast(); i++) + for (i =3D 0; i < broadcast_id; i++) if (!physid_isset(i, phys_id_present_map)) break; - if (i >=3D get_physical_broadcast()) + if (i >=3D broadcast_id) panic("Max APIC ID exceeded\n"); printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", i); @@ -2223,6 +2222,7 @@ int __init io_apic_get_unique_id (int ioapic, int api= c_id) static physid_mask_t __initdata apic_id_map =3D PHYSID_MASK_NONE; unsigned long flags; int i =3D 0; + const uint32_t broadcast_id =3D 0xf; =20 /* * The P4 platform supports up to 256 APIC IDs on two separate APIC=20 @@ -2240,7 +2240,7 @@ int __init io_apic_get_unique_id (int ioapic, int api= c_id) reg_00.raw =3D io_apic_read(ioapic, 0); spin_unlock_irqrestore(&ioapic_lock, flags); =20 - if (apic_id >=3D get_physical_broadcast()) { + if (apic_id >=3D broadcast_id) { printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying " "%d\n", ioapic, apic_id, reg_00.bits.ID); apic_id =3D reg_00.bits.ID; @@ -2253,12 +2253,12 @@ int __init io_apic_get_unique_id (int ioapic, int a= pic_id) if ( physid_isset(apic_id, apic_id_map) ) { =20 - for (i =3D 0; i < get_physical_broadcast(); i++) { + for (i =3D 0; i < broadcast_id; i++) { if ( !physid_isset(i, apic_id_map) ) break; } =20 - if (i =3D=3D get_physical_broadcast()) + if (i =3D=3D broadcast_id) panic("Max apic_id exceeded\n"); =20 printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, " --=20 2.39.5 From nobody Thu Oct 30 22:51:09 2025 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=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1756484247; cv=none; d=zohomail.com; s=zohoarc; b=bswUmvfcZDjZmQ3hryQ0UscjqAXh64OCu9Nowi8P5Kdmfxfl7zhnj+MjoArlJvjIm78Um2eG6UvYEtGwUtWr8YD+lpA1HHJzs3VGZJuplOph1YSJhHfRTVKKffJOn5GgClHsbk+RraA06RvR/XA4q7YIMOHw2Q1myS6UOpKQ0Ec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756484247; 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=xypB0QaWO3EyRJnuNNKYcPZslwzFz81Bl9dW+OTBh3w=; b=mamMwek7oRb0npGwjP+XDC0dtDHYDxMG5HGmeJSpTzP3GsMx0TStQ9Yas6AIA+zHj4CFfZP5kUkts6V/j2m2WcLTTiQzv2gUJcF8Lh/7NsdsoYYhTi0tglR7ZV/UlS0gGRncos1ZjoFz9gIFN4puFLvXytKuE7E3+yTh/DkC+9o= 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=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1756484247852599.6502835775129; Fri, 29 Aug 2025 09:17:27 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1101819.1454749 (Exim 4.92) (envelope-from ) id 1us1mv-0006nq-5s; Fri, 29 Aug 2025 16:17:17 +0000 Received: by outflank-mailman (output) from mailman id 1101819.1454749; Fri, 29 Aug 2025 16:17:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1us1mv-0006n4-08; Fri, 29 Aug 2025 16:17:17 +0000 Received: by outflank-mailman (input) for mailman id 1101819; Fri, 29 Aug 2025 16:17:16 +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 1us1mu-0006FV-Ev for xen-devel@lists.xenproject.org; Fri, 29 Aug 2025 16:17:16 +0000 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [2a00:1450:4864:20::42e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a0dfa72d-84f3-11f0-8adc-4578a1afcccb; Fri, 29 Aug 2025 18:17:16 +0200 (CEST) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3d17731ac0fso163252f8f.0 for ; Fri, 29 Aug 2025 09:17:16 -0700 (PDT) Received: from localhost.localdomain (host-195-149-20-212.as13285.net. [195.149.20.212]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3d0a7691340sm2973328f8f.39.2025.08.29.09.17.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Aug 2025 09:17:14 -0700 (PDT) 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: a0dfa72d-84f3-11f0-8adc-4578a1afcccb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1756484235; x=1757089035; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xypB0QaWO3EyRJnuNNKYcPZslwzFz81Bl9dW+OTBh3w=; b=RN4WntICOsvs/G1Zeol/YZQDMb+feEF3WNUbzNft1UVVuuyr/h1yCjxpDpvXHKNU7B 1AQ/GpsGgqJGHlsvW3JNC8zBm+FNq9vitdkm4WqfQCotDqhX7yDlOPsh3GwaweLtyLOv xTwrrLSwTID+bhXKgbbz7xVkAQE5aNeQldA5c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756484235; x=1757089035; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xypB0QaWO3EyRJnuNNKYcPZslwzFz81Bl9dW+OTBh3w=; b=ltSR7MoM3LZMVQy21+h9LroQ6OCgpQonbORswJFda5eAS4B7zlhWyex+R5ns3HK+Pr 6CZlCilhSvovnIS10MR4OpJGk02FpBHTQVLb3HZ86PGXJCjRw1C6kTDLa8NnzxfzlWdx qdkA07gH2QKP2Kai4FbHFsbHh8FT68KzEUWZdtwUAylAu2lJ3yXso6HuybmJU1WIy6qj BE3qOLyGrCo2AnMZLPdmL9gvSyzA1/04zJOsDG4AMwo+Ulrg0Z3R5hKAjhng8Fd71UUq TROjzfJiZRUtO6yDkqphAKEKKa4KR63M+OeX4Wp1UJSj6DmpplD/4p1xEgyygoNg3cQE Dp0A== X-Gm-Message-State: AOJu0YxrMGHh6tVpZx81OL/FqjfPpLjMrZz+iPI/OUC6uZ/ef4zXNFPP LTs4iVsuNpvPBlT0G1ER88de9SW99J3jL4c6E2fcn77CPUzUqv+jmmLYaYpyv7jgbSaoWvknHYs vgU6Y X-Gm-Gg: ASbGncvKK2ADOWpm52e2/HW0J/BcGJTPCT4oO/P7etq6GBCpC5VuebSXgoeOeV/12cV aVJlw9x6rJSOGTXai2UTMMx9WUOiFEIO0MabzL/jB6MSu8E6aJMfidWn/8uP7pwla721kfzzqwu EQrkN33uwqBAvk2rnnbQF93YnRtovzMVHhI1Uyi8b1Ru095HCGa6klqKM0/Ewl7SuT6DZYZhWrh MvbKdm9U2G2bkkaAULzcBkxeo+at2Z7F/oF/cD7Ieen9/i4PTC068aRH1jz1zTPGBA4yctBCXzT LmCAX+2iSVcEZ1R3zTA1ltFDUAx/T/Mg8Lt5CY2jSazvA/Y4fIzrCTI+ETSUtoGoFcwxe3nzUYB u6hIBvM7p5h/S4rqPVMq7qdMWa7kVHm4B3hjrHHZaDGt5yQdCyQb3tMla8ioN8VxIgwYKmy5G2e Jx X-Google-Smtp-Source: AGHT+IHmAm+14XR15ZHgzCO/nodXWPgrcrxMGvgH0v5HPDtt591SMA3JKPerKkQV4vkAKJngNG+V9w== X-Received: by 2002:a5d:5f4b:0:b0:3d0:cd3e:7ad5 with SMTP id ffacd0b85a97d-3d0cd3e8402mr1759230f8f.32.1756484235117; Fri, 29 Aug 2025 09:17:15 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 2/2] x86/apic: Drop sync_Arb_IDs() Date: Fri, 29 Aug 2025 17:17:10 +0100 Message-Id: <20250829161710.1056772-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250829161710.1056772-1-andrew.cooper3@citrix.com> References: <20250829161710.1056772-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1756484249270116600 It is not obvious at first glance, but this is dead logic. On Intel, xAPIC (which is what modern_apic() is really checking for) predat= es 64bit support, while the Family 0xf check on AMD is the K8 processor. Simply drop the logic, rather than trying to adjust vendor/family logic. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-166 (-166) Function old new delta setup_IO_APIC 2992 2987 -5 sync_Arb_IDs 161 - -161 --- xen/arch/x86/apic.c | 32 -------------------------------- xen/arch/x86/include/asm/apic.h | 1 - xen/arch/x86/io_apic.c | 2 +- 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index 70636b0bb585..774771860002 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -91,23 +91,6 @@ static enum apic_mode apic_boot_mode =3D APIC_MODE_INVAL= ID; bool __read_mostly x2apic_enabled; bool __read_mostly directed_eoi_enabled; =20 -static int modern_apic(void) -{ - unsigned int lvr, version; - /* AMD systems use old APIC versions, so check the CPU */ - if (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_AMD && - boot_cpu_data.x86 >=3D 0xf) - return 1; - - /* Hygon systems use modern APIC */ - if (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_HYGON) - return 1; - - lvr =3D apic_read(APIC_LVR); - version =3D GET_APIC_VERSION(lvr); - return version >=3D 0x14; -} - /* * 'what should we do if we get a hw irq event on an illegal vector'. * each architecture has to answer this themselves. @@ -396,21 +379,6 @@ int __init verify_local_APIC(void) return 1; } =20 -void __init sync_Arb_IDs(void) -{ - /* Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1 - And not needed on AMD */ - if (modern_apic()) - return; - /* - * Wait for idle. - */ - apic_wait_icr_idle(); - - apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n"); - apic_write(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG | APIC_DM_I= NIT); -} - /* * An initial setup of the virtual wire mode. */ diff --git a/xen/arch/x86/include/asm/apic.h b/xen/arch/x86/include/asm/api= c.h index d22854953689..918f1cee3567 100644 --- a/xen/arch/x86/include/asm/apic.h +++ b/xen/arch/x86/include/asm/apic.h @@ -166,7 +166,6 @@ extern void disconnect_bsp_APIC (int virt_wire_setup); extern void disable_local_APIC (void); extern int verify_local_APIC (void); extern void cache_APIC_registers (void); -extern void sync_Arb_IDs (void); extern void init_bsp_APIC (void); extern void setup_local_APIC(bool bsp); extern void init_apic_mappings (void); diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index 42a9b653d397..17e6827f4bb3 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -2163,7 +2163,7 @@ void __init setup_IO_APIC(void) */ if (!acpi_ioapic) setup_ioapic_ids_from_mpc(); - sync_Arb_IDs(); + setup_IO_APIC_irqs(); init_IO_APIC_traps(); check_timer(); --=20 2.39.5