From nobody Mon Nov 23 22:31:50 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=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1793996098; cv=none; d=zohomail.com; s=zohoarc; b=i6bMCVdcqjnAyuHpLkMYFSHbwmVJqFtlW02AsS2CkXS3kILbKgPtPYP6/TmiwWxUdAIl+XZ+e+MM26sbrUXHy4GFp86a4UMVBE9zqjYXcwKKS2gP2t/ufl02QGjB7XysmhobdNXP/jGPyORPKRtpHuxxIwcOVtel5DhvVvjGaOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793996098; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=n3ycVQfER+OeRfPQv9zS8nTjBTKJpLB/0bWRaXvffxA=; b=KJjcCaqFTxzuLmd/eIRT+Vdq41Xz9dTroq5J+UpYnlW7HbTGEAPvcU2/brHOxUzxPQ3G/ILd6+W7q/+wS6Dk+ZizmlOTlVbHZfzhp3UD6ys+i4J1+j45ZAdeATUVfh6WDj8KI+vqCW0YNImQeqU/2zTo3OLy2aD0dZL54UUBNDo= 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 1793996098575736.9913487102054; Fri, 6 Nov 2026 12:14:58 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1477337.1682887 (Exim 4.92) (envelope-from ) id 1xPQKW-00020Y-Bz; Fri, 06 Nov 2026 20:14:32 +0000 Received: by outflank-mailman (output) from mailman id 1477337.1682887; Fri, 06 Nov 2026 20:14:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xPQKW-00020J-5d; Fri, 06 Nov 2026 20:14:32 +0000 Received: by outflank-mailman (input) for mailman id 1477337; Fri, 06 Nov 2026 20:14:30 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) id 1xPQKU-00020D-AM for xen-devel@lists.xenproject.org; Fri, 06 Nov 2026 20:14:30 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xPQKT-0089Xe-8Y for xen-devel@lists.xenproject.org; Fri, 06 Nov 2026 21:14:29 +0100 Received: from [10.42.69.6] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6aee3502-2eae-0a2a0a5409dd-0a2a4506a8b2-30 for ; Fri, 06 Nov 2026 21:14:29 +0100 Received: from [209.85.128.43] (helo=mail-wm1-f43.google.com) by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6aee3524-195a-0a2a45060019-d155802bb924-3 for ; Fri, 06 Nov 2026 21:14:28 +0100 Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4a208d93758so10965255e9.3 for ; Fri, 06 Nov 2026 12:14:28 -0800 (PST) Received: from localhost.localdomain (host-78-146-248-75.as13285.net. [78.146.248.75]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4b7efb134ccsm3988335e9.10.2026.11.06.12.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Nov 2026 12:14:27 -0800 (PST) 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1793996068; x=1794600868; darn=lists.xenproject.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=n3ycVQfER+OeRfPQv9zS8nTjBTKJpLB/0bWRaXvffxA=; b=Ju6vEj9Ua5rB88buun6RHEtH0Vijf35NMZuaHHfeREXMMu0mLsFa1IRdF5hxOmxW4H uW6Y5VrEt0Io4Th6BGAH5qWHVHwr/UgbvO/99W6lE+/XBIvfI0P65znn8fiqceZXmf1Q r1qdAU3PnIxsfUiEp6hCWmthsPieztjkZiXZQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793996068; x=1794600868; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=n3ycVQfER+OeRfPQv9zS8nTjBTKJpLB/0bWRaXvffxA=; b=zks3+DOf1EMNz6LKF9xFPUp8EzVV5XYumgJ/JdN5o0WJjRJsQfcGQZuCv1DDFg2swy ZMPdNZrqfB13x3DFJBelnskd3xJTuenRGWb3mhu9yA0hglZ/poEqBDM+PH78qJyH39wA iPlFKq3i+uo1MU1ingGKygFvHGACwk5BHgc5qKiSKtqu7ve1WWgr47vV1q51jzX6Bjwz mhY6xGpjOTTkFp7Bt0VgYUwBHRMV/lW12WK4NBW4OMHoFSdQNl5Sab+5FPKxSNDRRl3C meswo9JDf8K1FbhtP3fniiq1/DymxkyCGHN3bx0HIRJRzVwSsahQ1/obe178qAizTn3B EBhQ== X-Gm-Message-State: APuU4Z9hfa97T9rHIJM20uVNWPak3wPyVNPNa6vGVpNLL8aZc8WIA6xt SvPLqFY4ZRqGnsha6lj7zxKwAnkSIkD8ys2zA3hClVVAV2hjik/UZSdgvZs9cY17O9wQaNuANiA EWTvQW1s= X-Gm-Gg: AYBFou0p+DuOqHTCO6eIFj0Rzxcp39wUmqZ41NerZFicu3o1dSJ+U7P1V9NBjYnvNKi 27/BWweynpzhavOHNQ8yuoDDHbdZe3yjTRC62NiJE1QOl3cUWxjzuTRB5Q+/wfBV0yTbmrZ6N37 68R/pX53BaLJQ4ddy6iLUvbcBwE9x7PJcbncLU2WZfZ0tVmZA3dIJoq9cxnS9izH/Q9yyqAWZ3H hZv5HNioEbLiRQRtRRseP4tMnczqrV76fwek3oInFk5B8g/wFPqaqfvI+JzSqi4DP1Ojbb0QhwK iNdLHpCASni30uNf1TTFkg5CBBqkSCgT0/10qOxTYZgbQkBgm4bte0O14HhiKe2fM1ByBPO3CKj uxDTqMQj1DM2INbQThjF0DJE2zW+r5urU0B9hVmk4TTnRvrCi7U3Wxip72RhmvJYWBfRHTNjnVp FlUb7PYbwXcnLTWswnq3UPi+2sg/rKlt0uYeRUGvfJWz3PLb6SiCcyhCNjkIG9M1ywPtOsYMv6Q nD1gdtPDBjZZ4CvxAacTRxKnezw/H4GVBeTXsF43MPVRW7DBqEb/XaxUMYo7uZb+ldE4UQZvJ/Y ePZq9CXDQhEn57n637988/DUbv1nizTUcHJWE/Z4+abGYhf0yamRW2ZIngLvitvBMXou4QLVJCh msvs= X-Received: by 2002:a05:600c:c8a:b0:4a1:f377:5c75 with SMTP id 5b1f17b1804b1-4b6e0454dbfmr62745665e9.33.1793996068148; Fri, 06 Nov 2026 12:14:28 -0800 (PST) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Jason Andryuk , Denis Mukhin , Ross Lagerwall Subject: [PATCH RFC] x86/hvm: Disallow modifying the APIC_ID register Date: Fri, 6 Nov 2026 20:14:26 +0000 Message-Id: <20261106201426.2785335-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-16d1c6/1793996068-FDC0F77B-887031CB/10/78276251493 X-purgate-type: spam X-purgate-size: 2454 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1793996101034158500 The APIC_ID register is strictly read-only in x2APIC mode. In xAPIC mode, both Intel and AMD document the read-only-ness as being implementation dependent. In practice, for Intel it's read-only on any x2APIC-capable hardware (Nehal= em and later, so almost two decades now). For AMD, the register is writeable = but doing so trucates the 32bit x2APIC ID, so in practice nothing (not even the firmware) does modify it. Just as we disallow changing the LAPIC base for ease of supporting APIC virtualisation extentions, ignore guest writes to the APIC_ID in xAPIC mode. Note, this still allows the toolstack to configure APIC IDs, for migration = and topology reasons. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Teddy Astie CC: Jason Andryuk CC: Denis Mukhin CC: Ross Lagerwall This patch is from 2019. I apparently never got as far as sending it... This is even lower risk than disallowing changing the xAPIC MMIO window. There's been no comment or issue with that restriction, which has been in place since 2018. It is however RFC. * Without this APIC_ID restriction, we need to modify the logical id table= in response to changes, including disabling AVIC domain-wide if the guest s= ets a layout which can't be expressed. Intel have gained a similar table wi= th their IPI Virt capability on SPR and later. * Both Intel and AMD allow writes to the APIC_ID to be accelerated, and gi= ve a trap VMExit after the backing page has been updated. So if we're going to enforce this restriction then we need the VMExit to undo the modification. --- xen/arch/x86/hvm/vlapic.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index 6698779e227c..358fdd4baf92 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -795,10 +795,6 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg= , uint32_t val) =20 switch ( reg ) { - case APIC_ID: - vlapic_set_reg(vlapic, APIC_ID, val); - break; - case APIC_ESR: val =3D xchg(&vlapic->hw.pending_esr, 0); vlapic_set_reg(vlapic, APIC_ESR, val); base-commit: c4a09c112c391ffc1aea33afff49ffb28156fbdb --=20 2.39.5