From nobody Thu Sep 3 07:05:09 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=vates.tech ARC-Seal: i=1; a=rsa-sha256; t=1787563993; cv=none; d=zohomail.com; s=zohoarc; b=izMwF5jtqEnJAR907WLYEzxi45NP5/4FtaqzrB5yalIfyEfLhs/ny6CGUnK3pQG71eiV58dHntZKbvXAyOAlDMiDvse+XKIl7EGqjJicz/6jYPYBVk05tfzcm8qJDd2XZ7S8RbNhAkzAPB2NJJ/Uh3jnP+qxW9blCSiPRlY33nk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787563993; h=Content-Type: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=frKZvkkoHuZO+4+eIBclrbgx87D7UdiHPGG3Sjh8yOc=; b=hmTST1u1t/5yrtNf7TOg+8IHVZ8RhdcIeCBrMMIS6XEE42DzQ1ZiDUxPWQQpTlD1XQcmvVt7cYo/7RU7U7KV7UuPCZB8ZfzU1ga8q4VbvGnc7RBnnG01w71dCrdEqym3f5ThbjohcllueV2vX5s1DFwQP6VzogMc2gPplwHWzmI= 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 178756399260511.929614416580193; Mon, 24 Aug 2026 02:33:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1398753.1634889 (Exim 4.92) (envelope-from ) id 1wyR2j-0007H9-PU; Mon, 24 Aug 2026 09:32:37 +0000 Received: by outflank-mailman (output) from mailman id 1398753.1634889; Mon, 24 Aug 2026 09:32:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyR2j-0007H2-Mn; Mon, 24 Aug 2026 09:32:37 +0000 Received: by outflank-mailman (input) for mailman id 1398753; Mon, 24 Aug 2026 09:32:36 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wyR2i-0007Gu-4k for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 09:32:36 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wyR2h-001LEV-Eu for xen-devel@lists.xenproject.org; Mon, 24 Aug 2026 11:32:35 +0200 Received: from [10.42.69.3] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a8c0fa9-8faa-0a2a0a5109dd-0a2a4503cea2-22 for ; Mon, 24 Aug 2026 11:32:35 +0200 Received: from [185.255.28.35] (helo=prod-mta-13-02.swg-srv.net) by tlsNG-33051d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a8c0fb2-fae8-0a2a45030019-b9ff1c23a21d-3 for ; Mon, 24 Aug 2026 11:32:35 +0200 Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr) (Authenticated sender: 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e) by prod-mta-13-02.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id 1a0331d3dbc000c4f3.005 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 24 Aug 2026 09:32:29 +0000 Received: from localhost.localdomain (88-188-240-210.subs.proxad.net [88.188.240.210]) (Authenticated sender: teddy.astie@vates.tech) by mail2.vates.fr (Postfix) with ESMTPSA id B1BF181C0F; Mon, 24 Aug 2026 11:32:28 +0200 (CEST) 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=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:Feedback-ID" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; q=dns/txt; s=selector1; bh=frKZvkkoHuZO+4+eIBclrbgx87D7UdiHPGG3Sjh8yOc=; h=from:subject:date:message-id:to:cc:mime-version:content-type:feedback-id; b=My4odkJLBO7r4pTldO8P4Rz15mkVZC8//CHKMqNxraZDX7QQ4nXjO/GJaA5IOvacteE7VvUrB OcAoI5srn46SXYRx8M3RCBb+rlJaaDhct5TZE+t3+ScF/OGYlUYwAyTVGrKiHsKv7d69y9oYsUr YuL+WnFB5i5QvmhjRKrCFDJXwWQ/NwX3gEdr+8xKxBrDPVSbi9ejcvaPFJuXvgS5F+h9pmqSY32 G2PpscrTU2cINrFJNQFNJdbrMHN2rEza1N8zS4mNVpdmYH50EVT0IOJCIbrIqaf1TILAvehh/Sp Bo3Aqb8Fmj84OJS48e51VpdpvSV3TZgZcUWOqmXIaGlg== X-Zone-Loop: 3f1f859c254e0d9ecc5ab89c0d9f252527c8cfc0b01d x-campaign-type: default x-transaction-id: bd0b3e67-a9e3-473f-9845-76bf1b19e373 x-swg-uid: 01-52ff2f37-3c8a-4b48-bdb7-c16eb44b22d6 X-Mailer: Sweego Message-ID: <1787563949.8631fc262581453bbf619ec5b2062170.1a0331d3dbc000c4f3@vates.tech> x-swg-bid: 1787563949.8631fc262581453bbf619ec5b2062170.1a0331d3dbc000c4f3 Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego x-campaign-id: default x-client-id: 8631fc262581453bbf619ec5b2062170 X-Originating-IP: [37.26.189.201] From: Teddy Astie To: xen-devel@lists.xenproject.org Cc: Teddy Astie , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Frediano Ziglio Subject: [PATCH v2] public/xen.h: Update comment on mmu_update sub-command size and PTE alignment Date: Mon, 24 Aug 2026 11:31:36 +0200 MIME-Version: 1.0 X-BM-Disclaimer: Yes Content-Type: multipart/alternative; boundary="-=Part.2999.e393777c230f96c6.1a0331d3b9b.11373df49aec6867=-" X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1787563948959 X-purgate-ID: tlsNG-33051d/1787563955-6ECCB4E9-C7AF6876/0/0 X-purgate-type: clean X-purgate-size: 4750 X-ZohoMail-DKIM: pass (identity @vates.tech) X-ZM-MESSAGEID: 1787563994629158500 ---=Part.2999.e393777c230f96c6.1a0331d3b9b.11373df49aec6867=- Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" HYPERVISOR_mmu_update passes a set of request, where each request has a poi= nter to the PTE along with a sub-command. The PTE alignment padding is used to transport the sub-command while the re= st is used as an address to a PTE entry. The current documentation state that = the 2 first bits are used for sub-command, hence the other ones for PTE which imply here a 4-bytes alignment on PTEs. On PV64 and PV32-PAE guests, all pagetable PTEs are 8-bytes aligned, hence off-by-4 PTEs addresses are always incorrect. Non-PAE PV32 guests used "legacy pagetables" which had 4-byte aligned PTEs. However, support had been completely removed since Xen 4.0, and was only available when Xen was built in 32-bits non-PAE mode [1]. Current Xen logic behaves as if 3 bits are used as sub-command, thus all off-by-4 PTEs are actually rejected as being unknown sub-commands. Adjust the documentation to match the current logic implemented in Xen, also expanding the documented sub-command parameter to 3 bits. [1] 84d54d5d8b31 ("i386: Remove non-PAE hypervisor build target.") Signed-off-by: Frediano Ziglio Signed-off-by: Teddy Astie --- v2: * Fixed typos * Added Frediano Ziglio S-o-B * Added historical note regarding non-PAE Xen. xen/include/public/xen.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index 2149b8dd38..cf32e74f14 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -218,16 +218,16 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t); * x =3D=3D 0 =3D> PFD =3D=3D DOMID_SELF * x !=3D 0 =3D> PFD =3D=3D x - 1 * - * Sub-commands: ptr[1:0] specifies the appropriate MMU_* command. + * Sub-commands: ptr[2:0] specifies the appropriate MMU_* command. * ------------- - * ptr[1:0] =3D=3D MMU_NORMAL_PT_UPDATE: + * ptr[2:0] =3D=3D MMU_NORMAL_PT_UPDATE: * Updates an entry in a page table belonging to PFD. If updating an L1 ta= ble, * and the new table entry is valid/present, the mapped frame must belong = to * FD. If attempting to map an I/O page then the caller assumes the privil= ege * of the FD. * FD =3D=3D DOMID_IO: Permit /only/ I/O mappings, at the priv level of th= e caller. * FD =3D=3D DOMID_XEN: Map restricted areas of Xen's heap space. - * ptr[:2] -- Machine address of the page-table entry to modify. + * ptr[:3] -- Machine address of the page-table entry to modify. * val -- Value to write. * * There also certain implicit requirements when using this hypercall. The @@ -260,21 +260,26 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t); * hypercall. Also if so desired the OS can also try to write to the PTE * and be trapped by the hypervisor (as the PTE entry is RO). * + * Note: Historically, Xen had support for non-PAE PV guests with 4-bytes = wide + * PTEs (if Xen was built in non-PAE mode); which support got remove= d in + * Xen 4.0. As a result, in current Xen,, all PTE are now always 8-b= yte + * aligned which allows expanding sub-commands part (now 3-bits wide= ). + * * To deallocate the pages, the operations are the reverse of the steps * mentioned above. The argument is MMUEXT_UNPIN_TABLE for all levels and = the * pagetable MUST not be in use (meaning that the cr3 is not set to it). * - * ptr[1:0] =3D=3D MMU_MACHPHYS_UPDATE: + * ptr[2:0] =3D=3D MMU_MACHPHYS_UPDATE: * Updates an entry in the machine->pseudo-physical mapping table. - * ptr[:2] -- Machine address within the frame whose mapping to modify. + * ptr[:3] -- Machine address within the frame whose mapping to modify. * The frame must belong to the FD, if one is specified. * val -- Value to write into the mapping entry. * - * ptr[1:0] =3D=3D MMU_PT_UPDATE_PRESERVE_AD: + * ptr[2:0] =3D=3D MMU_PT_UPDATE_PRESERVE_AD: * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are OR= ed * with those in @val. * - * ptr[1:0] =3D=3D MMU_PT_UPDATE_NO_TRANSLATE: + * ptr[2:0] =3D=3D MMU_PT_UPDATE_NO_TRANSLATE: * As MMU_NORMAL_PT_UPDATE above, but @val is not translated though FD * page tables. * --=20 2.55.0 --=20 | Vates=20 XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ---=Part.2999.e393777c230f96c6.1a0331d3b9b.11373df49aec6867=---