From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:11:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900695.1308536 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGoK-00014O-2T; Tue, 04 Mar 2025 01:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900695.1308536; Tue, 04 Mar 2025 01:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGoJ-00014B-UK; Tue, 04 Mar 2025 01:11:03 +0000
Received: by outflank-mailman (input) for mailman id 900695;
 Tue, 04 Mar 2025 01:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGoI-00013z-F3
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGoI-0012vU-1o
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGoI-005Wko-0r
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FV7SJCLYF4uSYxnOwB4XUZhoiWC1qfe5zzVuw5YyHtY=; b=wCRnMkCa+9X8doqQ97Hf8v6FyQ
	prTcwl7mUX6VQYj9tDFZempz652MxSiMn7YhUVIjqzo5BL7wTwtXpll7nI2I0Fn6Q87qdtPJJ9z2K
	qy743NWLsZMHtRX/V6e3yGDn7tGmiCqIwYroeBTmxfDl/Lz6KMqzQzOHxPQMmF3b04rw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: upgrade Linux kernel for arm64 tests to 6.6.74
Message-Id: <E1tpGoI-005Wko-0r@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:11:02 +0000

commit 87f87a5586b8c4bcee08ae6b82a985e242ab21dd
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Jan 31 15:32:53 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:03:46 2025 -0800

    automation: upgrade Linux kernel for arm64 tests to 6.6.74
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/gitlab-ci/build.yaml                    |  4 +--
 automation/gitlab-ci/test.yaml                     |  2 +-
 .../tests-artifacts/kernel/5.19-arm64v8.dockerfile | 37 ---------------------
 .../kernel/6.6.74-arm64v8.dockerfile               | 38 ++++++++++++++++++++++
 4 files changed, 41 insertions(+), 40 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 6a2e491534..5995063d77 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -269,9 +269,9 @@ alpine-3.18-arm64-rootfs-export:
   tags:
     - arm64
 
-kernel-5.19-arm64-export:
+kernel-6.6.74-arm64-export:
   extends: .test-jobs-artifact-common
-  image: registry.gitlab.com/xen-project/xen/tests-artifacts/kernel:5.19-arm64v8
+  image: registry.gitlab.com/xen-project/xen/tests-artifacts/kernel:6.6.74-arm64v8
   script:
     - mkdir binaries && cp /Image binaries/Image
   artifacts:
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 1822e3ea5f..6ad45269ea 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -4,7 +4,7 @@
 
 .arm64-test-needs: &arm64-test-needs
   - alpine-3.18-arm64-rootfs-export
-  - kernel-5.19-arm64-export
+  - kernel-6.6.74-arm64-export
   - qemu-system-aarch64-6.0.0-arm64-export
 
 .arm32-test-needs: &arm32-test-needs
diff --git a/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile b/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
deleted file mode 100644
index 8e33995ba3..0000000000
--- a/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
+++ /dev/null
@@ -1,37 +0,0 @@
-# syntax=docker/dockerfile:1
-FROM --platform=linux/arm64/v8 debian:bookworm
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV LINUX_VERSION=5.19
-ENV USER root
-
-RUN mkdir /build
-WORKDIR /build
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        bc \
-        curl \
-        flex \
-        bison \
-        && \
-    \
-    # Build the kernel
-    curl -fsSLO https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-"$LINUX_VERSION".tar.xz && \
-    tar xvJf linux-"$LINUX_VERSION".tar.xz && \
-    cd linux-"$LINUX_VERSION" && \
-    make defconfig && \
-    sed -i 's/CONFIG_IPV6=m/CONFIG_IPV6=y/g' .config && \
-    sed -i 's/CONFIG_BRIDGE=m/CONFIG_BRIDGE=y/g' .config && \
-    sed -i 's/# CONFIG_XEN_NETDEV_BACKEND is not set/CONFIG_XEN_NETDEV_BACKEND=y/g' .config && \
-    make -j$(nproc) Image.gz && \
-    cp arch/arm64/boot/Image / && \
-    cd /build && \
-    rm -rf linux-"$LINUX_VERSION"* && \
-    apt-get autoremove -y && \
-    apt-get clean && \
-    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/tests-artifacts/kernel/6.6.74-arm64v8.dockerfile b/automation/tests-artifacts/kernel/6.6.74-arm64v8.dockerfile
new file mode 100644
index 0000000000..73e5145425
--- /dev/null
+++ b/automation/tests-artifacts/kernel/6.6.74-arm64v8.dockerfile
@@ -0,0 +1,38 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/arm64/v8 debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV LINUX_VERSION=6.6.74
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        bc \
+        curl \
+        flex \
+        bison \
+        libssl-dev \
+        && \
+    \
+    # Build the kernel
+    curl -fsSLO https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-"$LINUX_VERSION".tar.xz && \
+    tar xvJf linux-"$LINUX_VERSION".tar.xz && \
+    cd linux-"$LINUX_VERSION" && \
+    make defconfig && \
+    sed -i 's/CONFIG_IPV6=m/CONFIG_IPV6=y/g' .config && \
+    sed -i 's/CONFIG_BRIDGE=m/CONFIG_BRIDGE=y/g' .config && \
+    sed -i 's/# CONFIG_XEN_NETDEV_BACKEND is not set/CONFIG_XEN_NETDEV_BACKEND=y/g' .config && \
+    make -j$(nproc) Image.gz && \
+    cp arch/arm64/boot/Image / && \
+    cd /build && \
+    rm -rf linux-"$LINUX_VERSION"* && \
+    apt-get autoremove -y && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:11:16 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900696.1308540 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGoT-00015V-2Y; Tue, 04 Mar 2025 01:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900696.1308540; Tue, 04 Mar 2025 01:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGoS-00015N-Vq; Tue, 04 Mar 2025 01:11:12 +0000
Received: by outflank-mailman (input) for mailman id 900696;
 Tue, 04 Mar 2025 01:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGoS-00015H-FX
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGoS-0012vo-26
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGoS-005Wlg-1E
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fYd60c/WLGOM6Xe47fl8CNIt3NmdvKHaaFMnh91kgBo=; b=gy/8+mdAc/cJw0WtEjBCgSjRj+
	2cCTX+V+9tRJdjLdBgjTI2D+65uH/3iTjxmAG6SyVWz4sqvafoXZyJJ/NUpLDF11sdeBuuCSOoFYx
	VnFlKKqI5l5p4EFL88r4nVsvOjjtfWAfoqThLN69ph8a7SmTrZTr7ReRx2cOp1ixNs5E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: upgrade arm32 kernel from bullseye to bookworm
Message-Id: <E1tpGoS-005Wlg-1E@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:11:12 +0000

commit 80ee4df5df1d89cf4ccaaca0562faee1cfa8c448
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Thu Feb 20 14:56:20 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    automation: upgrade arm32 kernel from bullseye to bookworm
    
    automation: upgrade arm32 kernel from bullseye to bookworm
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index 41f6e5d8e6..0c94e662aa 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -11,7 +11,7 @@ serial_log="$(pwd)/smoke.serial"
 
 cd binaries
 # Use the kernel from Debian
-curl --fail --silent --show-error --location --output vmlinuz https://deb.debian.org/debian/dists/bullseye/main/installer-armhf/current/images/netboot/vmlinuz
+curl --fail --silent --show-error --location --output vmlinuz https://deb.debian.org/debian/dists/bookworm/main/installer-armhf/current/images/netboot/vmlinuz
 # Use a tiny initrd based on busybox from Alpine Linux
 curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/armhf/alpine-minirootfs-3.15.1-armhf.tar.gz
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900697.1308543 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGod-00018D-3e; Tue, 04 Mar 2025 01:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900697.1308543; Tue, 04 Mar 2025 01:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGod-000185-13; Tue, 04 Mar 2025 01:11:23 +0000
Received: by outflank-mailman (input) for mailman id 900697;
 Tue, 04 Mar 2025 01:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGoc-00017v-IS
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGoc-0012vu-2U
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGoc-005WmF-1X
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0vTOdwDIprJ7LHu0doD19dcQy+hliFuFTpskCTB6UW4=; b=PQR1BVLQrUUrdOCMlK/y3r00qh
	G61uZe/uYG0InVqSDR7zYrhhhCkA8dpeylV4JhBEwkSQ6yU8kDk92AY3YkkMhiJWSlgDo6S6cuV59
	oe8dHBMJzjlQEEDRX8ORM40Y/l8KNayIFJuKGKMhFXesFz1ldzkZcQq8SgBd7SMuv490=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Alloc XenStore page for Dom0less DomUs from hypervisor
Message-Id: <E1tpGoc-005WmF-1X@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:11:22 +0000

commit df2c03e2ebfedd741110a978b63890d57daede0c
Author:     Henry Wang <xin.wang2@amd.com>
AuthorDate: Fri May 24 15:55:20 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    xen/arm: Alloc XenStore page for Dom0less DomUs from hypervisor
    
    There are use cases (for example using the PV driver) in Dom0less
    setup that require Dom0less DomUs start immediately with Dom0, but
    initialize XenStore later after Dom0's successful boot and call to
    the init-dom0less application.
    
    An error message can seen from the init-dom0less application on
    1:1 direct-mapped domains:
    ```
    Allocating magic pages
    memory.c:238:d0v0 mfn 0x39000 doesn't belong to d1
    Error on alloc magic pages
    ```
    
    The "magic page" is a terminology used in the toolstack as reserved
    pages for the VM to have access to virtual platform capabilities.
    Currently the magic pages for Dom0less DomUs are populated by the
    init-dom0less app through populate_physmap(), and populate_physmap()
    automatically assumes gfn == mfn for 1:1 direct mapped domains. This
    cannot be true for the magic pages that are allocated later from the
    init-dom0less application executed in Dom0. For domain using statically
    allocated memory but not 1:1 direct-mapped, similar error "failed to
    retrieve a reserved page" can be seen as the reserved memory list is
    empty at that time.
    
    Since for init-dom0less, the magic page region is only for XenStore.
    To solve above issue, this commit allocates the XenStore page for
    Dom0less DomUs at the domain construction time. The PFN will be
    noted and communicated to the init-dom0less application executed
    from Dom0. To keep the XenStore late init protocol, set the connection
    status to XENSTORE_RECONNECT.
    
    Since the guest magic region allocation from init-dom0less is for
    XenStore, and the XenStore page is now allocated from the hypervisor,
    instead of hardcoding the guest magic pages region, use
    xc_hvm_param_get() to get the XenStore page PFN. Rename alloc_xs_page()
    to get_xs_page() to reflect the changes.
    
    With this change, some existing code is not needed anymore, including:
    (1) The definition of the XenStore page offset.
    (2) Call to xc_domain_setmaxmem() and xc_clear_domain_page() as we
        don't need to set the max mem and clear the page anymore.
    (3) Foreign mapping of the XenStore page, setting of XenStore interface
        status and HVM_PARAM_STORE_PFN from init-dom0less, as they are set
        by the hypervisor.
    
    Take the opportunity to do some coding style improvements when possible.
    
    Reported-by: Alec Kwapis <alec.kwapis@medtronic.com>
    Signed-off-by: Henry Wang <xin.wang2@amd.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Tested-by: Michal Orzel <michal.orzel@amd.com>
---
 tools/helpers/init-dom0less.c | 58 +++++++++++--------------------------------
 xen/arch/arm/dom0less-build.c | 56 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 69 insertions(+), 45 deletions(-)

diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c
index fee93459c4..2b51965fa7 100644
--- a/tools/helpers/init-dom0less.c
+++ b/tools/helpers/init-dom0less.c
@@ -16,30 +16,18 @@
 
 #include "init-dom-json.h"
 
-#define XENSTORE_PFN_OFFSET 1
 #define STR_MAX_LENGTH 128
 
-static int alloc_xs_page(struct xc_interface_core *xch,
-                         libxl_dominfo *info,
-                         uint64_t *xenstore_pfn)
+static int get_xs_page(struct xc_interface_core *xch, libxl_dominfo *info,
+                       uint64_t *xenstore_pfn)
 {
     int rc;
-    const xen_pfn_t base = GUEST_MAGIC_BASE >> XC_PAGE_SHIFT;
-    xen_pfn_t p2m = (GUEST_MAGIC_BASE >> XC_PAGE_SHIFT) + XENSTORE_PFN_OFFSET;
 
-    rc = xc_domain_setmaxmem(xch, info->domid,
-                             info->max_memkb + (XC_PAGE_SIZE/1024));
-    if (rc < 0)
-        return rc;
-
-    rc = xc_domain_populate_physmap_exact(xch, info->domid, 1, 0, 0, &p2m);
-    if (rc < 0)
-        return rc;
-
-    *xenstore_pfn = base + XENSTORE_PFN_OFFSET;
-    rc = xc_clear_domain_page(xch, info->domid, *xenstore_pfn);
-    if (rc < 0)
-        return rc;
+    rc = xc_hvm_param_get(xch, info->domid, HVM_PARAM_STORE_PFN, xenstore_pfn);
+    if (rc < 0) {
+        printf("Failed to get HVM_PARAM_STORE_PFN\n");
+        return 1;
+    }
 
     return 0;
 }
@@ -100,6 +88,7 @@ static bool do_xs_write_vm(struct xs_handle *xsh, xs_transaction_t t,
  */
 static int create_xenstore(struct xs_handle *xsh,
                            libxl_dominfo *info, libxl_uuid uuid,
+                           uint64_t xenstore_pfn,
                            evtchn_port_t xenstore_port)
 {
     domid_t domid;
@@ -145,8 +134,7 @@ static int create_xenstore(struct xs_handle *xsh,
     rc = snprintf(target_memkb_str, STR_MAX_LENGTH, "%"PRIu64, info->current_memkb);
     if (rc < 0 || rc >= STR_MAX_LENGTH)
         return rc;
-    rc = snprintf(ring_ref_str, STR_MAX_LENGTH, "%lld",
-                  (GUEST_MAGIC_BASE >> XC_PAGE_SHIFT) + XENSTORE_PFN_OFFSET);
+    rc = snprintf(ring_ref_str, STR_MAX_LENGTH, "%"PRIu64, xenstore_pfn);
     if (rc < 0 || rc >= STR_MAX_LENGTH)
         return rc;
     rc = snprintf(xenstore_port_str, STR_MAX_LENGTH, "%u", xenstore_port);
@@ -230,7 +218,6 @@ static int init_domain(struct xs_handle *xsh,
     libxl_uuid uuid;
     uint64_t xenstore_evtchn, xenstore_pfn;
     int rc;
-    struct xenstore_domain_interface *intf;
 
     printf("Init dom0less domain: %u\n", info->domid);
 
@@ -245,20 +232,11 @@ static int init_domain(struct xs_handle *xsh,
     if (!xenstore_evtchn)
         return 0;
 
-    /* Alloc xenstore page */
-    if (alloc_xs_page(xch, info, &xenstore_pfn) != 0) {
-        printf("Error on alloc magic pages\n");
-        return 1;
-    }
-
-    intf = xenforeignmemory_map(xfh, info->domid, PROT_READ | PROT_WRITE, 1,
-                                &xenstore_pfn, NULL);
-    if (!intf) {
-        printf("Error mapping xenstore page\n");
+    /* Get xenstore page */
+    if (get_xs_page(xch, info, &xenstore_pfn) != 0) {
+        printf("Error on getting xenstore page\n");
         return 1;
     }
-    intf->connection = XENSTORE_RECONNECT;
-    xenforeignmemory_unmap(xfh, intf, 1);
 
     rc = xc_dom_gnttab_seed(xch, info->domid, true,
                             (xen_pfn_t)-1, xenstore_pfn, 0, 0);
@@ -272,19 +250,11 @@ static int init_domain(struct xs_handle *xsh,
     if (rc)
         err(1, "gen_stub_json_config");
 
-    /* Now everything is ready: set HVM_PARAM_STORE_PFN */
-    rc = xc_hvm_param_set(xch, info->domid, HVM_PARAM_STORE_PFN,
-                          xenstore_pfn);
-    if (rc < 0)
-        return rc;
-
-    rc = create_xenstore(xsh, info, uuid, xenstore_evtchn);
+    rc = create_xenstore(xsh, info, uuid, xenstore_pfn, xenstore_evtchn);
     if (rc)
         err(1, "writing to xenstore");
 
-    rc = xs_introduce_domain(xsh, info->domid,
-            (GUEST_MAGIC_BASE >> XC_PAGE_SHIFT) + XENSTORE_PFN_OFFSET,
-            xenstore_evtchn);
+    rc = xs_introduce_domain(xsh, info->domid, xenstore_pfn, xenstore_evtchn);
     if (!rc)
         err(1, "xs_introduce_domain");
     return 0;
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 49d1f14d65..6c51f91999 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/device_tree.h>
+#include <xen/domain_page.h>
 #include <xen/err.h>
 #include <xen/event.h>
 #include <xen/grant_table.h>
@@ -11,6 +12,8 @@
 #include <xen/sizes.h>
 #include <xen/vmap.h>
 
+#include <public/io/xs_wire.h>
+
 #include <asm/arm64/sve.h>
 #include <asm/dom0less-build.h>
 #include <asm/domain_build.h>
@@ -704,6 +707,54 @@ static int __init alloc_xenstore_evtchn(struct domain *d)
     return 0;
 }
 
+#define XENSTORE_PFN_OFFSET 1
+static int __init alloc_xenstore_page(struct domain *d)
+{
+    struct page_info *xenstore_pg;
+    struct xenstore_domain_interface *interface;
+    mfn_t mfn;
+    gfn_t gfn;
+    int rc;
+
+    if ( (UINT_MAX - d->max_pages) < 1 )
+    {
+        printk(XENLOG_ERR "%pd: Over-allocation for d->max_pages by 1 page.\n",
+               d);
+        return -EINVAL;
+    }
+
+    d->max_pages += 1;
+    xenstore_pg = alloc_domheap_page(d, MEMF_bits(32));
+    if ( xenstore_pg == NULL && is_64bit_domain(d) )
+        xenstore_pg = alloc_domheap_page(d, 0);
+    if ( xenstore_pg == NULL )
+        return -ENOMEM;
+
+    mfn = page_to_mfn(xenstore_pg);
+    if ( !mfn_x(mfn) )
+        return -ENOMEM;
+
+    if ( !is_domain_direct_mapped(d) )
+        gfn = gaddr_to_gfn(GUEST_MAGIC_BASE +
+                           (XENSTORE_PFN_OFFSET << PAGE_SHIFT));
+    else
+        gfn = gaddr_to_gfn(mfn_to_maddr(mfn));
+
+    rc = guest_physmap_add_page(d, gfn, mfn, 0);
+    if ( rc )
+    {
+        free_domheap_page(xenstore_pg);
+        return rc;
+    }
+
+    d->arch.hvm.params[HVM_PARAM_STORE_PFN] = gfn_x(gfn);
+    interface = map_domain_page(mfn);
+    interface->connection = XENSTORE_RECONNECT;
+    unmap_domain_page(interface);
+
+    return 0;
+}
+
 static int __init construct_domU(struct domain *d,
                                  const struct dt_device_node *node)
 {
@@ -804,7 +855,10 @@ static int __init construct_domU(struct domain *d,
         rc = alloc_xenstore_evtchn(d);
         if ( rc < 0 )
             return rc;
-        d->arch.hvm.params[HVM_PARAM_STORE_PFN] = ~0ULL;
+
+        rc = alloc_xenstore_page(d);
+        if ( rc < 0 )
+            return rc;
     }
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900698.1308547 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGon-0001B9-58; Tue, 04 Mar 2025 01:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900698.1308547; Tue, 04 Mar 2025 01:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGon-0001B1-2S; Tue, 04 Mar 2025 01:11:33 +0000
Received: by outflank-mailman (input) for mailman id 900698;
 Tue, 04 Mar 2025 01:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGom-0001Av-ML
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGom-0012w1-2q
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGom-005Wmi-1u
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u/YAsySe7KxErwdW6Pfmh6Wuuw9ogOcadnIG5osuOmQ=; b=5N/SpLLH+eFdwcFkKra0WeqmH0
	4Hh8ZgzhdLsKL0TGvyVPnmWH2pdWzQ0ltNlGBoT+CjdP1KgRC199JFuneUJ/Rk9Vhk7UKEQhCsrQU
	xgC2yCdYdxtTfZulBXdysEq9bSUT0YDqwwk9Cgje5Q9iARFv4naOlDIKTh0/3hcN8a/8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs/features/dom0less: Update the late XenStore init protocol
Message-Id: <E1tpGom-005Wmi-1u@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:11:32 +0000

commit 9cc1892bed7adb796b87f023e4bd99b9f0de1707
Author:     Henry Wang <xin.wang2@amd.com>
AuthorDate: Fri May 24 15:55:22 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    docs/features/dom0less: Update the late XenStore init protocol
    
    With the new allocation strategy of Dom0less DomUs XenStore page,
    update the doc of the late XenStore init protocol accordingly.
    
    Signed-off-by: Henry Wang <xin.wang2@amd.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 docs/features/dom0less.pandoc | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/docs/features/dom0less.pandoc b/docs/features/dom0less.pandoc
index 725afa0558..8b178edee0 100644
--- a/docs/features/dom0less.pandoc
+++ b/docs/features/dom0less.pandoc
@@ -110,9 +110,10 @@ hotplug PV drivers to dom0less guests. E.g. xl network-attach domU.
 The implementation works as follows:
 - Xen allocates the xenstore event channel for each dom0less domU that
   has the "xen,enhanced" property, and sets HVM_PARAM_STORE_EVTCHN
-- Xen does *not* allocate the xenstore page and sets HVM_PARAM_STORE_PFN
-  to ~0ULL (invalid)
-- Dom0less domU kernels check that HVM_PARAM_STORE_PFN is set to invalid
+- Xen allocates the xenstore page and sets HVM_PARAM_STORE_PFN as well
+  as the connection status to XENSTORE_RECONNECT.
+- Dom0less domU kernels check that HVM_PARAM_STORE_PFN is set to
+  ~0ULL (invalid) or the connection status is *not* XENSTORE_CONNECTED.
     - Old kernels will continue without xenstore support (Note: some old
       buggy kernels might crash because they don't check the validity of
       HVM_PARAM_STORE_PFN before using it! Disable "xen,enhanced" in
@@ -121,13 +122,14 @@ The implementation works as follows:
       channel (HVM_PARAM_STORE_EVTCHN) before continuing with the
       initialization
 - Once dom0 is booted, init-dom0less is executed:
-    - it allocates the xenstore shared page and sets HVM_PARAM_STORE_PFN
+    - it gets the xenstore shared page from HVM_PARAM_STORE_PFN
     - it calls xs_introduce_domain
 - Xenstored notices the new domain, initializes interfaces as usual, and
   sends an event channel notification to the domain using the xenstore
   event channel (HVM_PARAM_STORE_EVTCHN)
 - The Linux domU kernel receives the event channel notification, checks
-  HVM_PARAM_STORE_PFN again and continue with the initialization
+  HVM_PARAM_STORE_PFN and the connection status again and continue with
+  the initialization
 
 
 Limitations
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:11:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900699.1308551 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGox-0001Dd-6Z; Tue, 04 Mar 2025 01:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900699.1308551; Tue, 04 Mar 2025 01:11:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGox-0001DV-3r; Tue, 04 Mar 2025 01:11:43 +0000
Received: by outflank-mailman (input) for mailman id 900699;
 Tue, 04 Mar 2025 01:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGow-0001DO-PL
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGow-0012w6-3C
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGow-005Wne-2H
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TYmEej9ECbARVNC3B1Mr/M6xMc5AmVq7/lZEtiWjYlc=; b=0DzshhOL1DyX5F559QE4b3NCSu
	i3polSYEieEqu92nLpEWGXl0reC2oNMBJ0VzW0elthSljVyfGi1MeEayail++Mixjg1NiFbzygA7U
	9RXlJPOSihurMomBcl5qQzv4jDNmeFBoFdLaujOuRP/pTfWxuQtTDCwWakUQveK7JV4o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: add ping test to static-mem test
Message-Id: <E1tpGow-005Wne-2H@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:11:42 +0000

commit 9e051d3d4082394aaba799276d16e9f971c8b1db
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Jan 31 15:30:55 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    automation: add ping test to static-mem test
    
    With the recent fixes, Dom0less direct mapped domains can use PV
    drivers. Extend the existing static-mem test with a PV network ping
    tests.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 83e1866ca6..f72d209361 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -25,6 +25,9 @@ if [[ "${test_variant}" == "static-mem" ]]; then
     domU_check="
 mem_range=$(printf \"%08x-%08x\" ${domu_base} $(( ${domu_base} + ${domu_size} - 1 )))
 if grep -q -x \"\${mem_range} : System RAM\" /proc/iomem; then
+    until ifconfig eth0 192.168.0.2 &> /dev/null && ping -c 10 192.168.0.1; do
+        sleep 30
+    done
     echo \"${passed}\"
 fi
 "
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:11:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900700.1308555 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGp8-0001IZ-9U; Tue, 04 Mar 2025 01:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900700.1308555; Tue, 04 Mar 2025 01:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGp8-0001IR-6k; Tue, 04 Mar 2025 01:11:54 +0000
Received: by outflank-mailman (input) for mailman id 900700;
 Tue, 04 Mar 2025 01:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGp6-0001II-T8
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGp7-0012wA-0M
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGp6-005Wob-2c
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KAj4Idg8Sva9jTToT1uvsoU24pJnZGHDQzhB3je4iuU=; b=DIy6KFKlAWn1R5QWSrnIhYZniL
	sKhn/t/XKbIPyEGLC3rBiLnfpPYTN1W8NzQHU4abtaTkoDcIm+NBjUFHaRlxLl66jBKyd9QyLckLd
	bBeuOhPJ10F8I0SLS/0I0xdD/84/S1ezJZ1rVd1/4dYN1WyEGqVnR7Br4sWFAUoGGAaE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] init-dom0less: allocate xenstore page if not already allocated
Message-Id: <E1tpGp6-005Wob-2c@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:11:52 +0000

commit 56b8e80812f5ba98f6085d2c08c620d9a2a3479e
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Jan 31 16:29:46 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    init-dom0less: allocate xenstore page if not already allocated
    
    We check if the xenstore page is already allocated. If yes, there is
    nothing to do. If no, we proceed allocating it to support old unpatched
    Linux kernels.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 tools/helpers/init-dom0less.c | 54 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)

diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c
index 2b51965fa7..17579fe2e8 100644
--- a/tools/helpers/init-dom0less.c
+++ b/tools/helpers/init-dom0less.c
@@ -16,8 +16,34 @@
 
 #include "init-dom-json.h"
 
+#define XENSTORE_PFN_OFFSET 1
 #define STR_MAX_LENGTH 128
 
+static int alloc_xs_page(struct xc_interface_core *xch,
+                         libxl_dominfo *info,
+                         uint64_t *xenstore_pfn)
+{
+    int rc;
+    const xen_pfn_t base = GUEST_MAGIC_BASE >> XC_PAGE_SHIFT;
+    xen_pfn_t p2m = base + XENSTORE_PFN_OFFSET;
+
+    rc = xc_domain_setmaxmem(xch, info->domid,
+                             info->max_memkb + (XC_PAGE_SIZE/1024));
+    if (rc < 0)
+        return rc;
+
+    rc = xc_domain_populate_physmap_exact(xch, info->domid, 1, 0, 0, &p2m);
+    if (rc < 0)
+        return rc;
+
+    *xenstore_pfn = base + XENSTORE_PFN_OFFSET;
+    rc = xc_clear_domain_page(xch, info->domid, *xenstore_pfn);
+    if (rc < 0)
+        return rc;
+
+    return 0;
+}
+
 static int get_xs_page(struct xc_interface_core *xch, libxl_dominfo *info,
                        uint64_t *xenstore_pfn)
 {
@@ -233,9 +259,33 @@ static int init_domain(struct xs_handle *xsh,
         return 0;
 
     /* Get xenstore page */
-    if (get_xs_page(xch, info, &xenstore_pfn) != 0) {
-        printf("Error on getting xenstore page\n");
+    if (get_xs_page(xch, info, &xenstore_pfn) != 0)
         return 1;
+
+    if (xenstore_pfn == ~0ULL) {
+        struct xenstore_domain_interface *intf;
+
+        rc = alloc_xs_page(xch, info, &xenstore_pfn);
+        if (rc != 0) {
+            printf("Error on getting xenstore page\n");
+            return 1;
+        }
+
+        intf = xenforeignmemory_map(xfh, info->domid, PROT_READ | PROT_WRITE, 1,
+                                    &xenstore_pfn, NULL);
+        if (!intf) {
+            printf("Error mapping xenstore page\n");
+            return 1;
+        }
+
+        intf->connection = XENSTORE_RECONNECT;
+        xenforeignmemory_unmap(xfh, intf, 1);
+
+        /* Now everything is ready: set HVM_PARAM_STORE_PFN */
+        rc = xc_hvm_param_set(xch, info->domid, HVM_PARAM_STORE_PFN,
+                xenstore_pfn);
+        if (rc < 0)
+            return rc;
     }
 
     rc = xc_dom_gnttab_seed(xch, info->domid, true,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:12:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900701.1308559 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGpI-0001L4-Aq; Tue, 04 Mar 2025 01:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900701.1308559; Tue, 04 Mar 2025 01:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGpI-0001Kw-89; Tue, 04 Mar 2025 01:12:04 +0000
Received: by outflank-mailman (input) for mailman id 900701;
 Tue, 04 Mar 2025 01:12:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGpH-0001Kh-04
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:12:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGpH-0012wX-0g
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGpG-005WqK-30
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QrxfYVA+JCfEiSCZKVPYp/vnZdMVLziUJTKri88kg7I=; b=PsyJtOmcUkvPFyyGdbB6ByoflW
	+v0CXCRsTIvPJ43ppiB5bTf25md5d40YqA3dTu7EAQ7gkjmOKNKGMZPT2du9ZfV5e0b4kcj2OXcJW
	wC9j/ovvFqNIRRyd3+d9un7wg5KKQdyZ9BpIAmfSJOLQXrcXr03iKqLRajgj6iPFS/Zc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: introduce legacy dom0less option for xenstore allocation
Message-Id: <E1tpGpG-005WqK-30@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:12:02 +0000

commit 0e2bb9d9b1f9a85d4d88d5726058ddb39d8b9b6a
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Jan 31 16:42:12 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    xen/arm: introduce legacy dom0less option for xenstore allocation
    
    The new xenstore page allocation scheme might break older unpatched
    Linux kernels that do not check for the Xenstore connection status
    before proceeding with Xenstore initialization.
    
    Introduce a dom0less configuration option to retain the older behavior.
    
    The older behavior triggered by this option is to allocate the xenstore
    page in init-dom0less. That does not work with static-mem guests.
    However, it will make it possible to run as regular guests older Linux
    kernel versions that are left unpatched.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 docs/misc/arm/device-tree/booting.txt |  5 ++++
 xen/arch/arm/dom0less-build.c         | 45 +++++++++++++++++++++++++----------
 xen/arch/arm/include/asm/kernel.h     | 30 ++++++++++++++---------
 3 files changed, 56 insertions(+), 24 deletions(-)

diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
index 9c881baccc..4d6d859c66 100644
--- a/docs/misc/arm/device-tree/booting.txt
+++ b/docs/misc/arm/device-tree/booting.txt
@@ -222,6 +222,11 @@ with the following properties:
     Xen PV interfaces, including grant-table and xenstore, will be
     enabled for the VM.
 
+    - "legacy"
+    Same as above, but the way the xenstore page is allocated is not
+    compatible with static-mem guests. On the other hand, it works with
+    older Linux kernels.
+
     - "disabled"
     Xen PV interfaces are disabled.
 
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 6c51f91999..1d735f86db 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -755,6 +755,30 @@ static int __init alloc_xenstore_page(struct domain *d)
     return 0;
 }
 
+static int __init alloc_xenstore_params(struct kernel_info *kinfo)
+{
+    struct domain *d = kinfo->d;
+    int rc = 0;
+
+    if ( kinfo->dom0less_feature & (DOM0LESS_XENSTORE | DOM0LESS_XS_LEGACY) )
+    {
+        ASSERT(hardware_domain);
+        rc = alloc_xenstore_evtchn(d);
+        if ( rc < 0 )
+            return rc;
+        d->arch.hvm.params[HVM_PARAM_STORE_PFN] = ~0ULL;
+    }
+
+    if ( kinfo->dom0less_feature & DOM0LESS_XENSTORE )
+    {
+        rc = alloc_xenstore_page(d);
+        if ( rc < 0 )
+            return rc;
+    }
+
+    return rc;
+}
+
 static int __init construct_domU(struct domain *d,
                                  const struct dt_device_node *node)
 {
@@ -800,6 +824,13 @@ static int __init construct_domU(struct domain *d,
         else
             panic("At the moment, Xenstore support requires dom0 to be present\n");
     }
+    else if ( rc == 0 && !strcmp(dom0less_enhanced, "legacy") )
+    {
+        if ( hardware_domain )
+            kinfo.dom0less_feature = DOM0LESS_ENHANCED_LEGACY;
+        else
+            panic("At the moment, Xenstore support requires dom0 to be present\n");
+    }
     else if ( rc == 0 && !strcmp(dom0less_enhanced, "no-xenstore") )
         kinfo.dom0less_feature = DOM0LESS_ENHANCED_NO_XS;
 
@@ -849,19 +880,7 @@ static int __init construct_domU(struct domain *d,
     if ( rc < 0 )
         return rc;
 
-    if ( kinfo.dom0less_feature & DOM0LESS_XENSTORE )
-    {
-        ASSERT(hardware_domain);
-        rc = alloc_xenstore_evtchn(d);
-        if ( rc < 0 )
-            return rc;
-
-        rc = alloc_xenstore_page(d);
-        if ( rc < 0 )
-            return rc;
-    }
-
-    return rc;
+    return alloc_xenstore_params(&kinfo);
 }
 
 void __init create_domUs(void)
diff --git a/xen/arch/arm/include/asm/kernel.h b/xen/arch/arm/include/asm/kernel.h
index de3f945ae5..bdc96f4c18 100644
--- a/xen/arch/arm/include/asm/kernel.h
+++ b/xen/arch/arm/include/asm/kernel.h
@@ -13,20 +13,28 @@
 /*
  * List of possible features for dom0less domUs
  *
- * DOM0LESS_ENHANCED_NO_XS: Notify the OS it is running on top of Xen. All the
- *                          default features (excluding Xenstore) will be
- *                          available. Note that an OS *must* not rely on the
- *                          availability of Xen features if this is not set.
- * DOM0LESS_XENSTORE:       Xenstore will be enabled for the VM. This feature
- *                          can't be enabled without the
- *                          DOM0LESS_ENHANCED_NO_XS.
- * DOM0LESS_ENHANCED:       Notify the OS it is running on top of Xen. All the
- *                          default features (including Xenstore) will be
- *                          available. Note that an OS *must* not rely on the
- *                          availability of Xen features if this is not set.
+ * DOM0LESS_ENHANCED_NO_XS:  Notify the OS it is running on top of Xen. All the
+ *                           default features (excluding Xenstore) will be
+ *                           available. Note that an OS *must* not rely on the
+ *                           availability of Xen features if this is not set.
+ * DOM0LESS_XENSTORE:        Xenstore will be enabled for the VM. The
+ *                           xenstore page allocation is done by Xen at
+ *                           domain creation. This feature can't be
+ *                           enabled without the DOM0LESS_ENHANCED_NO_XS.
+ * DOM0LESS_XS_LEGACY        Xenstore will be enabled for the VM, the
+ *                           xenstore page allocation will happen in
+ *                           init-dom0less. This feature can't be enabled
+ *                           without the DOM0LESS_ENHANCED_NO_XS.
+ * DOM0LESS_ENHANCED:        Notify the OS it is running on top of Xen. All the
+ *                           default features (including Xenstore) will be
+ *                           available. Note that an OS *must* not rely on the
+ *                           availability of Xen features if this is not set.
+ * DOM0LESS_ENHANCED_LEGACY: Same as before, but using DOM0LESS_XS_LEGACY.
  */
 #define DOM0LESS_ENHANCED_NO_XS  BIT(0, U)
 #define DOM0LESS_XENSTORE        BIT(1, U)
+#define DOM0LESS_XS_LEGACY       BIT(2, U)
+#define DOM0LESS_ENHANCED_LEGACY (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XS_LEGACY)
 #define DOM0LESS_ENHANCED        (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XENSTORE)
 
 struct kernel_info {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:12:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900702.1308563 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGpS-0001NQ-C3; Tue, 04 Mar 2025 01:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900702.1308563; Tue, 04 Mar 2025 01:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGpS-0001NI-9W; Tue, 04 Mar 2025 01:12:14 +0000
Received: by outflank-mailman (input) for mailman id 900702;
 Tue, 04 Mar 2025 01:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGpR-0001N9-2m
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGpR-0012yl-0w
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGpR-005Wqq-06
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DOl2Ak4YXeRLBJv9MYxYH+fkAXBwE4m0yQukS7yWYUE=; b=vR6EpW2L6RFU+3/RPWCe7LHF7Z
	hAI3prgiR2T9WTH1XWIUeeIEv/LjRheIeebzXPlPlEdb6Ty3nmV1BTJ5lfqyCfcs/ndl4vyhZ1RmC
	vj6ub4lPnpXcwgCcVvHO+2rgZxdWQ4CTK2nmUOvOrqdbv5oeDBgjfUuCRIpPBdWcrc1w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/dom0less: support for vcpu affinity
Message-Id: <E1tpGpR-005Wqq-06@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:12:13 +0000

commit 29a9638fd4583c738811d4d846543ee85260ca17
Author:     Xenia Ragiadakou <xenia.ragiadakou@amd.com>
AuthorDate: Thu Feb 20 13:37:12 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    xen/dom0less: support for vcpu affinity
    
    Add vcpu affinity to the dom0less bindings. Example:
    
        dom1 {
                ...
                cpus = <4>;
                vcpu0 {
                       compatible = "xen,vcpu";
                       id = <0>;
                       hard-affinity = "4-7";
                };
                vcpu1 {
                       compatible = "xen,vcpu";
                       id = <1>;
                       hard-affinity = "0-3,5";
                };
                vcpu2 {
                       compatible = "xen,vcpu";
                       id = <2>;
                       hard-affinity = "1,6";
                };
                ...
    
    Note that the property hard-affinity is optional. It is possible to add
    other properties in the future not only to specify soft affinity, but
    also to provide more precise methods for configuring affinity. For
    instance, on ARM the MPIDR could be use to specify the pCPU. For now, it
    is left to the future.
    
    Signed-off-by: Xenia Ragiadakou <xenia.ragiadakou@amd.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/arm/device-tree/booting.txt | 34 +++++++++++++++++++
 xen/arch/arm/dom0less-build.c         | 64 +++++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+)

diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
index 4d6d859c66..ac781c9cc8 100644
--- a/docs/misc/arm/device-tree/booting.txt
+++ b/docs/misc/arm/device-tree/booting.txt
@@ -329,6 +329,28 @@ The ramdisk sub-node has the following properties:
     property because it will be created by the UEFI stub on boot.
     This option is needed only when UEFI boot is used.
 
+Under the "xen,domain" compatible node, it is possible optionally to add
+one or more sub-nodes to configure vCPU affinity. The vCPU affinity
+sub-node has the following properties:
+
+- compatible
+
+    "xen,vcpu"
+
+- id
+
+    A 32-bit integer that specifies the vCPU id. 0 is the first vCPU.
+    The last vCPU is cpus-1, where "cpus" is the number of vCPUs
+    specified with the "cpus" property under the "xen,domain" node.
+    Each "xen,vcpu" node must have a unique vCPU id.
+
+- hard-affinity
+
+    Optional. A string specifying the hard affinity configuration for the
+    vCPU: a comma-separated list of pCPUs or ranges of pCPUs is used.
+    Ranges are hyphen-separated intervals (such as `0-4`) and are inclusive
+    on both sides. The numbers refer to logical pCPU ids.
+
 
 Example
 =======
@@ -342,6 +364,18 @@ chosen {
         cpus = <2>;
         vpl011;
 
+        vcpu0 {
+            compatible = "xen,vcpu";
+            id = <0>;
+            hard-affinity = "0-3";
+        };
+
+        vcpu1 {
+            compatible = "xen,vcpu";
+            id = <1>;
+            hard-affinity = "1,4-7";
+        };
+
         module@0x4a000000 {
             compatible = "multiboot,kernel", "multiboot,module";
             reg = <0x0 0x4a000000 0xffffff>;
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 1d735f86db..31f31c38da 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -779,6 +779,68 @@ static int __init alloc_xenstore_params(struct kernel_info *kinfo)
     return rc;
 }
 
+static void __init domain_vcpu_affinity(struct domain *d,
+                                        const struct dt_device_node *node)
+{
+    struct dt_device_node *np;
+
+    dt_for_each_child_node(node, np)
+    {
+        const char *hard_affinity_str = NULL;
+        uint32_t val;
+        int rc;
+        struct vcpu *v;
+        cpumask_t affinity;
+
+        if ( !dt_device_is_compatible(np, "xen,vcpu") )
+            continue;
+
+        if ( !dt_property_read_u32(np, "id", &val) )
+            panic("Invalid xen,vcpu node for domain %s\n", dt_node_name(node));
+
+        if ( val >= d->max_vcpus )
+            panic("Invalid vcpu_id %u for domain %s, max_vcpus=%u\n", val,
+                  dt_node_name(node), d->max_vcpus);
+
+        v = d->vcpu[val];
+        rc = dt_property_read_string(np, "hard-affinity", &hard_affinity_str);
+        if ( rc < 0 )
+            continue;
+
+        cpumask_clear(&affinity);
+        while ( *hard_affinity_str != '\0' )
+        {
+            unsigned int start, end;
+
+            start = simple_strtoul(hard_affinity_str, &hard_affinity_str, 0);
+
+            if ( *hard_affinity_str == '-' )    /* Range */
+            {
+                hard_affinity_str++;
+                end = simple_strtoul(hard_affinity_str, &hard_affinity_str, 0);
+            }
+            else                /* Single value */
+                end = start;
+
+            if ( end >= nr_cpu_ids )
+                panic("Invalid pCPU %u for domain %s\n", end, dt_node_name(node));
+
+            for ( ; start <= end; start++ )
+                cpumask_set_cpu(start, &affinity);
+
+            if ( *hard_affinity_str == ',' )
+                hard_affinity_str++;
+            else if ( *hard_affinity_str != '\0' )
+                break;
+        }
+
+        rc = vcpu_set_hard_affinity(v, &affinity);
+        if ( rc )
+            panic("vcpu%d: failed (rc=%d) to set hard affinity for domain %s\n",
+                  v->vcpu_id, rc, dt_node_name(node));
+    }
+}
+
 static int __init construct_domU(struct domain *d,
                                  const struct dt_device_node *node)
 {
@@ -880,6 +942,8 @@ static int __init construct_domU(struct domain *d,
     if ( rc < 0 )
         return rc;
 
+    domain_vcpu_affinity(d, node);
+
     return alloc_xenstore_params(&kinfo);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:12:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900703.1308567 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGpc-0001Ph-Da; Tue, 04 Mar 2025 01:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900703.1308567; Tue, 04 Mar 2025 01:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGpc-0001PZ-Av; Tue, 04 Mar 2025 01:12:24 +0000
Received: by outflank-mailman (input) for mailman id 900703;
 Tue, 04 Mar 2025 01:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGpb-0001PM-6K
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGpb-0012zS-1I
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGpb-005Wrj-0O
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9UBxKSz6qdcbny2EcI/wcRVNf6NWISSUnkcDTeMOYtk=; b=Pyp+ABiDxASt2lDZJ/QLz8WOn2
	IN05Hxx64fNbKjj8K1wWIxoEUdG1bJTPIHF7r6ciNZeXZIa9wyk02pvlsfmzaVcUYo5Uv2ofDT7g4
	ZeZChJciATiNPGGNB4phkgS/imh/MRPoOOrbSs61GzOn5CoC3KRWyhLzU1ysRKxD/H6c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/include: introduce resource.h
Message-Id: <E1tpGpb-005Wrj-0O@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:12:23 +0000

commit 1b861bd95e9cc008942846cb71df5a21c78a1aad
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Tue Feb 11 15:55:44 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:06:17 2025 -0800

    xen/include: introduce resource.h
    
    Move resource definitions to a new architecture-agnostic shared header file.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/device-tree/device-tree.c | 21 +--------------------
 xen/drivers/passthrough/arm/smmu.c   | 18 +++---------------
 xen/include/xen/resource.h           | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/device-tree.c
index d0528c5825..e8f810b2fe 100644
--- a/xen/common/device-tree/device-tree.c
+++ b/xen/common/device-tree/device-tree.c
@@ -24,6 +24,7 @@
 #include <xen/ctype.h>
 #include <asm/setup.h>
 #include <xen/err.h>
+#include <xen/resource.h>
 
 const void *device_tree_flattened;
 dt_irq_xlate_func dt_irq_xlate;
@@ -535,26 +536,6 @@ int dt_child_n_size_cells(const struct dt_device_node *parent)
     return __dt_n_size_cells(parent, true);
 }
 
-/*
- * These are defined in Linux where much of this code comes from, but
- * are currently unused outside this file in the context of Xen.
- */
-#define IORESOURCE_BITS         0x000000ff      /* Bus-specific bits */
-
-#define IORESOURCE_TYPE_BITS    0x00001f00      /* Resource type */
-#define IORESOURCE_IO           0x00000100      /* PCI/ISA I/O ports */
-#define IORESOURCE_MEM          0x00000200
-#define IORESOURCE_REG          0x00000300      /* Register offsets */
-#define IORESOURCE_IRQ          0x00000400
-#define IORESOURCE_DMA          0x00000800
-#define IORESOURCE_BUS          0x00001000
-
-#define IORESOURCE_PREFETCH     0x00002000      /* No side effects */
-#define IORESOURCE_READONLY     0x00004000
-#define IORESOURCE_CACHEABLE    0x00008000
-#define IORESOURCE_RANGELENGTH  0x00010000
-#define IORESOURCE_SHADOWABLE   0x00020000
-
 /*
  * Default translator (generic bus)
  */
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 03d22bce1e..0f8d47dc98 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -50,6 +50,7 @@
 #include <xen/rbtree.h>
 #include <xen/sched.h>
 #include <xen/sizes.h>
+#include <xen/resource.h>
 #include <asm/atomic.h>
 #include <asm/device.h>
 #include <asm/io.h>
@@ -64,6 +65,8 @@
 
 /* Alias to Xen device tree helpers */
 #define device_node dt_device_node
+#define platform_device dt_device_node
+
 #define of_phandle_args dt_phandle_args
 #define of_device_id dt_device_match
 #define of_match_node dt_match_node
@@ -71,21 +74,6 @@
 #define of_property_read_bool dt_property_read_bool
 #define of_parse_phandle_with_args dt_parse_phandle_with_args
 
-/* Xen: Helpers to get device MMIO and IRQs */
-struct resource
-{
-	paddr_t addr;
-	paddr_t size;
-	unsigned int type;
-};
-
-#define resource_size(res) (res)->size;
-
-#define platform_device dt_device_node
-
-#define IORESOURCE_MEM 0
-#define IORESOURCE_IRQ 1
-
 static struct resource *platform_get_resource(struct platform_device *pdev,
 					      unsigned int type,
 					      unsigned int num)
diff --git a/xen/include/xen/resource.h b/xen/include/xen/resource.h
new file mode 100644
index 0000000000..5d10363128
--- /dev/null
+++ b/xen/include/xen/resource.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * System resource description.
+ */
+#ifndef XEN__RESOURCE_H
+#define XEN__RESOURCE_H
+
+#define IORESOURCE_BITS         0x000000FFU      /* Bus-specific bits */
+
+#define IORESOURCE_TYPE_BITS    0x00001F00U      /* Resource type */
+#define IORESOURCE_IO           0x00000100U      /* PCI/ISA I/O ports */
+#define IORESOURCE_MEM          0x00000200U
+#define IORESOURCE_REG          0x00000300U      /* Register offsets */
+#define IORESOURCE_IRQ          0x00000400U
+#define IORESOURCE_DMA          0x00000800U
+#define IORESOURCE_BUS          0x00001000U
+
+#define IORESOURCE_PREFETCH     0x00002000U      /* No side effects */
+#define IORESOURCE_READONLY     0x00004000U
+#define IORESOURCE_CACHEABLE    0x00008000U
+#define IORESOURCE_RANGELENGTH  0x00010000U
+#define IORESOURCE_SHADOWABLE   0x00020000U
+
+#define IORESOURCE_UNKNOWN      (~0U)
+
+struct resource {
+    paddr_t addr;
+    paddr_t size;
+    unsigned int type;
+};
+
+#define resource_size(res)      ((res)->size)
+
+#endif /* XEN__RESOURCE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:12:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900704.1308570 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGpm-0001SI-F6; Tue, 04 Mar 2025 01:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900704.1308570; Tue, 04 Mar 2025 01:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGpm-0001SA-CJ; Tue, 04 Mar 2025 01:12:34 +0000
Received: by outflank-mailman (input) for mailman id 900704;
 Tue, 04 Mar 2025 01:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGpl-0001Rz-AC
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGpl-0012zZ-1g
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGpl-005WsE-0j
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1vrgLKRYgG8CbCYt7Jw2uJkfvI/vTqkvgGgjS1up+VM=; b=Kk/BFEUzvvqwsSx2cTws8d8PbG
	kfu2GF0/FuWoAJQhfDVKuDctnD9tEUvVGnUQ4U5ZRd2oHnxQKtXzKkPp4c9r6hFvnzKFXf5LXgMhk
	YrSOYaAW4AN/22wFz1/sq24xXSKRW0PlUDGhkK2q7jMLo1rW7thNDB9ydwpf76i2G8uw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/vuart: move vpl011-related code to vpl011 emulator
Message-Id: <E1tpGpl-005WsE-0j@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:12:33 +0000

commit 68a88a2f33e2e98a0351fa57c8d31216f6d9fb67
Author:     dmkhn@proton.me <dmkhn@proton.me>
AuthorDate: Wed Feb 12 21:19:58 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:06:56 2025 -0800

    arm/vuart: move vpl011-related code to vpl011 emulator
    
    Xen console driver has vpl011-related logic which shall belong vpl011 emulator
    code (Arm port). Move vpl011-related code from arch-independent console driver
    to Arm's vpl011.c.
    
    Use rate-limiting guest_printk() for error logging in console driver in case
    vpl011 cannot handle the console input.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/vpl011.h |  2 +-
 xen/arch/arm/vpl011.c             | 15 +++++++++++----
 xen/drivers/char/console.c        | 21 +++++++--------------
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/xen/arch/arm/include/asm/vpl011.h b/xen/arch/arm/include/asm/vpl011.h
index c09abcd7a9..cc83868281 100644
--- a/xen/arch/arm/include/asm/vpl011.h
+++ b/xen/arch/arm/include/asm/vpl011.h
@@ -69,7 +69,7 @@ struct vpl011_init_info {
 int domain_vpl011_init(struct domain *d,
                        struct vpl011_init_info *info);
 void domain_vpl011_deinit(struct domain *d);
-void vpl011_rx_char_xen(struct domain *d, char c);
+int vpl011_rx_char_xen(struct domain *d, char c);
 #else
 static inline int domain_vpl011_init(struct domain *d,
                                      struct vpl011_init_info *info)
diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index 1fc3114cce..c72f3778bf 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -567,16 +567,21 @@ static void vpl011_data_avail(struct domain *d,
 
 /*
  * vpl011_rx_char_xen adds a char to a domain's vpl011 receive buffer.
- * It is only used when the vpl011 backend is in Xen.
  */
-void vpl011_rx_char_xen(struct domain *d, char c)
+int vpl011_rx_char_xen(struct domain *d, char c)
 {
     unsigned long flags;
     struct vpl011 *vpl011 = &d->arch.vpl011;
     struct vpl011_xen_backend *intf = vpl011->backend.xen;
     XENCONS_RING_IDX in_cons, in_prod, in_fifo_level;
 
-    ASSERT(!vpl011->backend_in_domain);
+    /* Forward input iff the vpl011 backend is in Xen. */
+    if ( vpl011->backend_in_domain )
+        return -ENODEV;
+
+    if ( intf == NULL )
+        return -ENODEV;
+
     VPL011_LOCK(d, flags);
 
     in_cons = intf->in_cons;
@@ -584,7 +589,7 @@ void vpl011_rx_char_xen(struct domain *d, char c)
     if ( xencons_queued(in_prod, in_cons, sizeof(intf->in)) == sizeof(intf->in) )
     {
         VPL011_UNLOCK(d, flags);
-        return;
+        return -ENOSPC;
     }
 
     intf->in[xencons_mask(in_prod, sizeof(intf->in))] = c;
@@ -596,6 +601,8 @@ void vpl011_rx_char_xen(struct domain *d, char c)
 
     vpl011_data_avail(d, in_fifo_level, sizeof(intf->in), 0, SBSA_UART_FIFO_SIZE);
     VPL011_UNLOCK(d, flags);
+
+    return 0;
 }
 
 static void vpl011_notification(struct vcpu *v, unsigned int port)
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index eb09b6d5fd..2f48001a44 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -553,21 +553,14 @@ static void __serial_rx(char c)
     {
         struct domain *d = rcu_lock_domain_by_id(console_rx - 1);
 
-        /*
-         * If we have a properly initialized vpl011 console for the
-         * domain, without a full PV ring to Dom0 (in that case input
-         * comes from the PV ring), then send the character to it.
-         */
-        if ( d != NULL &&
-             !d->arch.vpl011.backend_in_domain &&
-             d->arch.vpl011.backend.xen != NULL )
-            vpl011_rx_char_xen(d, c);
-        else
-            printk("Cannot send chars to Dom%d: no UART available\n",
-                   console_rx - 1);
-
-        if ( d != NULL )
+        if ( d )
+        {
+            int rc = vpl011_rx_char_xen(d, c);
+            if ( rc )
+                guest_printk(d, XENLOG_G_WARNING
+                                "failed to process console input: %d\n", rc);
             rcu_unlock_domain(d);
+        }
 
         break;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:12:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900705.1308575 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGpw-0001VD-Ht; Tue, 04 Mar 2025 01:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900705.1308575; Tue, 04 Mar 2025 01:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGpw-0001V6-F6; Tue, 04 Mar 2025 01:12:44 +0000
Received: by outflank-mailman (input) for mailman id 900705;
 Tue, 04 Mar 2025 01:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGpv-0001Uy-Dq
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGpv-0012zh-23
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGpv-005WvV-16
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SaONNIhF49YYHg+v6dzdbNdKvYn4Yg4allXHEQHlT4M=; b=k1K+dPaUdADALkH6myS49o4eia
	z4ZXpxLzTuu818bR3haKzm4l8afKq88U6wETfXnUt41JYG+xpKURdzt/SAgWlF22hzBPaIrkfbVlS
	32CC5msnViKXhEyy6gPZPkWJLZ2pJCOZsm95IucULbASVkauEXCnIKdFCmTuSQ89Mgf8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] device-tree: optimize size of struct dt_device_node
Message-Id: <E1tpGpv-005WvV-16@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:12:43 +0000

commit 0207fee58d1db2a5dd0b1ab689c6504a9dfa7431
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Feb 12 17:43:58 2025 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:07:27 2025 -0800

    device-tree: optimize size of struct dt_device_node
    
    The current placement of fields in struct dt_device_node is not optimal and
    introduces holes due to fields alignment.
    
    Checked with "'pahole xen-syms -C dt_device_node"
    
    ARM64 size 144B, 16B holes:
            /* size: 144, cachelines: 3, members: 15 */
            /* sum members: 128, holes: 3, sum holes: 16 */
            /* last cacheline: 16 bytes */
    ARM32 size 72B, 4B holes
            /* size: 72, cachelines: 2, members: 15 */
            /* sum members: 68, holes: 2, sum holes: 4 */
            /* last cacheline: 8 bytes */
    
    This patch optimizes size of struct dt_device_node by rearranging its
    field, which eliminates holes and reduces structure size by 16B(ARM64) and
    4B(ARM32).
    
    After ARM64 size 128B, no holes (-16B):
            /* size: 128, cachelines: 2, members: 15 */
    After ARM32 size 68B, no holes (-4B)
            /* size: 68, cachelines: 2, members: 15 */
            /* last cacheline: 4 bytes */
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/xen/device_tree.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index 5ff763bb80..0ff80fda04 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -81,17 +81,10 @@ struct dt_property {
 struct dt_device_node {
     const char *name;
     const char *type;
-    dt_phandle phandle;
     char *full_name;
+    dt_phandle phandle;
     domid_t used_by; /* By default it's used by dom0 */
 
-    struct dt_property *properties;
-    struct dt_device_node *parent;
-    struct dt_device_node *child;
-    struct dt_device_node *sibling;
-    struct dt_device_node *next; /* TODO: Remove it. Only use to know the last children */
-    struct dt_device_node *allnext;
-
     /* IOMMU specific fields */
     bool is_protected;
 
@@ -100,6 +93,13 @@ struct dt_device_node {
     bool static_evtchn_created;
 #endif
 
+    struct dt_property *properties;
+    struct dt_device_node *parent;
+    struct dt_device_node *child;
+    struct dt_device_node *sibling;
+    struct dt_device_node *next; /* TODO: Remove it. Only use to know the last children */
+    struct dt_device_node *allnext;
+
     /*
      * The main purpose of this list is to link the structure in the list
      * of devices assigned to domain.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:12:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:12:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900706.1308579 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGq6-0001Y0-JF; Tue, 04 Mar 2025 01:12:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900706.1308579; Tue, 04 Mar 2025 01:12:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGq6-0001Xt-Gl; Tue, 04 Mar 2025 01:12:54 +0000
Received: by outflank-mailman (input) for mailman id 900706;
 Tue, 04 Mar 2025 01:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGq5-0001Xg-HX
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGq5-0012zl-2P
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGq5-005WwT-1U
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FLdysK4EP5p3vMq5V/aZ+xgRP6a0ntk3JlHyisCISjA=; b=p+XYJJCIePHCmYX4irrXfNrtq/
	Nd4Zm2ZJEwh97d1Ce1U+C5xAPN3JhL80yieMvT/r/Rcj2a43oC7UzaGWnLD3pSyEc0rpJ8FHkWkvT
	Js5fE8u3Bpml8icrB0qbfF9/ne7uladdjyyEayU865aFXofCnnBBSaVnRHCmiF0L9IC8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arch: arm64: always set IL=1 when injecting undefined exception
Message-Id: <E1tpGq5-005WwT-1U@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:12:53 +0000

commit 9480d48437a1068b27514ffe1f58c89f7224b519
Author:     Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
AuthorDate: Thu Feb 13 15:37:54 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:08:08 2025 -0800

    arch: arm64: always set IL=1 when injecting undefined exception
    
    ARM Architecture Reference Manual states that IL field of ESR_EL1
    register should be 1 when EC is 0b000000 aka HSR_EC_UNKNOWN.
    
    Section D24.2.40, page D24-7337 of ARM DDI 0487L:
    
      IL, bit [25]
      Instruction Length for synchronous exceptions. Possible values of this bit are:
    
      [...]
    
      0b1 - 32-bit instruction trapped.
      This value is also used when the exception is one of the following:
      [...]
       - An exception reported using EC value 0b000000.
    
    To align code with the specification, set .len field to 1 in
    inject_undef64_exception() and remove unneeded second parameter.
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/arm64/vsysreg.c           | 10 +++++-----
 xen/arch/arm/include/asm/arm64/traps.h |  2 +-
 xen/arch/arm/include/asm/p2m.h         |  3 +--
 xen/arch/arm/include/asm/traps.h       |  2 +-
 xen/arch/arm/p2m.c                     |  5 ++---
 xen/arch/arm/traps.c                   | 24 ++++++++++++------------
 xen/arch/arm/vcpreg.c                  | 26 +++++++++++++-------------
 xen/arch/arm/vsmc.c                    |  6 ++----
 8 files changed, 37 insertions(+), 41 deletions(-)

diff --git a/xen/arch/arm/arm64/vsysreg.c b/xen/arch/arm/arm64/vsysreg.c
index c73b2c95ce..d14258290f 100644
--- a/xen/arch/arm/arm64/vsysreg.c
+++ b/xen/arch/arm/arm64/vsysreg.c
@@ -95,7 +95,7 @@ void do_sysreg(struct cpu_user_regs *regs,
      */
     case HSR_SYSREG_ACTLR_EL1:
         if ( regs_mode_is_user(regs) )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
         if ( hsr.sysreg.read )
             set_user_reg(regs, regidx, v->arch.actlr);
         break;
@@ -109,7 +109,7 @@ void do_sysreg(struct cpu_user_regs *regs,
     case HSR_SYSREG_DCCSW:
     case HSR_SYSREG_DCCISW:
         if ( !hsr.sysreg.read )
-            p2m_set_way_flush(current, regs, hsr);
+            p2m_set_way_flush(current, regs);
         break;
 
     /*
@@ -267,7 +267,7 @@ void do_sysreg(struct cpu_user_regs *regs,
     case HSR_SYSREG_CNTP_TVAL_EL0:
     case HSR_SYSREG_CNTP_CVAL_EL0:
         if ( !vtimer_emulate(regs, hsr) )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
         break;
 
     /*
@@ -280,7 +280,7 @@ void do_sysreg(struct cpu_user_regs *regs,
     case HSR_SYSREG_ICC_SGI0R_EL1:
 
         if ( !vgic_emulate(regs, hsr) )
-            return inject_undef64_exception(regs, hsr.len);
+            return inject_undef64_exception(regs);
         break;
 
     /*
@@ -440,7 +440,7 @@ void do_sysreg(struct cpu_user_regs *regs,
     gdprintk(XENLOG_ERR,
              "unhandled 64-bit sysreg access %#"PRIregister"\n",
              hsr.bits & HSR_SYSREG_REGS_MASK);
-    inject_undef_exception(regs, hsr);
+    inject_undef_exception(regs);
 }
 
 /*
diff --git a/xen/arch/arm/include/asm/arm64/traps.h b/xen/arch/arm/include/asm/arm64/traps.h
index a347cb13d6..3be2fa69ee 100644
--- a/xen/arch/arm/include/asm/arm64/traps.h
+++ b/xen/arch/arm/include/asm/arm64/traps.h
@@ -1,7 +1,7 @@
 #ifndef __ASM_ARM64_TRAPS__
 #define __ASM_ARM64_TRAPS__
 
-void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len);
+void inject_undef64_exception(struct cpu_user_regs *regs);
 
 void do_sysreg(struct cpu_user_regs *regs,
                const union hsr hsr);
diff --git a/xen/arch/arm/include/asm/p2m.h b/xen/arch/arm/include/asm/p2m.h
index 4818dd4b6a..594dc40041 100644
--- a/xen/arch/arm/include/asm/p2m.h
+++ b/xen/arch/arm/include/asm/p2m.h
@@ -298,8 +298,7 @@ void p2m_domain_creation_finished(struct domain *d);
  */
 int p2m_cache_flush_range(struct domain *d, gfn_t *pstart, gfn_t end);
 
-void p2m_set_way_flush(struct vcpu *v, struct cpu_user_regs *regs,
-                       const union hsr hsr);
+void p2m_set_way_flush(struct vcpu *v, struct cpu_user_regs *regs);
 
 void p2m_toggle_cache(struct vcpu *v, bool was_enabled);
 
diff --git a/xen/arch/arm/include/asm/traps.h b/xen/arch/arm/include/asm/traps.h
index 9a60dbf70e..3b40afe262 100644
--- a/xen/arch/arm/include/asm/traps.h
+++ b/xen/arch/arm/include/asm/traps.h
@@ -44,7 +44,7 @@ int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr);
 
 void advance_pc(struct cpu_user_regs *regs, const union hsr hsr);
 
-void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr);
+void inject_undef_exception(struct cpu_user_regs *regs);
 
 /* read as zero and write ignore */
 void handle_raz_wi(struct cpu_user_regs *regs, int regidx, bool read,
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 65b70955e3..ef8bd4b6ab 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -428,8 +428,7 @@ int p2m_cache_flush_range(struct domain *d, gfn_t *pstart, gfn_t end)
  *
  *  - Once the caches are enabled, we stop trapping VM ops.
  */
-void p2m_set_way_flush(struct vcpu *v, struct cpu_user_regs *regs,
-                       const union hsr hsr)
+void p2m_set_way_flush(struct vcpu *v, struct cpu_user_regs *regs)
 {
     /* This function can only work with the current vCPU. */
     ASSERT(v == current);
@@ -438,7 +437,7 @@ void p2m_set_way_flush(struct vcpu *v, struct cpu_user_regs *regs,
     {
         gprintk(XENLOG_ERR,
                 "The cache should be flushed by VA rather than by set/way.\n");
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
         return;
     }
 
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 737f4d65e3..5338d5c033 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -533,12 +533,12 @@ static vaddr_t exception_handler64(struct cpu_user_regs *regs, vaddr_t offset)
 }
 
 /* Inject an undefined exception into a 64 bit guest */
-void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len)
+void inject_undef64_exception(struct cpu_user_regs *regs)
 {
     vaddr_t handler;
     const union hsr esr = {
         .iss = 0,
-        .len = instr_len,
+        .len = 1,
         .ec = HSR_EC_UNKNOWN,
     };
 
@@ -606,13 +606,13 @@ static void inject_iabt64_exception(struct cpu_user_regs *regs,
 
 #endif
 
-void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr)
+void inject_undef_exception(struct cpu_user_regs *regs)
 {
         if ( is_32bit_domain(current->domain) )
             inject_undef32_exception(regs);
 #ifdef CONFIG_ARM_64
         else
-            inject_undef64_exception(regs, hsr.len);
+            inject_undef64_exception(regs);
 #endif
 }
 
@@ -1418,7 +1418,7 @@ static void do_trap_hypercall(struct cpu_user_regs *regs, register_t *nr,
     if ( hsr.iss != XEN_HYPERCALL_TAG )
     {
         gprintk(XENLOG_WARNING, "Invalid HVC imm 0x%x\n", hsr.iss);
-        return inject_undef_exception(regs, hsr);
+        return inject_undef_exception(regs);
     }
 
     curr->hcall_preempted = false;
@@ -1655,7 +1655,7 @@ void handle_raz_wi(struct cpu_user_regs *regs,
     ASSERT((min_el == 0) || (min_el == 1));
 
     if ( min_el > 0 && regs_mode_is_user(regs) )
-        return inject_undef_exception(regs, hsr);
+        return inject_undef_exception(regs);
 
     if ( read )
         set_user_reg(regs, regidx, 0);
@@ -1674,10 +1674,10 @@ void handle_wo_wi(struct cpu_user_regs *regs,
     ASSERT((min_el == 0) || (min_el == 1));
 
     if ( min_el > 0 && regs_mode_is_user(regs) )
-        return inject_undef_exception(regs, hsr);
+        return inject_undef_exception(regs);
 
     if ( read )
-        return inject_undef_exception(regs, hsr);
+        return inject_undef_exception(regs);
     /* else: ignore */
 
     advance_pc(regs, hsr);
@@ -1694,10 +1694,10 @@ void handle_ro_read_val(struct cpu_user_regs *regs,
     ASSERT((min_el == 0) || (min_el == 1));
 
     if ( min_el > 0 && regs_mode_is_user(regs) )
-        return inject_undef_exception(regs, hsr);
+        return inject_undef_exception(regs);
 
     if ( !read )
-        return inject_undef_exception(regs, hsr);
+        return inject_undef_exception(regs);
 
     set_user_reg(regs, regidx, val);
 
@@ -2147,7 +2147,7 @@ void asmlinkage do_trap_guest_sync(struct cpu_user_regs *regs)
     case HSR_EC_SVE:
         GUEST_BUG_ON(regs_mode_is_32bit(regs));
         gprintk(XENLOG_WARNING, "Domain tried to use SVE while not allowed\n");
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
         break;
 #endif
 
@@ -2164,7 +2164,7 @@ void asmlinkage do_trap_guest_sync(struct cpu_user_regs *regs)
         gprintk(XENLOG_WARNING,
                 "Unknown Guest Trap. HSR=%#"PRIregister" EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n",
                 hsr.bits, hsr.ec, hsr.len, hsr.iss);
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
         break;
     }
 }
diff --git a/xen/arch/arm/vcpreg.c b/xen/arch/arm/vcpreg.c
index 0b336875a4..e7c484f2c1 100644
--- a/xen/arch/arm/vcpreg.c
+++ b/xen/arch/arm/vcpreg.c
@@ -206,7 +206,7 @@ void do_cp15_32(struct cpu_user_regs *regs, const union hsr hsr)
     case HSR_CPREG32(CNTP_CTL):
     case HSR_CPREG32(CNTP_TVAL):
         if ( !vtimer_emulate(regs, hsr) )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
         break;
 
     /*
@@ -217,7 +217,7 @@ void do_cp15_32(struct cpu_user_regs *regs, const union hsr hsr)
      */
     case HSR_CPREG32(ACTLR):
         if ( regs_mode_is_user(regs) )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
         if ( cp32.read )
             set_user_reg(regs, regidx, v->arch.actlr);
         break;
@@ -232,7 +232,7 @@ void do_cp15_32(struct cpu_user_regs *regs, const union hsr hsr)
     case HSR_CPREG32(DCCSW):
     case HSR_CPREG32(DCCISW):
         if ( !cp32.read )
-            p2m_set_way_flush(current, regs, hsr);
+            p2m_set_way_flush(current, regs);
         break;
 
     /*
@@ -397,7 +397,7 @@ void do_cp15_32(struct cpu_user_regs *regs, const union hsr hsr)
                  cp32.op1, cp32.reg, cp32.crn, cp32.crm, cp32.op2, regs->pc);
         gdprintk(XENLOG_ERR, "unhandled 32-bit CP15 access %#"PRIregister"\n",
                  hsr.bits & HSR_CP32_REGS_MASK);
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
         return;
     }
     advance_pc(regs, hsr);
@@ -421,7 +421,7 @@ void do_cp15_64(struct cpu_user_regs *regs, const union hsr hsr)
      */
     case HSR_CPREG64(CNTP_CVAL):
         if ( !vtimer_emulate(regs, hsr) )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
         break;
 
     /*
@@ -433,7 +433,7 @@ void do_cp15_64(struct cpu_user_regs *regs, const union hsr hsr)
     case HSR_CPREG64(ICC_ASGI1R):
     case HSR_CPREG64(ICC_SGI0R):
         if ( !vgic_emulate(regs, hsr) )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
         break;
 
     GENERATE_CASE(TTBR0, 64)
@@ -467,7 +467,7 @@ void do_cp15_64(struct cpu_user_regs *regs, const union hsr hsr)
             gdprintk(XENLOG_ERR,
                      "unhandled 64-bit CP15 access %#"PRIregister"\n",
                      hsr.bits & HSR_CP64_REGS_MASK);
-            inject_undef_exception(regs, hsr);
+            inject_undef_exception(regs);
             return;
         }
     }
@@ -532,7 +532,7 @@ void do_cp14_32(struct cpu_user_regs *regs, const union hsr hsr)
          * is set to 0, which we emulated below.
          */
         if ( !cp32.read )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
 
         /* Implement the minimum requirements:
          *  - Number of watchpoints: 1
@@ -631,7 +631,7 @@ void do_cp14_32(struct cpu_user_regs *regs, const union hsr hsr)
              cp32.op1, cp32.reg, cp32.crn, cp32.crm, cp32.op2, regs->pc);
     gdprintk(XENLOG_ERR, "unhandled 32-bit cp14 access %#"PRIregister"\n",
              hsr.bits & HSR_CP32_REGS_MASK);
-    inject_undef_exception(regs, hsr);
+    inject_undef_exception(regs);
 }
 
 void do_cp14_64(struct cpu_user_regs *regs, const union hsr hsr)
@@ -669,7 +669,7 @@ void do_cp14_64(struct cpu_user_regs *regs, const union hsr hsr)
              cp64.op1, cp64.reg1, cp64.reg2, cp64.crm, regs->pc);
     gdprintk(XENLOG_ERR, "unhandled 64-bit CP14 access %#"PRIregister"\n",
              hsr.bits & HSR_CP64_REGS_MASK);
-    inject_undef_exception(regs, hsr);
+    inject_undef_exception(regs);
 }
 
 void do_cp14_dbg(struct cpu_user_regs *regs, const union hsr hsr)
@@ -698,7 +698,7 @@ void do_cp14_dbg(struct cpu_user_regs *regs, const union hsr hsr)
     gdprintk(XENLOG_ERR, "unhandled 64-bit CP14 DBG access %#"PRIregister"\n",
              hsr.bits & HSR_CP64_REGS_MASK);
 
-    inject_undef_exception(regs, hsr);
+    inject_undef_exception(regs);
 }
 
 void do_cp10(struct cpu_user_regs *regs, const union hsr hsr)
@@ -731,7 +731,7 @@ void do_cp10(struct cpu_user_regs *regs, const union hsr hsr)
                  cp32.op1, cp32.reg, cp32.crn, cp32.crm, cp32.op2, regs->pc);
         gdprintk(XENLOG_ERR, "unhandled 32-bit CP10 access %#"PRIregister"\n",
                  hsr.bits & HSR_CP32_REGS_MASK);
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
         return;
     }
     
@@ -756,7 +756,7 @@ void do_cp(struct cpu_user_regs *regs, const union hsr hsr)
 
     ASSERT(!cp.tas); /* We don't trap SIMD instruction */
     gdprintk(XENLOG_ERR, "unhandled CP%d access\n", cp.coproc);
-    inject_undef_exception(regs, hsr);
+    inject_undef_exception(regs);
 }
 
 /*
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index 62d8117a12..e253865b6c 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -346,13 +346,11 @@ void do_trap_smc(struct cpu_user_regs *regs, const union hsr hsr)
     if ( vsmccc_handle_call(regs) )
         advance_pc(regs, hsr);
     else
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
 }
 
 void do_trap_hvc_smccc(struct cpu_user_regs *regs)
 {
-    const union hsr hsr = { .bits = regs->hsr };
-
     /*
      * vsmccc_handle_call() will return false if this call is not
      * SMCCC compatible (e.g. immediate value != 0). As it is not
@@ -360,7 +358,7 @@ void do_trap_hvc_smccc(struct cpu_user_regs *regs)
      * ARM_SMCCC_ERR_UNKNOWN_FUNCTION.
      */
     if ( !vsmccc_handle_call(regs) )
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:13:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:13:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900707.1308583 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGqG-0001aT-L6; Tue, 04 Mar 2025 01:13:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900707.1308583; Tue, 04 Mar 2025 01:13:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGqG-0001aL-IV; Tue, 04 Mar 2025 01:13:04 +0000
Received: by outflank-mailman (input) for mailman id 900707;
 Tue, 04 Mar 2025 01:13:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGqF-0001aA-Jz
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:13:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGqF-001305-2f
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGqF-005WxG-1p
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7i9QmvqN+8L2LtMU5bml3/aTLVNniy8EJc1niUHQQyA=; b=qJiYTO6x+as9ZeIkrexPBpJvE6
	BuMM5REycWJDGpGezcp8Hm+Sibmfa/O/9KFgNhDCG5U9nFNwnOu1TQAYSN59ISK9kHYKk05gv0NPW
	Wj8b6suselsBhLBUOoe4N34uNGVKsmrNMIzZ/DIFLzxP7mPn4lYO989klmBa6yNpMGh4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arch: arm64: always set IL=1 when injecting an abort exception
Message-Id: <E1tpGqF-005WxG-1p@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:13:03 +0000

commit ec882958fd822ed7b235577efb4044482b7b4895
Author:     Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
AuthorDate: Thu Feb 13 15:37:55 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:08:27 2025 -0800

    arch: arm64: always set IL=1 when injecting an abort exception
    
    ARM Architecture Reference Manual states that IL field of ESR_EL1
    register should be 1 in some cases, and all these cases are covered by
    inject_abt64_exception()
    
    Section D24.2.40, page D24-7337 of ARM DDI 0487L:
    
      IL, bit [25]
      Instruction Length for synchronous exceptions. Possible values of this bit are:
    
      [...]
    
      0b1 - 32-bit instruction trapped.
      This value is also used when the exception is one of the following:
      [...]
       - An Instruction Abort exception.
       - A Data Abort exception for which the value of the ISV bit is 0.
      [...]
    
    inject_abt64_exception() function injects either Instruction Abort or
    Data Abort exception. In both cases, ISS is 0, which means that ISV
    bit is 0 as well. Thus, IL must be set to 1 unconditionally.
    
    To align code with the specification, set .len field to 1 in
    inject_abt64_exception() and remove unneeded third parameter.
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/traps.c | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 5338d5c033..3071c38768 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -559,13 +559,12 @@ void inject_undef64_exception(struct cpu_user_regs *regs)
 /* Inject an abort exception into a 64 bit guest */
 static void inject_abt64_exception(struct cpu_user_regs *regs,
                                    int prefetch,
-                                   register_t addr,
-                                   int instr_len)
+                                   register_t addr)
 {
     vaddr_t handler;
     union hsr esr = {
         .iss = 0,
-        .len = instr_len,
+        .len = 1,
     };
 
     if ( regs_mode_is_user(regs) )
@@ -591,17 +590,15 @@ static void inject_abt64_exception(struct cpu_user_regs *regs,
 }
 
 static void inject_dabt64_exception(struct cpu_user_regs *regs,
-                                   register_t addr,
-                                   int instr_len)
+                                    register_t addr)
 {
-    inject_abt64_exception(regs, 0, addr, instr_len);
+    inject_abt64_exception(regs, 0, addr);
 }
 
 static void inject_iabt64_exception(struct cpu_user_regs *regs,
-                                   register_t addr,
-                                   int instr_len)
+                                    register_t addr)
 {
-    inject_abt64_exception(regs, 1, addr, instr_len);
+    inject_abt64_exception(regs, 1, addr);
 }
 
 #endif
@@ -617,26 +614,24 @@ void inject_undef_exception(struct cpu_user_regs *regs)
 }
 
 static void inject_iabt_exception(struct cpu_user_regs *regs,
-                                  register_t addr,
-                                  int instr_len)
+                                  register_t addr)
 {
         if ( is_32bit_domain(current->domain) )
             inject_pabt32_exception(regs, addr);
 #ifdef CONFIG_ARM_64
         else
-            inject_iabt64_exception(regs, addr, instr_len);
+            inject_iabt64_exception(regs, addr);
 #endif
 }
 
 static void inject_dabt_exception(struct cpu_user_regs *regs,
-                                  register_t addr,
-                                  int instr_len)
+                                  register_t addr)
 {
         if ( is_32bit_domain(current->domain) )
             inject_dabt32_exception(regs, addr);
 #ifdef CONFIG_ARM_64
         else
-            inject_dabt64_exception(regs, addr, instr_len);
+            inject_dabt64_exception(regs, addr);
 #endif
 }
 
@@ -1965,9 +1960,9 @@ inject_abt:
              "HSR=%#"PRIregister" pc=%#"PRIregister" gva=%#"PRIvaddr" gpa=%#"PRIpaddr"\n",
              hsr.bits, regs->pc, gva, gpa);
     if ( is_data )
-        inject_dabt_exception(regs, gva, hsr.len);
+        inject_dabt_exception(regs, gva);
     else
-        inject_iabt_exception(regs, gva, hsr.len);
+        inject_iabt_exception(regs, gva);
 }
 
 static inline bool needs_ssbd_flip(struct vcpu *v)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:13:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:13:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900708.1308588 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGqQ-0001d3-NN; Tue, 04 Mar 2025 01:13:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900708.1308588; Tue, 04 Mar 2025 01:13:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGqQ-0001cv-K9; Tue, 04 Mar 2025 01:13:14 +0000
Received: by outflank-mailman (input) for mailman id 900708;
 Tue, 04 Mar 2025 01:13:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGqP-0001cj-N3
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:13:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGqP-00130P-2z
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGqP-005Wxz-25
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:13:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5+QVFckEeoJxZx12blotvVHVm6MhGPq3zkfSMNn5Vrs=; b=EfFX1Zzv61f+oGaenW7G2IDVUx
	ATcSPNeyt5TBrZXJFHNahWfkFco3kdunkMUJH5/wc/lxtiMiQnlESQBslbqV5JIePl3YWe32DgqiU
	tqbnhxkcIFnuLDdeDF3tdYJhlUdrfYYetGwXQ5i4kEpTFqspIyrlMwJ9/grbR7lvGuY0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Create GIC node using the node name from host dt
Message-Id: <E1tpGqP-005Wxz-25@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:13:13 +0000

commit 0c4b0e6236f4d50316e903221a9bef1f25eb6916
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Feb 19 18:29:46 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:10:10 2025 -0800

    xen/arm: Create GIC node using the node name from host dt
    
    At the moment the GIC node we create for hwdom has a name
    "interrupt-controller". Change it so that we use the same name as the
    GIC node from host device tree. This is done for at least 2 purposes:
    1) The convention in DT spec is that a node name with "reg" property
    is formed "node-name@unit-address".
    2) With DT overlay feature, many overlays refer to the GIC node using
    the symbol under __symbols__ that we copy to hwdom 1:1. With the name
    changed, the symbol is no longer valid and requires error prone manual
    change by the user.
    
    The unit-address part of the node name always refers to the first
    address in the "reg" property which in case of GIC, always refers to
    GICD and hwdom uses host memory layout.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/domain_build.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 7b47abade1..e760198d86 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1615,6 +1615,7 @@ static int __init make_gic_node(const struct domain *d, void *fdt,
     int res = 0;
     const void *addrcells, *sizecells;
     u32 addrcells_len, sizecells_len;
+    const char *name;
 
     /*
      * Xen currently supports only a single GIC. Discard any secondary
@@ -1628,7 +1629,11 @@ static int __init make_gic_node(const struct domain *d, void *fdt,
 
     dt_dprintk("Create gic node\n");
 
-    res = fdt_begin_node(fdt, "interrupt-controller");
+    /* Use the same name as the GIC node in host device tree */
+    name = strrchr(gic->full_name, '/');
+    name = name ? name + 1 : gic->full_name;
+
+    res = fdt_begin_node(fdt, name);
     if ( res )
         return res;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:13:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:13:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900709.1308591 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGqa-0001g9-Pi; Tue, 04 Mar 2025 01:13:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900709.1308591; Tue, 04 Mar 2025 01:13:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGqa-0001g1-N8; Tue, 04 Mar 2025 01:13:24 +0000
Received: by outflank-mailman (input) for mailman id 900709;
 Tue, 04 Mar 2025 01:13:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGqZ-0001fr-Pk
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:13:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGqa-00130T-01
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGqZ-005WyN-2P
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:13:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Rq0kGnB2E+REL5pgeUQvWXfYdY4j8nLB85TrLuj5wPg=; b=nOtccnZ0qJ2XuJMku7hJ+Gnae8
	MGUgxsWbU2vkvmi2H7KvyJFQotb+SF2KZB8dUyW4ARXCpq6jeYHNYvsrKayt3MPgd/gezzP++Rnez
	+YeXdyZBNNVJ4KGzsVtfeZbEREhpkTd8Y2HCWo1Q0MlbZ2YzbIgGcL+Bs/qAoS38obYw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM: ITS: implement quirks and add support for Renesas Gen4 ITS
Message-Id: <E1tpGqZ-005WyN-2P@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:13:23 +0000

commit 751ec850ec1d90afbd6c361940ee85e21e9edd79
Author:     Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
AuthorDate: Wed Jan 15 09:21:43 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:12:21 2025 -0800

    ARM: ITS: implement quirks and add support for Renesas Gen4 ITS
    
    There are number of ITS implementations exist which are different from
    the base one which have number of functionalities defined as is
    "IMPLEMENTATION DEFINED", e.g. there may exist differences in cacheability,
    shareability and memory requirements and others. This requires
    appropriate handling of such HW requirements which are implemented as
    ITS quirks: GITS_IIDR (ITS Implementer Identification Register) is used to
    differentiate the ITS implementations and select appropriate set of
    quirks if any.
    
    As an example of such ITSes add quirk implementation for Renesas Gen4 ITS:
    - add possibility to override default cacheability and shareability
    settings used for ITS memory allocations;
    - change relevant memory allocations to alloc_xenheap_pages which allows
    to specify memory access flags, free_xenheap_pages is used to free;
    - add quirks validation to ensure that all ITSes share the same quirks
    in case of multiple ITSes are present in the system;
    
    The Gen4 ITS memory requirements are not covered in any errata as of yet,
    but observed behavior suggests that they are indeed required.
    
    The idea of the quirk implementation is inspired by the Linux kernel ITS
    quirk implementation [1].
    
    Changelog:
    v2 -> v3:
    - added missing memset;
    v1 -> v2:
    - switched to using alloc_xenheap_pages/free_xenheap_pages for ITS memory
    allocations;
    - updated declaration of its_quirk_flags;
    - added quirks validation to ensure that all ITSes share the same quirks;
    - removed unnecessary vITS changes;
    
    Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
    Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    
    [1] https://elixir.bootlin.com/linux/v5.16.1/source/drivers/irqchip/irq-gic-v3-its.c
---
 xen/arch/arm/gic-v3-its.c             | 141 +++++++++++++++++++++++++++++++---
 xen/arch/arm/gic-v3-lpi.c             |  23 ++++--
 xen/arch/arm/include/asm/gic_v3_its.h |   8 ++
 3 files changed, 152 insertions(+), 20 deletions(-)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 5fd83af25a..34833166ad 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -42,6 +42,7 @@ struct its_device {
     struct rb_node rbnode;
     struct host_its *hw_its;
     void *itt_addr;
+    unsigned int itt_order;
     paddr_t guest_doorbell;             /* Identifies the virtual ITS */
     uint32_t host_devid;
     uint32_t guest_devid;
@@ -50,6 +51,104 @@ struct its_device {
     struct pending_irq *pend_irqs;      /* One struct per event */
 };
 
+/*
+ * It is unlikely that a platform implements ITSes with different quirks,
+ * so assume they all share the same.
+ */
+struct its_quirk {
+    const char *desc;
+    bool (*init)(struct host_its *hw_its);
+    uint32_t iidr;
+    uint32_t mask;
+};
+
+static uint32_t __ro_after_init its_quirk_flags;
+
+static bool gicv3_its_enable_quirk_gen4(struct host_its *hw_its)
+{
+    its_quirk_flags |= HOST_ITS_WORKAROUND_NC_NS |
+        HOST_ITS_WORKAROUND_32BIT_ADDR;
+
+    return true;
+}
+
+static const struct its_quirk its_quirks[] = {
+    {
+        .desc	= "R-Car Gen4",
+        .iidr	= 0x0201743b,
+        .mask	= 0xffffffff,
+        .init	= gicv3_its_enable_quirk_gen4,
+    },
+    {
+        /* Sentinel. */
+    }
+};
+
+static struct its_quirk* gicv3_its_find_quirk(uint32_t iidr)
+{
+    const struct its_quirk *quirks = its_quirks;
+
+    for ( ; quirks->desc; quirks++ )
+    {
+        if ( quirks->iidr == (quirks->mask & iidr) )
+            return (struct its_quirk *)quirks;
+    }
+
+    return NULL;
+}
+
+static void gicv3_its_enable_quirks(struct host_its *hw_its)
+{
+    uint32_t iidr = readl_relaxed(hw_its->its_base + GITS_IIDR);
+    const struct its_quirk *quirk = gicv3_its_find_quirk(iidr);
+
+    if ( quirk && quirk->init(hw_its) )
+        printk("GICv3: enabling workaround for ITS: %s\n", quirk->desc);
+}
+
+static void gicv3_its_validate_quirks(void)
+{
+    const struct its_quirk *quirk = NULL, *prev = NULL;
+    const struct host_its *hw_its;
+
+    if ( list_empty(&host_its_list) )
+        return;
+
+    hw_its = list_first_entry(&host_its_list, struct host_its, entry);
+    prev = gicv3_its_find_quirk(readl_relaxed(hw_its->its_base + GITS_IIDR));
+
+    list_for_each_entry(hw_its, &host_its_list, entry)
+    {
+        quirk = gicv3_its_find_quirk(readl_relaxed(hw_its->its_base + GITS_IIDR));
+        BUG_ON(quirk != prev);
+        prev = quirk;
+    }
+}
+
+uint64_t gicv3_its_get_cacheability(void)
+{
+    if ( its_quirk_flags & HOST_ITS_WORKAROUND_NC_NS )
+        return GIC_BASER_CACHE_nC;
+
+    return GIC_BASER_CACHE_RaWaWb;
+}
+
+uint64_t gicv3_its_get_shareability(void)
+{
+    if ( its_quirk_flags & HOST_ITS_WORKAROUND_NC_NS )
+        return GIC_BASER_NonShareable;
+
+    return GIC_BASER_InnerShareable;
+}
+
+unsigned int gicv3_its_get_memflags(void)
+{
+    if ( its_quirk_flags & HOST_ITS_WORKAROUND_32BIT_ADDR )
+        return MEMF_bits(32);
+
+    return 0;
+}
+
 bool gicv3_its_host_has_its(void)
 {
     return !list_empty(&host_its_list);
@@ -289,19 +388,23 @@ static void *its_map_cbaser(struct host_its *its)
 {
     void __iomem *cbasereg = its->its_base + GITS_CBASER;
     uint64_t reg;
+    unsigned int order;
     void *buffer;
 
-    reg  = GIC_BASER_InnerShareable << GITS_BASER_SHAREABILITY_SHIFT;
+    reg  = gicv3_its_get_shareability() << GITS_BASER_SHAREABILITY_SHIFT;
     reg |= GIC_BASER_CACHE_SameAsInner << GITS_BASER_OUTER_CACHEABILITY_SHIFT;
-    reg |= GIC_BASER_CACHE_RaWaWb << GITS_BASER_INNER_CACHEABILITY_SHIFT;
+    reg |= gicv3_its_get_cacheability() << GITS_BASER_INNER_CACHEABILITY_SHIFT;
 
-    buffer = _xzalloc(ITS_CMD_QUEUE_SZ, SZ_64K);
+    order = get_order_from_bytes(max(ITS_CMD_QUEUE_SZ, SZ_64K));
+    buffer = alloc_xenheap_pages(order, gicv3_its_get_memflags());
     if ( !buffer )
         return NULL;
 
+    memset(buffer, 0, PAGE_SIZE << order);
+
     if ( virt_to_maddr(buffer) & ~GENMASK(51, 12) )
     {
-        xfree(buffer);
+        free_xenheap_pages(buffer, order);
         return NULL;
     }
 
@@ -340,11 +443,12 @@ static int its_map_baser(void __iomem *basereg, uint64_t regc,
     unsigned int entry_size = GITS_BASER_ENTRY_SIZE(regc);
     unsigned int pagesz = 2;    /* try 64K pages first, then go down. */
     unsigned int table_size;
+    unsigned int order;
     void *buffer;
 
-    attr  = GIC_BASER_InnerShareable << GITS_BASER_SHAREABILITY_SHIFT;
+    attr  = gicv3_its_get_shareability() << GITS_BASER_SHAREABILITY_SHIFT;
     attr |= GIC_BASER_CACHE_SameAsInner << GITS_BASER_OUTER_CACHEABILITY_SHIFT;
-    attr |= GIC_BASER_CACHE_RaWaWb << GITS_BASER_INNER_CACHEABILITY_SHIFT;
+    attr |= gicv3_its_get_cacheability() << GITS_BASER_INNER_CACHEABILITY_SHIFT;
 
     /*
      * Setup the BASE register with the attributes that we like. Then read
@@ -357,13 +461,16 @@ retry:
     /* The BASE registers support at most 256 pages. */
     table_size = min(table_size, 256U << BASER_PAGE_BITS(pagesz));
 
-    buffer = _xzalloc(table_size, BIT(BASER_PAGE_BITS(pagesz), UL));
+    order = get_order_from_bytes(max(table_size, BIT(BASER_PAGE_BITS(pagesz), U)));
+    buffer = alloc_xenheap_pages(order, gicv3_its_get_memflags());
     if ( !buffer )
         return -ENOMEM;
 
+    memset(buffer, 0, PAGE_SIZE << order);
+
     if ( !check_baser_phys_addr(buffer, BASER_PAGE_BITS(pagesz)) )
     {
-        xfree(buffer);
+        free_xenheap_pages(buffer, order);
         return -ERANGE;
     }
 
@@ -396,7 +503,7 @@ retry:
     if ( ((regc >> GITS_BASER_PAGE_SIZE_SHIFT) & 0x3UL) == pagesz )
         return 0;
 
-    xfree(buffer);
+    free_xenheap_pages(buffer, order);
 
     if ( pagesz-- > 0 )
         goto retry;
@@ -453,6 +560,8 @@ static int gicv3_its_init_single_its(struct host_its *hw_its)
     if ( ret )
         return ret;
 
+    gicv3_its_enable_quirks(hw_its);
+
     reg = readq_relaxed(hw_its->its_base + GITS_TYPER);
     hw_its->devid_bits = GITS_TYPER_DEVICE_ID_BITS(reg);
     hw_its->evid_bits = GITS_TYPER_EVENT_ID_BITS(reg);
@@ -530,7 +639,7 @@ static int remove_mapped_guest_device(struct its_device *dev)
         printk(XENLOG_WARNING "Can't unmap host ITS device 0x%x\n",
                dev->host_devid);
 
-    xfree(dev->itt_addr);
+    free_xenheap_pages(dev->itt_addr, dev->itt_order);
     xfree(dev->pend_irqs);
     xfree(dev->host_lpi_blocks);
     xfree(dev);
@@ -619,6 +728,7 @@ int gicv3_its_map_guest_device(struct domain *d,
     struct its_device *dev = NULL;
     struct rb_node **new = &d->arch.vgic.its_devices.rb_node, *parent = NULL;
     int i, ret = -ENOENT;      /* "i" must be signed to check for >= 0 below. */
+    unsigned int order;
 
     hw_its = gicv3_its_find_by_doorbell(host_doorbell);
     if ( !hw_its )
@@ -681,10 +791,13 @@ int gicv3_its_map_guest_device(struct domain *d,
     ret = -ENOMEM;
 
     /* An Interrupt Translation Table needs to be 256-byte aligned. */
-    itt_addr = _xzalloc(nr_events * hw_its->itte_size, 256);
+    order = get_order_from_bytes(max(nr_events * hw_its->itte_size, 256UL));
+    itt_addr = alloc_xenheap_pages(order, gicv3_its_get_memflags());
     if ( !itt_addr )
         goto out_unlock;
 
+    memset(itt_addr, 0, PAGE_SIZE << order);
+
     clean_and_invalidate_dcache_va_range(itt_addr,
                                          nr_events * hw_its->itte_size);
 
@@ -718,6 +831,7 @@ int gicv3_its_map_guest_device(struct domain *d,
         goto out_unlock;
 
     dev->itt_addr = itt_addr;
+    dev->itt_order = order;
     dev->hw_its = hw_its;
     dev->guest_doorbell = guest_doorbell;
     dev->guest_devid = guest_devid;
@@ -775,7 +889,8 @@ out:
         xfree(dev->pend_irqs);
         xfree(dev->host_lpi_blocks);
     }
-    xfree(itt_addr);
+    if ( itt_addr )
+        free_xenheap_pages(itt_addr, order);
     xfree(dev);
 
     return ret;
@@ -1089,6 +1204,8 @@ int gicv3_its_init(void)
             return ret;
     }
 
+    gicv3_its_validate_quirks();
+
     return 0;
 }
 
diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c
index de4b0eb4a4..de5052e5cf 100644
--- a/xen/arch/arm/gic-v3-lpi.c
+++ b/xen/arch/arm/gic-v3-lpi.c
@@ -227,6 +227,7 @@ void gicv3_lpi_update_host_entry(uint32_t host_lpi, int domain_id,
 static int gicv3_lpi_allocate_pendtable(unsigned int cpu)
 {
     void *pendtable;
+    unsigned int order;
 
     if ( per_cpu(lpi_redist, cpu).pending_table )
         return -EBUSY;
@@ -237,14 +238,16 @@ static int gicv3_lpi_allocate_pendtable(unsigned int cpu)
      * The GICv3 imposes a 64KB alignment requirement, also requires
      * physically contiguous memory.
      */
-    pendtable = _xzalloc(lpi_data.max_host_lpi_ids / 8, SZ_64K);
+    order = get_order_from_bytes(max(lpi_data.max_host_lpi_ids / 8, (unsigned long)SZ_64K));
+    pendtable = alloc_xenheap_pages(order, gicv3_its_get_memflags());
     if ( !pendtable )
         return -ENOMEM;
 
+    memset(pendtable, 0, PAGE_SIZE << order);
     /* Make sure the physical address can be encoded in the register. */
     if ( virt_to_maddr(pendtable) & ~GENMASK(51, 16) )
     {
-        xfree(pendtable);
+        free_xenheap_pages(pendtable, order);
         return -ERANGE;
     }
     clean_and_invalidate_dcache_va_range(pendtable,
@@ -272,9 +275,9 @@ static int gicv3_lpi_set_pendtable(void __iomem *rdist_base)
 
     ASSERT(!(virt_to_maddr(pendtable) & ~GENMASK(51, 16)));
 
-    val  = GIC_BASER_CACHE_RaWaWb << GICR_PENDBASER_INNER_CACHEABILITY_SHIFT;
+    val  = gicv3_its_get_cacheability() << GICR_PENDBASER_INNER_CACHEABILITY_SHIFT;
     val |= GIC_BASER_CACHE_SameAsInner << GICR_PENDBASER_OUTER_CACHEABILITY_SHIFT;
-    val |= GIC_BASER_InnerShareable << GICR_PENDBASER_SHAREABILITY_SHIFT;
+    val |= gicv3_its_get_shareability() << GICR_PENDBASER_SHAREABILITY_SHIFT;
     val |= GICR_PENDBASER_PTZ;
     val |= virt_to_maddr(pendtable);
 
@@ -300,10 +303,11 @@ static int gicv3_lpi_set_pendtable(void __iomem *rdist_base)
 static int gicv3_lpi_set_proptable(void __iomem * rdist_base)
 {
     uint64_t reg;
+    unsigned int order;
 
-    reg  = GIC_BASER_CACHE_RaWaWb << GICR_PROPBASER_INNER_CACHEABILITY_SHIFT;
+    reg  = gicv3_its_get_cacheability() << GICR_PROPBASER_INNER_CACHEABILITY_SHIFT;
     reg |= GIC_BASER_CACHE_SameAsInner << GICR_PROPBASER_OUTER_CACHEABILITY_SHIFT;
-    reg |= GIC_BASER_InnerShareable << GICR_PROPBASER_SHAREABILITY_SHIFT;
+    reg |= gicv3_its_get_shareability() << GICR_PROPBASER_SHAREABILITY_SHIFT;
 
     /*
      * The property table is shared across all redistributors, so allocate
@@ -312,7 +316,10 @@ static int gicv3_lpi_set_proptable(void __iomem * rdist_base)
     if ( !lpi_data.lpi_property )
     {
         /* The property table holds one byte per LPI. */
-        void *table = _xmalloc(lpi_data.max_host_lpi_ids, SZ_4K);
+        void *table;
+
+        order = get_order_from_bytes(max(lpi_data.max_host_lpi_ids, (unsigned long)SZ_4K));
+        table = alloc_xenheap_pages(order, gicv3_its_get_memflags());
 
         if ( !table )
             return -ENOMEM;
@@ -320,7 +327,7 @@ static int gicv3_lpi_set_proptable(void __iomem * rdist_base)
         /* Make sure the physical address can be encoded in the register. */
         if ( (virt_to_maddr(table) & ~GENMASK(51, 12)) )
         {
-            xfree(table);
+            free_xenheap_pages(table, order);
             return -ERANGE;
         }
         memset(table, GIC_PRI_IRQ | LPI_PROP_RES1, MAX_NR_HOST_LPIS);
diff --git a/xen/arch/arm/include/asm/gic_v3_its.h b/xen/arch/arm/include/asm/gic_v3_its.h
index c24d4752d0..0737e67aa6 100644
--- a/xen/arch/arm/include/asm/gic_v3_its.h
+++ b/xen/arch/arm/include/asm/gic_v3_its.h
@@ -110,6 +110,9 @@
 #define HOST_ITS_FLUSH_CMD_QUEUE        (1U << 0)
 #define HOST_ITS_USES_PTA               (1U << 1)
 
+#define HOST_ITS_WORKAROUND_NC_NS       (1U << 0)
+#define HOST_ITS_WORKAROUND_32BIT_ADDR  (1U << 1)
+
 /* We allocate LPIs on the hosts in chunks of 32 to reduce handling overhead. */
 #define LPI_BLOCK                       32U
 
@@ -197,6 +200,11 @@ struct pending_irq *gicv3_assign_guest_event(struct domain *d,
 void gicv3_lpi_update_host_entry(uint32_t host_lpi, int domain_id,
                                  uint32_t virt_lpi);
 
+/* ITS quirks handling. */
+uint64_t gicv3_its_get_cacheability(void);
+uint64_t gicv3_its_get_shareability(void);
+unsigned int gicv3_its_get_memflags(void);
+
 #else
 
 #ifdef CONFIG_ACPI
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:13:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:13:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900710.1308594 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGqk-0001iT-R4; Tue, 04 Mar 2025 01:13:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900710.1308594; Tue, 04 Mar 2025 01:13:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGqk-0001iL-Oe; Tue, 04 Mar 2025 01:13:34 +0000
Received: by outflank-mailman (input) for mailman id 900710;
 Tue, 04 Mar 2025 01:13:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGqj-0001i8-SK
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:13:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGqk-00130Y-0H
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:13:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGqj-005Wyj-2f
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:13:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Y0UYMel0Bv0GsHURbXoo3qzIWgF53zbLLupvmlGxCvc=; b=lYgdj1pMuRd/v/AKYyBbRNlow7
	wF50NzEOIFj1QzbUDWUDHef1WGxUA6FHJdw2ab1QcJHENZqKTCyB/57QsNoCo9KIwwCYiR59c9I+n
	2IRub05U6i7szoL5XquvWmF7xthn7Hnwww41kfh2feCMKx1WT5K8H7aUa7UG1I43zJbg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: platform: Add support for R-Car Gen4
Message-Id: <E1tpGqj-005Wyj-2f@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:13:33 +0000

commit 336fc7a19b492390026f856643cf020829e5e9cc
Author:     Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
AuthorDate: Wed Jan 15 09:21:43 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:12:21 2025 -0800

    xen/arm: platform: Add support for R-Car Gen4
    
    Add Rcar Gen4 platform choice to Kconfig to select all required
    drivers automatically.
    
    Changelog:
    v1 -> v2:
    - Added RB from Stefano Stabellini
    
    Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/platforms/Kconfig | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/platforms/Kconfig b/xen/arch/arm/platforms/Kconfig
index 6dbf6ec87b..1a25706516 100644
--- a/xen/arch/arm/platforms/Kconfig
+++ b/xen/arch/arm/platforms/Kconfig
@@ -29,6 +29,15 @@ config RCAR3
 	help
 	Enable all the required drivers for Renesas RCar3
 
+config RCAR4
+	bool "Renesas RCar4 support"
+	depends on ARM_64
+	select HAS_SCIF
+	select HAS_ITS
+	select IPMMU_VMSA
+	help
+	Enable all the required drivers for Renesas RCar4
+
 config MPSOC
 	bool "Xilinx Ultrascale+ MPSoC support"
 	depends on ARM_64
@@ -63,4 +72,3 @@ config ALL32_PLAT
 config MPSOC_PLATFORM
 	bool
 	default (ALL64_PLAT || MPSOC)
-
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:13:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:13:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900711.1308599 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGqu-0001kx-Sl; Tue, 04 Mar 2025 01:13:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900711.1308599; Tue, 04 Mar 2025 01:13:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGqu-0001kp-Q6; Tue, 04 Mar 2025 01:13:44 +0000
Received: by outflank-mailman (input) for mailman id 900711;
 Tue, 04 Mar 2025 01:13:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGqt-0001ke-V3
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:13:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGqu-00130g-0X
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:13:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGqt-005WzJ-2v
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:13:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xpdFjKWld4JC/9lWTOVrf/o3tEqaBi9ZMCVvr0Zt2Ig=; b=0J5AmhHaIYxLL1DfHvEpSqJmzG
	8b8U4VEMNPmfotBsuPTTbdUkn8qPEhazxZYWOzYLc1w87ho4CrA7P61xTPSHedHU1NYNVXlJ7gmEo
	rCvu/TECHEBgCXfv7sBkNaeys1v87EG8cYa8P1YWojQ56VfQVgImxKhUapP/E+Cb73ew=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: platform: address violation of MISRA C Rule 7.2
Message-Id: <E1tpGqt-005WzJ-2v@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:13:43 +0000

commit eed384e390e1cc9c283467249dfce64192b0ea7c
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Fri Feb 14 21:45:21 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:14:12 2025 -0800

    xen/arm: platform: address violation of MISRA C Rule 7.2
    
    Rule 7.2 states: "A u or U suffix shall be applied to all integer
    constants that are represented in an unsigned type".
    
    Some PM_* constants are unsigned quantities, despite some
    of them being representable in a signed type, so a 'U' suffix
    should be present.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/platforms/brcm-raspberry-pi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/platforms/brcm-raspberry-pi.c b/xen/arch/arm/platforms/brcm-raspberry-pi.c
index 407ec07f63..d49460329c 100644
--- a/xen/arch/arm/platforms/brcm-raspberry-pi.c
+++ b/xen/arch/arm/platforms/brcm-raspberry-pi.c
@@ -47,11 +47,11 @@ static const struct dt_device_match rpi4_blacklist_dev[] __initconst =
 };
 
 
-#define PM_PASSWORD                 0x5a000000
+#define PM_PASSWORD                 0x5a000000U
 #define PM_RSTC                     0x1c
 #define PM_WDOG                     0x24
-#define PM_RSTC_WRCFG_FULL_RESET    0x00000020
-#define PM_RSTC_WRCFG_CLR           0xffffffcf
+#define PM_RSTC_WRCFG_FULL_RESET    0x00000020U
+#define PM_RSTC_WRCFG_CLR           0xffffffcfU
 
 static void __iomem *rpi4_map_watchdog(void)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:13:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:13:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900712.1308603 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGr4-0001nl-UH; Tue, 04 Mar 2025 01:13:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900712.1308603; Tue, 04 Mar 2025 01:13:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGr4-0001nd-RX; Tue, 04 Mar 2025 01:13:54 +0000
Received: by outflank-mailman (input) for mailman id 900712;
 Tue, 04 Mar 2025 01:13:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGr4-0001nT-1c
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:13:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGr4-00130l-0o
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:13:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGr3-005X0i-3B
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:13:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AhHrDHYKsqu17R8GzHRPr0sc4Rm75ERQ/CCS59q99sU=; b=v4A1/phe7W9FR2SWYqnopA1/OH
	Ja7nU6NAbWY6FTXpUz3qf915Ddx2wayh93pzLvLrWfTWazkgntv9RH/vJczXN3QDPGAHZRTjZSEb/
	FetCzGrzq6NsAK6zultsjNRmIB+6TBFchAuv2AIBSH1OSnGwQREZSV7uC6FCL7/EGP5o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/sched: address violation of MISRA C Rule 8.2
Message-Id: <E1tpGr3-005X0i-3B@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:13:53 +0000

commit 8cc548251691a7ecdfd687d6e049dda3282d8de3
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Fri Feb 14 21:45:22 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:14:13 2025 -0800

    xen/sched: address violation of MISRA C Rule 8.2
    
    Rule 8.2 states: "Function types shall be in prototype form with
    named parameters".
    
    The parameter name is missing from the function pointer type
    that constitutes the first parameter.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/rt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c
index f368e0fdd5..7b1f64a779 100644
--- a/xen/common/sched/rt.c
+++ b/xen/common/sched/rt.c
@@ -500,7 +500,7 @@ deadline_queue_remove(struct list_head *queue, struct list_head *elem)
 }
 
 static inline bool
-deadline_queue_insert(struct rt_unit * (*qelem)(struct list_head *),
+deadline_queue_insert(struct rt_unit * (*qelem)(struct list_head *elem),
                       struct rt_unit *svc, struct list_head *elem,
                       struct list_head *queue)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:14:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:14:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900713.1308607 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGrF-0001pq-0N; Tue, 04 Mar 2025 01:14:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900713.1308607; Tue, 04 Mar 2025 01:14:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGrE-0001pi-Sx; Tue, 04 Mar 2025 01:14:04 +0000
Received: by outflank-mailman (input) for mailman id 900713;
 Tue, 04 Mar 2025 01:14:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGrE-0001pV-47
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:14:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGrE-00131J-14
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:14:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGrE-005X2Z-0D
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:14:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rFbhSkRl3cKHQ7S8VhXh8d4HkYjt/CJUrQKhUkXMzp4=; b=Y2AAvzCt87zCOlaEgHYcFN9QGB
	FgRqPpkkDzdSBgZokDiYCMeWUtmeeFqRRpFrFst79LCZbm8IyeQ2mNSsnFDnevthc9YwANLLZO5i7
	8BwybFDt3oeWLfrNomttfF5Ei4tvMAaPUoi07CIsR85crCTyKiqXrTofrKdLGv1ObGzU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: Update ECLAIR analysis configuration
Message-Id: <E1tpGrE-005X2Z-0D@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:14:04 +0000

commit da03249bb1a030c340a2719b817e8a03b542325a
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Fri Feb 14 21:45:23 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:14:14 2025 -0800

    automation: Update ECLAIR analysis configuration
    
    The Xen configurations for the ARM64 and X86_64 ECLAIR analyses
    is currently held in fixed files under
    'automation/eclair_analysis/xen_{arm,x86}_config'. The values
    of the configuration options there are susceptible to going stale
    due to configuration option changes.
    
    To enhance maintainability, the configuration under analysis is
    derived from the respective architecture's defconfig, with suitable
    changes added via EXTRA_XEN_CONFIG.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/prepare.sh     |   8 +-
 automation/eclair_analysis/xen_arm_config | 141 -----------------------------
 automation/eclair_analysis/xen_x86_config | 143 ------------------------------
 automation/gitlab-ci/analyze.yaml         |  68 ++++++++++++++
 4 files changed, 73 insertions(+), 287 deletions(-)

diff --git a/automation/eclair_analysis/prepare.sh b/automation/eclair_analysis/prepare.sh
index 3a646414a3..4285ff26de 100755
--- a/automation/eclair_analysis/prepare.sh
+++ b/automation/eclair_analysis/prepare.sh
@@ -25,18 +25,20 @@ fi
 export XEN_TARGET_ARCH
 
 if [ "$1" = "X86_64" ]; then
-  CONFIG_FILE="${script_dir}/xen_x86_config"
   XEN_TARGET_ARCH=x86_64
 elif [ "$1" = "ARM64" ]; then
-  CONFIG_FILE="${script_dir}/xen_arm_config"
   XEN_TARGET_ARCH=arm64
 else
   fatal "Unknown configuration: $1"
 fi
 
 (
+    make -C xen defconfig
+    if [[ -n "${EXTRA_XEN_CONFIG}" ]]; then
+        echo "${EXTRA_XEN_CONFIG}" >> xen/.config
+    fi
+
     ./configure
-    cp "${CONFIG_FILE}" xen/.config
     make clean
     find . -type f -name "*.safparse" -print -delete
     "${script_dir}/build.sh" "$1"
diff --git a/automation/eclair_analysis/xen_arm_config b/automation/eclair_analysis/xen_arm_config
deleted file mode 100644
index ef140ceb73..0000000000
--- a/automation/eclair_analysis/xen_arm_config
+++ /dev/null
@@ -1,141 +0,0 @@
-CONFIG_CC_IS_GCC=y
-CONFIG_GCC_VERSION=90400
-CONFIG_CLANG_VERSION=0
-CONFIG_LD_IS_GNU=y
-CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE=y
-CONFIG_ARM_64=y
-CONFIG_ARM=y
-CONFIG_ARCH_DEFCONFIG="arch/arm/configs/arm64_defconfig"
-
-# UBSAN
-CONFIG_UBSAN=n
-
-#
-# Architecture Features
-#
-CONFIG_ARM64_SVE=n
-CONFIG_64BIT=y
-CONFIG_NR_CPUS=4
-# CONFIG_ACPI is not set
-CONFIG_ARM_EFI=y
-CONFIG_GICV3=y
-CONFIG_HAS_ITS=y
-CONFIG_HVM=y
-# CONFIG_NEW_VGIC is not set
-CONFIG_SBSA_VUART_CONSOLE=y
-CONFIG_ARM_SSBD=y
-CONFIG_HARDEN_BRANCH_PREDICTOR=y
-CONFIG_TEE=n
-CONFIG_OPTEE=n
-CONFIG_FFA=n
-# CONFIG_STATIC_SHM is not set
-# end of Architecture Features
-
-#
-# ARM errata workaround via the alternative framework
-#
-CONFIG_ARM64_ERRATUM_827319=y
-CONFIG_ARM64_ERRATUM_824069=y
-CONFIG_ARM64_ERRATUM_819472=y
-CONFIG_ARM64_ERRATUM_843419=y
-CONFIG_ARM64_ERRATUM_832075=y
-CONFIG_ARM64_ERRATUM_834220=y
-CONFIG_ARM64_ERRATUM_1508412=y
-CONFIG_ARM_ERRATUM_858921=y
-CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y
-CONFIG_ARM64_ERRATUM_1286807=y
-# end of ARM errata workaround via the alternative framework
-
-CONFIG_ARM64_HARDEN_BRANCH_PREDICTOR=y
-# CONFIG_ALL_PLAT is not set
-# CONFIG_QEMU is not set
-# CONFIG_RCAR3 is not set
-CONFIG_MPSOC=y
-# CONFIG_NO_PLAT is not set
-CONFIG_MPSOC_PLATFORM=y
-
-#
-# Common Features
-#
-CONFIG_GRANT_TABLE=y
-CONFIG_HAS_ALTERNATIVE=y
-CONFIG_HAS_DEVICE_TREE=y
-CONFIG_HAS_FAST_MULTIPLY=y
-CONFIG_HAS_PDX=y
-CONFIG_HAS_PMAP=y
-# CONFIG_MEM_ACCESS is not set
-CONFIG_STATIC_MEMORY=y
-
-#
-# Speculative hardening
-#
-CONFIG_SPECULATIVE_HARDEN_ARRAY=y
-# end of Speculative hardening
-
-# CONFIG_HYPFS is not set
-CONFIG_IOREQ_SERVER=y
-# CONFIG_EFI_SET_VIRTUAL_ADDRESS_MAP is not set
-# CONFIG_XSM is not set
-# CONFIG_ARGO is not set
-
-#
-# Schedulers
-#
-# CONFIG_SCHED_CREDIT is not set
-CONFIG_SCHED_CREDIT2=y
-# CONFIG_SCHED_RTDS is not set
-# CONFIG_SCHED_ARINC653 is not set
-CONFIG_SCHED_NULL=y
-CONFIG_SCHED_CREDIT2_DEFAULT=y
-# CONFIG_SCHED_NULL_DEFAULT is not set
-CONFIG_SCHED_DEFAULT="credit2"
-# end of Schedulers
-
-CONFIG_BOOT_TIME_CPUPOOLS=y
-# CONFIG_LIVEPATCH is not set
-# CONFIG_ENFORCE_UNIQUE_SYMBOLS is not set
-CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS=y
-CONFIG_CMDLINE=""
-CONFIG_DOM0_MEM=""
-CONFIG_DTB_FILE=""
-# CONFIG_TRACEBUFFER is not set
-# end of Common Features
-
-#
-# Device Drivers
-#
-# CONFIG_HAS_NS16550 is not set
-CONFIG_HAS_CADENCE_UART=y
-# CONFIG_HAS_IMX_LPUART is not set
-# CONFIG_HAS_MVEBU is not set
-# CONFIG_HAS_MESON is not set
-CONFIG_HAS_PL011=y
-# CONFIG_HAS_SCIF is not set
-CONFIG_SERIAL_TX_BUFSIZE=16384
-CONFIG_HAS_PASSTHROUGH=y
-CONFIG_ARM_SMMU=y
-CONFIG_ARM_SMMU_V3=y
-# CONFIG_IPMMU_VMSA is not set
-CONFIG_IOMMU_FORCE_PT_SHARE=y
-# end of Device Drivers
-
-CONFIG_EXPERT=y
-CONFIG_UNSUPPORTED=y
-
-#
-# Debugging Options
-#
-CONFIG_DEBUG=y
-CONFIG_FRAME_POINTER=y
-CONFIG_COVERAGE=y
-CONFIG_DEBUG_LOCK_PROFILE=y
-CONFIG_DEBUG_LOCKS=y
-CONFIG_PERF_COUNTERS=y
-CONFIG_PERF_ARRAYS=y
-CONFIG_VERBOSE_DEBUG=y
-CONFIG_DEVICE_TREE_DEBUG=y
-CONFIG_SCRUB_DEBUG=y
-CONFIG_DEBUG_TRACE=y
-CONFIG_XMEM_POOL_POISON=y
-CONFIG_DEBUG_INFO=y
-# end of Debugging Options
diff --git a/automation/eclair_analysis/xen_x86_config b/automation/eclair_analysis/xen_x86_config
deleted file mode 100644
index abc44d43e1..0000000000
--- a/automation/eclair_analysis/xen_x86_config
+++ /dev/null
@@ -1,143 +0,0 @@
-CONFIG_CC_IS_GCC=y
-CONFIG_GCC_VERSION=90400
-CONFIG_CLANG_VERSION=0
-CONFIG_LD_IS_GNU=y
-CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE=y
-CONFIG_X86_64=y
-CONFIG_X86=y
-CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
-CONFIG_CC_HAS_INDIRECT_THUNK=y
-CONFIG_HAS_AS_CET_SS=y
-CONFIG_HAS_CC_CET_IBT=y
-
-CONFIG_REQUIRE_NX=n
-
-#
-# Architecture Features
-#
-CONFIG_64BIT=y
-CONFIG_NR_CPUS=16
-CONFIG_NR_NUMA_NODES=2
-# CONFIG_PV is not set
-CONFIG_HVM=y
-# CONFIG_XEN_SHSTK is not set
-# CONFIG_XEN_IBT is not set
-# CONFIG_SHADOW_PAGING is not set
-# CONFIG_BIGMEM is not set
-# CONFIG_HVM_FEP is not set
-# CONFIG_TBOOT is not set
-CONFIG_XEN_ALIGN_DEFAULT=y
-# CONFIG_XEN_ALIGN_2M is not set
-CONFIG_X2APIC_PHYSICAL=y
-# CONFIG_XEN_GUEST is not set
-# CONFIG_HYPERV_GUEST is not set
-# CONFIG_MEM_PAGING is not set
-# CONFIG_MEM_SHARING is not set
-# end of Architecture Features
-
-#
-# Common Features
-#
-CONFIG_COMPAT=y
-CONFIG_CORE_PARKING=y
-CONFIG_GRANT_TABLE=y
-CONFIG_ALTERNATIVE_CALL=y
-CONFIG_ARCH_MAP_DOMAIN_PAGE=y
-CONFIG_GENERIC_BUG_FRAME=y
-CONFIG_HAS_ALTERNATIVE=y
-CONFIG_HAS_COMPAT=y
-CONFIG_HAS_EX_TABLE=y
-CONFIG_HAS_FAST_MULTIPLY=y
-CONFIG_HAS_IOPORTS=y
-CONFIG_HAS_KEXEC=y
-CONFIG_HAS_PDX=y
-CONFIG_HAS_SCHED_GRANULARITY=y
-CONFIG_HAS_UBSAN=y
-CONFIG_MEM_ACCESS_ALWAYS_ON=y
-CONFIG_MEM_ACCESS=y
-CONFIG_NEEDS_LIBELF=y
-CONFIG_NUMA=y
-
-#
-# Speculative hardening
-#
-CONFIG_INDIRECT_THUNK=y
-CONFIG_SPECULATIVE_HARDEN_ARRAY=y
-CONFIG_SPECULATIVE_HARDEN_BRANCH=y
-# end of Speculative hardening
-
-# CONFIG_HYPFS is not set
-CONFIG_IOREQ_SERVER=y
-# CONFIG_KEXEC is not set
-# CONFIG_EFI_SET_VIRTUAL_ADDRESS_MAP is not set
-# CONFIG_XENOPROF is not set
-# CONFIG_XSM is not set
-# CONFIG_ARGO is not set
-
-#
-# Schedulers
-#
-# CONFIG_SCHED_CREDIT is not set
-CONFIG_SCHED_CREDIT2=y
-# CONFIG_SCHED_RTDS is not set
-# CONFIG_SCHED_ARINC653 is not set
-CONFIG_SCHED_NULL=y
-CONFIG_SCHED_CREDIT2_DEFAULT=y
-# CONFIG_SCHED_NULL_DEFAULT is not set
-CONFIG_SCHED_DEFAULT="credit2"
-# end of Schedulers
-
-# CONFIG_LIVEPATCH is not set
-# CONFIG_ENFORCE_UNIQUE_SYMBOLS is not set
-# CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS is not set
-CONFIG_CMDLINE=""
-CONFIG_DOM0_MEM=""
-# CONFIG_TRACEBUFFER is not set
-# end of Common Features
-
-#
-# Device Drivers
-#
-CONFIG_ACPI=y
-CONFIG_ACPI_LEGACY_TABLES_LOOKUP=y
-CONFIG_ACPI_NUMA=y
-CONFIG_HAS_NS16550=y
-CONFIG_HAS_EHCI=y
-CONFIG_SERIAL_TX_BUFSIZE=16384
-# CONFIG_XHCI is not set
-CONFIG_HAS_CPUFREQ=y
-CONFIG_HAS_PASSTHROUGH=y
-CONFIG_AMD_IOMMU=y
-# CONFIG_INTEL_IOMMU is not set
-# CONFIG_IOMMU_QUARANTINE_NONE is not set
-CONFIG_IOMMU_QUARANTINE_BASIC=y
-# CONFIG_IOMMU_QUARANTINE_SCRATCH_PAGE is not set
-CONFIG_HAS_PCI=y
-CONFIG_HAS_PCI_MSI=y
-CONFIG_VIDEO=y
-CONFIG_VGA=y
-CONFIG_HAS_VPCI=y
-# end of Device Drivers
-
-CONFIG_EXPERT=y
-CONFIG_UNSUPPORTED=y
-CONFIG_ARCH_SUPPORTS_INT128=y
-
-#
-# Debugging Options
-#
-CONFIG_DEBUG=y
-# CONFIG_CRASH_DEBUG is not set
-CONFIG_GDBSX=y
-CONFIG_FRAME_POINTER=y
-# CONFIG_COVERAGE is not set
-# CONFIG_DEBUG_LOCK_PROFILE is not set
-CONFIG_DEBUG_LOCKS=y
-# CONFIG_PERF_COUNTERS is not set
-CONFIG_VERBOSE_DEBUG=y
-CONFIG_SCRUB_DEBUG=y
-# CONFIG_UBSAN is not set
-# CONFIG_DEBUG_TRACE is not set
-CONFIG_XMEM_POOL_POISON=y
-CONFIG_DEBUG_INFO=y
-# end of Debugging Options
diff --git a/automation/gitlab-ci/analyze.yaml b/automation/gitlab-ci/analyze.yaml
index 02e0ea692c..35ff3620cf 100644
--- a/automation/gitlab-ci/analyze.yaml
+++ b/automation/gitlab-ci/analyze.yaml
@@ -40,6 +40,36 @@ eclair-x86_64:
     LOGFILE: "eclair-x86_64.log"
     VARIANT: "X86_64"
     RULESET: "monitored"
+    EXTRA_XEN_CONFIG: |
+      CONFIG_AMD=y
+      CONFIG_INTEL=n
+      CONFIG_AMD_SVM=y
+      CONFIG_INTEL_VMX=n
+      CONFIG_NR_CPUS=16
+      CONFIG_NR_NUMA_NODES=2
+      CONFIG_PV=n
+      CONFIG_XEN_IBT=n
+      CONFIG_XEN_SHSTK=n
+      CONFIG_SHADOW_PAGING=n
+      CONFIG_HVM_FEP=n
+      CONFIG_TBOOT=n
+      CONFIG_HYPFS=n
+      CONFIG_KEXEC=n
+      CONFIG_ARGO=y
+      CONFIG_SCHED_CREDIT=n
+      CONFIG_SCHED_RTDS=n
+      CONFIG_SCHED_ARINC653=n
+      CONFIG_LIVEPATCH=n
+      CONFIG_TRACEBUFFER=n
+      CONFIG_INTEL_IOMMU=n
+      CONFIG_EXPERT=y
+      CONFIG_DEBUG=y
+      CONFIG_GDBSX=n
+      CONFIG_FRAME_POINTER=n
+      CONFIG_SELF_TESTS=n
+      CONFIG_DEBUG_LOCKS=n
+      CONFIG_SCRUB_DEBUG=n
+      CONFIG_XMEM_POOL_POISON=n
 
 eclair-ARM64:
   extends: .eclair-analysis:triggered
@@ -47,6 +77,44 @@ eclair-ARM64:
     LOGFILE: "eclair-ARM64.log"
     VARIANT: "ARM64"
     RULESET: "monitored"
+    EXTRA_XEN_CONFIG: |
+      CONFIG_NR_CPUS=16
+      CONFIG_GICV2=n
+      CONFIG_GICV3=y
+      CONFIG_VGICV2=n
+      CONFIG_HAS_ITS=y
+      CONFIG_HWDOM_VUART=n
+      CONFIG_STATIC_SHM=y
+      CONFIG_STATIC_EVTCHN=y
+      CONFIG_STATIC_MEMORY=y
+      CONFIG_SCMI_SMC=n
+      CONFIG_PARTIAL_EMULATION=n
+      CONFIG_HYPFS=n
+      CONFIG_IOREQ_SERVER=y
+      CONFIG_XSM=n
+      CONFIG_ARGO=y
+      CONFIG_SCHED_CREDIT=n
+      CONFIG_SCHED_RTDS=n
+      CONFIG_SCHED_ARINC653=n
+      CONFIG_BOOT_TIME_CPUPOOLS=y
+      CONFIG_TRACEBUFFER=n
+      CONFIG_HAS_CADENCE_UART=n
+      CONFIG_HAS_NS16550=n
+      CONFIG_HAS_IMX_LPUART=n
+      CONFIG_HAS_MVEBU=n
+      CONFIG_HAS_MESON=n
+      CONFIG_HAS_OMAP=n
+      CONFIG_HAS_SCIF=n
+      CONFIG_HAS_LINFLEX=n
+      CONFIG_ARM_SMMU=n
+      CONFIG_ARM_SMMU_V3=y
+      CONFIG_EXPERT=y
+      CONFIG_DEBUG=y
+      CONFIG_FRAME_POINTER=n
+      CONFIG_SELF_TESTS=n
+      CONFIG_DEBUG_LOCKS=n
+      CONFIG_SCRUB_DEBUG=n
+      CONFIG_XMEM_POOL_POISON=n
 
 .eclair-analysis:on-schedule:
   extends: .eclair-analysis
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:14:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:14:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900714.1308611 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGrP-0001t6-3D; Tue, 04 Mar 2025 01:14:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900714.1308611; Tue, 04 Mar 2025 01:14:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGrP-0001sy-0S; Tue, 04 Mar 2025 01:14:15 +0000
Received: by outflank-mailman (input) for mailman id 900714;
 Tue, 04 Mar 2025 01:14:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGrO-0001sp-6q
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:14:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGrO-00131R-1L
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:14:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGrO-005X3F-0U
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:14:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9JZ6HoNmdnz33knyVWub3OlBzmfjhaUyrIduldIvE44=; b=kW/dNjGzozKLq4Wx9rNJNjCOEh
	R4JWfzVL7J9/vTOF2U/O5ZeUFdLIAxwrpwFmRrvn06yr2aBI7RwIzEJgEEj4xE+AjM6mqudCwTCuP
	ihQtXqu1f+6ee2SOxnFmqccsf7kN0Qmp6IuK+34BHCGXDRkQWANvRTHzpLm7lR2ZCSjo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: skip building domU if there is no test defined for it
Message-Id: <E1tpGrO-005X3F-0U@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:14:14 +0000

commit ae521cd96f98adc99df0d897aedd384535b7f21d
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Feb 19 03:56:51 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:15:37 2025 -0800

    automation: skip building domU if there is no test defined for it
    
    This will be useful for later tests not using generic domU (unit tests,
    xtf etc).
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
 automation/scripts/qubes-x86-64.sh | 50 +++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 19 deletions(-)

diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 8a0b7bfbc0..7eb3ce1bf7 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -144,26 +144,28 @@ disk = [ ]
 ${domU_extra_config}
 "
 
-# DomU
-mkdir -p rootfs
-cd rootfs
-# fakeroot is needed to preserve device nodes in rootless podman container
-fakeroot -s ../fakeroot-save tar xzf ../binaries/initrd.tar.gz
-mkdir proc
-mkdir run
-mkdir srv
-mkdir sys
-rm var/run
-echo "#!/bin/sh
+if [ -n "$domU_check" ]; then
+    # DomU
+    mkdir -p rootfs
+    cd rootfs
+    # fakeroot is needed to preserve device nodes in rootless podman container
+    fakeroot -s ../fakeroot-save tar xzf ../binaries/initrd.tar.gz
+    mkdir proc
+    mkdir run
+    mkdir srv
+    mkdir sys
+    rm var/run
+    echo "#!/bin/sh
 
 ${domU_check}
 " > etc/local.d/xen.start
-chmod +x etc/local.d/xen.start
-echo "rc_verbose=yes" >> etc/rc.conf
-sed -i -e 's/^Welcome/domU \0/' etc/issue
-find . | fakeroot -i ../fakeroot-save cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
-cd ..
-rm -rf rootfs
+    chmod +x etc/local.d/xen.start
+    echo "rc_verbose=yes" >> etc/rc.conf
+    sed -i -e 's/^Welcome/domU \0/' etc/issue
+    find . | fakeroot -i ../fakeroot-save cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
+    cd ..
+    rm -rf rootfs
+fi
 
 # DOM0 rootfs
 mkdir -p rootfs
@@ -188,11 +190,19 @@ ifconfig eth0 up
 ifconfig xenbr0 up
 ifconfig xenbr0 192.168.0.1
 
+" > etc/local.d/xen.start
+
+if [ -n "$domU_check" ]; then
+    echo "
 # get domU console content into test log
 tail -F /var/log/xen/console/guest-domU.log 2>/dev/null | sed -e \"s/^/(domU) /\" &
 xl create /etc/xen/domU.cfg
 ${dom0_check}
-" > etc/local.d/xen.start
+" >> etc/local.d/xen.start
+else
+    echo "${dom0_check}" >> etc/local.d/xen.start
+fi
+
 chmod +x etc/local.d/xen.start
 echo "$domU_config" > etc/xen/domU.cfg
 
@@ -201,7 +211,9 @@ echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
 echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
 cp ../binaries/bzImage boot/vmlinuz
-cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
+if [ -n "$domU_check" ]; then
+    cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
+fi
 find . | fakeroot -i ../fakeroot-save cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:14:26 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:14:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900715.1308614 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGra-0001vb-4O; Tue, 04 Mar 2025 01:14:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900715.1308614; Tue, 04 Mar 2025 01:14:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGra-0001vT-1q; Tue, 04 Mar 2025 01:14:26 +0000
Received: by outflank-mailman (input) for mailman id 900715;
 Tue, 04 Mar 2025 01:14:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGrY-0001vF-9u
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:14:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGrY-00131V-1e
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:14:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGrY-005X47-0l
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:14:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yPlBtUJ9NGCOxf8OK7onm4TmnzFgYzAZW1Fp8SsW018=; b=XkuN1c21roDiiKEEMidyEeLtaE
	wq5v7PIOJpQDHpfWYaBODwFNfucf4k8AW3ExwXnQfuqRY6t39ocffyiFL6+1hPs2W+cafoViBCgOq
	AM0Ss3yIasjpuL7YHGGeNweiDEKeTTaQ9lTAsXCOPpG+xYpt7pp114YEt7nnbI7wTC1o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: add jobs running tests from tools/tests/*
Message-Id: <E1tpGrY-005X47-0l@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:14:24 +0000

commit fc10d6ecdd64c42dc4e3318ac31cd544a8d84959
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Feb 19 03:56:52 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:15:38 2025 -0800

    automation: add jobs running tests from tools/tests/*
    
    There are a bunch of tests in tools/tests/, let them run in CI.
    For each subdirectory expect "make run" will run the test, and observe
    its exit code. This way, adding new tests is easy, and they will be
    automatically picked up.
    
    For better visibility, log test output to junit xml format, and let
    gitlab ingest it. Set SUT_ADDR variable with name/address of the system
    under test, so a network can be used to extract the file. The actual
    address is set using DHCP. And for the test internal network, still add
    the 192.168.0.1 IP (but don't replace the DHCP-provided one).
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
 automation/gitlab-ci/test.yaml     | 23 +++++++++++++++++++
 automation/scripts/build           |  1 +
 automation/scripts/qubes-x86-64.sh | 28 +++++++++++++++++++++++
 automation/scripts/run-tools-tests | 47 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 99 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 6ad45269ea..e3ac689730 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -130,6 +130,7 @@
     PCIDEV: "03:00.0"
     PCIDEV_INTR: "MSI-X"
     CONSOLE_OPTS: "console=com1 com1=115200,8n1"
+    SUT_ADDR: test-2.testnet
   artifacts:
     paths:
       - smoke.serial
@@ -263,6 +264,28 @@ adl-pvshim-x86-64-gcc-debug:
     - *x86-64-test-needs
     - alpine-3.18-gcc-debug
 
+adl-tools-tests-pv-x86-64-gcc-debug:
+  extends: .adl-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh tools-tests-pv 2>&1 | tee ${LOGFILE}
+  artifacts:
+    reports:
+      junit: tests-junit.xml
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
+adl-tools-tests-pvh-x86-64-gcc-debug:
+  extends: .adl-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh tools-tests-pvh 2>&1 | tee ${LOGFILE}
+  artifacts:
+    reports:
+      junit: tests-junit.xml
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
 zen3p-smoke-x86-64-gcc-debug:
   extends: .zen3p-x86-64
   script:
diff --git a/automation/scripts/build b/automation/scripts/build
index 952599cc25..522efe774e 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -109,5 +109,6 @@ else
     # even though dist/ contains everything, while some containers don't even
     # build Xen
     cp -r dist binaries/
+    cp -r tools/tests binaries/
     collect_xen_artefacts
 fi
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 7eb3ce1bf7..7c80e0c233 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -10,6 +10,8 @@ set -ex
 #  - pci-pv         PV dom0,  PV domU + PCI Passthrough
 #  - pvshim         PV dom0,  PVSHIM domU
 #  - s3             PV dom0,  S3 suspend/resume
+#  - tools-tests-pv PV dom0, run tests from tools/tests/*
+#  - tools-tests-pvh PVH dom0, run tests from tools/tests/*
 test_variant=$1
 
 ### defaults
@@ -19,6 +21,7 @@ timeout=120
 domU_type="pvh"
 domU_vif="'bridge=xenbr0',"
 domU_extra_config=
+retrieve_xml=
 
 case "${test_variant}" in
     ### test: smoke test & smoke test PVH & smoke test HVM & smoke test PVSHIM
@@ -126,6 +129,21 @@ done
 "
         ;;
 
+    ### tests: tools-tests-pv, tools-tests-pvh
+    "tools-tests-pv"|"tools-tests-pvh")
+        retrieve_xml=1
+        passed="test passed"
+        domU_check=""
+        dom0_check="
+/tests/run-tools-tests /tests /tmp/tests-junit.xml && echo \"${passed}\"
+nc -l -p 8080 < /tmp/tests-junit.xml >/dev/null &
+"
+        if [ "${test_variant}" = "tools-tests-pvh" ]; then
+            extra_xen_opts="dom0=pvh"
+        fi
+
+        ;;
+
     *)
         echo "Unrecognised test_variant '${test_variant}'" >&2
         exit 1
@@ -178,6 +196,8 @@ mkdir srv
 mkdir sys
 rm var/run
 cp -ar ../binaries/dist/install/* .
+cp -ar ../binaries/tests .
+cp -a ../automation/scripts/run-tools-tests tests/
 
 echo "#!/bin/bash
 
@@ -192,6 +212,10 @@ ifconfig xenbr0 192.168.0.1
 
 " > etc/local.d/xen.start
 
+if [ -n "$retrieve_xml" ]; then
+    echo "timeout 30s udhcpc -i xenbr0" >> etc/local.d/xen.start
+fi
+
 if [ -n "$domU_check" ]; then
     echo "
 # get domU console content into test log
@@ -272,6 +296,10 @@ if [ $timeout -le 0 ]; then
     exit 1
 fi
 
+if [ -n "$retrieve_xml" ]; then
+    nc -w 10 "$SUT_ADDR" 8080 > tests-junit.xml </dev/null
+fi
+
 sleep 1
 
 (grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
diff --git a/automation/scripts/run-tools-tests b/automation/scripts/run-tools-tests
new file mode 100755
index 0000000000..770e97c3e9
--- /dev/null
+++ b/automation/scripts/run-tools-tests
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+usage() {
+    echo "Usage: $0 tests-dir xml-out"
+}
+
+xml_out=$2
+if [ -z "$xml_out" ]; then
+  xml_out=/dev/null
+fi
+printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$xml_out"
+printf '<testsuites name="tools.tests">\n' >> "$xml_out"
+printf ' <testsuite name="tools.tests">\n' >> "$xml_out"
+failed=
+for dir in "$1"/*; do
+    [ -d "$dir" ] || continue
+    echo "Running test in $dir"
+    printf '  <testcase name="%s">\n' "$dir" >> "$xml_out"
+    ret=
+    for f in "$dir"/*; do
+        [ -f "$f" ] || continue
+        [ -x "$f" ] || continue
+        "$f" 2>&1 | tee /tmp/out
+        ret=$?
+        if [ "$ret" -ne 0 ]; then
+            echo "FAILED: $ret"
+            failed+=" $dir"
+            printf '   <failure type="failure" message="binary %s exited with code %d">\n' "$f" "$ret" >> "$xml_out"
+            # TODO: could use xml escaping... but current tests seems to
+            # produce sane output
+            cat /tmp/out >> "$xml_out"
+            printf '   </failure>\n' >> "$xml_out"
+        else
+            echo "PASSED"
+        fi
+    done
+    if [ -z "$ret" ]; then
+        printf '   <skipped type="skipped" message="no executable test found in %s"/>\n' "$dir" >> "$xml_out"
+    fi
+    printf '  </testcase>\n' >> "$xml_out"
+done
+printf ' </testsuite>\n' >> "$xml_out"
+printf '</testsuites>\n' >> "$xml_out"
+
+if [ -n "$failed" ]; then
+    exit 1
+fi
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:14:36 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:14:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900716.1308619 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGrk-0001y8-63; Tue, 04 Mar 2025 01:14:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900716.1308619; Tue, 04 Mar 2025 01:14:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGrk-0001y0-3I; Tue, 04 Mar 2025 01:14:36 +0000
Received: by outflank-mailman (input) for mailman id 900716;
 Tue, 04 Mar 2025 01:14:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGri-0001xr-CX
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:14:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGri-00131b-1u
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:14:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGri-005X4x-14
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:14:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7YwyMB4LU2YEqew+0kkhDTAIZI3tTgv/4CZ3bKoKplU=; b=Nytcnu0poInIfmLxcGu2xH1og3
	KvUz0VAlfQ8WxPZC4ROeuFSgM+OUMftW+w4aYiaZ4XHAypeY7NOkUazG1Lu+1l0U6UwolA3Wp0vB1
	oCgLfH9LpSCFuSGdnoiHG//5j1oSoxhx/EhiyaQVkAwYcvLBMsA3UYBPC/mz/siwxBcc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: allow selecting individual jobs via CI variables
Message-Id: <E1tpGri-005X4x-14@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:14:34 +0000

commit 9d419afa4667ba0369471c4a0e11e0717289c7bf
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Feb 19 03:56:53 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:15:38 2025 -0800

    automation: allow selecting individual jobs via CI variables
    
    Debugging sometimes involves running specific jobs on different
    versions. It's useful to easily avoid running all of the not interesting
    ones (for given case) to save both time and CI resources. Doing so used
    to require changing the yaml files, usually in several places.
    Ease this step by adding SELECTED_JOBS_ONLY variable that takes a regex.
    Note that one needs to satisfy job dependencies on their own (for
    example if a test job needs a build job, that specific build job
    needs to be included too).
    
    The variable can be specified via Gitlab web UI when scheduling a
    pipeline, but it can be also set when doing git push directly:
    
        git push -o ci.variable=SELECTED_JOBS_ONLY="/job1|job2/"
    
    More details at https://docs.gitlab.co.jp/ee/user/project/push_options.html
    
    The variable needs to include regex for selecting jobs, including
    enclosing slashes.
    A coma/space separated list of jobs to select would be friendlier UX,
    but unfortunately that is not supported:
    https://gitlab.com/gitlab-org/gitlab/-/issues/209904 (note the proposed
    workaround doesn't work for job-level CI_JOB_NAME).
    On the other hand, the regex is more flexible (one can select for
    example all arm32 jobs).
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .gitlab-ci.yml                  |  2 ++
 automation/gitlab-ci/build.yaml |  6 ++++++
 automation/gitlab-ci/test.yaml  | 14 ++++++++++++++
 3 files changed, 22 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5a9b8b7228..b3beb2ff9d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,7 @@
 variables:
   XEN_REGISTRY: registry.gitlab.com/xen-project/xen
+  SELECTED_JOBS_ONLY:
+    description: "Regex to select only some jobs, must be enclosed with /. For example /job1|job2/"
 
 workflow:
   rules:
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 5995063d77..4fd800e996 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -12,6 +12,12 @@
       - '*/*.log'
     when: always
   needs: []
+  rules:
+  - if: $SELECTED_JOBS_ONLY && $CI_JOB_NAME =~ $SELECTED_JOBS_ONLY
+    when: always
+  - if: $SELECTED_JOBS_ONLY
+    when: never
+  - when: on_success
 
 .gcc-tmpl:
   variables: &gcc
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index e3ac689730..882b545a7f 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -1,6 +1,11 @@
 .test-jobs-common:
   stage: test
   image: ${XEN_REGISTRY}/${CONTAINER}
+  rules:
+  - if: $SELECTED_JOBS_ONLY && $CI_JOB_NAME =~ $SELECTED_JOBS_ONLY
+  - if: $SELECTED_JOBS_ONLY
+    when: never
+  - when: on_success
 
 .arm64-test-needs: &arm64-test-needs
   - alpine-3.18-arm64-rootfs-export
@@ -99,6 +104,9 @@
       - '*.dtb'
     when: always
   rules:
+    - if: $SELECTED_JOBS_ONLY && $CI_JOB_NAME =~ $SELECTED_JOBS_ONLY
+    - if: $SELECTED_JOBS_ONLY
+      when: never
     - if: $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
   tags:
     - xilinx
@@ -117,6 +125,9 @@
       - '*.log'
     when: always
   rules:
+    - if: $SELECTED_JOBS_ONLY && $CI_JOB_NAME =~ $SELECTED_JOBS_ONLY
+    - if: $SELECTED_JOBS_ONLY
+      when: never
     - if: $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
   tags:
     - xilinx
@@ -137,6 +148,9 @@
       - '*.log'
     when: always
   rules:
+    - if: $SELECTED_JOBS_ONLY && $CI_JOB_NAME =~ $SELECTED_JOBS_ONLY
+    - if: $SELECTED_JOBS_ONLY
+      when: never
     - if: $QUBES_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
   tags:
     - qubes-hw2
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:14:46 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:14:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900717.1308623 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGru-00020V-7P; Tue, 04 Mar 2025 01:14:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900717.1308623; Tue, 04 Mar 2025 01:14:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGru-00020N-4h; Tue, 04 Mar 2025 01:14:46 +0000
Received: by outflank-mailman (input) for mailman id 900717;
 Tue, 04 Mar 2025 01:14:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGrs-00020C-Es
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:14:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGrs-00131g-29
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:14:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGrs-005X5c-1J
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:14:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jABXEaxVG2YlWSf6zjG0+H0gLxF6L2Dcks1Y+2qPjNg=; b=RYn0+zvPlMyuLllpORsaVft5HU
	rLpbXyUGu9LdhaKXpVhjgnlnnQn9S0nVaxMzHVY2Xfwpc8q750mtrM8iI4ucq6JHR3v1jH91/vvdI
	q40/6ws32aV3T1vpeH1IeZQa/1Q3uKjxbqYZfzTWEPMJeA6yqd/XSrz6xLd+TWJRZxM8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: add tools/tests jobs on the AMD Zen3+ runner too
Message-Id: <E1tpGrs-005X5c-1J@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:14:44 +0000

commit b551aed4ab131e61a13922d07bd7d9e29d694f31
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Feb 19 03:56:54 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:15:39 2025 -0800

    automation: add tools/tests jobs on the AMD Zen3+ runner too
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
 automation/gitlab-ci/test.yaml | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 882b545a7f..9530e36e9a 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -162,6 +162,7 @@
     PCIDEV: "01:00.0"
     PCIDEV_INTR: "MSI-X"
     CONSOLE_OPTS: "console=com1 com1=115200,8n1,pci,msi"
+    SUT_ADDR: test-11.testnet
   tags:
     - qubes-hw11
 
@@ -340,6 +341,28 @@ zen3p-pvshim-x86-64-gcc-debug:
     - *x86-64-test-needs
     - alpine-3.18-gcc-debug
 
+zen3p-tools-tests-pv-x86-64-gcc-debug:
+  extends: .zen3p-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh tools-tests-pv 2>&1 | tee ${LOGFILE}
+  artifacts:
+    reports:
+      junit: tests-junit.xml
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
+zen3p-tools-tests-pvh-x86-64-gcc-debug:
+  extends: .zen3p-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh tools-tests-pvh 2>&1 | tee ${LOGFILE}
+  artifacts:
+    reports:
+      junit: tests-junit.xml
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
 qemu-smoke-dom0-arm64-gcc:
   extends: .qemu-arm64
   script:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 01:14:56 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 01:14:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900718.1308627 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGs4-000239-8f; Tue, 04 Mar 2025 01:14:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900718.1308627; Tue, 04 Mar 2025 01:14:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpGs4-000231-65; Tue, 04 Mar 2025 01:14:56 +0000
Received: by outflank-mailman (input) for mailman id 900718;
 Tue, 04 Mar 2025 01:14:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpGs2-00022o-Hf
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 01:14:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGs2-00131k-2R
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:14:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpGs2-005X66-1Y
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 01:14:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PXgoxl9UxByKr0pumFH1TzygklvvlQKZkjfy6yPpU/Y=; b=FVXsT8Qsg/1KVRFpwxmQspKA8U
	CKKNT1qDRrac35ds6ye9j39SL3JTUzZu9p2bASYy2Htu61mDmrqtEZ7RFPLfsDtSb0986STqPipyz
	em96gdPpJYzwIlx36AYbvWkJ57ESfFP8LyUto57q0+PHg+HFDCCq06PbTARrbkAuY3E0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: add basic CI documentation
Message-Id: <E1tpGs2-005X66-1Y@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 01:14:54 +0000

commit 274effbec245732e910d41f61a43dc07bc3e77ce
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Feb 19 03:56:55 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:15:40 2025 -0800

    docs: add basic CI documentation
    
    Include info how to get access/enable hardware runners and how to select
    individual jobs.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/index.rst   |  1 +
 docs/misc/ci.rst | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/docs/index.rst b/docs/index.rst
index 1bb8d02ea3..bd87d736b9 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -51,6 +51,7 @@ kind of development environment.
    :maxdepth: 2
 
    hypervisor-guide/index
+   misc/ci
 
 
 Unsorted documents
diff --git a/docs/misc/ci.rst b/docs/misc/ci.rst
new file mode 100644
index 0000000000..7aee55c5d2
--- /dev/null
+++ b/docs/misc/ci.rst
@@ -0,0 +1,35 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Continuous Integration
+======================
+
+Xen Project uses Gitlab-CI for automated testing. Test pipelines for official
+staging branches are at
+`<https://gitlab.com/xen-project/hardware/xen/-/pipelines>`_. Developers can
+schedule test pipelines in their repositories under
+`<https://gitlab.com/xen-project/people/>`_.
+
+Hardware runners
+****************
+
+Some of the tests are using dedicated hardware runners. Those are not available freely, but the access is granted to individual developers. To get access to them, ask on the ``#XenDevel:matrix.org`` Matrix channel.
+After getting access to relevant runners, few extra changes are necessary in settings of the relevant "xen" gitlab project (under your `<https://gitlab.com/xen-project/people/>`_ namespace):
+
+1. Go to Settings -> CI/CD, expand the "Runners" section and enable relevant runners for your project.
+2. Expand "Variables" section and add ``QUBES_JOBS=true`` variable for Qubes runners.
+3. Go to Settings -> Repository, expand "Branch rules" section and add a rule for protected branches - only those branches will get tests on the hardware runners. It's okay to use a pattern for branch name, and it's okay to allow force push.
+
+Selecting individual tests
+**************************
+
+Normally, all build and test jobs are scheduled in a pipeline. When working on a specific patches, it is sometimes useful to run only jobs relevant for the current work - both to save time and to save CI resources. This can be done by seeting ``SELECTED_JOBS_ONLY`` variable when starting the pipeline. The variable holds a regular expression, enclosed with ``/`` that matches jobs to be included. The variable can be set via the gitlab.com web UI or directly when pushing changes to gitlab::
+
+   git push -o ci.variable=SELECTED_JOBS_ONLY="/job1|job2/"
+
+Note if a test job requires some build job, both need to be included in the regex. For example, ``adl-smoke-x86-64-gcc-debug`` requires ``alpine-3.18-gcc-debug``, so to run just this test the command will look like this::
+
+   git push -o ci.variable=SELECTED_JOBS_ONLY="/adl-smoke-x86-64-gcc-debug|alpine-3.18-gcc-debug/"
+
+More details at `<https://docs.gitlab.co.jp/ee/user/project/push_options.html>`_.
+
+Alternatively, irrelevant jobs can be removed from respective yaml files in ``automation/gitlab-ci`` by adding temporary commit on top of the branch.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:00:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900742.1308652 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHZj-0001uc-Qf; Tue, 04 Mar 2025 02:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900742.1308652; Tue, 04 Mar 2025 02:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHZj-0001uD-NF; Tue, 04 Mar 2025 02:00:03 +0000
Received: by outflank-mailman (input) for mailman id 900742;
 Tue, 04 Mar 2025 02:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHZi-0001SR-Og
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHZi-0014Hn-2g
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHZi-005ZCI-1k
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dXaBvwe5DEKWtbLlVQpGLZqnaOjESX+DaXYsoB8gdDI=; b=quF2nmzWLKX9xs8hn31epStDDP
	wJkpGuEc2DXGCk1wMuhPwbSsnPv0yPK/s62sm8cUFoGgauaGTphHAe+4zcnUjEAjscvFj3FzqHrbQ
	frPRHgOou5grqQtIg+/z0dM2S/64u4PN3lzPbS91D7Q+ECbcCha2Pc+cPH0idF3FqsAM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: upgrade Linux kernel for arm64 tests to 6.6.74
Message-Id: <E1tpHZi-005ZCI-1k@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:00:02 +0000

commit 87f87a5586b8c4bcee08ae6b82a985e242ab21dd
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Jan 31 15:32:53 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:03:46 2025 -0800

    automation: upgrade Linux kernel for arm64 tests to 6.6.74
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/gitlab-ci/build.yaml                    |  4 +--
 automation/gitlab-ci/test.yaml                     |  2 +-
 .../tests-artifacts/kernel/5.19-arm64v8.dockerfile | 37 ---------------------
 .../kernel/6.6.74-arm64v8.dockerfile               | 38 ++++++++++++++++++++++
 4 files changed, 41 insertions(+), 40 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 6a2e491534..5995063d77 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -269,9 +269,9 @@ alpine-3.18-arm64-rootfs-export:
   tags:
     - arm64
 
-kernel-5.19-arm64-export:
+kernel-6.6.74-arm64-export:
   extends: .test-jobs-artifact-common
-  image: registry.gitlab.com/xen-project/xen/tests-artifacts/kernel:5.19-arm64v8
+  image: registry.gitlab.com/xen-project/xen/tests-artifacts/kernel:6.6.74-arm64v8
   script:
     - mkdir binaries && cp /Image binaries/Image
   artifacts:
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 1822e3ea5f..6ad45269ea 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -4,7 +4,7 @@
 
 .arm64-test-needs: &arm64-test-needs
   - alpine-3.18-arm64-rootfs-export
-  - kernel-5.19-arm64-export
+  - kernel-6.6.74-arm64-export
   - qemu-system-aarch64-6.0.0-arm64-export
 
 .arm32-test-needs: &arm32-test-needs
diff --git a/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile b/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
deleted file mode 100644
index 8e33995ba3..0000000000
--- a/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
+++ /dev/null
@@ -1,37 +0,0 @@
-# syntax=docker/dockerfile:1
-FROM --platform=linux/arm64/v8 debian:bookworm
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV LINUX_VERSION=5.19
-ENV USER root
-
-RUN mkdir /build
-WORKDIR /build
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        bc \
-        curl \
-        flex \
-        bison \
-        && \
-    \
-    # Build the kernel
-    curl -fsSLO https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-"$LINUX_VERSION".tar.xz && \
-    tar xvJf linux-"$LINUX_VERSION".tar.xz && \
-    cd linux-"$LINUX_VERSION" && \
-    make defconfig && \
-    sed -i 's/CONFIG_IPV6=m/CONFIG_IPV6=y/g' .config && \
-    sed -i 's/CONFIG_BRIDGE=m/CONFIG_BRIDGE=y/g' .config && \
-    sed -i 's/# CONFIG_XEN_NETDEV_BACKEND is not set/CONFIG_XEN_NETDEV_BACKEND=y/g' .config && \
-    make -j$(nproc) Image.gz && \
-    cp arch/arm64/boot/Image / && \
-    cd /build && \
-    rm -rf linux-"$LINUX_VERSION"* && \
-    apt-get autoremove -y && \
-    apt-get clean && \
-    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/tests-artifacts/kernel/6.6.74-arm64v8.dockerfile b/automation/tests-artifacts/kernel/6.6.74-arm64v8.dockerfile
new file mode 100644
index 0000000000..73e5145425
--- /dev/null
+++ b/automation/tests-artifacts/kernel/6.6.74-arm64v8.dockerfile
@@ -0,0 +1,38 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/arm64/v8 debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV LINUX_VERSION=6.6.74
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        bc \
+        curl \
+        flex \
+        bison \
+        libssl-dev \
+        && \
+    \
+    # Build the kernel
+    curl -fsSLO https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-"$LINUX_VERSION".tar.xz && \
+    tar xvJf linux-"$LINUX_VERSION".tar.xz && \
+    cd linux-"$LINUX_VERSION" && \
+    make defconfig && \
+    sed -i 's/CONFIG_IPV6=m/CONFIG_IPV6=y/g' .config && \
+    sed -i 's/CONFIG_BRIDGE=m/CONFIG_BRIDGE=y/g' .config && \
+    sed -i 's/# CONFIG_XEN_NETDEV_BACKEND is not set/CONFIG_XEN_NETDEV_BACKEND=y/g' .config && \
+    make -j$(nproc) Image.gz && \
+    cp arch/arm64/boot/Image / && \
+    cd /build && \
+    rm -rf linux-"$LINUX_VERSION"* && \
+    apt-get autoremove -y && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:00:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900743.1308655 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHZt-0002HZ-TL; Tue, 04 Mar 2025 02:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900743.1308655; Tue, 04 Mar 2025 02:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHZt-0002HR-Q0; Tue, 04 Mar 2025 02:00:13 +0000
Received: by outflank-mailman (input) for mailman id 900743;
 Tue, 04 Mar 2025 02:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHZs-0002HG-OA
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHZs-0014Ts-31
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHZs-005ZDy-26
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ek1juhZnEncVXWezSHaJ7oiCm/EtNWf9zkPTZSOsnTk=; b=EPumM6sgYDP0YXyH/IEjligGuf
	9YznyesfnWWuJT5NUThL+EzVjK8ubLG9UOPMEjLUmt9unczxpz27yJd/kiw6B7zOrjbLbCgzgrgq7
	8Ww6Pc0W2vEaZYTnqDYYOZQ+VM31N5n3M/+jM5JkqsbchgAZF8cZV5m0y8/RaBUFclxA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: upgrade arm32 kernel from bullseye to bookworm
Message-Id: <E1tpHZs-005ZDy-26@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:00:12 +0000

commit 80ee4df5df1d89cf4ccaaca0562faee1cfa8c448
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Thu Feb 20 14:56:20 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    automation: upgrade arm32 kernel from bullseye to bookworm
    
    automation: upgrade arm32 kernel from bullseye to bookworm
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index 41f6e5d8e6..0c94e662aa 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -11,7 +11,7 @@ serial_log="$(pwd)/smoke.serial"
 
 cd binaries
 # Use the kernel from Debian
-curl --fail --silent --show-error --location --output vmlinuz https://deb.debian.org/debian/dists/bullseye/main/installer-armhf/current/images/netboot/vmlinuz
+curl --fail --silent --show-error --location --output vmlinuz https://deb.debian.org/debian/dists/bookworm/main/installer-armhf/current/images/netboot/vmlinuz
 # Use a tiny initrd based on busybox from Alpine Linux
 curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/armhf/alpine-minirootfs-3.15.1-armhf.tar.gz
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:00:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900744.1308659 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHa3-0002KB-Ub; Tue, 04 Mar 2025 02:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900744.1308659; Tue, 04 Mar 2025 02:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHa3-0002K3-RT; Tue, 04 Mar 2025 02:00:23 +0000
Received: by outflank-mailman (input) for mailman id 900744;
 Tue, 04 Mar 2025 02:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHa2-0002Jv-Rb
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHa3-0014Tx-09
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHa2-005ZEN-2S
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wo3+N61JOFPn8xeNFwB9Rk9jCV7OATz5ybpAiCBv3mU=; b=Q8PFTViYa68uDt6+oxmxGNlN9P
	AGTsTagcMz5sjnATcKSXBrMWO4spXIjjRzqhf6hHA7X8ed97D02hru1ZmoRuikDAzo3F/i3twnxU3
	cCokXV2i/lxdlJ8iPoRJccPbQsW8OxGREavm8qrt6d/AQN4hugd8a/JLrbPQg/RdyDZ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Alloc XenStore page for Dom0less DomUs from hypervisor
Message-Id: <E1tpHa2-005ZEN-2S@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:00:22 +0000

commit df2c03e2ebfedd741110a978b63890d57daede0c
Author:     Henry Wang <xin.wang2@amd.com>
AuthorDate: Fri May 24 15:55:20 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    xen/arm: Alloc XenStore page for Dom0less DomUs from hypervisor
    
    There are use cases (for example using the PV driver) in Dom0less
    setup that require Dom0less DomUs start immediately with Dom0, but
    initialize XenStore later after Dom0's successful boot and call to
    the init-dom0less application.
    
    An error message can seen from the init-dom0less application on
    1:1 direct-mapped domains:
    ```
    Allocating magic pages
    memory.c:238:d0v0 mfn 0x39000 doesn't belong to d1
    Error on alloc magic pages
    ```
    
    The "magic page" is a terminology used in the toolstack as reserved
    pages for the VM to have access to virtual platform capabilities.
    Currently the magic pages for Dom0less DomUs are populated by the
    init-dom0less app through populate_physmap(), and populate_physmap()
    automatically assumes gfn == mfn for 1:1 direct mapped domains. This
    cannot be true for the magic pages that are allocated later from the
    init-dom0less application executed in Dom0. For domain using statically
    allocated memory but not 1:1 direct-mapped, similar error "failed to
    retrieve a reserved page" can be seen as the reserved memory list is
    empty at that time.
    
    Since for init-dom0less, the magic page region is only for XenStore.
    To solve above issue, this commit allocates the XenStore page for
    Dom0less DomUs at the domain construction time. The PFN will be
    noted and communicated to the init-dom0less application executed
    from Dom0. To keep the XenStore late init protocol, set the connection
    status to XENSTORE_RECONNECT.
    
    Since the guest magic region allocation from init-dom0less is for
    XenStore, and the XenStore page is now allocated from the hypervisor,
    instead of hardcoding the guest magic pages region, use
    xc_hvm_param_get() to get the XenStore page PFN. Rename alloc_xs_page()
    to get_xs_page() to reflect the changes.
    
    With this change, some existing code is not needed anymore, including:
    (1) The definition of the XenStore page offset.
    (2) Call to xc_domain_setmaxmem() and xc_clear_domain_page() as we
        don't need to set the max mem and clear the page anymore.
    (3) Foreign mapping of the XenStore page, setting of XenStore interface
        status and HVM_PARAM_STORE_PFN from init-dom0less, as they are set
        by the hypervisor.
    
    Take the opportunity to do some coding style improvements when possible.
    
    Reported-by: Alec Kwapis <alec.kwapis@medtronic.com>
    Signed-off-by: Henry Wang <xin.wang2@amd.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Tested-by: Michal Orzel <michal.orzel@amd.com>
---
 tools/helpers/init-dom0less.c | 58 +++++++++++--------------------------------
 xen/arch/arm/dom0less-build.c | 56 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 69 insertions(+), 45 deletions(-)

diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c
index fee93459c4..2b51965fa7 100644
--- a/tools/helpers/init-dom0less.c
+++ b/tools/helpers/init-dom0less.c
@@ -16,30 +16,18 @@
 
 #include "init-dom-json.h"
 
-#define XENSTORE_PFN_OFFSET 1
 #define STR_MAX_LENGTH 128
 
-static int alloc_xs_page(struct xc_interface_core *xch,
-                         libxl_dominfo *info,
-                         uint64_t *xenstore_pfn)
+static int get_xs_page(struct xc_interface_core *xch, libxl_dominfo *info,
+                       uint64_t *xenstore_pfn)
 {
     int rc;
-    const xen_pfn_t base = GUEST_MAGIC_BASE >> XC_PAGE_SHIFT;
-    xen_pfn_t p2m = (GUEST_MAGIC_BASE >> XC_PAGE_SHIFT) + XENSTORE_PFN_OFFSET;
 
-    rc = xc_domain_setmaxmem(xch, info->domid,
-                             info->max_memkb + (XC_PAGE_SIZE/1024));
-    if (rc < 0)
-        return rc;
-
-    rc = xc_domain_populate_physmap_exact(xch, info->domid, 1, 0, 0, &p2m);
-    if (rc < 0)
-        return rc;
-
-    *xenstore_pfn = base + XENSTORE_PFN_OFFSET;
-    rc = xc_clear_domain_page(xch, info->domid, *xenstore_pfn);
-    if (rc < 0)
-        return rc;
+    rc = xc_hvm_param_get(xch, info->domid, HVM_PARAM_STORE_PFN, xenstore_pfn);
+    if (rc < 0) {
+        printf("Failed to get HVM_PARAM_STORE_PFN\n");
+        return 1;
+    }
 
     return 0;
 }
@@ -100,6 +88,7 @@ static bool do_xs_write_vm(struct xs_handle *xsh, xs_transaction_t t,
  */
 static int create_xenstore(struct xs_handle *xsh,
                            libxl_dominfo *info, libxl_uuid uuid,
+                           uint64_t xenstore_pfn,
                            evtchn_port_t xenstore_port)
 {
     domid_t domid;
@@ -145,8 +134,7 @@ static int create_xenstore(struct xs_handle *xsh,
     rc = snprintf(target_memkb_str, STR_MAX_LENGTH, "%"PRIu64, info->current_memkb);
     if (rc < 0 || rc >= STR_MAX_LENGTH)
         return rc;
-    rc = snprintf(ring_ref_str, STR_MAX_LENGTH, "%lld",
-                  (GUEST_MAGIC_BASE >> XC_PAGE_SHIFT) + XENSTORE_PFN_OFFSET);
+    rc = snprintf(ring_ref_str, STR_MAX_LENGTH, "%"PRIu64, xenstore_pfn);
     if (rc < 0 || rc >= STR_MAX_LENGTH)
         return rc;
     rc = snprintf(xenstore_port_str, STR_MAX_LENGTH, "%u", xenstore_port);
@@ -230,7 +218,6 @@ static int init_domain(struct xs_handle *xsh,
     libxl_uuid uuid;
     uint64_t xenstore_evtchn, xenstore_pfn;
     int rc;
-    struct xenstore_domain_interface *intf;
 
     printf("Init dom0less domain: %u\n", info->domid);
 
@@ -245,20 +232,11 @@ static int init_domain(struct xs_handle *xsh,
     if (!xenstore_evtchn)
         return 0;
 
-    /* Alloc xenstore page */
-    if (alloc_xs_page(xch, info, &xenstore_pfn) != 0) {
-        printf("Error on alloc magic pages\n");
-        return 1;
-    }
-
-    intf = xenforeignmemory_map(xfh, info->domid, PROT_READ | PROT_WRITE, 1,
-                                &xenstore_pfn, NULL);
-    if (!intf) {
-        printf("Error mapping xenstore page\n");
+    /* Get xenstore page */
+    if (get_xs_page(xch, info, &xenstore_pfn) != 0) {
+        printf("Error on getting xenstore page\n");
         return 1;
     }
-    intf->connection = XENSTORE_RECONNECT;
-    xenforeignmemory_unmap(xfh, intf, 1);
 
     rc = xc_dom_gnttab_seed(xch, info->domid, true,
                             (xen_pfn_t)-1, xenstore_pfn, 0, 0);
@@ -272,19 +250,11 @@ static int init_domain(struct xs_handle *xsh,
     if (rc)
         err(1, "gen_stub_json_config");
 
-    /* Now everything is ready: set HVM_PARAM_STORE_PFN */
-    rc = xc_hvm_param_set(xch, info->domid, HVM_PARAM_STORE_PFN,
-                          xenstore_pfn);
-    if (rc < 0)
-        return rc;
-
-    rc = create_xenstore(xsh, info, uuid, xenstore_evtchn);
+    rc = create_xenstore(xsh, info, uuid, xenstore_pfn, xenstore_evtchn);
     if (rc)
         err(1, "writing to xenstore");
 
-    rc = xs_introduce_domain(xsh, info->domid,
-            (GUEST_MAGIC_BASE >> XC_PAGE_SHIFT) + XENSTORE_PFN_OFFSET,
-            xenstore_evtchn);
+    rc = xs_introduce_domain(xsh, info->domid, xenstore_pfn, xenstore_evtchn);
     if (!rc)
         err(1, "xs_introduce_domain");
     return 0;
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 49d1f14d65..6c51f91999 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/device_tree.h>
+#include <xen/domain_page.h>
 #include <xen/err.h>
 #include <xen/event.h>
 #include <xen/grant_table.h>
@@ -11,6 +12,8 @@
 #include <xen/sizes.h>
 #include <xen/vmap.h>
 
+#include <public/io/xs_wire.h>
+
 #include <asm/arm64/sve.h>
 #include <asm/dom0less-build.h>
 #include <asm/domain_build.h>
@@ -704,6 +707,54 @@ static int __init alloc_xenstore_evtchn(struct domain *d)
     return 0;
 }
 
+#define XENSTORE_PFN_OFFSET 1
+static int __init alloc_xenstore_page(struct domain *d)
+{
+    struct page_info *xenstore_pg;
+    struct xenstore_domain_interface *interface;
+    mfn_t mfn;
+    gfn_t gfn;
+    int rc;
+
+    if ( (UINT_MAX - d->max_pages) < 1 )
+    {
+        printk(XENLOG_ERR "%pd: Over-allocation for d->max_pages by 1 page.\n",
+               d);
+        return -EINVAL;
+    }
+
+    d->max_pages += 1;
+    xenstore_pg = alloc_domheap_page(d, MEMF_bits(32));
+    if ( xenstore_pg == NULL && is_64bit_domain(d) )
+        xenstore_pg = alloc_domheap_page(d, 0);
+    if ( xenstore_pg == NULL )
+        return -ENOMEM;
+
+    mfn = page_to_mfn(xenstore_pg);
+    if ( !mfn_x(mfn) )
+        return -ENOMEM;
+
+    if ( !is_domain_direct_mapped(d) )
+        gfn = gaddr_to_gfn(GUEST_MAGIC_BASE +
+                           (XENSTORE_PFN_OFFSET << PAGE_SHIFT));
+    else
+        gfn = gaddr_to_gfn(mfn_to_maddr(mfn));
+
+    rc = guest_physmap_add_page(d, gfn, mfn, 0);
+    if ( rc )
+    {
+        free_domheap_page(xenstore_pg);
+        return rc;
+    }
+
+    d->arch.hvm.params[HVM_PARAM_STORE_PFN] = gfn_x(gfn);
+    interface = map_domain_page(mfn);
+    interface->connection = XENSTORE_RECONNECT;
+    unmap_domain_page(interface);
+
+    return 0;
+}
+
 static int __init construct_domU(struct domain *d,
                                  const struct dt_device_node *node)
 {
@@ -804,7 +855,10 @@ static int __init construct_domU(struct domain *d,
         rc = alloc_xenstore_evtchn(d);
         if ( rc < 0 )
             return rc;
-        d->arch.hvm.params[HVM_PARAM_STORE_PFN] = ~0ULL;
+
+        rc = alloc_xenstore_page(d);
+        if ( rc < 0 )
+            return rc;
     }
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:00:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:00:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900746.1308663 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHaD-0002SR-Vg; Tue, 04 Mar 2025 02:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900746.1308663; Tue, 04 Mar 2025 02:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHaD-0002SJ-Sw; Tue, 04 Mar 2025 02:00:33 +0000
Received: by outflank-mailman (input) for mailman id 900746;
 Tue, 04 Mar 2025 02:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHaC-0002S8-Tv
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHaD-0014U2-0P
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHaC-005ZEx-2n
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OhWCFbHKQYgzxEtJNQR0rU2BGrKhHV633nmXEmQgsOs=; b=OujKSfq3mpss9G0L4m3Y1pLlOk
	jmLEOi9KfxtmfuSx2pdw9G0YPLw/TTev8QjNmb0wloYrGKwNCY2A3MWKzo66F01US+yLunmMrNAAz
	w8XenHvJpllsfJhlvKN5faVNaJyrSxVGcRBGBFYBpKga6XGwKXUL6rPldujqj+wGlJMI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/features/dom0less: Update the late XenStore init protocol
Message-Id: <E1tpHaC-005ZEx-2n@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:00:32 +0000

commit 9cc1892bed7adb796b87f023e4bd99b9f0de1707
Author:     Henry Wang <xin.wang2@amd.com>
AuthorDate: Fri May 24 15:55:22 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    docs/features/dom0less: Update the late XenStore init protocol
    
    With the new allocation strategy of Dom0less DomUs XenStore page,
    update the doc of the late XenStore init protocol accordingly.
    
    Signed-off-by: Henry Wang <xin.wang2@amd.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 docs/features/dom0less.pandoc | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/docs/features/dom0less.pandoc b/docs/features/dom0less.pandoc
index 725afa0558..8b178edee0 100644
--- a/docs/features/dom0less.pandoc
+++ b/docs/features/dom0less.pandoc
@@ -110,9 +110,10 @@ hotplug PV drivers to dom0less guests. E.g. xl network-attach domU.
 The implementation works as follows:
 - Xen allocates the xenstore event channel for each dom0less domU that
   has the "xen,enhanced" property, and sets HVM_PARAM_STORE_EVTCHN
-- Xen does *not* allocate the xenstore page and sets HVM_PARAM_STORE_PFN
-  to ~0ULL (invalid)
-- Dom0less domU kernels check that HVM_PARAM_STORE_PFN is set to invalid
+- Xen allocates the xenstore page and sets HVM_PARAM_STORE_PFN as well
+  as the connection status to XENSTORE_RECONNECT.
+- Dom0less domU kernels check that HVM_PARAM_STORE_PFN is set to
+  ~0ULL (invalid) or the connection status is *not* XENSTORE_CONNECTED.
     - Old kernels will continue without xenstore support (Note: some old
       buggy kernels might crash because they don't check the validity of
       HVM_PARAM_STORE_PFN before using it! Disable "xen,enhanced" in
@@ -121,13 +122,14 @@ The implementation works as follows:
       channel (HVM_PARAM_STORE_EVTCHN) before continuing with the
       initialization
 - Once dom0 is booted, init-dom0less is executed:
-    - it allocates the xenstore shared page and sets HVM_PARAM_STORE_PFN
+    - it gets the xenstore shared page from HVM_PARAM_STORE_PFN
     - it calls xs_introduce_domain
 - Xenstored notices the new domain, initializes interfaces as usual, and
   sends an event channel notification to the domain using the xenstore
   event channel (HVM_PARAM_STORE_EVTCHN)
 - The Linux domU kernel receives the event channel notification, checks
-  HVM_PARAM_STORE_PFN again and continue with the initialization
+  HVM_PARAM_STORE_PFN and the connection status again and continue with
+  the initialization
 
 
 Limitations
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:00:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900747.1308666 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHaO-0002Ux-0j; Tue, 04 Mar 2025 02:00:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900747.1308666; Tue, 04 Mar 2025 02:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHaN-0002Up-UQ; Tue, 04 Mar 2025 02:00:43 +0000
Received: by outflank-mailman (input) for mailman id 900747;
 Tue, 04 Mar 2025 02:00:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHaN-0002Uh-0h
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:00:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHaN-0014U8-0j
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHaM-005ZFN-33
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8hsXU5kLA/zK9OE+XIyWJR+Y4D2gsYBGnlJs1ogyRPo=; b=iiMVh3PJX8jqzSnj/HSqrspMLT
	qIY1Bo8LpBdJLR16K6gyLTlmHflvRsO4Dua8poZpKoqxArmKDRqjmeV2X6hdzJ6o3FkaaMml2mEDO
	8JmfZMbebBHCvPK9mf9ARbrlQCN8WJDQerq76mdUQE7bX+Fb+DAKW3IRTKKnHc5QvlME=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add ping test to static-mem test
Message-Id: <E1tpHaM-005ZFN-33@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:00:42 +0000

commit 9e051d3d4082394aaba799276d16e9f971c8b1db
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Jan 31 15:30:55 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    automation: add ping test to static-mem test
    
    With the recent fixes, Dom0less direct mapped domains can use PV
    drivers. Extend the existing static-mem test with a PV network ping
    tests.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 83e1866ca6..f72d209361 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -25,6 +25,9 @@ if [[ "${test_variant}" == "static-mem" ]]; then
     domU_check="
 mem_range=$(printf \"%08x-%08x\" ${domu_base} $(( ${domu_base} + ${domu_size} - 1 )))
 if grep -q -x \"\${mem_range} : System RAM\" /proc/iomem; then
+    until ifconfig eth0 192.168.0.2 &> /dev/null && ping -c 10 192.168.0.1; do
+        sleep 30
+    done
     echo \"${passed}\"
 fi
 "
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:00:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900749.1308671 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHaY-0002v4-26; Tue, 04 Mar 2025 02:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900749.1308671; Tue, 04 Mar 2025 02:00:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHaX-0002uw-Vr; Tue, 04 Mar 2025 02:00:53 +0000
Received: by outflank-mailman (input) for mailman id 900749;
 Tue, 04 Mar 2025 02:00:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHaX-0002uk-4o
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:00:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHaX-0014UC-15
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:00:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHaX-005ZHu-09
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:00:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=crruQmEYK5e4e46DoLM+Rzozq8+JR/eXBqugIKHSKmA=; b=VJA/oONWsCR1UyNJNIENvpiM74
	nxzxV1K2r88tjdtiIF5JwB3cXcMxIYPe9QGvqqJcBUfIyH4uU0cizk0TDBSV42M1iyrJxHS1/p7Jj
	kZQfwATxb+CGgwrNK+OmoQNOA/rvMHsi9eqWxSYVHeZDNxHU7rVNgSpy3lY0rxFRsYDs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] init-dom0less: allocate xenstore page if not already allocated
Message-Id: <E1tpHaX-005ZHu-09@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:00:53 +0000

commit 56b8e80812f5ba98f6085d2c08c620d9a2a3479e
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Jan 31 16:29:46 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    init-dom0less: allocate xenstore page if not already allocated
    
    We check if the xenstore page is already allocated. If yes, there is
    nothing to do. If no, we proceed allocating it to support old unpatched
    Linux kernels.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 tools/helpers/init-dom0less.c | 54 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)

diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c
index 2b51965fa7..17579fe2e8 100644
--- a/tools/helpers/init-dom0less.c
+++ b/tools/helpers/init-dom0less.c
@@ -16,8 +16,34 @@
 
 #include "init-dom-json.h"
 
+#define XENSTORE_PFN_OFFSET 1
 #define STR_MAX_LENGTH 128
 
+static int alloc_xs_page(struct xc_interface_core *xch,
+                         libxl_dominfo *info,
+                         uint64_t *xenstore_pfn)
+{
+    int rc;
+    const xen_pfn_t base = GUEST_MAGIC_BASE >> XC_PAGE_SHIFT;
+    xen_pfn_t p2m = base + XENSTORE_PFN_OFFSET;
+
+    rc = xc_domain_setmaxmem(xch, info->domid,
+                             info->max_memkb + (XC_PAGE_SIZE/1024));
+    if (rc < 0)
+        return rc;
+
+    rc = xc_domain_populate_physmap_exact(xch, info->domid, 1, 0, 0, &p2m);
+    if (rc < 0)
+        return rc;
+
+    *xenstore_pfn = base + XENSTORE_PFN_OFFSET;
+    rc = xc_clear_domain_page(xch, info->domid, *xenstore_pfn);
+    if (rc < 0)
+        return rc;
+
+    return 0;
+}
+
 static int get_xs_page(struct xc_interface_core *xch, libxl_dominfo *info,
                        uint64_t *xenstore_pfn)
 {
@@ -233,9 +259,33 @@ static int init_domain(struct xs_handle *xsh,
         return 0;
 
     /* Get xenstore page */
-    if (get_xs_page(xch, info, &xenstore_pfn) != 0) {
-        printf("Error on getting xenstore page\n");
+    if (get_xs_page(xch, info, &xenstore_pfn) != 0)
         return 1;
+
+    if (xenstore_pfn == ~0ULL) {
+        struct xenstore_domain_interface *intf;
+
+        rc = alloc_xs_page(xch, info, &xenstore_pfn);
+        if (rc != 0) {
+            printf("Error on getting xenstore page\n");
+            return 1;
+        }
+
+        intf = xenforeignmemory_map(xfh, info->domid, PROT_READ | PROT_WRITE, 1,
+                                    &xenstore_pfn, NULL);
+        if (!intf) {
+            printf("Error mapping xenstore page\n");
+            return 1;
+        }
+
+        intf->connection = XENSTORE_RECONNECT;
+        xenforeignmemory_unmap(xfh, intf, 1);
+
+        /* Now everything is ready: set HVM_PARAM_STORE_PFN */
+        rc = xc_hvm_param_set(xch, info->domid, HVM_PARAM_STORE_PFN,
+                xenstore_pfn);
+        if (rc < 0)
+            return rc;
     }
 
     rc = xc_dom_gnttab_seed(xch, info->domid, true,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:01:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:01:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900750.1308675 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHai-0002xt-3l; Tue, 04 Mar 2025 02:01:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900750.1308675; Tue, 04 Mar 2025 02:01:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHai-0002xl-0z; Tue, 04 Mar 2025 02:01:04 +0000
Received: by outflank-mailman (input) for mailman id 900750;
 Tue, 04 Mar 2025 02:01:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHah-0002xX-7l
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:01:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHah-0014UX-1R
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:01:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHah-005ZIc-0V
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:01:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zhsyOtA48T0QAP/3N0vn6h1TddOa9Y7gULx9Fv7EFns=; b=NklWX29nPf703M8glbugdENfUM
	BaWVIEeoBSQLVLoOhKBYKOesXO2RfJBLLJR1y6hD1o55hQ5g/lTSNF9Ac9sLbuHj/VFCeGueu8B2f
	tqKkCN++f1DEG72slWf/D0Cxtii/b/Se6dyb74Oma8+Aj1IwibZPin6R2F/WKimMtk0o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: introduce legacy dom0less option for xenstore allocation
Message-Id: <E1tpHah-005ZIc-0V@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:01:03 +0000

commit 0e2bb9d9b1f9a85d4d88d5726058ddb39d8b9b6a
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Jan 31 16:42:12 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    xen/arm: introduce legacy dom0less option for xenstore allocation
    
    The new xenstore page allocation scheme might break older unpatched
    Linux kernels that do not check for the Xenstore connection status
    before proceeding with Xenstore initialization.
    
    Introduce a dom0less configuration option to retain the older behavior.
    
    The older behavior triggered by this option is to allocate the xenstore
    page in init-dom0less. That does not work with static-mem guests.
    However, it will make it possible to run as regular guests older Linux
    kernel versions that are left unpatched.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 docs/misc/arm/device-tree/booting.txt |  5 ++++
 xen/arch/arm/dom0less-build.c         | 45 +++++++++++++++++++++++++----------
 xen/arch/arm/include/asm/kernel.h     | 30 ++++++++++++++---------
 3 files changed, 56 insertions(+), 24 deletions(-)

diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
index 9c881baccc..4d6d859c66 100644
--- a/docs/misc/arm/device-tree/booting.txt
+++ b/docs/misc/arm/device-tree/booting.txt
@@ -222,6 +222,11 @@ with the following properties:
     Xen PV interfaces, including grant-table and xenstore, will be
     enabled for the VM.
 
+    - "legacy"
+    Same as above, but the way the xenstore page is allocated is not
+    compatible with static-mem guests. On the other hand, it works with
+    older Linux kernels.
+
     - "disabled"
     Xen PV interfaces are disabled.
 
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 6c51f91999..1d735f86db 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -755,6 +755,30 @@ static int __init alloc_xenstore_page(struct domain *d)
     return 0;
 }
 
+static int __init alloc_xenstore_params(struct kernel_info *kinfo)
+{
+    struct domain *d = kinfo->d;
+    int rc = 0;
+
+    if ( kinfo->dom0less_feature & (DOM0LESS_XENSTORE | DOM0LESS_XS_LEGACY) )
+    {
+        ASSERT(hardware_domain);
+        rc = alloc_xenstore_evtchn(d);
+        if ( rc < 0 )
+            return rc;
+        d->arch.hvm.params[HVM_PARAM_STORE_PFN] = ~0ULL;
+    }
+
+    if ( kinfo->dom0less_feature & DOM0LESS_XENSTORE )
+    {
+        rc = alloc_xenstore_page(d);
+        if ( rc < 0 )
+            return rc;
+    }
+
+    return rc;
+}
+
 static int __init construct_domU(struct domain *d,
                                  const struct dt_device_node *node)
 {
@@ -800,6 +824,13 @@ static int __init construct_domU(struct domain *d,
         else
             panic("At the moment, Xenstore support requires dom0 to be present\n");
     }
+    else if ( rc == 0 && !strcmp(dom0less_enhanced, "legacy") )
+    {
+        if ( hardware_domain )
+            kinfo.dom0less_feature = DOM0LESS_ENHANCED_LEGACY;
+        else
+            panic("At the moment, Xenstore support requires dom0 to be present\n");
+    }
     else if ( rc == 0 && !strcmp(dom0less_enhanced, "no-xenstore") )
         kinfo.dom0less_feature = DOM0LESS_ENHANCED_NO_XS;
 
@@ -849,19 +880,7 @@ static int __init construct_domU(struct domain *d,
     if ( rc < 0 )
         return rc;
 
-    if ( kinfo.dom0less_feature & DOM0LESS_XENSTORE )
-    {
-        ASSERT(hardware_domain);
-        rc = alloc_xenstore_evtchn(d);
-        if ( rc < 0 )
-            return rc;
-
-        rc = alloc_xenstore_page(d);
-        if ( rc < 0 )
-            return rc;
-    }
-
-    return rc;
+    return alloc_xenstore_params(&kinfo);
 }
 
 void __init create_domUs(void)
diff --git a/xen/arch/arm/include/asm/kernel.h b/xen/arch/arm/include/asm/kernel.h
index de3f945ae5..bdc96f4c18 100644
--- a/xen/arch/arm/include/asm/kernel.h
+++ b/xen/arch/arm/include/asm/kernel.h
@@ -13,20 +13,28 @@
 /*
  * List of possible features for dom0less domUs
  *
- * DOM0LESS_ENHANCED_NO_XS: Notify the OS it is running on top of Xen. All the
- *                          default features (excluding Xenstore) will be
- *                          available. Note that an OS *must* not rely on the
- *                          availability of Xen features if this is not set.
- * DOM0LESS_XENSTORE:       Xenstore will be enabled for the VM. This feature
- *                          can't be enabled without the
- *                          DOM0LESS_ENHANCED_NO_XS.
- * DOM0LESS_ENHANCED:       Notify the OS it is running on top of Xen. All the
- *                          default features (including Xenstore) will be
- *                          available. Note that an OS *must* not rely on the
- *                          availability of Xen features if this is not set.
+ * DOM0LESS_ENHANCED_NO_XS:  Notify the OS it is running on top of Xen. All the
+ *                           default features (excluding Xenstore) will be
+ *                           available. Note that an OS *must* not rely on the
+ *                           availability of Xen features if this is not set.
+ * DOM0LESS_XENSTORE:        Xenstore will be enabled for the VM. The
+ *                           xenstore page allocation is done by Xen at
+ *                           domain creation. This feature can't be
+ *                           enabled without the DOM0LESS_ENHANCED_NO_XS.
+ * DOM0LESS_XS_LEGACY        Xenstore will be enabled for the VM, the
+ *                           xenstore page allocation will happen in
+ *                           init-dom0less. This feature can't be enabled
+ *                           without the DOM0LESS_ENHANCED_NO_XS.
+ * DOM0LESS_ENHANCED:        Notify the OS it is running on top of Xen. All the
+ *                           default features (including Xenstore) will be
+ *                           available. Note that an OS *must* not rely on the
+ *                           availability of Xen features if this is not set.
+ * DOM0LESS_ENHANCED_LEGACY: Same as before, but using DOM0LESS_XS_LEGACY.
  */
 #define DOM0LESS_ENHANCED_NO_XS  BIT(0, U)
 #define DOM0LESS_XENSTORE        BIT(1, U)
+#define DOM0LESS_XS_LEGACY       BIT(2, U)
+#define DOM0LESS_ENHANCED_LEGACY (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XS_LEGACY)
 #define DOM0LESS_ENHANCED        (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XENSTORE)
 
 struct kernel_info {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:01:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:01:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900751.1308679 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHas-00030x-6S; Tue, 04 Mar 2025 02:01:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900751.1308679; Tue, 04 Mar 2025 02:01:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHas-00030p-3l; Tue, 04 Mar 2025 02:01:14 +0000
Received: by outflank-mailman (input) for mailman id 900751;
 Tue, 04 Mar 2025 02:01:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHar-00030h-BO
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:01:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHar-0014Ur-1n
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:01:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHar-005ZJ5-0s
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:01:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=k6Q+TMoXQQqZcYEnH1kusW5LRRx/v7WLFFhspMdzd7Y=; b=G6QOD4ZDANY6brMlATUj6tfozS
	cS8dufmM2TzwkVKgs+OqpYTquhKJknCdBCqBSvUeyxL8dZizojAznwXYDQfmDQAPY93FPfc1s7Jbh
	kjb0AB8vGLAvIhpbrPzuk5lXh1IPa0alNc5OeNIZYvl/aBE/6HW+qM1wii3BiSzcw11k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/dom0less: support for vcpu affinity
Message-Id: <E1tpHar-005ZJ5-0s@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:01:13 +0000

commit 29a9638fd4583c738811d4d846543ee85260ca17
Author:     Xenia Ragiadakou <xenia.ragiadakou@amd.com>
AuthorDate: Thu Feb 20 13:37:12 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:05:13 2025 -0800

    xen/dom0less: support for vcpu affinity
    
    Add vcpu affinity to the dom0less bindings. Example:
    
        dom1 {
                ...
                cpus = <4>;
                vcpu0 {
                       compatible = "xen,vcpu";
                       id = <0>;
                       hard-affinity = "4-7";
                };
                vcpu1 {
                       compatible = "xen,vcpu";
                       id = <1>;
                       hard-affinity = "0-3,5";
                };
                vcpu2 {
                       compatible = "xen,vcpu";
                       id = <2>;
                       hard-affinity = "1,6";
                };
                ...
    
    Note that the property hard-affinity is optional. It is possible to add
    other properties in the future not only to specify soft affinity, but
    also to provide more precise methods for configuring affinity. For
    instance, on ARM the MPIDR could be use to specify the pCPU. For now, it
    is left to the future.
    
    Signed-off-by: Xenia Ragiadakou <xenia.ragiadakou@amd.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/arm/device-tree/booting.txt | 34 +++++++++++++++++++
 xen/arch/arm/dom0less-build.c         | 64 +++++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+)

diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
index 4d6d859c66..ac781c9cc8 100644
--- a/docs/misc/arm/device-tree/booting.txt
+++ b/docs/misc/arm/device-tree/booting.txt
@@ -329,6 +329,28 @@ The ramdisk sub-node has the following properties:
     property because it will be created by the UEFI stub on boot.
     This option is needed only when UEFI boot is used.
 
+Under the "xen,domain" compatible node, it is possible optionally to add
+one or more sub-nodes to configure vCPU affinity. The vCPU affinity
+sub-node has the following properties:
+
+- compatible
+
+    "xen,vcpu"
+
+- id
+
+    A 32-bit integer that specifies the vCPU id. 0 is the first vCPU.
+    The last vCPU is cpus-1, where "cpus" is the number of vCPUs
+    specified with the "cpus" property under the "xen,domain" node.
+    Each "xen,vcpu" node must have a unique vCPU id.
+
+- hard-affinity
+
+    Optional. A string specifying the hard affinity configuration for the
+    vCPU: a comma-separated list of pCPUs or ranges of pCPUs is used.
+    Ranges are hyphen-separated intervals (such as `0-4`) and are inclusive
+    on both sides. The numbers refer to logical pCPU ids.
+
 
 Example
 =======
@@ -342,6 +364,18 @@ chosen {
         cpus = <2>;
         vpl011;
 
+        vcpu0 {
+            compatible = "xen,vcpu";
+            id = <0>;
+            hard-affinity = "0-3";
+        };
+
+        vcpu1 {
+            compatible = "xen,vcpu";
+            id = <1>;
+            hard-affinity = "1,4-7";
+        };
+
         module@0x4a000000 {
             compatible = "multiboot,kernel", "multiboot,module";
             reg = <0x0 0x4a000000 0xffffff>;
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 1d735f86db..31f31c38da 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -779,6 +779,68 @@ static int __init alloc_xenstore_params(struct kernel_info *kinfo)
     return rc;
 }
 
+static void __init domain_vcpu_affinity(struct domain *d,
+                                        const struct dt_device_node *node)
+{
+    struct dt_device_node *np;
+
+    dt_for_each_child_node(node, np)
+    {
+        const char *hard_affinity_str = NULL;
+        uint32_t val;
+        int rc;
+        struct vcpu *v;
+        cpumask_t affinity;
+
+        if ( !dt_device_is_compatible(np, "xen,vcpu") )
+            continue;
+
+        if ( !dt_property_read_u32(np, "id", &val) )
+            panic("Invalid xen,vcpu node for domain %s\n", dt_node_name(node));
+
+        if ( val >= d->max_vcpus )
+            panic("Invalid vcpu_id %u for domain %s, max_vcpus=%u\n", val,
+                  dt_node_name(node), d->max_vcpus);
+
+        v = d->vcpu[val];
+        rc = dt_property_read_string(np, "hard-affinity", &hard_affinity_str);
+        if ( rc < 0 )
+            continue;
+
+        cpumask_clear(&affinity);
+        while ( *hard_affinity_str != '\0' )
+        {
+            unsigned int start, end;
+
+            start = simple_strtoul(hard_affinity_str, &hard_affinity_str, 0);
+
+            if ( *hard_affinity_str == '-' )    /* Range */
+            {
+                hard_affinity_str++;
+                end = simple_strtoul(hard_affinity_str, &hard_affinity_str, 0);
+            }
+            else                /* Single value */
+                end = start;
+
+            if ( end >= nr_cpu_ids )
+                panic("Invalid pCPU %u for domain %s\n", end, dt_node_name(node));
+
+            for ( ; start <= end; start++ )
+                cpumask_set_cpu(start, &affinity);
+
+            if ( *hard_affinity_str == ',' )
+                hard_affinity_str++;
+            else if ( *hard_affinity_str != '\0' )
+                break;
+        }
+
+        rc = vcpu_set_hard_affinity(v, &affinity);
+        if ( rc )
+            panic("vcpu%d: failed (rc=%d) to set hard affinity for domain %s\n",
+                  v->vcpu_id, rc, dt_node_name(node));
+    }
+}
+
 static int __init construct_domU(struct domain *d,
                                  const struct dt_device_node *node)
 {
@@ -880,6 +942,8 @@ static int __init construct_domU(struct domain *d,
     if ( rc < 0 )
         return rc;
 
+    domain_vcpu_affinity(d, node);
+
     return alloc_xenstore_params(&kinfo);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:01:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:01:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900752.1308683 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHb2-00033m-7k; Tue, 04 Mar 2025 02:01:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900752.1308683; Tue, 04 Mar 2025 02:01:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHb2-00033e-59; Tue, 04 Mar 2025 02:01:24 +0000
Received: by outflank-mailman (input) for mailman id 900752;
 Tue, 04 Mar 2025 02:01:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHb1-00033Q-F2
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:01:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHb1-0014Uv-2A
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:01:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHb1-005ZJX-1F
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:01:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Oa5W1RBqKMnKOtdSbmE+zmdsieGxfV5fL5uaH7u08pA=; b=pYRjEyRVcO/MFRewO4jD+lLSrz
	F/26Zm3hATVj0ULVaQVFmHYwlGLthDI7ZDcn7yXJdSxRNPr8g31fTt0EyJWRSfYZBcnHBxwg2JqhK
	g4G4mO9d026YjrOgiBAtebZ4RnmpVAyXILyVqNbCYYn5W8HCLRGS9CV0KdTrZoUn65NY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/include: introduce resource.h
Message-Id: <E1tpHb1-005ZJX-1F@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:01:23 +0000

commit 1b861bd95e9cc008942846cb71df5a21c78a1aad
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Tue Feb 11 15:55:44 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:06:17 2025 -0800

    xen/include: introduce resource.h
    
    Move resource definitions to a new architecture-agnostic shared header file.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/device-tree/device-tree.c | 21 +--------------------
 xen/drivers/passthrough/arm/smmu.c   | 18 +++---------------
 xen/include/xen/resource.h           | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/device-tree.c
index d0528c5825..e8f810b2fe 100644
--- a/xen/common/device-tree/device-tree.c
+++ b/xen/common/device-tree/device-tree.c
@@ -24,6 +24,7 @@
 #include <xen/ctype.h>
 #include <asm/setup.h>
 #include <xen/err.h>
+#include <xen/resource.h>
 
 const void *device_tree_flattened;
 dt_irq_xlate_func dt_irq_xlate;
@@ -535,26 +536,6 @@ int dt_child_n_size_cells(const struct dt_device_node *parent)
     return __dt_n_size_cells(parent, true);
 }
 
-/*
- * These are defined in Linux where much of this code comes from, but
- * are currently unused outside this file in the context of Xen.
- */
-#define IORESOURCE_BITS         0x000000ff      /* Bus-specific bits */
-
-#define IORESOURCE_TYPE_BITS    0x00001f00      /* Resource type */
-#define IORESOURCE_IO           0x00000100      /* PCI/ISA I/O ports */
-#define IORESOURCE_MEM          0x00000200
-#define IORESOURCE_REG          0x00000300      /* Register offsets */
-#define IORESOURCE_IRQ          0x00000400
-#define IORESOURCE_DMA          0x00000800
-#define IORESOURCE_BUS          0x00001000
-
-#define IORESOURCE_PREFETCH     0x00002000      /* No side effects */
-#define IORESOURCE_READONLY     0x00004000
-#define IORESOURCE_CACHEABLE    0x00008000
-#define IORESOURCE_RANGELENGTH  0x00010000
-#define IORESOURCE_SHADOWABLE   0x00020000
-
 /*
  * Default translator (generic bus)
  */
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 03d22bce1e..0f8d47dc98 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -50,6 +50,7 @@
 #include <xen/rbtree.h>
 #include <xen/sched.h>
 #include <xen/sizes.h>
+#include <xen/resource.h>
 #include <asm/atomic.h>
 #include <asm/device.h>
 #include <asm/io.h>
@@ -64,6 +65,8 @@
 
 /* Alias to Xen device tree helpers */
 #define device_node dt_device_node
+#define platform_device dt_device_node
+
 #define of_phandle_args dt_phandle_args
 #define of_device_id dt_device_match
 #define of_match_node dt_match_node
@@ -71,21 +74,6 @@
 #define of_property_read_bool dt_property_read_bool
 #define of_parse_phandle_with_args dt_parse_phandle_with_args
 
-/* Xen: Helpers to get device MMIO and IRQs */
-struct resource
-{
-	paddr_t addr;
-	paddr_t size;
-	unsigned int type;
-};
-
-#define resource_size(res) (res)->size;
-
-#define platform_device dt_device_node
-
-#define IORESOURCE_MEM 0
-#define IORESOURCE_IRQ 1
-
 static struct resource *platform_get_resource(struct platform_device *pdev,
 					      unsigned int type,
 					      unsigned int num)
diff --git a/xen/include/xen/resource.h b/xen/include/xen/resource.h
new file mode 100644
index 0000000000..5d10363128
--- /dev/null
+++ b/xen/include/xen/resource.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * System resource description.
+ */
+#ifndef XEN__RESOURCE_H
+#define XEN__RESOURCE_H
+
+#define IORESOURCE_BITS         0x000000FFU      /* Bus-specific bits */
+
+#define IORESOURCE_TYPE_BITS    0x00001F00U      /* Resource type */
+#define IORESOURCE_IO           0x00000100U      /* PCI/ISA I/O ports */
+#define IORESOURCE_MEM          0x00000200U
+#define IORESOURCE_REG          0x00000300U      /* Register offsets */
+#define IORESOURCE_IRQ          0x00000400U
+#define IORESOURCE_DMA          0x00000800U
+#define IORESOURCE_BUS          0x00001000U
+
+#define IORESOURCE_PREFETCH     0x00002000U      /* No side effects */
+#define IORESOURCE_READONLY     0x00004000U
+#define IORESOURCE_CACHEABLE    0x00008000U
+#define IORESOURCE_RANGELENGTH  0x00010000U
+#define IORESOURCE_SHADOWABLE   0x00020000U
+
+#define IORESOURCE_UNKNOWN      (~0U)
+
+struct resource {
+    paddr_t addr;
+    paddr_t size;
+    unsigned int type;
+};
+
+#define resource_size(res)      ((res)->size)
+
+#endif /* XEN__RESOURCE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:01:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:01:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900753.1308687 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHbC-00036D-93; Tue, 04 Mar 2025 02:01:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900753.1308687; Tue, 04 Mar 2025 02:01:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHbC-000364-6a; Tue, 04 Mar 2025 02:01:34 +0000
Received: by outflank-mailman (input) for mailman id 900753;
 Tue, 04 Mar 2025 02:01:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHbB-00035x-Hj
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:01:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHbB-0014V2-2R
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:01:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHbB-005ZJt-1b
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:01:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JIeszYtkvUeMuaPPWsS9Uu0R5utyqZKpt3EjsMxawbc=; b=r13l5d4oFNEprV//yCUQHS/6h6
	ajd5kMmrjFVLl/dZx6+2WpyI76Me9Mq0zJ1TofiiB+H2y5GTVzrLqgXj4t/ChWTmcsOWl6ZQlOzl8
	dbwnijexdogcFd5CEUncfZjMP9Cyg15QnL9RuEu1tT78FxTphg7765VKdkeJC46SvDhA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/vuart: move vpl011-related code to vpl011 emulator
Message-Id: <E1tpHbB-005ZJt-1b@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:01:33 +0000

commit 68a88a2f33e2e98a0351fa57c8d31216f6d9fb67
Author:     dmkhn@proton.me <dmkhn@proton.me>
AuthorDate: Wed Feb 12 21:19:58 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:06:56 2025 -0800

    arm/vuart: move vpl011-related code to vpl011 emulator
    
    Xen console driver has vpl011-related logic which shall belong vpl011 emulator
    code (Arm port). Move vpl011-related code from arch-independent console driver
    to Arm's vpl011.c.
    
    Use rate-limiting guest_printk() for error logging in console driver in case
    vpl011 cannot handle the console input.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/vpl011.h |  2 +-
 xen/arch/arm/vpl011.c             | 15 +++++++++++----
 xen/drivers/char/console.c        | 21 +++++++--------------
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/xen/arch/arm/include/asm/vpl011.h b/xen/arch/arm/include/asm/vpl011.h
index c09abcd7a9..cc83868281 100644
--- a/xen/arch/arm/include/asm/vpl011.h
+++ b/xen/arch/arm/include/asm/vpl011.h
@@ -69,7 +69,7 @@ struct vpl011_init_info {
 int domain_vpl011_init(struct domain *d,
                        struct vpl011_init_info *info);
 void domain_vpl011_deinit(struct domain *d);
-void vpl011_rx_char_xen(struct domain *d, char c);
+int vpl011_rx_char_xen(struct domain *d, char c);
 #else
 static inline int domain_vpl011_init(struct domain *d,
                                      struct vpl011_init_info *info)
diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index 1fc3114cce..c72f3778bf 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -567,16 +567,21 @@ static void vpl011_data_avail(struct domain *d,
 
 /*
  * vpl011_rx_char_xen adds a char to a domain's vpl011 receive buffer.
- * It is only used when the vpl011 backend is in Xen.
  */
-void vpl011_rx_char_xen(struct domain *d, char c)
+int vpl011_rx_char_xen(struct domain *d, char c)
 {
     unsigned long flags;
     struct vpl011 *vpl011 = &d->arch.vpl011;
     struct vpl011_xen_backend *intf = vpl011->backend.xen;
     XENCONS_RING_IDX in_cons, in_prod, in_fifo_level;
 
-    ASSERT(!vpl011->backend_in_domain);
+    /* Forward input iff the vpl011 backend is in Xen. */
+    if ( vpl011->backend_in_domain )
+        return -ENODEV;
+
+    if ( intf == NULL )
+        return -ENODEV;
+
     VPL011_LOCK(d, flags);
 
     in_cons = intf->in_cons;
@@ -584,7 +589,7 @@ void vpl011_rx_char_xen(struct domain *d, char c)
     if ( xencons_queued(in_prod, in_cons, sizeof(intf->in)) == sizeof(intf->in) )
     {
         VPL011_UNLOCK(d, flags);
-        return;
+        return -ENOSPC;
     }
 
     intf->in[xencons_mask(in_prod, sizeof(intf->in))] = c;
@@ -596,6 +601,8 @@ void vpl011_rx_char_xen(struct domain *d, char c)
 
     vpl011_data_avail(d, in_fifo_level, sizeof(intf->in), 0, SBSA_UART_FIFO_SIZE);
     VPL011_UNLOCK(d, flags);
+
+    return 0;
 }
 
 static void vpl011_notification(struct vcpu *v, unsigned int port)
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index eb09b6d5fd..2f48001a44 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -553,21 +553,14 @@ static void __serial_rx(char c)
     {
         struct domain *d = rcu_lock_domain_by_id(console_rx - 1);
 
-        /*
-         * If we have a properly initialized vpl011 console for the
-         * domain, without a full PV ring to Dom0 (in that case input
-         * comes from the PV ring), then send the character to it.
-         */
-        if ( d != NULL &&
-             !d->arch.vpl011.backend_in_domain &&
-             d->arch.vpl011.backend.xen != NULL )
-            vpl011_rx_char_xen(d, c);
-        else
-            printk("Cannot send chars to Dom%d: no UART available\n",
-                   console_rx - 1);
-
-        if ( d != NULL )
+        if ( d )
+        {
+            int rc = vpl011_rx_char_xen(d, c);
+            if ( rc )
+                guest_printk(d, XENLOG_G_WARNING
+                                "failed to process console input: %d\n", rc);
             rcu_unlock_domain(d);
+        }
 
         break;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:01:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:01:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900754.1308691 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHbN-00038a-Aw; Tue, 04 Mar 2025 02:01:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900754.1308691; Tue, 04 Mar 2025 02:01:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHbN-00038S-87; Tue, 04 Mar 2025 02:01:45 +0000
Received: by outflank-mailman (input) for mailman id 900754;
 Tue, 04 Mar 2025 02:01:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHbL-00038J-KQ
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:01:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHbL-0014V6-2i
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:01:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHbL-005ZKL-1r
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:01:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=doSx0PC8BuhOzFtY+s06/5JpFPq2HdXdJZvUVpLu++k=; b=eziXoRCA2oRy/qD2iistLOJk20
	0b076UfYbTMy7j2FIPRXvl6bDZ+fkd0r2KAKiR8GAvUs1TgH2D5zDw6BLljS7g/8blG3DI3LuGhQK
	dFti3reN7Mc7oLlt/q+/FIIFgQs/lPjsCTlLPyZMG+4evFM1nSByvm5G5QJVoT6HABp8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] device-tree: optimize size of struct dt_device_node
Message-Id: <E1tpHbL-005ZKL-1r@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:01:43 +0000

commit 0207fee58d1db2a5dd0b1ab689c6504a9dfa7431
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Feb 12 17:43:58 2025 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:07:27 2025 -0800

    device-tree: optimize size of struct dt_device_node
    
    The current placement of fields in struct dt_device_node is not optimal and
    introduces holes due to fields alignment.
    
    Checked with "'pahole xen-syms -C dt_device_node"
    
    ARM64 size 144B, 16B holes:
            /* size: 144, cachelines: 3, members: 15 */
            /* sum members: 128, holes: 3, sum holes: 16 */
            /* last cacheline: 16 bytes */
    ARM32 size 72B, 4B holes
            /* size: 72, cachelines: 2, members: 15 */
            /* sum members: 68, holes: 2, sum holes: 4 */
            /* last cacheline: 8 bytes */
    
    This patch optimizes size of struct dt_device_node by rearranging its
    field, which eliminates holes and reduces structure size by 16B(ARM64) and
    4B(ARM32).
    
    After ARM64 size 128B, no holes (-16B):
            /* size: 128, cachelines: 2, members: 15 */
    After ARM32 size 68B, no holes (-4B)
            /* size: 68, cachelines: 2, members: 15 */
            /* last cacheline: 4 bytes */
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/xen/device_tree.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index 5ff763bb80..0ff80fda04 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -81,17 +81,10 @@ struct dt_property {
 struct dt_device_node {
     const char *name;
     const char *type;
-    dt_phandle phandle;
     char *full_name;
+    dt_phandle phandle;
     domid_t used_by; /* By default it's used by dom0 */
 
-    struct dt_property *properties;
-    struct dt_device_node *parent;
-    struct dt_device_node *child;
-    struct dt_device_node *sibling;
-    struct dt_device_node *next; /* TODO: Remove it. Only use to know the last children */
-    struct dt_device_node *allnext;
-
     /* IOMMU specific fields */
     bool is_protected;
 
@@ -100,6 +93,13 @@ struct dt_device_node {
     bool static_evtchn_created;
 #endif
 
+    struct dt_property *properties;
+    struct dt_device_node *parent;
+    struct dt_device_node *child;
+    struct dt_device_node *sibling;
+    struct dt_device_node *next; /* TODO: Remove it. Only use to know the last children */
+    struct dt_device_node *allnext;
+
     /*
      * The main purpose of this list is to link the structure in the list
      * of devices assigned to domain.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:01:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:01:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900755.1308694 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHbX-0003Cm-CG; Tue, 04 Mar 2025 02:01:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900755.1308694; Tue, 04 Mar 2025 02:01:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHbX-0003Cf-9e; Tue, 04 Mar 2025 02:01:55 +0000
Received: by outflank-mailman (input) for mailman id 900755;
 Tue, 04 Mar 2025 02:01:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHbV-0003CU-OH
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:01:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHbV-0014VC-34
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:01:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHbV-005ZLU-2B
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:01:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dBI7l9xWww9MsAS9X38TTjH5umIZL9Z8O0POQn9scwI=; b=5rwU0WfyixJo2W8elfRYP8FwsT
	KYA+LC3G1lohdCKK98PfB2EAaOXLPB3bOqsphogtOWyDaIx/lFWwx1xI5CmaB+aWqte+3xC3srdIF
	dFQotw6sHeSaDuJ0HFb8rOlp1zTlLcJ0EdrQVKj1x0O2Shl9YD1M19E0ITii/o6CcinI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arch: arm64: always set IL=1 when injecting undefined exception
Message-Id: <E1tpHbV-005ZLU-2B@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:01:53 +0000

commit 9480d48437a1068b27514ffe1f58c89f7224b519
Author:     Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
AuthorDate: Thu Feb 13 15:37:54 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:08:08 2025 -0800

    arch: arm64: always set IL=1 when injecting undefined exception
    
    ARM Architecture Reference Manual states that IL field of ESR_EL1
    register should be 1 when EC is 0b000000 aka HSR_EC_UNKNOWN.
    
    Section D24.2.40, page D24-7337 of ARM DDI 0487L:
    
      IL, bit [25]
      Instruction Length for synchronous exceptions. Possible values of this bit are:
    
      [...]
    
      0b1 - 32-bit instruction trapped.
      This value is also used when the exception is one of the following:
      [...]
       - An exception reported using EC value 0b000000.
    
    To align code with the specification, set .len field to 1 in
    inject_undef64_exception() and remove unneeded second parameter.
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/arm64/vsysreg.c           | 10 +++++-----
 xen/arch/arm/include/asm/arm64/traps.h |  2 +-
 xen/arch/arm/include/asm/p2m.h         |  3 +--
 xen/arch/arm/include/asm/traps.h       |  2 +-
 xen/arch/arm/p2m.c                     |  5 ++---
 xen/arch/arm/traps.c                   | 24 ++++++++++++------------
 xen/arch/arm/vcpreg.c                  | 26 +++++++++++++-------------
 xen/arch/arm/vsmc.c                    |  6 ++----
 8 files changed, 37 insertions(+), 41 deletions(-)

diff --git a/xen/arch/arm/arm64/vsysreg.c b/xen/arch/arm/arm64/vsysreg.c
index c73b2c95ce..d14258290f 100644
--- a/xen/arch/arm/arm64/vsysreg.c
+++ b/xen/arch/arm/arm64/vsysreg.c
@@ -95,7 +95,7 @@ void do_sysreg(struct cpu_user_regs *regs,
      */
     case HSR_SYSREG_ACTLR_EL1:
         if ( regs_mode_is_user(regs) )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
         if ( hsr.sysreg.read )
             set_user_reg(regs, regidx, v->arch.actlr);
         break;
@@ -109,7 +109,7 @@ void do_sysreg(struct cpu_user_regs *regs,
     case HSR_SYSREG_DCCSW:
     case HSR_SYSREG_DCCISW:
         if ( !hsr.sysreg.read )
-            p2m_set_way_flush(current, regs, hsr);
+            p2m_set_way_flush(current, regs);
         break;
 
     /*
@@ -267,7 +267,7 @@ void do_sysreg(struct cpu_user_regs *regs,
     case HSR_SYSREG_CNTP_TVAL_EL0:
     case HSR_SYSREG_CNTP_CVAL_EL0:
         if ( !vtimer_emulate(regs, hsr) )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
         break;
 
     /*
@@ -280,7 +280,7 @@ void do_sysreg(struct cpu_user_regs *regs,
     case HSR_SYSREG_ICC_SGI0R_EL1:
 
         if ( !vgic_emulate(regs, hsr) )
-            return inject_undef64_exception(regs, hsr.len);
+            return inject_undef64_exception(regs);
         break;
 
     /*
@@ -440,7 +440,7 @@ void do_sysreg(struct cpu_user_regs *regs,
     gdprintk(XENLOG_ERR,
              "unhandled 64-bit sysreg access %#"PRIregister"\n",
              hsr.bits & HSR_SYSREG_REGS_MASK);
-    inject_undef_exception(regs, hsr);
+    inject_undef_exception(regs);
 }
 
 /*
diff --git a/xen/arch/arm/include/asm/arm64/traps.h b/xen/arch/arm/include/asm/arm64/traps.h
index a347cb13d6..3be2fa69ee 100644
--- a/xen/arch/arm/include/asm/arm64/traps.h
+++ b/xen/arch/arm/include/asm/arm64/traps.h
@@ -1,7 +1,7 @@
 #ifndef __ASM_ARM64_TRAPS__
 #define __ASM_ARM64_TRAPS__
 
-void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len);
+void inject_undef64_exception(struct cpu_user_regs *regs);
 
 void do_sysreg(struct cpu_user_regs *regs,
                const union hsr hsr);
diff --git a/xen/arch/arm/include/asm/p2m.h b/xen/arch/arm/include/asm/p2m.h
index 4818dd4b6a..594dc40041 100644
--- a/xen/arch/arm/include/asm/p2m.h
+++ b/xen/arch/arm/include/asm/p2m.h
@@ -298,8 +298,7 @@ void p2m_domain_creation_finished(struct domain *d);
  */
 int p2m_cache_flush_range(struct domain *d, gfn_t *pstart, gfn_t end);
 
-void p2m_set_way_flush(struct vcpu *v, struct cpu_user_regs *regs,
-                       const union hsr hsr);
+void p2m_set_way_flush(struct vcpu *v, struct cpu_user_regs *regs);
 
 void p2m_toggle_cache(struct vcpu *v, bool was_enabled);
 
diff --git a/xen/arch/arm/include/asm/traps.h b/xen/arch/arm/include/asm/traps.h
index 9a60dbf70e..3b40afe262 100644
--- a/xen/arch/arm/include/asm/traps.h
+++ b/xen/arch/arm/include/asm/traps.h
@@ -44,7 +44,7 @@ int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr);
 
 void advance_pc(struct cpu_user_regs *regs, const union hsr hsr);
 
-void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr);
+void inject_undef_exception(struct cpu_user_regs *regs);
 
 /* read as zero and write ignore */
 void handle_raz_wi(struct cpu_user_regs *regs, int regidx, bool read,
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 65b70955e3..ef8bd4b6ab 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -428,8 +428,7 @@ int p2m_cache_flush_range(struct domain *d, gfn_t *pstart, gfn_t end)
  *
  *  - Once the caches are enabled, we stop trapping VM ops.
  */
-void p2m_set_way_flush(struct vcpu *v, struct cpu_user_regs *regs,
-                       const union hsr hsr)
+void p2m_set_way_flush(struct vcpu *v, struct cpu_user_regs *regs)
 {
     /* This function can only work with the current vCPU. */
     ASSERT(v == current);
@@ -438,7 +437,7 @@ void p2m_set_way_flush(struct vcpu *v, struct cpu_user_regs *regs,
     {
         gprintk(XENLOG_ERR,
                 "The cache should be flushed by VA rather than by set/way.\n");
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
         return;
     }
 
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 737f4d65e3..5338d5c033 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -533,12 +533,12 @@ static vaddr_t exception_handler64(struct cpu_user_regs *regs, vaddr_t offset)
 }
 
 /* Inject an undefined exception into a 64 bit guest */
-void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len)
+void inject_undef64_exception(struct cpu_user_regs *regs)
 {
     vaddr_t handler;
     const union hsr esr = {
         .iss = 0,
-        .len = instr_len,
+        .len = 1,
         .ec = HSR_EC_UNKNOWN,
     };
 
@@ -606,13 +606,13 @@ static void inject_iabt64_exception(struct cpu_user_regs *regs,
 
 #endif
 
-void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr)
+void inject_undef_exception(struct cpu_user_regs *regs)
 {
         if ( is_32bit_domain(current->domain) )
             inject_undef32_exception(regs);
 #ifdef CONFIG_ARM_64
         else
-            inject_undef64_exception(regs, hsr.len);
+            inject_undef64_exception(regs);
 #endif
 }
 
@@ -1418,7 +1418,7 @@ static void do_trap_hypercall(struct cpu_user_regs *regs, register_t *nr,
     if ( hsr.iss != XEN_HYPERCALL_TAG )
     {
         gprintk(XENLOG_WARNING, "Invalid HVC imm 0x%x\n", hsr.iss);
-        return inject_undef_exception(regs, hsr);
+        return inject_undef_exception(regs);
     }
 
     curr->hcall_preempted = false;
@@ -1655,7 +1655,7 @@ void handle_raz_wi(struct cpu_user_regs *regs,
     ASSERT((min_el == 0) || (min_el == 1));
 
     if ( min_el > 0 && regs_mode_is_user(regs) )
-        return inject_undef_exception(regs, hsr);
+        return inject_undef_exception(regs);
 
     if ( read )
         set_user_reg(regs, regidx, 0);
@@ -1674,10 +1674,10 @@ void handle_wo_wi(struct cpu_user_regs *regs,
     ASSERT((min_el == 0) || (min_el == 1));
 
     if ( min_el > 0 && regs_mode_is_user(regs) )
-        return inject_undef_exception(regs, hsr);
+        return inject_undef_exception(regs);
 
     if ( read )
-        return inject_undef_exception(regs, hsr);
+        return inject_undef_exception(regs);
     /* else: ignore */
 
     advance_pc(regs, hsr);
@@ -1694,10 +1694,10 @@ void handle_ro_read_val(struct cpu_user_regs *regs,
     ASSERT((min_el == 0) || (min_el == 1));
 
     if ( min_el > 0 && regs_mode_is_user(regs) )
-        return inject_undef_exception(regs, hsr);
+        return inject_undef_exception(regs);
 
     if ( !read )
-        return inject_undef_exception(regs, hsr);
+        return inject_undef_exception(regs);
 
     set_user_reg(regs, regidx, val);
 
@@ -2147,7 +2147,7 @@ void asmlinkage do_trap_guest_sync(struct cpu_user_regs *regs)
     case HSR_EC_SVE:
         GUEST_BUG_ON(regs_mode_is_32bit(regs));
         gprintk(XENLOG_WARNING, "Domain tried to use SVE while not allowed\n");
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
         break;
 #endif
 
@@ -2164,7 +2164,7 @@ void asmlinkage do_trap_guest_sync(struct cpu_user_regs *regs)
         gprintk(XENLOG_WARNING,
                 "Unknown Guest Trap. HSR=%#"PRIregister" EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n",
                 hsr.bits, hsr.ec, hsr.len, hsr.iss);
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
         break;
     }
 }
diff --git a/xen/arch/arm/vcpreg.c b/xen/arch/arm/vcpreg.c
index 0b336875a4..e7c484f2c1 100644
--- a/xen/arch/arm/vcpreg.c
+++ b/xen/arch/arm/vcpreg.c
@@ -206,7 +206,7 @@ void do_cp15_32(struct cpu_user_regs *regs, const union hsr hsr)
     case HSR_CPREG32(CNTP_CTL):
     case HSR_CPREG32(CNTP_TVAL):
         if ( !vtimer_emulate(regs, hsr) )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
         break;
 
     /*
@@ -217,7 +217,7 @@ void do_cp15_32(struct cpu_user_regs *regs, const union hsr hsr)
      */
     case HSR_CPREG32(ACTLR):
         if ( regs_mode_is_user(regs) )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
         if ( cp32.read )
             set_user_reg(regs, regidx, v->arch.actlr);
         break;
@@ -232,7 +232,7 @@ void do_cp15_32(struct cpu_user_regs *regs, const union hsr hsr)
     case HSR_CPREG32(DCCSW):
     case HSR_CPREG32(DCCISW):
         if ( !cp32.read )
-            p2m_set_way_flush(current, regs, hsr);
+            p2m_set_way_flush(current, regs);
         break;
 
     /*
@@ -397,7 +397,7 @@ void do_cp15_32(struct cpu_user_regs *regs, const union hsr hsr)
                  cp32.op1, cp32.reg, cp32.crn, cp32.crm, cp32.op2, regs->pc);
         gdprintk(XENLOG_ERR, "unhandled 32-bit CP15 access %#"PRIregister"\n",
                  hsr.bits & HSR_CP32_REGS_MASK);
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
         return;
     }
     advance_pc(regs, hsr);
@@ -421,7 +421,7 @@ void do_cp15_64(struct cpu_user_regs *regs, const union hsr hsr)
      */
     case HSR_CPREG64(CNTP_CVAL):
         if ( !vtimer_emulate(regs, hsr) )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
         break;
 
     /*
@@ -433,7 +433,7 @@ void do_cp15_64(struct cpu_user_regs *regs, const union hsr hsr)
     case HSR_CPREG64(ICC_ASGI1R):
     case HSR_CPREG64(ICC_SGI0R):
         if ( !vgic_emulate(regs, hsr) )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
         break;
 
     GENERATE_CASE(TTBR0, 64)
@@ -467,7 +467,7 @@ void do_cp15_64(struct cpu_user_regs *regs, const union hsr hsr)
             gdprintk(XENLOG_ERR,
                      "unhandled 64-bit CP15 access %#"PRIregister"\n",
                      hsr.bits & HSR_CP64_REGS_MASK);
-            inject_undef_exception(regs, hsr);
+            inject_undef_exception(regs);
             return;
         }
     }
@@ -532,7 +532,7 @@ void do_cp14_32(struct cpu_user_regs *regs, const union hsr hsr)
          * is set to 0, which we emulated below.
          */
         if ( !cp32.read )
-            return inject_undef_exception(regs, hsr);
+            return inject_undef_exception(regs);
 
         /* Implement the minimum requirements:
          *  - Number of watchpoints: 1
@@ -631,7 +631,7 @@ void do_cp14_32(struct cpu_user_regs *regs, const union hsr hsr)
              cp32.op1, cp32.reg, cp32.crn, cp32.crm, cp32.op2, regs->pc);
     gdprintk(XENLOG_ERR, "unhandled 32-bit cp14 access %#"PRIregister"\n",
              hsr.bits & HSR_CP32_REGS_MASK);
-    inject_undef_exception(regs, hsr);
+    inject_undef_exception(regs);
 }
 
 void do_cp14_64(struct cpu_user_regs *regs, const union hsr hsr)
@@ -669,7 +669,7 @@ void do_cp14_64(struct cpu_user_regs *regs, const union hsr hsr)
              cp64.op1, cp64.reg1, cp64.reg2, cp64.crm, regs->pc);
     gdprintk(XENLOG_ERR, "unhandled 64-bit CP14 access %#"PRIregister"\n",
              hsr.bits & HSR_CP64_REGS_MASK);
-    inject_undef_exception(regs, hsr);
+    inject_undef_exception(regs);
 }
 
 void do_cp14_dbg(struct cpu_user_regs *regs, const union hsr hsr)
@@ -698,7 +698,7 @@ void do_cp14_dbg(struct cpu_user_regs *regs, const union hsr hsr)
     gdprintk(XENLOG_ERR, "unhandled 64-bit CP14 DBG access %#"PRIregister"\n",
              hsr.bits & HSR_CP64_REGS_MASK);
 
-    inject_undef_exception(regs, hsr);
+    inject_undef_exception(regs);
 }
 
 void do_cp10(struct cpu_user_regs *regs, const union hsr hsr)
@@ -731,7 +731,7 @@ void do_cp10(struct cpu_user_regs *regs, const union hsr hsr)
                  cp32.op1, cp32.reg, cp32.crn, cp32.crm, cp32.op2, regs->pc);
         gdprintk(XENLOG_ERR, "unhandled 32-bit CP10 access %#"PRIregister"\n",
                  hsr.bits & HSR_CP32_REGS_MASK);
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
         return;
     }
     
@@ -756,7 +756,7 @@ void do_cp(struct cpu_user_regs *regs, const union hsr hsr)
 
     ASSERT(!cp.tas); /* We don't trap SIMD instruction */
     gdprintk(XENLOG_ERR, "unhandled CP%d access\n", cp.coproc);
-    inject_undef_exception(regs, hsr);
+    inject_undef_exception(regs);
 }
 
 /*
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index 62d8117a12..e253865b6c 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -346,13 +346,11 @@ void do_trap_smc(struct cpu_user_regs *regs, const union hsr hsr)
     if ( vsmccc_handle_call(regs) )
         advance_pc(regs, hsr);
     else
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
 }
 
 void do_trap_hvc_smccc(struct cpu_user_regs *regs)
 {
-    const union hsr hsr = { .bits = regs->hsr };
-
     /*
      * vsmccc_handle_call() will return false if this call is not
      * SMCCC compatible (e.g. immediate value != 0). As it is not
@@ -360,7 +358,7 @@ void do_trap_hvc_smccc(struct cpu_user_regs *regs)
      * ARM_SMCCC_ERR_UNKNOWN_FUNCTION.
      */
     if ( !vsmccc_handle_call(regs) )
-        inject_undef_exception(regs, hsr);
+        inject_undef_exception(regs);
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:02:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:02:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900756.1308699 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHbh-0003Fm-Fu; Tue, 04 Mar 2025 02:02:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900756.1308699; Tue, 04 Mar 2025 02:02:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHbh-0003Fe-DH; Tue, 04 Mar 2025 02:02:05 +0000
Received: by outflank-mailman (input) for mailman id 900756;
 Tue, 04 Mar 2025 02:02:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHbf-0003FW-RT
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:02:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHbg-0014VZ-0C
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:02:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHbf-005ZMQ-2W
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:02:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=183+6dlf58HDWj+QHcpyil1F3SI7tiGB5J/NBYFvrVw=; b=4ushT4OsQ3kC+KgbIHeeHpgXc2
	X5Cf0m8WzikHwiY+e5OQNN/Y5AE/8TzAIP9qGseru4Cz7+E9wmytkoJYY6iPK9N2LETKiVhPN7N/l
	OmQZPfeUCoDrUL0/wuelOWrBDfWl+iJaf/u77yD4miAYUeesYyt7IQnhmYOjjfDEpzT0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arch: arm64: always set IL=1 when injecting an abort exception
Message-Id: <E1tpHbf-005ZMQ-2W@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:02:03 +0000

commit ec882958fd822ed7b235577efb4044482b7b4895
Author:     Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
AuthorDate: Thu Feb 13 15:37:55 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:08:27 2025 -0800

    arch: arm64: always set IL=1 when injecting an abort exception
    
    ARM Architecture Reference Manual states that IL field of ESR_EL1
    register should be 1 in some cases, and all these cases are covered by
    inject_abt64_exception()
    
    Section D24.2.40, page D24-7337 of ARM DDI 0487L:
    
      IL, bit [25]
      Instruction Length for synchronous exceptions. Possible values of this bit are:
    
      [...]
    
      0b1 - 32-bit instruction trapped.
      This value is also used when the exception is one of the following:
      [...]
       - An Instruction Abort exception.
       - A Data Abort exception for which the value of the ISV bit is 0.
      [...]
    
    inject_abt64_exception() function injects either Instruction Abort or
    Data Abort exception. In both cases, ISS is 0, which means that ISV
    bit is 0 as well. Thus, IL must be set to 1 unconditionally.
    
    To align code with the specification, set .len field to 1 in
    inject_abt64_exception() and remove unneeded third parameter.
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/traps.c | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 5338d5c033..3071c38768 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -559,13 +559,12 @@ void inject_undef64_exception(struct cpu_user_regs *regs)
 /* Inject an abort exception into a 64 bit guest */
 static void inject_abt64_exception(struct cpu_user_regs *regs,
                                    int prefetch,
-                                   register_t addr,
-                                   int instr_len)
+                                   register_t addr)
 {
     vaddr_t handler;
     union hsr esr = {
         .iss = 0,
-        .len = instr_len,
+        .len = 1,
     };
 
     if ( regs_mode_is_user(regs) )
@@ -591,17 +590,15 @@ static void inject_abt64_exception(struct cpu_user_regs *regs,
 }
 
 static void inject_dabt64_exception(struct cpu_user_regs *regs,
-                                   register_t addr,
-                                   int instr_len)
+                                    register_t addr)
 {
-    inject_abt64_exception(regs, 0, addr, instr_len);
+    inject_abt64_exception(regs, 0, addr);
 }
 
 static void inject_iabt64_exception(struct cpu_user_regs *regs,
-                                   register_t addr,
-                                   int instr_len)
+                                    register_t addr)
 {
-    inject_abt64_exception(regs, 1, addr, instr_len);
+    inject_abt64_exception(regs, 1, addr);
 }
 
 #endif
@@ -617,26 +614,24 @@ void inject_undef_exception(struct cpu_user_regs *regs)
 }
 
 static void inject_iabt_exception(struct cpu_user_regs *regs,
-                                  register_t addr,
-                                  int instr_len)
+                                  register_t addr)
 {
         if ( is_32bit_domain(current->domain) )
             inject_pabt32_exception(regs, addr);
 #ifdef CONFIG_ARM_64
         else
-            inject_iabt64_exception(regs, addr, instr_len);
+            inject_iabt64_exception(regs, addr);
 #endif
 }
 
 static void inject_dabt_exception(struct cpu_user_regs *regs,
-                                  register_t addr,
-                                  int instr_len)
+                                  register_t addr)
 {
         if ( is_32bit_domain(current->domain) )
             inject_dabt32_exception(regs, addr);
 #ifdef CONFIG_ARM_64
         else
-            inject_dabt64_exception(regs, addr, instr_len);
+            inject_dabt64_exception(regs, addr);
 #endif
 }
 
@@ -1965,9 +1960,9 @@ inject_abt:
              "HSR=%#"PRIregister" pc=%#"PRIregister" gva=%#"PRIvaddr" gpa=%#"PRIpaddr"\n",
              hsr.bits, regs->pc, gva, gpa);
     if ( is_data )
-        inject_dabt_exception(regs, gva, hsr.len);
+        inject_dabt_exception(regs, gva);
     else
-        inject_iabt_exception(regs, gva, hsr.len);
+        inject_iabt_exception(regs, gva);
 }
 
 static inline bool needs_ssbd_flip(struct vcpu *v)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:02:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:02:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900757.1308703 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHbr-0003IH-HL; Tue, 04 Mar 2025 02:02:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900757.1308703; Tue, 04 Mar 2025 02:02:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHbr-0003IA-Ee; Tue, 04 Mar 2025 02:02:15 +0000
Received: by outflank-mailman (input) for mailman id 900757;
 Tue, 04 Mar 2025 02:02:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHbp-0003I1-Uu
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:02:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHbq-0014Vy-0X
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:02:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHbp-005ZMx-2q
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:02:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2GYjyVwzM10MeBEazAhCZ172gGD9h48TD+Kucoax3LI=; b=y2LWe0d4JapU2pgzQbZ+RTPdOT
	z7JDn4R/6+z/MNOsaQpmVrRyPgeuYVafzIFKyVABkFRdakAuqItT4aVIsx2nYnGdXQwzH09O4gwET
	14Bn1bB+Ne/sJbibMNcjlvFUWBGhZC9NmRL5YGkzyIs5DYLEfubjVsAbnUs4jE3eVbjg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Create GIC node using the node name from host dt
Message-Id: <E1tpHbp-005ZMx-2q@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:02:13 +0000

commit 0c4b0e6236f4d50316e903221a9bef1f25eb6916
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Feb 19 18:29:46 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:10:10 2025 -0800

    xen/arm: Create GIC node using the node name from host dt
    
    At the moment the GIC node we create for hwdom has a name
    "interrupt-controller". Change it so that we use the same name as the
    GIC node from host device tree. This is done for at least 2 purposes:
    1) The convention in DT spec is that a node name with "reg" property
    is formed "node-name@unit-address".
    2) With DT overlay feature, many overlays refer to the GIC node using
    the symbol under __symbols__ that we copy to hwdom 1:1. With the name
    changed, the symbol is no longer valid and requires error prone manual
    change by the user.
    
    The unit-address part of the node name always refers to the first
    address in the "reg" property which in case of GIC, always refers to
    GICD and hwdom uses host memory layout.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/domain_build.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 7b47abade1..e760198d86 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1615,6 +1615,7 @@ static int __init make_gic_node(const struct domain *d, void *fdt,
     int res = 0;
     const void *addrcells, *sizecells;
     u32 addrcells_len, sizecells_len;
+    const char *name;
 
     /*
      * Xen currently supports only a single GIC. Discard any secondary
@@ -1628,7 +1629,11 @@ static int __init make_gic_node(const struct domain *d, void *fdt,
 
     dt_dprintk("Create gic node\n");
 
-    res = fdt_begin_node(fdt, "interrupt-controller");
+    /* Use the same name as the GIC node in host device tree */
+    name = strrchr(gic->full_name, '/');
+    name = name ? name + 1 : gic->full_name;
+
+    res = fdt_begin_node(fdt, name);
     if ( res )
         return res;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:02:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:02:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900758.1308707 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHc1-0003Kj-JH; Tue, 04 Mar 2025 02:02:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900758.1308707; Tue, 04 Mar 2025 02:02:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHc1-0003Kb-GV; Tue, 04 Mar 2025 02:02:25 +0000
Received: by outflank-mailman (input) for mailman id 900758;
 Tue, 04 Mar 2025 02:02:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHc0-0003KL-1U
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:02:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHc0-0014W8-0n
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:02:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHbz-005ZPc-3B
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:02:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kGsHwsNgrJ8e+bPWJAeEuLmjjQ+f6/7Y0g32TWTzVZA=; b=yWTxJpCEc01VUPY7DxUfkc5a8F
	/GRjxh9wH/3U5uiUhEhAHch23C6FOrePIHfqgJdK8B9l3BIoLAYPYe4go0TOsAF3jVV0FYyulFlbh
	VSiOTtB6FysUOwj642hJr+9i2I+/hLIKtYywxfFULn3sVpYCR4ldCgC7zNhQHk+tZhWs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM: ITS: implement quirks and add support for Renesas Gen4 ITS
Message-Id: <E1tpHbz-005ZPc-3B@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:02:23 +0000

commit 751ec850ec1d90afbd6c361940ee85e21e9edd79
Author:     Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
AuthorDate: Wed Jan 15 09:21:43 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:12:21 2025 -0800

    ARM: ITS: implement quirks and add support for Renesas Gen4 ITS
    
    There are number of ITS implementations exist which are different from
    the base one which have number of functionalities defined as is
    "IMPLEMENTATION DEFINED", e.g. there may exist differences in cacheability,
    shareability and memory requirements and others. This requires
    appropriate handling of such HW requirements which are implemented as
    ITS quirks: GITS_IIDR (ITS Implementer Identification Register) is used to
    differentiate the ITS implementations and select appropriate set of
    quirks if any.
    
    As an example of such ITSes add quirk implementation for Renesas Gen4 ITS:
    - add possibility to override default cacheability and shareability
    settings used for ITS memory allocations;
    - change relevant memory allocations to alloc_xenheap_pages which allows
    to specify memory access flags, free_xenheap_pages is used to free;
    - add quirks validation to ensure that all ITSes share the same quirks
    in case of multiple ITSes are present in the system;
    
    The Gen4 ITS memory requirements are not covered in any errata as of yet,
    but observed behavior suggests that they are indeed required.
    
    The idea of the quirk implementation is inspired by the Linux kernel ITS
    quirk implementation [1].
    
    Changelog:
    v2 -> v3:
    - added missing memset;
    v1 -> v2:
    - switched to using alloc_xenheap_pages/free_xenheap_pages for ITS memory
    allocations;
    - updated declaration of its_quirk_flags;
    - added quirks validation to ensure that all ITSes share the same quirks;
    - removed unnecessary vITS changes;
    
    Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
    Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    
    [1] https://elixir.bootlin.com/linux/v5.16.1/source/drivers/irqchip/irq-gic-v3-its.c
---
 xen/arch/arm/gic-v3-its.c             | 141 +++++++++++++++++++++++++++++++---
 xen/arch/arm/gic-v3-lpi.c             |  23 ++++--
 xen/arch/arm/include/asm/gic_v3_its.h |   8 ++
 3 files changed, 152 insertions(+), 20 deletions(-)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 5fd83af25a..34833166ad 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -42,6 +42,7 @@ struct its_device {
     struct rb_node rbnode;
     struct host_its *hw_its;
     void *itt_addr;
+    unsigned int itt_order;
     paddr_t guest_doorbell;             /* Identifies the virtual ITS */
     uint32_t host_devid;
     uint32_t guest_devid;
@@ -50,6 +51,104 @@ struct its_device {
     struct pending_irq *pend_irqs;      /* One struct per event */
 };
 
+/*
+ * It is unlikely that a platform implements ITSes with different quirks,
+ * so assume they all share the same.
+ */
+struct its_quirk {
+    const char *desc;
+    bool (*init)(struct host_its *hw_its);
+    uint32_t iidr;
+    uint32_t mask;
+};
+
+static uint32_t __ro_after_init its_quirk_flags;
+
+static bool gicv3_its_enable_quirk_gen4(struct host_its *hw_its)
+{
+    its_quirk_flags |= HOST_ITS_WORKAROUND_NC_NS |
+        HOST_ITS_WORKAROUND_32BIT_ADDR;
+
+    return true;
+}
+
+static const struct its_quirk its_quirks[] = {
+    {
+        .desc	= "R-Car Gen4",
+        .iidr	= 0x0201743b,
+        .mask	= 0xffffffff,
+        .init	= gicv3_its_enable_quirk_gen4,
+    },
+    {
+        /* Sentinel. */
+    }
+};
+
+static struct its_quirk* gicv3_its_find_quirk(uint32_t iidr)
+{
+    const struct its_quirk *quirks = its_quirks;
+
+    for ( ; quirks->desc; quirks++ )
+    {
+        if ( quirks->iidr == (quirks->mask & iidr) )
+            return (struct its_quirk *)quirks;
+    }
+
+    return NULL;
+}
+
+static void gicv3_its_enable_quirks(struct host_its *hw_its)
+{
+    uint32_t iidr = readl_relaxed(hw_its->its_base + GITS_IIDR);
+    const struct its_quirk *quirk = gicv3_its_find_quirk(iidr);
+
+    if ( quirk && quirk->init(hw_its) )
+        printk("GICv3: enabling workaround for ITS: %s\n", quirk->desc);
+}
+
+static void gicv3_its_validate_quirks(void)
+{
+    const struct its_quirk *quirk = NULL, *prev = NULL;
+    const struct host_its *hw_its;
+
+    if ( list_empty(&host_its_list) )
+        return;
+
+    hw_its = list_first_entry(&host_its_list, struct host_its, entry);
+    prev = gicv3_its_find_quirk(readl_relaxed(hw_its->its_base + GITS_IIDR));
+
+    list_for_each_entry(hw_its, &host_its_list, entry)
+    {
+        quirk = gicv3_its_find_quirk(readl_relaxed(hw_its->its_base + GITS_IIDR));
+        BUG_ON(quirk != prev);
+        prev = quirk;
+    }
+}
+
+uint64_t gicv3_its_get_cacheability(void)
+{
+    if ( its_quirk_flags & HOST_ITS_WORKAROUND_NC_NS )
+        return GIC_BASER_CACHE_nC;
+
+    return GIC_BASER_CACHE_RaWaWb;
+}
+
+uint64_t gicv3_its_get_shareability(void)
+{
+    if ( its_quirk_flags & HOST_ITS_WORKAROUND_NC_NS )
+        return GIC_BASER_NonShareable;
+
+    return GIC_BASER_InnerShareable;
+}
+
+unsigned int gicv3_its_get_memflags(void)
+{
+    if ( its_quirk_flags & HOST_ITS_WORKAROUND_32BIT_ADDR )
+        return MEMF_bits(32);
+
+    return 0;
+}
+
 bool gicv3_its_host_has_its(void)
 {
     return !list_empty(&host_its_list);
@@ -289,19 +388,23 @@ static void *its_map_cbaser(struct host_its *its)
 {
     void __iomem *cbasereg = its->its_base + GITS_CBASER;
     uint64_t reg;
+    unsigned int order;
     void *buffer;
 
-    reg  = GIC_BASER_InnerShareable << GITS_BASER_SHAREABILITY_SHIFT;
+    reg  = gicv3_its_get_shareability() << GITS_BASER_SHAREABILITY_SHIFT;
     reg |= GIC_BASER_CACHE_SameAsInner << GITS_BASER_OUTER_CACHEABILITY_SHIFT;
-    reg |= GIC_BASER_CACHE_RaWaWb << GITS_BASER_INNER_CACHEABILITY_SHIFT;
+    reg |= gicv3_its_get_cacheability() << GITS_BASER_INNER_CACHEABILITY_SHIFT;
 
-    buffer = _xzalloc(ITS_CMD_QUEUE_SZ, SZ_64K);
+    order = get_order_from_bytes(max(ITS_CMD_QUEUE_SZ, SZ_64K));
+    buffer = alloc_xenheap_pages(order, gicv3_its_get_memflags());
     if ( !buffer )
         return NULL;
 
+    memset(buffer, 0, PAGE_SIZE << order);
+
     if ( virt_to_maddr(buffer) & ~GENMASK(51, 12) )
     {
-        xfree(buffer);
+        free_xenheap_pages(buffer, order);
         return NULL;
     }
 
@@ -340,11 +443,12 @@ static int its_map_baser(void __iomem *basereg, uint64_t regc,
     unsigned int entry_size = GITS_BASER_ENTRY_SIZE(regc);
     unsigned int pagesz = 2;    /* try 64K pages first, then go down. */
     unsigned int table_size;
+    unsigned int order;
     void *buffer;
 
-    attr  = GIC_BASER_InnerShareable << GITS_BASER_SHAREABILITY_SHIFT;
+    attr  = gicv3_its_get_shareability() << GITS_BASER_SHAREABILITY_SHIFT;
     attr |= GIC_BASER_CACHE_SameAsInner << GITS_BASER_OUTER_CACHEABILITY_SHIFT;
-    attr |= GIC_BASER_CACHE_RaWaWb << GITS_BASER_INNER_CACHEABILITY_SHIFT;
+    attr |= gicv3_its_get_cacheability() << GITS_BASER_INNER_CACHEABILITY_SHIFT;
 
     /*
      * Setup the BASE register with the attributes that we like. Then read
@@ -357,13 +461,16 @@ retry:
     /* The BASE registers support at most 256 pages. */
     table_size = min(table_size, 256U << BASER_PAGE_BITS(pagesz));
 
-    buffer = _xzalloc(table_size, BIT(BASER_PAGE_BITS(pagesz), UL));
+    order = get_order_from_bytes(max(table_size, BIT(BASER_PAGE_BITS(pagesz), U)));
+    buffer = alloc_xenheap_pages(order, gicv3_its_get_memflags());
     if ( !buffer )
         return -ENOMEM;
 
+    memset(buffer, 0, PAGE_SIZE << order);
+
     if ( !check_baser_phys_addr(buffer, BASER_PAGE_BITS(pagesz)) )
     {
-        xfree(buffer);
+        free_xenheap_pages(buffer, order);
         return -ERANGE;
     }
 
@@ -396,7 +503,7 @@ retry:
     if ( ((regc >> GITS_BASER_PAGE_SIZE_SHIFT) & 0x3UL) == pagesz )
         return 0;
 
-    xfree(buffer);
+    free_xenheap_pages(buffer, order);
 
     if ( pagesz-- > 0 )
         goto retry;
@@ -453,6 +560,8 @@ static int gicv3_its_init_single_its(struct host_its *hw_its)
     if ( ret )
         return ret;
 
+    gicv3_its_enable_quirks(hw_its);
+
     reg = readq_relaxed(hw_its->its_base + GITS_TYPER);
     hw_its->devid_bits = GITS_TYPER_DEVICE_ID_BITS(reg);
     hw_its->evid_bits = GITS_TYPER_EVENT_ID_BITS(reg);
@@ -530,7 +639,7 @@ static int remove_mapped_guest_device(struct its_device *dev)
         printk(XENLOG_WARNING "Can't unmap host ITS device 0x%x\n",
                dev->host_devid);
 
-    xfree(dev->itt_addr);
+    free_xenheap_pages(dev->itt_addr, dev->itt_order);
     xfree(dev->pend_irqs);
     xfree(dev->host_lpi_blocks);
     xfree(dev);
@@ -619,6 +728,7 @@ int gicv3_its_map_guest_device(struct domain *d,
     struct its_device *dev = NULL;
     struct rb_node **new = &d->arch.vgic.its_devices.rb_node, *parent = NULL;
     int i, ret = -ENOENT;      /* "i" must be signed to check for >= 0 below. */
+    unsigned int order;
 
     hw_its = gicv3_its_find_by_doorbell(host_doorbell);
     if ( !hw_its )
@@ -681,10 +791,13 @@ int gicv3_its_map_guest_device(struct domain *d,
     ret = -ENOMEM;
 
     /* An Interrupt Translation Table needs to be 256-byte aligned. */
-    itt_addr = _xzalloc(nr_events * hw_its->itte_size, 256);
+    order = get_order_from_bytes(max(nr_events * hw_its->itte_size, 256UL));
+    itt_addr = alloc_xenheap_pages(order, gicv3_its_get_memflags());
     if ( !itt_addr )
         goto out_unlock;
 
+    memset(itt_addr, 0, PAGE_SIZE << order);
+
     clean_and_invalidate_dcache_va_range(itt_addr,
                                          nr_events * hw_its->itte_size);
 
@@ -718,6 +831,7 @@ int gicv3_its_map_guest_device(struct domain *d,
         goto out_unlock;
 
     dev->itt_addr = itt_addr;
+    dev->itt_order = order;
     dev->hw_its = hw_its;
     dev->guest_doorbell = guest_doorbell;
     dev->guest_devid = guest_devid;
@@ -775,7 +889,8 @@ out:
         xfree(dev->pend_irqs);
         xfree(dev->host_lpi_blocks);
     }
-    xfree(itt_addr);
+    if ( itt_addr )
+        free_xenheap_pages(itt_addr, order);
     xfree(dev);
 
     return ret;
@@ -1089,6 +1204,8 @@ int gicv3_its_init(void)
             return ret;
     }
 
+    gicv3_its_validate_quirks();
+
     return 0;
 }
 
diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c
index de4b0eb4a4..de5052e5cf 100644
--- a/xen/arch/arm/gic-v3-lpi.c
+++ b/xen/arch/arm/gic-v3-lpi.c
@@ -227,6 +227,7 @@ void gicv3_lpi_update_host_entry(uint32_t host_lpi, int domain_id,
 static int gicv3_lpi_allocate_pendtable(unsigned int cpu)
 {
     void *pendtable;
+    unsigned int order;
 
     if ( per_cpu(lpi_redist, cpu).pending_table )
         return -EBUSY;
@@ -237,14 +238,16 @@ static int gicv3_lpi_allocate_pendtable(unsigned int cpu)
      * The GICv3 imposes a 64KB alignment requirement, also requires
      * physically contiguous memory.
      */
-    pendtable = _xzalloc(lpi_data.max_host_lpi_ids / 8, SZ_64K);
+    order = get_order_from_bytes(max(lpi_data.max_host_lpi_ids / 8, (unsigned long)SZ_64K));
+    pendtable = alloc_xenheap_pages(order, gicv3_its_get_memflags());
     if ( !pendtable )
         return -ENOMEM;
 
+    memset(pendtable, 0, PAGE_SIZE << order);
     /* Make sure the physical address can be encoded in the register. */
     if ( virt_to_maddr(pendtable) & ~GENMASK(51, 16) )
     {
-        xfree(pendtable);
+        free_xenheap_pages(pendtable, order);
         return -ERANGE;
     }
     clean_and_invalidate_dcache_va_range(pendtable,
@@ -272,9 +275,9 @@ static int gicv3_lpi_set_pendtable(void __iomem *rdist_base)
 
     ASSERT(!(virt_to_maddr(pendtable) & ~GENMASK(51, 16)));
 
-    val  = GIC_BASER_CACHE_RaWaWb << GICR_PENDBASER_INNER_CACHEABILITY_SHIFT;
+    val  = gicv3_its_get_cacheability() << GICR_PENDBASER_INNER_CACHEABILITY_SHIFT;
     val |= GIC_BASER_CACHE_SameAsInner << GICR_PENDBASER_OUTER_CACHEABILITY_SHIFT;
-    val |= GIC_BASER_InnerShareable << GICR_PENDBASER_SHAREABILITY_SHIFT;
+    val |= gicv3_its_get_shareability() << GICR_PENDBASER_SHAREABILITY_SHIFT;
     val |= GICR_PENDBASER_PTZ;
     val |= virt_to_maddr(pendtable);
 
@@ -300,10 +303,11 @@ static int gicv3_lpi_set_pendtable(void __iomem *rdist_base)
 static int gicv3_lpi_set_proptable(void __iomem * rdist_base)
 {
     uint64_t reg;
+    unsigned int order;
 
-    reg  = GIC_BASER_CACHE_RaWaWb << GICR_PROPBASER_INNER_CACHEABILITY_SHIFT;
+    reg  = gicv3_its_get_cacheability() << GICR_PROPBASER_INNER_CACHEABILITY_SHIFT;
     reg |= GIC_BASER_CACHE_SameAsInner << GICR_PROPBASER_OUTER_CACHEABILITY_SHIFT;
-    reg |= GIC_BASER_InnerShareable << GICR_PROPBASER_SHAREABILITY_SHIFT;
+    reg |= gicv3_its_get_shareability() << GICR_PROPBASER_SHAREABILITY_SHIFT;
 
     /*
      * The property table is shared across all redistributors, so allocate
@@ -312,7 +316,10 @@ static int gicv3_lpi_set_proptable(void __iomem * rdist_base)
     if ( !lpi_data.lpi_property )
     {
         /* The property table holds one byte per LPI. */
-        void *table = _xmalloc(lpi_data.max_host_lpi_ids, SZ_4K);
+        void *table;
+
+        order = get_order_from_bytes(max(lpi_data.max_host_lpi_ids, (unsigned long)SZ_4K));
+        table = alloc_xenheap_pages(order, gicv3_its_get_memflags());
 
         if ( !table )
             return -ENOMEM;
@@ -320,7 +327,7 @@ static int gicv3_lpi_set_proptable(void __iomem * rdist_base)
         /* Make sure the physical address can be encoded in the register. */
         if ( (virt_to_maddr(table) & ~GENMASK(51, 12)) )
         {
-            xfree(table);
+            free_xenheap_pages(table, order);
             return -ERANGE;
         }
         memset(table, GIC_PRI_IRQ | LPI_PROP_RES1, MAX_NR_HOST_LPIS);
diff --git a/xen/arch/arm/include/asm/gic_v3_its.h b/xen/arch/arm/include/asm/gic_v3_its.h
index c24d4752d0..0737e67aa6 100644
--- a/xen/arch/arm/include/asm/gic_v3_its.h
+++ b/xen/arch/arm/include/asm/gic_v3_its.h
@@ -110,6 +110,9 @@
 #define HOST_ITS_FLUSH_CMD_QUEUE        (1U << 0)
 #define HOST_ITS_USES_PTA               (1U << 1)
 
+#define HOST_ITS_WORKAROUND_NC_NS       (1U << 0)
+#define HOST_ITS_WORKAROUND_32BIT_ADDR  (1U << 1)
+
 /* We allocate LPIs on the hosts in chunks of 32 to reduce handling overhead. */
 #define LPI_BLOCK                       32U
 
@@ -197,6 +200,11 @@ struct pending_irq *gicv3_assign_guest_event(struct domain *d,
 void gicv3_lpi_update_host_entry(uint32_t host_lpi, int domain_id,
                                  uint32_t virt_lpi);
 
+/* ITS quirks handling. */
+uint64_t gicv3_its_get_cacheability(void);
+uint64_t gicv3_its_get_shareability(void);
+unsigned int gicv3_its_get_memflags(void);
+
 #else
 
 #ifdef CONFIG_ACPI
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:02:35 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:02:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900759.1308711 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHcB-0003NB-Kt; Tue, 04 Mar 2025 02:02:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900759.1308711; Tue, 04 Mar 2025 02:02:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHcB-0003N3-Hy; Tue, 04 Mar 2025 02:02:35 +0000
Received: by outflank-mailman (input) for mailman id 900759;
 Tue, 04 Mar 2025 02:02:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHcA-0003Mt-4D
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:02:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHcA-0014Y4-15
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:02:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHcA-005ZPy-0E
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:02:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zqaVJ83Ei/Wo5dkw6dvyUHzKg+T4rASabyRUlF+rwks=; b=QUpPyeDHklFgHCQNQCCJgsNzG7
	HSiqwHUF7I75GGYAQJ+x9ay9pdjdjt3sK70v0rriKP5k21UMVveuIVadx3dpdEdGsRN4l2lafGa1s
	vVClhq5qOBcullY4oJb9afCT/n7F8pIuOk0CFdPV/kbFR3U7UJVgiWGvFCPRHnlcde1A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: platform: Add support for R-Car Gen4
Message-Id: <E1tpHcA-005ZPy-0E@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:02:34 +0000

commit 336fc7a19b492390026f856643cf020829e5e9cc
Author:     Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
AuthorDate: Wed Jan 15 09:21:43 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:12:21 2025 -0800

    xen/arm: platform: Add support for R-Car Gen4
    
    Add Rcar Gen4 platform choice to Kconfig to select all required
    drivers automatically.
    
    Changelog:
    v1 -> v2:
    - Added RB from Stefano Stabellini
    
    Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/platforms/Kconfig | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/platforms/Kconfig b/xen/arch/arm/platforms/Kconfig
index 6dbf6ec87b..1a25706516 100644
--- a/xen/arch/arm/platforms/Kconfig
+++ b/xen/arch/arm/platforms/Kconfig
@@ -29,6 +29,15 @@ config RCAR3
 	help
 	Enable all the required drivers for Renesas RCar3
 
+config RCAR4
+	bool "Renesas RCar4 support"
+	depends on ARM_64
+	select HAS_SCIF
+	select HAS_ITS
+	select IPMMU_VMSA
+	help
+	Enable all the required drivers for Renesas RCar4
+
 config MPSOC
 	bool "Xilinx Ultrascale+ MPSoC support"
 	depends on ARM_64
@@ -63,4 +72,3 @@ config ALL32_PLAT
 config MPSOC_PLATFORM
 	bool
 	default (ALL64_PLAT || MPSOC)
-
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:02:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:02:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900760.1308715 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHcL-0003QB-Nu; Tue, 04 Mar 2025 02:02:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900760.1308715; Tue, 04 Mar 2025 02:02:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHcL-0003Q1-Kz; Tue, 04 Mar 2025 02:02:45 +0000
Received: by outflank-mailman (input) for mailman id 900760;
 Tue, 04 Mar 2025 02:02:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHcK-0003Pp-6j
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:02:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHcK-0014Yl-1L
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:02:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHcK-005ZSP-0V
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:02:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LgFsXQCXSsCCVbw5Ptei/WXE2lZTV0U0V58Xk4T1Du4=; b=WQHIDkw/8TTDySzWNQL5rU9hqn
	2jL9u4UKaMhSVXk/jENRrf9TV1OzWDepCPh806kv5iKE/c9y+LONFVDfDVRv/CsIh+0y1eK5BypiH
	NXMZ05Rv1yjYV7YeVLLB3WKADLBlaxqEpVi4+gQLOIfp6KF38WF+h5Vs1U13hZQ+/54I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: platform: address violation of MISRA C Rule 7.2
Message-Id: <E1tpHcK-005ZSP-0V@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:02:44 +0000

commit eed384e390e1cc9c283467249dfce64192b0ea7c
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Fri Feb 14 21:45:21 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:14:12 2025 -0800

    xen/arm: platform: address violation of MISRA C Rule 7.2
    
    Rule 7.2 states: "A u or U suffix shall be applied to all integer
    constants that are represented in an unsigned type".
    
    Some PM_* constants are unsigned quantities, despite some
    of them being representable in a signed type, so a 'U' suffix
    should be present.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/platforms/brcm-raspberry-pi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/platforms/brcm-raspberry-pi.c b/xen/arch/arm/platforms/brcm-raspberry-pi.c
index 407ec07f63..d49460329c 100644
--- a/xen/arch/arm/platforms/brcm-raspberry-pi.c
+++ b/xen/arch/arm/platforms/brcm-raspberry-pi.c
@@ -47,11 +47,11 @@ static const struct dt_device_match rpi4_blacklist_dev[] __initconst =
 };
 
 
-#define PM_PASSWORD                 0x5a000000
+#define PM_PASSWORD                 0x5a000000U
 #define PM_RSTC                     0x1c
 #define PM_WDOG                     0x24
-#define PM_RSTC_WRCFG_FULL_RESET    0x00000020
-#define PM_RSTC_WRCFG_CLR           0xffffffcf
+#define PM_RSTC_WRCFG_FULL_RESET    0x00000020U
+#define PM_RSTC_WRCFG_CLR           0xffffffcfU
 
 static void __iomem *rpi4_map_watchdog(void)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:02:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:02:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900761.1308719 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHcV-0003Sn-P6; Tue, 04 Mar 2025 02:02:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900761.1308719; Tue, 04 Mar 2025 02:02:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHcV-0003Sf-MX; Tue, 04 Mar 2025 02:02:55 +0000
Received: by outflank-mailman (input) for mailman id 900761;
 Tue, 04 Mar 2025 02:02:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHcU-0003SX-9K
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:02:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHcU-0014Yp-1b
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:02:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHcU-005ZTl-0l
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:02:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6R4tbmpF0x8mIHJGRxgoOJMjwmcXx9S4Ye6kGjTVce4=; b=aQhF91mYZ6fiGCzditZ0zwXlu4
	UUTCNpbAOPhRpTBiUvNacRHHSkvwPNsgUQbrjQBmV6iE04mCcgzULDsSVwqLnDtRJM9kn361d3JU1
	DSUDzkXkM7bhn1Nthkcwl1Swigy1ip9HhhbrMsSvmXJrzVGsSW7uW5lp5cvQ0+mJqj4M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/sched: address violation of MISRA C Rule 8.2
Message-Id: <E1tpHcU-005ZTl-0l@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:02:54 +0000

commit 8cc548251691a7ecdfd687d6e049dda3282d8de3
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Fri Feb 14 21:45:22 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:14:13 2025 -0800

    xen/sched: address violation of MISRA C Rule 8.2
    
    Rule 8.2 states: "Function types shall be in prototype form with
    named parameters".
    
    The parameter name is missing from the function pointer type
    that constitutes the first parameter.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/rt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c
index f368e0fdd5..7b1f64a779 100644
--- a/xen/common/sched/rt.c
+++ b/xen/common/sched/rt.c
@@ -500,7 +500,7 @@ deadline_queue_remove(struct list_head *queue, struct list_head *elem)
 }
 
 static inline bool
-deadline_queue_insert(struct rt_unit * (*qelem)(struct list_head *),
+deadline_queue_insert(struct rt_unit * (*qelem)(struct list_head *elem),
                       struct rt_unit *svc, struct list_head *elem,
                       struct list_head *queue)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:03:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:03:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900762.1308723 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHcf-0003VR-Qe; Tue, 04 Mar 2025 02:03:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900762.1308723; Tue, 04 Mar 2025 02:03:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHcf-0003VJ-Nw; Tue, 04 Mar 2025 02:03:05 +0000
Received: by outflank-mailman (input) for mailman id 900762;
 Tue, 04 Mar 2025 02:03:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHce-0003VB-CC
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:03:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHce-0014Z7-1r
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:03:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHce-005ZUs-11
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:03:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PtdK1Cb7UtUKqJaZUwuD+GuG6Sp4Zk8WT19p/4sZ/uc=; b=0nexTdlAfcpIqealFo+DYtZ2zL
	ohfMmsKRM5KBL0FmhGrQPuDskCyC/cX3A3B37KPjEsNJxNVJy5yQJO3kAvGzlldtP8N6Lfd9QQKxv
	cNMkOyV9MfBXJkAfaRy9iTkgaXhCRwGK2m+nUAP30AaN9EjQuxBGgTel/APkcex7p6LM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Update ECLAIR analysis configuration
Message-Id: <E1tpHce-005ZUs-11@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:03:04 +0000

commit da03249bb1a030c340a2719b817e8a03b542325a
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Fri Feb 14 21:45:23 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:14:14 2025 -0800

    automation: Update ECLAIR analysis configuration
    
    The Xen configurations for the ARM64 and X86_64 ECLAIR analyses
    is currently held in fixed files under
    'automation/eclair_analysis/xen_{arm,x86}_config'. The values
    of the configuration options there are susceptible to going stale
    due to configuration option changes.
    
    To enhance maintainability, the configuration under analysis is
    derived from the respective architecture's defconfig, with suitable
    changes added via EXTRA_XEN_CONFIG.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/prepare.sh     |   8 +-
 automation/eclair_analysis/xen_arm_config | 141 -----------------------------
 automation/eclair_analysis/xen_x86_config | 143 ------------------------------
 automation/gitlab-ci/analyze.yaml         |  68 ++++++++++++++
 4 files changed, 73 insertions(+), 287 deletions(-)

diff --git a/automation/eclair_analysis/prepare.sh b/automation/eclair_analysis/prepare.sh
index 3a646414a3..4285ff26de 100755
--- a/automation/eclair_analysis/prepare.sh
+++ b/automation/eclair_analysis/prepare.sh
@@ -25,18 +25,20 @@ fi
 export XEN_TARGET_ARCH
 
 if [ "$1" = "X86_64" ]; then
-  CONFIG_FILE="${script_dir}/xen_x86_config"
   XEN_TARGET_ARCH=x86_64
 elif [ "$1" = "ARM64" ]; then
-  CONFIG_FILE="${script_dir}/xen_arm_config"
   XEN_TARGET_ARCH=arm64
 else
   fatal "Unknown configuration: $1"
 fi
 
 (
+    make -C xen defconfig
+    if [[ -n "${EXTRA_XEN_CONFIG}" ]]; then
+        echo "${EXTRA_XEN_CONFIG}" >> xen/.config
+    fi
+
     ./configure
-    cp "${CONFIG_FILE}" xen/.config
     make clean
     find . -type f -name "*.safparse" -print -delete
     "${script_dir}/build.sh" "$1"
diff --git a/automation/eclair_analysis/xen_arm_config b/automation/eclair_analysis/xen_arm_config
deleted file mode 100644
index ef140ceb73..0000000000
--- a/automation/eclair_analysis/xen_arm_config
+++ /dev/null
@@ -1,141 +0,0 @@
-CONFIG_CC_IS_GCC=y
-CONFIG_GCC_VERSION=90400
-CONFIG_CLANG_VERSION=0
-CONFIG_LD_IS_GNU=y
-CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE=y
-CONFIG_ARM_64=y
-CONFIG_ARM=y
-CONFIG_ARCH_DEFCONFIG="arch/arm/configs/arm64_defconfig"
-
-# UBSAN
-CONFIG_UBSAN=n
-
-#
-# Architecture Features
-#
-CONFIG_ARM64_SVE=n
-CONFIG_64BIT=y
-CONFIG_NR_CPUS=4
-# CONFIG_ACPI is not set
-CONFIG_ARM_EFI=y
-CONFIG_GICV3=y
-CONFIG_HAS_ITS=y
-CONFIG_HVM=y
-# CONFIG_NEW_VGIC is not set
-CONFIG_SBSA_VUART_CONSOLE=y
-CONFIG_ARM_SSBD=y
-CONFIG_HARDEN_BRANCH_PREDICTOR=y
-CONFIG_TEE=n
-CONFIG_OPTEE=n
-CONFIG_FFA=n
-# CONFIG_STATIC_SHM is not set
-# end of Architecture Features
-
-#
-# ARM errata workaround via the alternative framework
-#
-CONFIG_ARM64_ERRATUM_827319=y
-CONFIG_ARM64_ERRATUM_824069=y
-CONFIG_ARM64_ERRATUM_819472=y
-CONFIG_ARM64_ERRATUM_843419=y
-CONFIG_ARM64_ERRATUM_832075=y
-CONFIG_ARM64_ERRATUM_834220=y
-CONFIG_ARM64_ERRATUM_1508412=y
-CONFIG_ARM_ERRATUM_858921=y
-CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y
-CONFIG_ARM64_ERRATUM_1286807=y
-# end of ARM errata workaround via the alternative framework
-
-CONFIG_ARM64_HARDEN_BRANCH_PREDICTOR=y
-# CONFIG_ALL_PLAT is not set
-# CONFIG_QEMU is not set
-# CONFIG_RCAR3 is not set
-CONFIG_MPSOC=y
-# CONFIG_NO_PLAT is not set
-CONFIG_MPSOC_PLATFORM=y
-
-#
-# Common Features
-#
-CONFIG_GRANT_TABLE=y
-CONFIG_HAS_ALTERNATIVE=y
-CONFIG_HAS_DEVICE_TREE=y
-CONFIG_HAS_FAST_MULTIPLY=y
-CONFIG_HAS_PDX=y
-CONFIG_HAS_PMAP=y
-# CONFIG_MEM_ACCESS is not set
-CONFIG_STATIC_MEMORY=y
-
-#
-# Speculative hardening
-#
-CONFIG_SPECULATIVE_HARDEN_ARRAY=y
-# end of Speculative hardening
-
-# CONFIG_HYPFS is not set
-CONFIG_IOREQ_SERVER=y
-# CONFIG_EFI_SET_VIRTUAL_ADDRESS_MAP is not set
-# CONFIG_XSM is not set
-# CONFIG_ARGO is not set
-
-#
-# Schedulers
-#
-# CONFIG_SCHED_CREDIT is not set
-CONFIG_SCHED_CREDIT2=y
-# CONFIG_SCHED_RTDS is not set
-# CONFIG_SCHED_ARINC653 is not set
-CONFIG_SCHED_NULL=y
-CONFIG_SCHED_CREDIT2_DEFAULT=y
-# CONFIG_SCHED_NULL_DEFAULT is not set
-CONFIG_SCHED_DEFAULT="credit2"
-# end of Schedulers
-
-CONFIG_BOOT_TIME_CPUPOOLS=y
-# CONFIG_LIVEPATCH is not set
-# CONFIG_ENFORCE_UNIQUE_SYMBOLS is not set
-CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS=y
-CONFIG_CMDLINE=""
-CONFIG_DOM0_MEM=""
-CONFIG_DTB_FILE=""
-# CONFIG_TRACEBUFFER is not set
-# end of Common Features
-
-#
-# Device Drivers
-#
-# CONFIG_HAS_NS16550 is not set
-CONFIG_HAS_CADENCE_UART=y
-# CONFIG_HAS_IMX_LPUART is not set
-# CONFIG_HAS_MVEBU is not set
-# CONFIG_HAS_MESON is not set
-CONFIG_HAS_PL011=y
-# CONFIG_HAS_SCIF is not set
-CONFIG_SERIAL_TX_BUFSIZE=16384
-CONFIG_HAS_PASSTHROUGH=y
-CONFIG_ARM_SMMU=y
-CONFIG_ARM_SMMU_V3=y
-# CONFIG_IPMMU_VMSA is not set
-CONFIG_IOMMU_FORCE_PT_SHARE=y
-# end of Device Drivers
-
-CONFIG_EXPERT=y
-CONFIG_UNSUPPORTED=y
-
-#
-# Debugging Options
-#
-CONFIG_DEBUG=y
-CONFIG_FRAME_POINTER=y
-CONFIG_COVERAGE=y
-CONFIG_DEBUG_LOCK_PROFILE=y
-CONFIG_DEBUG_LOCKS=y
-CONFIG_PERF_COUNTERS=y
-CONFIG_PERF_ARRAYS=y
-CONFIG_VERBOSE_DEBUG=y
-CONFIG_DEVICE_TREE_DEBUG=y
-CONFIG_SCRUB_DEBUG=y
-CONFIG_DEBUG_TRACE=y
-CONFIG_XMEM_POOL_POISON=y
-CONFIG_DEBUG_INFO=y
-# end of Debugging Options
diff --git a/automation/eclair_analysis/xen_x86_config b/automation/eclair_analysis/xen_x86_config
deleted file mode 100644
index abc44d43e1..0000000000
--- a/automation/eclair_analysis/xen_x86_config
+++ /dev/null
@@ -1,143 +0,0 @@
-CONFIG_CC_IS_GCC=y
-CONFIG_GCC_VERSION=90400
-CONFIG_CLANG_VERSION=0
-CONFIG_LD_IS_GNU=y
-CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE=y
-CONFIG_X86_64=y
-CONFIG_X86=y
-CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
-CONFIG_CC_HAS_INDIRECT_THUNK=y
-CONFIG_HAS_AS_CET_SS=y
-CONFIG_HAS_CC_CET_IBT=y
-
-CONFIG_REQUIRE_NX=n
-
-#
-# Architecture Features
-#
-CONFIG_64BIT=y
-CONFIG_NR_CPUS=16
-CONFIG_NR_NUMA_NODES=2
-# CONFIG_PV is not set
-CONFIG_HVM=y
-# CONFIG_XEN_SHSTK is not set
-# CONFIG_XEN_IBT is not set
-# CONFIG_SHADOW_PAGING is not set
-# CONFIG_BIGMEM is not set
-# CONFIG_HVM_FEP is not set
-# CONFIG_TBOOT is not set
-CONFIG_XEN_ALIGN_DEFAULT=y
-# CONFIG_XEN_ALIGN_2M is not set
-CONFIG_X2APIC_PHYSICAL=y
-# CONFIG_XEN_GUEST is not set
-# CONFIG_HYPERV_GUEST is not set
-# CONFIG_MEM_PAGING is not set
-# CONFIG_MEM_SHARING is not set
-# end of Architecture Features
-
-#
-# Common Features
-#
-CONFIG_COMPAT=y
-CONFIG_CORE_PARKING=y
-CONFIG_GRANT_TABLE=y
-CONFIG_ALTERNATIVE_CALL=y
-CONFIG_ARCH_MAP_DOMAIN_PAGE=y
-CONFIG_GENERIC_BUG_FRAME=y
-CONFIG_HAS_ALTERNATIVE=y
-CONFIG_HAS_COMPAT=y
-CONFIG_HAS_EX_TABLE=y
-CONFIG_HAS_FAST_MULTIPLY=y
-CONFIG_HAS_IOPORTS=y
-CONFIG_HAS_KEXEC=y
-CONFIG_HAS_PDX=y
-CONFIG_HAS_SCHED_GRANULARITY=y
-CONFIG_HAS_UBSAN=y
-CONFIG_MEM_ACCESS_ALWAYS_ON=y
-CONFIG_MEM_ACCESS=y
-CONFIG_NEEDS_LIBELF=y
-CONFIG_NUMA=y
-
-#
-# Speculative hardening
-#
-CONFIG_INDIRECT_THUNK=y
-CONFIG_SPECULATIVE_HARDEN_ARRAY=y
-CONFIG_SPECULATIVE_HARDEN_BRANCH=y
-# end of Speculative hardening
-
-# CONFIG_HYPFS is not set
-CONFIG_IOREQ_SERVER=y
-# CONFIG_KEXEC is not set
-# CONFIG_EFI_SET_VIRTUAL_ADDRESS_MAP is not set
-# CONFIG_XENOPROF is not set
-# CONFIG_XSM is not set
-# CONFIG_ARGO is not set
-
-#
-# Schedulers
-#
-# CONFIG_SCHED_CREDIT is not set
-CONFIG_SCHED_CREDIT2=y
-# CONFIG_SCHED_RTDS is not set
-# CONFIG_SCHED_ARINC653 is not set
-CONFIG_SCHED_NULL=y
-CONFIG_SCHED_CREDIT2_DEFAULT=y
-# CONFIG_SCHED_NULL_DEFAULT is not set
-CONFIG_SCHED_DEFAULT="credit2"
-# end of Schedulers
-
-# CONFIG_LIVEPATCH is not set
-# CONFIG_ENFORCE_UNIQUE_SYMBOLS is not set
-# CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS is not set
-CONFIG_CMDLINE=""
-CONFIG_DOM0_MEM=""
-# CONFIG_TRACEBUFFER is not set
-# end of Common Features
-
-#
-# Device Drivers
-#
-CONFIG_ACPI=y
-CONFIG_ACPI_LEGACY_TABLES_LOOKUP=y
-CONFIG_ACPI_NUMA=y
-CONFIG_HAS_NS16550=y
-CONFIG_HAS_EHCI=y
-CONFIG_SERIAL_TX_BUFSIZE=16384
-# CONFIG_XHCI is not set
-CONFIG_HAS_CPUFREQ=y
-CONFIG_HAS_PASSTHROUGH=y
-CONFIG_AMD_IOMMU=y
-# CONFIG_INTEL_IOMMU is not set
-# CONFIG_IOMMU_QUARANTINE_NONE is not set
-CONFIG_IOMMU_QUARANTINE_BASIC=y
-# CONFIG_IOMMU_QUARANTINE_SCRATCH_PAGE is not set
-CONFIG_HAS_PCI=y
-CONFIG_HAS_PCI_MSI=y
-CONFIG_VIDEO=y
-CONFIG_VGA=y
-CONFIG_HAS_VPCI=y
-# end of Device Drivers
-
-CONFIG_EXPERT=y
-CONFIG_UNSUPPORTED=y
-CONFIG_ARCH_SUPPORTS_INT128=y
-
-#
-# Debugging Options
-#
-CONFIG_DEBUG=y
-# CONFIG_CRASH_DEBUG is not set
-CONFIG_GDBSX=y
-CONFIG_FRAME_POINTER=y
-# CONFIG_COVERAGE is not set
-# CONFIG_DEBUG_LOCK_PROFILE is not set
-CONFIG_DEBUG_LOCKS=y
-# CONFIG_PERF_COUNTERS is not set
-CONFIG_VERBOSE_DEBUG=y
-CONFIG_SCRUB_DEBUG=y
-# CONFIG_UBSAN is not set
-# CONFIG_DEBUG_TRACE is not set
-CONFIG_XMEM_POOL_POISON=y
-CONFIG_DEBUG_INFO=y
-# end of Debugging Options
diff --git a/automation/gitlab-ci/analyze.yaml b/automation/gitlab-ci/analyze.yaml
index 02e0ea692c..35ff3620cf 100644
--- a/automation/gitlab-ci/analyze.yaml
+++ b/automation/gitlab-ci/analyze.yaml
@@ -40,6 +40,36 @@ eclair-x86_64:
     LOGFILE: "eclair-x86_64.log"
     VARIANT: "X86_64"
     RULESET: "monitored"
+    EXTRA_XEN_CONFIG: |
+      CONFIG_AMD=y
+      CONFIG_INTEL=n
+      CONFIG_AMD_SVM=y
+      CONFIG_INTEL_VMX=n
+      CONFIG_NR_CPUS=16
+      CONFIG_NR_NUMA_NODES=2
+      CONFIG_PV=n
+      CONFIG_XEN_IBT=n
+      CONFIG_XEN_SHSTK=n
+      CONFIG_SHADOW_PAGING=n
+      CONFIG_HVM_FEP=n
+      CONFIG_TBOOT=n
+      CONFIG_HYPFS=n
+      CONFIG_KEXEC=n
+      CONFIG_ARGO=y
+      CONFIG_SCHED_CREDIT=n
+      CONFIG_SCHED_RTDS=n
+      CONFIG_SCHED_ARINC653=n
+      CONFIG_LIVEPATCH=n
+      CONFIG_TRACEBUFFER=n
+      CONFIG_INTEL_IOMMU=n
+      CONFIG_EXPERT=y
+      CONFIG_DEBUG=y
+      CONFIG_GDBSX=n
+      CONFIG_FRAME_POINTER=n
+      CONFIG_SELF_TESTS=n
+      CONFIG_DEBUG_LOCKS=n
+      CONFIG_SCRUB_DEBUG=n
+      CONFIG_XMEM_POOL_POISON=n
 
 eclair-ARM64:
   extends: .eclair-analysis:triggered
@@ -47,6 +77,44 @@ eclair-ARM64:
     LOGFILE: "eclair-ARM64.log"
     VARIANT: "ARM64"
     RULESET: "monitored"
+    EXTRA_XEN_CONFIG: |
+      CONFIG_NR_CPUS=16
+      CONFIG_GICV2=n
+      CONFIG_GICV3=y
+      CONFIG_VGICV2=n
+      CONFIG_HAS_ITS=y
+      CONFIG_HWDOM_VUART=n
+      CONFIG_STATIC_SHM=y
+      CONFIG_STATIC_EVTCHN=y
+      CONFIG_STATIC_MEMORY=y
+      CONFIG_SCMI_SMC=n
+      CONFIG_PARTIAL_EMULATION=n
+      CONFIG_HYPFS=n
+      CONFIG_IOREQ_SERVER=y
+      CONFIG_XSM=n
+      CONFIG_ARGO=y
+      CONFIG_SCHED_CREDIT=n
+      CONFIG_SCHED_RTDS=n
+      CONFIG_SCHED_ARINC653=n
+      CONFIG_BOOT_TIME_CPUPOOLS=y
+      CONFIG_TRACEBUFFER=n
+      CONFIG_HAS_CADENCE_UART=n
+      CONFIG_HAS_NS16550=n
+      CONFIG_HAS_IMX_LPUART=n
+      CONFIG_HAS_MVEBU=n
+      CONFIG_HAS_MESON=n
+      CONFIG_HAS_OMAP=n
+      CONFIG_HAS_SCIF=n
+      CONFIG_HAS_LINFLEX=n
+      CONFIG_ARM_SMMU=n
+      CONFIG_ARM_SMMU_V3=y
+      CONFIG_EXPERT=y
+      CONFIG_DEBUG=y
+      CONFIG_FRAME_POINTER=n
+      CONFIG_SELF_TESTS=n
+      CONFIG_DEBUG_LOCKS=n
+      CONFIG_SCRUB_DEBUG=n
+      CONFIG_XMEM_POOL_POISON=n
 
 .eclair-analysis:on-schedule:
   extends: .eclair-analysis
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:03:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:03:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900763.1308726 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHcp-0003Xn-SR; Tue, 04 Mar 2025 02:03:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900763.1308726; Tue, 04 Mar 2025 02:03:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHcp-0003Xg-PR; Tue, 04 Mar 2025 02:03:15 +0000
Received: by outflank-mailman (input) for mailman id 900763;
 Tue, 04 Mar 2025 02:03:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHco-0003XX-F5
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:03:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHco-0014ZR-2B
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:03:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHco-005ZVF-1H
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:03:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9QiRegvHhhPAmI7Ypdw+8xYs1sFgL+MGg2jl/5AC2RU=; b=G60Ti5jsaHAs5JhVHDIsUEBsLQ
	mrwVAhila7FPN//ape7qd9Oo6rNmLCx47be4wT5WdxSMD4gI6AqIBq9LAndmw1hjnA+6cBrs3z82V
	52R1pdx8sLmYw9G5hn/qQCIXMOjNf21Pm9mFzQAg52SJe6PCMXX6fd5sjVh4cfmG+Tqk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: skip building domU if there is no test defined for it
Message-Id: <E1tpHco-005ZVF-1H@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:03:14 +0000

commit ae521cd96f98adc99df0d897aedd384535b7f21d
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Feb 19 03:56:51 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:15:37 2025 -0800

    automation: skip building domU if there is no test defined for it
    
    This will be useful for later tests not using generic domU (unit tests,
    xtf etc).
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
 automation/scripts/qubes-x86-64.sh | 50 +++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 19 deletions(-)

diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 8a0b7bfbc0..7eb3ce1bf7 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -144,26 +144,28 @@ disk = [ ]
 ${domU_extra_config}
 "
 
-# DomU
-mkdir -p rootfs
-cd rootfs
-# fakeroot is needed to preserve device nodes in rootless podman container
-fakeroot -s ../fakeroot-save tar xzf ../binaries/initrd.tar.gz
-mkdir proc
-mkdir run
-mkdir srv
-mkdir sys
-rm var/run
-echo "#!/bin/sh
+if [ -n "$domU_check" ]; then
+    # DomU
+    mkdir -p rootfs
+    cd rootfs
+    # fakeroot is needed to preserve device nodes in rootless podman container
+    fakeroot -s ../fakeroot-save tar xzf ../binaries/initrd.tar.gz
+    mkdir proc
+    mkdir run
+    mkdir srv
+    mkdir sys
+    rm var/run
+    echo "#!/bin/sh
 
 ${domU_check}
 " > etc/local.d/xen.start
-chmod +x etc/local.d/xen.start
-echo "rc_verbose=yes" >> etc/rc.conf
-sed -i -e 's/^Welcome/domU \0/' etc/issue
-find . | fakeroot -i ../fakeroot-save cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
-cd ..
-rm -rf rootfs
+    chmod +x etc/local.d/xen.start
+    echo "rc_verbose=yes" >> etc/rc.conf
+    sed -i -e 's/^Welcome/domU \0/' etc/issue
+    find . | fakeroot -i ../fakeroot-save cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
+    cd ..
+    rm -rf rootfs
+fi
 
 # DOM0 rootfs
 mkdir -p rootfs
@@ -188,11 +190,19 @@ ifconfig eth0 up
 ifconfig xenbr0 up
 ifconfig xenbr0 192.168.0.1
 
+" > etc/local.d/xen.start
+
+if [ -n "$domU_check" ]; then
+    echo "
 # get domU console content into test log
 tail -F /var/log/xen/console/guest-domU.log 2>/dev/null | sed -e \"s/^/(domU) /\" &
 xl create /etc/xen/domU.cfg
 ${dom0_check}
-" > etc/local.d/xen.start
+" >> etc/local.d/xen.start
+else
+    echo "${dom0_check}" >> etc/local.d/xen.start
+fi
+
 chmod +x etc/local.d/xen.start
 echo "$domU_config" > etc/xen/domU.cfg
 
@@ -201,7 +211,9 @@ echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
 echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
 cp ../binaries/bzImage boot/vmlinuz
-cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
+if [ -n "$domU_check" ]; then
+    cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
+fi
 find . | fakeroot -i ../fakeroot-save cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:03:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:03:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900764.1308730 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHcz-0003aN-Ts; Tue, 04 Mar 2025 02:03:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900764.1308730; Tue, 04 Mar 2025 02:03:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHcz-0003aF-RA; Tue, 04 Mar 2025 02:03:25 +0000
Received: by outflank-mailman (input) for mailman id 900764;
 Tue, 04 Mar 2025 02:03:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHcy-0003a5-Hf
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:03:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHcy-0014ZV-2R
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:03:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHcy-005ZVd-1b
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:03:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AOSSU6mA2NAGWeWi9FMR1TZDMkrKaNLugq0n8FVQD/k=; b=QpTUwRLTBVTnEqOMRHsbSz4N9o
	LoO7eY9DOBjFfRZKw5JzT/KgQdnGwdkp/HQwngwittJG/IJi7TQ+dk2a/hSd2VJ7y0jroiEkQw4ij
	V+vbbckm6pzerLisDcCOFSXi86dOVbSivJ5RstsIoGvoxQ2zbdDHVhNvDbcLkToLlHfg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add jobs running tests from tools/tests/*
Message-Id: <E1tpHcy-005ZVd-1b@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:03:24 +0000

commit fc10d6ecdd64c42dc4e3318ac31cd544a8d84959
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Feb 19 03:56:52 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:15:38 2025 -0800

    automation: add jobs running tests from tools/tests/*
    
    There are a bunch of tests in tools/tests/, let them run in CI.
    For each subdirectory expect "make run" will run the test, and observe
    its exit code. This way, adding new tests is easy, and they will be
    automatically picked up.
    
    For better visibility, log test output to junit xml format, and let
    gitlab ingest it. Set SUT_ADDR variable with name/address of the system
    under test, so a network can be used to extract the file. The actual
    address is set using DHCP. And for the test internal network, still add
    the 192.168.0.1 IP (but don't replace the DHCP-provided one).
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
 automation/gitlab-ci/test.yaml     | 23 +++++++++++++++++++
 automation/scripts/build           |  1 +
 automation/scripts/qubes-x86-64.sh | 28 +++++++++++++++++++++++
 automation/scripts/run-tools-tests | 47 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 99 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 6ad45269ea..e3ac689730 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -130,6 +130,7 @@
     PCIDEV: "03:00.0"
     PCIDEV_INTR: "MSI-X"
     CONSOLE_OPTS: "console=com1 com1=115200,8n1"
+    SUT_ADDR: test-2.testnet
   artifacts:
     paths:
       - smoke.serial
@@ -263,6 +264,28 @@ adl-pvshim-x86-64-gcc-debug:
     - *x86-64-test-needs
     - alpine-3.18-gcc-debug
 
+adl-tools-tests-pv-x86-64-gcc-debug:
+  extends: .adl-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh tools-tests-pv 2>&1 | tee ${LOGFILE}
+  artifacts:
+    reports:
+      junit: tests-junit.xml
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
+adl-tools-tests-pvh-x86-64-gcc-debug:
+  extends: .adl-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh tools-tests-pvh 2>&1 | tee ${LOGFILE}
+  artifacts:
+    reports:
+      junit: tests-junit.xml
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
 zen3p-smoke-x86-64-gcc-debug:
   extends: .zen3p-x86-64
   script:
diff --git a/automation/scripts/build b/automation/scripts/build
index 952599cc25..522efe774e 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -109,5 +109,6 @@ else
     # even though dist/ contains everything, while some containers don't even
     # build Xen
     cp -r dist binaries/
+    cp -r tools/tests binaries/
     collect_xen_artefacts
 fi
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 7eb3ce1bf7..7c80e0c233 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -10,6 +10,8 @@ set -ex
 #  - pci-pv         PV dom0,  PV domU + PCI Passthrough
 #  - pvshim         PV dom0,  PVSHIM domU
 #  - s3             PV dom0,  S3 suspend/resume
+#  - tools-tests-pv PV dom0, run tests from tools/tests/*
+#  - tools-tests-pvh PVH dom0, run tests from tools/tests/*
 test_variant=$1
 
 ### defaults
@@ -19,6 +21,7 @@ timeout=120
 domU_type="pvh"
 domU_vif="'bridge=xenbr0',"
 domU_extra_config=
+retrieve_xml=
 
 case "${test_variant}" in
     ### test: smoke test & smoke test PVH & smoke test HVM & smoke test PVSHIM
@@ -126,6 +129,21 @@ done
 "
         ;;
 
+    ### tests: tools-tests-pv, tools-tests-pvh
+    "tools-tests-pv"|"tools-tests-pvh")
+        retrieve_xml=1
+        passed="test passed"
+        domU_check=""
+        dom0_check="
+/tests/run-tools-tests /tests /tmp/tests-junit.xml && echo \"${passed}\"
+nc -l -p 8080 < /tmp/tests-junit.xml >/dev/null &
+"
+        if [ "${test_variant}" = "tools-tests-pvh" ]; then
+            extra_xen_opts="dom0=pvh"
+        fi
+
+        ;;
+
     *)
         echo "Unrecognised test_variant '${test_variant}'" >&2
         exit 1
@@ -178,6 +196,8 @@ mkdir srv
 mkdir sys
 rm var/run
 cp -ar ../binaries/dist/install/* .
+cp -ar ../binaries/tests .
+cp -a ../automation/scripts/run-tools-tests tests/
 
 echo "#!/bin/bash
 
@@ -192,6 +212,10 @@ ifconfig xenbr0 192.168.0.1
 
 " > etc/local.d/xen.start
 
+if [ -n "$retrieve_xml" ]; then
+    echo "timeout 30s udhcpc -i xenbr0" >> etc/local.d/xen.start
+fi
+
 if [ -n "$domU_check" ]; then
     echo "
 # get domU console content into test log
@@ -272,6 +296,10 @@ if [ $timeout -le 0 ]; then
     exit 1
 fi
 
+if [ -n "$retrieve_xml" ]; then
+    nc -w 10 "$SUT_ADDR" 8080 > tests-junit.xml </dev/null
+fi
+
 sleep 1
 
 (grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
diff --git a/automation/scripts/run-tools-tests b/automation/scripts/run-tools-tests
new file mode 100755
index 0000000000..770e97c3e9
--- /dev/null
+++ b/automation/scripts/run-tools-tests
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+usage() {
+    echo "Usage: $0 tests-dir xml-out"
+}
+
+xml_out=$2
+if [ -z "$xml_out" ]; then
+  xml_out=/dev/null
+fi
+printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$xml_out"
+printf '<testsuites name="tools.tests">\n' >> "$xml_out"
+printf ' <testsuite name="tools.tests">\n' >> "$xml_out"
+failed=
+for dir in "$1"/*; do
+    [ -d "$dir" ] || continue
+    echo "Running test in $dir"
+    printf '  <testcase name="%s">\n' "$dir" >> "$xml_out"
+    ret=
+    for f in "$dir"/*; do
+        [ -f "$f" ] || continue
+        [ -x "$f" ] || continue
+        "$f" 2>&1 | tee /tmp/out
+        ret=$?
+        if [ "$ret" -ne 0 ]; then
+            echo "FAILED: $ret"
+            failed+=" $dir"
+            printf '   <failure type="failure" message="binary %s exited with code %d">\n' "$f" "$ret" >> "$xml_out"
+            # TODO: could use xml escaping... but current tests seems to
+            # produce sane output
+            cat /tmp/out >> "$xml_out"
+            printf '   </failure>\n' >> "$xml_out"
+        else
+            echo "PASSED"
+        fi
+    done
+    if [ -z "$ret" ]; then
+        printf '   <skipped type="skipped" message="no executable test found in %s"/>\n' "$dir" >> "$xml_out"
+    fi
+    printf '  </testcase>\n' >> "$xml_out"
+done
+printf ' </testsuite>\n' >> "$xml_out"
+printf '</testsuites>\n' >> "$xml_out"
+
+if [ -n "$failed" ]; then
+    exit 1
+fi
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:03:36 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:03:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900765.1308736 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHdA-0003dN-0h; Tue, 04 Mar 2025 02:03:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900765.1308736; Tue, 04 Mar 2025 02:03:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHd9-0003dF-Tz; Tue, 04 Mar 2025 02:03:35 +0000
Received: by outflank-mailman (input) for mailman id 900765;
 Tue, 04 Mar 2025 02:03:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHd8-0003d5-K9
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:03:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHd8-0014Zg-2g
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:03:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHd8-005ZW5-1r
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:03:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pwuqIcjYA80Cm85zQA3TiotbAUE9hMeRHM5wudplz00=; b=SVGKHJWTY8LpL59zN8q+yV2sTn
	bJXmWgY7o9Qs673WcxVqTVd1OpzyxCAqx2FNqmWcwp7fuHbRBpCo8UdP5nwQJkTYDMdk7+IpEtFEi
	7Jc6g5rqveW17fmYMsnggEIswq1TDkT9cFStBXtVoqb2oymHXXckjyAl+XdwbD9rWy2I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: allow selecting individual jobs via CI variables
Message-Id: <E1tpHd8-005ZW5-1r@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:03:34 +0000

commit 9d419afa4667ba0369471c4a0e11e0717289c7bf
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Feb 19 03:56:53 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:15:38 2025 -0800

    automation: allow selecting individual jobs via CI variables
    
    Debugging sometimes involves running specific jobs on different
    versions. It's useful to easily avoid running all of the not interesting
    ones (for given case) to save both time and CI resources. Doing so used
    to require changing the yaml files, usually in several places.
    Ease this step by adding SELECTED_JOBS_ONLY variable that takes a regex.
    Note that one needs to satisfy job dependencies on their own (for
    example if a test job needs a build job, that specific build job
    needs to be included too).
    
    The variable can be specified via Gitlab web UI when scheduling a
    pipeline, but it can be also set when doing git push directly:
    
        git push -o ci.variable=SELECTED_JOBS_ONLY="/job1|job2/"
    
    More details at https://docs.gitlab.co.jp/ee/user/project/push_options.html
    
    The variable needs to include regex for selecting jobs, including
    enclosing slashes.
    A coma/space separated list of jobs to select would be friendlier UX,
    but unfortunately that is not supported:
    https://gitlab.com/gitlab-org/gitlab/-/issues/209904 (note the proposed
    workaround doesn't work for job-level CI_JOB_NAME).
    On the other hand, the regex is more flexible (one can select for
    example all arm32 jobs).
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .gitlab-ci.yml                  |  2 ++
 automation/gitlab-ci/build.yaml |  6 ++++++
 automation/gitlab-ci/test.yaml  | 14 ++++++++++++++
 3 files changed, 22 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5a9b8b7228..b3beb2ff9d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,7 @@
 variables:
   XEN_REGISTRY: registry.gitlab.com/xen-project/xen
+  SELECTED_JOBS_ONLY:
+    description: "Regex to select only some jobs, must be enclosed with /. For example /job1|job2/"
 
 workflow:
   rules:
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 5995063d77..4fd800e996 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -12,6 +12,12 @@
       - '*/*.log'
     when: always
   needs: []
+  rules:
+  - if: $SELECTED_JOBS_ONLY && $CI_JOB_NAME =~ $SELECTED_JOBS_ONLY
+    when: always
+  - if: $SELECTED_JOBS_ONLY
+    when: never
+  - when: on_success
 
 .gcc-tmpl:
   variables: &gcc
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index e3ac689730..882b545a7f 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -1,6 +1,11 @@
 .test-jobs-common:
   stage: test
   image: ${XEN_REGISTRY}/${CONTAINER}
+  rules:
+  - if: $SELECTED_JOBS_ONLY && $CI_JOB_NAME =~ $SELECTED_JOBS_ONLY
+  - if: $SELECTED_JOBS_ONLY
+    when: never
+  - when: on_success
 
 .arm64-test-needs: &arm64-test-needs
   - alpine-3.18-arm64-rootfs-export
@@ -99,6 +104,9 @@
       - '*.dtb'
     when: always
   rules:
+    - if: $SELECTED_JOBS_ONLY && $CI_JOB_NAME =~ $SELECTED_JOBS_ONLY
+    - if: $SELECTED_JOBS_ONLY
+      when: never
     - if: $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
   tags:
     - xilinx
@@ -117,6 +125,9 @@
       - '*.log'
     when: always
   rules:
+    - if: $SELECTED_JOBS_ONLY && $CI_JOB_NAME =~ $SELECTED_JOBS_ONLY
+    - if: $SELECTED_JOBS_ONLY
+      when: never
     - if: $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
   tags:
     - xilinx
@@ -137,6 +148,9 @@
       - '*.log'
     when: always
   rules:
+    - if: $SELECTED_JOBS_ONLY && $CI_JOB_NAME =~ $SELECTED_JOBS_ONLY
+    - if: $SELECTED_JOBS_ONLY
+      when: never
     - if: $QUBES_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
   tags:
     - qubes-hw2
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:03:46 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:03:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900766.1308739 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHdK-0003fp-22; Tue, 04 Mar 2025 02:03:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900766.1308739; Tue, 04 Mar 2025 02:03:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHdJ-0003fh-VY; Tue, 04 Mar 2025 02:03:45 +0000
Received: by outflank-mailman (input) for mailman id 900766;
 Tue, 04 Mar 2025 02:03:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHdI-0003fX-MZ
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:03:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHdI-0014Zo-2w
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:03:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHdI-005ZXE-26
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:03:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j0uGIXijD2tbphHyLECH5Z3r2+7ZjRObsoLzgmWi/4I=; b=MvIzol+aTFPeX+rcyd7kdy1Ire
	hNi4XUdhCcw8q7/AxbUViEvy/nANkYi+SBuAcgqErdx8T7CJiRDzQrwiThMpdLXpUQOU2RUqr7lQo
	ppcBVgQTjZ1DRWfKheboSz9afglv/jFOsUyc6ZDIFC9X27vGVHDqidGmqnQvIGE3RKto=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add tools/tests jobs on the AMD Zen3+ runner too
Message-Id: <E1tpHdI-005ZXE-26@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:03:44 +0000

commit b551aed4ab131e61a13922d07bd7d9e29d694f31
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Feb 19 03:56:54 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:15:39 2025 -0800

    automation: add tools/tests jobs on the AMD Zen3+ runner too
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
 automation/gitlab-ci/test.yaml | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 882b545a7f..9530e36e9a 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -162,6 +162,7 @@
     PCIDEV: "01:00.0"
     PCIDEV_INTR: "MSI-X"
     CONSOLE_OPTS: "console=com1 com1=115200,8n1,pci,msi"
+    SUT_ADDR: test-11.testnet
   tags:
     - qubes-hw11
 
@@ -340,6 +341,28 @@ zen3p-pvshim-x86-64-gcc-debug:
     - *x86-64-test-needs
     - alpine-3.18-gcc-debug
 
+zen3p-tools-tests-pv-x86-64-gcc-debug:
+  extends: .zen3p-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh tools-tests-pv 2>&1 | tee ${LOGFILE}
+  artifacts:
+    reports:
+      junit: tests-junit.xml
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
+zen3p-tools-tests-pvh-x86-64-gcc-debug:
+  extends: .zen3p-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh tools-tests-pvh 2>&1 | tee ${LOGFILE}
+  artifacts:
+    reports:
+      junit: tests-junit.xml
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
 qemu-smoke-dom0-arm64-gcc:
   extends: .qemu-arm64
   script:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 02:03:56 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 02:03:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900767.1308742 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHdU-0003iV-3T; Tue, 04 Mar 2025 02:03:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900767.1308742; Tue, 04 Mar 2025 02:03:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpHdU-0003iN-0j; Tue, 04 Mar 2025 02:03:56 +0000
Received: by outflank-mailman (input) for mailman id 900767;
 Tue, 04 Mar 2025 02:03:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpHdS-0003iF-PA
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 02:03:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHdS-0014Zt-3B
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:03:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpHdS-005ZXc-2L
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 02:03:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZNRAjTZWKEiJ1uMdc9ojn7Fic1hiFH8tto+1Fzp5J5Y=; b=qUVjwfuMu1GQ790v5Rvvcyzy3b
	CnN0Ru5YMOsPgFnsWIiPcpQexEVO4N7lfts04c4LuzZ8y8eoWqE4vi5eWnGfIhhajWAeOugp9uCxk
	j4IblN2ad0CNi9+JXnHRsqAC8s8NusUOWDxzHUff95PySawuva8+0T+BfH7w/4ouxq6A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: add basic CI documentation
Message-Id: <E1tpHdS-005ZXc-2L@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 02:03:54 +0000

commit 274effbec245732e910d41f61a43dc07bc3e77ce
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Feb 19 03:56:55 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Mar 3 16:15:40 2025 -0800

    docs: add basic CI documentation
    
    Include info how to get access/enable hardware runners and how to select
    individual jobs.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/index.rst   |  1 +
 docs/misc/ci.rst | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/docs/index.rst b/docs/index.rst
index 1bb8d02ea3..bd87d736b9 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -51,6 +51,7 @@ kind of development environment.
    :maxdepth: 2
 
    hypervisor-guide/index
+   misc/ci
 
 
 Unsorted documents
diff --git a/docs/misc/ci.rst b/docs/misc/ci.rst
new file mode 100644
index 0000000000..7aee55c5d2
--- /dev/null
+++ b/docs/misc/ci.rst
@@ -0,0 +1,35 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Continuous Integration
+======================
+
+Xen Project uses Gitlab-CI for automated testing. Test pipelines for official
+staging branches are at
+`<https://gitlab.com/xen-project/hardware/xen/-/pipelines>`_. Developers can
+schedule test pipelines in their repositories under
+`<https://gitlab.com/xen-project/people/>`_.
+
+Hardware runners
+****************
+
+Some of the tests are using dedicated hardware runners. Those are not available freely, but the access is granted to individual developers. To get access to them, ask on the ``#XenDevel:matrix.org`` Matrix channel.
+After getting access to relevant runners, few extra changes are necessary in settings of the relevant "xen" gitlab project (under your `<https://gitlab.com/xen-project/people/>`_ namespace):
+
+1. Go to Settings -> CI/CD, expand the "Runners" section and enable relevant runners for your project.
+2. Expand "Variables" section and add ``QUBES_JOBS=true`` variable for Qubes runners.
+3. Go to Settings -> Repository, expand "Branch rules" section and add a rule for protected branches - only those branches will get tests on the hardware runners. It's okay to use a pattern for branch name, and it's okay to allow force push.
+
+Selecting individual tests
+**************************
+
+Normally, all build and test jobs are scheduled in a pipeline. When working on a specific patches, it is sometimes useful to run only jobs relevant for the current work - both to save time and to save CI resources. This can be done by seeting ``SELECTED_JOBS_ONLY`` variable when starting the pipeline. The variable holds a regular expression, enclosed with ``/`` that matches jobs to be included. The variable can be set via the gitlab.com web UI or directly when pushing changes to gitlab::
+
+   git push -o ci.variable=SELECTED_JOBS_ONLY="/job1|job2/"
+
+Note if a test job requires some build job, both need to be included in the regex. For example, ``adl-smoke-x86-64-gcc-debug`` requires ``alpine-3.18-gcc-debug``, so to run just this test the command will look like this::
+
+   git push -o ci.variable=SELECTED_JOBS_ONLY="/adl-smoke-x86-64-gcc-debug|alpine-3.18-gcc-debug/"
+
+More details at `<https://docs.gitlab.co.jp/ee/user/project/push_options.html>`_.
+
+Alternatively, irrelevant jobs can be removed from respective yaml files in ``automation/gitlab-ci`` by adding temporary commit on top of the branch.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 09:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 09:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900876.1308837 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpOzQ-00054f-CG; Tue, 04 Mar 2025 09:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900876.1308837; Tue, 04 Mar 2025 09:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpOzQ-00054X-9i; Tue, 04 Mar 2025 09:55:04 +0000
Received: by outflank-mailman (input) for mailman id 900876;
 Tue, 04 Mar 2025 09:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpOzO-00054R-Mq
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 09:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpOzO-001FDc-2U
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 09:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpOzO-005wlO-1W
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 09:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=U0faN2UWslU4Herlf3rECJCwTXuIv2Hg+DSZAw3SSmo=; b=n+Zs+xe31kam4tBhizdBSMIwIG
	OR1+nFET9ZH/3v0RhDH7aRqUawQcAje04vfIs2KgICp/EN75w2PMwCYBtnszvw94Oflw6aeoCh/9U
	nbpvHTcu34CGO28qvUllFMYhD4j7KiuBStiOkEmYwnG4SuEFqCkTs92b8k9I0bZR0Ja0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Don't use copy_from_paddr for DTB relocation
Message-Id: <E1tpOzO-005wlO-1W@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 09:55:02 +0000

commit 2bcbcedaf9475757b3bb5104982edb2acbdd1eee
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Feb 26 21:52:56 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 4 08:54:45 2025 +0100

    xen/arm: Don't use copy_from_paddr for DTB relocation
    
    Currently the early stage of the Arm boot maps the DTB using
    early_fdt_map() using PAGE_HYPERVISOR_RO which is cacheable
    read-only memory, later during DTB relocation the function
    copy_from_paddr() is used to map pages in the same range on
    the fixmap but using PAGE_HYPERVISOR_WC which is non-cacheable
    read-write memory.
    
    The Arm specifications, ARM DDI0487L.a, section B2.11 "Mismatched
    memory attributes" discourage using mismatched attributes for
    aliases of the same location.
    
    Given that there is nothing preventing the relocation since the region
    is already mapped, fix that by open-coding copy_from_paddr inside
    relocate_fdt, without mapping on the fixmap.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/setup.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index c1f2d1b89d..ffcae900d7 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -237,16 +237,17 @@ void __init discard_initial_modules(void)
 }
 
 /* Relocate the FDT in Xen heap */
-static void * __init relocate_fdt(paddr_t dtb_paddr, size_t dtb_size)
+static void __init relocate_fdt(const void **dtb_vaddr, size_t dtb_size)
 {
     void *fdt = xmalloc_bytes(dtb_size);
 
     if ( !fdt )
         panic("Unable to allocate memory for relocating the Device-Tree.\n");
 
-    copy_from_paddr(fdt, dtb_paddr, dtb_size);
+    memcpy(fdt, *dtb_vaddr, dtb_size);
+    clean_dcache_va_range(fdt, dtb_size);
 
-    return fdt;
+    *dtb_vaddr = fdt;
 }
 
 void __init init_pdx(void)
@@ -362,7 +363,7 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
     if ( acpi_disabled )
     {
         printk("Booting using Device Tree\n");
-        device_tree_flattened = relocate_fdt(fdt_paddr, fdt_size);
+        relocate_fdt(&device_tree_flattened, fdt_size);
         dt_unflatten_host_device_tree();
     }
     else
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 09:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 09:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900877.1308842 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpOza-00056e-E7; Tue, 04 Mar 2025 09:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900877.1308842; Tue, 04 Mar 2025 09:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpOza-00056W-B8; Tue, 04 Mar 2025 09:55:14 +0000
Received: by outflank-mailman (input) for mailman id 900877;
 Tue, 04 Mar 2025 09:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpOzY-00056E-Lu
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 09:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpOzY-001FDw-2l
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 09:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpOzY-005wlw-1u
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 09:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aeqlAMl6+eJ76S/R9qeRcwXc9PoU7czYbYbdT40Oyo0=; b=V6TH8iAOet9u8y6XQR9q5pIM1s
	NMSyJOZTcG/etEHPcKhsIBBDuQY+d5vuBzRMSoSEL6tmv2gqsGF1vahqdGLqzX4TQ2J8C4vo65mq0
	p6CH1tW1B/EkOhyDcno6gomZBThFyGjqeazKP1T5jUQQCmRMIXAIDb/xgDcB1qREuKxE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: dm: Bail out if padding != 0 for XEN_DMOP_set_irq_level
Message-Id: <E1tpOzY-005wlw-1u@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 09:55:12 +0000

commit c29e5a16cb9c5331207edac5a8d495e7b22d6214
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Mar 3 09:56:47 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 4 08:54:53 2025 +0100

    xen/arm: dm: Bail out if padding != 0 for XEN_DMOP_set_irq_level
    
    XEN_DMOP_set_irq_level operation requires elements of pad array (being
    member of xen_dm_op_set_irq_level structure) to be 0. While handling the
    hypercall we validate this. If one of the elements is not zero, we set
    rc to -EINVAL. At this point we should stop further DM handling and bail
    out propagating the error to the caller. However, instead of goto the
    code uses break which has basically no meaningful effect. The rc value
    is never read and the code continues with the hypercall processing ending
    up (possibly) with the interrupt injection. Fix it.
    
    Fixes: 5d752df85f2c ("xen/dm: Introduce xendevicemodel_set_irq_level DM op")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/dm.c b/xen/arch/arm/dm.c
index 773a0a2592..fdb3d967ec 100644
--- a/xen/arch/arm/dm.c
+++ b/xen/arch/arm/dm.c
@@ -93,7 +93,7 @@ int dm_op(const struct dmop_args *op_args)
             if ( data->pad[i] )
             {
                 rc = -EINVAL;
-                break;
+                goto out;
             }
         }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 09:55:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 09:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900878.1308845 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpOzk-00059P-G7; Tue, 04 Mar 2025 09:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900878.1308845; Tue, 04 Mar 2025 09:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpOzk-00059G-CX; Tue, 04 Mar 2025 09:55:24 +0000
Received: by outflank-mailman (input) for mailman id 900878;
 Tue, 04 Mar 2025 09:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpOzi-000594-Qg
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 09:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpOzi-001FE0-38
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 09:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpOzi-005wmP-2B
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 09:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cOuFMMgrq2s2mf0X1wYm2eyJEaKRwc03CNjGnH2fr2s=; b=dMAeEqPhDeBT+jHOGkd/bmHX+C
	sNJg4qx5POI6EHT544G0elSOtCWku+afhX5r7o5wVkFYG9JawiqqMbaHIhGAfJuAZCyYS3aOqui5c
	6WjT28xZhwRFJqn/z5nSJ0xmeFV5M9WXL5MCTbs63t/4xFlniruHUDS09O1uFuq+hLtQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Check return code from fdt_finish_reservemap()
Message-Id: <E1tpOzi-005wmP-2B@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 09:55:22 +0000

commit dd0f6ea412a60b4a2efbebace21e2de02c6d3502
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Mar 3 09:56:48 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 4 08:54:53 2025 +0100

    xen/arm: Check return code from fdt_finish_reservemap()
    
    fdt_finish_reservemap() may fail (with -FDT_ERR_NOSPACE) in which case
    further DTB creation (in prepare_dtb_hwdom()) makes no sense. Fix it.
    
    Fixes: 13bb63b754e4 ("device tree,arm: supply a flat device tree to dom0")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/domain_build.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index e760198d86..fea1382d49 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2038,7 +2038,9 @@ static int __init prepare_dtb_hwdom(struct domain *d, struct kernel_info *kinfo)
     if ( ret < 0 )
         goto err;
 
-    fdt_finish_reservemap(kinfo->fdt);
+    ret = fdt_finish_reservemap(kinfo->fdt);
+    if ( ret )
+        goto err;
 
     ret = handle_node(d, kinfo, dt_host, default_p2mt);
     if ( ret )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 09:55:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 09:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900879.1308848 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpOzu-0005CL-Gg; Tue, 04 Mar 2025 09:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900879.1308848; Tue, 04 Mar 2025 09:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpOzu-0005CD-Dv; Tue, 04 Mar 2025 09:55:34 +0000
Received: by outflank-mailman (input) for mailman id 900879;
 Tue, 04 Mar 2025 09:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpOzs-0005Bf-Rv
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 09:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpOzt-001FE6-0B
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 09:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpOzs-005wn6-2X
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 09:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=22NdevWAcn8iKT4Ms+2N3g/fjGDiPF1sFOLtjzbGB+o=; b=XD5yciY3wnXFc/pRLF+BgjEL3i
	AzJWemfo1gCelXDKnJMKWuwqSxwuMO/3X0A3a9TA61me9R3JLk7bE3/lCA8IkhTyWZELEh9dFlFvr
	+8ndvwG1hlhfmBUoWye/ZaI6SeT/s+UW3WD0O8z1BbuNnFUBS0n5haDoykdbbPjnROcY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: static-shmem: Drop unused size_cells
Message-Id: <E1tpOzs-005wn6-2X@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 09:55:32 +0000

commit dead72ba933de7d7c2ddf2eaf2b6eb11fdeb1dc6
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Mar 3 09:56:49 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 4 08:54:53 2025 +0100

    xen/arm: static-shmem: Drop unused size_cells
    
    Value stored in size_cells is never read because we're only interested
    in retrieving gbase address of shmem region for which we only need
    address cells.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/static-shmem.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/arm/static-shmem.c b/xen/arch/arm/static-shmem.c
index 8f87154c35..c74fa13d48 100644
--- a/xen/arch/arm/static-shmem.c
+++ b/xen/arch/arm/static-shmem.c
@@ -302,7 +302,7 @@ int __init process_shm(struct domain *d, struct kernel_info *kinfo,
         const struct membank *boot_shm_bank;
         const struct dt_property *prop;
         const __be32 *cells;
-        uint32_t addr_cells, size_cells;
+        uint32_t addr_cells;
         paddr_t gbase, pbase, psize;
         int ret = 0;
         unsigned int i;
@@ -338,7 +338,6 @@ int __init process_shm(struct domain *d, struct kernel_info *kinfo,
          * pbase is optional.
          */
         addr_cells = dt_n_addr_cells(shm_node);
-        size_cells = dt_n_size_cells(shm_node);
         prop = dt_find_property(shm_node, "xen,shared-mem", NULL);
         BUG_ON(!prop);
         cells = (const __be32 *)prop->value;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 09:55:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 09:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900884.1308852 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpP04-0005FN-Iz; Tue, 04 Mar 2025 09:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900884.1308852; Tue, 04 Mar 2025 09:55:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpP04-0005FG-GZ; Tue, 04 Mar 2025 09:55:44 +0000
Received: by outflank-mailman (input) for mailman id 900884;
 Tue, 04 Mar 2025 09:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpP02-0005F8-UD
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 09:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpP03-001FEv-0T
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 09:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpP02-005wnf-2p
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 09:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g+83K8xoKj6G7Beci4srGOlNMglm2F2rJZ+3zI5DUpA=; b=664nOgV7W7XtZGHU9xA1Jf/25e
	qyggQHvk3Uj0XMY/OnbSanVRCUbdyeo2pBsc9eKlW/bwN2kh73LT2s6KlX2oWDs/SnRwcQKLc0yT5
	fG2Mvw50UAh60g9vAklo5LTrC2bdWAvydgaPj0hB6hib/pyFgZHfXuIbIeq0Ckxwr9cE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Don't blindly print hwdom in generic panic messages
Message-Id: <E1tpP02-005wnf-2p@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 09:55:42 +0000

commit 23bb5f1a112bb0a3cd4bec57b5b9d7a6b0726cae
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Mar 3 09:56:50 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 4 08:54:53 2025 +0100

    xen/arm: Don't blindly print hwdom in generic panic messages
    
    These functions are generic and used not only for hardware domain. This
    creates confusion when printing any of these panic messages (e.g.
    failure when loading domU kernel would result in informing a user about
    a failure in loading hwdom kernel).
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/domain_build.c | 4 ++--
 xen/arch/arm/kernel.c       | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index fea1382d49..d4570bc0b4 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2117,12 +2117,12 @@ static void __init initrd_load(struct kernel_info *kinfo)
 
     initrd = ioremap_wc(paddr, len);
     if ( !initrd )
-        panic("Unable to map the hwdom initrd\n");
+        panic("Unable to map the %pd initrd\n", kinfo->d);
 
     res = copy_to_guest_phys_flush_dcache(kinfo->d, load_addr,
                                           initrd, len);
     if ( res != 0 )
-        panic("Unable to copy the initrd in the hwdom memory\n");
+        panic("Unable to copy the initrd in the %pd memory\n", kinfo->d);
 
     iounmap(initrd);
 }
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 80fad8b336..6eaf9e2b06 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -150,12 +150,12 @@ static void __init kernel_zimage_load(struct kernel_info *info)
 
     kernel = ioremap_wc(paddr, len);
     if ( !kernel )
-        panic("Unable to map the hwdom kernel\n");
+        panic("Unable to map the %pd kernel\n", info->d);
 
     rc = copy_to_guest_phys_flush_dcache(info->d, load_addr,
                                          kernel, len);
     if ( rc != 0 )
-        panic("Unable to copy the kernel in the hwdom memory\n");
+        panic("Unable to copy the kernel in the %pd memory\n", info->d);
 
     iounmap(kernel);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 09:55:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 09:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900885.1308857 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpP0E-0005HW-KY; Tue, 04 Mar 2025 09:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900885.1308857; Tue, 04 Mar 2025 09:55:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpP0E-0005HO-I3; Tue, 04 Mar 2025 09:55:54 +0000
Received: by outflank-mailman (input) for mailman id 900885;
 Tue, 04 Mar 2025 09:55:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpP0D-0005HD-1E
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 09:55:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpP0D-001FGe-0m
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 09:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpP0C-005wo9-36
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 09:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wBqWr5Kv0GwQxggt7YMSxKZO6QKsdT+d66RamQQSY2E=; b=qPOAlNAVtOuRoYc4NV7d3D9kqp
	zu6dmAdinN7wA5fNUvP8+x3apdPRqwJJeZZBNZ1zs0J8Sxpmhm9OYQy5/GwCud3HLoNfSwyw5ZL8h
	YY4MzNjrE7UdA1VejW0ZMJ99UBtu5l590ulyrFBfDniz0IhNL2XHIcKy2py4tVARI67g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Fix platforms Kconfig indent
Message-Id: <E1tpP0C-005wo9-36@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 09:55:52 +0000

commit 0ddbaba408c16ebfa0b7e61da2b2e76735e6ad4d
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Mon Mar 3 11:27:15 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 4 08:54:53 2025 +0100

    xen/arm: Fix platforms Kconfig indent
    
    Fix platforms/Kconfig and Kconfig.debug help indent to respect the
    standard (tab + 2 spaces).
    While there also move some default in Kconfig.debug before the help
    message.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/Kconfig.debug     | 82 +++++++++++++++++++++---------------------
 xen/arch/arm/platforms/Kconfig | 20 +++++------
 2 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/xen/arch/arm/Kconfig.debug b/xen/arch/arm/Kconfig.debug
index 84a0616102..5a03b220ac 100644
--- a/xen/arch/arm/Kconfig.debug
+++ b/xen/arch/arm/Kconfig.debug
@@ -2,85 +2,85 @@ choice
 	bool "Early printk"
 	optional
 	help
-		You may want to enable early printk if you are debugging code
-		that executes before the console is initialized.
+	  You may want to enable early printk if you are debugging code
+	  that executes before the console is initialized.
 
-		Note that selecting this option will limit Xen to a single UART
-		definition. Attempting to boot Xen image on a different
-		platform *will not work*, so this option should not be enable
-		for Xens that are intended to be portable.
+	  Note that selecting this option will limit Xen to a single UART
+	  definition. Attempting to boot Xen image on a different
+	  platform *will not work*, so this option should not be enable
+	  for Xens that are intended to be portable.
 
-		Choose one of the UART drivers for early printk, then you'll
-		have to specify the parameters, like the base address.
+	  Choose one of the UART drivers for early printk, then you'll
+	  have to specify the parameters, like the base address.
 
 	config EARLY_UART_CHOICE_8250
 		select EARLY_UART_8250
 		bool "Early printk via 8250 UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a 8250 UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a 8250 UART.
 
 	config EARLY_UART_CHOICE_CADENCE
 		select EARLY_UART_CADENCE
 		depends on ARM_64
 		bool "Early printk via Cadence UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a Cadence UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a Cadence UART.
 
 	config EARLY_UART_CHOICE_EXYNOS4210
 		select EARLY_UART_EXYNOS4210
 		depends on ARM_32
 		bool "Early printk via Exynos4210 UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a Exynos 4210 UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a Exynos 4210 UART.
 
 	config EARLY_UART_CHOICE_IMX_LPUART
 		select EARLY_UART_IMX_LPUART
 		depends on ARM_64
 		bool "Early printk via i.MX LPUART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a i.MX LPUART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a i.MX LPUART.
 
 	config EARLY_UART_CHOICE_LINFLEX
 		select EARLY_UART_LINFLEX
 		depends on ARM_64
 		bool "Early printk via NXP LINFlexD UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to an NXP LINFlexD UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to an NXP LINFlexD UART.
 
 	config EARLY_UART_CHOICE_MESON
 		select EARLY_UART_MESON
 		depends on ARM_64
 		bool "Early printk via MESON UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a MESON UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a MESON UART.
 
 	config EARLY_UART_CHOICE_MVEBU
 		select EARLY_UART_MVEBU
 		depends on ARM_64
 		bool "Early printk via MVEBU UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a MVEBU UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a MVEBU UART.
 
 	config EARLY_UART_CHOICE_PL011
 		select EARLY_UART_PL011
 		bool "Early printk via PL011 UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a PL011 UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a PL011 UART.
 
 	config EARLY_UART_CHOICE_SCIF
 		select EARLY_UART_SCIF
 		bool "Early printk via SCIF UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a SCIF UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a SCIF UART.
 
 endchoice
 
@@ -131,15 +131,14 @@ config EARLY_UART_SIZE
 config EARLY_UART_PL011_BAUD_RATE
 	depends on EARLY_UART_PL011
 	int "Early printk UART baud rate for pl011"
+	default 0
 	help
-		Optionally sets the baud rate which should be used to configure
-		the UART at start of day.
-
-		If EARLY_UART_PL011_BAUD_RATE is set to 0 then the code will
-		not try to initialize the UART, so that bootloader or firmware
-		settings can be used for maximum compatibility.
+	  Optionally sets the baud rate which should be used to configure
+	  the UART at start of day.
 
-	default 0
+	  If EARLY_UART_PL011_BAUD_RATE is set to 0 then the code will
+	  not try to initialize the UART, so that bootloader or firmware
+	  settings can be used for maximum compatibility.
 
 config EARLY_UART_PL011_MMIO32
 	bool "32-bit only MMIO for PL011 early printk"
@@ -155,24 +154,25 @@ config EARLY_UART_INIT
 config EARLY_UART_8250_REG_SHIFT
 	depends on EARLY_UART_8250
 	int "Early printk, left-shift to apply to the register offsets within the 8250 UART"
+	default 0
 	help
-		EARLY_UART_8250_REG_SHIFT is, optionally, the left-shift to
-		apply to the register offsets within the UART with early
-		printk.
+	  EARLY_UART_8250_REG_SHIFT is, optionally, the left-shift to
+	  apply to the register offsets within the UART with early
+	  printk.
 
-		Default to 0.
+	  Default to 0.
 
-	default 0
 
 choice EARLY_UART_SCIF_VERSION
 	prompt "Early printk UART SCIF interface version"
 	depends on EARLY_UART_SCIF
 	default EARLY_UART_SCIF_VERSION_NONE
 	help
-		Select the interface version of the SCIF UART.
+	  Select the interface version of the SCIF UART.
+
+	  Select EARLY_UART_SCIF_VERSION_NONE to use the default
+	  interface version (SCIF).
 
-		Select EARLY_UART_SCIF_VERSION_NONE to use the default
-		interface version (SCIF).
 	config EARLY_UART_SCIF_VERSION_NONE
 		bool "default SCIF UART interface"
 	config EARLY_UART_SCIF_VERSION_A
diff --git a/xen/arch/arm/platforms/Kconfig b/xen/arch/arm/platforms/Kconfig
index 1a25706516..87bf614788 100644
--- a/xen/arch/arm/platforms/Kconfig
+++ b/xen/arch/arm/platforms/Kconfig
@@ -2,15 +2,15 @@ choice
 	prompt "Platform Support" if MMU
 	default ALL_PLAT
 	help
-	Choose which hardware platform to enable in Xen.
+	  Choose which hardware platform to enable in Xen.
 
-	If unsure, choose ALL_PLAT.
+	  If unsure, choose ALL_PLAT.
 
 config ALL_PLAT
 	bool "All Platforms"
 	help
-	Enable support for all available hardware platforms. It doesn't
-	automatically select any of the related drivers.
+	  Enable support for all available hardware platforms. It doesn't
+	  automatically select any of the related drivers.
 
 config QEMU
 	bool "QEMU aarch virt machine support"
@@ -18,8 +18,8 @@ config QEMU
 	select GICV3
 	select HAS_PL011
 	help
-	Enable all the required drivers for QEMU aarch64 virt emulated
-	machine.
+	  Enable all the required drivers for QEMU aarch64 virt emulated
+	  machine.
 
 config RCAR3
 	bool "Renesas RCar3 support"
@@ -27,7 +27,7 @@ config RCAR3
 	select HAS_SCIF
 	select IPMMU_VMSA
 	help
-	Enable all the required drivers for Renesas RCar3
+	  Enable all the required drivers for Renesas RCar3
 
 config RCAR4
 	bool "Renesas RCar4 support"
@@ -44,7 +44,7 @@ config MPSOC
 	select HAS_CADENCE_UART
 	select ARM_SMMU
 	help
-	Enable all the required drivers for Xilinx Ultrascale+ MPSoC
+	  Enable all the required drivers for Xilinx Ultrascale+ MPSoC
 
 config S32G3
 	bool "NXP S32G3 Processors support"
@@ -52,12 +52,12 @@ config S32G3
 	select HAS_LINFLEX
 	select SCMI_SMC
 	help
-	Enable all the required drivers for NXP S32G3 Processors Family
+	  Enable all the required drivers for NXP S32G3 Processors Family
 
 config NO_PLAT
 	bool "No Platforms"
 	help
-	Do not enable specific support for any platform.
+	  Do not enable specific support for any platform.
 
 endchoice
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 10:55:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 10:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900934.1308900 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpPvU-0008Q7-Ks; Tue, 04 Mar 2025 10:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900934.1308900; Tue, 04 Mar 2025 10:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpPvU-0008Q2-II; Tue, 04 Mar 2025 10:55:04 +0000
Received: by outflank-mailman (input) for mailman id 900934;
 Tue, 04 Mar 2025 10:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpPvS-0008Pi-O6
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 10:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpPvS-001GSt-26
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 10:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpPvS-005z7c-18
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 10:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CGv5mPsf4w0AdkwwmOwyLr0lt+ZEbp4+7W1+syb532k=; b=MRWWznXsCJYjubPKzvEcBs7kSm
	raWREq3SVLAVKtEGszEJ9xRMLcp937ebo3+7YYwZadZPp167r+z88LnEgmSwj2ndUGhBjuVvPe98U
	PtpEKoWXCRqRdEB64oj+Aje0rh1duiijSwWbYeX+v/eY1mb5Q5TXOPP8YtRw7YZCP2JI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Don't use copy_from_paddr for DTB relocation
Message-Id: <E1tpPvS-005z7c-18@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 10:55:02 +0000

commit 2bcbcedaf9475757b3bb5104982edb2acbdd1eee
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Feb 26 21:52:56 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 4 08:54:45 2025 +0100

    xen/arm: Don't use copy_from_paddr for DTB relocation
    
    Currently the early stage of the Arm boot maps the DTB using
    early_fdt_map() using PAGE_HYPERVISOR_RO which is cacheable
    read-only memory, later during DTB relocation the function
    copy_from_paddr() is used to map pages in the same range on
    the fixmap but using PAGE_HYPERVISOR_WC which is non-cacheable
    read-write memory.
    
    The Arm specifications, ARM DDI0487L.a, section B2.11 "Mismatched
    memory attributes" discourage using mismatched attributes for
    aliases of the same location.
    
    Given that there is nothing preventing the relocation since the region
    is already mapped, fix that by open-coding copy_from_paddr inside
    relocate_fdt, without mapping on the fixmap.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/setup.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index c1f2d1b89d..ffcae900d7 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -237,16 +237,17 @@ void __init discard_initial_modules(void)
 }
 
 /* Relocate the FDT in Xen heap */
-static void * __init relocate_fdt(paddr_t dtb_paddr, size_t dtb_size)
+static void __init relocate_fdt(const void **dtb_vaddr, size_t dtb_size)
 {
     void *fdt = xmalloc_bytes(dtb_size);
 
     if ( !fdt )
         panic("Unable to allocate memory for relocating the Device-Tree.\n");
 
-    copy_from_paddr(fdt, dtb_paddr, dtb_size);
+    memcpy(fdt, *dtb_vaddr, dtb_size);
+    clean_dcache_va_range(fdt, dtb_size);
 
-    return fdt;
+    *dtb_vaddr = fdt;
 }
 
 void __init init_pdx(void)
@@ -362,7 +363,7 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
     if ( acpi_disabled )
     {
         printk("Booting using Device Tree\n");
-        device_tree_flattened = relocate_fdt(fdt_paddr, fdt_size);
+        relocate_fdt(&device_tree_flattened, fdt_size);
         dt_unflatten_host_device_tree();
     }
     else
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 10:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 10:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900935.1308904 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpPvd-0008T0-ME; Tue, 04 Mar 2025 10:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900935.1308904; Tue, 04 Mar 2025 10:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpPvd-0008Ss-Jf; Tue, 04 Mar 2025 10:55:13 +0000
Received: by outflank-mailman (input) for mailman id 900935;
 Tue, 04 Mar 2025 10:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpPvc-0008Sb-KC
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 10:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpPvc-001GTN-2V
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 10:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpPvc-005z81-1W
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 10:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=D/TVDl+7j1PcCgwsjGfHDiCcH+9ulVW38NQInycHnrk=; b=szvOLlZzJePsZe5kwCxhrmnxLv
	ildI8P7NrsodIfGdoXn9GZy5/tTgYlDRI7+go3my38dW3KoENdCEcTiqoOZ4c+vliFnOeYHCncYTo
	GEmZ7MJnrRWKN2jXZZx9TCPwNM7N34/QT6GuFj7v2x5jlBYH5PPuhdkqBLmPjikF6dKs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: dm: Bail out if padding != 0 for XEN_DMOP_set_irq_level
Message-Id: <E1tpPvc-005z81-1W@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 10:55:12 +0000

commit c29e5a16cb9c5331207edac5a8d495e7b22d6214
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Mar 3 09:56:47 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 4 08:54:53 2025 +0100

    xen/arm: dm: Bail out if padding != 0 for XEN_DMOP_set_irq_level
    
    XEN_DMOP_set_irq_level operation requires elements of pad array (being
    member of xen_dm_op_set_irq_level structure) to be 0. While handling the
    hypercall we validate this. If one of the elements is not zero, we set
    rc to -EINVAL. At this point we should stop further DM handling and bail
    out propagating the error to the caller. However, instead of goto the
    code uses break which has basically no meaningful effect. The rc value
    is never read and the code continues with the hypercall processing ending
    up (possibly) with the interrupt injection. Fix it.
    
    Fixes: 5d752df85f2c ("xen/dm: Introduce xendevicemodel_set_irq_level DM op")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/dm.c b/xen/arch/arm/dm.c
index 773a0a2592..fdb3d967ec 100644
--- a/xen/arch/arm/dm.c
+++ b/xen/arch/arm/dm.c
@@ -93,7 +93,7 @@ int dm_op(const struct dmop_args *op_args)
             if ( data->pad[i] )
             {
                 rc = -EINVAL;
-                break;
+                goto out;
             }
         }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 10:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 10:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900936.1308909 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpPvn-0008WK-Nr; Tue, 04 Mar 2025 10:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900936.1308909; Tue, 04 Mar 2025 10:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpPvn-0008WC-L5; Tue, 04 Mar 2025 10:55:23 +0000
Received: by outflank-mailman (input) for mailman id 900936;
 Tue, 04 Mar 2025 10:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpPvm-0008Vy-Mo
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 10:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpPvm-001GTT-2u
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 10:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpPvm-005z8P-1v
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 10:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aRn+zW2t+U5X2uzya6NY21/t6IMXji9CsprDK9RyA6U=; b=YrsKdLUU8EMoYpUW3rwDT2C9QM
	edz1wzjJhXIiQo6QMfth0cylV1oI8yvbLLQf6oQgoxsaznkmcNS95kqSAS4X+quXIpM+EvqB7EZt/
	9Lo5moK3aIFhJlooj51xL+jOCh/mT8JHrrdurjrrGig3MV1RlZJc1iNIReD+9cddHT4E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Check return code from fdt_finish_reservemap()
Message-Id: <E1tpPvm-005z8P-1v@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 10:55:22 +0000

commit dd0f6ea412a60b4a2efbebace21e2de02c6d3502
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Mar 3 09:56:48 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 4 08:54:53 2025 +0100

    xen/arm: Check return code from fdt_finish_reservemap()
    
    fdt_finish_reservemap() may fail (with -FDT_ERR_NOSPACE) in which case
    further DTB creation (in prepare_dtb_hwdom()) makes no sense. Fix it.
    
    Fixes: 13bb63b754e4 ("device tree,arm: supply a flat device tree to dom0")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/domain_build.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index e760198d86..fea1382d49 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2038,7 +2038,9 @@ static int __init prepare_dtb_hwdom(struct domain *d, struct kernel_info *kinfo)
     if ( ret < 0 )
         goto err;
 
-    fdt_finish_reservemap(kinfo->fdt);
+    ret = fdt_finish_reservemap(kinfo->fdt);
+    if ( ret )
+        goto err;
 
     ret = handle_node(d, kinfo, dt_host, default_p2mt);
     if ( ret )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 10:55:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 10:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900937.1308913 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpPvy-00007j-P8; Tue, 04 Mar 2025 10:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900937.1308913; Tue, 04 Mar 2025 10:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpPvy-00007Z-MT; Tue, 04 Mar 2025 10:55:34 +0000
Received: by outflank-mailman (input) for mailman id 900937;
 Tue, 04 Mar 2025 10:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpPvw-00007P-Q5
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 10:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpPvx-001GTX-03
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 10:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpPvw-005zAJ-2J
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 10:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=53WKifxxaSqyzxew+0kkvwaQgBKsZza7JcI8AR2cThA=; b=bpRay6KP0sNDoSlee7lZKmA4f+
	c1K9bbmSgTkJbX38RHmAKl637dsl7t9MyCpOPtJqx/nkHDZNYIgS+Xir0PU9K+QdOi7a7qmY1mEDX
	hiwIRhp0sgqrbJOIEauHaMX5HJUnLIqMHnNAvP4nNGUXwQKrhq5TbQ8SE2XdxVUtkdFU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: static-shmem: Drop unused size_cells
Message-Id: <E1tpPvw-005zAJ-2J@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 10:55:32 +0000

commit dead72ba933de7d7c2ddf2eaf2b6eb11fdeb1dc6
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Mar 3 09:56:49 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 4 08:54:53 2025 +0100

    xen/arm: static-shmem: Drop unused size_cells
    
    Value stored in size_cells is never read because we're only interested
    in retrieving gbase address of shmem region for which we only need
    address cells.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/static-shmem.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/arm/static-shmem.c b/xen/arch/arm/static-shmem.c
index 8f87154c35..c74fa13d48 100644
--- a/xen/arch/arm/static-shmem.c
+++ b/xen/arch/arm/static-shmem.c
@@ -302,7 +302,7 @@ int __init process_shm(struct domain *d, struct kernel_info *kinfo,
         const struct membank *boot_shm_bank;
         const struct dt_property *prop;
         const __be32 *cells;
-        uint32_t addr_cells, size_cells;
+        uint32_t addr_cells;
         paddr_t gbase, pbase, psize;
         int ret = 0;
         unsigned int i;
@@ -338,7 +338,6 @@ int __init process_shm(struct domain *d, struct kernel_info *kinfo,
          * pbase is optional.
          */
         addr_cells = dt_n_addr_cells(shm_node);
-        size_cells = dt_n_size_cells(shm_node);
         prop = dt_find_property(shm_node, "xen,shared-mem", NULL);
         BUG_ON(!prop);
         cells = (const __be32 *)prop->value;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 10:55:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 10:55:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900938.1308917 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpPw8-0000Ai-Qb; Tue, 04 Mar 2025 10:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900938.1308917; Tue, 04 Mar 2025 10:55:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpPw8-0000AZ-Nt; Tue, 04 Mar 2025 10:55:44 +0000
Received: by outflank-mailman (input) for mailman id 900938;
 Tue, 04 Mar 2025 10:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpPw6-0000AM-Tj
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 10:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpPw7-001GTd-0P
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 10:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpPw6-005zB7-2h
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 10:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dW2J8D5519wbRFv1gSR3dk4K1F8nDKBxIZs3b5s3pSQ=; b=5YNq4R4r1M5sNK+KvsFHZTufjX
	qRvDQPbrM4e2wXtmA3QB6Ur9NU2dKCsuBv3wM7wOLohNXoVOnbudhnMLfjDV2IhoUESoby9D3tZ82
	9wLjc1PdFWLdufVv4tmY1pjS7seR9jtzmofZqiRglV3YynAskNcMKvKpBuocVjvNiiFA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Don't blindly print hwdom in generic panic messages
Message-Id: <E1tpPw6-005zB7-2h@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 10:55:42 +0000

commit 23bb5f1a112bb0a3cd4bec57b5b9d7a6b0726cae
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Mar 3 09:56:50 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 4 08:54:53 2025 +0100

    xen/arm: Don't blindly print hwdom in generic panic messages
    
    These functions are generic and used not only for hardware domain. This
    creates confusion when printing any of these panic messages (e.g.
    failure when loading domU kernel would result in informing a user about
    a failure in loading hwdom kernel).
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/domain_build.c | 4 ++--
 xen/arch/arm/kernel.c       | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index fea1382d49..d4570bc0b4 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2117,12 +2117,12 @@ static void __init initrd_load(struct kernel_info *kinfo)
 
     initrd = ioremap_wc(paddr, len);
     if ( !initrd )
-        panic("Unable to map the hwdom initrd\n");
+        panic("Unable to map the %pd initrd\n", kinfo->d);
 
     res = copy_to_guest_phys_flush_dcache(kinfo->d, load_addr,
                                           initrd, len);
     if ( res != 0 )
-        panic("Unable to copy the initrd in the hwdom memory\n");
+        panic("Unable to copy the initrd in the %pd memory\n", kinfo->d);
 
     iounmap(initrd);
 }
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 80fad8b336..6eaf9e2b06 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -150,12 +150,12 @@ static void __init kernel_zimage_load(struct kernel_info *info)
 
     kernel = ioremap_wc(paddr, len);
     if ( !kernel )
-        panic("Unable to map the hwdom kernel\n");
+        panic("Unable to map the %pd kernel\n", info->d);
 
     rc = copy_to_guest_phys_flush_dcache(info->d, load_addr,
                                          kernel, len);
     if ( rc != 0 )
-        panic("Unable to copy the kernel in the hwdom memory\n");
+        panic("Unable to copy the kernel in the %pd memory\n", info->d);
 
     iounmap(kernel);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 10:55:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 10:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.900939.1308921 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpPwI-0000De-U9; Tue, 04 Mar 2025 10:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 900939.1308921; Tue, 04 Mar 2025 10:55:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpPwI-0000DW-RR; Tue, 04 Mar 2025 10:55:54 +0000
Received: by outflank-mailman (input) for mailman id 900939;
 Tue, 04 Mar 2025 10:55:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpPwH-0000DJ-0v
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 10:55:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpPwH-001GTh-0l
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 10:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpPwG-005zBc-33
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 10:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FTN5NM1bisevAg/sgPDPl2XuHOpw0OUtAgICMaqMfiY=; b=f/GHNJMB5p77u8YutGKPPjvFRU
	yh4QFJ6OSxtpAeEmBSxlQ+eGGqukin9HFptMiLqFJvSiI44qWmyObMCnDhM4O6W+DBsgdGZNQ0iIj
	zOf/ENmLGQXoF53yw7iU0FOotEt6cnJ3iNfimtQMU9rDpZiGjyShxWLONIJKqQY6dKC8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Fix platforms Kconfig indent
Message-Id: <E1tpPwG-005zBc-33@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 10:55:52 +0000

commit 0ddbaba408c16ebfa0b7e61da2b2e76735e6ad4d
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Mon Mar 3 11:27:15 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Mar 4 08:54:53 2025 +0100

    xen/arm: Fix platforms Kconfig indent
    
    Fix platforms/Kconfig and Kconfig.debug help indent to respect the
    standard (tab + 2 spaces).
    While there also move some default in Kconfig.debug before the help
    message.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/Kconfig.debug     | 82 +++++++++++++++++++++---------------------
 xen/arch/arm/platforms/Kconfig | 20 +++++------
 2 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/xen/arch/arm/Kconfig.debug b/xen/arch/arm/Kconfig.debug
index 84a0616102..5a03b220ac 100644
--- a/xen/arch/arm/Kconfig.debug
+++ b/xen/arch/arm/Kconfig.debug
@@ -2,85 +2,85 @@ choice
 	bool "Early printk"
 	optional
 	help
-		You may want to enable early printk if you are debugging code
-		that executes before the console is initialized.
+	  You may want to enable early printk if you are debugging code
+	  that executes before the console is initialized.
 
-		Note that selecting this option will limit Xen to a single UART
-		definition. Attempting to boot Xen image on a different
-		platform *will not work*, so this option should not be enable
-		for Xens that are intended to be portable.
+	  Note that selecting this option will limit Xen to a single UART
+	  definition. Attempting to boot Xen image on a different
+	  platform *will not work*, so this option should not be enable
+	  for Xens that are intended to be portable.
 
-		Choose one of the UART drivers for early printk, then you'll
-		have to specify the parameters, like the base address.
+	  Choose one of the UART drivers for early printk, then you'll
+	  have to specify the parameters, like the base address.
 
 	config EARLY_UART_CHOICE_8250
 		select EARLY_UART_8250
 		bool "Early printk via 8250 UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a 8250 UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a 8250 UART.
 
 	config EARLY_UART_CHOICE_CADENCE
 		select EARLY_UART_CADENCE
 		depends on ARM_64
 		bool "Early printk via Cadence UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a Cadence UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a Cadence UART.
 
 	config EARLY_UART_CHOICE_EXYNOS4210
 		select EARLY_UART_EXYNOS4210
 		depends on ARM_32
 		bool "Early printk via Exynos4210 UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a Exynos 4210 UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a Exynos 4210 UART.
 
 	config EARLY_UART_CHOICE_IMX_LPUART
 		select EARLY_UART_IMX_LPUART
 		depends on ARM_64
 		bool "Early printk via i.MX LPUART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a i.MX LPUART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a i.MX LPUART.
 
 	config EARLY_UART_CHOICE_LINFLEX
 		select EARLY_UART_LINFLEX
 		depends on ARM_64
 		bool "Early printk via NXP LINFlexD UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to an NXP LINFlexD UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to an NXP LINFlexD UART.
 
 	config EARLY_UART_CHOICE_MESON
 		select EARLY_UART_MESON
 		depends on ARM_64
 		bool "Early printk via MESON UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a MESON UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a MESON UART.
 
 	config EARLY_UART_CHOICE_MVEBU
 		select EARLY_UART_MVEBU
 		depends on ARM_64
 		bool "Early printk via MVEBU UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a MVEBU UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a MVEBU UART.
 
 	config EARLY_UART_CHOICE_PL011
 		select EARLY_UART_PL011
 		bool "Early printk via PL011 UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a PL011 UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a PL011 UART.
 
 	config EARLY_UART_CHOICE_SCIF
 		select EARLY_UART_SCIF
 		bool "Early printk via SCIF UART"
 		help
-			Say Y here if you wish the early printk to direct their
-			output to a SCIF UART.
+		  Say Y here if you wish the early printk to direct their
+		  output to a SCIF UART.
 
 endchoice
 
@@ -131,15 +131,14 @@ config EARLY_UART_SIZE
 config EARLY_UART_PL011_BAUD_RATE
 	depends on EARLY_UART_PL011
 	int "Early printk UART baud rate for pl011"
+	default 0
 	help
-		Optionally sets the baud rate which should be used to configure
-		the UART at start of day.
-
-		If EARLY_UART_PL011_BAUD_RATE is set to 0 then the code will
-		not try to initialize the UART, so that bootloader or firmware
-		settings can be used for maximum compatibility.
+	  Optionally sets the baud rate which should be used to configure
+	  the UART at start of day.
 
-	default 0
+	  If EARLY_UART_PL011_BAUD_RATE is set to 0 then the code will
+	  not try to initialize the UART, so that bootloader or firmware
+	  settings can be used for maximum compatibility.
 
 config EARLY_UART_PL011_MMIO32
 	bool "32-bit only MMIO for PL011 early printk"
@@ -155,24 +154,25 @@ config EARLY_UART_INIT
 config EARLY_UART_8250_REG_SHIFT
 	depends on EARLY_UART_8250
 	int "Early printk, left-shift to apply to the register offsets within the 8250 UART"
+	default 0
 	help
-		EARLY_UART_8250_REG_SHIFT is, optionally, the left-shift to
-		apply to the register offsets within the UART with early
-		printk.
+	  EARLY_UART_8250_REG_SHIFT is, optionally, the left-shift to
+	  apply to the register offsets within the UART with early
+	  printk.
 
-		Default to 0.
+	  Default to 0.
 
-	default 0
 
 choice EARLY_UART_SCIF_VERSION
 	prompt "Early printk UART SCIF interface version"
 	depends on EARLY_UART_SCIF
 	default EARLY_UART_SCIF_VERSION_NONE
 	help
-		Select the interface version of the SCIF UART.
+	  Select the interface version of the SCIF UART.
+
+	  Select EARLY_UART_SCIF_VERSION_NONE to use the default
+	  interface version (SCIF).
 
-		Select EARLY_UART_SCIF_VERSION_NONE to use the default
-		interface version (SCIF).
 	config EARLY_UART_SCIF_VERSION_NONE
 		bool "default SCIF UART interface"
 	config EARLY_UART_SCIF_VERSION_A
diff --git a/xen/arch/arm/platforms/Kconfig b/xen/arch/arm/platforms/Kconfig
index 1a25706516..87bf614788 100644
--- a/xen/arch/arm/platforms/Kconfig
+++ b/xen/arch/arm/platforms/Kconfig
@@ -2,15 +2,15 @@ choice
 	prompt "Platform Support" if MMU
 	default ALL_PLAT
 	help
-	Choose which hardware platform to enable in Xen.
+	  Choose which hardware platform to enable in Xen.
 
-	If unsure, choose ALL_PLAT.
+	  If unsure, choose ALL_PLAT.
 
 config ALL_PLAT
 	bool "All Platforms"
 	help
-	Enable support for all available hardware platforms. It doesn't
-	automatically select any of the related drivers.
+	  Enable support for all available hardware platforms. It doesn't
+	  automatically select any of the related drivers.
 
 config QEMU
 	bool "QEMU aarch virt machine support"
@@ -18,8 +18,8 @@ config QEMU
 	select GICV3
 	select HAS_PL011
 	help
-	Enable all the required drivers for QEMU aarch64 virt emulated
-	machine.
+	  Enable all the required drivers for QEMU aarch64 virt emulated
+	  machine.
 
 config RCAR3
 	bool "Renesas RCar3 support"
@@ -27,7 +27,7 @@ config RCAR3
 	select HAS_SCIF
 	select IPMMU_VMSA
 	help
-	Enable all the required drivers for Renesas RCar3
+	  Enable all the required drivers for Renesas RCar3
 
 config RCAR4
 	bool "Renesas RCar4 support"
@@ -44,7 +44,7 @@ config MPSOC
 	select HAS_CADENCE_UART
 	select ARM_SMMU
 	help
-	Enable all the required drivers for Xilinx Ultrascale+ MPSoC
+	  Enable all the required drivers for Xilinx Ultrascale+ MPSoC
 
 config S32G3
 	bool "NXP S32G3 Processors support"
@@ -52,12 +52,12 @@ config S32G3
 	select HAS_LINFLEX
 	select SCMI_SMC
 	help
-	Enable all the required drivers for NXP S32G3 Processors Family
+	  Enable all the required drivers for NXP S32G3 Processors Family
 
 config NO_PLAT
 	bool "No Platforms"
 	help
-	Do not enable specific support for any platform.
+	  Do not enable specific support for any platform.
 
 endchoice
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 13:00:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 13:00:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901107.1309075 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpRsR-0001nS-7e; Tue, 04 Mar 2025 13:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901107.1309075; Tue, 04 Mar 2025 13:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpRsR-0001n1-4q; Tue, 04 Mar 2025 13:00:03 +0000
Received: by outflank-mailman (input) for mailman id 901107;
 Tue, 04 Mar 2025 13:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpRsQ-0001W5-0z
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 13:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpRsQ-001J0H-0Q
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 13:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpRsP-0068B8-2i
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 13:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OpsJynskIdX1onlOEn4N7ciGg8WZRgqTjkITXb4eoCY=; b=szxuSIELh6xg7j4IsZI0/agSio
	mSCsz8ZbEwTjIMgT984H51O9XqgKXoslE6izlsqyoemQwWdPYBPrc3e4PjPB9K8oRmk5jMOlTyaXW
	97kgYcs9bzIgn7VyPPq1YHWZXoGSqTjHo/B7j5LLDKAMaWj9WsuFiplNcwP9DAOP6kPE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/asm: Remove semicolon from LOCK prefix
Message-Id: <E1tpRsP-0068B8-2i@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 13:00:01 +0000

commit f5aee09423fe010cf9c072cfff85710be462abef
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 28 21:50:01 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 12:53:15 2025 +0000

    x86/asm: Remove semicolon from LOCK prefix
    
    Most of Xen's LOCK prefixes are already without semicolon, but we have a few
    still remaining in the tree.
    
    As noted in the Linux patch, this adversely affects size/inlining decisions,
    and prevents the assembler from diagnosing certain classes of error.
    
    No functional change.
    
    Link: https://lore.kernel.org/lkml/20250228085149.2478245-1-ubizjak@gmail.com/
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/include/asm/atomic.h   | 16 ++++++++--------
 xen/arch/x86/include/asm/bitops.h   | 12 ++++++------
 xen/arch/x86/include/asm/spinlock.h |  2 +-
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/include/asm/atomic.h b/xen/arch/x86/include/asm/atomic.h
index 16bd0ebfd7..ed4e09a503 100644
--- a/xen/arch/x86/include/asm/atomic.h
+++ b/xen/arch/x86/include/asm/atomic.h
@@ -115,7 +115,7 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
 static inline void atomic_add(int i, atomic_t *v)
 {
     asm volatile (
-        "lock; addl %1,%0"
+        "lock addl %1,%0"
         : "=m" (*(volatile int *)&v->counter)
         : "ir" (i), "m" (*(volatile int *)&v->counter) );
 }
@@ -128,7 +128,7 @@ static inline int atomic_add_return(int i, atomic_t *v)
 static inline void atomic_sub(int i, atomic_t *v)
 {
     asm volatile (
-        "lock; subl %1,%0"
+        "lock subl %1,%0"
         : "=m" (*(volatile int *)&v->counter)
         : "ir" (i), "m" (*(volatile int *)&v->counter) );
 }
@@ -142,7 +142,7 @@ static inline int atomic_sub_and_test(int i, atomic_t *v)
 {
     bool c;
 
-    asm volatile ( "lock; subl %[i], %[counter]\n\t"
+    asm volatile ( "lock subl %[i], %[counter]\n\t"
                    ASM_FLAG_OUT(, "setz %[zf]\n\t")
                    : [counter] "+m" (*(volatile int *)&v->counter),
                      [zf] ASM_FLAG_OUT("=@ccz", "=qm") (c)
@@ -154,7 +154,7 @@ static inline int atomic_sub_and_test(int i, atomic_t *v)
 static inline void atomic_inc(atomic_t *v)
 {
     asm volatile (
-        "lock; incl %0"
+        "lock incl %0"
         : "=m" (*(volatile int *)&v->counter)
         : "m" (*(volatile int *)&v->counter) );
 }
@@ -168,7 +168,7 @@ static inline int atomic_inc_and_test(atomic_t *v)
 {
     bool c;
 
-    asm volatile ( "lock; incl %[counter]\n\t"
+    asm volatile ( "lock incl %[counter]\n\t"
                    ASM_FLAG_OUT(, "setz %[zf]\n\t")
                    : [counter] "+m" (*(volatile int *)&v->counter),
                      [zf] ASM_FLAG_OUT("=@ccz", "=qm") (c)
@@ -180,7 +180,7 @@ static inline int atomic_inc_and_test(atomic_t *v)
 static inline void atomic_dec(atomic_t *v)
 {
     asm volatile (
-        "lock; decl %0"
+        "lock decl %0"
         : "=m" (*(volatile int *)&v->counter)
         : "m" (*(volatile int *)&v->counter) );
 }
@@ -194,7 +194,7 @@ static inline int atomic_dec_and_test(atomic_t *v)
 {
     bool c;
 
-    asm volatile ( "lock; decl %[counter]\n\t"
+    asm volatile ( "lock decl %[counter]\n\t"
                    ASM_FLAG_OUT(, "setz %[zf]\n\t")
                    : [counter] "+m" (*(volatile int *)&v->counter),
                      [zf] ASM_FLAG_OUT("=@ccz", "=qm") (c)
@@ -207,7 +207,7 @@ static inline int atomic_add_negative(int i, atomic_t *v)
 {
     bool c;
 
-    asm volatile ( "lock; addl %[i], %[counter]\n\t"
+    asm volatile ( "lock addl %[i], %[counter]\n\t"
                    ASM_FLAG_OUT(, "sets %[sf]\n\t")
                    : [counter] "+m" (*(volatile int *)&v->counter),
                      [sf] ASM_FLAG_OUT("=@ccs", "=qm") (c)
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 39e37f1cbe..bb9d756460 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -32,7 +32,7 @@
  */
 static inline void set_bit(int nr, volatile void *addr)
 {
-    asm volatile ( "lock; btsl %1,%0"
+    asm volatile ( "lock btsl %1,%0"
                    : "+m" (ADDR) : "Ir" (nr) : "memory");
 }
 #define set_bit(nr, addr) ({                            \
@@ -73,7 +73,7 @@ static inline void constant_set_bit(int nr, void *addr)
  */
 static inline void clear_bit(int nr, volatile void *addr)
 {
-    asm volatile ( "lock; btrl %1,%0"
+    asm volatile ( "lock btrl %1,%0"
                    : "+m" (ADDR) : "Ir" (nr) : "memory");
 }
 #define clear_bit(nr, addr) ({                          \
@@ -140,7 +140,7 @@ static inline void constant_change_bit(int nr, void *addr)
  */
 static inline void change_bit(int nr, volatile void *addr)
 {
-    asm volatile ( "lock; btcl %1,%0"
+    asm volatile ( "lock btcl %1,%0"
                     : "+m" (ADDR) : "Ir" (nr) : "memory");
 }
 #define change_bit(nr, addr) ({                         \
@@ -160,7 +160,7 @@ static inline int test_and_set_bit(int nr, volatile void *addr)
 {
     int oldbit;
 
-    asm volatile ( "lock; btsl %[nr], %[addr]\n\t"
+    asm volatile ( "lock btsl %[nr], %[addr]\n\t"
                    ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
                    : [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
                      [addr] "+m" (ADDR) : [nr] "Ir" (nr) : "memory" );
@@ -206,7 +206,7 @@ static inline int test_and_clear_bit(int nr, volatile void *addr)
 {
     int oldbit;
 
-    asm volatile ( "lock; btrl %[nr], %[addr]\n\t"
+    asm volatile ( "lock btrl %[nr], %[addr]\n\t"
                    ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
                    : [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
                      [addr] "+m" (ADDR) : [nr] "Ir" (nr) : "memory" );
@@ -266,7 +266,7 @@ static inline int test_and_change_bit(int nr, volatile void *addr)
 {
     int oldbit;
 
-    asm volatile ( "lock; btcl %[nr], %[addr]\n\t"
+    asm volatile ( "lock btcl %[nr], %[addr]\n\t"
                    ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
                    : [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
                      [addr] "+m" (ADDR) : [nr] "Ir" (nr) : "memory" );
diff --git a/xen/arch/x86/include/asm/spinlock.h b/xen/arch/x86/include/asm/spinlock.h
index 56f6095752..834e8c580e 100644
--- a/xen/arch/x86/include/asm/spinlock.h
+++ b/xen/arch/x86/include/asm/spinlock.h
@@ -3,7 +3,7 @@
 
 #define _raw_read_unlock(l) \
     BUILD_BUG_ON(sizeof((l)->lock) != 4); /* Clang doesn't support %z in asm. */ \
-    asm volatile ( "lock; decl %0" : "+m" ((l)->lock) :: "memory" )
+    asm volatile ( "lock decl %0" : "+m" ((l)->lock) :: "memory" )
 
 /*
  * On x86 the only reordering is of reads with older writes.  In the
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 13:00:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 13:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901108.1309078 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpRsb-0002N5-8s; Tue, 04 Mar 2025 13:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901108.1309078; Tue, 04 Mar 2025 13:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpRsb-0002Mx-6N; Tue, 04 Mar 2025 13:00:13 +0000
Received: by outflank-mailman (input) for mailman id 901108;
 Tue, 04 Mar 2025 13:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpRsa-0002Mj-0z
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 13:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpRsa-001J0Q-0l
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 13:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpRsZ-0068Do-34
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 13:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uDanrd+7H/RbiEC/huV0GizmSepO+/vUZiONkb8VeHg=; b=pm+6JlQx4cJE9snj61Mw8JJO2z
	pajG104Pc8IFJLLzEus1rdkKYEbaCrJaZ1e39gRaazyCCCI7ab7/LLtyZc83UDDzc/X5usoxXzicv
	Uot6TmU1KI2TF3/lnCc55nX/GxKw6Hc0eqGy1HdeVmkd5E3U0cQV21ASsw3bPVtIZGQg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/spinlock: Don't perpetuate broken API in new logic
Message-Id: <E1tpRsZ-0068Do-34@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 13:00:11 +0000

commit a3373a82f890bd920270e6ae16dc3d275ae1c429
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 19 11:17:16 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 12:53:15 2025 +0000

    xen/spinlock: Don't perpetuate broken API in new logic
    
    The single user wants this the sane way around.  Write it as a normal static
    inline just like rspin_lock().
    
    Fixes: cc3e8df542ed ("xen/spinlock: add rspin_[un]lock_irq[save|restore]()")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/drivers/char/console.c |  6 +-----
 xen/include/xen/spinlock.h | 14 ++++++++------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 2f48001a44..b3bc4bc963 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1158,11 +1158,7 @@ void console_end_log_everything(void)
 
 unsigned long console_lock_recursive_irqsave(void)
 {
-    unsigned long flags;
-
-    rspin_lock_irqsave(&console_lock, flags);
-
-    return flags;
+    return rspin_lock_irqsave(&console_lock);
 }
 
 void console_unlock_recursive_irqrestore(unsigned long flags)
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index 8825affb25..ca9d8c7ec0 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -303,12 +303,6 @@ static always_inline void spin_lock_if(bool condition, spinlock_t *l)
  */
 bool _rspin_trylock(rspinlock_t *lock);
 void _rspin_lock(rspinlock_t *lock);
-#define rspin_lock_irqsave(l, f)                                \
-    ({                                                          \
-        BUILD_BUG_ON(sizeof(f) != sizeof(unsigned long));       \
-        (f) = _rspin_lock_irqsave(l);                           \
-        block_lock_speculation();                               \
-    })
 unsigned long _rspin_lock_irqsave(rspinlock_t *lock);
 void _rspin_unlock(rspinlock_t *lock);
 void _rspin_unlock_irqrestore(rspinlock_t *lock, unsigned long flags);
@@ -321,6 +315,14 @@ static always_inline void rspin_lock(rspinlock_t *lock)
     block_lock_speculation();
 }
 
+static always_inline unsigned long rspin_lock_irqsave(rspinlock_t *lock)
+{
+    unsigned long flags = _rspin_lock_irqsave(lock);
+
+    block_lock_speculation();
+    return flags;
+}
+
 #define rspin_trylock(l)              lock_evaluate_nospec(_rspin_trylock(l))
 #define rspin_unlock(l)               _rspin_unlock(l)
 #define rspin_unlock_irqrestore(l, f) _rspin_unlock_irqrestore(l, f)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 13:00:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 13:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901109.1309082 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpRsl-0002Pu-AI; Tue, 04 Mar 2025 13:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901109.1309082; Tue, 04 Mar 2025 13:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpRsl-0002Pm-7n; Tue, 04 Mar 2025 13:00:23 +0000
Received: by outflank-mailman (input) for mailman id 901109;
 Tue, 04 Mar 2025 13:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpRsk-0002PU-6z
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 13:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpRsk-001J0p-19
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 13:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpRsk-0068F8-0B
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 13:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zVZwHNe9xNsyEtvYXOexf49hQfQKaeWhfQ9P1G3nOIU=; b=cZd65PI/VTqeLtYb/Rmnk+1De/
	jXQr+F4fCI6hTRHl4W8wBje3PzQK+Law7Yp83gemMp5aj2px9RNifBHaPEsSpNUBIz2qEAV2OSWUp
	X4MDTDAQo6mLihEVV7zWEy3QdIxuYD1Yv+QxHi6wT3HaVHW3HZzODqFnAqvtxqCbb8go=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] IOMMU/VT-d: Fix comment
Message-Id: <E1tpRsk-0068F8-0B@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 13:00:22 +0000

commit 66f9aceafdbee045d5ef56feef2c02064e35af15
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 24 17:05:02 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 12:53:15 2025 +0000

    IOMMU/VT-d: Fix comment
    
    "find upstream bridge" is surprisingly jarring in context, considering that's
    the name of the function who's return value we're testing.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/passthrough/vtd/intremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 820616a8de..1aeaeb5ec5 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -475,7 +475,7 @@ static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *ire)
             set_ire_sid(ire, SVT_VERIFY_SID_SQ, SQ_ALL_16,
                         PCI_BDF(bus, devfn));
         }
-        else if ( ret == 1 ) /* find upstream bridge */
+        else if ( ret == 1 ) /* found upstream bridge */
         {
             if ( pdev_type(seg, bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE )
                 set_ire_sid(ire, SVT_VERIFY_BUS, SQ_ALL_16,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 13:00:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 13:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901110.1309087 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpRsv-0002U0-Bu; Tue, 04 Mar 2025 13:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901110.1309087; Tue, 04 Mar 2025 13:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpRsv-0002Ts-9L; Tue, 04 Mar 2025 13:00:33 +0000
Received: by outflank-mailman (input) for mailman id 901110;
 Tue, 04 Mar 2025 13:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpRsu-0002Tk-7f
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 13:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpRsu-001J0t-1Q
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 13:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpRsu-0068HN-0a
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 13:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VF2wtX2A24CYUffUdt5/0f+pueT6oie1VSmZ1Jn6JpI=; b=SkC9WK08o+v7HjY2Z8eUOMm8PI
	F90qikeQVgaBP7mUbxKBVV3xlEkp54GeUoBKjtKsgOtM+nPMBWIz0wlA1bCWO/MCFqOd3OQSvJGZe
	FuakLQiuVOwE3+iXPYZP5u1omy0Mf2NOrSQpeKShzQjYlhJIRhPmUOJG2MDsWi+yk5iE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] common: remove -fno-stack-protector from EMBEDDED_EXTRA_CFLAGS
Message-Id: <E1tpRsu-0068HN-0a@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 13:00:32 +0000

commit 981d5550fdfbc66481530809098369e97369b78d
Author:     Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
AuthorDate: Mon Feb 17 02:49:16 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 12:53:15 2025 +0000

    common: remove -fno-stack-protector from EMBEDDED_EXTRA_CFLAGS
    
    This patch is preparation for making stack protector
    configurable. First step is to remove -fno-stack-protector flag from
    EMBEDDED_EXTRA_CFLAGS so separate components (Hypervisor in this case)
    can enable/disable this feature by themselves.
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk                            | 2 +-
 stubdom/Makefile                     | 1 +
 tools/firmware/Rules.mk              | 2 ++
 tools/tests/x86_emulator/testcase.mk | 2 +-
 xen/Makefile                         | 2 ++
 xen/arch/x86/boot/Makefile           | 1 +
 6 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Config.mk b/Config.mk
index 9188fc9053..8b426a580f 100644
--- a/Config.mk
+++ b/Config.mk
@@ -198,7 +198,7 @@ endif
 APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
 APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
-EMBEDDED_EXTRA_CFLAGS := -fno-pie -fno-stack-protector
+EMBEDDED_EXTRA_CFLAGS := -fno-pie
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
 
 XEN_EXTFILES_URL ?= https://xenbits.xen.org/xen-extfiles
diff --git a/stubdom/Makefile b/stubdom/Makefile
index 2a81af28a1..c6978caa5a 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -13,6 +13,7 @@ export stubdom=y
 export debug=y
 # Moved from config/StdGNU.mk
 CFLAGS += -O1 -fno-omit-frame-pointer
+CFLAGS += -fno-stack-protector
 
 ifeq (,$(findstring clean,$(MAKECMDGOALS)))
   ifeq ($(wildcard $(MINI_OS)/Config.mk),)
diff --git a/tools/firmware/Rules.mk b/tools/firmware/Rules.mk
index d3482c9ec4..be2692695d 100644
--- a/tools/firmware/Rules.mk
+++ b/tools/firmware/Rules.mk
@@ -11,6 +11,8 @@ ifneq ($(debug),y)
 CFLAGS += -DNDEBUG
 endif
 
+CFLAGS += -fno-stack-protector
+
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
 $(call cc-option-add,CFLAGS,CC,-fcf-protection=none)
diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulator/testcase.mk
index fc95e24589..7875b95d7c 100644
--- a/tools/tests/x86_emulator/testcase.mk
+++ b/tools/tests/x86_emulator/testcase.mk
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
-CFLAGS += -fno-builtin -g0 $($(TESTCASE)-cflags)
+CFLAGS += -fno-builtin -fno-stack-protector -g0 $($(TESTCASE)-cflags)
 
 LDFLAGS_DIRECT += $(shell { $(LD) -v --warn-rwx-segments; } >/dev/null 2>&1 && echo --no-warn-rwx-segments)
 
diff --git a/xen/Makefile b/xen/Makefile
index 93532653ee..58fafab33d 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -435,6 +435,8 @@ else
 CFLAGS_UBSAN :=
 endif
 
+CFLAGS += -fno-stack-protector
+
 ifeq ($(CONFIG_LTO),y)
 CFLAGS += -flto
 LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin LLVMgold.so
diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index d457876659..ff0d61d7ac 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -17,6 +17,7 @@ obj32 := $(addprefix $(obj)/,$(obj32))
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
+CFLAGS_x86_32 += -fno-stack-protector
 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS))
 CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 14:00:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 14:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901157.1309134 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpSof-0005KQ-FG; Tue, 04 Mar 2025 14:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901157.1309134; Tue, 04 Mar 2025 14:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpSof-0005KJ-Cj; Tue, 04 Mar 2025 14:00:13 +0000
Received: by outflank-mailman (input) for mailman id 901157;
 Tue, 04 Mar 2025 14:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpSoe-0005KC-44
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 14:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpSoe-001KE3-14
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpSod-006EDR-3A
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4y3XzxGNhHChDRlm/3KMGuwAu45j2Qlw+ZpiOKRdjO0=; b=cFTjn+SrT0G45Y8TFnYjYEpUk3
	iD0vc4yzhaokELi8wtRokLACc+Jc5sUH7nAJgqCDYRnEVN3StYO3KNRLc3pqwld/DLAV/im9rjtFj
	eS1SR4u16p1jwEEYfapc3mjTDpcp0k62XtE2vhnP8aYeqHgocB5o/p5q4GLkKgfIgxC4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/spinlock: Don't perpetuate broken API in new logic
Message-Id: <E1tpSod-006EDR-3A@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 14:00:11 +0000

commit a3373a82f890bd920270e6ae16dc3d275ae1c429
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 19 11:17:16 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 12:53:15 2025 +0000

    xen/spinlock: Don't perpetuate broken API in new logic
    
    The single user wants this the sane way around.  Write it as a normal static
    inline just like rspin_lock().
    
    Fixes: cc3e8df542ed ("xen/spinlock: add rspin_[un]lock_irq[save|restore]()")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/drivers/char/console.c |  6 +-----
 xen/include/xen/spinlock.h | 14 ++++++++------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 2f48001a44..b3bc4bc963 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1158,11 +1158,7 @@ void console_end_log_everything(void)
 
 unsigned long console_lock_recursive_irqsave(void)
 {
-    unsigned long flags;
-
-    rspin_lock_irqsave(&console_lock, flags);
-
-    return flags;
+    return rspin_lock_irqsave(&console_lock);
 }
 
 void console_unlock_recursive_irqrestore(unsigned long flags)
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index 8825affb25..ca9d8c7ec0 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -303,12 +303,6 @@ static always_inline void spin_lock_if(bool condition, spinlock_t *l)
  */
 bool _rspin_trylock(rspinlock_t *lock);
 void _rspin_lock(rspinlock_t *lock);
-#define rspin_lock_irqsave(l, f)                                \
-    ({                                                          \
-        BUILD_BUG_ON(sizeof(f) != sizeof(unsigned long));       \
-        (f) = _rspin_lock_irqsave(l);                           \
-        block_lock_speculation();                               \
-    })
 unsigned long _rspin_lock_irqsave(rspinlock_t *lock);
 void _rspin_unlock(rspinlock_t *lock);
 void _rspin_unlock_irqrestore(rspinlock_t *lock, unsigned long flags);
@@ -321,6 +315,14 @@ static always_inline void rspin_lock(rspinlock_t *lock)
     block_lock_speculation();
 }
 
+static always_inline unsigned long rspin_lock_irqsave(rspinlock_t *lock)
+{
+    unsigned long flags = _rspin_lock_irqsave(lock);
+
+    block_lock_speculation();
+    return flags;
+}
+
 #define rspin_trylock(l)              lock_evaluate_nospec(_rspin_trylock(l))
 #define rspin_unlock(l)               _rspin_unlock(l)
 #define rspin_unlock_irqrestore(l, f) _rspin_unlock_irqrestore(l, f)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 14:00:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 14:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901156.1309131 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpSoV-0004sW-Cz; Tue, 04 Mar 2025 14:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901156.1309131; Tue, 04 Mar 2025 14:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpSoV-0004s7-9j; Tue, 04 Mar 2025 14:00:03 +0000
Received: by outflank-mailman (input) for mailman id 901156;
 Tue, 04 Mar 2025 14:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpSoT-0004Zg-WD
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 14:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpSoU-001KDz-0V
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpSoT-006EBk-2l
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=427C4PUUpuFysndPCArabWp0PUZBR/FoIRn4u7kleLY=; b=0xTeWVzsGo4oNEGprm7OHszWcI
	nOi4AV2CheFEXaGiUGwh94umGQhlkjG1p6qdxu/VisNyzTBAvBHYOSA9Q8pHL3NJrx8dECajORUVC
	fRrjaUg5ugLkGeslYXBHRnswr5PjmZjZ5Tw7CKxu3b1news3qU69fGIqpCaPBRKNsH0g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/asm: Remove semicolon from LOCK prefix
Message-Id: <E1tpSoT-006EBk-2l@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 14:00:01 +0000

commit f5aee09423fe010cf9c072cfff85710be462abef
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 28 21:50:01 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 12:53:15 2025 +0000

    x86/asm: Remove semicolon from LOCK prefix
    
    Most of Xen's LOCK prefixes are already without semicolon, but we have a few
    still remaining in the tree.
    
    As noted in the Linux patch, this adversely affects size/inlining decisions,
    and prevents the assembler from diagnosing certain classes of error.
    
    No functional change.
    
    Link: https://lore.kernel.org/lkml/20250228085149.2478245-1-ubizjak@gmail.com/
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/include/asm/atomic.h   | 16 ++++++++--------
 xen/arch/x86/include/asm/bitops.h   | 12 ++++++------
 xen/arch/x86/include/asm/spinlock.h |  2 +-
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/include/asm/atomic.h b/xen/arch/x86/include/asm/atomic.h
index 16bd0ebfd7..ed4e09a503 100644
--- a/xen/arch/x86/include/asm/atomic.h
+++ b/xen/arch/x86/include/asm/atomic.h
@@ -115,7 +115,7 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
 static inline void atomic_add(int i, atomic_t *v)
 {
     asm volatile (
-        "lock; addl %1,%0"
+        "lock addl %1,%0"
         : "=m" (*(volatile int *)&v->counter)
         : "ir" (i), "m" (*(volatile int *)&v->counter) );
 }
@@ -128,7 +128,7 @@ static inline int atomic_add_return(int i, atomic_t *v)
 static inline void atomic_sub(int i, atomic_t *v)
 {
     asm volatile (
-        "lock; subl %1,%0"
+        "lock subl %1,%0"
         : "=m" (*(volatile int *)&v->counter)
         : "ir" (i), "m" (*(volatile int *)&v->counter) );
 }
@@ -142,7 +142,7 @@ static inline int atomic_sub_and_test(int i, atomic_t *v)
 {
     bool c;
 
-    asm volatile ( "lock; subl %[i], %[counter]\n\t"
+    asm volatile ( "lock subl %[i], %[counter]\n\t"
                    ASM_FLAG_OUT(, "setz %[zf]\n\t")
                    : [counter] "+m" (*(volatile int *)&v->counter),
                      [zf] ASM_FLAG_OUT("=@ccz", "=qm") (c)
@@ -154,7 +154,7 @@ static inline int atomic_sub_and_test(int i, atomic_t *v)
 static inline void atomic_inc(atomic_t *v)
 {
     asm volatile (
-        "lock; incl %0"
+        "lock incl %0"
         : "=m" (*(volatile int *)&v->counter)
         : "m" (*(volatile int *)&v->counter) );
 }
@@ -168,7 +168,7 @@ static inline int atomic_inc_and_test(atomic_t *v)
 {
     bool c;
 
-    asm volatile ( "lock; incl %[counter]\n\t"
+    asm volatile ( "lock incl %[counter]\n\t"
                    ASM_FLAG_OUT(, "setz %[zf]\n\t")
                    : [counter] "+m" (*(volatile int *)&v->counter),
                      [zf] ASM_FLAG_OUT("=@ccz", "=qm") (c)
@@ -180,7 +180,7 @@ static inline int atomic_inc_and_test(atomic_t *v)
 static inline void atomic_dec(atomic_t *v)
 {
     asm volatile (
-        "lock; decl %0"
+        "lock decl %0"
         : "=m" (*(volatile int *)&v->counter)
         : "m" (*(volatile int *)&v->counter) );
 }
@@ -194,7 +194,7 @@ static inline int atomic_dec_and_test(atomic_t *v)
 {
     bool c;
 
-    asm volatile ( "lock; decl %[counter]\n\t"
+    asm volatile ( "lock decl %[counter]\n\t"
                    ASM_FLAG_OUT(, "setz %[zf]\n\t")
                    : [counter] "+m" (*(volatile int *)&v->counter),
                      [zf] ASM_FLAG_OUT("=@ccz", "=qm") (c)
@@ -207,7 +207,7 @@ static inline int atomic_add_negative(int i, atomic_t *v)
 {
     bool c;
 
-    asm volatile ( "lock; addl %[i], %[counter]\n\t"
+    asm volatile ( "lock addl %[i], %[counter]\n\t"
                    ASM_FLAG_OUT(, "sets %[sf]\n\t")
                    : [counter] "+m" (*(volatile int *)&v->counter),
                      [sf] ASM_FLAG_OUT("=@ccs", "=qm") (c)
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 39e37f1cbe..bb9d756460 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -32,7 +32,7 @@
  */
 static inline void set_bit(int nr, volatile void *addr)
 {
-    asm volatile ( "lock; btsl %1,%0"
+    asm volatile ( "lock btsl %1,%0"
                    : "+m" (ADDR) : "Ir" (nr) : "memory");
 }
 #define set_bit(nr, addr) ({                            \
@@ -73,7 +73,7 @@ static inline void constant_set_bit(int nr, void *addr)
  */
 static inline void clear_bit(int nr, volatile void *addr)
 {
-    asm volatile ( "lock; btrl %1,%0"
+    asm volatile ( "lock btrl %1,%0"
                    : "+m" (ADDR) : "Ir" (nr) : "memory");
 }
 #define clear_bit(nr, addr) ({                          \
@@ -140,7 +140,7 @@ static inline void constant_change_bit(int nr, void *addr)
  */
 static inline void change_bit(int nr, volatile void *addr)
 {
-    asm volatile ( "lock; btcl %1,%0"
+    asm volatile ( "lock btcl %1,%0"
                     : "+m" (ADDR) : "Ir" (nr) : "memory");
 }
 #define change_bit(nr, addr) ({                         \
@@ -160,7 +160,7 @@ static inline int test_and_set_bit(int nr, volatile void *addr)
 {
     int oldbit;
 
-    asm volatile ( "lock; btsl %[nr], %[addr]\n\t"
+    asm volatile ( "lock btsl %[nr], %[addr]\n\t"
                    ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
                    : [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
                      [addr] "+m" (ADDR) : [nr] "Ir" (nr) : "memory" );
@@ -206,7 +206,7 @@ static inline int test_and_clear_bit(int nr, volatile void *addr)
 {
     int oldbit;
 
-    asm volatile ( "lock; btrl %[nr], %[addr]\n\t"
+    asm volatile ( "lock btrl %[nr], %[addr]\n\t"
                    ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
                    : [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
                      [addr] "+m" (ADDR) : [nr] "Ir" (nr) : "memory" );
@@ -266,7 +266,7 @@ static inline int test_and_change_bit(int nr, volatile void *addr)
 {
     int oldbit;
 
-    asm volatile ( "lock; btcl %[nr], %[addr]\n\t"
+    asm volatile ( "lock btcl %[nr], %[addr]\n\t"
                    ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
                    : [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
                      [addr] "+m" (ADDR) : [nr] "Ir" (nr) : "memory" );
diff --git a/xen/arch/x86/include/asm/spinlock.h b/xen/arch/x86/include/asm/spinlock.h
index 56f6095752..834e8c580e 100644
--- a/xen/arch/x86/include/asm/spinlock.h
+++ b/xen/arch/x86/include/asm/spinlock.h
@@ -3,7 +3,7 @@
 
 #define _raw_read_unlock(l) \
     BUILD_BUG_ON(sizeof((l)->lock) != 4); /* Clang doesn't support %z in asm. */ \
-    asm volatile ( "lock; decl %0" : "+m" ((l)->lock) :: "memory" )
+    asm volatile ( "lock decl %0" : "+m" ((l)->lock) :: "memory" )
 
 /*
  * On x86 the only reordering is of reads with older writes.  In the
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 14:00:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 14:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901158.1309139 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpSop-0005NN-Gn; Tue, 04 Mar 2025 14:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901158.1309139; Tue, 04 Mar 2025 14:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpSop-0005NE-EB; Tue, 04 Mar 2025 14:00:23 +0000
Received: by outflank-mailman (input) for mailman id 901158;
 Tue, 04 Mar 2025 14:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpSoo-0005Mz-7w
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 14:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpSoo-001KEQ-1R
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpSoo-006EDs-0T
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O73xLtp6Luu7OS6e8EUBS070xLy1IIBECqLJQS1TkJI=; b=x0cZMz2aB/ApulJuW/eHoARIxX
	akZJzhwYEjhHaPDD1tMCiQ6hKH6RA0LuoU9x0MYcbcYMT4jijh1HAz6ql9JBjVo0N53BztFZQAtjU
	e8Z5eZJ3Kl1PFfwusDVT+fTyQP0oGK8DHFuzpZPH3eYGR3NO5F8Ow/9dx6yNgbmw18sQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] IOMMU/VT-d: Fix comment
Message-Id: <E1tpSoo-006EDs-0T@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 14:00:22 +0000

commit 66f9aceafdbee045d5ef56feef2c02064e35af15
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 24 17:05:02 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 12:53:15 2025 +0000

    IOMMU/VT-d: Fix comment
    
    "find upstream bridge" is surprisingly jarring in context, considering that's
    the name of the function who's return value we're testing.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/passthrough/vtd/intremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 820616a8de..1aeaeb5ec5 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -475,7 +475,7 @@ static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *ire)
             set_ire_sid(ire, SVT_VERIFY_SID_SQ, SQ_ALL_16,
                         PCI_BDF(bus, devfn));
         }
-        else if ( ret == 1 ) /* find upstream bridge */
+        else if ( ret == 1 ) /* found upstream bridge */
         {
             if ( pdev_type(seg, bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE )
                 set_ire_sid(ire, SVT_VERIFY_BUS, SQ_ALL_16,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 14:00:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 14:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901159.1309143 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpSoz-0005QY-IA; Tue, 04 Mar 2025 14:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901159.1309143; Tue, 04 Mar 2025 14:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpSoz-0005QQ-Fa; Tue, 04 Mar 2025 14:00:33 +0000
Received: by outflank-mailman (input) for mailman id 901159;
 Tue, 04 Mar 2025 14:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpSoy-0005QH-BP
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 14:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpSoy-001KEU-1n
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpSoy-006EEI-0t
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=360bgRVGnyPqzPyRzH4w/9pUOHEQO4nRMtng8Ri4e2M=; b=OEtGDLbWqXc9U9n9LlueLCa6Ur
	cD1hheAyTXcLkkRxt21qUSbbr87Z3sF9ah2vXQzuzISRJsHtiBawCQpLLlj5VT0yiKgB5BLCsODKo
	/bPH1hqpw5xKbrpS4M6GC+MI1qQuK2KbD7RkEu77sAATcaewfleA7OCo4LHHl9GaUJvY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] common: remove -fno-stack-protector from EMBEDDED_EXTRA_CFLAGS
Message-Id: <E1tpSoy-006EEI-0t@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 14:00:32 +0000

commit 981d5550fdfbc66481530809098369e97369b78d
Author:     Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
AuthorDate: Mon Feb 17 02:49:16 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 12:53:15 2025 +0000

    common: remove -fno-stack-protector from EMBEDDED_EXTRA_CFLAGS
    
    This patch is preparation for making stack protector
    configurable. First step is to remove -fno-stack-protector flag from
    EMBEDDED_EXTRA_CFLAGS so separate components (Hypervisor in this case)
    can enable/disable this feature by themselves.
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk                            | 2 +-
 stubdom/Makefile                     | 1 +
 tools/firmware/Rules.mk              | 2 ++
 tools/tests/x86_emulator/testcase.mk | 2 +-
 xen/Makefile                         | 2 ++
 xen/arch/x86/boot/Makefile           | 1 +
 6 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Config.mk b/Config.mk
index 9188fc9053..8b426a580f 100644
--- a/Config.mk
+++ b/Config.mk
@@ -198,7 +198,7 @@ endif
 APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
 APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
-EMBEDDED_EXTRA_CFLAGS := -fno-pie -fno-stack-protector
+EMBEDDED_EXTRA_CFLAGS := -fno-pie
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables
 
 XEN_EXTFILES_URL ?= https://xenbits.xen.org/xen-extfiles
diff --git a/stubdom/Makefile b/stubdom/Makefile
index 2a81af28a1..c6978caa5a 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -13,6 +13,7 @@ export stubdom=y
 export debug=y
 # Moved from config/StdGNU.mk
 CFLAGS += -O1 -fno-omit-frame-pointer
+CFLAGS += -fno-stack-protector
 
 ifeq (,$(findstring clean,$(MAKECMDGOALS)))
   ifeq ($(wildcard $(MINI_OS)/Config.mk),)
diff --git a/tools/firmware/Rules.mk b/tools/firmware/Rules.mk
index d3482c9ec4..be2692695d 100644
--- a/tools/firmware/Rules.mk
+++ b/tools/firmware/Rules.mk
@@ -11,6 +11,8 @@ ifneq ($(debug),y)
 CFLAGS += -DNDEBUG
 endif
 
+CFLAGS += -fno-stack-protector
+
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
 $(call cc-option-add,CFLAGS,CC,-fcf-protection=none)
diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulator/testcase.mk
index fc95e24589..7875b95d7c 100644
--- a/tools/tests/x86_emulator/testcase.mk
+++ b/tools/tests/x86_emulator/testcase.mk
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
-CFLAGS += -fno-builtin -g0 $($(TESTCASE)-cflags)
+CFLAGS += -fno-builtin -fno-stack-protector -g0 $($(TESTCASE)-cflags)
 
 LDFLAGS_DIRECT += $(shell { $(LD) -v --warn-rwx-segments; } >/dev/null 2>&1 && echo --no-warn-rwx-segments)
 
diff --git a/xen/Makefile b/xen/Makefile
index 93532653ee..58fafab33d 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -435,6 +435,8 @@ else
 CFLAGS_UBSAN :=
 endif
 
+CFLAGS += -fno-stack-protector
+
 ifeq ($(CONFIG_LTO),y)
 CFLAGS += -flto
 LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin LLVMgold.so
diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index d457876659..ff0d61d7ac 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -17,6 +17,7 @@ obj32 := $(addprefix $(obj)/,$(obj32))
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
+CFLAGS_x86_32 += -fno-stack-protector
 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS))
 CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 14:55:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 14:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901219.1309197 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpTfj-0001fb-D3; Tue, 04 Mar 2025 14:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901219.1309197; Tue, 04 Mar 2025 14:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpTfj-0001fT-AN; Tue, 04 Mar 2025 14:55:03 +0000
Received: by outflank-mailman (input) for mailman id 901219;
 Tue, 04 Mar 2025 14:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpTfh-0001fN-OG
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 14:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpTfh-001LH9-2M
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpTfh-006Gdf-1N
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VqVHxhnpJTcixPxag3giNOGN73Dxv24LYIiS5a4dwDc=; b=gg3Aq9Uy5L59X/z8ZDwg36qlPj
	VbzKYcNVblI2dsEW1kn3BHD74lVHtbsjXNQ6uN4cgATUzQJ1vlS86fMtKDuCqmAMa0KcYmoVbCeUL
	lecXStd5QbNtZ5N5t5ijQuw0u4mLDm/O2B7GrIXWBSYRG2Sp3crh3c2U+m1+cqKmAH6I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Set release date for 4.20
Message-Id: <E1tpTfh-006Gdf-1N@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 14:55:01 +0000

commit e28802927e0a24dab9c73082c3e322ef4dd0bd02
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 3 14:06:55 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 14:43:19 2025 +0000

    CHANGELOG.md: Set release date for 4.20
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 111af1fb4c..04c21d5bce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
 ### Removed
 
-## [4.20.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
+## [4.20.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.20.0) - 2025-03-05
 
 ### Changed
  - Fixed blkif protocol specification for sector sizes different than 512b.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 14:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 14:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901220.1309201 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpTft-0001hQ-EQ; Tue, 04 Mar 2025 14:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901220.1309201; Tue, 04 Mar 2025 14:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpTft-0001hH-Bp; Tue, 04 Mar 2025 14:55:13 +0000
Received: by outflank-mailman (input) for mailman id 901220;
 Tue, 04 Mar 2025 14:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpTfs-0001h7-15
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 14:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpTfs-001LHO-0l
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpTfr-006Gem-34
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F/YnKZu5BoqsPhTKfifu3yvtCHXrhw4kzGQdqEkeYuQ=; b=1+9jHBqgdmQC0sveCdqzAqIANU
	eyFLRF8RAqX53SilXl5stFW8hbJsBGb3Py1yZ0kEcfOdFActoEBEUUSJeHeyPfDNRkzkCrLCwm8Q9
	3fCBx6KJFzsdeiJ4atKywTqT3+B0wjMUdQwTLjQ1ReyhSt6w63djwRgK8zMeG7HZmcVA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] CHANGELOG.md: Set release date for 4.20
Message-Id: <E1tpTfr-006Gem-34@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 14:55:11 +0000

commit 5cd830509d3832a77f001f954a9932405f509007
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 3 14:06:55 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 14:47:48 2025 +0000

    CHANGELOG.md: Set release date for 4.20
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    (cherry picked from commit e28802927e0a24dab9c73082c3e322ef4dd0bd02)
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c10df7d969..2b9ba49225 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
-## [4.20.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
+## [4.20.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.20.0) - 2025-03-05
 
 ### Changed
  - Fixed blkif protocol specification for sector sizes different than 512b.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 14:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 14:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901221.1309205 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpTg3-0001jj-Fn; Tue, 04 Mar 2025 14:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901221.1309205; Tue, 04 Mar 2025 14:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpTg3-0001jb-DB; Tue, 04 Mar 2025 14:55:23 +0000
Received: by outflank-mailman (input) for mailman id 901221;
 Tue, 04 Mar 2025 14:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpTg2-0001jO-4l
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 14:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpTg2-001LHi-17
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpTg2-006Gf8-0B
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 14:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dtwQNAmT7veQnHIcX8JPbeDuhpnpL4jNB3mY+WMt/O4=; b=ymuyLrclPEZdcNxJAt8DJ47hRp
	2BVcwMpf1vzrtNx3mJV1i//BwcWELe42BQHm46PTmGvZXfPbm+idQJGw6jxaM8ASVXT4bSDsRvLQD
	nlIRdUz5+lYxKIN3xNI84d4ZOxfv+dxD0OQ0x0R6iGuPxlvjsd2id3PIuTttuUBCjBOc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] SUPPORT.md: Define support lifetime
Message-Id: <E1tpTg2-006Gf8-0B@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 14:55:22 +0000

commit 6bf05e086765d2d55c70c21de580548b97494fac
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 3 14:12:05 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 14:47:48 2025 +0000

    SUPPORT.md: Define support lifetime
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    ---
    CC: Anthony PERARD <anthony.perard@vates.tech>
    CC: Michal Orzel <michal.orzel@amd.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Julien Grall <julien@xen.org>
    CC: Roger Pau Monné <roger.pau@citrix.com>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 SUPPORT.md | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 2bc5bd81ee..559aa812ad 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,13 +9,13 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.20-rc
-    Initial-Release: n/a
-    Supported-Until: TBD
-    Security-Support-Until: Unreleased - not yet security-supported
+    Xen-Version: 4.20
+    Initial-Release: 2025-03-05
+    Supported-Until: 2026-09-05
+    Security-Support-Until: 2028-03-05
 
 Release Notes
-: <a href="https://wiki.xenproject.org/wiki/Xen_Project_X.YY_Release_Notes">RN</a>
+: <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.20_Release_Notes">RN</a>
 
 # Feature Support
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 15:55:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 15:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901268.1309238 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpUbn-0002er-7t; Tue, 04 Mar 2025 15:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901268.1309238; Tue, 04 Mar 2025 15:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpUbn-0002ek-5M; Tue, 04 Mar 2025 15:55:03 +0000
Received: by outflank-mailman (input) for mailman id 901268;
 Tue, 04 Mar 2025 15:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpUbl-0002ee-P7
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 15:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpUbl-001MQ3-2N
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 15:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpUbl-006JEX-1G
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 15:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9Q/D7dv/n2m9uSJqlzPMKxxnaaPmdvqzMH2YMK3Q7GM=; b=xU6g8pJklzysnK84XwpFhtlvys
	SnTHf9hZpAKeZWwjq5MlWCNTJ52PrvSuT6DcxN6xC5CxHStwAD13g0QMS3uDQ96bVPCtwEVWgTqTF
	YxI6FXsAAWnN3fbu2r5w4mlGzR8aZJFUrFitYUzL9bDfah3uflQ0UhfyMcYJfjFeznFo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Set release date for 4.20
Message-Id: <E1tpUbl-006JEX-1G@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 15:55:01 +0000

commit e28802927e0a24dab9c73082c3e322ef4dd0bd02
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 3 14:06:55 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 14:43:19 2025 +0000

    CHANGELOG.md: Set release date for 4.20
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 111af1fb4c..04c21d5bce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
 ### Removed
 
-## [4.20.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
+## [4.20.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.20.0) - 2025-03-05
 
 ### Changed
  - Fixed blkif protocol specification for sector sizes different than 512b.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 16:22:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 16:22:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901307.1309274 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpV1u-0000vz-Sx; Tue, 04 Mar 2025 16:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901307.1309274; Tue, 04 Mar 2025 16:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpV1u-0000vr-Pc; Tue, 04 Mar 2025 16:22:02 +0000
Received: by outflank-mailman (input) for mailman id 901307;
 Tue, 04 Mar 2025 16:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpV1t-0000vj-Lt
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 16:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpV1t-001NX9-2M
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 16:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpV1t-006LWi-1O
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 16:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cJvOO8zd9VwyLvzoHDxa5DmcZ+cfRdSZreYplO5zN9U=; b=eacUfzN4gowCcjDTslnrcX7oxK
	J+Skpwz+7MBgN0Fi8lFMCjsBNZ5EzeKgEtxWd0f5MKGH2Vz2D6ctZWOs8ggKyU33uQb2WvKAy0rai
	N43x9vxG1wHQIF9Wpet+S8Sv11Dd+ZLtc9pjDFufbWfXNoSCFNGclILMtur/a7KESMV8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] CHANGELOG.md: Set release date for 4.20
Message-Id: <E1tpV1t-006LWi-1O@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 16:22:01 +0000

commit 5cd830509d3832a77f001f954a9932405f509007
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 3 14:06:55 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 14:47:48 2025 +0000

    CHANGELOG.md: Set release date for 4.20
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    (cherry picked from commit e28802927e0a24dab9c73082c3e322ef4dd0bd02)
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c10df7d969..2b9ba49225 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
-## [4.20.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
+## [4.20.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.20.0) - 2025-03-05
 
 ### Changed
  - Fixed blkif protocol specification for sector sizes different than 512b.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 16:22:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 16:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901308.1309277 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpV24-0000ya-V3; Tue, 04 Mar 2025 16:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901308.1309277; Tue, 04 Mar 2025 16:22:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpV24-0000yS-SO; Tue, 04 Mar 2025 16:22:12 +0000
Received: by outflank-mailman (input) for mailman id 901308;
 Tue, 04 Mar 2025 16:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpV23-0000yF-Mf
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 16:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpV23-001NXQ-2u
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 16:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpV23-006LXP-1m
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 16:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rnLZSuMxNGQ5treKGdtliNoJPLit5237ecUb2FXMTqo=; b=v7AAsGmcc6bOCUoZ4Aj5n3sAkh
	sacnnczygN6+0FWSiC3gGkYTMPOK12lT5GD7ETRUGlthx/7ct3KL3c0mNhMjedfrexHc5xASLahqc
	bVnDiNPe8tesBeTGN+dYmx5iaMojJ1R5eEr4a6D0x0NoFWHPWXrH5ppuwwUksYHlNW54=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] SUPPORT.md: Define support lifetime
Message-Id: <E1tpV23-006LXP-1m@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 16:22:11 +0000

commit 6bf05e086765d2d55c70c21de580548b97494fac
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 3 14:12:05 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 14:47:48 2025 +0000

    SUPPORT.md: Define support lifetime
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    ---
    CC: Anthony PERARD <anthony.perard@vates.tech>
    CC: Michal Orzel <michal.orzel@amd.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Julien Grall <julien@xen.org>
    CC: Roger Pau Monné <roger.pau@citrix.com>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 SUPPORT.md | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 2bc5bd81ee..559aa812ad 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,13 +9,13 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.20-rc
-    Initial-Release: n/a
-    Supported-Until: TBD
-    Security-Support-Until: Unreleased - not yet security-supported
+    Xen-Version: 4.20
+    Initial-Release: 2025-03-05
+    Supported-Until: 2026-09-05
+    Security-Support-Until: 2028-03-05
 
 Release Notes
-: <a href="https://wiki.xenproject.org/wiki/Xen_Project_X.YY_Release_Notes">RN</a>
+: <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.20_Release_Notes">RN</a>
 
 # Feature Support
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 17:33:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 17:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901365.1309321 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpW8d-0005g9-NT; Tue, 04 Mar 2025 17:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901365.1309321; Tue, 04 Mar 2025 17:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpW8d-0005g1-Kt; Tue, 04 Mar 2025 17:33:03 +0000
Received: by outflank-mailman (input) for mailman id 901365;
 Tue, 04 Mar 2025 17:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpW8c-0005fv-1k
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 17:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpW8b-001P69-33
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 17:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpW8b-006V03-2A
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 17:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HxshdxYPGVDy4+pGLBJTWK7r1RqWsvrz5XILrtVo4Ws=; b=1/LQ5L2Lofi/suJKKEBNBbUm76
	IgPHhN6l1bzvfjFgTW7kM2yYj1IMCXPQOgbI0iR26/u1fZU6wKFNhdWLNNpzCFsjqvQNk9FF+HS73
	cR1vK7nV+Hv+BGBWsUHMhyA0bSDzDrxPYFa/xmdOW2OEAXcoYjQSmoTnH2A59tGJMxdo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] Config.mk: Bump tags to final
Message-Id: <E1tpW8b-006V03-2A@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 17:33:01 +0000

commit 89fd1ba88403ff180cb4ca0472ece527012dc7fb
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 4 16:12:23 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 16:41:08 2025 +0000

    Config.mk: Bump tags to final
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Config.mk b/Config.mk
index 1eb6ed04fe..1a86c03d11 100644
--- a/Config.mk
+++ b/Config.mk
@@ -229,10 +229,10 @@ OVMF_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/ovmf.git
 OVMF_UPSTREAM_REVISION ?= ba91d0292e593df8528b66f99c1b0b14fadc8e16
 
 QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
-QEMU_UPSTREAM_REVISION ?= 3fdb3cd3a27a22a050c7d27126a24807a7a45745
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.20.0
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= 6d5159e8410be16a47433bac1627e63f8adc7cd9
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.20.0
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.3
@@ -241,7 +241,7 @@ ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
 QEMU_TRADITIONAL_URL ?= https://xenbits.xen.org/git-http/qemu-xen-traditional.git
-QEMU_TRADITIONAL_REVISION ?= 3d273dd05e51e5a1ffba3d98c7437ee84e8f8764
+QEMU_TRADITIONAL_REVISION ?= xen-4.20.0
 # Wed Jul 15 10:01:40 2020 +0100
 # qemu-trad: remove Xen path dependencies
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 17:33:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 17:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901366.1309325 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpW8n-0005hg-PK; Tue, 04 Mar 2025 17:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901366.1309325; Tue, 04 Mar 2025 17:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpW8n-0005hZ-MK; Tue, 04 Mar 2025 17:33:13 +0000
Received: by outflank-mailman (input) for mailman id 901366;
 Tue, 04 Mar 2025 17:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpW8l-0005hN-Rn
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 17:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpW8m-001P6F-0D
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 17:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpW8l-006V0V-2T
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 17:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3Umf8s//hkMN7uXAmWiPyvm7/AbOZ/T7oanZSptp22Q=; b=GUF6JF+k6gyF3VqUd8liWEf+kZ
	Y9VHLfzSVgJKb49n0SRcm3y0JB95gz1Er/nu9LwBfdGYQZHgCdMzr+jI75XMGZegc0l3+rkhAhKU1
	liM+r+eXPcdI5ImcpCwIY3KIjBxxkQ9ZM4QJV3pcy+LD9YdcWNGzPPbcSVWbL8rnuiD4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] Update to Xen 4.20
Message-Id: <E1tpW8l-006V0V-2T@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 17:33:11 +0000

commit 3ad5d648cda5add395f49fc3704b2552aae734f7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 4 16:17:52 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 16:41:08 2025 +0000

    Update to Xen 4.20
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 README       | 12 ++++++------
 xen/Makefile |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/README b/README
index 373885523c..6cf929c0ef 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
-#####################################################
+######################################
 __  __            _  _    ____   ___
-\ \/ /___ _ __   | || |  |___ \ / _ \       _ __ ___
- \  // _ \ '_ \  | || |_   __) | | | |_____| '__/ __|
- /  \  __/ | | | |__   _| / __/| |_| |_____| | | (__
-/_/\_\___|_| |_|    |_|(_)_____|\___/      |_|  \___|
+\ \/ /___ _ __   | || |  |___ \ / _ \
+ \  // _ \ '_ \  | || |_   __) | | | |
+ /  \  __/ | | | |__   _| / __/| |_| |
+/_/\_\___|_| |_|    |_|(_)_____|\___/
 
-#####################################################
+######################################
 
 https://www.xen.org/
 
diff --git a/xen/Makefile b/xen/Makefile
index 4e37fff925..6bf0b0ea9e 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -6,7 +6,7 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 20
-export XEN_EXTRAVERSION ?= .0-rc5$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .0$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 18:33:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 18:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901452.1309398 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpX4h-0001sQ-Oh; Tue, 04 Mar 2025 18:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901452.1309398; Tue, 04 Mar 2025 18:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpX4h-0001sJ-MD; Tue, 04 Mar 2025 18:33:03 +0000
Received: by outflank-mailman (input) for mailman id 901452;
 Tue, 04 Mar 2025 18:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpX4f-0001s9-RD
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 18:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpX4f-001QLH-2h
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 18:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpX4f-006XFg-1b
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 18:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=b7RlWJ6MXmGVBJpoDOmUoOU4cDrTH/k1tN56M+p4H+Q=; b=rcCfzntIPwiIOe4ihYSTxYSk5w
	lfKtymwawsxCrcmFyQMH17DhhsFw5VDCdXV3kLK3WdMb442sCjGiixZTIGs8U5CMs7Jz+yuqFx8Q3
	MPs/BRedp5FU0PArfHlnfjCEKo3DBT5jM/uh8pVUVahy3n2Ea9O0awsnvBxtLR4HMADU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] Config.mk: Bump tags to final
Message-Id: <E1tpX4f-006XFg-1b@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 18:33:01 +0000

commit 89fd1ba88403ff180cb4ca0472ece527012dc7fb
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 4 16:12:23 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 16:41:08 2025 +0000

    Config.mk: Bump tags to final
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Config.mk b/Config.mk
index 1eb6ed04fe..1a86c03d11 100644
--- a/Config.mk
+++ b/Config.mk
@@ -229,10 +229,10 @@ OVMF_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/ovmf.git
 OVMF_UPSTREAM_REVISION ?= ba91d0292e593df8528b66f99c1b0b14fadc8e16
 
 QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
-QEMU_UPSTREAM_REVISION ?= 3fdb3cd3a27a22a050c7d27126a24807a7a45745
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.20.0
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= 6d5159e8410be16a47433bac1627e63f8adc7cd9
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.20.0
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.3
@@ -241,7 +241,7 @@ ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
 QEMU_TRADITIONAL_URL ?= https://xenbits.xen.org/git-http/qemu-xen-traditional.git
-QEMU_TRADITIONAL_REVISION ?= 3d273dd05e51e5a1ffba3d98c7437ee84e8f8764
+QEMU_TRADITIONAL_REVISION ?= xen-4.20.0
 # Wed Jul 15 10:01:40 2020 +0100
 # qemu-trad: remove Xen path dependencies
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 18:33:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 18:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901453.1309403 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpX4q-0001uJ-QA; Tue, 04 Mar 2025 18:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901453.1309403; Tue, 04 Mar 2025 18:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpX4q-0001uC-Nc; Tue, 04 Mar 2025 18:33:12 +0000
Received: by outflank-mailman (input) for mailman id 901453;
 Tue, 04 Mar 2025 18:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpX4p-0001tz-Pp
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 18:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpX4p-001QLW-32
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 18:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpX4p-006XGr-27
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 18:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uLGcgBlaawZ7r68B863XnBhZV2SUfOwGhle5pqisLew=; b=mWzGZ5hcanZDtE+Uzm8zVSiS7a
	/CAXplZW7ZuZlf+DplP7pUej46qZU78IxFRoD8aaBkDhI2hsNbm4Yci11XmUuI8cF0Bfk1np4pZTW
	LiqIlYZf/IyUGcp4Y1fVVSK7QLUmxani0vctgBqDSDA+ATkgyONFMfA44avigl21mM3I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] Update to Xen 4.20
Message-Id: <E1tpX4p-006XGr-27@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 18:33:11 +0000

commit 3ad5d648cda5add395f49fc3704b2552aae734f7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 4 16:17:52 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 16:41:08 2025 +0000

    Update to Xen 4.20
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 README       | 12 ++++++------
 xen/Makefile |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/README b/README
index 373885523c..6cf929c0ef 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
-#####################################################
+######################################
 __  __            _  _    ____   ___
-\ \/ /___ _ __   | || |  |___ \ / _ \       _ __ ___
- \  // _ \ '_ \  | || |_   __) | | | |_____| '__/ __|
- /  \  __/ | | | |__   _| / __/| |_| |_____| | | (__
-/_/\_\___|_| |_|    |_|(_)_____|\___/      |_|  \___|
+\ \/ /___ _ __   | || |  |___ \ / _ \
+ \  // _ \ '_ \  | || |_   __) | | | |
+ /  \  __/ | | | |__   _| / __/| |_| |
+/_/\_\___|_| |_|    |_|(_)_____|\___/
 
-#####################################################
+######################################
 
 https://www.xen.org/
 
diff --git a/xen/Makefile b/xen/Makefile
index 4e37fff925..6bf0b0ea9e 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -6,7 +6,7 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 20
-export XEN_EXTRAVERSION ?= .0-rc5$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .0$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 19:33:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 19:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901494.1309447 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpY0l-0006qn-KU; Tue, 04 Mar 2025 19:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901494.1309447; Tue, 04 Mar 2025 19:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpY0l-0006qf-Hm; Tue, 04 Mar 2025 19:33:03 +0000
Received: by outflank-mailman (input) for mailman id 901494;
 Tue, 04 Mar 2025 19:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpY0k-0006qZ-82
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 19:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpY0k-001RVy-0j
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 19:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpY0j-006ZVM-2z
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 19:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ac/WfLvmC0tsDYQRNDvoVOf6sGQaRV/B6/Jol1MJ9Lo=; b=aUpzixb0bgBnEvEioJAyCXtP7F
	SMiiDPLlThmLEdwYHrT2F8kN15TpxkNcNiVZe20Ofc4bGAA1DP0yDEWRdC/3CTD9D1FreMIwiMxzp
	8AR3Dw4OQG0FMyXw037n5LjsbV95VsoF6xz8Q01L/p9bzDau2dz38NrEJ/XFOwcJbeUY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair: Reduce verbosity of ECLAIR logs.
Message-Id: <E1tpY0j-006ZVM-2z@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 19:33:01 +0000

commit 78f2a5792c68128e3205dd18f0f92fd408bf5cd8
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Tue Mar 4 18:49:36 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Mar 4 11:29:12 2025 -0800

    automation/eclair: Reduce verbosity of ECLAIR logs.
    
    While activating verbose logging simplifies debugging, this causes
    GitLab logs to be truncated, preventing the links to the ECLAIR
    analysis database to be shown.
    
    No functional change.
    
    Fixes: c4392ec83244 ("automation: Add ECLAIR utilities and settings")
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/analysis.ecl | 2 --
 automation/eclair_analysis/ECLAIR/analyze.sh   | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/analysis.ecl b/automation/eclair_analysis/ECLAIR/analysis.ecl
index 824283a989..29409a9af0 100644
--- a/automation/eclair_analysis/ECLAIR/analysis.ecl
+++ b/automation/eclair_analysis/ECLAIR/analysis.ecl
@@ -10,8 +10,6 @@ setq(analysis_kind,getenv("ANALYSIS_KIND"))
 # strings_map("scheduled-analysis",500,"","^.*$",0)
 # map_strings("scheduled-analysis",analysis_kind)
 
--verbose
-
 -enable=B.REPORT.ECB
 -config=B.REPORT.ECB,output=join_paths(data_dir,"FRAME.@FRAME@.ecb")
 -config=B.REPORT.ECB,preprocessed=show
diff --git a/automation/eclair_analysis/ECLAIR/analyze.sh b/automation/eclair_analysis/ECLAIR/analyze.sh
index 1dc63c1bc2..2356fc4007 100755
--- a/automation/eclair_analysis/ECLAIR/analyze.sh
+++ b/automation/eclair_analysis/ECLAIR/analyze.sh
@@ -91,11 +91,13 @@ find "${ECLAIR_DATA_DIR}" -maxdepth 1 -name "FRAME.*.ecb" |
   sort | xargs cat |
   "${ECLAIR_BIN_DIR}eclair_report" \
     "-create_db='${PROJECT_ECD}'" \
+    -quiet \
     -load=/dev/stdin > "${ECLAIR_REPORT_LOG}" 2>&1
 
 # Create the Jenkins reports file.
 "${ECLAIR_BIN_DIR}eclair_report" \
   "-db='${PROJECT_ECD}'" \
+  -quiet \
   "-eval_file='${SCRIPT_DIR}/report.ecl'" \
   >> "${ECLAIR_REPORT_LOG}" 2>&1
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 19:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 19:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901498.1309451 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpYM4-0000om-4X; Tue, 04 Mar 2025 19:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901498.1309451; Tue, 04 Mar 2025 19:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpYM4-0000oe-1g; Tue, 04 Mar 2025 19:55:04 +0000
Received: by outflank-mailman (input) for mailman id 901498;
 Tue, 04 Mar 2025 19:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpYM2-0000oW-L3
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 19:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpYM2-001Rvx-1n
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 19:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpYM2-006adB-0s
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 19:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Pf3MoKA04XBKsQ2RWUSz/Jhdg8yrHUhdhCpnT87ms/g=; b=cOA/l6tjhmkQLZQSv31KEze4n8
	B8rSurHJwPGUhDEnC/60QSm5FieOpyorZuw22iMTBe4lgidIxxcp7juxvReULlzE2tJHaMd+AnPCv
	2H1Mrf9nTDeApug+b7TedGZt9Z1L3uOPapoe/k2WMvUTqSr8Z26vHBPishCZrhVOFWFM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: Don't cast away const-ness in vcpu_show_registers()
Message-Id: <E1tpYM2-006adB-0s@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 19:55:02 +0000

commit c3923b9f30ab5715fa28d922546586875d95ebde
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 30 06:41:46 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 19:46:41 2025 +0000

    xen: Don't cast away const-ness in vcpu_show_registers()
    
    The final hunk is `(struct vcpu *)v` in disguise, expressed using a runtime
    pointer chase through memory and a technicality of the C type system to work
    around the fact that get_hvm_registers() strictly requires a mutable pointer.
    
    For anyone interested, this is one reason why C cannot optimise any reads
    across sequence points, even for a function purporting to take a const object.
    
    Anyway, have the function correctly state that it needs a mutable vcpu.  All
    callers have a mutable vCPU to hand, and it removes the runtime pointer chase
    in x86.
    
    Make one style adjustment in ARM while adjusting the parameter type.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/domain.h | 2 +-
 xen/arch/arm/traps.c              | 3 ++-
 xen/arch/x86/include/asm/domain.h | 2 +-
 xen/arch/x86/x86_64/traps.c       | 4 ++--
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index f1d72c6e48..50b6a4b009 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -243,7 +243,7 @@ struct arch_vcpu
 
 }  __cacheline_aligned;
 
-void vcpu_show_registers(const struct vcpu *v);
+void vcpu_show_registers(struct vcpu *v);
 void vcpu_switch_to_aarch64_mode(struct vcpu *v);
 
 /*
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 3071c38768..445e7378dd 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -964,9 +964,10 @@ void show_registers(const struct cpu_user_regs *regs)
     _show_registers(regs, &ctxt, guest_mode(regs), current);
 }
 
-void vcpu_show_registers(const struct vcpu *v)
+void vcpu_show_registers(struct vcpu *v)
 {
     struct reg_ctxt ctxt;
+
     ctxt.sctlr_el1 = v->arch.sctlr;
     ctxt.tcr_el1 = v->arch.ttbcr;
     ctxt.ttbr0_el1 = v->arch.ttbr0;
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index b79d6badd7..5fc1d1e5d0 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -688,7 +688,7 @@ bool update_secondary_system_time(struct vcpu *v,
 void force_update_secondary_system_time(struct vcpu *v,
                                         struct vcpu_time_info *map);
 
-void vcpu_show_registers(const struct vcpu *v);
+void vcpu_show_registers(struct vcpu *v);
 
 static inline struct vcpu_guest_context *alloc_vcpu_guest_context(void)
 {
diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
index 02fdb3637d..22d4db240b 100644
--- a/xen/arch/x86/x86_64/traps.c
+++ b/xen/arch/x86/x86_64/traps.c
@@ -170,7 +170,7 @@ void show_registers(const struct cpu_user_regs *regs)
     }
 }
 
-void vcpu_show_registers(const struct vcpu *v)
+void vcpu_show_registers(struct vcpu *v)
 {
     const struct cpu_user_regs *regs = &v->arch.user_regs;
     struct cpu_user_regs aux_regs;
@@ -180,7 +180,7 @@ void vcpu_show_registers(const struct vcpu *v)
     if ( is_hvm_vcpu(v) )
     {
         aux_regs = *regs;
-        get_hvm_registers(v->domain->vcpu[v->vcpu_id], &aux_regs, crs);
+        get_hvm_registers(v, &aux_regs, crs);
         regs = &aux_regs;
         context = CTXT_hvm_guest;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 19:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 19:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901499.1309454 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpYME-0000qf-6T; Tue, 04 Mar 2025 19:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901499.1309454; Tue, 04 Mar 2025 19:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpYME-0000qX-36; Tue, 04 Mar 2025 19:55:14 +0000
Received: by outflank-mailman (input) for mailman id 901499;
 Tue, 04 Mar 2025 19:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpYMC-0000qI-FN
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 19:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpYMC-001Rw1-2B
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 19:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpYMC-006adw-1J
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 19:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DBkCqYpgztUimdQHKWWu+fdbe02RTXQmBYWd/WCAc4c=; b=pVRci/QIODUw5x5iZopBJ5wq+w
	12SzSJL/pZFYzpxSHeCCzOP+uvB5MOTmK0ChI1kWJR/qTxJdZG/vzrAOeN8FpuZcDWbX+XGGoii0J
	iHuor55G4oBAy5KBWCsD0Kz+tOvk8kqeSZWgdSHWqum/gjAwfWtXnbgItISsIwSiXMRw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Sort includes in various files
Message-Id: <E1tpYMC-006adw-1J@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 19:55:12 +0000

commit 532ff1027ae4ea2b44a2f8a0aa28937f76278892
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 1 15:51:57 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 19:46:41 2025 +0000

    x86: Sort includes in various files
    
    FRED support involves quite a lot of header file shuffling and cleanup.  Start
    by sorting the includes of impacted files, and dropping duplciates.
    
      domain.c: Double asm/spec_ctrl.h
      power.c:  Double xen/sched.h
      setup.c:  Double xen/serial.h
      mm.c:     Double xen/mm.h
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/power.c    | 19 +++++-----
 xen/arch/x86/cpu/common.c    | 15 ++++----
 xen/arch/x86/crash.c         | 32 +++++++++--------
 xen/arch/x86/domain.c        | 84 +++++++++++++++++++++++---------------------
 xen/arch/x86/hvm/vmx/vmcs.c  | 25 ++++++-------
 xen/arch/x86/machine_kexec.c |  5 +--
 xen/arch/x86/mm.c            | 54 ++++++++++++++--------------
 xen/arch/x86/setup.c         | 84 +++++++++++++++++++++++---------------------
 xen/arch/x86/smpboot.c       | 22 ++++++------
 xen/arch/x86/traps.c         | 78 ++++++++++++++++++++--------------------
 xen/arch/x86/x86_64/traps.c  | 25 +++++++------
 11 files changed, 228 insertions(+), 215 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 08a7fc2508..d0b67614d5 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -11,28 +11,29 @@
  */
 
 #include <xen/acpi.h>
+#include <xen/console.h>
+#include <xen/cpu.h>
+#include <xen/domain.h>
 #include <xen/errno.h>
 #include <xen/iocap.h>
+#include <xen/iommu.h>
 #include <xen/param.h>
 #include <xen/sched.h>
-#include <asm/acpi.h>
-#include <asm/irq.h>
 #include <xen/spinlock.h>
-#include <xen/sched.h>
-#include <xen/domain.h>
-#include <xen/console.h>
-#include <xen/iommu.h>
 #include <xen/watchdog.h>
-#include <xen/cpu.h>
-#include <public/platform.h>
-#include <asm/tboot.h>
+
+#include <asm/acpi.h>
 #include <asm/apic.h>
 #include <asm/io_apic.h>
+#include <asm/irq.h>
 #include <asm/microcode.h>
 #include <asm/prot-key.h>
 #include <asm/spec_ctrl.h>
+#include <asm/tboot.h>
 #include <asm/trampoline.h>
 
+#include <public/platform.h>
+
 #include <acpi/cpufreq/cpufreq.h>
 
 uint32_t system_reset_counter = 1;
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 067d855bad..1cc4adccb4 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -1,24 +1,25 @@
-#include <xen/init.h>
-#include <xen/string.h>
 #include <xen/delay.h>
+#include <xen/init.h>
 #include <xen/param.h>
 #include <xen/smp.h>
+#include <xen/string.h>
 
 #include <asm/amd.h>
+#include <asm/apic.h>
 #include <asm/cpu-policy.h>
 #include <asm/current.h>
 #include <asm/debugreg.h>
-#include <asm/processor.h>
-#include <asm/xstate.h>
-#include <asm/msr.h>
 #include <asm/io.h>
 #include <asm/mpspec.h>
-#include <asm/apic.h>
+#include <asm/msr.h>
+#include <asm/processor.h>
 #include <asm/prot-key.h>
 #include <asm/random.h>
 #include <asm/setup.h>
 #include <asm/shstk.h>
-#include <public/sysctl.h> /* for XEN_INVALID_{SOCKET,CORE}_ID */
+#include <asm/xstate.h>
+
+#include <public/sysctl.h>
 
 #include "cpu.h"
 #include "mcheck/x86_mca.h"
diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 26057c71d3..4afe0ad859 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -8,27 +8,29 @@
  * - Magnus Damm <magnus@valinux.co.jp>
  */
 
-#include <asm/atomic.h>
-#include <asm/elf.h>
-#include <xen/types.h>
-#include <xen/irq.h>
-#include <asm/nmi.h>
-#include <xen/string.h>
+#include <xen/console.h>
+#include <xen/delay.h>
 #include <xen/elf.h>
 #include <xen/elfcore.h>
-#include <xen/smp.h>
-#include <xen/delay.h>
-#include <xen/perfc.h>
+#include <xen/iommu.h>
+#include <xen/irq.h>
 #include <xen/kexec.h>
-#include <xen/sched.h>
 #include <xen/keyhandler.h>
-#include <public/xen.h>
-#include <asm/shared.h>
+#include <xen/perfc.h>
+#include <xen/sched.h>
+#include <xen/smp.h>
+#include <xen/string.h>
+#include <xen/types.h>
+
 #include <asm/apic.h>
-#include <asm/io_apic.h>
-#include <xen/iommu.h>
+#include <asm/atomic.h>
+#include <asm/elf.h>
 #include <asm/hpet.h>
-#include <xen/console.h>
+#include <asm/io_apic.h>
+#include <asm/nmi.h>
+#include <asm/shared.h>
+
+#include <public/xen.h>
 
 static cpumask_t waiting_to_crash;
 static unsigned int crashing_cpu;
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 78a13e6812..7b2549091f 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -11,66 +11,68 @@
  *  Gareth Hughes <gareth@valinux.com>, May 2000
  */
 
-#include <xen/init.h>
-#include <xen/lib.h>
-#include <xen/errno.h>
-#include <xen/sched.h>
-#include <xen/domain.h>
-#include <xen/smp.h>
+#include <xen/acpi.h>
+#include <xen/compat.h>
+#include <xen/console.h>
+#include <xen/cpu.h>
 #include <xen/delay.h>
-#include <xen/softirq.h>
+#include <xen/domain.h>
+#include <xen/errno.h>
+#include <xen/event.h>
 #include <xen/grant_table.h>
+#include <xen/guest_access.h>
+#include <xen/hypercall.h>
+#include <xen/init.h>
 #include <xen/iocap.h>
+#include <xen/irq.h>
 #include <xen/kernel.h>
-#include <xen/hypercall.h>
+#include <xen/lib.h>
+#include <xen/livepatch.h>
 #include <xen/multicall.h>
-#include <xen/irq.h>
-#include <xen/event.h>
-#include <xen/console.h>
-#include <xen/percpu.h>
-#include <xen/compat.h>
-#include <xen/acpi.h>
-#include <xen/pci.h>
 #include <xen/paging.h>
-#include <xen/cpu.h>
+#include <xen/pci.h>
+#include <xen/percpu.h>
+#include <xen/sched.h>
+#include <xen/smp.h>
+#include <xen/softirq.h>
 #include <xen/wait.h>
-#include <xen/guest_access.h>
-#include <xen/livepatch.h>
-#include <public/arch-x86/cpuid.h>
-#include <public/sysctl.h>
-#include <public/hvm/hvm_vcpu.h>
-#include <asm/regs.h>
-#include <asm/mc146818rtc.h>
-#include <asm/system.h>
-#include <asm/io.h>
-#include <asm/processor.h>
-#include <asm/desc.h>
-#include <asm/i387.h>
-#include <asm/xstate.h>
+
+#include <asm/amd.h>
+#include <asm/cpu-policy.h>
 #include <asm/cpuidle.h>
-#include <asm/mpspec.h>
-#include <asm/ldt.h>
+#include <asm/debugreg.h>
+#include <asm/desc.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/viridian.h>
-#include <asm/debugreg.h>
+#include <asm/i387.h>
+#include <asm/io.h>
+#include <asm/ldt.h>
+#include <asm/mc146818rtc.h>
+#include <asm/mce.h>
+#include <asm/mpspec.h>
 #include <asm/msr.h>
+#include <asm/nmi.h>
+#include <asm/processor.h>
+#include <asm/psr.h>
+#include <asm/pv/domain.h>
+#include <asm/pv/mm.h>
+#include <asm/regs.h>
 #include <asm/spec_ctrl.h>
+#include <asm/system.h>
 #include <asm/traps.h>
-#include <asm/nmi.h>
-#include <asm/mce.h>
-#include <asm/amd.h>
-#include <xen/numa.h>
+#include <asm/xstate.h>
 #include <xen/iommu.h>
+#include <xen/numa.h>
+
+#include <public/arch-x86/cpuid.h>
+#include <public/sysctl.h>
+#include <public/hvm/hvm_vcpu.h>
+
 #ifdef CONFIG_COMPAT
 #include <compat/vcpu.h>
 #endif
-#include <asm/cpu-policy.h>
-#include <asm/psr.h>
-#include <asm/pv/domain.h>
-#include <asm/pv/mm.h>
-#include <asm/spec_ctrl.h>
 
 DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
 
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 8c0ea789c1..fa9d8b3267 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -4,33 +4,34 @@
  * Copyright (c) 2004, Intel Corporation.
  */
 
-#include <xen/init.h>
-#include <xen/mm.h>
-#include <xen/lib.h>
-#include <xen/param.h>
-#include <xen/errno.h>
 #include <xen/domain_page.h>
+#include <xen/errno.h>
 #include <xen/event.h>
+#include <xen/init.h>
 #include <xen/kernel.h>
 #include <xen/keyhandler.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/param.h>
 #include <xen/vm_event.h>
-#include <asm/current.h>
+
+#include <asm/apic.h>
 #include <asm/cpufeature.h>
-#include <asm/processor.h>
-#include <asm/msr.h>
-#include <asm/xstate.h>
+#include <asm/current.h>
+#include <asm/flushtlb.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/io.h>
 #include <asm/hvm/nestedhvm.h>
+#include <asm/hvm/vmx/vmcs.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/hvm/vmx/vvmx.h>
-#include <asm/hvm/vmx/vmcs.h>
-#include <asm/flushtlb.h>
 #include <asm/monitor.h>
+#include <asm/msr.h>
+#include <asm/processor.h>
 #include <asm/shadow.h>
 #include <asm/spec_ctrl.h>
 #include <asm/tboot.h>
-#include <asm/apic.h>
+#include <asm/xstate.h>
 
 static bool __read_mostly opt_vpid_enabled = true;
 boolean_param("vpid", opt_vpid_enabled);
diff --git a/xen/arch/x86/machine_kexec.c b/xen/arch/x86/machine_kexec.c
index d50772ad6c..e20e8d0b15 100644
--- a/xen/arch/x86/machine_kexec.c
+++ b/xen/arch/x86/machine_kexec.c
@@ -15,14 +15,15 @@
  * Version 2.  See the file COPYING for more details.
  */
 
-#include <xen/types.h>
 #include <xen/domain_page.h>
 #include <xen/elfstructs.h>
 #include <xen/kexec.h>
+#include <xen/types.h>
+
 #include <asm/fixmap.h>
 #include <asm/hpet.h>
-#include <asm/page.h>
 #include <asm/machine_kexec.h>
+#include <asm/page.h>
 
 /*
  * Add a mapping for a page to the page tables used during kexec.
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index fa21903eb2..6b34b908ef 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -87,51 +87,53 @@
  * doing the final put_page(), and remove it from the iommu if so.
  */
 
+#include <xen/domain.h>
+#include <xen/domain_page.h>
+#include <xen/efi.h>
+#include <xen/err.h>
+#include <xen/event.h>
+#include <xen/guest_access.h>
+#include <xen/hypercall.h>
 #include <xen/init.h>
+#include <xen/iocap.h>
 #include <xen/ioreq.h>
+#include <xen/irq.h>
 #include <xen/kernel.h>
 #include <xen/lib.h>
 #include <xen/livepatch.h>
 #include <xen/mm.h>
 #include <xen/param.h>
-#include <xen/domain.h>
-#include <xen/sched.h>
-#include <xen/err.h>
 #include <xen/perfc.h>
-#include <xen/irq.h>
-#include <xen/softirq.h>
-#include <xen/domain_page.h>
-#include <xen/event.h>
-#include <xen/iocap.h>
-#include <xen/guest_access.h>
 #include <xen/pfn.h>
+#include <xen/sched.h>
+#include <xen/softirq.h>
+#include <xen/trace.h>
 #include <xen/vmap.h>
 #include <xen/xmalloc.h>
-#include <xen/efi.h>
-#include <xen/hypercall.h>
-#include <xen/mm.h>
-#include <asm/paging.h>
-#include <asm/shadow.h>
-#include <asm/page.h>
+
+#include <asm/e820.h>
+#include <asm/fixmap.h>
 #include <asm/flushtlb.h>
+#include <asm/guest.h>
 #include <asm/io.h>
+#include <asm/io_apic.h>
 #include <asm/ldt.h>
-#include <asm/x86_emulate.h>
-#include <asm/e820.h>
-#include <asm/shared.h>
 #include <asm/mem_sharing.h>
-#include <public/memory.h>
-#include <public/sched.h>
-#include <xsm/xsm.h>
-#include <xen/trace.h>
-#include <asm/setup.h>
-#include <asm/fixmap.h>
-#include <asm/io_apic.h>
+#include <asm/page.h>
+#include <asm/paging.h>
 #include <asm/pci.h>
-#include <asm/guest.h>
 #include <asm/pv/domain.h>
 #include <asm/pv/mm.h>
+#include <asm/setup.h>
+#include <asm/shadow.h>
+#include <asm/shared.h>
 #include <asm/trampoline.h>
+#include <asm/x86_emulate.h>
+
+#include <public/memory.h>
+#include <public/sched.h>
+
+#include <xsm/xsm.h>
 
 #ifdef CONFIG_PV
 #include "pv/mm.h"
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8ebe5a9443..143749e5da 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1,68 +1,70 @@
-#include <xen/init.h>
-#include <xen/lib.h>
+#include <xen/acpi.h>
+#include <xen/bitops.h>
+#include <xen/console.h>
+#include <xen/cpu.h>
+#include <xen/cpuidle.h>
+#include <xen/dmi.h>
+#include <xen/domain.h>
+#include <xen/domain_page.h>
+#include <xen/efi.h>
 #include <xen/err.h>
 #include <xen/grant_table.h>
+#include <xen/hypercall.h>
+#include <xen/init.h>
+#include <xen/kexec.h>
+#include <xen/keyhandler.h>
+#include <xen/lib.h>
+#include <xen/multiboot.h>
+#include <xen/nodemask.h>
+#include <xen/numa.h>
 #include <xen/param.h>
+#include <xen/pfn.h>
+#include <xen/rcupdate.h>
 #include <xen/sched.h>
-#include <xen/domain.h>
 #include <xen/sections.h>
 #include <xen/serial.h>
 #include <xen/softirq.h>
-#include <xen/acpi.h>
-#include <xen/efi.h>
-#include <xen/console.h>
-#include <xen/serial.h>
 #include <xen/trace.h>
-#include <xen/multiboot.h>
-#include <xen/domain_page.h>
 #include <xen/version.h>
-#include <xen/hypercall.h>
-#include <xen/keyhandler.h>
-#include <xen/numa.h>
-#include <xen/rcupdate.h>
 #include <xen/vga.h>
-#include <xen/dmi.h>
-#include <xen/pfn.h>
-#include <xen/nodemask.h>
 #include <xen/virtual_region.h>
 #include <xen/watchdog.h>
-#include <public/version.h>
-#ifdef CONFIG_COMPAT
-#include <compat/platform.h>
-#include <compat/xen.h>
-#endif
-#include <xen/bitops.h>
-#include <asm/bootinfo.h>
-#include <asm/smp.h>
-#include <asm/processor.h>
-#include <asm/mpspec.h>
+
+#include <asm/alternative.h>
 #include <asm/apic.h>
-#include <asm/msi.h>
+#include <asm/bootinfo.h>
+#include <asm/bzimage.h>
+#include <asm/cpu-policy.h>
 #include <asm/desc.h>
-#include <asm/paging.h>
 #include <asm/e820.h>
-#include <xen/kexec.h>
 #include <asm/edd.h>
-#include <xsm/xsm.h>
-#include <asm/tboot.h>
-#include <asm/bzimage.h> /* for bzimage_headroom */
 #include <asm/genapic.h>
+#include <asm/guest.h>
+#include <asm/invpcid.h>
 #include <asm/io_apic.h>
-#include <asm/setup.h>
-#include <xen/cpu.h>
-#include <xen/cpuidle.h>
-#include <asm/nmi.h>
-#include <asm/alternative.h>
 #include <asm/mc146818rtc.h>
-#include <asm/cpu-policy.h>
-#include <asm/invpcid.h>
-#include <asm/spec_ctrl.h>
-#include <asm/guest.h>
 #include <asm/microcode.h>
+#include <asm/mpspec.h>
+#include <asm/msi.h>
+#include <asm/nmi.h>
+#include <asm/paging.h>
+#include <asm/processor.h>
 #include <asm/prot-key.h>
 #include <asm/pv/domain.h>
+#include <asm/setup.h>
+#include <asm/smp.h>
+#include <asm/spec_ctrl.h>
+#include <asm/tboot.h>
 #include <asm/trampoline.h>
 
+#include <xsm/xsm.h>
+
+#include <public/version.h>
+#ifdef CONFIG_COMPAT
+#include <compat/platform.h>
+#include <compat/xen.h>
+#endif
+
 /* opt_nosmp: If true, secondary processors are ignored. */
 static bool __initdata opt_nosmp;
 boolean_param("nosmp", opt_nosmp);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 891a29fca1..f904d56232 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -7,39 +7,39 @@
  *  (c) 1998, 1999, 2000 Ingo Molnar <mingo@redhat.com>
  */
 
+#include <xen/cpu.h>
+#include <xen/delay.h>
+#include <xen/domain.h>
+#include <xen/domain_page.h>
 #include <xen/init.h>
+#include <xen/irq.h>
 #include <xen/kernel.h>
 #include <xen/mm.h>
-#include <xen/domain.h>
-#include <xen/domain_page.h>
+#include <xen/numa.h>
 #include <xen/sched.h>
-#include <xen/irq.h>
-#include <xen/delay.h>
+#include <xen/serial.h>
 #include <xen/softirq.h>
 #include <xen/tasklet.h>
-#include <xen/serial.h>
-#include <xen/numa.h>
-#include <xen/cpu.h>
 
 #include <asm/apic.h>
-#include <asm/io_apic.h>
 #include <asm/cpuidle.h>
 #include <asm/current.h>
-#include <asm/mc146818rtc.h>
 #include <asm/desc.h>
 #include <asm/div64.h>
 #include <asm/flushtlb.h>
 #include <asm/guest.h>
+#include <asm/io_apic.h>
+#include <asm/irq-vectors.h>
+#include <asm/mc146818rtc.h>
 #include <asm/microcode.h>
 #include <asm/msr.h>
 #include <asm/mtrr.h>
 #include <asm/prot-key.h>
 #include <asm/setup.h>
 #include <asm/spec_ctrl.h>
-#include <asm/time.h>
 #include <asm/tboot.h>
+#include <asm/time.h>
 #include <asm/trampoline.h>
-#include <asm/irq-vectors.h>
 
 uint32_t __ro_after_init trampoline_phys;
 enum ap_boot_method __read_mostly ap_boot_method = AP_BOOT_NORMAL;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index be2bc59f03..3613ce573c 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -12,65 +12,67 @@
  * Gareth Hughes <gareth@valinux.com>, May 2000
  */
 
+#include <xen/bitops.h>
 #include <xen/bug.h>
-#include <xen/init.h>
-#include <xen/sched.h>
-#include <xen/lib.h>
+#include <xen/console.h>
+#include <xen/delay.h>
+#include <xen/domain_page.h>
 #include <xen/err.h>
 #include <xen/errno.h>
+#include <xen/event.h>
+#include <xen/guest_access.h>
 #include <xen/hypercall.h>
+#include <xen/init.h>
+#include <xen/iocap.h>
+#include <xen/irq.h>
+#include <xen/kexec.h>
+#include <xen/lib.h>
+#include <xen/livepatch.h>
 #include <xen/mm.h>
+#include <xen/paging.h>
 #include <xen/param.h>
-#include <xen/console.h>
-#include <xen/shutdown.h>
-#include <xen/guest_access.h>
-#include <asm/regs.h>
-#include <xen/delay.h>
-#include <xen/event.h>
-#include <xen/spinlock.h>
-#include <xen/irq.h>
 #include <xen/perfc.h>
+#include <xen/sched.h>
+#include <xen/shutdown.h>
 #include <xen/softirq.h>
-#include <xen/domain_page.h>
+#include <xen/spinlock.h>
 #include <xen/symbols.h>
-#include <xen/iocap.h>
-#include <xen/kexec.h>
 #include <xen/trace.h>
-#include <xen/paging.h>
 #include <xen/virtual_region.h>
 #include <xen/watchdog.h>
-#include <xen/livepatch.h>
-#include <asm/system.h>
-#include <asm/io.h>
+
+#include <xsm/xsm.h>
+
+#include <asm/apic.h>
 #include <asm/atomic.h>
-#include <xen/bitops.h>
-#include <asm/desc.h>
+#include <asm/cpuid.h>
 #include <asm/debugreg.h>
-#include <asm/gdbsx.h>
-#include <asm/smp.h>
+#include <asm/desc.h>
 #include <asm/flushtlb.h>
-#include <asm/uaccess.h>
+#include <asm/gdbsx.h>
+#include <asm/hpet.h>
+#include <asm/hvm/vpt.h>
 #include <asm/i387.h>
-#include <asm/xstate.h>
+#include <asm/io.h>
+#include <asm/irq-vectors.h>
+#include <asm/mc146818rtc.h>
+#include <asm/mce.h>
 #include <asm/msr.h>
 #include <asm/nmi.h>
-#include <asm/xenoprof.h>
+#include <asm/pv/mm.h>
+#include <asm/pv/trace.h>
+#include <asm/pv/traps.h>
+#include <asm/regs.h>
 #include <asm/shared.h>
-#include <asm/x86_emulate.h>
+#include <asm/shstk.h>
+#include <asm/smp.h>
+#include <asm/system.h>
 #include <asm/traps.h>
-#include <asm/hvm/vpt.h>
-#include <asm/mce.h>
-#include <asm/apic.h>
-#include <asm/mc146818rtc.h>
-#include <asm/hpet.h>
+#include <asm/uaccess.h>
 #include <asm/vpmu.h>
-#include <asm/cpuid.h>
-#include <xsm/xsm.h>
-#include <asm/irq-vectors.h>
-#include <asm/pv/traps.h>
-#include <asm/pv/trace.h>
-#include <asm/pv/mm.h>
-#include <asm/shstk.h>
+#include <asm/x86_emulate.h>
+#include <asm/xenoprof.h>
+#include <asm/xstate.h>
 
 /*
  * opt_nmi: one of 'ignore', 'dom0', or 'fatal'.
diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
index 22d4db240b..7a370fae7d 100644
--- a/xen/arch/x86/x86_64/traps.c
+++ b/xen/arch/x86/x86_64/traps.c
@@ -1,28 +1,27 @@
-
-#include <xen/version.h>
+#include <xen/console.h>
+#include <xen/errno.h>
+#include <xen/guest_access.h>
+#include <xen/hypercall.h>
 #include <xen/init.h>
-#include <xen/sched.h>
+#include <xen/irq.h>
 #include <xen/lib.h>
-#include <xen/errno.h>
 #include <xen/mm.h>
-#include <xen/irq.h>
-#include <xen/symbols.h>
-#include <xen/console.h>
 #include <xen/sched.h>
 #include <xen/shutdown.h>
-#include <xen/guest_access.h>
+#include <xen/symbols.h>
+#include <xen/version.h>
 #include <xen/watchdog.h>
-#include <xen/hypercall.h>
+
 #include <asm/current.h>
-#include <asm/flushtlb.h>
-#include <asm/traps.h>
 #include <asm/endbr.h>
 #include <asm/event.h>
-#include <asm/nmi.h>
+#include <asm/flushtlb.h>
+#include <asm/hvm/hvm.h>
 #include <asm/msr.h>
+#include <asm/nmi.h>
 #include <asm/page.h>
 #include <asm/shared.h>
-#include <asm/hvm/hvm.h>
+#include <asm/traps.h>
 
 
 static void print_xen_info(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 19:55:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 19:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901500.1309458 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpYMO-0000uJ-9E; Tue, 04 Mar 2025 19:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901500.1309458; Tue, 04 Mar 2025 19:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpYMO-0000uA-6j; Tue, 04 Mar 2025 19:55:24 +0000
Received: by outflank-mailman (input) for mailman id 901500;
 Tue, 04 Mar 2025 19:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpYMM-0000tu-KK
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 19:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpYMM-001RwL-2d
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 19:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpYMM-006aeI-1i
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 19:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H1x2Id/BWI7rvCbroERqXmgStoQ4xqhzl6aBVSeGzog=; b=RfmAcKQA78Pam5UWB9WPX7JImi
	0X4ynzaodMmDnl4e2mN+yBcjUgxpzf3a+30tHSkQUNWO2fJVtkOecH4CwqImTK9Wh+LMwVeGkj3f/
	yyKAd8ka4v+i/kVCi3Bmq4kPXdYdlFgAQg88XY2P3Dc1inSCJ/gUXAeDXm59PCSNv9Y4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/IDT: Collect IDT related content idt.h
Message-Id: <E1tpYMM-006aeI-1i@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 19:55:22 +0000

commit c58b1b11f59879d42aaac188ebe8c610a15e6816
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 1 15:43:20 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 19:46:41 2025 +0000

    x86/IDT: Collect IDT related content idt.h
    
    Logic concerning the IDT is somewhat different to the other system tables, and
    in particular ought not to be in asm/processor.h.  Collect it together a new
    header.
    
    While doing so, make a few minor adjustments:
    
     * Make set_ist() use volatile rather than ACCESS_ONCE(), as
       _write_gate_lower() already does, removing the need for xen/lib.h.
    
     * Move the BUILD_BUG_ON() from subarch_percpu_traps_init() into mm.c's
       build_assertions(), rather than including idt.h into x86_64/traps.c.
    
     * Drop UL from IST constants.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c            |   1 +
 xen/arch/x86/crash.c                 |   1 +
 xen/arch/x86/domain.c                |   1 +
 xen/arch/x86/hvm/svm/svm.c           |   1 +
 xen/arch/x86/hvm/vmx/vmcs.c          |   1 +
 xen/arch/x86/include/asm/desc.h      |  76 ---------------------
 xen/arch/x86/include/asm/idt.h       | 124 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/processor.h |  37 -----------
 xen/arch/x86/machine_kexec.c         |   1 +
 xen/arch/x86/mm.c                    |   4 ++
 xen/arch/x86/pv/traps.c              |   1 +
 xen/arch/x86/smpboot.c               |   1 +
 xen/arch/x86/traps.c                 |   1 +
 xen/arch/x86/x86_64/traps.c          |   3 -
 14 files changed, 137 insertions(+), 116 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 1cc4adccb4..1540ab0007 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -9,6 +9,7 @@
 #include <asm/cpu-policy.h>
 #include <asm/current.h>
 #include <asm/debugreg.h>
+#include <asm/idt.h>
 #include <asm/io.h>
 #include <asm/mpspec.h>
 #include <asm/msr.h>
diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 4afe0ad859..5f7d7b392a 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -26,6 +26,7 @@
 #include <asm/atomic.h>
 #include <asm/elf.h>
 #include <asm/hpet.h>
+#include <asm/idt.h>
 #include <asm/io_apic.h>
 #include <asm/nmi.h>
 #include <asm/shared.h>
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 7b2549091f..d3db76833f 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -47,6 +47,7 @@
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/viridian.h>
 #include <asm/i387.h>
+#include <asm/idt.h>
 #include <asm/io.h>
 #include <asm/ldt.h>
 #include <asm/mc146818rtc.h>
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 62905c2c7a..ea78da4f42 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -18,6 +18,7 @@
 #include <asm/cpufeature.h>
 #include <asm/current.h>
 #include <asm/debugreg.h>
+#include <asm/idt.h>
 #include <asm/gdbsx.h>
 #include <asm/hvm/emulate.h>
 #include <asm/hvm/hvm.h>
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index fa9d8b3267..0136830ebc 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -25,6 +25,7 @@
 #include <asm/hvm/vmx/vmcs.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/hvm/vmx/vvmx.h>
+#include <asm/idt.h>
 #include <asm/monitor.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
diff --git a/xen/arch/x86/include/asm/desc.h b/xen/arch/x86/include/asm/desc.h
index a1e0807d97..85fae6b2f9 100644
--- a/xen/arch/x86/include/asm/desc.h
+++ b/xen/arch/x86/include/asm/desc.h
@@ -115,82 +115,6 @@ typedef union {
     };
 } seg_desc_t;
 
-typedef union {
-    struct {
-        uint64_t a, b;
-    };
-    struct {
-        uint16_t addr0;
-        uint16_t cs;
-        uint8_t  ist; /* :3, 5 bits rsvd, but this yields far better code. */
-        uint8_t  type:4, s:1, dpl:2, p:1;
-        uint16_t addr1;
-        uint32_t addr2;
-        /* 32 bits rsvd. */
-    };
-} idt_entry_t;
-
-/* Write the lower 64 bits of an IDT Entry. This relies on the upper 32
- * bits of the address not changing, which is a safe assumption as all
- * functions we are likely to load will live inside the 1GB
- * code/data/bss address range.
- *
- * Ideally, we would use cmpxchg16b, but this is not supported on some
- * old AMD 64bit capable processors, and has no safe equivalent.
- */
-static inline void _write_gate_lower(volatile idt_entry_t *gate,
-                                     const idt_entry_t *new)
-{
-    ASSERT(gate->b == new->b);
-    gate->a = new->a;
-}
-
-#define _set_gate(gate_addr,type,dpl,addr)               \
-do {                                                     \
-    (gate_addr)->a = 0;                                  \
-    smp_wmb(); /* disable gate /then/ rewrite */         \
-    (gate_addr)->b =                                     \
-        ((unsigned long)(addr) >> 32);                   \
-    smp_wmb(); /* rewrite /then/ enable gate */          \
-    (gate_addr)->a =                                     \
-        (((unsigned long)(addr) & 0xFFFF0000UL) << 32) | \
-        ((unsigned long)(dpl) << 45) |                   \
-        ((unsigned long)(type) << 40) |                  \
-        ((unsigned long)(addr) & 0xFFFFUL) |             \
-        ((unsigned long)__HYPERVISOR_CS << 16) |         \
-        (1UL << 47);                                     \
-} while (0)
-
-static inline void _set_gate_lower(idt_entry_t *gate, unsigned long type,
-                                   unsigned long dpl, void *addr)
-{
-    idt_entry_t idte;
-    idte.b = gate->b;
-    idte.a =
-        (((unsigned long)(addr) & 0xFFFF0000UL) << 32) |
-        ((unsigned long)(dpl) << 45) |
-        ((unsigned long)(type) << 40) |
-        ((unsigned long)(addr) & 0xFFFFUL) |
-        ((unsigned long)__HYPERVISOR_CS << 16) |
-        (1UL << 47);
-    _write_gate_lower(gate, &idte);
-}
-
-/* Update the lower half handler of an IDT Entry, without changing any
- * other configuration. */
-static inline void _update_gate_addr_lower(idt_entry_t *gate, void *addr)
-{
-    idt_entry_t idte;
-    idte.a = gate->a;
-
-    idte.b = ((unsigned long)(addr) >> 32);
-    idte.a &= 0x0000FFFFFFFF0000ULL;
-    idte.a |= (((unsigned long)(addr) & 0xFFFF0000UL) << 32) |
-        ((unsigned long)(addr) & 0xFFFFUL);
-
-    _write_gate_lower(gate, &idte);
-}
-
 #define _set_tssldt_desc(desc,addr,limit,type)           \
 do {                                                     \
     (desc)[0].b = (desc)[1].b = 0;                       \
diff --git a/xen/arch/x86/include/asm/idt.h b/xen/arch/x86/include/asm/idt.h
new file mode 100644
index 0000000000..3689fdecbe
--- /dev/null
+++ b/xen/arch/x86/include/asm/idt.h
@@ -0,0 +1,124 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef X86_ASM_IDT_H
+#define X86_ASM_IDT_H
+
+#include <xen/bug.h>
+
+#include <asm/x86-defns.h>
+
+#define IST_NONE 0
+#define IST_MCE  1
+#define IST_NMI  2
+#define IST_DB   3
+#define IST_DF   4
+#define IST_MAX  4
+
+typedef union {
+    struct {
+        uint64_t a, b;
+    };
+    struct {
+        uint16_t addr0;
+        uint16_t cs;
+        uint8_t  ist; /* :3, 5 bits rsvd, but this yields far better code. */
+        uint8_t  type:4, s:1, dpl:2, p:1;
+        uint16_t addr1;
+        uint32_t addr2;
+        /* 32 bits rsvd. */
+    };
+} idt_entry_t;
+
+#define IDT_ENTRIES 256
+extern idt_entry_t idt_table[];
+extern idt_entry_t *idt_tables[];
+
+/*
+ * Set the Interrupt Stack Table used by a particular IDT entry.  Typically
+ * used on a live IDT, so volatile to disuade clever optimisations.
+ */
+static inline void set_ist(volatile idt_entry_t *idt, unsigned int ist)
+{
+    /* IST is a 3 bit field, 32 bits into the IDT entry. */
+    ASSERT(ist <= IST_MAX);
+
+    idt->ist = ist;
+}
+
+static inline void enable_each_ist(idt_entry_t *idt)
+{
+    set_ist(&idt[X86_EXC_DF],  IST_DF);
+    set_ist(&idt[X86_EXC_NMI], IST_NMI);
+    set_ist(&idt[X86_EXC_MC],  IST_MCE);
+    set_ist(&idt[X86_EXC_DB],  IST_DB);
+}
+
+static inline void disable_each_ist(idt_entry_t *idt)
+{
+    set_ist(&idt[X86_EXC_DF],  IST_NONE);
+    set_ist(&idt[X86_EXC_NMI], IST_NONE);
+    set_ist(&idt[X86_EXC_MC],  IST_NONE);
+    set_ist(&idt[X86_EXC_DB],  IST_NONE);
+}
+
+#define _set_gate(gate_addr,type,dpl,addr)               \
+do {                                                     \
+    (gate_addr)->a = 0;                                  \
+    smp_wmb(); /* disable gate /then/ rewrite */         \
+    (gate_addr)->b =                                     \
+        ((unsigned long)(addr) >> 32);                   \
+    smp_wmb(); /* rewrite /then/ enable gate */          \
+    (gate_addr)->a =                                     \
+        (((unsigned long)(addr) & 0xFFFF0000UL) << 32) | \
+        ((unsigned long)(dpl) << 45) |                   \
+        ((unsigned long)(type) << 40) |                  \
+        ((unsigned long)(addr) & 0xFFFFUL) |             \
+        ((unsigned long)__HYPERVISOR_CS << 16) |         \
+        (1UL << 47);                                     \
+} while (0)
+
+/*
+ * Write the lower 64 bits of an IDT Entry. This relies on the upper 32
+ * bits of the address not changing, which is a safe assumption as all
+ * functions we are likely to load will live inside the 1GB
+ * code/data/bss address range.
+ */
+static inline void _write_gate_lower(volatile idt_entry_t *gate,
+                                     const idt_entry_t *new)
+{
+    ASSERT(gate->b == new->b);
+    gate->a = new->a;
+}
+
+static inline void _set_gate_lower(idt_entry_t *gate, unsigned long type,
+                                   unsigned long dpl, void *addr)
+{
+    idt_entry_t idte;
+    idte.b = gate->b;
+    idte.a =
+        (((unsigned long)(addr) & 0xFFFF0000UL) << 32) |
+        ((unsigned long)(dpl) << 45) |
+        ((unsigned long)(type) << 40) |
+        ((unsigned long)(addr) & 0xFFFFUL) |
+        ((unsigned long)__HYPERVISOR_CS << 16) |
+        (1UL << 47);
+    _write_gate_lower(gate, &idte);
+}
+
+/*
+ * Update the lower half handler of an IDT entry, without changing any other
+ * configuration.
+ */
+static inline void _update_gate_addr_lower(idt_entry_t *gate, void *addr)
+{
+    idt_entry_t idte;
+    idte.a = gate->a;
+
+    idte.b = ((unsigned long)(addr) >> 32);
+    idte.a &= 0x0000FFFFFFFF0000ULL;
+    idte.a |= (((unsigned long)(addr) & 0xFFFF0000UL) << 32) |
+        ((unsigned long)(addr) & 0xFFFFUL);
+
+    _write_gate_lower(gate, &idte);
+}
+
+#endif /* X86_ASM_IDT_H */
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index 6bc88b0317..75af7ea3c4 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -353,43 +353,6 @@ struct tss_page {
 };
 DECLARE_PER_CPU(struct tss_page, tss_page);
 
-#define IST_NONE 0UL
-#define IST_MCE  1UL
-#define IST_NMI  2UL
-#define IST_DB   3UL
-#define IST_DF   4UL
-#define IST_MAX  4UL
-
-/* Set the Interrupt Stack Table used by a particular IDT entry. */
-static inline void set_ist(idt_entry_t *idt, unsigned int ist)
-{
-    /* IST is a 3 bit field, 32 bits into the IDT entry. */
-    ASSERT(ist <= IST_MAX);
-
-    /* Typically used on a live idt.  Disuade any clever optimisations. */
-    ACCESS_ONCE(idt->ist) = ist;
-}
-
-static inline void enable_each_ist(idt_entry_t *idt)
-{
-    set_ist(&idt[X86_EXC_DF],  IST_DF);
-    set_ist(&idt[X86_EXC_NMI], IST_NMI);
-    set_ist(&idt[X86_EXC_MC],  IST_MCE);
-    set_ist(&idt[X86_EXC_DB],  IST_DB);
-}
-
-static inline void disable_each_ist(idt_entry_t *idt)
-{
-    set_ist(&idt[X86_EXC_DF],  IST_NONE);
-    set_ist(&idt[X86_EXC_NMI], IST_NONE);
-    set_ist(&idt[X86_EXC_MC],  IST_NONE);
-    set_ist(&idt[X86_EXC_DB],  IST_NONE);
-}
-
-#define IDT_ENTRIES 256
-extern idt_entry_t idt_table[];
-extern idt_entry_t *idt_tables[];
-
 DECLARE_PER_CPU(root_pgentry_t *, root_pgt);
 
 extern void write_ptbase(struct vcpu *v);
diff --git a/xen/arch/x86/machine_kexec.c b/xen/arch/x86/machine_kexec.c
index e20e8d0b15..f775e526d5 100644
--- a/xen/arch/x86/machine_kexec.c
+++ b/xen/arch/x86/machine_kexec.c
@@ -22,6 +22,7 @@
 
 #include <asm/fixmap.h>
 #include <asm/hpet.h>
+#include <asm/idt.h>
 #include <asm/machine_kexec.h>
 #include <asm/page.h>
 
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 6b34b908ef..bfdc8fb019 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -115,6 +115,7 @@
 #include <asm/fixmap.h>
 #include <asm/flushtlb.h>
 #include <asm/guest.h>
+#include <asm/idt.h>
 #include <asm/io.h>
 #include <asm/io_apic.h>
 #include <asm/ldt.h>
@@ -6639,6 +6640,9 @@ static void __init __maybe_unused build_assertions(void)
      * using different PATs will not work.
      */
     BUILD_BUG_ON(XEN_MSR_PAT != 0x050100070406ULL);
+
+    /* IST_MAX IST pages + at least 1 guard page + primary stack. */
+    BUILD_BUG_ON((IST_MAX + 1) * PAGE_SIZE + PRIMARY_STACK_SIZE > STACK_SIZE);
 }
 
 /*
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index fd1597d0bd..77b034e4dc 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -13,6 +13,7 @@
 #include <xen/softirq.h>
 
 #include <asm/debugreg.h>
+#include <asm/idt.h>
 #include <asm/irq-vectors.h>
 #include <asm/pv/trace.h>
 #include <asm/shared.h>
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index f904d56232..f3d60d5bae 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -28,6 +28,7 @@
 #include <asm/div64.h>
 #include <asm/flushtlb.h>
 #include <asm/guest.h>
+#include <asm/idt.h>
 #include <asm/io_apic.h>
 #include <asm/irq-vectors.h>
 #include <asm/mc146818rtc.h>
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 3613ce573c..e466a260ca 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -53,6 +53,7 @@
 #include <asm/hpet.h>
 #include <asm/hvm/vpt.h>
 #include <asm/i387.h>
+#include <asm/idt.h>
 #include <asm/io.h>
 #include <asm/irq-vectors.h>
 #include <asm/mc146818rtc.h>
diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
index 7a370fae7d..ac0fafd72d 100644
--- a/xen/arch/x86/x86_64/traps.c
+++ b/xen/arch/x86/x86_64/traps.c
@@ -342,9 +342,6 @@ void subarch_percpu_traps_init(void)
     unsigned char *stub_page;
     unsigned int offset;
 
-    /* IST_MAX IST pages + at least 1 guard page + primary stack. */
-    BUILD_BUG_ON((IST_MAX + 1) * PAGE_SIZE + PRIMARY_STACK_SIZE > STACK_SIZE);
-
     /* No PV guests?  No need to set up SYSCALL/SYSENTER infrastructure. */
     if ( !IS_ENABLED(CONFIG_PV) )
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 19:55:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 19:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901501.1309463 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpYMY-0000wo-BY; Tue, 04 Mar 2025 19:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901501.1309463; Tue, 04 Mar 2025 19:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpYMY-0000wg-8K; Tue, 04 Mar 2025 19:55:34 +0000
Received: by outflank-mailman (input) for mailman id 901501;
 Tue, 04 Mar 2025 19:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpYMW-0000wP-OF
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 19:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpYMW-001RwP-34
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 19:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpYMW-006aee-29
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 19:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FRKHWuEfGEioyXoHU8q+Bu7XhIYd6ztD0e1XI4KLvfw=; b=ozyXo52rr2eiGxcr6MqPtEZxbL
	E/yeCftz09mzy0BelftGY3Ap8vJQKaG1mPb+g2Tfpp70CO6R5z3KuWl2jKp21y0OpwMCZFMFhtRSG
	osFpsqn8PkIqFsNhm3+jkKHlpzC150wrRtq5FXhwQkgmh0P5SNSjzduoDP5q5DpZP21o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/IDT: Rename X86_NR_VECTORS to X86_IDT_VECTORS
Message-Id: <E1tpYMW-006aee-29@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 19:55:32 +0000

commit 83e043ee72b8c2fe1d620d137c20a2ffb040da01
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 2 16:56:59 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 19:46:41 2025 +0000

    x86/IDT: Rename X86_NR_VECTORS to X86_IDT_VECTORS
    
    Observant readers may have noticed that the FRED spec has another 8 bits of
    space reserved immediately following the vector field.
    
    Make the existing constant more precise.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vlapic.c               |  4 ++--
 xen/arch/x86/hvm/vmx/intr.c             |  4 ++--
 xen/arch/x86/hvm/vmx/vmcs.c             |  2 +-
 xen/arch/x86/hvm/vmx/vmx.c              |  6 +++---
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  4 ++--
 xen/arch/x86/include/asm/irq.h          |  4 ++--
 xen/arch/x86/include/asm/x86-defns.h    |  2 +-
 xen/arch/x86/io_apic.c                  |  2 +-
 xen/arch/x86/irq.c                      | 12 ++++++------
 xen/arch/x86/pv/callback.c              |  4 ++--
 xen/arch/x86/pv/domain.c                |  4 ++--
 xen/arch/x86/traps.c                    |  4 ++--
 xen/arch/x86/x86_64/entry.S             |  2 +-
 13 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 3363926b48..91fc457165 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -72,7 +72,7 @@ static void vlapic_do_init(struct vlapic *vlapic);
 static int vlapic_find_highest_vector(const void *bitmap)
 {
     const uint32_t *word = bitmap;
-    unsigned int word_offset = X86_NR_VECTORS / 32;
+    unsigned int word_offset = X86_IDT_VECTORS / 32;
 
     /* Work backwards through the bitmap (first 32-bit word in every four). */
     while ( (word_offset != 0) && (word[(--word_offset)*4] == 0) )
@@ -665,7 +665,7 @@ int guest_rdmsr_x2apic(const struct vcpu *v, uint32_t msr, uint64_t *val)
         REG(LVT0)  | REG(LVT1) | REG(LVTERR)  | REG(TMICT)   |
         REG(TMCCT) | REG(TDCR) |
 #undef REG
-#define REGBLOCK(x) (((1UL << (X86_NR_VECTORS / 32)) - 1) << (APIC_ ## x >> 4))
+#define REGBLOCK(x) (((1UL << (X86_IDT_VECTORS / 32)) - 1) << (APIC_ ## x >> 4))
         REGBLOCK(ISR) | REGBLOCK(TMR) | REGBLOCK(IRR)
 #undef REGBLOCK
     };
diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c
index 1a4dfb499b..91b407e6bc 100644
--- a/xen/arch/x86/hvm/vmx/intr.c
+++ b/xen/arch/x86/hvm/vmx/intr.c
@@ -356,7 +356,7 @@ void asmlinkage vmx_intr_assist(void)
                 {
                     word = (const void *)&vlapic->regs->data[APIC_IRR];
                     printk(XENLOG_ERR "vIRR:");
-                    for ( i = X86_NR_VECTORS / 32; i-- ; )
+                    for ( i = X86_IDT_VECTORS / 32; i-- ; )
                         printk(" %08x", word[i*4]);
                     printk("\n");
                 }
@@ -366,7 +366,7 @@ void asmlinkage vmx_intr_assist(void)
                 {
                     word = (const void *)&pi_desc->pir;
                     printk(XENLOG_ERR " PIR:");
-                    for ( i = X86_NR_VECTORS / 32; i-- ; )
+                    for ( i = X86_IDT_VECTORS / 32; i-- ; )
                         printk(" %08x", word[i]);
                     printk("\n");
                 }
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 0136830ebc..20ab2d0f26 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1219,7 +1219,7 @@ static int construct_vmcs(struct vcpu *v)
         unsigned int i;
 
         /* EOI-exit bitmap */
-        bitmap_zero(v->arch.hvm.vmx.eoi_exit_bitmap, X86_NR_VECTORS);
+        bitmap_zero(v->arch.hvm.vmx.eoi_exit_bitmap, X86_IDT_VECTORS);
         for ( i = 0; i < ARRAY_SIZE(v->arch.hvm.vmx.eoi_exit_bitmap); ++i )
             __vmwrite(EOI_EXIT_BITMAP(i), 0);
 
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 3728d2cd0d..d87da427ad 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2199,7 +2199,7 @@ static void cf_check vmx_process_isr(int isr, struct vcpu *v)
      * is acceptable because the subsequent interrupts will set up the eoi
      * bitmap correctly.
      */
-    for ( i = 0x10; i < X86_NR_VECTORS; ++i )
+    for ( i = 0x10; i < X86_IDT_VECTORS; ++i )
         if ( vlapic_test_vector(i, &vlapic->regs->data[APIC_IRR]) ||
              vlapic_test_vector(i, &vlapic->regs->data[APIC_ISR]) )
             set_bit(i, v->arch.hvm.vmx.eoi_exit_bitmap);
@@ -2316,7 +2316,7 @@ static void cf_check vmx_sync_pir_to_irr(struct vcpu *v)
 {
     struct vlapic *vlapic = vcpu_vlapic(v);
     unsigned int group, i;
-    DECLARE_BITMAP(pending_intr, X86_NR_VECTORS);
+    DECLARE_BITMAP(pending_intr, X86_IDT_VECTORS);
 
     if ( !pi_test_and_clear_on(&v->arch.hvm.vmx.pi_desc) )
         return;
@@ -2324,7 +2324,7 @@ static void cf_check vmx_sync_pir_to_irr(struct vcpu *v)
     for ( group = 0; group < ARRAY_SIZE(pending_intr); group++ )
         pending_intr[group] = pi_get_pir(&v->arch.hvm.vmx.pi_desc, group);
 
-    bitmap_for_each ( i, pending_intr, X86_NR_VECTORS )
+    bitmap_for_each ( i, pending_intr, X86_IDT_VECTORS )
         vlapic_set_vector(i, &vlapic->regs->data[APIC_IRR]);
 }
 
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index e1d3398141..bfb2341011 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -71,7 +71,7 @@ struct vmx_msr_bitmap {
 };
 
 struct pi_desc {
-    DECLARE_BITMAP(pir, X86_NR_VECTORS);
+    DECLARE_BITMAP(pir, X86_IDT_VECTORS);
     union {
         struct {
             u16     on     : 1,  /* bit 256 - Outstanding Notification */
@@ -138,7 +138,7 @@ struct vmx_vcpu {
     unsigned int         host_msr_count;
 
     unsigned long        eoi_exitmap_changed;
-    DECLARE_BITMAP(eoi_exit_bitmap, X86_NR_VECTORS);
+    DECLARE_BITMAP(eoi_exit_bitmap, X86_IDT_VECTORS);
     struct pi_desc       pi_desc;
 
     unsigned long        host_cr0;
diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index 354868ba31..f9ed5dc86c 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -23,7 +23,7 @@ extern unsigned int nr_irqs;
 #define LEGACY_VECTOR(irq)          ((irq) + FIRST_LEGACY_VECTOR)
 
 typedef struct {
-    DECLARE_BITMAP(_bits, X86_NR_VECTORS);
+    DECLARE_BITMAP(_bits, X86_IDT_VECTORS);
 } vmask_t;
 
 struct irq_desc;
@@ -96,7 +96,7 @@ struct arch_irq_desc {
 
 #define IRQ_VECTOR_UNASSIGNED (-1)
 
-typedef int vector_irq_t[X86_NR_VECTORS];
+typedef int vector_irq_t[X86_IDT_VECTORS];
 DECLARE_PER_CPU(vector_irq_t, vector_irq);
 
 extern bool opt_noirqbalance;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 2493ec277f..61b0cea8f3 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -155,7 +155,7 @@
 #define X86_INVPCID_ALL_INCL_GLOBAL 2
 #define X86_INVPCID_ALL_NON_GLOBAL  3
 
-#define X86_NR_VECTORS 256
+#define X86_IDT_VECTORS 256
 
 /* Exception Vectors */
 #define X86_EXC_DE             0 /* Divide Error */
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 68680c102f..776dd57720 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -101,7 +101,7 @@ static void share_vector_maps(unsigned int src, unsigned int dst)
         return;
 
     bitmap_or(vector_map[src]->_bits, vector_map[src]->_bits,
-              vector_map[dst]->_bits, X86_NR_VECTORS);
+              vector_map[dst]->_bits, X86_IDT_VECTORS);
 
     for (pin = 0; pin < nr_ioapic_entries[dst]; ++pin) {
         int irq = apic_pin_2_gsi_irq(dst, pin);
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index ff3ac832f4..f35894577b 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -51,7 +51,7 @@ static vmask_t global_used_vector_map;
 
 struct irq_desc __read_mostly *irq_desc = NULL;
 
-static DECLARE_BITMAP(used_vectors, X86_NR_VECTORS);
+static DECLARE_BITMAP(used_vectors, X86_IDT_VECTORS);
 
 static DEFINE_SPINLOCK(vector_lock);
 
@@ -155,7 +155,7 @@ static int __init _bind_irq_vector(struct irq_desc *desc, int vector,
     cpumask_t online_mask;
     int cpu;
 
-    BUG_ON((unsigned)vector >= X86_NR_VECTORS);
+    BUG_ON((unsigned)vector >= X86_IDT_VECTORS);
 
     cpumask_and(&online_mask, cpu_mask, &cpu_online_map);
     if (cpumask_empty(&online_mask))
@@ -423,7 +423,7 @@ int __init init_irq_data(void)
     struct irq_desc *desc;
     int irq, vector;
 
-    for ( vector = 0; vector < X86_NR_VECTORS; ++vector )
+    for ( vector = 0; vector < X86_IDT_VECTORS; ++vector )
         this_cpu(vector_irq)[vector] = INT_MIN;
 
     irq_desc = xzalloc_array(struct irq_desc, nr_irqs);
@@ -745,7 +745,7 @@ void setup_vector_irq(unsigned int cpu)
     unsigned int irq, vector;
 
     /* Clear vector_irq */
-    for ( vector = 0; vector < X86_NR_VECTORS; ++vector )
+    for ( vector = 0; vector < X86_IDT_VECTORS; ++vector )
         per_cpu(vector_irq, cpu)[vector] = INT_MIN;
     /* Mark the inuse vectors */
     for ( irq = 0; irq < nr_irqs; ++irq )
@@ -972,7 +972,7 @@ uint8_t alloc_hipriority_vector(void)
     return next++;
 }
 
-static void (*direct_apic_vector[X86_NR_VECTORS])(void);
+static void (*direct_apic_vector[X86_IDT_VECTORS])(void);
 void set_direct_apic_vector(uint8_t vector, void (*handler)(void))
 {
     BUG_ON(direct_apic_vector[vector] != NULL);
@@ -2572,7 +2572,7 @@ static void cf_check dump_irqs(unsigned char key)
 
     process_pending_softirqs();
     printk("Direct vector information:\n");
-    for ( i = FIRST_DYNAMIC_VECTOR; i < X86_NR_VECTORS; ++i )
+    for ( i = FIRST_DYNAMIC_VECTOR; i < X86_IDT_VECTORS; ++i )
         if ( direct_apic_vector[i] )
             printk("   %#02x -> %ps()\n", i, direct_apic_vector[i]);
 
diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c
index caec4fb16f..38b819b566 100644
--- a/xen/arch/x86/pv/callback.c
+++ b/xen/arch/x86/pv/callback.c
@@ -347,7 +347,7 @@ long do_set_trap_table(XEN_GUEST_HANDLE_PARAM(const_trap_info_t) traps)
     /* If no table is presented then clear the entire virtual IDT. */
     if ( guest_handle_is_null(traps) )
     {
-        memset(dst, 0, X86_NR_VECTORS * sizeof(*dst));
+        memset(dst, 0, X86_IDT_VECTORS * sizeof(*dst));
         return 0;
     }
 
@@ -393,7 +393,7 @@ int compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) traps)
     /* If no table is presented then clear the entire virtual IDT. */
     if ( guest_handle_is_null(traps) )
     {
-        memset(dst, 0, X86_NR_VECTORS * sizeof(*dst));
+        memset(dst, 0, X86_IDT_VECTORS * sizeof(*dst));
         return 0;
     }
 
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index 7aef628f55..9334da1dab 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -312,9 +312,9 @@ int pv_vcpu_initialise(struct vcpu *v)
     if ( rc )
         return rc;
 
-    BUILD_BUG_ON(X86_NR_VECTORS * sizeof(*v->arch.pv.trap_ctxt) >
+    BUILD_BUG_ON(X86_IDT_VECTORS * sizeof(*v->arch.pv.trap_ctxt) >
                  PAGE_SIZE);
-    v->arch.pv.trap_ctxt = xzalloc_array(struct trap_info, X86_NR_VECTORS);
+    v->arch.pv.trap_ctxt = xzalloc_array(struct trap_info, X86_IDT_VECTORS);
     if ( !v->arch.pv.trap_ctxt )
     {
         rc = -ENOMEM;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index e466a260ca..4d1aaa78e7 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1986,7 +1986,7 @@ static void __init init_ler(void)
     setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
 }
 
-extern void (*const autogen_entrypoints[X86_NR_VECTORS])(void);
+extern void (*const autogen_entrypoints[X86_IDT_VECTORS])(void);
 void __init trap_init(void)
 {
     unsigned int vector;
@@ -1996,7 +1996,7 @@ void __init trap_init(void)
 
     pv_trap_init();
 
-    for ( vector = 0; vector < X86_NR_VECTORS; ++vector )
+    for ( vector = 0; vector < X86_IDT_VECTORS; ++vector )
     {
         if ( autogen_entrypoints[vector] )
         {
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 40d094d5b2..d866e62625 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -1243,7 +1243,7 @@ DATA(autogen_entrypoints, 8)
 FUNC_LOCAL(autogen_stubs, 0) /* Automatically generated stubs. */
 
         vec = 0
-        .rept X86_NR_VECTORS
+        .rept X86_IDT_VECTORS
 
         /* Common interrupts, heading towards do_IRQ(). */
 #if defined(CONFIG_PV32)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 22:22:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 22:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901541.1309487 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpaeJ-0007AZ-Mt; Tue, 04 Mar 2025 22:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901541.1309487; Tue, 04 Mar 2025 22:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpaeJ-0007AR-KF; Tue, 04 Mar 2025 22:22:03 +0000
Received: by outflank-mailman (input) for mailman id 901541;
 Tue, 04 Mar 2025 22:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpaeI-0007A0-9x
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 22:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpaeI-001Ulm-1G
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 22:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpaeI-006hbP-0K
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 22:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d8o+/bqPi7Ah/qccqodHkzNZVbuEBgzsUhBqLcVd8Bg=; b=X0Z0qVKQnpIogPLzbeh6t7x1Vc
	QUcWTxGweM2tgLzdAch8UcWByj+em+sSLhY5kp0VXXot0zfwLTVcKOjA/HrH9u0dpG+0xJPB+oxDq
	86kazEgc5wYVhREjVTIQ1OJfPgrjgD/aPPs+rKEAKMmUToz1y/ic5LPumpIM8aNPvjQM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair: Reduce verbosity of ECLAIR logs.
Message-Id: <E1tpaeI-006hbP-0K@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 22:22:02 +0000

commit 78f2a5792c68128e3205dd18f0f92fd408bf5cd8
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Tue Mar 4 18:49:36 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Mar 4 11:29:12 2025 -0800

    automation/eclair: Reduce verbosity of ECLAIR logs.
    
    While activating verbose logging simplifies debugging, this causes
    GitLab logs to be truncated, preventing the links to the ECLAIR
    analysis database to be shown.
    
    No functional change.
    
    Fixes: c4392ec83244 ("automation: Add ECLAIR utilities and settings")
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/analysis.ecl | 2 --
 automation/eclair_analysis/ECLAIR/analyze.sh   | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/analysis.ecl b/automation/eclair_analysis/ECLAIR/analysis.ecl
index 824283a989..29409a9af0 100644
--- a/automation/eclair_analysis/ECLAIR/analysis.ecl
+++ b/automation/eclair_analysis/ECLAIR/analysis.ecl
@@ -10,8 +10,6 @@ setq(analysis_kind,getenv("ANALYSIS_KIND"))
 # strings_map("scheduled-analysis",500,"","^.*$",0)
 # map_strings("scheduled-analysis",analysis_kind)
 
--verbose
-
 -enable=B.REPORT.ECB
 -config=B.REPORT.ECB,output=join_paths(data_dir,"FRAME.@FRAME@.ecb")
 -config=B.REPORT.ECB,preprocessed=show
diff --git a/automation/eclair_analysis/ECLAIR/analyze.sh b/automation/eclair_analysis/ECLAIR/analyze.sh
index 1dc63c1bc2..2356fc4007 100755
--- a/automation/eclair_analysis/ECLAIR/analyze.sh
+++ b/automation/eclair_analysis/ECLAIR/analyze.sh
@@ -91,11 +91,13 @@ find "${ECLAIR_DATA_DIR}" -maxdepth 1 -name "FRAME.*.ecb" |
   sort | xargs cat |
   "${ECLAIR_BIN_DIR}eclair_report" \
     "-create_db='${PROJECT_ECD}'" \
+    -quiet \
     -load=/dev/stdin > "${ECLAIR_REPORT_LOG}" 2>&1
 
 # Create the Jenkins reports file.
 "${ECLAIR_BIN_DIR}eclair_report" \
   "-db='${PROJECT_ECD}'" \
+  -quiet \
   "-eval_file='${SCRIPT_DIR}/report.ecl'" \
   >> "${ECLAIR_REPORT_LOG}" 2>&1
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 22:22:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 22:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901542.1309491 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpaeT-0007CF-Oc; Tue, 04 Mar 2025 22:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901542.1309491; Tue, 04 Mar 2025 22:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpaeT-0007C7-Lh; Tue, 04 Mar 2025 22:22:13 +0000
Received: by outflank-mailman (input) for mailman id 901542;
 Tue, 04 Mar 2025 22:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpaeS-0007Bt-BL
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 22:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpaeS-001Uls-1m
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 22:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpaeS-006hc6-0h
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 22:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dH2/eknT1r7kEtUc7FqHihWCFrssES9o0pdlK4x85kg=; b=r2n69OoaYMQ/wPULY+fIv+sSTW
	iCyoshIYAiL2q4VMl5XqBhJOfEu4kgE1c9o5n7zyR2m+Yhn4R3rsC5a/llipY5KTPzRijTYirus6f
	bad0azw4tm1mOJPeNco2u+1+YjsMxiyRE0Jx4dcUG+YWz3ltQVRKFryvjrod9YBB/N5U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Don't cast away const-ness in vcpu_show_registers()
Message-Id: <E1tpaeS-006hc6-0h@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 22:22:12 +0000

commit c3923b9f30ab5715fa28d922546586875d95ebde
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 30 06:41:46 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 19:46:41 2025 +0000

    xen: Don't cast away const-ness in vcpu_show_registers()
    
    The final hunk is `(struct vcpu *)v` in disguise, expressed using a runtime
    pointer chase through memory and a technicality of the C type system to work
    around the fact that get_hvm_registers() strictly requires a mutable pointer.
    
    For anyone interested, this is one reason why C cannot optimise any reads
    across sequence points, even for a function purporting to take a const object.
    
    Anyway, have the function correctly state that it needs a mutable vcpu.  All
    callers have a mutable vCPU to hand, and it removes the runtime pointer chase
    in x86.
    
    Make one style adjustment in ARM while adjusting the parameter type.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/domain.h | 2 +-
 xen/arch/arm/traps.c              | 3 ++-
 xen/arch/x86/include/asm/domain.h | 2 +-
 xen/arch/x86/x86_64/traps.c       | 4 ++--
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index f1d72c6e48..50b6a4b009 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -243,7 +243,7 @@ struct arch_vcpu
 
 }  __cacheline_aligned;
 
-void vcpu_show_registers(const struct vcpu *v);
+void vcpu_show_registers(struct vcpu *v);
 void vcpu_switch_to_aarch64_mode(struct vcpu *v);
 
 /*
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 3071c38768..445e7378dd 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -964,9 +964,10 @@ void show_registers(const struct cpu_user_regs *regs)
     _show_registers(regs, &ctxt, guest_mode(regs), current);
 }
 
-void vcpu_show_registers(const struct vcpu *v)
+void vcpu_show_registers(struct vcpu *v)
 {
     struct reg_ctxt ctxt;
+
     ctxt.sctlr_el1 = v->arch.sctlr;
     ctxt.tcr_el1 = v->arch.ttbcr;
     ctxt.ttbr0_el1 = v->arch.ttbr0;
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index b79d6badd7..5fc1d1e5d0 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -688,7 +688,7 @@ bool update_secondary_system_time(struct vcpu *v,
 void force_update_secondary_system_time(struct vcpu *v,
                                         struct vcpu_time_info *map);
 
-void vcpu_show_registers(const struct vcpu *v);
+void vcpu_show_registers(struct vcpu *v);
 
 static inline struct vcpu_guest_context *alloc_vcpu_guest_context(void)
 {
diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
index 02fdb3637d..22d4db240b 100644
--- a/xen/arch/x86/x86_64/traps.c
+++ b/xen/arch/x86/x86_64/traps.c
@@ -170,7 +170,7 @@ void show_registers(const struct cpu_user_regs *regs)
     }
 }
 
-void vcpu_show_registers(const struct vcpu *v)
+void vcpu_show_registers(struct vcpu *v)
 {
     const struct cpu_user_regs *regs = &v->arch.user_regs;
     struct cpu_user_regs aux_regs;
@@ -180,7 +180,7 @@ void vcpu_show_registers(const struct vcpu *v)
     if ( is_hvm_vcpu(v) )
     {
         aux_regs = *regs;
-        get_hvm_registers(v->domain->vcpu[v->vcpu_id], &aux_regs, crs);
+        get_hvm_registers(v, &aux_regs, crs);
         regs = &aux_regs;
         context = CTXT_hvm_guest;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 22:22:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 22:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901543.1309494 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpaed-0007FG-Q0; Tue, 04 Mar 2025 22:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901543.1309494; Tue, 04 Mar 2025 22:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpaed-0007F8-NF; Tue, 04 Mar 2025 22:22:23 +0000
Received: by outflank-mailman (input) for mailman id 901543;
 Tue, 04 Mar 2025 22:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpaec-0007Em-Fo
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 22:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpaec-001UmL-2F
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 22:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpaec-006hd0-1H
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 22:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aS++XWWEl79wxSyDQ3Ayg35rJC4jT9MzbdjjtepV4bA=; b=VT21cWFjJ69RYobvTt/hiWYJzK
	i3IIb0V5auTDSqn+2piuYTkwQ2XjZWwri9palOESiF0+obqIC1LR2jHYvC3gkhXi5LcugHFWMvFEK
	tk1H5CIE2ur8cSiiWJgcfv0Xw0YhJv6Ntta9bB/Q7IKsuD6XYwq3wh27i8hRV/hWeaFc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Sort includes in various files
Message-Id: <E1tpaec-006hd0-1H@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 22:22:22 +0000

commit 532ff1027ae4ea2b44a2f8a0aa28937f76278892
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 1 15:51:57 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 19:46:41 2025 +0000

    x86: Sort includes in various files
    
    FRED support involves quite a lot of header file shuffling and cleanup.  Start
    by sorting the includes of impacted files, and dropping duplciates.
    
      domain.c: Double asm/spec_ctrl.h
      power.c:  Double xen/sched.h
      setup.c:  Double xen/serial.h
      mm.c:     Double xen/mm.h
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/power.c    | 19 +++++-----
 xen/arch/x86/cpu/common.c    | 15 ++++----
 xen/arch/x86/crash.c         | 32 +++++++++--------
 xen/arch/x86/domain.c        | 84 +++++++++++++++++++++++---------------------
 xen/arch/x86/hvm/vmx/vmcs.c  | 25 ++++++-------
 xen/arch/x86/machine_kexec.c |  5 +--
 xen/arch/x86/mm.c            | 54 ++++++++++++++--------------
 xen/arch/x86/setup.c         | 84 +++++++++++++++++++++++---------------------
 xen/arch/x86/smpboot.c       | 22 ++++++------
 xen/arch/x86/traps.c         | 78 ++++++++++++++++++++--------------------
 xen/arch/x86/x86_64/traps.c  | 25 +++++++------
 11 files changed, 228 insertions(+), 215 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 08a7fc2508..d0b67614d5 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -11,28 +11,29 @@
  */
 
 #include <xen/acpi.h>
+#include <xen/console.h>
+#include <xen/cpu.h>
+#include <xen/domain.h>
 #include <xen/errno.h>
 #include <xen/iocap.h>
+#include <xen/iommu.h>
 #include <xen/param.h>
 #include <xen/sched.h>
-#include <asm/acpi.h>
-#include <asm/irq.h>
 #include <xen/spinlock.h>
-#include <xen/sched.h>
-#include <xen/domain.h>
-#include <xen/console.h>
-#include <xen/iommu.h>
 #include <xen/watchdog.h>
-#include <xen/cpu.h>
-#include <public/platform.h>
-#include <asm/tboot.h>
+
+#include <asm/acpi.h>
 #include <asm/apic.h>
 #include <asm/io_apic.h>
+#include <asm/irq.h>
 #include <asm/microcode.h>
 #include <asm/prot-key.h>
 #include <asm/spec_ctrl.h>
+#include <asm/tboot.h>
 #include <asm/trampoline.h>
 
+#include <public/platform.h>
+
 #include <acpi/cpufreq/cpufreq.h>
 
 uint32_t system_reset_counter = 1;
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 067d855bad..1cc4adccb4 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -1,24 +1,25 @@
-#include <xen/init.h>
-#include <xen/string.h>
 #include <xen/delay.h>
+#include <xen/init.h>
 #include <xen/param.h>
 #include <xen/smp.h>
+#include <xen/string.h>
 
 #include <asm/amd.h>
+#include <asm/apic.h>
 #include <asm/cpu-policy.h>
 #include <asm/current.h>
 #include <asm/debugreg.h>
-#include <asm/processor.h>
-#include <asm/xstate.h>
-#include <asm/msr.h>
 #include <asm/io.h>
 #include <asm/mpspec.h>
-#include <asm/apic.h>
+#include <asm/msr.h>
+#include <asm/processor.h>
 #include <asm/prot-key.h>
 #include <asm/random.h>
 #include <asm/setup.h>
 #include <asm/shstk.h>
-#include <public/sysctl.h> /* for XEN_INVALID_{SOCKET,CORE}_ID */
+#include <asm/xstate.h>
+
+#include <public/sysctl.h>
 
 #include "cpu.h"
 #include "mcheck/x86_mca.h"
diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 26057c71d3..4afe0ad859 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -8,27 +8,29 @@
  * - Magnus Damm <magnus@valinux.co.jp>
  */
 
-#include <asm/atomic.h>
-#include <asm/elf.h>
-#include <xen/types.h>
-#include <xen/irq.h>
-#include <asm/nmi.h>
-#include <xen/string.h>
+#include <xen/console.h>
+#include <xen/delay.h>
 #include <xen/elf.h>
 #include <xen/elfcore.h>
-#include <xen/smp.h>
-#include <xen/delay.h>
-#include <xen/perfc.h>
+#include <xen/iommu.h>
+#include <xen/irq.h>
 #include <xen/kexec.h>
-#include <xen/sched.h>
 #include <xen/keyhandler.h>
-#include <public/xen.h>
-#include <asm/shared.h>
+#include <xen/perfc.h>
+#include <xen/sched.h>
+#include <xen/smp.h>
+#include <xen/string.h>
+#include <xen/types.h>
+
 #include <asm/apic.h>
-#include <asm/io_apic.h>
-#include <xen/iommu.h>
+#include <asm/atomic.h>
+#include <asm/elf.h>
 #include <asm/hpet.h>
-#include <xen/console.h>
+#include <asm/io_apic.h>
+#include <asm/nmi.h>
+#include <asm/shared.h>
+
+#include <public/xen.h>
 
 static cpumask_t waiting_to_crash;
 static unsigned int crashing_cpu;
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 78a13e6812..7b2549091f 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -11,66 +11,68 @@
  *  Gareth Hughes <gareth@valinux.com>, May 2000
  */
 
-#include <xen/init.h>
-#include <xen/lib.h>
-#include <xen/errno.h>
-#include <xen/sched.h>
-#include <xen/domain.h>
-#include <xen/smp.h>
+#include <xen/acpi.h>
+#include <xen/compat.h>
+#include <xen/console.h>
+#include <xen/cpu.h>
 #include <xen/delay.h>
-#include <xen/softirq.h>
+#include <xen/domain.h>
+#include <xen/errno.h>
+#include <xen/event.h>
 #include <xen/grant_table.h>
+#include <xen/guest_access.h>
+#include <xen/hypercall.h>
+#include <xen/init.h>
 #include <xen/iocap.h>
+#include <xen/irq.h>
 #include <xen/kernel.h>
-#include <xen/hypercall.h>
+#include <xen/lib.h>
+#include <xen/livepatch.h>
 #include <xen/multicall.h>
-#include <xen/irq.h>
-#include <xen/event.h>
-#include <xen/console.h>
-#include <xen/percpu.h>
-#include <xen/compat.h>
-#include <xen/acpi.h>
-#include <xen/pci.h>
 #include <xen/paging.h>
-#include <xen/cpu.h>
+#include <xen/pci.h>
+#include <xen/percpu.h>
+#include <xen/sched.h>
+#include <xen/smp.h>
+#include <xen/softirq.h>
 #include <xen/wait.h>
-#include <xen/guest_access.h>
-#include <xen/livepatch.h>
-#include <public/arch-x86/cpuid.h>
-#include <public/sysctl.h>
-#include <public/hvm/hvm_vcpu.h>
-#include <asm/regs.h>
-#include <asm/mc146818rtc.h>
-#include <asm/system.h>
-#include <asm/io.h>
-#include <asm/processor.h>
-#include <asm/desc.h>
-#include <asm/i387.h>
-#include <asm/xstate.h>
+
+#include <asm/amd.h>
+#include <asm/cpu-policy.h>
 #include <asm/cpuidle.h>
-#include <asm/mpspec.h>
-#include <asm/ldt.h>
+#include <asm/debugreg.h>
+#include <asm/desc.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/viridian.h>
-#include <asm/debugreg.h>
+#include <asm/i387.h>
+#include <asm/io.h>
+#include <asm/ldt.h>
+#include <asm/mc146818rtc.h>
+#include <asm/mce.h>
+#include <asm/mpspec.h>
 #include <asm/msr.h>
+#include <asm/nmi.h>
+#include <asm/processor.h>
+#include <asm/psr.h>
+#include <asm/pv/domain.h>
+#include <asm/pv/mm.h>
+#include <asm/regs.h>
 #include <asm/spec_ctrl.h>
+#include <asm/system.h>
 #include <asm/traps.h>
-#include <asm/nmi.h>
-#include <asm/mce.h>
-#include <asm/amd.h>
-#include <xen/numa.h>
+#include <asm/xstate.h>
 #include <xen/iommu.h>
+#include <xen/numa.h>
+
+#include <public/arch-x86/cpuid.h>
+#include <public/sysctl.h>
+#include <public/hvm/hvm_vcpu.h>
+
 #ifdef CONFIG_COMPAT
 #include <compat/vcpu.h>
 #endif
-#include <asm/cpu-policy.h>
-#include <asm/psr.h>
-#include <asm/pv/domain.h>
-#include <asm/pv/mm.h>
-#include <asm/spec_ctrl.h>
 
 DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
 
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 8c0ea789c1..fa9d8b3267 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -4,33 +4,34 @@
  * Copyright (c) 2004, Intel Corporation.
  */
 
-#include <xen/init.h>
-#include <xen/mm.h>
-#include <xen/lib.h>
-#include <xen/param.h>
-#include <xen/errno.h>
 #include <xen/domain_page.h>
+#include <xen/errno.h>
 #include <xen/event.h>
+#include <xen/init.h>
 #include <xen/kernel.h>
 #include <xen/keyhandler.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/param.h>
 #include <xen/vm_event.h>
-#include <asm/current.h>
+
+#include <asm/apic.h>
 #include <asm/cpufeature.h>
-#include <asm/processor.h>
-#include <asm/msr.h>
-#include <asm/xstate.h>
+#include <asm/current.h>
+#include <asm/flushtlb.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/io.h>
 #include <asm/hvm/nestedhvm.h>
+#include <asm/hvm/vmx/vmcs.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/hvm/vmx/vvmx.h>
-#include <asm/hvm/vmx/vmcs.h>
-#include <asm/flushtlb.h>
 #include <asm/monitor.h>
+#include <asm/msr.h>
+#include <asm/processor.h>
 #include <asm/shadow.h>
 #include <asm/spec_ctrl.h>
 #include <asm/tboot.h>
-#include <asm/apic.h>
+#include <asm/xstate.h>
 
 static bool __read_mostly opt_vpid_enabled = true;
 boolean_param("vpid", opt_vpid_enabled);
diff --git a/xen/arch/x86/machine_kexec.c b/xen/arch/x86/machine_kexec.c
index d50772ad6c..e20e8d0b15 100644
--- a/xen/arch/x86/machine_kexec.c
+++ b/xen/arch/x86/machine_kexec.c
@@ -15,14 +15,15 @@
  * Version 2.  See the file COPYING for more details.
  */
 
-#include <xen/types.h>
 #include <xen/domain_page.h>
 #include <xen/elfstructs.h>
 #include <xen/kexec.h>
+#include <xen/types.h>
+
 #include <asm/fixmap.h>
 #include <asm/hpet.h>
-#include <asm/page.h>
 #include <asm/machine_kexec.h>
+#include <asm/page.h>
 
 /*
  * Add a mapping for a page to the page tables used during kexec.
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index fa21903eb2..6b34b908ef 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -87,51 +87,53 @@
  * doing the final put_page(), and remove it from the iommu if so.
  */
 
+#include <xen/domain.h>
+#include <xen/domain_page.h>
+#include <xen/efi.h>
+#include <xen/err.h>
+#include <xen/event.h>
+#include <xen/guest_access.h>
+#include <xen/hypercall.h>
 #include <xen/init.h>
+#include <xen/iocap.h>
 #include <xen/ioreq.h>
+#include <xen/irq.h>
 #include <xen/kernel.h>
 #include <xen/lib.h>
 #include <xen/livepatch.h>
 #include <xen/mm.h>
 #include <xen/param.h>
-#include <xen/domain.h>
-#include <xen/sched.h>
-#include <xen/err.h>
 #include <xen/perfc.h>
-#include <xen/irq.h>
-#include <xen/softirq.h>
-#include <xen/domain_page.h>
-#include <xen/event.h>
-#include <xen/iocap.h>
-#include <xen/guest_access.h>
 #include <xen/pfn.h>
+#include <xen/sched.h>
+#include <xen/softirq.h>
+#include <xen/trace.h>
 #include <xen/vmap.h>
 #include <xen/xmalloc.h>
-#include <xen/efi.h>
-#include <xen/hypercall.h>
-#include <xen/mm.h>
-#include <asm/paging.h>
-#include <asm/shadow.h>
-#include <asm/page.h>
+
+#include <asm/e820.h>
+#include <asm/fixmap.h>
 #include <asm/flushtlb.h>
+#include <asm/guest.h>
 #include <asm/io.h>
+#include <asm/io_apic.h>
 #include <asm/ldt.h>
-#include <asm/x86_emulate.h>
-#include <asm/e820.h>
-#include <asm/shared.h>
 #include <asm/mem_sharing.h>
-#include <public/memory.h>
-#include <public/sched.h>
-#include <xsm/xsm.h>
-#include <xen/trace.h>
-#include <asm/setup.h>
-#include <asm/fixmap.h>
-#include <asm/io_apic.h>
+#include <asm/page.h>
+#include <asm/paging.h>
 #include <asm/pci.h>
-#include <asm/guest.h>
 #include <asm/pv/domain.h>
 #include <asm/pv/mm.h>
+#include <asm/setup.h>
+#include <asm/shadow.h>
+#include <asm/shared.h>
 #include <asm/trampoline.h>
+#include <asm/x86_emulate.h>
+
+#include <public/memory.h>
+#include <public/sched.h>
+
+#include <xsm/xsm.h>
 
 #ifdef CONFIG_PV
 #include "pv/mm.h"
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8ebe5a9443..143749e5da 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1,68 +1,70 @@
-#include <xen/init.h>
-#include <xen/lib.h>
+#include <xen/acpi.h>
+#include <xen/bitops.h>
+#include <xen/console.h>
+#include <xen/cpu.h>
+#include <xen/cpuidle.h>
+#include <xen/dmi.h>
+#include <xen/domain.h>
+#include <xen/domain_page.h>
+#include <xen/efi.h>
 #include <xen/err.h>
 #include <xen/grant_table.h>
+#include <xen/hypercall.h>
+#include <xen/init.h>
+#include <xen/kexec.h>
+#include <xen/keyhandler.h>
+#include <xen/lib.h>
+#include <xen/multiboot.h>
+#include <xen/nodemask.h>
+#include <xen/numa.h>
 #include <xen/param.h>
+#include <xen/pfn.h>
+#include <xen/rcupdate.h>
 #include <xen/sched.h>
-#include <xen/domain.h>
 #include <xen/sections.h>
 #include <xen/serial.h>
 #include <xen/softirq.h>
-#include <xen/acpi.h>
-#include <xen/efi.h>
-#include <xen/console.h>
-#include <xen/serial.h>
 #include <xen/trace.h>
-#include <xen/multiboot.h>
-#include <xen/domain_page.h>
 #include <xen/version.h>
-#include <xen/hypercall.h>
-#include <xen/keyhandler.h>
-#include <xen/numa.h>
-#include <xen/rcupdate.h>
 #include <xen/vga.h>
-#include <xen/dmi.h>
-#include <xen/pfn.h>
-#include <xen/nodemask.h>
 #include <xen/virtual_region.h>
 #include <xen/watchdog.h>
-#include <public/version.h>
-#ifdef CONFIG_COMPAT
-#include <compat/platform.h>
-#include <compat/xen.h>
-#endif
-#include <xen/bitops.h>
-#include <asm/bootinfo.h>
-#include <asm/smp.h>
-#include <asm/processor.h>
-#include <asm/mpspec.h>
+
+#include <asm/alternative.h>
 #include <asm/apic.h>
-#include <asm/msi.h>
+#include <asm/bootinfo.h>
+#include <asm/bzimage.h>
+#include <asm/cpu-policy.h>
 #include <asm/desc.h>
-#include <asm/paging.h>
 #include <asm/e820.h>
-#include <xen/kexec.h>
 #include <asm/edd.h>
-#include <xsm/xsm.h>
-#include <asm/tboot.h>
-#include <asm/bzimage.h> /* for bzimage_headroom */
 #include <asm/genapic.h>
+#include <asm/guest.h>
+#include <asm/invpcid.h>
 #include <asm/io_apic.h>
-#include <asm/setup.h>
-#include <xen/cpu.h>
-#include <xen/cpuidle.h>
-#include <asm/nmi.h>
-#include <asm/alternative.h>
 #include <asm/mc146818rtc.h>
-#include <asm/cpu-policy.h>
-#include <asm/invpcid.h>
-#include <asm/spec_ctrl.h>
-#include <asm/guest.h>
 #include <asm/microcode.h>
+#include <asm/mpspec.h>
+#include <asm/msi.h>
+#include <asm/nmi.h>
+#include <asm/paging.h>
+#include <asm/processor.h>
 #include <asm/prot-key.h>
 #include <asm/pv/domain.h>
+#include <asm/setup.h>
+#include <asm/smp.h>
+#include <asm/spec_ctrl.h>
+#include <asm/tboot.h>
 #include <asm/trampoline.h>
 
+#include <xsm/xsm.h>
+
+#include <public/version.h>
+#ifdef CONFIG_COMPAT
+#include <compat/platform.h>
+#include <compat/xen.h>
+#endif
+
 /* opt_nosmp: If true, secondary processors are ignored. */
 static bool __initdata opt_nosmp;
 boolean_param("nosmp", opt_nosmp);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 891a29fca1..f904d56232 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -7,39 +7,39 @@
  *  (c) 1998, 1999, 2000 Ingo Molnar <mingo@redhat.com>
  */
 
+#include <xen/cpu.h>
+#include <xen/delay.h>
+#include <xen/domain.h>
+#include <xen/domain_page.h>
 #include <xen/init.h>
+#include <xen/irq.h>
 #include <xen/kernel.h>
 #include <xen/mm.h>
-#include <xen/domain.h>
-#include <xen/domain_page.h>
+#include <xen/numa.h>
 #include <xen/sched.h>
-#include <xen/irq.h>
-#include <xen/delay.h>
+#include <xen/serial.h>
 #include <xen/softirq.h>
 #include <xen/tasklet.h>
-#include <xen/serial.h>
-#include <xen/numa.h>
-#include <xen/cpu.h>
 
 #include <asm/apic.h>
-#include <asm/io_apic.h>
 #include <asm/cpuidle.h>
 #include <asm/current.h>
-#include <asm/mc146818rtc.h>
 #include <asm/desc.h>
 #include <asm/div64.h>
 #include <asm/flushtlb.h>
 #include <asm/guest.h>
+#include <asm/io_apic.h>
+#include <asm/irq-vectors.h>
+#include <asm/mc146818rtc.h>
 #include <asm/microcode.h>
 #include <asm/msr.h>
 #include <asm/mtrr.h>
 #include <asm/prot-key.h>
 #include <asm/setup.h>
 #include <asm/spec_ctrl.h>
-#include <asm/time.h>
 #include <asm/tboot.h>
+#include <asm/time.h>
 #include <asm/trampoline.h>
-#include <asm/irq-vectors.h>
 
 uint32_t __ro_after_init trampoline_phys;
 enum ap_boot_method __read_mostly ap_boot_method = AP_BOOT_NORMAL;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index be2bc59f03..3613ce573c 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -12,65 +12,67 @@
  * Gareth Hughes <gareth@valinux.com>, May 2000
  */
 
+#include <xen/bitops.h>
 #include <xen/bug.h>
-#include <xen/init.h>
-#include <xen/sched.h>
-#include <xen/lib.h>
+#include <xen/console.h>
+#include <xen/delay.h>
+#include <xen/domain_page.h>
 #include <xen/err.h>
 #include <xen/errno.h>
+#include <xen/event.h>
+#include <xen/guest_access.h>
 #include <xen/hypercall.h>
+#include <xen/init.h>
+#include <xen/iocap.h>
+#include <xen/irq.h>
+#include <xen/kexec.h>
+#include <xen/lib.h>
+#include <xen/livepatch.h>
 #include <xen/mm.h>
+#include <xen/paging.h>
 #include <xen/param.h>
-#include <xen/console.h>
-#include <xen/shutdown.h>
-#include <xen/guest_access.h>
-#include <asm/regs.h>
-#include <xen/delay.h>
-#include <xen/event.h>
-#include <xen/spinlock.h>
-#include <xen/irq.h>
 #include <xen/perfc.h>
+#include <xen/sched.h>
+#include <xen/shutdown.h>
 #include <xen/softirq.h>
-#include <xen/domain_page.h>
+#include <xen/spinlock.h>
 #include <xen/symbols.h>
-#include <xen/iocap.h>
-#include <xen/kexec.h>
 #include <xen/trace.h>
-#include <xen/paging.h>
 #include <xen/virtual_region.h>
 #include <xen/watchdog.h>
-#include <xen/livepatch.h>
-#include <asm/system.h>
-#include <asm/io.h>
+
+#include <xsm/xsm.h>
+
+#include <asm/apic.h>
 #include <asm/atomic.h>
-#include <xen/bitops.h>
-#include <asm/desc.h>
+#include <asm/cpuid.h>
 #include <asm/debugreg.h>
-#include <asm/gdbsx.h>
-#include <asm/smp.h>
+#include <asm/desc.h>
 #include <asm/flushtlb.h>
-#include <asm/uaccess.h>
+#include <asm/gdbsx.h>
+#include <asm/hpet.h>
+#include <asm/hvm/vpt.h>
 #include <asm/i387.h>
-#include <asm/xstate.h>
+#include <asm/io.h>
+#include <asm/irq-vectors.h>
+#include <asm/mc146818rtc.h>
+#include <asm/mce.h>
 #include <asm/msr.h>
 #include <asm/nmi.h>
-#include <asm/xenoprof.h>
+#include <asm/pv/mm.h>
+#include <asm/pv/trace.h>
+#include <asm/pv/traps.h>
+#include <asm/regs.h>
 #include <asm/shared.h>
-#include <asm/x86_emulate.h>
+#include <asm/shstk.h>
+#include <asm/smp.h>
+#include <asm/system.h>
 #include <asm/traps.h>
-#include <asm/hvm/vpt.h>
-#include <asm/mce.h>
-#include <asm/apic.h>
-#include <asm/mc146818rtc.h>
-#include <asm/hpet.h>
+#include <asm/uaccess.h>
 #include <asm/vpmu.h>
-#include <asm/cpuid.h>
-#include <xsm/xsm.h>
-#include <asm/irq-vectors.h>
-#include <asm/pv/traps.h>
-#include <asm/pv/trace.h>
-#include <asm/pv/mm.h>
-#include <asm/shstk.h>
+#include <asm/x86_emulate.h>
+#include <asm/xenoprof.h>
+#include <asm/xstate.h>
 
 /*
  * opt_nmi: one of 'ignore', 'dom0', or 'fatal'.
diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
index 22d4db240b..7a370fae7d 100644
--- a/xen/arch/x86/x86_64/traps.c
+++ b/xen/arch/x86/x86_64/traps.c
@@ -1,28 +1,27 @@
-
-#include <xen/version.h>
+#include <xen/console.h>
+#include <xen/errno.h>
+#include <xen/guest_access.h>
+#include <xen/hypercall.h>
 #include <xen/init.h>
-#include <xen/sched.h>
+#include <xen/irq.h>
 #include <xen/lib.h>
-#include <xen/errno.h>
 #include <xen/mm.h>
-#include <xen/irq.h>
-#include <xen/symbols.h>
-#include <xen/console.h>
 #include <xen/sched.h>
 #include <xen/shutdown.h>
-#include <xen/guest_access.h>
+#include <xen/symbols.h>
+#include <xen/version.h>
 #include <xen/watchdog.h>
-#include <xen/hypercall.h>
+
 #include <asm/current.h>
-#include <asm/flushtlb.h>
-#include <asm/traps.h>
 #include <asm/endbr.h>
 #include <asm/event.h>
-#include <asm/nmi.h>
+#include <asm/flushtlb.h>
+#include <asm/hvm/hvm.h>
 #include <asm/msr.h>
+#include <asm/nmi.h>
 #include <asm/page.h>
 #include <asm/shared.h>
-#include <asm/hvm/hvm.h>
+#include <asm/traps.h>
 
 
 static void print_xen_info(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 22:22:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 22:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901544.1309499 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpaen-0007K7-Sc; Tue, 04 Mar 2025 22:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901544.1309499; Tue, 04 Mar 2025 22:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpaen-0007Jz-Q1; Tue, 04 Mar 2025 22:22:33 +0000
Received: by outflank-mailman (input) for mailman id 901544;
 Tue, 04 Mar 2025 22:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpaem-0007Jk-K9
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 22:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpaem-001UmS-2f
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 22:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpaem-006hdT-1k
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 22:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9tjwOnAlJp/OJ4jqWn/OmXLYpFSLYyQpyF959978dVo=; b=SZ1gZ8+u0Cpf33FwWZodKw9NjI
	4KhnTvzi1aizfDysOFbbHpyyuPdlzJFzKh26QPKStU6/6ruyX32I4QzXmBUYGostLQTe/QzkrPd9e
	vuCi/sZ21wAacMzdpWoJtOpogPZxeWJXLicDMqAZdNgFdlRS7+hfpag9RpYdF4nRUgpE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/IDT: Collect IDT related content idt.h
Message-Id: <E1tpaem-006hdT-1k@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 22:22:32 +0000

commit c58b1b11f59879d42aaac188ebe8c610a15e6816
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 1 15:43:20 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 19:46:41 2025 +0000

    x86/IDT: Collect IDT related content idt.h
    
    Logic concerning the IDT is somewhat different to the other system tables, and
    in particular ought not to be in asm/processor.h.  Collect it together a new
    header.
    
    While doing so, make a few minor adjustments:
    
     * Make set_ist() use volatile rather than ACCESS_ONCE(), as
       _write_gate_lower() already does, removing the need for xen/lib.h.
    
     * Move the BUILD_BUG_ON() from subarch_percpu_traps_init() into mm.c's
       build_assertions(), rather than including idt.h into x86_64/traps.c.
    
     * Drop UL from IST constants.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c            |   1 +
 xen/arch/x86/crash.c                 |   1 +
 xen/arch/x86/domain.c                |   1 +
 xen/arch/x86/hvm/svm/svm.c           |   1 +
 xen/arch/x86/hvm/vmx/vmcs.c          |   1 +
 xen/arch/x86/include/asm/desc.h      |  76 ---------------------
 xen/arch/x86/include/asm/idt.h       | 124 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/processor.h |  37 -----------
 xen/arch/x86/machine_kexec.c         |   1 +
 xen/arch/x86/mm.c                    |   4 ++
 xen/arch/x86/pv/traps.c              |   1 +
 xen/arch/x86/smpboot.c               |   1 +
 xen/arch/x86/traps.c                 |   1 +
 xen/arch/x86/x86_64/traps.c          |   3 -
 14 files changed, 137 insertions(+), 116 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 1cc4adccb4..1540ab0007 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -9,6 +9,7 @@
 #include <asm/cpu-policy.h>
 #include <asm/current.h>
 #include <asm/debugreg.h>
+#include <asm/idt.h>
 #include <asm/io.h>
 #include <asm/mpspec.h>
 #include <asm/msr.h>
diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 4afe0ad859..5f7d7b392a 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -26,6 +26,7 @@
 #include <asm/atomic.h>
 #include <asm/elf.h>
 #include <asm/hpet.h>
+#include <asm/idt.h>
 #include <asm/io_apic.h>
 #include <asm/nmi.h>
 #include <asm/shared.h>
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 7b2549091f..d3db76833f 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -47,6 +47,7 @@
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/viridian.h>
 #include <asm/i387.h>
+#include <asm/idt.h>
 #include <asm/io.h>
 #include <asm/ldt.h>
 #include <asm/mc146818rtc.h>
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 62905c2c7a..ea78da4f42 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -18,6 +18,7 @@
 #include <asm/cpufeature.h>
 #include <asm/current.h>
 #include <asm/debugreg.h>
+#include <asm/idt.h>
 #include <asm/gdbsx.h>
 #include <asm/hvm/emulate.h>
 #include <asm/hvm/hvm.h>
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index fa9d8b3267..0136830ebc 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -25,6 +25,7 @@
 #include <asm/hvm/vmx/vmcs.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/hvm/vmx/vvmx.h>
+#include <asm/idt.h>
 #include <asm/monitor.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
diff --git a/xen/arch/x86/include/asm/desc.h b/xen/arch/x86/include/asm/desc.h
index a1e0807d97..85fae6b2f9 100644
--- a/xen/arch/x86/include/asm/desc.h
+++ b/xen/arch/x86/include/asm/desc.h
@@ -115,82 +115,6 @@ typedef union {
     };
 } seg_desc_t;
 
-typedef union {
-    struct {
-        uint64_t a, b;
-    };
-    struct {
-        uint16_t addr0;
-        uint16_t cs;
-        uint8_t  ist; /* :3, 5 bits rsvd, but this yields far better code. */
-        uint8_t  type:4, s:1, dpl:2, p:1;
-        uint16_t addr1;
-        uint32_t addr2;
-        /* 32 bits rsvd. */
-    };
-} idt_entry_t;
-
-/* Write the lower 64 bits of an IDT Entry. This relies on the upper 32
- * bits of the address not changing, which is a safe assumption as all
- * functions we are likely to load will live inside the 1GB
- * code/data/bss address range.
- *
- * Ideally, we would use cmpxchg16b, but this is not supported on some
- * old AMD 64bit capable processors, and has no safe equivalent.
- */
-static inline void _write_gate_lower(volatile idt_entry_t *gate,
-                                     const idt_entry_t *new)
-{
-    ASSERT(gate->b == new->b);
-    gate->a = new->a;
-}
-
-#define _set_gate(gate_addr,type,dpl,addr)               \
-do {                                                     \
-    (gate_addr)->a = 0;                                  \
-    smp_wmb(); /* disable gate /then/ rewrite */         \
-    (gate_addr)->b =                                     \
-        ((unsigned long)(addr) >> 32);                   \
-    smp_wmb(); /* rewrite /then/ enable gate */          \
-    (gate_addr)->a =                                     \
-        (((unsigned long)(addr) & 0xFFFF0000UL) << 32) | \
-        ((unsigned long)(dpl) << 45) |                   \
-        ((unsigned long)(type) << 40) |                  \
-        ((unsigned long)(addr) & 0xFFFFUL) |             \
-        ((unsigned long)__HYPERVISOR_CS << 16) |         \
-        (1UL << 47);                                     \
-} while (0)
-
-static inline void _set_gate_lower(idt_entry_t *gate, unsigned long type,
-                                   unsigned long dpl, void *addr)
-{
-    idt_entry_t idte;
-    idte.b = gate->b;
-    idte.a =
-        (((unsigned long)(addr) & 0xFFFF0000UL) << 32) |
-        ((unsigned long)(dpl) << 45) |
-        ((unsigned long)(type) << 40) |
-        ((unsigned long)(addr) & 0xFFFFUL) |
-        ((unsigned long)__HYPERVISOR_CS << 16) |
-        (1UL << 47);
-    _write_gate_lower(gate, &idte);
-}
-
-/* Update the lower half handler of an IDT Entry, without changing any
- * other configuration. */
-static inline void _update_gate_addr_lower(idt_entry_t *gate, void *addr)
-{
-    idt_entry_t idte;
-    idte.a = gate->a;
-
-    idte.b = ((unsigned long)(addr) >> 32);
-    idte.a &= 0x0000FFFFFFFF0000ULL;
-    idte.a |= (((unsigned long)(addr) & 0xFFFF0000UL) << 32) |
-        ((unsigned long)(addr) & 0xFFFFUL);
-
-    _write_gate_lower(gate, &idte);
-}
-
 #define _set_tssldt_desc(desc,addr,limit,type)           \
 do {                                                     \
     (desc)[0].b = (desc)[1].b = 0;                       \
diff --git a/xen/arch/x86/include/asm/idt.h b/xen/arch/x86/include/asm/idt.h
new file mode 100644
index 0000000000..3689fdecbe
--- /dev/null
+++ b/xen/arch/x86/include/asm/idt.h
@@ -0,0 +1,124 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef X86_ASM_IDT_H
+#define X86_ASM_IDT_H
+
+#include <xen/bug.h>
+
+#include <asm/x86-defns.h>
+
+#define IST_NONE 0
+#define IST_MCE  1
+#define IST_NMI  2
+#define IST_DB   3
+#define IST_DF   4
+#define IST_MAX  4
+
+typedef union {
+    struct {
+        uint64_t a, b;
+    };
+    struct {
+        uint16_t addr0;
+        uint16_t cs;
+        uint8_t  ist; /* :3, 5 bits rsvd, but this yields far better code. */
+        uint8_t  type:4, s:1, dpl:2, p:1;
+        uint16_t addr1;
+        uint32_t addr2;
+        /* 32 bits rsvd. */
+    };
+} idt_entry_t;
+
+#define IDT_ENTRIES 256
+extern idt_entry_t idt_table[];
+extern idt_entry_t *idt_tables[];
+
+/*
+ * Set the Interrupt Stack Table used by a particular IDT entry.  Typically
+ * used on a live IDT, so volatile to disuade clever optimisations.
+ */
+static inline void set_ist(volatile idt_entry_t *idt, unsigned int ist)
+{
+    /* IST is a 3 bit field, 32 bits into the IDT entry. */
+    ASSERT(ist <= IST_MAX);
+
+    idt->ist = ist;
+}
+
+static inline void enable_each_ist(idt_entry_t *idt)
+{
+    set_ist(&idt[X86_EXC_DF],  IST_DF);
+    set_ist(&idt[X86_EXC_NMI], IST_NMI);
+    set_ist(&idt[X86_EXC_MC],  IST_MCE);
+    set_ist(&idt[X86_EXC_DB],  IST_DB);
+}
+
+static inline void disable_each_ist(idt_entry_t *idt)
+{
+    set_ist(&idt[X86_EXC_DF],  IST_NONE);
+    set_ist(&idt[X86_EXC_NMI], IST_NONE);
+    set_ist(&idt[X86_EXC_MC],  IST_NONE);
+    set_ist(&idt[X86_EXC_DB],  IST_NONE);
+}
+
+#define _set_gate(gate_addr,type,dpl,addr)               \
+do {                                                     \
+    (gate_addr)->a = 0;                                  \
+    smp_wmb(); /* disable gate /then/ rewrite */         \
+    (gate_addr)->b =                                     \
+        ((unsigned long)(addr) >> 32);                   \
+    smp_wmb(); /* rewrite /then/ enable gate */          \
+    (gate_addr)->a =                                     \
+        (((unsigned long)(addr) & 0xFFFF0000UL) << 32) | \
+        ((unsigned long)(dpl) << 45) |                   \
+        ((unsigned long)(type) << 40) |                  \
+        ((unsigned long)(addr) & 0xFFFFUL) |             \
+        ((unsigned long)__HYPERVISOR_CS << 16) |         \
+        (1UL << 47);                                     \
+} while (0)
+
+/*
+ * Write the lower 64 bits of an IDT Entry. This relies on the upper 32
+ * bits of the address not changing, which is a safe assumption as all
+ * functions we are likely to load will live inside the 1GB
+ * code/data/bss address range.
+ */
+static inline void _write_gate_lower(volatile idt_entry_t *gate,
+                                     const idt_entry_t *new)
+{
+    ASSERT(gate->b == new->b);
+    gate->a = new->a;
+}
+
+static inline void _set_gate_lower(idt_entry_t *gate, unsigned long type,
+                                   unsigned long dpl, void *addr)
+{
+    idt_entry_t idte;
+    idte.b = gate->b;
+    idte.a =
+        (((unsigned long)(addr) & 0xFFFF0000UL) << 32) |
+        ((unsigned long)(dpl) << 45) |
+        ((unsigned long)(type) << 40) |
+        ((unsigned long)(addr) & 0xFFFFUL) |
+        ((unsigned long)__HYPERVISOR_CS << 16) |
+        (1UL << 47);
+    _write_gate_lower(gate, &idte);
+}
+
+/*
+ * Update the lower half handler of an IDT entry, without changing any other
+ * configuration.
+ */
+static inline void _update_gate_addr_lower(idt_entry_t *gate, void *addr)
+{
+    idt_entry_t idte;
+    idte.a = gate->a;
+
+    idte.b = ((unsigned long)(addr) >> 32);
+    idte.a &= 0x0000FFFFFFFF0000ULL;
+    idte.a |= (((unsigned long)(addr) & 0xFFFF0000UL) << 32) |
+        ((unsigned long)(addr) & 0xFFFFUL);
+
+    _write_gate_lower(gate, &idte);
+}
+
+#endif /* X86_ASM_IDT_H */
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index 6bc88b0317..75af7ea3c4 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -353,43 +353,6 @@ struct tss_page {
 };
 DECLARE_PER_CPU(struct tss_page, tss_page);
 
-#define IST_NONE 0UL
-#define IST_MCE  1UL
-#define IST_NMI  2UL
-#define IST_DB   3UL
-#define IST_DF   4UL
-#define IST_MAX  4UL
-
-/* Set the Interrupt Stack Table used by a particular IDT entry. */
-static inline void set_ist(idt_entry_t *idt, unsigned int ist)
-{
-    /* IST is a 3 bit field, 32 bits into the IDT entry. */
-    ASSERT(ist <= IST_MAX);
-
-    /* Typically used on a live idt.  Disuade any clever optimisations. */
-    ACCESS_ONCE(idt->ist) = ist;
-}
-
-static inline void enable_each_ist(idt_entry_t *idt)
-{
-    set_ist(&idt[X86_EXC_DF],  IST_DF);
-    set_ist(&idt[X86_EXC_NMI], IST_NMI);
-    set_ist(&idt[X86_EXC_MC],  IST_MCE);
-    set_ist(&idt[X86_EXC_DB],  IST_DB);
-}
-
-static inline void disable_each_ist(idt_entry_t *idt)
-{
-    set_ist(&idt[X86_EXC_DF],  IST_NONE);
-    set_ist(&idt[X86_EXC_NMI], IST_NONE);
-    set_ist(&idt[X86_EXC_MC],  IST_NONE);
-    set_ist(&idt[X86_EXC_DB],  IST_NONE);
-}
-
-#define IDT_ENTRIES 256
-extern idt_entry_t idt_table[];
-extern idt_entry_t *idt_tables[];
-
 DECLARE_PER_CPU(root_pgentry_t *, root_pgt);
 
 extern void write_ptbase(struct vcpu *v);
diff --git a/xen/arch/x86/machine_kexec.c b/xen/arch/x86/machine_kexec.c
index e20e8d0b15..f775e526d5 100644
--- a/xen/arch/x86/machine_kexec.c
+++ b/xen/arch/x86/machine_kexec.c
@@ -22,6 +22,7 @@
 
 #include <asm/fixmap.h>
 #include <asm/hpet.h>
+#include <asm/idt.h>
 #include <asm/machine_kexec.h>
 #include <asm/page.h>
 
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 6b34b908ef..bfdc8fb019 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -115,6 +115,7 @@
 #include <asm/fixmap.h>
 #include <asm/flushtlb.h>
 #include <asm/guest.h>
+#include <asm/idt.h>
 #include <asm/io.h>
 #include <asm/io_apic.h>
 #include <asm/ldt.h>
@@ -6639,6 +6640,9 @@ static void __init __maybe_unused build_assertions(void)
      * using different PATs will not work.
      */
     BUILD_BUG_ON(XEN_MSR_PAT != 0x050100070406ULL);
+
+    /* IST_MAX IST pages + at least 1 guard page + primary stack. */
+    BUILD_BUG_ON((IST_MAX + 1) * PAGE_SIZE + PRIMARY_STACK_SIZE > STACK_SIZE);
 }
 
 /*
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index fd1597d0bd..77b034e4dc 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -13,6 +13,7 @@
 #include <xen/softirq.h>
 
 #include <asm/debugreg.h>
+#include <asm/idt.h>
 #include <asm/irq-vectors.h>
 #include <asm/pv/trace.h>
 #include <asm/shared.h>
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index f904d56232..f3d60d5bae 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -28,6 +28,7 @@
 #include <asm/div64.h>
 #include <asm/flushtlb.h>
 #include <asm/guest.h>
+#include <asm/idt.h>
 #include <asm/io_apic.h>
 #include <asm/irq-vectors.h>
 #include <asm/mc146818rtc.h>
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 3613ce573c..e466a260ca 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -53,6 +53,7 @@
 #include <asm/hpet.h>
 #include <asm/hvm/vpt.h>
 #include <asm/i387.h>
+#include <asm/idt.h>
 #include <asm/io.h>
 #include <asm/irq-vectors.h>
 #include <asm/mc146818rtc.h>
diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
index 7a370fae7d..ac0fafd72d 100644
--- a/xen/arch/x86/x86_64/traps.c
+++ b/xen/arch/x86/x86_64/traps.c
@@ -342,9 +342,6 @@ void subarch_percpu_traps_init(void)
     unsigned char *stub_page;
     unsigned int offset;
 
-    /* IST_MAX IST pages + at least 1 guard page + primary stack. */
-    BUILD_BUG_ON((IST_MAX + 1) * PAGE_SIZE + PRIMARY_STACK_SIZE > STACK_SIZE);
-
     /* No PV guests?  No need to set up SYSCALL/SYSENTER infrastructure. */
     if ( !IS_ENABLED(CONFIG_PV) )
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 04 22:22:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Mar 2025 22:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.901545.1309502 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpaex-0007Mz-UA; Tue, 04 Mar 2025 22:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 901545.1309502; Tue, 04 Mar 2025 22:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpaex-0007Ms-RU; Tue, 04 Mar 2025 22:22:43 +0000
Received: by outflank-mailman (input) for mailman id 901545;
 Tue, 04 Mar 2025 22:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpaew-0007Mg-OT
 for xen-changelog@lists.xenproject.org; Tue, 04 Mar 2025 22:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpaew-001Uma-37
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 22:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpaew-006hfo-2A
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Mar 2025 22:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AjDHEfSyYsbTuVR6AaHi58RjlLGAZtQ0n3VCzeU+vU4=; b=0p6/SPC03rSWWEoxFTJNcXX75z
	rbEJlHLbUObrOwUSWYyFMdG7j7Jok+gwC0qk4hw57KOi6FcRnaVWsASQl/54PTotjqAOQ3B/hdRj8
	pR1TDmoorIygM6ihkT4jOev6ceMgK7uRmQXWuydb7YpyEFAmWG4lV4S8A1euKkUsxzUU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/IDT: Rename X86_NR_VECTORS to X86_IDT_VECTORS
Message-Id: <E1tpaew-006hfo-2A@xenbits.xenproject.org>
Date: Tue, 04 Mar 2025 22:22:42 +0000

commit 83e043ee72b8c2fe1d620d137c20a2ffb040da01
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 2 16:56:59 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 4 19:46:41 2025 +0000

    x86/IDT: Rename X86_NR_VECTORS to X86_IDT_VECTORS
    
    Observant readers may have noticed that the FRED spec has another 8 bits of
    space reserved immediately following the vector field.
    
    Make the existing constant more precise.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vlapic.c               |  4 ++--
 xen/arch/x86/hvm/vmx/intr.c             |  4 ++--
 xen/arch/x86/hvm/vmx/vmcs.c             |  2 +-
 xen/arch/x86/hvm/vmx/vmx.c              |  6 +++---
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  4 ++--
 xen/arch/x86/include/asm/irq.h          |  4 ++--
 xen/arch/x86/include/asm/x86-defns.h    |  2 +-
 xen/arch/x86/io_apic.c                  |  2 +-
 xen/arch/x86/irq.c                      | 12 ++++++------
 xen/arch/x86/pv/callback.c              |  4 ++--
 xen/arch/x86/pv/domain.c                |  4 ++--
 xen/arch/x86/traps.c                    |  4 ++--
 xen/arch/x86/x86_64/entry.S             |  2 +-
 13 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 3363926b48..91fc457165 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -72,7 +72,7 @@ static void vlapic_do_init(struct vlapic *vlapic);
 static int vlapic_find_highest_vector(const void *bitmap)
 {
     const uint32_t *word = bitmap;
-    unsigned int word_offset = X86_NR_VECTORS / 32;
+    unsigned int word_offset = X86_IDT_VECTORS / 32;
 
     /* Work backwards through the bitmap (first 32-bit word in every four). */
     while ( (word_offset != 0) && (word[(--word_offset)*4] == 0) )
@@ -665,7 +665,7 @@ int guest_rdmsr_x2apic(const struct vcpu *v, uint32_t msr, uint64_t *val)
         REG(LVT0)  | REG(LVT1) | REG(LVTERR)  | REG(TMICT)   |
         REG(TMCCT) | REG(TDCR) |
 #undef REG
-#define REGBLOCK(x) (((1UL << (X86_NR_VECTORS / 32)) - 1) << (APIC_ ## x >> 4))
+#define REGBLOCK(x) (((1UL << (X86_IDT_VECTORS / 32)) - 1) << (APIC_ ## x >> 4))
         REGBLOCK(ISR) | REGBLOCK(TMR) | REGBLOCK(IRR)
 #undef REGBLOCK
     };
diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c
index 1a4dfb499b..91b407e6bc 100644
--- a/xen/arch/x86/hvm/vmx/intr.c
+++ b/xen/arch/x86/hvm/vmx/intr.c
@@ -356,7 +356,7 @@ void asmlinkage vmx_intr_assist(void)
                 {
                     word = (const void *)&vlapic->regs->data[APIC_IRR];
                     printk(XENLOG_ERR "vIRR:");
-                    for ( i = X86_NR_VECTORS / 32; i-- ; )
+                    for ( i = X86_IDT_VECTORS / 32; i-- ; )
                         printk(" %08x", word[i*4]);
                     printk("\n");
                 }
@@ -366,7 +366,7 @@ void asmlinkage vmx_intr_assist(void)
                 {
                     word = (const void *)&pi_desc->pir;
                     printk(XENLOG_ERR " PIR:");
-                    for ( i = X86_NR_VECTORS / 32; i-- ; )
+                    for ( i = X86_IDT_VECTORS / 32; i-- ; )
                         printk(" %08x", word[i]);
                     printk("\n");
                 }
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 0136830ebc..20ab2d0f26 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1219,7 +1219,7 @@ static int construct_vmcs(struct vcpu *v)
         unsigned int i;
 
         /* EOI-exit bitmap */
-        bitmap_zero(v->arch.hvm.vmx.eoi_exit_bitmap, X86_NR_VECTORS);
+        bitmap_zero(v->arch.hvm.vmx.eoi_exit_bitmap, X86_IDT_VECTORS);
         for ( i = 0; i < ARRAY_SIZE(v->arch.hvm.vmx.eoi_exit_bitmap); ++i )
             __vmwrite(EOI_EXIT_BITMAP(i), 0);
 
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 3728d2cd0d..d87da427ad 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2199,7 +2199,7 @@ static void cf_check vmx_process_isr(int isr, struct vcpu *v)
      * is acceptable because the subsequent interrupts will set up the eoi
      * bitmap correctly.
      */
-    for ( i = 0x10; i < X86_NR_VECTORS; ++i )
+    for ( i = 0x10; i < X86_IDT_VECTORS; ++i )
         if ( vlapic_test_vector(i, &vlapic->regs->data[APIC_IRR]) ||
              vlapic_test_vector(i, &vlapic->regs->data[APIC_ISR]) )
             set_bit(i, v->arch.hvm.vmx.eoi_exit_bitmap);
@@ -2316,7 +2316,7 @@ static void cf_check vmx_sync_pir_to_irr(struct vcpu *v)
 {
     struct vlapic *vlapic = vcpu_vlapic(v);
     unsigned int group, i;
-    DECLARE_BITMAP(pending_intr, X86_NR_VECTORS);
+    DECLARE_BITMAP(pending_intr, X86_IDT_VECTORS);
 
     if ( !pi_test_and_clear_on(&v->arch.hvm.vmx.pi_desc) )
         return;
@@ -2324,7 +2324,7 @@ static void cf_check vmx_sync_pir_to_irr(struct vcpu *v)
     for ( group = 0; group < ARRAY_SIZE(pending_intr); group++ )
         pending_intr[group] = pi_get_pir(&v->arch.hvm.vmx.pi_desc, group);
 
-    bitmap_for_each ( i, pending_intr, X86_NR_VECTORS )
+    bitmap_for_each ( i, pending_intr, X86_IDT_VECTORS )
         vlapic_set_vector(i, &vlapic->regs->data[APIC_IRR]);
 }
 
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index e1d3398141..bfb2341011 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -71,7 +71,7 @@ struct vmx_msr_bitmap {
 };
 
 struct pi_desc {
-    DECLARE_BITMAP(pir, X86_NR_VECTORS);
+    DECLARE_BITMAP(pir, X86_IDT_VECTORS);
     union {
         struct {
             u16     on     : 1,  /* bit 256 - Outstanding Notification */
@@ -138,7 +138,7 @@ struct vmx_vcpu {
     unsigned int         host_msr_count;
 
     unsigned long        eoi_exitmap_changed;
-    DECLARE_BITMAP(eoi_exit_bitmap, X86_NR_VECTORS);
+    DECLARE_BITMAP(eoi_exit_bitmap, X86_IDT_VECTORS);
     struct pi_desc       pi_desc;
 
     unsigned long        host_cr0;
diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index 354868ba31..f9ed5dc86c 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -23,7 +23,7 @@ extern unsigned int nr_irqs;
 #define LEGACY_VECTOR(irq)          ((irq) + FIRST_LEGACY_VECTOR)
 
 typedef struct {
-    DECLARE_BITMAP(_bits, X86_NR_VECTORS);
+    DECLARE_BITMAP(_bits, X86_IDT_VECTORS);
 } vmask_t;
 
 struct irq_desc;
@@ -96,7 +96,7 @@ struct arch_irq_desc {
 
 #define IRQ_VECTOR_UNASSIGNED (-1)
 
-typedef int vector_irq_t[X86_NR_VECTORS];
+typedef int vector_irq_t[X86_IDT_VECTORS];
 DECLARE_PER_CPU(vector_irq_t, vector_irq);
 
 extern bool opt_noirqbalance;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 2493ec277f..61b0cea8f3 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -155,7 +155,7 @@
 #define X86_INVPCID_ALL_INCL_GLOBAL 2
 #define X86_INVPCID_ALL_NON_GLOBAL  3
 
-#define X86_NR_VECTORS 256
+#define X86_IDT_VECTORS 256
 
 /* Exception Vectors */
 #define X86_EXC_DE             0 /* Divide Error */
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 68680c102f..776dd57720 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -101,7 +101,7 @@ static void share_vector_maps(unsigned int src, unsigned int dst)
         return;
 
     bitmap_or(vector_map[src]->_bits, vector_map[src]->_bits,
-              vector_map[dst]->_bits, X86_NR_VECTORS);
+              vector_map[dst]->_bits, X86_IDT_VECTORS);
 
     for (pin = 0; pin < nr_ioapic_entries[dst]; ++pin) {
         int irq = apic_pin_2_gsi_irq(dst, pin);
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index ff3ac832f4..f35894577b 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -51,7 +51,7 @@ static vmask_t global_used_vector_map;
 
 struct irq_desc __read_mostly *irq_desc = NULL;
 
-static DECLARE_BITMAP(used_vectors, X86_NR_VECTORS);
+static DECLARE_BITMAP(used_vectors, X86_IDT_VECTORS);
 
 static DEFINE_SPINLOCK(vector_lock);
 
@@ -155,7 +155,7 @@ static int __init _bind_irq_vector(struct irq_desc *desc, int vector,
     cpumask_t online_mask;
     int cpu;
 
-    BUG_ON((unsigned)vector >= X86_NR_VECTORS);
+    BUG_ON((unsigned)vector >= X86_IDT_VECTORS);
 
     cpumask_and(&online_mask, cpu_mask, &cpu_online_map);
     if (cpumask_empty(&online_mask))
@@ -423,7 +423,7 @@ int __init init_irq_data(void)
     struct irq_desc *desc;
     int irq, vector;
 
-    for ( vector = 0; vector < X86_NR_VECTORS; ++vector )
+    for ( vector = 0; vector < X86_IDT_VECTORS; ++vector )
         this_cpu(vector_irq)[vector] = INT_MIN;
 
     irq_desc = xzalloc_array(struct irq_desc, nr_irqs);
@@ -745,7 +745,7 @@ void setup_vector_irq(unsigned int cpu)
     unsigned int irq, vector;
 
     /* Clear vector_irq */
-    for ( vector = 0; vector < X86_NR_VECTORS; ++vector )
+    for ( vector = 0; vector < X86_IDT_VECTORS; ++vector )
         per_cpu(vector_irq, cpu)[vector] = INT_MIN;
     /* Mark the inuse vectors */
     for ( irq = 0; irq < nr_irqs; ++irq )
@@ -972,7 +972,7 @@ uint8_t alloc_hipriority_vector(void)
     return next++;
 }
 
-static void (*direct_apic_vector[X86_NR_VECTORS])(void);
+static void (*direct_apic_vector[X86_IDT_VECTORS])(void);
 void set_direct_apic_vector(uint8_t vector, void (*handler)(void))
 {
     BUG_ON(direct_apic_vector[vector] != NULL);
@@ -2572,7 +2572,7 @@ static void cf_check dump_irqs(unsigned char key)
 
     process_pending_softirqs();
     printk("Direct vector information:\n");
-    for ( i = FIRST_DYNAMIC_VECTOR; i < X86_NR_VECTORS; ++i )
+    for ( i = FIRST_DYNAMIC_VECTOR; i < X86_IDT_VECTORS; ++i )
         if ( direct_apic_vector[i] )
             printk("   %#02x -> %ps()\n", i, direct_apic_vector[i]);
 
diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c
index caec4fb16f..38b819b566 100644
--- a/xen/arch/x86/pv/callback.c
+++ b/xen/arch/x86/pv/callback.c
@@ -347,7 +347,7 @@ long do_set_trap_table(XEN_GUEST_HANDLE_PARAM(const_trap_info_t) traps)
     /* If no table is presented then clear the entire virtual IDT. */
     if ( guest_handle_is_null(traps) )
     {
-        memset(dst, 0, X86_NR_VECTORS * sizeof(*dst));
+        memset(dst, 0, X86_IDT_VECTORS * sizeof(*dst));
         return 0;
     }
 
@@ -393,7 +393,7 @@ int compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) traps)
     /* If no table is presented then clear the entire virtual IDT. */
     if ( guest_handle_is_null(traps) )
     {
-        memset(dst, 0, X86_NR_VECTORS * sizeof(*dst));
+        memset(dst, 0, X86_IDT_VECTORS * sizeof(*dst));
         return 0;
     }
 
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index 7aef628f55..9334da1dab 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -312,9 +312,9 @@ int pv_vcpu_initialise(struct vcpu *v)
     if ( rc )
         return rc;
 
-    BUILD_BUG_ON(X86_NR_VECTORS * sizeof(*v->arch.pv.trap_ctxt) >
+    BUILD_BUG_ON(X86_IDT_VECTORS * sizeof(*v->arch.pv.trap_ctxt) >
                  PAGE_SIZE);
-    v->arch.pv.trap_ctxt = xzalloc_array(struct trap_info, X86_NR_VECTORS);
+    v->arch.pv.trap_ctxt = xzalloc_array(struct trap_info, X86_IDT_VECTORS);
     if ( !v->arch.pv.trap_ctxt )
     {
         rc = -ENOMEM;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index e466a260ca..4d1aaa78e7 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1986,7 +1986,7 @@ static void __init init_ler(void)
     setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
 }
 
-extern void (*const autogen_entrypoints[X86_NR_VECTORS])(void);
+extern void (*const autogen_entrypoints[X86_IDT_VECTORS])(void);
 void __init trap_init(void)
 {
     unsigned int vector;
@@ -1996,7 +1996,7 @@ void __init trap_init(void)
 
     pv_trap_init();
 
-    for ( vector = 0; vector < X86_NR_VECTORS; ++vector )
+    for ( vector = 0; vector < X86_IDT_VECTORS; ++vector )
     {
         if ( autogen_entrypoints[vector] )
         {
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 40d094d5b2..d866e62625 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -1243,7 +1243,7 @@ DATA(autogen_entrypoints, 8)
 FUNC_LOCAL(autogen_stubs, 0) /* Automatically generated stubs. */
 
         vec = 0
-        .rept X86_NR_VECTORS
+        .rept X86_IDT_VECTORS
 
         /* Common interrupts, heading towards do_IRQ(). */
 #if defined(CONFIG_PV32)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 09:44:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 09:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902146.1310077 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tplIJ-0005Al-8e; Wed, 05 Mar 2025 09:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902146.1310077; Wed, 05 Mar 2025 09:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tplIJ-0005Ad-60; Wed, 05 Mar 2025 09:44:03 +0000
Received: by outflank-mailman (input) for mailman id 902146;
 Wed, 05 Mar 2025 09:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tplII-0005AX-RG
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 09:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tplII-0037ND-2O
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 09:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tplII-007aAQ-1Q
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 09:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5y3QdKHc8YFRq7EWBJuRbE7AvH88tbVmNwZhoUGJD8A=; b=oOUJzHPGv/WImBCVKCsrJklCQc
	vznvo5XlB4kV5ZUzSG9YVm/0rW9zMt6YZlnYitKuGNK74x5Wj87No0bJmv4/PjryxlBqAKEttO4jZ
	QZQCWGju3saYTBivtuGcFVd6KBdrjqSI1/T0R6XDo4/jtJsSn2tEW3kws7bsjN85BEug=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/emul: dump unhandled memory accesses for PVH dom0
Message-Id: <E1tplII-007aAQ-1Q@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 09:44:02 +0000

commit 43d8a80a0cccfe3715bb3178b5c15fb983979651
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 13 09:08:01 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 5 10:26:46 2025 +0100

    x86/emul: dump unhandled memory accesses for PVH dom0
    
    A PV dom0 can map any host memory as long as it's allowed by the IO
    capability range in d->iomem_caps.  On the other hand, a PVH dom0 has no
    way to populate MMIO region onto it's p2m, so it's limited to what Xen
    initially populates on the p2m based on the host memory map and the enabled
    device BARs.
    
    Introduce a new debug build only printk that reports attempts by dom0 to
    access addresses not populated on the p2m, and not handled by any emulator.
    This is for information purposes only, but might allow getting an idea of
    what MMIO ranges might be missing on the p2m.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 0d90cc4598..08b9493e6d 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -337,6 +337,9 @@ static int hvmemul_do_io(
         /* If there is no suitable backing DM, just ignore accesses */
         if ( !s )
         {
+            if ( is_mmio && is_hardware_domain(currd) )
+                gdprintk(XENLOG_DEBUG, "unhandled memory %s %#lx size %u\n",
+                         dir ? "read from" : "write to", addr, size);
             rc = hvm_process_io_intercept(&null_handler, &p);
             vio->req.state = STATE_IOREQ_NONE;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 09:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 09:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902147.1310080 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tplIT-0005Dl-9s; Wed, 05 Mar 2025 09:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902147.1310080; Wed, 05 Mar 2025 09:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tplIT-0005De-7P; Wed, 05 Mar 2025 09:44:13 +0000
Received: by outflank-mailman (input) for mailman id 902147;
 Wed, 05 Mar 2025 09:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tplIS-0005DN-LN
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 09:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tplIS-0037NH-2n
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 09:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tplIS-007aCs-1r
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 09:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wufGjtfmdXNgRXNhetBxA9BN7RiTt8GaJlFUj+oyr+s=; b=Y0gk8ousgLrXL9vlXQ1AuSzgEd
	t4w4vPgbUpuSsC68Kf2gIXeREEkn3oLERbO6YMyaEQy6D7IWRIvJvt+u6odGoU6FPadarLSsEy47h
	VUWvM4Etyb8mqNyEE1u2tHS4iDKSOqzLaQeZIfvzHBKOybyfsQFcyHzutGXsR7ZSv/O8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/dom0: attempt to fixup p2m page-faults for PVH dom0
Message-Id: <E1tplIS-007aCs-1r@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 09:44:12 +0000

commit 104591f5dd675d7bfb04885dace0e4e5a097fc1e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 13 10:58:45 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 5 10:26:46 2025 +0100

    x86/dom0: attempt to fixup p2m page-faults for PVH dom0
    
    When building a PVH dom0 Xen attempts to map all (relevant) MMIO regions
    into the p2m for dom0 access.  However the information Xen has about the
    host memory map is limited.  Xen doesn't have access to any resources
    described in ACPI dynamic tables, and hence the p2m mappings provided might
    not be complete.
    
    PV doesn't suffer from this issue because a PV dom0 is capable of mapping
    into it's page-tables any address not explicitly banned in d->iomem_caps.
    
    Introduce a new command line options that allows Xen to attempt to fixup
    the p2m page-faults, by creating p2m identity maps in response to p2m
    page-faults.
    
    This is aimed as a workaround to small ACPI regions Xen doesn't know about.
    Note that missing large MMIO regions mapped in this way will lead to
    slowness due to the VM exit processing, plus the mappings will always use
    small pages.
    
    The ultimate aim is to attempt to bring better parity with a classic PV
    dom0.
    
    Note such fixup rely on the CPU doing the access to the unpopulated
    address.  If the access is attempted from a device instead there's no
    possible way to fixup, as IOMMU page-fault are asynchronous.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    ---
    Only slightly tested on my local PVH dom0 deployment.
    ---
    Changes since v1:
     - Make the fixup function static.
     - Print message in case mapping already exists.
---
 CHANGELOG.md                           |  2 +
 docs/misc/xen-command-line.pandoc      | 16 +++++++-
 xen/arch/x86/dom0_build.c              |  5 +++
 xen/arch/x86/hvm/emulate.c             | 74 +++++++++++++++++++++++++++++++++-
 xen/arch/x86/include/asm/hvm/emulate.h |  3 ++
 5 files changed, 97 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 04c21d5bce..e99c5a5515 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Changed
 
 ### Added
+ - On x86:
+   - Option to attempt to fixup p2m page-faults on PVH dom0.
 
 ### Removed
 
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 0c6225391d..7e0f81adab 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -822,7 +822,8 @@ Specify the bit width of the DMA heap.
 
 ### dom0
     = List of [ pv | pvh, shadow=<bool>, verbose=<bool>,
-                cpuid-faulting=<bool>, msr-relaxed=<bool> ] (x86)
+                cpuid-faulting=<bool>, msr-relaxed=<bool>,
+                pf-fixup=<bool> ] (x86)
 
     = List of [ sve=<integer> ] (Arm64)
 
@@ -883,6 +884,19 @@ Controls for how dom0 is constructed on x86 systems.
 
     If using this option is necessary to fix an issue, please report a bug.
 
+*   The `pf-fixup` boolean is only applicable when using a PVH dom0 and
+    defaults to false.
+
+    When running dom0 in PVH mode the dom0 kernel has no way to map MMIO
+    regions into its physical memory map, such mode relies on Xen dom0 builder
+    populating the physical memory map with all MMIO regions that dom0 should
+    access.  However Xen doesn't have a complete picture of the host memory
+    map, due to not being able to process ACPI dynamic tables.
+
+    The `pf-fixup` option allows Xen to attempt to add missing MMIO regions
+    to the dom0 physical memory map in response to page-faults generated by
+    dom0 trying to access unpopulated entries in the memory map.
+
 Enables features on dom0 on Arm systems.
 
 *   The `sve` integer parameter enables Arm SVE usage for Dom0 and sets the
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index e8f5bf5447..3b9681dc91 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -16,6 +16,7 @@
 #include <asm/dom0_build.h>
 #include <asm/guest.h>
 #include <asm/hpet.h>
+#include <asm/hvm/emulate.h>
 #include <asm/io-ports.h>
 #include <asm/io_apic.h>
 #include <asm/p2m.h>
@@ -286,6 +287,10 @@ int __init parse_arch_dom0_param(const char *s, const char *e)
         opt_dom0_cpuid_faulting = val;
     else if ( (val = parse_boolean("msr-relaxed", s, e)) >= 0 )
         opt_dom0_msr_relaxed = val;
+#ifdef CONFIG_HVM
+    else if ( (val = parse_boolean("pf-fixup", s, e)) >= 0 )
+        opt_dom0_pf_fixup = val;
+#endif
     else
         return -EINVAL;
 
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 08b9493e6d..3cd7f2e22f 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -10,12 +10,15 @@
  */
 
 #include <xen/init.h>
+#include <xen/iocap.h>
 #include <xen/ioreq.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <xen/paging.h>
 #include <xen/trace.h>
 #include <xen/vm_event.h>
+
+#include <asm/altp2m.h>
 #include <asm/event.h>
 #include <asm/i387.h>
 #include <asm/xstate.h>
@@ -161,6 +164,36 @@ void hvmemul_cancel(struct vcpu *v)
     hvmemul_cache_disable(v);
 }
 
+bool __ro_after_init opt_dom0_pf_fixup;
+static int hwdom_fixup_p2m(paddr_t addr)
+{
+    unsigned long gfn = paddr_to_pfn(addr);
+    struct domain *currd = current->domain;
+    p2m_type_t type;
+    mfn_t mfn;
+    int rc;
+
+    ASSERT(is_hardware_domain(currd));
+    ASSERT(!altp2m_active(currd));
+
+    /*
+     * Fixups are only applied for MMIO holes, and rely on the hardware domain
+     * having identity mappings for non RAM regions (gfn == mfn).
+     */
+    if ( !iomem_access_permitted(currd, gfn, gfn) ||
+         !is_memory_hole(_mfn(gfn), _mfn(gfn)) )
+        return -EPERM;
+
+    mfn = get_gfn(currd, gfn, &type);
+    if ( !mfn_eq(mfn, INVALID_MFN) || !p2m_is_hole(type) )
+        rc = mfn_eq(mfn, _mfn(gfn)) ? -EEXIST : -ENOTEMPTY;
+    else
+        rc = set_mmio_p2m_entry(currd, _gfn(gfn), _mfn(gfn), 0);
+    put_gfn(currd, gfn);
+
+    return rc;
+}
+
 static int hvmemul_do_io(
     bool is_mmio, paddr_t addr, unsigned long *reps, unsigned int size,
     uint8_t dir, bool df, bool data_is_addr, uintptr_t data)
@@ -338,8 +371,45 @@ static int hvmemul_do_io(
         if ( !s )
         {
             if ( is_mmio && is_hardware_domain(currd) )
-                gdprintk(XENLOG_DEBUG, "unhandled memory %s %#lx size %u\n",
-                         dir ? "read from" : "write to", addr, size);
+            {
+                /*
+                 * PVH dom0 is likely missing MMIO mappings on the p2m, due to
+                 * the incomplete information Xen has about the memory layout.
+                 *
+                 * Either print a message to note dom0 attempted to access an
+                 * unpopulated GPA, or try to fixup the p2m by creating an
+                 * identity mapping for the faulting GPA.
+                 */
+                if ( opt_dom0_pf_fixup )
+                {
+                    int inner_rc = hwdom_fixup_p2m(addr);
+
+                    if ( !inner_rc || inner_rc == -EEXIST )
+                    {
+                        if ( !inner_rc )
+                            gdprintk(XENLOG_DEBUG,
+                                     "fixup p2m mapping for page %lx added\n",
+                                     paddr_to_pfn(addr));
+                        else
+                            gprintk(XENLOG_INFO,
+                                    "fixup p2m mapping for page %lx already present\n",
+                                    paddr_to_pfn(addr));
+
+                        rc = X86EMUL_RETRY;
+                        vio->req.state = STATE_IOREQ_NONE;
+                        break;
+                    }
+
+                    gprintk(XENLOG_WARNING,
+                            "unable to fixup memory %s %#lx size %u: %d\n",
+                            dir ? "read from" : "write to", addr, size,
+                            inner_rc);
+                }
+                else
+                    gdprintk(XENLOG_DEBUG,
+                             "unhandled memory %s %#lx size %u\n",
+                             dir ? "read from" : "write to", addr, size);
+            }
             rc = hvm_process_io_intercept(&null_handler, &p);
             vio->req.state = STATE_IOREQ_NONE;
         }
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index 45b03e4e37..d61eacfaa7 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -148,6 +148,9 @@ static inline void hvmemul_write_cache(const struct vcpu *v, paddr_t gpa,
 void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
                               struct hvm_emulate_ctxt *hvmemul_ctxt, int rc);
 
+/* For PVH dom0: signal whether to attempt fixup of p2m page-faults. */
+extern bool opt_dom0_pf_fixup;
+
 #endif /* __ASM_X86_HVM_EMULATE_H__ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 09:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 09:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902148.1310084 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tplId-0005H6-BP; Wed, 05 Mar 2025 09:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902148.1310084; Wed, 05 Mar 2025 09:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tplId-0005Gy-8u; Wed, 05 Mar 2025 09:44:23 +0000
Received: by outflank-mailman (input) for mailman id 902148;
 Wed, 05 Mar 2025 09:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tplIc-0005Gq-OW
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 09:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tplIc-0037NV-36
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 09:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tplIc-007aFF-2D
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 09:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lkh7EYeeBuPi9WocplYDXrR1sIEu2U0U0srXcDLr31A=; b=DaZP6hnRsuDXj6Wd5tBfeZhsuS
	nrnKQRbPS1cB2YeZZq3TxagoFjkD4XP/lFhSWZPKVwltnD6caeHScakZXxowu1EoAXz87AsvMVUgK
	2Bpvn1amrueQ0T8aRBSLYRa0U+s9llkX/eEkn2HPdutcqUcAdSjvyIZQqYl33x2z/ZiQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
Message-Id: <E1tplIc-007aFF-2D@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 09:44:22 +0000

commit a00e08799cc7657d2a1aca158f4ad43d4c9103e7
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 18 17:57:49 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 5 10:26:46 2025 +0100

    x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
    
    The logic in dom0_setup_permissions() sets the maximum bound in
    ->iomem_caps unconditionally using paddr_bits, which is not correct for HVM
    based domains.  Instead use domain_max_paddr_bits() to get the correct
    maximum paddr bits for each possible domain type.
    
    Switch to using PFN_DOWN() instead of PAGE_SHIFT, as that's shorter.
    
    Fixes: 53de839fb409 ('x86: constrain MFN range Dom0 may access')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/dom0_build.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 3b9681dc91..aec596997d 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -481,7 +481,8 @@ int __init dom0_setup_permissions(struct domain *d)
 
     /* The hardware domain is initially permitted full I/O capabilities. */
     rc = ioports_permit_access(d, 0, 0xFFFF);
-    rc |= iomem_permit_access(d, 0UL, (1UL << (paddr_bits - PAGE_SHIFT)) - 1);
+    rc |= iomem_permit_access(d, 0UL,
+                              PFN_DOWN(1UL << domain_max_paddr_bits(d)) - 1);
     rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
 
     /* Modify I/O port access permissions. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 09:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 09:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902149.1310088 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tplIn-0005Jx-D3; Wed, 05 Mar 2025 09:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902149.1310088; Wed, 05 Mar 2025 09:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tplIn-0005Jq-AM; Wed, 05 Mar 2025 09:44:33 +0000
Received: by outflank-mailman (input) for mailman id 902149;
 Wed, 05 Mar 2025 09:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tplIm-0005Jk-RJ
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 09:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tplIn-0037Nu-0A
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 09:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tplIm-007aGg-2X
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 09:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Zd4QjmHxbtF6JHtT1ukqwdIzaH5G4HNlPDQTJkrdzEc=; b=R5NaXvZmMikubStC2Z1neatE0c
	KDmnI35EJX+PY5CkeOloIebvS2hfBn2bzifkOuFuAOs3pb0GF7FS9bkOxnW6om5+n4oxuBWS4WMBU
	iPBKI8sDBQhWdsv3ER+FAWY1V7EXCGe2PbibFnKzLykyWHRsjgOQ1uTXR00Ev7isoyL8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/iommu: account for IOMEM caps when populating dom0 IOMMU page-tables
Message-Id: <E1tplIm-007aGg-2X@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 09:44:32 +0000

commit 62f3fc5296c452285e81adb50976bde2d68d3181
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Feb 14 10:39:29 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 5 10:26:46 2025 +0100

    x86/iommu: account for IOMEM caps when populating dom0 IOMMU page-tables
    
    The current code in arch_iommu_hwdom_init() kind of open-codes the same
    MMIO permission ranges that are added to the hardware domain ->iomem_caps.
    Avoid this duplication and use ->iomem_caps in arch_iommu_hwdom_init() to
    filter which memory regions should be added to the dom0 IOMMU page-tables.
    
    Note the IO-APIC and MCFG page(s) must be set as not accessible for a PVH
    dom0, otherwise the internal Xen emulation for those ranges won't work.
    This requires adjustments in dom0_setup_permissions().
    
    The call to pvh_setup_mmcfg() in dom0_construct_pvh() must now strictly be
    done ahead of setting up dom0 permissions, so take the opportunity to also
    put it inside the existing is_hardware_domain() region.
    
    Also the special casing of E820_UNUSABLE regions no longer needs to be done
    in arch_iommu_hwdom_init(), as those regions are already blocked in
    ->iomem_caps and thus would be removed from the rangeset as part of
    ->iomem_caps processing in arch_iommu_hwdom_init().  The E820_UNUSABLE
    regions below 1Mb are not removed from ->iomem_caps, that's a slight
    difference for the IOMMU created page-tables, but the aim is to allow
    access to the same memory either from the CPU or the IOMMU page-tables.
    
    Since ->iomem_caps already takes into account the domain max paddr, there's
    no need to remove any regions past the last address addressable by the
    domain, as applying ->iomem_caps would have already taken care of that.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/dom0_build.c           | 11 +++++-
 xen/arch/x86/hvm/dom0_build.c       | 14 ++++----
 xen/arch/x86/hvm/io.c               |  6 ++--
 xen/arch/x86/include/asm/hvm/io.h   |  4 +--
 xen/drivers/passthrough/x86/iommu.c | 67 +++++++++++++++----------------------
 5 files changed, 49 insertions(+), 53 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index aec596997d..a735e3650c 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -558,7 +558,9 @@ int __init dom0_setup_permissions(struct domain *d)
     for ( i = 0; i < nr_ioapics; i++ )
     {
         mfn = paddr_to_pfn(mp_ioapics[i].mpc_apicaddr);
-        if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
+        /* If emulating IO-APIC(s) make sure the base address is unmapped. */
+        if ( has_vioapic(d) ||
+             !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
     /* MSI range. */
@@ -599,6 +601,13 @@ int __init dom0_setup_permissions(struct domain *d)
             rc |= rangeset_add_singleton(mmio_ro_ranges, mfn);
     }
 
+    if ( has_vpci(d) )
+        /*
+         * TODO: runtime added MMCFG regions are not checked to make sure they
+         * don't overlap with already mapped regions, thus preventing trapping.
+         */
+        rc |= vpci_mmcfg_deny_access(d);
+
     return rc;
 }
 
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index ce5b5c31b3..6a4453103a 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1323,6 +1323,13 @@ int __init dom0_construct_pvh(struct boot_info *bi, struct domain *d)
 
     if ( is_hardware_domain(d) )
     {
+        /*
+         * MMCFG initialization must be performed before setting domain
+         * permissions, as the MCFG areas must not be part of the domain IOMEM
+         * accessible regions.
+         */
+        pvh_setup_mmcfg(d);
+
         /*
          * Setup permissions early so that calls to add MMIO regions to the
          * p2m as part of vPCI setup don't fail due to permission checks.
@@ -1335,13 +1342,6 @@ int __init dom0_construct_pvh(struct boot_info *bi, struct domain *d)
         }
     }
 
-    /*
-     * NB: MMCFG initialization needs to be performed before iommu
-     * initialization so the iommu code can fetch the MMCFG regions used by the
-     * domain.
-     */
-    pvh_setup_mmcfg(d);
-
     /*
      * Craft dom0 physical memory map and set the paging allocation. This must
      * be done before the iommu initializion, since iommu initialization code
diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index db726b3817..de6ee6c4dd 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -363,14 +363,14 @@ static const struct hvm_mmcfg *vpci_mmcfg_find(const struct domain *d,
     return NULL;
 }
 
-int __hwdom_init vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r)
+int __hwdom_init vpci_mmcfg_deny_access(struct domain *d)
 {
     const struct hvm_mmcfg *mmcfg;
 
     list_for_each_entry ( mmcfg, &d->arch.hvm.mmcfg_regions, next )
     {
-        int rc = rangeset_remove_range(r, PFN_DOWN(mmcfg->addr),
-                                       PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
+        int rc = iomem_deny_access(d, PFN_DOWN(mmcfg->addr),
+                                   PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
 
         if ( rc )
             return rc;
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index f2b8431fac..565bad300d 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -132,8 +132,8 @@ int register_vpci_mmcfg_handler(struct domain *d, paddr_t addr,
 /* Destroy tracked MMCFG areas. */
 void destroy_vpci_mmcfg(struct domain *d);
 
-/* Remove MMCFG regions from a given rangeset. */
-int vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r);
+/* Remove MMCFG regions from a domain ->iomem_caps. */
+int vpci_mmcfg_deny_access(struct domain *d);
 
 #endif /* __ASM_X86_HVM_IO_H__ */
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 8b1e0596b8..67f025c1ec 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -320,6 +320,26 @@ static int __hwdom_init cf_check map_subtract(unsigned long s, unsigned long e,
     return rangeset_remove_range(map, s, e);
 }
 
+struct handle_iomemcap {
+    struct rangeset *r;
+    unsigned long last;
+};
+static int __hwdom_init cf_check map_subtract_iomemcap(unsigned long s,
+                                                       unsigned long e,
+                                                       void *data)
+{
+    struct handle_iomemcap *h = data;
+    int rc = 0;
+
+    if ( h->last != s )
+        rc = rangeset_remove_range(h->r, h->last, s - 1);
+
+    ASSERT(e < ~0UL);
+    h->last = e + 1;
+
+    return rc;
+}
+
 struct map_data {
     struct domain *d;
     unsigned int flush_flags;
@@ -400,6 +420,7 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
     unsigned int i;
     struct rangeset *map;
     struct map_data map_data = { .d = d };
+    struct handle_iomemcap iomem = {};
     int rc;
 
     BUG_ON(!is_hardware_domain(d));
@@ -442,14 +463,6 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
 
         switch ( entry.type )
         {
-        case E820_UNUSABLE:
-            /* Only relevant for inclusive mode, otherwise this is a no-op. */
-            rc = rangeset_remove_range(map, PFN_DOWN(entry.addr),
-                                       PFN_DOWN(entry.addr + entry.size - 1));
-            if ( rc )
-                panic("IOMMU failed to remove unusable memory: %d\n", rc);
-            continue;
-
         case E820_RESERVED:
             if ( !iommu_hwdom_inclusive && !iommu_hwdom_reserved )
                 continue;
@@ -475,22 +488,13 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
     if ( rc )
         panic("IOMMU failed to remove Xen ranges: %d\n", rc);
 
-    /* Remove any overlap with the Interrupt Address Range. */
-    rc = rangeset_remove_range(map, 0xfee00, 0xfeeff);
+    iomem.r = map;
+    rc = rangeset_report_ranges(d->iomem_caps, 0, ~0UL, map_subtract_iomemcap,
+                                &iomem);
+    if ( !rc && iomem.last < ~0UL )
+        rc = rangeset_remove_range(map, iomem.last, ~0UL);
     if ( rc )
-        panic("IOMMU failed to remove Interrupt Address Range: %d\n", rc);
-
-    /* If emulating IO-APIC(s) make sure the base address is unmapped. */
-    if ( has_vioapic(d) )
-    {
-        for ( i = 0; i < d->arch.hvm.nr_vioapics; i++ )
-        {
-            rc = rangeset_remove_singleton(map,
-                PFN_DOWN(domain_vioapic(d, i)->base_address));
-            if ( rc )
-                panic("IOMMU failed to remove IO-APIC: %d\n", rc);
-        }
-    }
+        panic("IOMMU failed to remove forbidden regions: %d\n", rc);
 
     if ( is_pv_domain(d) )
     {
@@ -506,23 +510,6 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
             panic("IOMMU failed to remove read-only regions: %d\n", rc);
     }
 
-    if ( has_vpci(d) )
-    {
-        /*
-         * TODO: runtime added MMCFG regions are not checked to make sure they
-         * don't overlap with already mapped regions, thus preventing trapping.
-         */
-        rc = vpci_subtract_mmcfg(d, map);
-        if ( rc )
-            panic("IOMMU unable to remove MMCFG areas: %d\n", rc);
-    }
-
-    /* Remove any regions past the last address addressable by the domain. */
-    rc = rangeset_remove_range(map, PFN_DOWN(1UL << domain_max_paddr_bits(d)),
-                               ~0UL);
-    if ( rc )
-        panic("IOMMU unable to remove unaddressable ranges: %d\n", rc);
-
     if ( iommu_verbose )
         printk(XENLOG_INFO "%pd: identity mappings for IOMMU:\n", d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 09:44:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 09:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902150.1310092 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tplIx-0005NF-Fn; Wed, 05 Mar 2025 09:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902150.1310092; Wed, 05 Mar 2025 09:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tplIx-0005N7-DG; Wed, 05 Mar 2025 09:44:43 +0000
Received: by outflank-mailman (input) for mailman id 902150;
 Wed, 05 Mar 2025 09:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tplIw-0005Mx-UD
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 09:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tplIx-0037O2-0R
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 09:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tplIw-007aHL-2n
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 09:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0BfTtfftEgPPx9Ry2th3MHrnjFdvkm3qlyqqdO9d6cI=; b=0YXXEL2v/gzPW+N7vc/td2GzGt
	cwJx4p8NlwlfqNa84fMyCkt8B3skMWXZerYYdHLEmjhpRYnDIhFJvv2QsBaEYjPiFt6EKlBMZujeF
	PEotSlQbI5Fe6JXRXktiuh502JB9taohcE7xGmqOYuVvfZwdEQ6JxNvT5Y0MpIJu7IXk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/dom0: be less restrictive with the Interrupt Address Range
Message-Id: <E1tplIw-007aHL-2n@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 09:44:42 +0000

commit 381caa38850771ae218eb6f6d490dc02e40df964
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Feb 12 11:37:50 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 5 10:26:46 2025 +0100

    x86/dom0: be less restrictive with the Interrupt Address Range
    
    Xen currently prevents dom0 from creating CPU or IOMMU page-table mappings
    into the interrupt address range [0xfee00000, 0xfeefffff].  This range has
    two different purposes.  For accesses from the CPU is contains the default
    position of local APIC page at 0xfee00000.  For accesses from devices
    it's the MSI address range, so the address field in the MSI entries
    (usually) point to an address on that range to trigger an interrupt.
    
    There are reports of Lenovo Thinkpad devices placing what seems to be the
    UCSI shared mailbox at address 0xfeec2000 in the interrupt address range.
    Attempting to use that device with a Linux PV dom0 leads to an error when
    Linux kernel maps 0xfeec2000:
    
    RIP: e030:xen_mc_flush+0x1e8/0x2b0
     xen_leave_lazy_mmu+0x15/0x60
     vmap_range_noflush+0x408/0x6f0
     __ioremap_caller+0x20d/0x350
     acpi_os_map_iomem+0x1a3/0x1c0
     acpi_ex_system_memory_space_handler+0x229/0x3f0
     acpi_ev_address_space_dispatch+0x17e/0x4c0
     acpi_ex_access_region+0x28a/0x510
     acpi_ex_field_datum_io+0x95/0x5c0
     acpi_ex_extract_from_field+0x36b/0x4e0
     acpi_ex_read_data_from_field+0xcb/0x430
     acpi_ex_resolve_node_to_value+0x2e0/0x530
     acpi_ex_resolve_to_value+0x1e7/0x550
     acpi_ds_evaluate_name_path+0x107/0x170
     acpi_ds_exec_end_op+0x392/0x860
     acpi_ps_parse_loop+0x268/0xa30
     acpi_ps_parse_aml+0x221/0x5e0
     acpi_ps_execute_method+0x171/0x3e0
     acpi_ns_evaluate+0x174/0x5d0
     acpi_evaluate_object+0x167/0x440
     acpi_evaluate_dsm+0xb6/0x130
     ucsi_acpi_dsm+0x53/0x80
     ucsi_acpi_read+0x2e/0x60
     ucsi_register+0x24/0xa0
     ucsi_acpi_probe+0x162/0x1e3
     platform_probe+0x48/0x90
     really_probe+0xde/0x340
     __driver_probe_device+0x78/0x110
     driver_probe_device+0x1f/0x90
     __driver_attach+0xd2/0x1c0
     bus_for_each_dev+0x77/0xc0
     bus_add_driver+0x112/0x1f0
     driver_register+0x72/0xd0
     do_one_initcall+0x48/0x300
     do_init_module+0x60/0x220
     __do_sys_init_module+0x17f/0x1b0
     do_syscall_64+0x82/0x170
    
    Remove the restrictions to create mappings in the interrupt address range
    for dom0.  Note that the restriction to map the local APIC page is enforced
    separately, and that continues to be present.  Additionally make sure the
    emulated local APIC page is also not mapped, in case dom0 is using it.
    
    Note that even if the interrupt address range entries are populated in the
    IOMMU page-tables no device access will reach those pages.  Device accesses
    to the Interrupt Address Range will always be converted into Interrupt
    Messages and are not subject to DMA remapping.
    
    There's also the following restriction noted in Intel VT-d:
    
    > Software must not program paging-structure entries to remap any address to
    > the interrupt address range. Untranslated requests and translation requests
    > that result in an address in the interrupt range will be blocked with
    > condition code LGN.4 or SGN.8. Translated requests with an address in the
    > interrupt address range are treated as Unsupported Request (UR).
    
    Similarly for AMD-Vi:
    
    > Accesses to the interrupt address range (Table 3) are defined to go through
    > the interrupt remapping portion of the IOMMU and not through address
    > translation processing. Therefore, when a transaction is being processed as
    > an interrupt remapping operation, the transaction attribute of
    > pretranslated or untranslated is ignored.
    >
    > Software Note: The IOMMU should
    > not be configured such that an address translation results in a special
    > address such as the interrupt address range.
    
    However those restrictions don't apply to the identity mappings possibly
    created for dom0, since the interrupt address range is never subject to DMA
    remapping, and hence there's no output address after translation that
    belongs to the interrupt address range.
    
    Reported-by: Jürgen Groß <jgross@suse.com>
    Link: https://lore.kernel.org/xen-devel/baade0a7-e204-4743-bda1-282df74e5f89@suse.com/
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/dom0_build.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index a735e3650c..8191d90a22 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -554,6 +554,13 @@ int __init dom0_setup_permissions(struct domain *d)
         mfn = paddr_to_pfn(mp_lapic_addr);
         rc |= iomem_deny_access(d, mfn, mfn);
     }
+    /* If using an emulated local APIC make sure its MMIO is unpopulated. */
+    if ( has_vlapic(d) )
+    {
+        /* Xen doesn't allow changing the local APIC MMIO window position. */
+        mfn = paddr_to_pfn(APIC_DEFAULT_PHYS_BASE);
+        rc |= iomem_deny_access(d, mfn, mfn);
+    }
     /* I/O APICs. */
     for ( i = 0; i < nr_ioapics; i++ )
     {
@@ -563,10 +570,6 @@ int __init dom0_setup_permissions(struct domain *d)
              !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
-    /* MSI range. */
-    rc |= iomem_deny_access(d, paddr_to_pfn(MSI_ADDR_BASE_LO),
-                            paddr_to_pfn(MSI_ADDR_BASE_LO +
-                                         MSI_ADDR_DEST_ID_MASK));
     /* HyperTransport range. */
     if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 10:44:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 10:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902175.1310120 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpmEN-0002B7-3U; Wed, 05 Mar 2025 10:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902175.1310120; Wed, 05 Mar 2025 10:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpmEN-0002Az-0z; Wed, 05 Mar 2025 10:44:03 +0000
Received: by outflank-mailman (input) for mailman id 902175;
 Wed, 05 Mar 2025 10:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpmEL-0002Ar-St
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 10:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpmEL-0038d4-2T
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 10:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpmEL-007fyS-1X
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 10:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1d78h82p4bO/xDkZmhZ9xHXEibO3xNEWl4LgXQ35tSQ=; b=FGKpHf5Ui2JXrOd/gRP2Pgwfbf
	cwBowKcv2ej+z3j3GAPrIZZJdkoWbcP2N1hpYKnDXSZNE1MkmE1wnj9Sz6mkU+XqWv2vxzES1rHdm
	7pYzuk4Zpmxvo+NDn5EzI4k75OUl4Y2E1MxELzSDTQNwqDZn9iukpFWS8fg8ex7LM1n4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/emul: dump unhandled memory accesses for PVH dom0
Message-Id: <E1tpmEL-007fyS-1X@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 10:44:01 +0000

commit 43d8a80a0cccfe3715bb3178b5c15fb983979651
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 13 09:08:01 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 5 10:26:46 2025 +0100

    x86/emul: dump unhandled memory accesses for PVH dom0
    
    A PV dom0 can map any host memory as long as it's allowed by the IO
    capability range in d->iomem_caps.  On the other hand, a PVH dom0 has no
    way to populate MMIO region onto it's p2m, so it's limited to what Xen
    initially populates on the p2m based on the host memory map and the enabled
    device BARs.
    
    Introduce a new debug build only printk that reports attempts by dom0 to
    access addresses not populated on the p2m, and not handled by any emulator.
    This is for information purposes only, but might allow getting an idea of
    what MMIO ranges might be missing on the p2m.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 0d90cc4598..08b9493e6d 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -337,6 +337,9 @@ static int hvmemul_do_io(
         /* If there is no suitable backing DM, just ignore accesses */
         if ( !s )
         {
+            if ( is_mmio && is_hardware_domain(currd) )
+                gdprintk(XENLOG_DEBUG, "unhandled memory %s %#lx size %u\n",
+                         dir ? "read from" : "write to", addr, size);
             rc = hvm_process_io_intercept(&null_handler, &p);
             vio->req.state = STATE_IOREQ_NONE;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 10:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 10:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902176.1310123 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpmEX-0002D3-4x; Wed, 05 Mar 2025 10:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902176.1310123; Wed, 05 Mar 2025 10:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpmEX-0002Cv-2M; Wed, 05 Mar 2025 10:44:13 +0000
Received: by outflank-mailman (input) for mailman id 902176;
 Wed, 05 Mar 2025 10:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpmEV-0002Cn-LT
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 10:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpmEV-0038dJ-2o
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 10:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpmEV-007fzk-1v
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 10:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+BoacDrDXctWSquCUVZ/RpjXC08b503Y/8na1KT52ig=; b=uWC/VnkpZXmf+mCZ560mlsVtWT
	oEkT5Cm2B9y/jtB/l1B0O/iSXpwOcU54NhUPkjq+6COHWaq04xtehwr5dqqtTCSCgz/32KxCvFp1l
	7DUcNkE/iW1At8H9N4ish8cQTPe3fEcBrTwm8DrvVtuj4BxkuwdqrXYCvkQRbMDSGNGE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/dom0: attempt to fixup p2m page-faults for PVH dom0
Message-Id: <E1tpmEV-007fzk-1v@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 10:44:11 +0000

commit 104591f5dd675d7bfb04885dace0e4e5a097fc1e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 13 10:58:45 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 5 10:26:46 2025 +0100

    x86/dom0: attempt to fixup p2m page-faults for PVH dom0
    
    When building a PVH dom0 Xen attempts to map all (relevant) MMIO regions
    into the p2m for dom0 access.  However the information Xen has about the
    host memory map is limited.  Xen doesn't have access to any resources
    described in ACPI dynamic tables, and hence the p2m mappings provided might
    not be complete.
    
    PV doesn't suffer from this issue because a PV dom0 is capable of mapping
    into it's page-tables any address not explicitly banned in d->iomem_caps.
    
    Introduce a new command line options that allows Xen to attempt to fixup
    the p2m page-faults, by creating p2m identity maps in response to p2m
    page-faults.
    
    This is aimed as a workaround to small ACPI regions Xen doesn't know about.
    Note that missing large MMIO regions mapped in this way will lead to
    slowness due to the VM exit processing, plus the mappings will always use
    small pages.
    
    The ultimate aim is to attempt to bring better parity with a classic PV
    dom0.
    
    Note such fixup rely on the CPU doing the access to the unpopulated
    address.  If the access is attempted from a device instead there's no
    possible way to fixup, as IOMMU page-fault are asynchronous.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    ---
    Only slightly tested on my local PVH dom0 deployment.
    ---
    Changes since v1:
     - Make the fixup function static.
     - Print message in case mapping already exists.
---
 CHANGELOG.md                           |  2 +
 docs/misc/xen-command-line.pandoc      | 16 +++++++-
 xen/arch/x86/dom0_build.c              |  5 +++
 xen/arch/x86/hvm/emulate.c             | 74 +++++++++++++++++++++++++++++++++-
 xen/arch/x86/include/asm/hvm/emulate.h |  3 ++
 5 files changed, 97 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 04c21d5bce..e99c5a5515 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Changed
 
 ### Added
+ - On x86:
+   - Option to attempt to fixup p2m page-faults on PVH dom0.
 
 ### Removed
 
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 0c6225391d..7e0f81adab 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -822,7 +822,8 @@ Specify the bit width of the DMA heap.
 
 ### dom0
     = List of [ pv | pvh, shadow=<bool>, verbose=<bool>,
-                cpuid-faulting=<bool>, msr-relaxed=<bool> ] (x86)
+                cpuid-faulting=<bool>, msr-relaxed=<bool>,
+                pf-fixup=<bool> ] (x86)
 
     = List of [ sve=<integer> ] (Arm64)
 
@@ -883,6 +884,19 @@ Controls for how dom0 is constructed on x86 systems.
 
     If using this option is necessary to fix an issue, please report a bug.
 
+*   The `pf-fixup` boolean is only applicable when using a PVH dom0 and
+    defaults to false.
+
+    When running dom0 in PVH mode the dom0 kernel has no way to map MMIO
+    regions into its physical memory map, such mode relies on Xen dom0 builder
+    populating the physical memory map with all MMIO regions that dom0 should
+    access.  However Xen doesn't have a complete picture of the host memory
+    map, due to not being able to process ACPI dynamic tables.
+
+    The `pf-fixup` option allows Xen to attempt to add missing MMIO regions
+    to the dom0 physical memory map in response to page-faults generated by
+    dom0 trying to access unpopulated entries in the memory map.
+
 Enables features on dom0 on Arm systems.
 
 *   The `sve` integer parameter enables Arm SVE usage for Dom0 and sets the
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index e8f5bf5447..3b9681dc91 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -16,6 +16,7 @@
 #include <asm/dom0_build.h>
 #include <asm/guest.h>
 #include <asm/hpet.h>
+#include <asm/hvm/emulate.h>
 #include <asm/io-ports.h>
 #include <asm/io_apic.h>
 #include <asm/p2m.h>
@@ -286,6 +287,10 @@ int __init parse_arch_dom0_param(const char *s, const char *e)
         opt_dom0_cpuid_faulting = val;
     else if ( (val = parse_boolean("msr-relaxed", s, e)) >= 0 )
         opt_dom0_msr_relaxed = val;
+#ifdef CONFIG_HVM
+    else if ( (val = parse_boolean("pf-fixup", s, e)) >= 0 )
+        opt_dom0_pf_fixup = val;
+#endif
     else
         return -EINVAL;
 
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 08b9493e6d..3cd7f2e22f 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -10,12 +10,15 @@
  */
 
 #include <xen/init.h>
+#include <xen/iocap.h>
 #include <xen/ioreq.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <xen/paging.h>
 #include <xen/trace.h>
 #include <xen/vm_event.h>
+
+#include <asm/altp2m.h>
 #include <asm/event.h>
 #include <asm/i387.h>
 #include <asm/xstate.h>
@@ -161,6 +164,36 @@ void hvmemul_cancel(struct vcpu *v)
     hvmemul_cache_disable(v);
 }
 
+bool __ro_after_init opt_dom0_pf_fixup;
+static int hwdom_fixup_p2m(paddr_t addr)
+{
+    unsigned long gfn = paddr_to_pfn(addr);
+    struct domain *currd = current->domain;
+    p2m_type_t type;
+    mfn_t mfn;
+    int rc;
+
+    ASSERT(is_hardware_domain(currd));
+    ASSERT(!altp2m_active(currd));
+
+    /*
+     * Fixups are only applied for MMIO holes, and rely on the hardware domain
+     * having identity mappings for non RAM regions (gfn == mfn).
+     */
+    if ( !iomem_access_permitted(currd, gfn, gfn) ||
+         !is_memory_hole(_mfn(gfn), _mfn(gfn)) )
+        return -EPERM;
+
+    mfn = get_gfn(currd, gfn, &type);
+    if ( !mfn_eq(mfn, INVALID_MFN) || !p2m_is_hole(type) )
+        rc = mfn_eq(mfn, _mfn(gfn)) ? -EEXIST : -ENOTEMPTY;
+    else
+        rc = set_mmio_p2m_entry(currd, _gfn(gfn), _mfn(gfn), 0);
+    put_gfn(currd, gfn);
+
+    return rc;
+}
+
 static int hvmemul_do_io(
     bool is_mmio, paddr_t addr, unsigned long *reps, unsigned int size,
     uint8_t dir, bool df, bool data_is_addr, uintptr_t data)
@@ -338,8 +371,45 @@ static int hvmemul_do_io(
         if ( !s )
         {
             if ( is_mmio && is_hardware_domain(currd) )
-                gdprintk(XENLOG_DEBUG, "unhandled memory %s %#lx size %u\n",
-                         dir ? "read from" : "write to", addr, size);
+            {
+                /*
+                 * PVH dom0 is likely missing MMIO mappings on the p2m, due to
+                 * the incomplete information Xen has about the memory layout.
+                 *
+                 * Either print a message to note dom0 attempted to access an
+                 * unpopulated GPA, or try to fixup the p2m by creating an
+                 * identity mapping for the faulting GPA.
+                 */
+                if ( opt_dom0_pf_fixup )
+                {
+                    int inner_rc = hwdom_fixup_p2m(addr);
+
+                    if ( !inner_rc || inner_rc == -EEXIST )
+                    {
+                        if ( !inner_rc )
+                            gdprintk(XENLOG_DEBUG,
+                                     "fixup p2m mapping for page %lx added\n",
+                                     paddr_to_pfn(addr));
+                        else
+                            gprintk(XENLOG_INFO,
+                                    "fixup p2m mapping for page %lx already present\n",
+                                    paddr_to_pfn(addr));
+
+                        rc = X86EMUL_RETRY;
+                        vio->req.state = STATE_IOREQ_NONE;
+                        break;
+                    }
+
+                    gprintk(XENLOG_WARNING,
+                            "unable to fixup memory %s %#lx size %u: %d\n",
+                            dir ? "read from" : "write to", addr, size,
+                            inner_rc);
+                }
+                else
+                    gdprintk(XENLOG_DEBUG,
+                             "unhandled memory %s %#lx size %u\n",
+                             dir ? "read from" : "write to", addr, size);
+            }
             rc = hvm_process_io_intercept(&null_handler, &p);
             vio->req.state = STATE_IOREQ_NONE;
         }
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index 45b03e4e37..d61eacfaa7 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -148,6 +148,9 @@ static inline void hvmemul_write_cache(const struct vcpu *v, paddr_t gpa,
 void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
                               struct hvm_emulate_ctxt *hvmemul_ctxt, int rc);
 
+/* For PVH dom0: signal whether to attempt fixup of p2m page-faults. */
+extern bool opt_dom0_pf_fixup;
+
 #endif /* __ASM_X86_HVM_EMULATE_H__ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 10:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 10:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902177.1310129 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpmEh-0002Fh-6n; Wed, 05 Mar 2025 10:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902177.1310129; Wed, 05 Mar 2025 10:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpmEh-0002FX-3o; Wed, 05 Mar 2025 10:44:23 +0000
Received: by outflank-mailman (input) for mailman id 902177;
 Wed, 05 Mar 2025 10:44:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpmEf-0002FH-Q7
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 10:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpmEg-0038dN-00
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 10:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpmEf-007g0R-2D
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 10:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pDl4xN7/wtJbq56PbpNBXXhbQoAWbZsxuyjIziFbSDg=; b=H06Q268BMcrKD2DbJe/joxKVcc
	44X5Ar/IXqvcSWtQa548jxWWJY9O+cJxCrBJIaaByu4LYtjUi3UllPA8cYZfPc4SmY0nJzE04m16+
	BV3/WlP3Cy3Bs6J1xa7bDPwG4h/Jjca88VADRpFsBC38HSfN2olP+N8JPifkdncRXlrA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
Message-Id: <E1tpmEf-007g0R-2D@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 10:44:21 +0000

commit a00e08799cc7657d2a1aca158f4ad43d4c9103e7
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 18 17:57:49 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 5 10:26:46 2025 +0100

    x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
    
    The logic in dom0_setup_permissions() sets the maximum bound in
    ->iomem_caps unconditionally using paddr_bits, which is not correct for HVM
    based domains.  Instead use domain_max_paddr_bits() to get the correct
    maximum paddr bits for each possible domain type.
    
    Switch to using PFN_DOWN() instead of PAGE_SHIFT, as that's shorter.
    
    Fixes: 53de839fb409 ('x86: constrain MFN range Dom0 may access')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/dom0_build.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 3b9681dc91..aec596997d 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -481,7 +481,8 @@ int __init dom0_setup_permissions(struct domain *d)
 
     /* The hardware domain is initially permitted full I/O capabilities. */
     rc = ioports_permit_access(d, 0, 0xFFFF);
-    rc |= iomem_permit_access(d, 0UL, (1UL << (paddr_bits - PAGE_SHIFT)) - 1);
+    rc |= iomem_permit_access(d, 0UL,
+                              PFN_DOWN(1UL << domain_max_paddr_bits(d)) - 1);
     rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
 
     /* Modify I/O port access permissions. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 10:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 10:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902178.1310132 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpmEr-0002IR-82; Wed, 05 Mar 2025 10:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902178.1310132; Wed, 05 Mar 2025 10:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpmEr-0002IJ-59; Wed, 05 Mar 2025 10:44:33 +0000
Received: by outflank-mailman (input) for mailman id 902178;
 Wed, 05 Mar 2025 10:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpmEp-0002I9-VU
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 10:44:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpmEq-0038dR-0M
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 10:44:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpmEp-007g2Q-2e
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 10:44:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SsAD6TO6SBmf9uUQqlKre0nCgw+lyZKIFEI6voZiCLQ=; b=GXqgEr6b+OKStWdeTQDIDsAFik
	Xr5s5AArTzNXg+hyPjJC0Bop/zlDus+IkkC0CAHqmAWwJTaFx0O6WTcbpZfFTcEpbsMCVyKZ40N06
	jFiCJ7W9aF+0lbZxqtbR+K5iRYTAUHQ91WbaFyg7Fe86SXRYKZy6kKZ0Yh0rqv8kDql4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/iommu: account for IOMEM caps when populating dom0 IOMMU page-tables
Message-Id: <E1tpmEp-007g2Q-2e@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 10:44:31 +0000

commit 62f3fc5296c452285e81adb50976bde2d68d3181
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Feb 14 10:39:29 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 5 10:26:46 2025 +0100

    x86/iommu: account for IOMEM caps when populating dom0 IOMMU page-tables
    
    The current code in arch_iommu_hwdom_init() kind of open-codes the same
    MMIO permission ranges that are added to the hardware domain ->iomem_caps.
    Avoid this duplication and use ->iomem_caps in arch_iommu_hwdom_init() to
    filter which memory regions should be added to the dom0 IOMMU page-tables.
    
    Note the IO-APIC and MCFG page(s) must be set as not accessible for a PVH
    dom0, otherwise the internal Xen emulation for those ranges won't work.
    This requires adjustments in dom0_setup_permissions().
    
    The call to pvh_setup_mmcfg() in dom0_construct_pvh() must now strictly be
    done ahead of setting up dom0 permissions, so take the opportunity to also
    put it inside the existing is_hardware_domain() region.
    
    Also the special casing of E820_UNUSABLE regions no longer needs to be done
    in arch_iommu_hwdom_init(), as those regions are already blocked in
    ->iomem_caps and thus would be removed from the rangeset as part of
    ->iomem_caps processing in arch_iommu_hwdom_init().  The E820_UNUSABLE
    regions below 1Mb are not removed from ->iomem_caps, that's a slight
    difference for the IOMMU created page-tables, but the aim is to allow
    access to the same memory either from the CPU or the IOMMU page-tables.
    
    Since ->iomem_caps already takes into account the domain max paddr, there's
    no need to remove any regions past the last address addressable by the
    domain, as applying ->iomem_caps would have already taken care of that.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/dom0_build.c           | 11 +++++-
 xen/arch/x86/hvm/dom0_build.c       | 14 ++++----
 xen/arch/x86/hvm/io.c               |  6 ++--
 xen/arch/x86/include/asm/hvm/io.h   |  4 +--
 xen/drivers/passthrough/x86/iommu.c | 67 +++++++++++++++----------------------
 5 files changed, 49 insertions(+), 53 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index aec596997d..a735e3650c 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -558,7 +558,9 @@ int __init dom0_setup_permissions(struct domain *d)
     for ( i = 0; i < nr_ioapics; i++ )
     {
         mfn = paddr_to_pfn(mp_ioapics[i].mpc_apicaddr);
-        if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
+        /* If emulating IO-APIC(s) make sure the base address is unmapped. */
+        if ( has_vioapic(d) ||
+             !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
     /* MSI range. */
@@ -599,6 +601,13 @@ int __init dom0_setup_permissions(struct domain *d)
             rc |= rangeset_add_singleton(mmio_ro_ranges, mfn);
     }
 
+    if ( has_vpci(d) )
+        /*
+         * TODO: runtime added MMCFG regions are not checked to make sure they
+         * don't overlap with already mapped regions, thus preventing trapping.
+         */
+        rc |= vpci_mmcfg_deny_access(d);
+
     return rc;
 }
 
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index ce5b5c31b3..6a4453103a 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1323,6 +1323,13 @@ int __init dom0_construct_pvh(struct boot_info *bi, struct domain *d)
 
     if ( is_hardware_domain(d) )
     {
+        /*
+         * MMCFG initialization must be performed before setting domain
+         * permissions, as the MCFG areas must not be part of the domain IOMEM
+         * accessible regions.
+         */
+        pvh_setup_mmcfg(d);
+
         /*
          * Setup permissions early so that calls to add MMIO regions to the
          * p2m as part of vPCI setup don't fail due to permission checks.
@@ -1335,13 +1342,6 @@ int __init dom0_construct_pvh(struct boot_info *bi, struct domain *d)
         }
     }
 
-    /*
-     * NB: MMCFG initialization needs to be performed before iommu
-     * initialization so the iommu code can fetch the MMCFG regions used by the
-     * domain.
-     */
-    pvh_setup_mmcfg(d);
-
     /*
      * Craft dom0 physical memory map and set the paging allocation. This must
      * be done before the iommu initializion, since iommu initialization code
diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index db726b3817..de6ee6c4dd 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -363,14 +363,14 @@ static const struct hvm_mmcfg *vpci_mmcfg_find(const struct domain *d,
     return NULL;
 }
 
-int __hwdom_init vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r)
+int __hwdom_init vpci_mmcfg_deny_access(struct domain *d)
 {
     const struct hvm_mmcfg *mmcfg;
 
     list_for_each_entry ( mmcfg, &d->arch.hvm.mmcfg_regions, next )
     {
-        int rc = rangeset_remove_range(r, PFN_DOWN(mmcfg->addr),
-                                       PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
+        int rc = iomem_deny_access(d, PFN_DOWN(mmcfg->addr),
+                                   PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
 
         if ( rc )
             return rc;
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index f2b8431fac..565bad300d 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -132,8 +132,8 @@ int register_vpci_mmcfg_handler(struct domain *d, paddr_t addr,
 /* Destroy tracked MMCFG areas. */
 void destroy_vpci_mmcfg(struct domain *d);
 
-/* Remove MMCFG regions from a given rangeset. */
-int vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r);
+/* Remove MMCFG regions from a domain ->iomem_caps. */
+int vpci_mmcfg_deny_access(struct domain *d);
 
 #endif /* __ASM_X86_HVM_IO_H__ */
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 8b1e0596b8..67f025c1ec 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -320,6 +320,26 @@ static int __hwdom_init cf_check map_subtract(unsigned long s, unsigned long e,
     return rangeset_remove_range(map, s, e);
 }
 
+struct handle_iomemcap {
+    struct rangeset *r;
+    unsigned long last;
+};
+static int __hwdom_init cf_check map_subtract_iomemcap(unsigned long s,
+                                                       unsigned long e,
+                                                       void *data)
+{
+    struct handle_iomemcap *h = data;
+    int rc = 0;
+
+    if ( h->last != s )
+        rc = rangeset_remove_range(h->r, h->last, s - 1);
+
+    ASSERT(e < ~0UL);
+    h->last = e + 1;
+
+    return rc;
+}
+
 struct map_data {
     struct domain *d;
     unsigned int flush_flags;
@@ -400,6 +420,7 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
     unsigned int i;
     struct rangeset *map;
     struct map_data map_data = { .d = d };
+    struct handle_iomemcap iomem = {};
     int rc;
 
     BUG_ON(!is_hardware_domain(d));
@@ -442,14 +463,6 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
 
         switch ( entry.type )
         {
-        case E820_UNUSABLE:
-            /* Only relevant for inclusive mode, otherwise this is a no-op. */
-            rc = rangeset_remove_range(map, PFN_DOWN(entry.addr),
-                                       PFN_DOWN(entry.addr + entry.size - 1));
-            if ( rc )
-                panic("IOMMU failed to remove unusable memory: %d\n", rc);
-            continue;
-
         case E820_RESERVED:
             if ( !iommu_hwdom_inclusive && !iommu_hwdom_reserved )
                 continue;
@@ -475,22 +488,13 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
     if ( rc )
         panic("IOMMU failed to remove Xen ranges: %d\n", rc);
 
-    /* Remove any overlap with the Interrupt Address Range. */
-    rc = rangeset_remove_range(map, 0xfee00, 0xfeeff);
+    iomem.r = map;
+    rc = rangeset_report_ranges(d->iomem_caps, 0, ~0UL, map_subtract_iomemcap,
+                                &iomem);
+    if ( !rc && iomem.last < ~0UL )
+        rc = rangeset_remove_range(map, iomem.last, ~0UL);
     if ( rc )
-        panic("IOMMU failed to remove Interrupt Address Range: %d\n", rc);
-
-    /* If emulating IO-APIC(s) make sure the base address is unmapped. */
-    if ( has_vioapic(d) )
-    {
-        for ( i = 0; i < d->arch.hvm.nr_vioapics; i++ )
-        {
-            rc = rangeset_remove_singleton(map,
-                PFN_DOWN(domain_vioapic(d, i)->base_address));
-            if ( rc )
-                panic("IOMMU failed to remove IO-APIC: %d\n", rc);
-        }
-    }
+        panic("IOMMU failed to remove forbidden regions: %d\n", rc);
 
     if ( is_pv_domain(d) )
     {
@@ -506,23 +510,6 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
             panic("IOMMU failed to remove read-only regions: %d\n", rc);
     }
 
-    if ( has_vpci(d) )
-    {
-        /*
-         * TODO: runtime added MMCFG regions are not checked to make sure they
-         * don't overlap with already mapped regions, thus preventing trapping.
-         */
-        rc = vpci_subtract_mmcfg(d, map);
-        if ( rc )
-            panic("IOMMU unable to remove MMCFG areas: %d\n", rc);
-    }
-
-    /* Remove any regions past the last address addressable by the domain. */
-    rc = rangeset_remove_range(map, PFN_DOWN(1UL << domain_max_paddr_bits(d)),
-                               ~0UL);
-    if ( rc )
-        panic("IOMMU unable to remove unaddressable ranges: %d\n", rc);
-
     if ( iommu_verbose )
         printk(XENLOG_INFO "%pd: identity mappings for IOMMU:\n", d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 10:44:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 10:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902179.1310136 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpmF1-0002Lc-B4; Wed, 05 Mar 2025 10:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902179.1310136; Wed, 05 Mar 2025 10:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpmF1-0002LU-8K; Wed, 05 Mar 2025 10:44:43 +0000
Received: by outflank-mailman (input) for mailman id 902179;
 Wed, 05 Mar 2025 10:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpmEz-0002LM-W9
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 10:44:41 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpmF0-0038dq-0d
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 10:44:41 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpmEz-007g2n-2z
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 10:44:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YjzB8H9+bv4ONCJSyYlEhdR6c76jOJPzlCCjGPXSnvY=; b=BBio8UTbGKlF57lVKqEbQn6jkg
	dczbLf8SOoNc6ybmTPfYUo1/u2wsuZk79lobYYPhhIr8bPMloXrCA2pPI41Te1UltjiIgp/4qASvk
	IP/tUozNSEfzxNDyYKqSvZzMMDCWlNx3NL96ZmZHjvv7gF3dac+tIoOGXh2qBC6lcCTg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/dom0: be less restrictive with the Interrupt Address Range
Message-Id: <E1tpmEz-007g2n-2z@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 10:44:41 +0000

commit 381caa38850771ae218eb6f6d490dc02e40df964
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Feb 12 11:37:50 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 5 10:26:46 2025 +0100

    x86/dom0: be less restrictive with the Interrupt Address Range
    
    Xen currently prevents dom0 from creating CPU or IOMMU page-table mappings
    into the interrupt address range [0xfee00000, 0xfeefffff].  This range has
    two different purposes.  For accesses from the CPU is contains the default
    position of local APIC page at 0xfee00000.  For accesses from devices
    it's the MSI address range, so the address field in the MSI entries
    (usually) point to an address on that range to trigger an interrupt.
    
    There are reports of Lenovo Thinkpad devices placing what seems to be the
    UCSI shared mailbox at address 0xfeec2000 in the interrupt address range.
    Attempting to use that device with a Linux PV dom0 leads to an error when
    Linux kernel maps 0xfeec2000:
    
    RIP: e030:xen_mc_flush+0x1e8/0x2b0
     xen_leave_lazy_mmu+0x15/0x60
     vmap_range_noflush+0x408/0x6f0
     __ioremap_caller+0x20d/0x350
     acpi_os_map_iomem+0x1a3/0x1c0
     acpi_ex_system_memory_space_handler+0x229/0x3f0
     acpi_ev_address_space_dispatch+0x17e/0x4c0
     acpi_ex_access_region+0x28a/0x510
     acpi_ex_field_datum_io+0x95/0x5c0
     acpi_ex_extract_from_field+0x36b/0x4e0
     acpi_ex_read_data_from_field+0xcb/0x430
     acpi_ex_resolve_node_to_value+0x2e0/0x530
     acpi_ex_resolve_to_value+0x1e7/0x550
     acpi_ds_evaluate_name_path+0x107/0x170
     acpi_ds_exec_end_op+0x392/0x860
     acpi_ps_parse_loop+0x268/0xa30
     acpi_ps_parse_aml+0x221/0x5e0
     acpi_ps_execute_method+0x171/0x3e0
     acpi_ns_evaluate+0x174/0x5d0
     acpi_evaluate_object+0x167/0x440
     acpi_evaluate_dsm+0xb6/0x130
     ucsi_acpi_dsm+0x53/0x80
     ucsi_acpi_read+0x2e/0x60
     ucsi_register+0x24/0xa0
     ucsi_acpi_probe+0x162/0x1e3
     platform_probe+0x48/0x90
     really_probe+0xde/0x340
     __driver_probe_device+0x78/0x110
     driver_probe_device+0x1f/0x90
     __driver_attach+0xd2/0x1c0
     bus_for_each_dev+0x77/0xc0
     bus_add_driver+0x112/0x1f0
     driver_register+0x72/0xd0
     do_one_initcall+0x48/0x300
     do_init_module+0x60/0x220
     __do_sys_init_module+0x17f/0x1b0
     do_syscall_64+0x82/0x170
    
    Remove the restrictions to create mappings in the interrupt address range
    for dom0.  Note that the restriction to map the local APIC page is enforced
    separately, and that continues to be present.  Additionally make sure the
    emulated local APIC page is also not mapped, in case dom0 is using it.
    
    Note that even if the interrupt address range entries are populated in the
    IOMMU page-tables no device access will reach those pages.  Device accesses
    to the Interrupt Address Range will always be converted into Interrupt
    Messages and are not subject to DMA remapping.
    
    There's also the following restriction noted in Intel VT-d:
    
    > Software must not program paging-structure entries to remap any address to
    > the interrupt address range. Untranslated requests and translation requests
    > that result in an address in the interrupt range will be blocked with
    > condition code LGN.4 or SGN.8. Translated requests with an address in the
    > interrupt address range are treated as Unsupported Request (UR).
    
    Similarly for AMD-Vi:
    
    > Accesses to the interrupt address range (Table 3) are defined to go through
    > the interrupt remapping portion of the IOMMU and not through address
    > translation processing. Therefore, when a transaction is being processed as
    > an interrupt remapping operation, the transaction attribute of
    > pretranslated or untranslated is ignored.
    >
    > Software Note: The IOMMU should
    > not be configured such that an address translation results in a special
    > address such as the interrupt address range.
    
    However those restrictions don't apply to the identity mappings possibly
    created for dom0, since the interrupt address range is never subject to DMA
    remapping, and hence there's no output address after translation that
    belongs to the interrupt address range.
    
    Reported-by: Jürgen Groß <jgross@suse.com>
    Link: https://lore.kernel.org/xen-devel/baade0a7-e204-4743-bda1-282df74e5f89@suse.com/
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/dom0_build.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index a735e3650c..8191d90a22 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -554,6 +554,13 @@ int __init dom0_setup_permissions(struct domain *d)
         mfn = paddr_to_pfn(mp_lapic_addr);
         rc |= iomem_deny_access(d, mfn, mfn);
     }
+    /* If using an emulated local APIC make sure its MMIO is unpopulated. */
+    if ( has_vlapic(d) )
+    {
+        /* Xen doesn't allow changing the local APIC MMIO window position. */
+        mfn = paddr_to_pfn(APIC_DEFAULT_PHYS_BASE);
+        rc |= iomem_deny_access(d, mfn, mfn);
+    }
     /* I/O APICs. */
     for ( i = 0; i < nr_ioapics; i++ )
     {
@@ -563,10 +570,6 @@ int __init dom0_setup_permissions(struct domain *d)
              !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
-    /* MSI range. */
-    rc |= iomem_deny_access(d, paddr_to_pfn(MSI_ADDR_BASE_LO),
-                            paddr_to_pfn(MSI_ADDR_BASE_LO +
-                                         MSI_ADDR_DEST_ID_MASK));
     /* HyperTransport range. */
     if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 14:55:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 14:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902402.1310361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpq9H-00059y-BM; Wed, 05 Mar 2025 14:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902402.1310361; Wed, 05 Mar 2025 14:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpq9H-00059q-8M; Wed, 05 Mar 2025 14:55:03 +0000
Received: by outflank-mailman (input) for mailman id 902402;
 Wed, 05 Mar 2025 14:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpq9G-00059Y-6w
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 14:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpq9G-003Dsc-17
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpq9G-0081Q8-07
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DjsbTcWnmroDy9cd98z0u5juxBjkB8DqLTvaN3lfb2g=; b=34zyZCHihfYmvv56lzkVt6ekCq
	IitZY+lX6A/fTk+OzP1fNFTPSoC9ic7h2d5movO3Fb3mm1b1gV5TxhW01I7PNnvSoAgTZQsEWds3p
	x6ZzTf6vzfAV4MhBRT0HVHeFvtiC9RaN3blYb4POf8a1yLsn4jYTypMxn7s8gmylLZ9s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: slightly improve CMPXCHG16B emulation
Message-Id: <E1tpq9G-0081Q8-07@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 14:55:02 +0000

commit 2488ede7a994c8254b8d9304082d70924bbca141
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 5 15:41:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:41:14 2025 +0100

    x86/HVM: slightly improve CMPXCHG16B emulation
    
    Using hvmemul_linear_mmio_write() directly (as fallback when mapping the
    memory operand isn't possible) won't work properly when the access
    crosses a RAM/MMIO boundary. Use linear_write() instead, which splits at
    such boundaries as necessary.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/emulate.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 3cd7f2e22f..de38142413 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1718,10 +1718,8 @@ static int cf_check hvmemul_cmpxchg(
 {
     struct hvm_emulate_ctxt *hvmemul_ctxt =
         container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
-    struct vcpu *curr = current;
     unsigned long addr;
     uint32_t pfec = PFEC_page_present | PFEC_write_access;
-    struct hvm_vcpu_io *hvio = &curr->arch.hvm.hvm_io;
     int rc;
     void *mapping = NULL;
 
@@ -1745,10 +1743,7 @@ static int cf_check hvmemul_cmpxchg(
     if ( !mapping )
     {
         /* Fix this in case the guest is really relying on r-m-w atomicity. */
-        return hvmemul_linear_mmio_write(addr, bytes, p_new, pfec,
-                                         hvmemul_ctxt, addr,
-                                         hvio->mmio_access.write_access &&
-                                         hvio->mmio_gla == (addr & PAGE_MASK));
+        return linear_write(addr, bytes, p_new, pfec, hvmemul_ctxt);
     }
 
     switch ( bytes )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 14:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 14:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902403.1310364 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpq9R-0005FG-CY; Wed, 05 Mar 2025 14:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902403.1310364; Wed, 05 Mar 2025 14:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpq9R-0005F8-9l; Wed, 05 Mar 2025 14:55:13 +0000
Received: by outflank-mailman (input) for mailman id 902403;
 Wed, 05 Mar 2025 14:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpq9Q-0005Eb-9D
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 14:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpq9Q-003Dsi-1X
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpq9Q-0081R9-0X
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HQzSeimEqDKNsr8witBPIMzlBrCQqxW0H0v6HwQyL/8=; b=EYPJpIa0P4mZA2qYZh19Xi40KM
	Pg6pt5xOyUXZOIxFS4DKgxkEDyupFiamMBlB8pM22vkIMbDrAwxO4+YXAr5stV3twRa9jqFELO6IP
	FHFzB9ZkMVJaSurA/cbGswWD0bBATGESl1Y9RBEx3vbEjmpz36I2wztuRkJmvAGg2BAk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: drop redundant access splitting
Message-Id: <E1tpq9Q-0081R9-0X@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 14:55:12 +0000

commit 86e14fe17f2d6ba290799f6d0cb5f8e3e65f82ea
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 5 15:42:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:42:12 2025 +0100

    x86/HVM: drop redundant access splitting
    
    With all paths into hvmemul_linear_mmio_access() coming through
    linear_{read,write}(), there's no need anymore to split accesses at
    page boundaries there. Leave an assertion, though.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/emulate.c | 33 +++++++++------------------------
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index de38142413..5eb78ae275 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1157,7 +1157,7 @@ static int hvmemul_linear_mmio_access(
 {
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned long offset = gla & ~PAGE_MASK;
-    unsigned int chunk, buffer_offset = gla - start_gla;
+    unsigned int buffer_offset = gla - start_gla;
     struct hvm_mmio_cache *cache = hvmemul_find_mmio_cache(hvio, start_gla,
                                                            dir, buffer_offset);
     paddr_t gpa;
@@ -1167,13 +1167,17 @@ static int hvmemul_linear_mmio_access(
     if ( cache == NULL )
         return X86EMUL_UNHANDLEABLE;
 
-    chunk = min_t(unsigned int, size, PAGE_SIZE - offset);
+    if ( size + offset > PAGE_SIZE )
+    {
+        ASSERT_UNREACHABLE();
+        return X86EMUL_UNHANDLEABLE;
+    }
 
     if ( known_gpfn )
         gpa = pfn_to_paddr(hvio->mmio_gpfn) | offset;
     else
     {
-        rc = hvmemul_linear_to_phys(gla, &gpa, chunk, &one_rep, pfec,
+        rc = hvmemul_linear_to_phys(gla, &gpa, size, &one_rep, pfec,
                                     hvmemul_ctxt);
         if ( rc != X86EMUL_OKAY )
             return rc;
@@ -1181,27 +1185,8 @@ static int hvmemul_linear_mmio_access(
         latch_linear_to_phys(hvio, gla, gpa, dir == IOREQ_WRITE);
     }
 
-    for ( ;; )
-    {
-        rc = hvmemul_phys_mmio_access(cache, gpa, chunk, dir, buffer, buffer_offset);
-        if ( rc != X86EMUL_OKAY )
-            break;
-
-        gla += chunk;
-        buffer_offset += chunk;
-        size -= chunk;
-
-        if ( size == 0 )
-            break;
-
-        chunk = min_t(unsigned int, size, PAGE_SIZE);
-        rc = hvmemul_linear_to_phys(gla, &gpa, chunk, &one_rep, pfec,
-                                    hvmemul_ctxt);
-        if ( rc != X86EMUL_OKAY )
-            return rc;
-    }
-
-    return rc;
+    return hvmemul_phys_mmio_access(cache, gpa, size, dir, buffer,
+                                    buffer_offset);
 }
 
 static inline int hvmemul_linear_mmio_read(
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 14:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 14:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902405.1310367 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpq9b-0005P1-EE; Wed, 05 Mar 2025 14:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902405.1310367; Wed, 05 Mar 2025 14:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpq9b-0005Ot-BE; Wed, 05 Mar 2025 14:55:23 +0000
Received: by outflank-mailman (input) for mailman id 902405;
 Wed, 05 Mar 2025 14:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpq9a-0005ON-Bu
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 14:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpq9a-003Dsp-1p
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpq9a-0081Tg-0y
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EgblaPqNe6bHjUVbQ8+pFAKwqvCFTweVPQAoRRz6ulw=; b=TQmGUeQprDXP7Gd7TteUpANT49
	WdeDiipJtRMb6sdugMkonuBbRDaM4vmbgXj2O0iVEt9tBUHHs9QnglYdGSZMpgVRU9sJ6Hs2KknPu
	qqgFeH2FMwGIyKjKBlOX8yB88FRb/n+jYUx8DtL+wgvRPV3xLQ0OsxiA7vc7Fket2PZg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/console: introduce console_{get,put}_domain()
Message-Id: <E1tpq9a-0081Tg-0y@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 14:55:22 +0000

commit 91db39013a84c7f18066e284f62330a1fd93da09
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Wed Mar 5 15:42:49 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:42:49 2025 +0100

    xen/console: introduce console_{get,put}_domain()
    
    console_input_domain() takes an RCU lock to protect domain structure.
    That implies call to rcu_unlock_domain() after use.
    
    Introduce a pair of console_get_domain() / console_put_domain() to highlight
    the correct use of the call within the code interacting with Xen console
    driver.
    
    The new calls used in __serial_rx(), which also fixed console forwarding to
    late hardware domains which run with domain IDs different from 0.
    
    While moving the guest_printk() invocation also drop the redundant _G infix.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/vpl011.c      |  6 +++---
 xen/drivers/char/console.c | 54 ++++++++++++++++++++++++----------------------
 xen/include/xen/console.h  |  3 ++-
 3 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index c72f3778bf..66047bf33c 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -78,7 +78,7 @@ static void vpl011_write_data_xen(struct domain *d, uint8_t data)
     unsigned long flags;
     struct vpl011 *vpl011 = &d->arch.vpl011;
     struct vpl011_xen_backend *intf = vpl011->backend.xen;
-    struct domain *input = console_input_domain();
+    struct domain *input = console_get_domain();
 
     VPL011_LOCK(d, flags);
 
@@ -123,8 +123,8 @@ static void vpl011_write_data_xen(struct domain *d, uint8_t data)
     vpl011_update_interrupt_status(d);
 
     VPL011_UNLOCK(d, flags);
-    if ( input != NULL )
-        rcu_unlock_domain(input);
+
+    console_put_domain(input);
 }
 
 /*
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index b3bc4bc963..2f028c5d44 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -474,15 +474,18 @@ static unsigned int __read_mostly console_rx = 0;
 
 #define max_console_rx (max_init_domid + 1)
 
-#ifdef CONFIG_SBSA_VUART_CONSOLE
-/* Make sure to rcu_unlock_domain after use */
-struct domain *console_input_domain(void)
+struct domain *console_get_domain(void)
 {
     if ( console_rx == 0 )
             return NULL;
     return rcu_lock_domain_by_id(console_rx - 1);
 }
-#endif
+
+void console_put_domain(struct domain *d)
+{
+    if ( d )
+        rcu_unlock_domain(d);
+}
 
 static void switch_serial_input(void)
 {
@@ -528,12 +531,18 @@ static void switch_serial_input(void)
 
 static void __serial_rx(char c)
 {
-    switch ( console_rx )
-    {
-    case 0:
+    struct domain *d;
+    int rc = 0;
+
+    if ( console_rx == 0 )
         return handle_keypress(c, false);
 
-    case 1:
+    d = console_get_domain();
+    if ( !d )
+        return;
+
+    if ( is_hardware_domain(d) )
+    {
         /*
          * Deliver input to the hardware domain buffer, unless it is
          * already full.
@@ -546,31 +555,24 @@ static void __serial_rx(char c)
          * getting stuck.
          */
         send_global_virq(VIRQ_CONSOLE);
-        break;
-
-#ifdef CONFIG_SBSA_VUART_CONSOLE
-    default:
-    {
-        struct domain *d = rcu_lock_domain_by_id(console_rx - 1);
-
-        if ( d )
-        {
-            int rc = vpl011_rx_char_xen(d, c);
-            if ( rc )
-                guest_printk(d, XENLOG_G_WARNING
-                                "failed to process console input: %d\n", rc);
-            rcu_unlock_domain(d);
-        }
-
-        break;
     }
+#ifdef CONFIG_SBSA_VUART_CONSOLE
+    else
+        /* Deliver input to the emulated UART. */
+        rc = vpl011_rx_char_xen(d, c);
 #endif
-    }
+
+    if ( rc )
+        guest_printk(d,
+                     XENLOG_WARNING "failed to process console input: %d\n",
+                     rc);
 
 #ifdef CONFIG_X86
     if ( pv_shim && pv_console )
         consoled_guest_tx(c);
 #endif
+
+    console_put_domain(d);
 }
 
 static void cf_check serial_rx(char c)
diff --git a/xen/include/xen/console.h b/xen/include/xen/console.h
index c4650231be..83cbc9fbda 100644
--- a/xen/include/xen/console.h
+++ b/xen/include/xen/console.h
@@ -32,7 +32,8 @@ void console_end_sync(void);
 void console_start_log_everything(void);
 void console_end_log_everything(void);
 
-struct domain *console_input_domain(void);
+struct domain *console_get_domain(void);
+void console_put_domain(struct domain *d);
 
 /*
  * Steal output from the console. Returns +ve identifier, else -ve error.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 14:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 14:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902412.1310384 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpq9l-0005nN-N3; Wed, 05 Mar 2025 14:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902412.1310384; Wed, 05 Mar 2025 14:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpq9l-0005nB-Ji; Wed, 05 Mar 2025 14:55:33 +0000
Received: by outflank-mailman (input) for mailman id 902412;
 Wed, 05 Mar 2025 14:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpq9k-0005mX-F8
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 14:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpq9k-003Dsw-29
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpq9k-0081UB-1F
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+r/ThPB+aGNrUTlZ48t3/5J+iw2h0xf5Ib1wQ+6qQcQ=; b=2oyV8g2FeNdflmBzlRRA1KbXbW
	V+nLplzKV9ZdQQyGQbf3SM9HGIDq/PjQ9q56SREZaW41Pbi+76bjgM0K/OGPtRpfAKQysI/pgPtyy
	Lhn5qvUsxeSE6hEDtyuJcWo7O97igNMwyo9r3T8ypgxmBx4pt1La9uPbOQo9O4aU2qCw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/list: fix comments in include/xen/list.h
Message-Id: <E1tpq9k-0081UB-1F@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 14:55:32 +0000

commit 9f78105500f8c0e0907f10a94ac25734e5fd4c11
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Mar 5 15:43:32 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:43:32 2025 +0100

    xen/list: fix comments in include/xen/list.h
    
    There are several places in list.h where "list_struct" is used instead
    of "struct list_head". Fix that.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/list.h | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/xen/include/xen/list.h b/xen/include/xen/list.h
index 62169f4674..98d8482dab 100644
--- a/xen/include/xen/list.h
+++ b/xen/include/xen/list.h
@@ -384,7 +384,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_entry - get the struct for this entry
  * @ptr:    the &struct list_head pointer.
  * @type:    the type of the struct this is embedded in.
- * @member:    the name of the list_struct within the struct.
+ * @member:    the name of the struct list_head within the struct.
  */
 #define list_entry(ptr, type, member) \
     container_of(ptr, type, member)
@@ -393,7 +393,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_first_entry - get the first element from a list
  * @ptr:        the list head to take the element from.
  * @type:       the type of the struct this is embedded in.
- * @member:     the name of the list_struct within the struct.
+ * @member:     the name of the struct list_head within the struct.
  *
  * Note, that list is expected to be not empty.
  */
@@ -404,7 +404,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_last_entry - get the last element from a list
  * @ptr:        the list head to take the element from.
  * @type:       the type of the struct this is embedded in.
- * @member:     the name of the list_struct within the struct.
+ * @member:     the name of the struct list_head within the struct.
  *
  * Note, that list is expected to be not empty.
  */
@@ -415,7 +415,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_first_entry_or_null - get the first element from a list
  * @ptr:        the list head to take the element from.
  * @type:       the type of the struct this is embedded in.
- * @member:     the name of the list_struct within the struct.
+ * @member:     the name of the struct list_head within the struct.
  *
  * Note that if the list is empty, it returns NULL.
  */
@@ -426,7 +426,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_last_entry_or_null - get the last element from a list
  * @ptr:        the list head to take the element from.
  * @type:       the type of the struct this is embedded in.
- * @member:     the name of the list_struct within the struct.
+ * @member:     the name of the struct list_head within the struct.
  *
  * Note that if the list is empty, it returns NULL.
  */
@@ -436,7 +436,7 @@ static inline void list_splice_init(struct list_head *list,
 /**
   * list_next_entry - get the next element in list
   * @pos:        the type * to cursor
-  * @member:     the name of the list_struct within the struct.
+  * @member:     the name of the struct list_head within the struct.
   */
 #define list_next_entry(pos, member) \
         list_entry((pos)->member.next, typeof(*(pos)), member)
@@ -444,7 +444,7 @@ static inline void list_splice_init(struct list_head *list,
 /**
   * list_prev_entry - get the prev element in list
   * @pos:        the type * to cursor
-  * @member:     the name of the list_struct within the struct.
+  * @member:     the name of the struct list_head within the struct.
   */
 #define list_prev_entry(pos, member) \
         list_entry((pos)->member.prev, typeof(*(pos)), member)
@@ -490,7 +490,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_for_each_entry - iterate over list of given type
  * @pos:    the type * to use as a loop cursor.
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  */
 #define list_for_each_entry(pos, head, member)                          \
     for ((pos) = list_entry((head)->next, typeof(*(pos)), member);      \
@@ -501,7 +501,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_for_each_entry_reverse - iterate backwards over list of given type.
  * @pos:    the type * to use as a loop cursor.
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  */
 #define list_for_each_entry_reverse(pos, head, member)                  \
     for ((pos) = list_entry((head)->prev, typeof(*(pos)), member);      \
@@ -513,7 +513,7 @@ static inline void list_splice_init(struct list_head *list,
  *                      list_for_each_entry_continue
  * @pos:    the type * to use as a start point
  * @head:   the head of the list
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * Prepares a pos entry for use as a start point in
  * list_for_each_entry_continue.
@@ -525,7 +525,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_for_each_entry_continue - continue iteration over list of given type
  * @pos:    the type * to use as a loop cursor.
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * Continue to iterate over list of given type, continuing after
  * the current position.
@@ -540,7 +540,7 @@ static inline void list_splice_init(struct list_head *list,
  *                            current point
  * @pos:    the type * to use as a loop cursor.
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * Iterate over list of given type, continuing from current position.
  */
@@ -554,7 +554,7 @@ static inline void list_splice_init(struct list_head *list,
  * @pos:    the type * to use as a loop cursor.
  * @n:      another type * to use as temporary storage
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  */
 #define list_for_each_entry_safe(pos, n, head, member)                  \
     for ((pos) = list_entry((head)->next, typeof(*(pos)), member),      \
@@ -567,7 +567,7 @@ static inline void list_splice_init(struct list_head *list,
  * @pos:    the type * to use as a loop cursor.
  * @n:      another type * to use as temporary storage
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * Iterate over list of given type, continuing after current point,
  * safe against removal of list entry.
@@ -583,7 +583,7 @@ static inline void list_splice_init(struct list_head *list,
  * @pos:    the type * to use as a loop cursor.
  * @n:      another type * to use as temporary storage
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * Iterate over list of given type from current point, safe against
  * removal of list entry.
@@ -598,7 +598,7 @@ static inline void list_splice_init(struct list_head *list,
  * @pos:    the type * to use as a loop cursor.
  * @n:      another type * to use as temporary storage
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * Iterate backwards over list of given type, safe against removal
  * of list entry.
@@ -649,7 +649,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_for_each_entry_rcu - iterate over rcu list of given type
  * @pos:    the type * to use as a loop cursor.
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * This list-traversal primitive may safely run concurrently with
  * the _rcu list-mutation primitives such as list_add_rcu()
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 14:55:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 14:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902420.1310386 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpq9v-000614-Nu; Wed, 05 Mar 2025 14:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902420.1310386; Wed, 05 Mar 2025 14:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpq9v-00060w-LA; Wed, 05 Mar 2025 14:55:43 +0000
Received: by outflank-mailman (input) for mailman id 902420;
 Wed, 05 Mar 2025 14:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpq9u-0005yq-IK
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 14:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpq9u-003DtG-2U
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpq9u-0081VI-1Z
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=o1+HrLWkSNCtcVOwqT26hT0wmoTHZfNq0KbllvEbYHI=; b=JKhxrrQThj2fsVYL4+IvmQEQlf
	FZJ/ErK605g/M7x5cGUsY4vgqS5rkcGnf7dt8mgstXpyBacicq1n1cjKcQ9Vz0eHXp8sso4lL5WoZ
	cHYQKHjs7mY+YqgXJdfvkwdEy2rm58Z3snxLdHF4Tqp541TmW22TPCy83EjIuCGyQYqU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/README: add compiler and binutils versions for RISCV-64
Message-Id: <E1tpq9u-0081VI-1Z@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 14:55:42 +0000

commit 85caf5a0223150b541611bf32aa7f6112dd56359
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Mar 5 15:43:55 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:43:55 2025 +0100

    xen/README: add compiler and binutils versions for RISCV-64
    
    Considering that the Zbb extension is supported since GCC version 12 [1]
    and that older GCC versions do not support Z extensions in -march (I haven't
    faced this issue for GCC >=11.2), leading to compilation failures,
    the baseline version for GCC is set to 12.2 and for GNU binutils to 2.39.
    
    The GCC version is set to 12.2 instead of 12.1 because Xen's GitLab CI uses
    Debian 12, which includes GCC 12.2 and GNU binutils 2.39.
    
    [1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=149e217033f01410a9783c5cb2d020cf8334ae4c
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 README | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/README b/README
index 72f6b0fcde..9d9c6fc324 100644
--- a/README
+++ b/README
@@ -48,6 +48,9 @@ provided by your OS distributor:
       - For ARM 64-bit:
         - GCC 5.1 or later
         - GNU Binutils 2.24 or later
+      - For RISC-V 64-bit:
+        - GCC 12.2 or later
+        - GNU Binutils 2.39 or later
     * POSIX compatible awk
     * Development install of zlib (e.g., zlib-dev)
     * Development install of Python 2.7 or later (e.g., python-dev)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 14:55:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 14:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902424.1310390 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqA5-00068q-PV; Wed, 05 Mar 2025 14:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902424.1310390; Wed, 05 Mar 2025 14:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqA5-00068i-Mg; Wed, 05 Mar 2025 14:55:53 +0000
Received: by outflank-mailman (input) for mailman id 902424;
 Wed, 05 Mar 2025 14:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpqA4-00068N-Ls
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 14:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqA4-003DtM-2q
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqA4-0081Vl-1u
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9KjD1OuJCQAew7x7Ae9oa7pt61yjkGc9TMQdyKfGGAY=; b=HjFg0CP+SeuxKklQckhokcNAuM
	JYvL0qena1s16HB9LJBryw9qFCYiRNXrbnSc4i3VQq7YbwQW6LE0HsjzklBrryyJVE0POzxHBTash
	8Gy4gtCMZCib3kd4GUbDA4QhfyVp1UniqYRzNB3nXbhd3/UMCskxx7jsk32tNxohh/70=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: drop CONFIG_RISCV_ISA_RV64G
Message-Id: <E1tpqA4-0081Vl-1u@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 14:55:52 +0000

commit 86b1b8ec3d9d0508a95540e368432291b883837f
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Mar 5 15:44:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:44:12 2025 +0100

    xen/riscv: drop CONFIG_RISCV_ISA_RV64G
    
    'G' stands for "imafd_zicsr_zifencei".
    
    Extensions 'f' and 'd' aren't really needed for Xen, and allowing floating
    point registers to be used can lead to crashes.
    
    Extensions 'i', 'm', 'a', 'zicsr', and 'zifencei' are necessary for the
    operation of Xen, which is why they are used explicitly (unconditionally)
    in -march.
    
    Drop "Base ISA" choice from riscv/Kconfig as it is always empty.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Kconfig | 18 ------------------
 xen/arch/riscv/arch.mk |  8 +++++---
 2 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index fa95cd0a42..d882e0a059 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -23,24 +23,6 @@ endmenu
 
 menu "ISA Selection"
 
-choice
-	prompt "Base ISA"
-	default RISCV_ISA_RV64G if RISCV_64
-	help
-	  This selects the base ISA extensions that Xen will target.
-
-config RISCV_ISA_RV64G
-	bool "RV64G"
-	help
-	  Use the RV64I base ISA, plus
-	  "M" for multiply/divide,
-	  "A" for atomic instructions,
-	  “F”/"D" for  {single/double}-precision floating-point instructions,
-	  "Zicsr" for control and status register access,
-	  "Zifencei" for instruction-fetch fence.
-
-endchoice
-
 config RISCV_ISA_C
 	bool "Compressed extension"
 	default y
diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 17827c302c..3034da76cb 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -6,10 +6,12 @@ $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 riscv-abi-$(CONFIG_RISCV_32) := -mabi=ilp32
 riscv-abi-$(CONFIG_RISCV_64) := -mabi=lp64
 
-riscv-march-$(CONFIG_RISCV_ISA_RV64G) := rv64g
-riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
+riscv-march-$(CONFIG_RISCV_64) := rv64
+riscv-march-y += ima
+riscv-march-$(CONFIG_RISCV_ISA_C) += c
+riscv-march-y += _zicsr_zifencei
 
-riscv-generic-flags := $(riscv-abi-y) -march=$(riscv-march-y)
+riscv-generic-flags := $(riscv-abi-y) -march=$(subst $(space),,$(riscv-march-y))
 
 # check-extension: Check whether extenstion is supported by a compiler and
 #                  an assembler.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 14:56:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 14:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902428.1310394 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqAF-0006FX-S7; Wed, 05 Mar 2025 14:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902428.1310394; Wed, 05 Mar 2025 14:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqAF-0006FP-PU; Wed, 05 Mar 2025 14:56:03 +0000
Received: by outflank-mailman (input) for mailman id 902428;
 Wed, 05 Mar 2025 14:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpqAE-0006F9-PL
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 14:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqAE-003Dtf-3C
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqAE-0081X0-2G
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 14:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kachy6N9RjfeVaIpZ97nKjZQ0fknyRx420jxPPR8sRQ=; b=celFbGLYs7lWmB1OWiw3GNViFE
	SxtJaXsZjed4tCgjiOTjRlcwtzfOgvnV1k0xwXZD6uWYr03cOum+qG6PPWDiG8WFMPxJS/Tgd76V0
	t9uKgbBiEFjktBXMv2QD/mYLphIK5bJLymq/9XRCJ8QMPjwAlX6eHrL2GFsTu59h4+GM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/cpufreq: abstract Energy Performance Preference value
Message-Id: <E1tpqAE-0081X0-2G@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 14:56:02 +0000

commit f84366bd42e3bee5ca2ec6ef0e3ca8326db5f78c
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Wed Mar 5 15:45:10 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:45:10 2025 +0100

    xen/cpufreq: abstract Energy Performance Preference value
    
    Intel's hwp Energy Performance Preference value is compatible with
    CPPC's Energy Performance Preference value, so this commit abstracts
    the value and re-place it in common header file cpufreq.h, to be
    used not only for hwp in the future.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpufreq/hwp.c    | 10 +++-------
 xen/include/acpi/cpufreq/cpufreq.h | 10 ++++++++++
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/hwp.c b/xen/arch/x86/acpi/cpufreq/hwp.c
index 59b57a4cef..d5fa3d47ca 100644
--- a/xen/arch/x86/acpi/cpufreq/hwp.c
+++ b/xen/arch/x86/acpi/cpufreq/hwp.c
@@ -21,10 +21,6 @@ static bool __ro_after_init feature_hdc;
 
 static bool __ro_after_init opt_cpufreq_hdc = true;
 
-#define HWP_ENERGY_PERF_MAX_PERFORMANCE 0
-#define HWP_ENERGY_PERF_BALANCE         0x80
-#define HWP_ENERGY_PERF_MAX_POWERSAVE   0xff
-
 union hwp_request
 {
     struct
@@ -597,7 +593,7 @@ int set_hwp_para(struct cpufreq_policy *policy,
         data->minimum = data->hw.lowest;
         data->maximum = data->hw.lowest;
         data->activity_window = 0;
-        data->energy_perf = HWP_ENERGY_PERF_MAX_POWERSAVE;
+        data->energy_perf = CPPC_ENERGY_PERF_MAX_POWERSAVE;
         data->desired = 0;
         break;
 
@@ -605,7 +601,7 @@ int set_hwp_para(struct cpufreq_policy *policy,
         data->minimum = data->hw.highest;
         data->maximum = data->hw.highest;
         data->activity_window = 0;
-        data->energy_perf = HWP_ENERGY_PERF_MAX_PERFORMANCE;
+        data->energy_perf = CPPC_ENERGY_PERF_MAX_PERFORMANCE;
         data->desired = 0;
         break;
 
@@ -613,7 +609,7 @@ int set_hwp_para(struct cpufreq_policy *policy,
         data->minimum = data->hw.lowest;
         data->maximum = data->hw.highest;
         data->activity_window = 0;
-        data->energy_perf = HWP_ENERGY_PERF_BALANCE;
+        data->energy_perf = CPPC_ENERGY_PERF_BALANCE;
         data->desired = 0;
         break;
 
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index 3f1b05a02e..a3c84143af 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -252,6 +252,16 @@ void cpufreq_dbs_timer_resume(void);
 
 void intel_feature_detect(struct cpufreq_policy *policy);
 
+/*
+ * If Energy Performance Preference(epp) is supported in the platform,
+ * OSPM may write a range of values from 0(performance preference)
+ * to 0xFF(energy efficiency perference) to control the platform's
+ * energy efficiency and performance optimization policies
+ */
+#define CPPC_ENERGY_PERF_MAX_PERFORMANCE 0
+#define CPPC_ENERGY_PERF_BALANCE         0x80
+#define CPPC_ENERGY_PERF_MAX_POWERSAVE   0xff
+
 int hwp_cmdline_parse(const char *s, const char *e);
 int hwp_register_driver(void);
 #ifdef CONFIG_INTEL
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 15:44:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 15:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902482.1310448 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpquh-0000eE-Bz; Wed, 05 Mar 2025 15:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902482.1310448; Wed, 05 Mar 2025 15:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpquh-0000e6-9O; Wed, 05 Mar 2025 15:44:03 +0000
Received: by outflank-mailman (input) for mailman id 902482;
 Wed, 05 Mar 2025 15:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpquf-0000e0-Pn
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 15:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpquf-003F5p-2z
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpquf-008ENS-1z
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zfoaX5mvQZWT8XZBYVGEgO0IwyJcKZWijSEcwGsKtVg=; b=AKYts1G0eVgzmjd6QXILXAIUNq
	YzLCf4S4CSRDhBp3EyNdEJFC3IerQH6Wk2ZsUQUnV7RDldG67/PZEyqtk+GrdxY3TlI4+qBxMwFb4
	h5DUQ+imB3o2Iptpyugeeizqra82kAsdJbKVilU2hDCbs3V1ew1SDXDQ8grMni4uMAc0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/xstate: Create map/unmap primitives for xsave areas
Message-Id: <E1tpquf-008ENS-1z@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 15:44:01 +0000

commit de742b2d7c20027ad686ec190117acf4b7ca5376
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:34:27 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:34:27 2025 +0100

    x86/xstate: Create map/unmap primitives for xsave areas
    
    Add infrastructure to simplify ASI handling. With ASI in the picture
    we'll have several different means of accessing the XSAVE area of a
    given vCPU, depending on whether a domain is covered by ASI or not and
    whether the vCPU is question is scheduled on the current pCPU or not.
    
    Having these complexities exposed at the call sites becomes unwieldy
    very fast. These wrappers are intended to be used in a similar way to
    map_domain_page() and unmap_domain_page(); The map operation will
    dispatch the appropriate pointer for each case in a future patch, while
    unmap will remain a no-op where no unmap is required (e.g: when there's
    no ASI) and remove the transient maping if one was required.
    
    Follow-up patches replace all uses of raw v->arch.xsave_area by this
    mechanism in preparation to add the beforementioned dispatch logic to be
    added at a later time.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/xstate.h | 42 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index 07017cc4ed..e3b9745543 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -143,4 +143,46 @@ static inline bool xstate_all(const struct vcpu *v)
            (v->arch.xcr0_accum & XSTATE_LAZY & ~XSTATE_FP_SSE);
 }
 
+/*
+ * Fetch a pointer to a vCPU's XSAVE area
+ *
+ * TL;DR: If v == current, the mapping is guaranteed to already exist.
+ *
+ * Despite the name, this macro might not actually map anything. The only case
+ * in which a mutation of page tables is strictly required is when ASI==on &&
+ * v!=current. For everything else the mapping already exists and needs not
+ * be created nor destroyed.
+ *
+ *                         +-----------------+--------------+
+ *                         |   v == current  | v != current |
+ *          +--------------+-----------------+--------------+
+ *          | ASI  enabled | per-vCPU fixmap |  actual map  |
+ *          +--------------+-----------------+--------------+
+ *          | ASI disabled |             directmap          |
+ *          +--------------+--------------------------------+
+ *
+ * There MUST NOT be outstanding maps of XSAVE areas of the non-current vCPU
+ * at the point of context switch. Otherwise, the unmap operation will
+ * misbehave.
+ *
+ * TODO: Expand the macro to the ASI cases after infra to do so is in place.
+ *
+ * @param v Owner of the XSAVE area
+ */
+#define VCPU_MAP_XSAVE_AREA(v) ((v)->arch.xsave_area)
+
+/*
+ * Drops the mapping of a vCPU's XSAVE area and nullifies its pointer on exit
+ *
+ * See VCPU_MAP_XSAVE_AREA() for additional information on the persistence of
+ * these mappings. This macro only tears down the mappings in the ASI=on &&
+ * v!=current case.
+ *
+ * TODO: Expand the macro to the ASI cases after infra to do so is in place.
+ *
+ * @param v Owner of the XSAVE area
+ * @param x XSAVE blob of v
+ */
+#define VCPU_UNMAP_XSAVE_AREA(v, x) do { (void)(v); (x) = NULL; } while (0)
+
 #endif /* __ASM_XSTATE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 15:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 15:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902483.1310451 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqur-0000gR-DW; Wed, 05 Mar 2025 15:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902483.1310451; Wed, 05 Mar 2025 15:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqur-0000gJ-An; Wed, 05 Mar 2025 15:44:13 +0000
Received: by outflank-mailman (input) for mailman id 902483;
 Wed, 05 Mar 2025 15:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpqup-0000g3-RT
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 15:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpquq-003F5w-0A
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqup-008EOI-2Q
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XbZQc8kRHQWfnMkJOyCtRxi1fSqMIbyhJwM1PdJmQYk=; b=Nf1h9L+EjkdCxOTdZosqc8HXFv
	T0qY+E++HpkMUDVXnZyKWuvq7/VIL4Bk3P3c9IyOUJS7mZjN8cDz6il7YoiogsvF4UNHYFmYcmTt3
	3+huqfYS0UFQAqf6lYqkUGk+JhHqCRlXAWFvGK7a3XqxzBWIDsjB+3WShxN81ccGX6Sg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Map/unmap xsave area in hvm_save_cpu_ctxt()
Message-Id: <E1tpqup-008EOI-2Q@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 15:44:11 +0000

commit 9004cc229a911dca9519ecf0a517ad37ce9ba8d0
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:35:04 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:35:04 2025 +0100

    x86/hvm: Map/unmap xsave area in hvm_save_cpu_ctxt()
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 4851e2e150..969e43c2f2 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -913,11 +913,11 @@ static int cf_check hvm_save_cpu_ctxt(struct vcpu *v, hvm_domain_context_t *h)
 
     if ( v->fpu_initialised )
     {
-        BUILD_BUG_ON(sizeof(ctxt.fpu_regs) !=
-                     sizeof(v->arch.xsave_area->fpu_sse));
-        memcpy(ctxt.fpu_regs, &v->arch.xsave_area->fpu_sse,
-               sizeof(ctxt.fpu_regs));
+        const struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(v);
 
+        BUILD_BUG_ON(sizeof(ctxt.fpu_regs) != sizeof(xsave_area->fpu_sse));
+        memcpy(ctxt.fpu_regs, &xsave_area->fpu_sse, sizeof(ctxt.fpu_regs));
+        VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
         ctxt.flags = XEN_X86_FPU_INITIALISED;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 15:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 15:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902484.1310456 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqv1-0000jF-Eo; Wed, 05 Mar 2025 15:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902484.1310456; Wed, 05 Mar 2025 15:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqv1-0000j6-CA; Wed, 05 Mar 2025 15:44:23 +0000
Received: by outflank-mailman (input) for mailman id 902484;
 Wed, 05 Mar 2025 15:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpquz-0000is-VB
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 15:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqv0-003F60-0V
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpquz-008ETP-2o
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UNY1jUm2jh3O/riCBd7u59+ChR2pBeAUn26t6VImkbU=; b=GBuZlFrYHwAWnDIo9vJh+WhQTV
	HBulckexgD69/JyBDIt+oNm4a6ToABJMox1n7fd+LCtuydG6AK5x4aeEd/vQ1R/4dW4EP2seEM+ZD
	lrm5RS7PA3HRbON0FCAk8wE07MmzGJ9LT0bv1fNb34gK0GDVG/Qi3c9SUSz6fMPg/i/w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/fpu: Map/umap xsave area in vcpu_{reset,setup}_fpu()
Message-Id: <E1tpquz-008ETP-2o@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 15:44:21 +0000

commit dd9f4e7b51793e09c0c1448bebec296324ed2909
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:35:37 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:35:37 2025 +0100

    x86/fpu: Map/umap xsave area in vcpu_{reset,setup}_fpu()
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/i387.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 8fba0aef42..5429531ddd 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -304,24 +304,32 @@ int vcpu_init_fpu(struct vcpu *v)
 
 void vcpu_reset_fpu(struct vcpu *v)
 {
+    struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(v);
+
     v->fpu_initialised = false;
-    *v->arch.xsave_area = (struct xsave_struct) {
+    *xsave_area = (struct xsave_struct) {
         .xsave_hdr.xstate_bv = X86_XCR0_X87,
     };
 
     /* Old gcc doesn't permit these to be part of the initializer. */
-    v->arch.xsave_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
-    v->arch.xsave_area->fpu_sse.fcw = FCW_RESET;
-    v->arch.xsave_area->fpu_sse.ftw = FXSAVE_FTW_RESET;
+    xsave_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
+    xsave_area->fpu_sse.fcw = FCW_RESET;
+    xsave_area->fpu_sse.ftw = FXSAVE_FTW_RESET;
+
+    VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
 }
 
 void vcpu_setup_fpu(struct vcpu *v, const void *data)
 {
+    struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(v);
+
     v->fpu_initialised = true;
-    *v->arch.xsave_area = (struct xsave_struct) {
+    *xsave_area = (struct xsave_struct) {
         .fpu_sse = *(const fpusse_t*)data,
         .xsave_hdr.xstate_bv = XSTATE_FP_SSE,
     };
+
+    VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
 }
 
 /* Free FPU's context save area */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 15:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 15:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902485.1310460 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqvB-0000lf-GF; Wed, 05 Mar 2025 15:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902485.1310460; Wed, 05 Mar 2025 15:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqvB-0000lX-DZ; Wed, 05 Mar 2025 15:44:33 +0000
Received: by outflank-mailman (input) for mailman id 902485;
 Wed, 05 Mar 2025 15:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpqvA-0000lL-1q
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 15:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqvA-003F68-0p
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqv9-008EUA-39
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:44:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f6w2dTNzdbBsde+2B9/iMp2kaAwNSB6qaQ5XtLq1Fho=; b=aXXqzHGCRkaxn12berC2BCY4rv
	RGx33YY6oFl68uHxMX8YJLBINWyDUf6XQiOfZTp+f/2Llr1IfpH0vfPMZJLDbVOq/So5azAhVbmHs
	J0VHbSXGvoqZTLviaFo47ysgiVodY08lil5oQdrhiMy7TW6Xso7jGoIoLiLraLC/RbaM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/xstate: Map/unmap xsave area in xstate_set_init() and handle_setbv()
Message-Id: <E1tpqv9-008EUA-39@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 15:44:31 +0000

commit e628968f4ffb4a28d5951c122e5a163cb12586d0
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:35:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:35:57 2025 +0100

    x86/xstate: Map/unmap xsave area in xstate_set_init() and handle_setbv()
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/xstate.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index af9e345a7a..12004d7db2 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -993,7 +993,13 @@ int handle_xsetbv(u32 index, u64 new_bv)
 
         clts();
         if ( curr->fpu_dirtied )
-            asm ( "stmxcsr %0" : "=m" (curr->arch.xsave_area->fpu_sse.mxcsr) );
+        {
+            /* Has a fastpath for `current`, so there's no actual map */
+            struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(curr);
+
+            asm ( "stmxcsr %0" : "=m" (xsave_area->fpu_sse.mxcsr) );
+            VCPU_UNMAP_XSAVE_AREA(curr, xsave_area);
+        }
         else if ( xstate_all(curr) )
         {
             /* See the comment in i387.c:vcpu_restore_fpu_eager(). */
@@ -1048,7 +1054,7 @@ void xstate_set_init(uint64_t mask)
     unsigned long cr0 = read_cr0();
     unsigned long xcr0 = this_cpu(xcr0);
     struct vcpu *v = idle_vcpu[smp_processor_id()];
-    struct xsave_struct *xstate = v->arch.xsave_area;
+    struct xsave_struct *xstate;
 
     if ( ~xfeature_mask & mask )
     {
@@ -1061,8 +1067,10 @@ void xstate_set_init(uint64_t mask)
 
     clts();
 
+    xstate = VCPU_MAP_XSAVE_AREA(v);
     memset(&xstate->xsave_hdr, 0, sizeof(xstate->xsave_hdr));
     xrstor(v, mask);
+    VCPU_UNMAP_XSAVE_AREA(v, xstate);
 
     if ( cr0 & X86_CR0_TS )
         write_cr0(cr0);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 15:44:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 15:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902486.1310463 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqvL-0000o4-Hi; Wed, 05 Mar 2025 15:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902486.1310463; Wed, 05 Mar 2025 15:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqvL-0000nx-Ey; Wed, 05 Mar 2025 15:44:43 +0000
Received: by outflank-mailman (input) for mailman id 902486;
 Wed, 05 Mar 2025 15:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpqvK-0000np-5U
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 15:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqvK-003F6X-1C
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqvK-008EVf-0F
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9cB8gsnyGX6l406DYbLqePS92xk5Go40ZPRCwYa19mw=; b=4ill6iJZfVkFaOZLBtwzaArxay
	TBJvKcwCqqFYU4FzUc5F96aD4rGW83Hrt6v2cOBcoUrH5qCPDoOxeXir+pC8fZs2M2BFE/dRBmwt+
	2ta+rO98vDHgMajn0Zp6C7OTG1TKMUNLAXLSwg91are6T6w7UCz4Okblv6GE5IXK9JJY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Map/unmap xsave area in hvmemul_{get,put}_fpu()
Message-Id: <E1tpqvK-008EVf-0F@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 15:44:42 +0000

commit c4a1b992e53dbdb86cae3e7aebba210106c6f02f
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:36:25 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:36:25 2025 +0100

    x86/hvm: Map/unmap xsave area in hvmemul_{get,put}_fpu()
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 5eb78ae275..1db14642b3 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2467,7 +2467,9 @@ static int cf_check hvmemul_get_fpu(
         alternative_vcall(hvm_funcs.fpu_dirty_intercept);
     else if ( type == X86EMUL_FPU_fpu )
     {
-        const fpusse_t *fpu_ctxt = &curr->arch.xsave_area->fpu_sse;
+        /* Has a fastpath for `current`, so there's no actual map */
+        const struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(curr);
+        const fpusse_t *fpu_ctxt = &xsave_area->fpu_sse;
 
         /*
          * Latch current register state so that we can back out changes
@@ -2493,6 +2495,8 @@ static int cf_check hvmemul_get_fpu(
             else
                 ASSERT(fcw == fpu_ctxt->fcw);
         }
+
+        VCPU_UNMAP_XSAVE_AREA(curr, xsave_area);
     }
 
     return X86EMUL_OKAY;
@@ -2507,7 +2511,9 @@ static void cf_check hvmemul_put_fpu(
 
     if ( aux )
     {
-        fpusse_t *fpu_ctxt = &curr->arch.xsave_area->fpu_sse;
+        /* Has a fastpath for `current`, so there's no actual map */
+        struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(curr);
+        fpusse_t *fpu_ctxt = &xsave_area->fpu_sse;
         bool dval = aux->dval;
         int mode = hvm_guest_x86_mode(curr);
 
@@ -2563,6 +2569,8 @@ static void cf_check hvmemul_put_fpu(
 
         fpu_ctxt->fop = aux->op;
 
+        VCPU_UNMAP_XSAVE_AREA(curr, xsave_area);
+
         /* Re-use backout code below. */
         backout = X86EMUL_FPU_fpu;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 15:44:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 15:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902487.1310468 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqvV-0000qV-Jo; Wed, 05 Mar 2025 15:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902487.1310468; Wed, 05 Mar 2025 15:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqvV-0000qN-Gm; Wed, 05 Mar 2025 15:44:53 +0000
Received: by outflank-mailman (input) for mailman id 902487;
 Wed, 05 Mar 2025 15:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpqvU-0000qA-8D
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 15:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqvU-003F6d-1T
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqvU-008EWQ-0c
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=E8MV1uPwrm+rtCgYgSkeNFSfwBIAb9pnAuUnP3q6HGs=; b=OKcN+zeezkgU2/G26AZBRH9eEJ
	eUtsI/vNtPpkoVqPVlmVk0ZSAsrZx6g7IcYy9qMTsYhSoHPo0jhXR8N4TPFsW+JW2VZee52j+VEb2
	kTFAquukoJszU2u1td/RwJT9retRqetodW+Xo+r0bgAyYehsU3mRcIojD9i6rqYcrAd0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/domctl: Map/unmap xsave area in arch_get_info_guest()
Message-Id: <E1tpqvU-008EWQ-0c@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 15:44:52 +0000

commit 29adbf4961c8fcb6b39857f8827eae7a4f7b84c0
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:37:02 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:37:02 2025 +0100

    x86/domctl: Map/unmap xsave area in arch_get_info_guest()
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domctl.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 5f01111619..3044f706de 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1377,16 +1377,17 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
     unsigned int i;
     const struct domain *d = v->domain;
     bool compat = is_pv_32bit_domain(d);
+    const struct xsave_struct *xsave_area;
 #ifdef CONFIG_COMPAT
 #define c(fld) (!compat ? (c.nat->fld) : (c.cmp->fld))
 #else
 #define c(fld) (c.nat->fld)
 #endif
 
-    BUILD_BUG_ON(sizeof(c.nat->fpu_ctxt) !=
-                 sizeof(v->arch.xsave_area->fpu_sse));
-    memcpy(&c.nat->fpu_ctxt, &v->arch.xsave_area->fpu_sse,
-           sizeof(c.nat->fpu_ctxt));
+    xsave_area = VCPU_MAP_XSAVE_AREA(v);
+    BUILD_BUG_ON(sizeof(c.nat->fpu_ctxt) != sizeof(xsave_area->fpu_sse));
+    memcpy(&c.nat->fpu_ctxt, &xsave_area->fpu_sse, sizeof(c.nat->fpu_ctxt));
+    VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
 
     if ( is_pv_domain(d) )
         c(flags = v->arch.pv.vgc_flags & ~(VGCF_i387_valid|VGCF_in_kernel));
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 15:45:02 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 15:45:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902488.1310472 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqve-0000tR-Ms; Wed, 05 Mar 2025 15:45:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902488.1310472; Wed, 05 Mar 2025 15:45:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqve-0000tK-KF; Wed, 05 Mar 2025 15:45:02 +0000
Received: by outflank-mailman (input) for mailman id 902488;
 Wed, 05 Mar 2025 15:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpqve-0000tC-Ao
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 15:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqve-003F75-1j
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqve-008EXL-0t
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rX0uIF2MRJ9wXvxtY27ke+y246MetOmI8o5XvGLfL5o=; b=1OfvRnUtTHuMGRdEmqwXzBV4wn
	aUlZ+lLkoHB3OluUVWLEW21hErOfvmnSRYEZQCkA4zuyTBaNYWtgTip6gYJZo/VWrP5Xfift113RE
	XIvw41GfomPCzqXj1ZGigZUd9vUJDubNw89vSJ/MyfOP2ctIrQhKcerV2EVAsDBSgWeA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/xstate: Map/unmap xsave area in {compress,expand}_xsave_states()
Message-Id: <E1tpqve-008EXL-0t@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 15:45:02 +0000

commit c2e3d122de58476961dec25869f51026aed34168
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:37:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:37:14 2025 +0100

    x86/xstate: Map/unmap xsave area in {compress,expand}_xsave_states()
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/xstate.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 12004d7db2..3d249518a1 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -177,7 +177,7 @@ static void setup_xstate_comp(uint16_t *comp_offsets,
  */
 void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size)
 {
-    const struct xsave_struct *xstate = v->arch.xsave_area;
+    const struct xsave_struct *xstate = VCPU_MAP_XSAVE_AREA(v);
     const void *src;
     uint16_t comp_offsets[sizeof(xfeature_mask)*8];
     u64 xstate_bv = xstate->xsave_hdr.xstate_bv;
@@ -191,7 +191,7 @@ void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size)
     if ( !(xstate->xsave_hdr.xcomp_bv & XSTATE_COMPACTION_ENABLED) )
     {
         memcpy(dest, xstate, size);
-        return;
+        goto out;
     }
 
     ASSERT(xsave_area_compressed(xstate));
@@ -228,6 +228,9 @@ void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size)
 
         valid &= ~feature;
     }
+
+ out:
+    VCPU_UNMAP_XSAVE_AREA(v, xstate);
 }
 
 /*
@@ -242,7 +245,7 @@ void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size)
  */
 void compress_xsave_states(struct vcpu *v, const void *src, unsigned int size)
 {
-    struct xsave_struct *xstate = v->arch.xsave_area;
+    struct xsave_struct *xstate = VCPU_MAP_XSAVE_AREA(v);
     void *dest;
     uint16_t comp_offsets[sizeof(xfeature_mask)*8];
     u64 xstate_bv, valid;
@@ -256,7 +259,7 @@ void compress_xsave_states(struct vcpu *v, const void *src, unsigned int size)
     if ( !(v->arch.xcr0_accum & XSTATE_XSAVES_ONLY) )
     {
         memcpy(xstate, src, size);
-        return;
+        goto out;
     }
 
     /*
@@ -294,6 +297,9 @@ void compress_xsave_states(struct vcpu *v, const void *src, unsigned int size)
 
         valid &= ~feature;
     }
+
+ out:
+    VCPU_UNMAP_XSAVE_AREA(v, xstate);
 }
 
 void xsave(struct vcpu *v, uint64_t mask)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 15:45:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 15:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902489.1310476 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqvp-0000vt-Oa; Wed, 05 Mar 2025 15:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902489.1310476; Wed, 05 Mar 2025 15:45:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpqvp-0000vm-Lr; Wed, 05 Mar 2025 15:45:13 +0000
Received: by outflank-mailman (input) for mailman id 902489;
 Wed, 05 Mar 2025 15:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpqvo-0000vc-EV
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 15:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqvo-003F79-27
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpqvo-008EYW-19
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 15:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cfYNvOkpsGYLiKZxy7ZcP8ET2H268Wns4+t8Vehlm/c=; b=WTk7PHYhjgvhZontKpvxw4jDpT
	bRt6KzTTifCa0/j3U32phPqF6SvaTEC3NX/2x99E9E145xBsRDwP9qnuw6PxGvvZ9bXODv4wWwTPQ
	n3JFkWP+KRiDdxynnd9+ZAFRZW+YOCvKrTZ7jq+Poa6zErdvmY0SjWUt9lCcb8rDZfNI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xl: fix channel configuration setting
Message-Id: <E1tpqvo-008EYW-19@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 15:45:12 +0000

commit e1ccced4afe465d6541c5825a0f8d1b8f5fa4253
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Mar 5 16:37:37 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:37:37 2025 +0100

    tools/xl: fix channel configuration setting
    
    Channels work differently than other device types: their devid should
    be -1 initially in order to distinguish them from the primary console
    which has the devid of 0.
    
    So when parsing the channel configuration, use
    ARRAY_EXTEND_INIT_NODEVID() in order to avoid overwriting the devid
    set by libxl_device_channel_init().
    
    Fixes: 3a6679634766 ("libxl: set channel devid when not provided by application")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xl/xl_parse.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 3d85be7dd4..089a88935a 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2423,8 +2423,9 @@ void parse_config_data(const char *config_source,
             char *path = NULL;
             int len;
 
-            chn = ARRAY_EXTEND_INIT(d_config->channels, d_config->num_channels,
-                                   libxl_device_channel_init);
+            chn = ARRAY_EXTEND_INIT_NODEVID(d_config->channels,
+                                            d_config->num_channels,
+                                            libxl_device_channel_init);
 
             split_string_into_string_list(buf, ",", &pairs);
             len = libxl_string_list_length(&pairs);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 16:11:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 16:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902490.1310480 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tprKp-000740-Cx; Wed, 05 Mar 2025 16:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902490.1310480; Wed, 05 Mar 2025 16:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tprKp-00073s-AM; Wed, 05 Mar 2025 16:11:03 +0000
Received: by outflank-mailman (input) for mailman id 902490;
 Wed, 05 Mar 2025 16:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tprKo-00073g-Eb
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 16:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tprKo-003GAR-1g
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 16:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tprKo-008H1b-0k
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 16:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=asUCjtxrLHnebbEwNb8oPFQEBuityOg6Ag44aABBs64=; b=0bJMukKXsvwaNRP+6wstZJm7+W
	npiJe7bYeb3xA8A7h8LOk0vc6+T3E3vrj2LldtHaEbwZrJohTixGgn0gJPvEQOVYq9VedB7oDsy9i
	E4DVI2EzfM13mc6PlEe0N42l8QBol1qSBETbMS6R1pTshqqnbmdnberPVETaiinEZNH0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "xen/riscv: drop CONFIG_RISCV_ISA_RV64G"
Message-Id: <E1tprKo-008H1b-0k@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 16:11:02 +0000

commit c658d4f75887fc64cd3b8e4b3d0cbae07fa300e6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 5 17:06:23 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 17:06:23 2025 +0100

    Revert "xen/riscv: drop CONFIG_RISCV_ISA_RV64G"
    
    This reverts commit 86b1b8ec3d9d0508a95540e368432291b883837f. It
    fails in CI without an adjustment there.
---
 xen/arch/riscv/Kconfig | 18 ++++++++++++++++++
 xen/arch/riscv/arch.mk |  8 +++-----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index d882e0a059..fa95cd0a42 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -23,6 +23,24 @@ endmenu
 
 menu "ISA Selection"
 
+choice
+	prompt "Base ISA"
+	default RISCV_ISA_RV64G if RISCV_64
+	help
+	  This selects the base ISA extensions that Xen will target.
+
+config RISCV_ISA_RV64G
+	bool "RV64G"
+	help
+	  Use the RV64I base ISA, plus
+	  "M" for multiply/divide,
+	  "A" for atomic instructions,
+	  “F”/"D" for  {single/double}-precision floating-point instructions,
+	  "Zicsr" for control and status register access,
+	  "Zifencei" for instruction-fetch fence.
+
+endchoice
+
 config RISCV_ISA_C
 	bool "Compressed extension"
 	default y
diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 3034da76cb..17827c302c 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -6,12 +6,10 @@ $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 riscv-abi-$(CONFIG_RISCV_32) := -mabi=ilp32
 riscv-abi-$(CONFIG_RISCV_64) := -mabi=lp64
 
-riscv-march-$(CONFIG_RISCV_64) := rv64
-riscv-march-y += ima
-riscv-march-$(CONFIG_RISCV_ISA_C) += c
-riscv-march-y += _zicsr_zifencei
+riscv-march-$(CONFIG_RISCV_ISA_RV64G) := rv64g
+riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
 
-riscv-generic-flags := $(riscv-abi-y) -march=$(subst $(space),,$(riscv-march-y))
+riscv-generic-flags := $(riscv-abi-y) -march=$(riscv-march-y)
 
 # check-extension: Check whether extenstion is supported by a compiler and
 #                  an assembler.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902599.1310589 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsxS-00057h-UZ; Wed, 05 Mar 2025 17:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902599.1310589; Wed, 05 Mar 2025 17:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsxS-00057a-SB; Wed, 05 Mar 2025 17:55:02 +0000
Received: by outflank-mailman (input) for mailman id 902599;
 Wed, 05 Mar 2025 17:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpsxS-00057U-5e
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsxS-003IEo-0w
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsxR-008Xw3-39
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ET1yZiojuMGB1xdxLKaOIbQR9TsyiV/O/MkmRk9DiwY=; b=yxWVEpSwFN0tLqJyuMOHQ3Y/jl
	BK/x+5D/+ga81KN6Kb3ES33Rlz3rzspED1kFiE8y0OvHT3APojwPF3lpnO4eou2dVX8DWifuOWkoG
	3xuDerw/F1oBQjExSZn4A9q9iGZfbNQBMfzGk8JIAeFKBHrgxTx45ZW71nwyij/FNnoA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: slightly improve CMPXCHG16B emulation
Message-Id: <E1tpsxR-008Xw3-39@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:55:01 +0000

commit 2488ede7a994c8254b8d9304082d70924bbca141
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 5 15:41:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:41:14 2025 +0100

    x86/HVM: slightly improve CMPXCHG16B emulation
    
    Using hvmemul_linear_mmio_write() directly (as fallback when mapping the
    memory operand isn't possible) won't work properly when the access
    crosses a RAM/MMIO boundary. Use linear_write() instead, which splits at
    such boundaries as necessary.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/emulate.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 3cd7f2e22f..de38142413 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1718,10 +1718,8 @@ static int cf_check hvmemul_cmpxchg(
 {
     struct hvm_emulate_ctxt *hvmemul_ctxt =
         container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
-    struct vcpu *curr = current;
     unsigned long addr;
     uint32_t pfec = PFEC_page_present | PFEC_write_access;
-    struct hvm_vcpu_io *hvio = &curr->arch.hvm.hvm_io;
     int rc;
     void *mapping = NULL;
 
@@ -1745,10 +1743,7 @@ static int cf_check hvmemul_cmpxchg(
     if ( !mapping )
     {
         /* Fix this in case the guest is really relying on r-m-w atomicity. */
-        return hvmemul_linear_mmio_write(addr, bytes, p_new, pfec,
-                                         hvmemul_ctxt, addr,
-                                         hvio->mmio_access.write_access &&
-                                         hvio->mmio_gla == (addr & PAGE_MASK));
+        return linear_write(addr, bytes, p_new, pfec, hvmemul_ctxt);
     }
 
     switch ( bytes )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902600.1310593 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsxc-00059U-W3; Wed, 05 Mar 2025 17:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902600.1310593; Wed, 05 Mar 2025 17:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsxc-00059N-Tb; Wed, 05 Mar 2025 17:55:12 +0000
Received: by outflank-mailman (input) for mailman id 902600;
 Wed, 05 Mar 2025 17:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpsxc-00059A-6f
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsxc-003IEw-1K
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsxc-008Xx9-0N
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3eabkZbGHwsoUkuuYags9o45AAtUBj+iL0bjR9flHjc=; b=E8jqqLZ4SqOXk90I5RDrjKNFSB
	BQujfnJMSuG2T9Dcj8YR31pAxs7IPvmyD+WongubyRkSKACaGnJq1bSKTvDwTnWIZQR/ls+jGLRVu
	63n+eqWkEIvQR9hsg3vw5CJ3kXahv7yHlqBFaZ2QK5v1geNKBe5Ru5i91H7ziDVJsp7c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: drop redundant access splitting
Message-Id: <E1tpsxc-008Xx9-0N@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:55:12 +0000

commit 86e14fe17f2d6ba290799f6d0cb5f8e3e65f82ea
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 5 15:42:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:42:12 2025 +0100

    x86/HVM: drop redundant access splitting
    
    With all paths into hvmemul_linear_mmio_access() coming through
    linear_{read,write}(), there's no need anymore to split accesses at
    page boundaries there. Leave an assertion, though.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/emulate.c | 33 +++++++++------------------------
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index de38142413..5eb78ae275 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1157,7 +1157,7 @@ static int hvmemul_linear_mmio_access(
 {
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned long offset = gla & ~PAGE_MASK;
-    unsigned int chunk, buffer_offset = gla - start_gla;
+    unsigned int buffer_offset = gla - start_gla;
     struct hvm_mmio_cache *cache = hvmemul_find_mmio_cache(hvio, start_gla,
                                                            dir, buffer_offset);
     paddr_t gpa;
@@ -1167,13 +1167,17 @@ static int hvmemul_linear_mmio_access(
     if ( cache == NULL )
         return X86EMUL_UNHANDLEABLE;
 
-    chunk = min_t(unsigned int, size, PAGE_SIZE - offset);
+    if ( size + offset > PAGE_SIZE )
+    {
+        ASSERT_UNREACHABLE();
+        return X86EMUL_UNHANDLEABLE;
+    }
 
     if ( known_gpfn )
         gpa = pfn_to_paddr(hvio->mmio_gpfn) | offset;
     else
     {
-        rc = hvmemul_linear_to_phys(gla, &gpa, chunk, &one_rep, pfec,
+        rc = hvmemul_linear_to_phys(gla, &gpa, size, &one_rep, pfec,
                                     hvmemul_ctxt);
         if ( rc != X86EMUL_OKAY )
             return rc;
@@ -1181,27 +1185,8 @@ static int hvmemul_linear_mmio_access(
         latch_linear_to_phys(hvio, gla, gpa, dir == IOREQ_WRITE);
     }
 
-    for ( ;; )
-    {
-        rc = hvmemul_phys_mmio_access(cache, gpa, chunk, dir, buffer, buffer_offset);
-        if ( rc != X86EMUL_OKAY )
-            break;
-
-        gla += chunk;
-        buffer_offset += chunk;
-        size -= chunk;
-
-        if ( size == 0 )
-            break;
-
-        chunk = min_t(unsigned int, size, PAGE_SIZE);
-        rc = hvmemul_linear_to_phys(gla, &gpa, chunk, &one_rep, pfec,
-                                    hvmemul_ctxt);
-        if ( rc != X86EMUL_OKAY )
-            return rc;
-    }
-
-    return rc;
+    return hvmemul_phys_mmio_access(cache, gpa, size, dir, buffer,
+                                    buffer_offset);
 }
 
 static inline int hvmemul_linear_mmio_read(
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902601.1310598 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsxn-0005CO-1i; Wed, 05 Mar 2025 17:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902601.1310598; Wed, 05 Mar 2025 17:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsxm-0005CG-V6; Wed, 05 Mar 2025 17:55:22 +0000
Received: by outflank-mailman (input) for mailman id 902601;
 Wed, 05 Mar 2025 17:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpsxm-0005C5-AG
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsxm-003IF0-1e
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsxm-008Xxo-0l
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n3muvbjXSBwl/HuniF2ZabBk/XW4M6Tm+BbKCIA6Gdk=; b=EPzTTkn7vtoUeHVLmnhy8T9YpA
	n3BXyrw3jKo5I/rf/zOiEtzSFwof5prJs9qVetTwV1y4jnnwrv3USFaJ3ifZf+JlyQmPxpis45bre
	Ret0hzlC0k9S5OZmkvG6ucVzoy8jsQE7r3rPO41h3+oXG7b+W92mgFK0CsriLsedl8yE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/console: introduce console_{get,put}_domain()
Message-Id: <E1tpsxm-008Xxo-0l@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:55:22 +0000

commit 91db39013a84c7f18066e284f62330a1fd93da09
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Wed Mar 5 15:42:49 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:42:49 2025 +0100

    xen/console: introduce console_{get,put}_domain()
    
    console_input_domain() takes an RCU lock to protect domain structure.
    That implies call to rcu_unlock_domain() after use.
    
    Introduce a pair of console_get_domain() / console_put_domain() to highlight
    the correct use of the call within the code interacting with Xen console
    driver.
    
    The new calls used in __serial_rx(), which also fixed console forwarding to
    late hardware domains which run with domain IDs different from 0.
    
    While moving the guest_printk() invocation also drop the redundant _G infix.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/vpl011.c      |  6 +++---
 xen/drivers/char/console.c | 54 ++++++++++++++++++++++++----------------------
 xen/include/xen/console.h  |  3 ++-
 3 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index c72f3778bf..66047bf33c 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -78,7 +78,7 @@ static void vpl011_write_data_xen(struct domain *d, uint8_t data)
     unsigned long flags;
     struct vpl011 *vpl011 = &d->arch.vpl011;
     struct vpl011_xen_backend *intf = vpl011->backend.xen;
-    struct domain *input = console_input_domain();
+    struct domain *input = console_get_domain();
 
     VPL011_LOCK(d, flags);
 
@@ -123,8 +123,8 @@ static void vpl011_write_data_xen(struct domain *d, uint8_t data)
     vpl011_update_interrupt_status(d);
 
     VPL011_UNLOCK(d, flags);
-    if ( input != NULL )
-        rcu_unlock_domain(input);
+
+    console_put_domain(input);
 }
 
 /*
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index b3bc4bc963..2f028c5d44 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -474,15 +474,18 @@ static unsigned int __read_mostly console_rx = 0;
 
 #define max_console_rx (max_init_domid + 1)
 
-#ifdef CONFIG_SBSA_VUART_CONSOLE
-/* Make sure to rcu_unlock_domain after use */
-struct domain *console_input_domain(void)
+struct domain *console_get_domain(void)
 {
     if ( console_rx == 0 )
             return NULL;
     return rcu_lock_domain_by_id(console_rx - 1);
 }
-#endif
+
+void console_put_domain(struct domain *d)
+{
+    if ( d )
+        rcu_unlock_domain(d);
+}
 
 static void switch_serial_input(void)
 {
@@ -528,12 +531,18 @@ static void switch_serial_input(void)
 
 static void __serial_rx(char c)
 {
-    switch ( console_rx )
-    {
-    case 0:
+    struct domain *d;
+    int rc = 0;
+
+    if ( console_rx == 0 )
         return handle_keypress(c, false);
 
-    case 1:
+    d = console_get_domain();
+    if ( !d )
+        return;
+
+    if ( is_hardware_domain(d) )
+    {
         /*
          * Deliver input to the hardware domain buffer, unless it is
          * already full.
@@ -546,31 +555,24 @@ static void __serial_rx(char c)
          * getting stuck.
          */
         send_global_virq(VIRQ_CONSOLE);
-        break;
-
-#ifdef CONFIG_SBSA_VUART_CONSOLE
-    default:
-    {
-        struct domain *d = rcu_lock_domain_by_id(console_rx - 1);
-
-        if ( d )
-        {
-            int rc = vpl011_rx_char_xen(d, c);
-            if ( rc )
-                guest_printk(d, XENLOG_G_WARNING
-                                "failed to process console input: %d\n", rc);
-            rcu_unlock_domain(d);
-        }
-
-        break;
     }
+#ifdef CONFIG_SBSA_VUART_CONSOLE
+    else
+        /* Deliver input to the emulated UART. */
+        rc = vpl011_rx_char_xen(d, c);
 #endif
-    }
+
+    if ( rc )
+        guest_printk(d,
+                     XENLOG_WARNING "failed to process console input: %d\n",
+                     rc);
 
 #ifdef CONFIG_X86
     if ( pv_shim && pv_console )
         consoled_guest_tx(c);
 #endif
+
+    console_put_domain(d);
 }
 
 static void cf_check serial_rx(char c)
diff --git a/xen/include/xen/console.h b/xen/include/xen/console.h
index c4650231be..83cbc9fbda 100644
--- a/xen/include/xen/console.h
+++ b/xen/include/xen/console.h
@@ -32,7 +32,8 @@ void console_end_sync(void);
 void console_start_log_everything(void);
 void console_end_log_everything(void);
 
-struct domain *console_input_domain(void);
+struct domain *console_get_domain(void);
+void console_put_domain(struct domain *d);
 
 /*
  * Steal output from the console. Returns +ve identifier, else -ve error.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902602.1310602 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsxx-0005Ed-2x; Wed, 05 Mar 2025 17:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902602.1310602; Wed, 05 Mar 2025 17:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsxx-0005EV-0O; Wed, 05 Mar 2025 17:55:33 +0000
Received: by outflank-mailman (input) for mailman id 902602;
 Wed, 05 Mar 2025 17:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpsxw-0005EK-Dl
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsxw-003IF4-21
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsxw-008XyB-14
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IEPCnPjZDHnGHD9ww7R3GjsOyqoOZTO/tC6P5iJVI7A=; b=1dUg3jIIfgs1v1bK/iKkMVVBRp
	un0JHjEvBZj+VVZO0YX64gyuqN6tTZsswzX1oARPU2QgNP4zydq5uBBV6/+jqpkos+JNRxpEBwVhE
	hulfqYHGMo6+GYvNwsbZCZHXqAnWU1cdZW7jXzc5sZclixImakhYNSI8FuUs4aL6POYc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/list: fix comments in include/xen/list.h
Message-Id: <E1tpsxw-008XyB-14@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:55:32 +0000

commit 9f78105500f8c0e0907f10a94ac25734e5fd4c11
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Mar 5 15:43:32 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:43:32 2025 +0100

    xen/list: fix comments in include/xen/list.h
    
    There are several places in list.h where "list_struct" is used instead
    of "struct list_head". Fix that.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/list.h | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/xen/include/xen/list.h b/xen/include/xen/list.h
index 62169f4674..98d8482dab 100644
--- a/xen/include/xen/list.h
+++ b/xen/include/xen/list.h
@@ -384,7 +384,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_entry - get the struct for this entry
  * @ptr:    the &struct list_head pointer.
  * @type:    the type of the struct this is embedded in.
- * @member:    the name of the list_struct within the struct.
+ * @member:    the name of the struct list_head within the struct.
  */
 #define list_entry(ptr, type, member) \
     container_of(ptr, type, member)
@@ -393,7 +393,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_first_entry - get the first element from a list
  * @ptr:        the list head to take the element from.
  * @type:       the type of the struct this is embedded in.
- * @member:     the name of the list_struct within the struct.
+ * @member:     the name of the struct list_head within the struct.
  *
  * Note, that list is expected to be not empty.
  */
@@ -404,7 +404,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_last_entry - get the last element from a list
  * @ptr:        the list head to take the element from.
  * @type:       the type of the struct this is embedded in.
- * @member:     the name of the list_struct within the struct.
+ * @member:     the name of the struct list_head within the struct.
  *
  * Note, that list is expected to be not empty.
  */
@@ -415,7 +415,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_first_entry_or_null - get the first element from a list
  * @ptr:        the list head to take the element from.
  * @type:       the type of the struct this is embedded in.
- * @member:     the name of the list_struct within the struct.
+ * @member:     the name of the struct list_head within the struct.
  *
  * Note that if the list is empty, it returns NULL.
  */
@@ -426,7 +426,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_last_entry_or_null - get the last element from a list
  * @ptr:        the list head to take the element from.
  * @type:       the type of the struct this is embedded in.
- * @member:     the name of the list_struct within the struct.
+ * @member:     the name of the struct list_head within the struct.
  *
  * Note that if the list is empty, it returns NULL.
  */
@@ -436,7 +436,7 @@ static inline void list_splice_init(struct list_head *list,
 /**
   * list_next_entry - get the next element in list
   * @pos:        the type * to cursor
-  * @member:     the name of the list_struct within the struct.
+  * @member:     the name of the struct list_head within the struct.
   */
 #define list_next_entry(pos, member) \
         list_entry((pos)->member.next, typeof(*(pos)), member)
@@ -444,7 +444,7 @@ static inline void list_splice_init(struct list_head *list,
 /**
   * list_prev_entry - get the prev element in list
   * @pos:        the type * to cursor
-  * @member:     the name of the list_struct within the struct.
+  * @member:     the name of the struct list_head within the struct.
   */
 #define list_prev_entry(pos, member) \
         list_entry((pos)->member.prev, typeof(*(pos)), member)
@@ -490,7 +490,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_for_each_entry - iterate over list of given type
  * @pos:    the type * to use as a loop cursor.
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  */
 #define list_for_each_entry(pos, head, member)                          \
     for ((pos) = list_entry((head)->next, typeof(*(pos)), member);      \
@@ -501,7 +501,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_for_each_entry_reverse - iterate backwards over list of given type.
  * @pos:    the type * to use as a loop cursor.
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  */
 #define list_for_each_entry_reverse(pos, head, member)                  \
     for ((pos) = list_entry((head)->prev, typeof(*(pos)), member);      \
@@ -513,7 +513,7 @@ static inline void list_splice_init(struct list_head *list,
  *                      list_for_each_entry_continue
  * @pos:    the type * to use as a start point
  * @head:   the head of the list
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * Prepares a pos entry for use as a start point in
  * list_for_each_entry_continue.
@@ -525,7 +525,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_for_each_entry_continue - continue iteration over list of given type
  * @pos:    the type * to use as a loop cursor.
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * Continue to iterate over list of given type, continuing after
  * the current position.
@@ -540,7 +540,7 @@ static inline void list_splice_init(struct list_head *list,
  *                            current point
  * @pos:    the type * to use as a loop cursor.
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * Iterate over list of given type, continuing from current position.
  */
@@ -554,7 +554,7 @@ static inline void list_splice_init(struct list_head *list,
  * @pos:    the type * to use as a loop cursor.
  * @n:      another type * to use as temporary storage
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  */
 #define list_for_each_entry_safe(pos, n, head, member)                  \
     for ((pos) = list_entry((head)->next, typeof(*(pos)), member),      \
@@ -567,7 +567,7 @@ static inline void list_splice_init(struct list_head *list,
  * @pos:    the type * to use as a loop cursor.
  * @n:      another type * to use as temporary storage
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * Iterate over list of given type, continuing after current point,
  * safe against removal of list entry.
@@ -583,7 +583,7 @@ static inline void list_splice_init(struct list_head *list,
  * @pos:    the type * to use as a loop cursor.
  * @n:      another type * to use as temporary storage
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * Iterate over list of given type from current point, safe against
  * removal of list entry.
@@ -598,7 +598,7 @@ static inline void list_splice_init(struct list_head *list,
  * @pos:    the type * to use as a loop cursor.
  * @n:      another type * to use as temporary storage
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * Iterate backwards over list of given type, safe against removal
  * of list entry.
@@ -649,7 +649,7 @@ static inline void list_splice_init(struct list_head *list,
  * list_for_each_entry_rcu - iterate over rcu list of given type
  * @pos:    the type * to use as a loop cursor.
  * @head:   the head for your list.
- * @member: the name of the list_struct within the struct.
+ * @member: the name of the struct list_head within the struct.
  *
  * This list-traversal primitive may safely run concurrently with
  * the _rcu list-mutation primitives such as list_add_rcu()
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:55:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902603.1310605 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsy7-0005Ho-5l; Wed, 05 Mar 2025 17:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902603.1310605; Wed, 05 Mar 2025 17:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsy7-0005Hg-3C; Wed, 05 Mar 2025 17:55:43 +0000
Received: by outflank-mailman (input) for mailman id 902603;
 Wed, 05 Mar 2025 17:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpsy6-0005HU-Gi
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsy6-003IFQ-2K
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsy6-008Xz0-1R
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LFqwxe+rca4+mQv3pA1O2waC9RlSTX6aOVFzg1wynp0=; b=u4ooHtyps3qeXsuAS2ORXCC/br
	PbQR8+l7uAj+2fL6AVOxARF5Ji39Gg5IYQNQQzGz1IbczEvCMUxoynoe+Kz0O6ghzzv/fc7MgnJVE
	gVb+rA6JitObp3KJsqlFz6EN53NNdQfKT55i5tKF+RVVOnZKPU+AylpFYUc2tYHph+00=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/README: add compiler and binutils versions for RISCV-64
Message-Id: <E1tpsy6-008Xz0-1R@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:55:42 +0000

commit 85caf5a0223150b541611bf32aa7f6112dd56359
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Mar 5 15:43:55 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:43:55 2025 +0100

    xen/README: add compiler and binutils versions for RISCV-64
    
    Considering that the Zbb extension is supported since GCC version 12 [1]
    and that older GCC versions do not support Z extensions in -march (I haven't
    faced this issue for GCC >=11.2), leading to compilation failures,
    the baseline version for GCC is set to 12.2 and for GNU binutils to 2.39.
    
    The GCC version is set to 12.2 instead of 12.1 because Xen's GitLab CI uses
    Debian 12, which includes GCC 12.2 and GNU binutils 2.39.
    
    [1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=149e217033f01410a9783c5cb2d020cf8334ae4c
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 README | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/README b/README
index 72f6b0fcde..9d9c6fc324 100644
--- a/README
+++ b/README
@@ -48,6 +48,9 @@ provided by your OS distributor:
       - For ARM 64-bit:
         - GCC 5.1 or later
         - GNU Binutils 2.24 or later
+      - For RISC-V 64-bit:
+        - GCC 12.2 or later
+        - GNU Binutils 2.39 or later
     * POSIX compatible awk
     * Development install of zlib (e.g., zlib-dev)
     * Development install of Python 2.7 or later (e.g., python-dev)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:55:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902604.1310610 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsyI-0005KJ-7F; Wed, 05 Mar 2025 17:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902604.1310610; Wed, 05 Mar 2025 17:55:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsyI-0005KB-4e; Wed, 05 Mar 2025 17:55:54 +0000
Received: by outflank-mailman (input) for mailman id 902604;
 Wed, 05 Mar 2025 17:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpsyG-0005Jv-KW
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsyG-003IFU-2i
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsyG-008XzR-1k
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kcERbAx5DSbgclOqtHKAYEDvlWO5kJyULLNniASfSGE=; b=6KNml/xEEA4UG/vVGv4vomMmkV
	7a5UiY4CdF/vzbfggXDOEupLcivdqrBW2ToNZKdO8aNU3/ZYqJ9hyzFG/o4iyAsqZ8xrdaSK59rTG
	+72pqtnr3HBbNa/Zk7B6O1TrEwqDlyyKyFqzC6w1YOc8TjeFiAfeD5BJOVHnd6TjaJEo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: drop CONFIG_RISCV_ISA_RV64G
Message-Id: <E1tpsyG-008XzR-1k@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:55:52 +0000

commit 86b1b8ec3d9d0508a95540e368432291b883837f
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Mar 5 15:44:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:44:12 2025 +0100

    xen/riscv: drop CONFIG_RISCV_ISA_RV64G
    
    'G' stands for "imafd_zicsr_zifencei".
    
    Extensions 'f' and 'd' aren't really needed for Xen, and allowing floating
    point registers to be used can lead to crashes.
    
    Extensions 'i', 'm', 'a', 'zicsr', and 'zifencei' are necessary for the
    operation of Xen, which is why they are used explicitly (unconditionally)
    in -march.
    
    Drop "Base ISA" choice from riscv/Kconfig as it is always empty.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Kconfig | 18 ------------------
 xen/arch/riscv/arch.mk |  8 +++++---
 2 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index fa95cd0a42..d882e0a059 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -23,24 +23,6 @@ endmenu
 
 menu "ISA Selection"
 
-choice
-	prompt "Base ISA"
-	default RISCV_ISA_RV64G if RISCV_64
-	help
-	  This selects the base ISA extensions that Xen will target.
-
-config RISCV_ISA_RV64G
-	bool "RV64G"
-	help
-	  Use the RV64I base ISA, plus
-	  "M" for multiply/divide,
-	  "A" for atomic instructions,
-	  “F”/"D" for  {single/double}-precision floating-point instructions,
-	  "Zicsr" for control and status register access,
-	  "Zifencei" for instruction-fetch fence.
-
-endchoice
-
 config RISCV_ISA_C
 	bool "Compressed extension"
 	default y
diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 17827c302c..3034da76cb 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -6,10 +6,12 @@ $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 riscv-abi-$(CONFIG_RISCV_32) := -mabi=ilp32
 riscv-abi-$(CONFIG_RISCV_64) := -mabi=lp64
 
-riscv-march-$(CONFIG_RISCV_ISA_RV64G) := rv64g
-riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
+riscv-march-$(CONFIG_RISCV_64) := rv64
+riscv-march-y += ima
+riscv-march-$(CONFIG_RISCV_ISA_C) += c
+riscv-march-y += _zicsr_zifencei
 
-riscv-generic-flags := $(riscv-abi-y) -march=$(riscv-march-y)
+riscv-generic-flags := $(riscv-abi-y) -march=$(subst $(space),,$(riscv-march-y))
 
 # check-extension: Check whether extenstion is supported by a compiler and
 #                  an assembler.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:56:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902605.1310614 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsyS-0005Mu-8t; Wed, 05 Mar 2025 17:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902605.1310614; Wed, 05 Mar 2025 17:56:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsyS-0005Mm-65; Wed, 05 Mar 2025 17:56:04 +0000
Received: by outflank-mailman (input) for mailman id 902605;
 Wed, 05 Mar 2025 17:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpsyQ-0005Me-Nv
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsyQ-003IFv-33
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsyQ-008Y0Z-29
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8AClw7JATgy6fOA2ML+TJoCMAEkqAKuaJ1sOmni+94I=; b=wtPKTY14QofJnMbQyrsJfby3qB
	NQGIzznOPSH/w/HN3H3xYUkofR141886AfqMvsLtLYdm37QpPk9RvFDFQveX9FhRQAVCXuF0SAwse
	sWdkJ/XCnx9qMwiOtceNZuFALj+hoBP0YBF/dxy2DLqhdT5fki2fb9ZRYrP+9kavdbak=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cpufreq: abstract Energy Performance Preference value
Message-Id: <E1tpsyQ-008Y0Z-29@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:56:02 +0000

commit f84366bd42e3bee5ca2ec6ef0e3ca8326db5f78c
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Wed Mar 5 15:45:10 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 15:45:10 2025 +0100

    xen/cpufreq: abstract Energy Performance Preference value
    
    Intel's hwp Energy Performance Preference value is compatible with
    CPPC's Energy Performance Preference value, so this commit abstracts
    the value and re-place it in common header file cpufreq.h, to be
    used not only for hwp in the future.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpufreq/hwp.c    | 10 +++-------
 xen/include/acpi/cpufreq/cpufreq.h | 10 ++++++++++
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/hwp.c b/xen/arch/x86/acpi/cpufreq/hwp.c
index 59b57a4cef..d5fa3d47ca 100644
--- a/xen/arch/x86/acpi/cpufreq/hwp.c
+++ b/xen/arch/x86/acpi/cpufreq/hwp.c
@@ -21,10 +21,6 @@ static bool __ro_after_init feature_hdc;
 
 static bool __ro_after_init opt_cpufreq_hdc = true;
 
-#define HWP_ENERGY_PERF_MAX_PERFORMANCE 0
-#define HWP_ENERGY_PERF_BALANCE         0x80
-#define HWP_ENERGY_PERF_MAX_POWERSAVE   0xff
-
 union hwp_request
 {
     struct
@@ -597,7 +593,7 @@ int set_hwp_para(struct cpufreq_policy *policy,
         data->minimum = data->hw.lowest;
         data->maximum = data->hw.lowest;
         data->activity_window = 0;
-        data->energy_perf = HWP_ENERGY_PERF_MAX_POWERSAVE;
+        data->energy_perf = CPPC_ENERGY_PERF_MAX_POWERSAVE;
         data->desired = 0;
         break;
 
@@ -605,7 +601,7 @@ int set_hwp_para(struct cpufreq_policy *policy,
         data->minimum = data->hw.highest;
         data->maximum = data->hw.highest;
         data->activity_window = 0;
-        data->energy_perf = HWP_ENERGY_PERF_MAX_PERFORMANCE;
+        data->energy_perf = CPPC_ENERGY_PERF_MAX_PERFORMANCE;
         data->desired = 0;
         break;
 
@@ -613,7 +609,7 @@ int set_hwp_para(struct cpufreq_policy *policy,
         data->minimum = data->hw.lowest;
         data->maximum = data->hw.highest;
         data->activity_window = 0;
-        data->energy_perf = HWP_ENERGY_PERF_BALANCE;
+        data->energy_perf = CPPC_ENERGY_PERF_BALANCE;
         data->desired = 0;
         break;
 
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index 3f1b05a02e..a3c84143af 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -252,6 +252,16 @@ void cpufreq_dbs_timer_resume(void);
 
 void intel_feature_detect(struct cpufreq_policy *policy);
 
+/*
+ * If Energy Performance Preference(epp) is supported in the platform,
+ * OSPM may write a range of values from 0(performance preference)
+ * to 0xFF(energy efficiency perference) to control the platform's
+ * energy efficiency and performance optimization policies
+ */
+#define CPPC_ENERGY_PERF_MAX_PERFORMANCE 0
+#define CPPC_ENERGY_PERF_BALANCE         0x80
+#define CPPC_ENERGY_PERF_MAX_POWERSAVE   0xff
+
 int hwp_cmdline_parse(const char *s, const char *e);
 int hwp_register_driver(void);
 #ifdef CONFIG_INTEL
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:56:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902606.1310618 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsyc-0005PJ-AF; Wed, 05 Mar 2025 17:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902606.1310618; Wed, 05 Mar 2025 17:56:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsyc-0005PB-7b; Wed, 05 Mar 2025 17:56:14 +0000
Received: by outflank-mailman (input) for mailman id 902606;
 Wed, 05 Mar 2025 17:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpsya-0005P3-QR
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsyb-003IFz-05
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsya-008Y3F-2T
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q6k1R7dMUrvawggvJX/BAntVg9Rp5WK2Rmce3RybQlU=; b=yr1qqexytahwsDLqS7q6DvyuYU
	DkBQ+9wjTL2NX2HCf0BFiuZJRWh2m+RSCvor/3HzsdpM6mIt4JZ71mLml0wsvaQ7c1YxoOZUBCFZS
	uwE7oWvK0UvYiua4sHw3bHerOXGGKJc1b7LhueTQ/V11uC/iiLQOuhbLyX8m5KodhseA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/xstate: Create map/unmap primitives for xsave areas
Message-Id: <E1tpsya-008Y3F-2T@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:56:12 +0000

commit de742b2d7c20027ad686ec190117acf4b7ca5376
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:34:27 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:34:27 2025 +0100

    x86/xstate: Create map/unmap primitives for xsave areas
    
    Add infrastructure to simplify ASI handling. With ASI in the picture
    we'll have several different means of accessing the XSAVE area of a
    given vCPU, depending on whether a domain is covered by ASI or not and
    whether the vCPU is question is scheduled on the current pCPU or not.
    
    Having these complexities exposed at the call sites becomes unwieldy
    very fast. These wrappers are intended to be used in a similar way to
    map_domain_page() and unmap_domain_page(); The map operation will
    dispatch the appropriate pointer for each case in a future patch, while
    unmap will remain a no-op where no unmap is required (e.g: when there's
    no ASI) and remove the transient maping if one was required.
    
    Follow-up patches replace all uses of raw v->arch.xsave_area by this
    mechanism in preparation to add the beforementioned dispatch logic to be
    added at a later time.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/xstate.h | 42 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index 07017cc4ed..e3b9745543 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -143,4 +143,46 @@ static inline bool xstate_all(const struct vcpu *v)
            (v->arch.xcr0_accum & XSTATE_LAZY & ~XSTATE_FP_SSE);
 }
 
+/*
+ * Fetch a pointer to a vCPU's XSAVE area
+ *
+ * TL;DR: If v == current, the mapping is guaranteed to already exist.
+ *
+ * Despite the name, this macro might not actually map anything. The only case
+ * in which a mutation of page tables is strictly required is when ASI==on &&
+ * v!=current. For everything else the mapping already exists and needs not
+ * be created nor destroyed.
+ *
+ *                         +-----------------+--------------+
+ *                         |   v == current  | v != current |
+ *          +--------------+-----------------+--------------+
+ *          | ASI  enabled | per-vCPU fixmap |  actual map  |
+ *          +--------------+-----------------+--------------+
+ *          | ASI disabled |             directmap          |
+ *          +--------------+--------------------------------+
+ *
+ * There MUST NOT be outstanding maps of XSAVE areas of the non-current vCPU
+ * at the point of context switch. Otherwise, the unmap operation will
+ * misbehave.
+ *
+ * TODO: Expand the macro to the ASI cases after infra to do so is in place.
+ *
+ * @param v Owner of the XSAVE area
+ */
+#define VCPU_MAP_XSAVE_AREA(v) ((v)->arch.xsave_area)
+
+/*
+ * Drops the mapping of a vCPU's XSAVE area and nullifies its pointer on exit
+ *
+ * See VCPU_MAP_XSAVE_AREA() for additional information on the persistence of
+ * these mappings. This macro only tears down the mappings in the ASI=on &&
+ * v!=current case.
+ *
+ * TODO: Expand the macro to the ASI cases after infra to do so is in place.
+ *
+ * @param v Owner of the XSAVE area
+ * @param x XSAVE blob of v
+ */
+#define VCPU_UNMAP_XSAVE_AREA(v, x) do { (void)(v); (x) = NULL; } while (0)
+
 #endif /* __ASM_XSTATE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:56:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902607.1310621 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsym-0005S5-BT; Wed, 05 Mar 2025 17:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902607.1310621; Wed, 05 Mar 2025 17:56:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsym-0005Ry-90; Wed, 05 Mar 2025 17:56:24 +0000
Received: by outflank-mailman (input) for mailman id 902607;
 Wed, 05 Mar 2025 17:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpsyk-0005Rp-U0
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsyl-003IG5-0R
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsyk-008Y3d-2k
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yh/KMK1OxdseD4iXYq9khuP1MHOW+5JQTGblpSw8Kbg=; b=kTeNMwsuRnh0BfJCD3NAviAMWO
	MjnOJ9a3C/5gIJY40zhoExpNmmcySLgCrbz58E0hFF6OP6SnTTQdNPMpefCOOpZb+xPZH5RtUYbjV
	K36iNUMyUHWHiVbZ4FrhXXJ/pp/jqR4IzdJ0jdGFQoM4KX8jw/GZUUHSk65fimk/mhJw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Map/unmap xsave area in hvm_save_cpu_ctxt()
Message-Id: <E1tpsyk-008Y3d-2k@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:56:22 +0000

commit 9004cc229a911dca9519ecf0a517ad37ce9ba8d0
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:35:04 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:35:04 2025 +0100

    x86/hvm: Map/unmap xsave area in hvm_save_cpu_ctxt()
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 4851e2e150..969e43c2f2 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -913,11 +913,11 @@ static int cf_check hvm_save_cpu_ctxt(struct vcpu *v, hvm_domain_context_t *h)
 
     if ( v->fpu_initialised )
     {
-        BUILD_BUG_ON(sizeof(ctxt.fpu_regs) !=
-                     sizeof(v->arch.xsave_area->fpu_sse));
-        memcpy(ctxt.fpu_regs, &v->arch.xsave_area->fpu_sse,
-               sizeof(ctxt.fpu_regs));
+        const struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(v);
 
+        BUILD_BUG_ON(sizeof(ctxt.fpu_regs) != sizeof(xsave_area->fpu_sse));
+        memcpy(ctxt.fpu_regs, &xsave_area->fpu_sse, sizeof(ctxt.fpu_regs));
+        VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
         ctxt.flags = XEN_X86_FPU_INITIALISED;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:56:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902608.1310626 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsyw-0005UT-D6; Wed, 05 Mar 2025 17:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902608.1310626; Wed, 05 Mar 2025 17:56:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsyw-0005UL-AQ; Wed, 05 Mar 2025 17:56:34 +0000
Received: by outflank-mailman (input) for mailman id 902608;
 Wed, 05 Mar 2025 17:56:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpsyv-0005UD-1G
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:56:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsyv-003IGG-0m
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:56:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsyu-008Y43-35
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zEfM5vAW4Fvy1BE5rhw6DVbhWj9AqoD3Sc7PnwvSUQw=; b=hez1wLT2Ad1t0EZa35qLUB1Erq
	lGjoZdiu1o+kC+94pEus2/9FIo+NFkyFk/ndHY04aSzwe/dYooZfq2lbJD3cnRYDT1N79s2gCGUEF
	EFeEAxSMkEjbLPXIt3uGhWxyiOcdZW0cfmPs7tzIH8C+aGsr9etxVBAF3rKZLzFT9wEg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/fpu: Map/umap xsave area in vcpu_{reset,setup}_fpu()
Message-Id: <E1tpsyu-008Y43-35@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:56:32 +0000

commit dd9f4e7b51793e09c0c1448bebec296324ed2909
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:35:37 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:35:37 2025 +0100

    x86/fpu: Map/umap xsave area in vcpu_{reset,setup}_fpu()
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/i387.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 8fba0aef42..5429531ddd 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -304,24 +304,32 @@ int vcpu_init_fpu(struct vcpu *v)
 
 void vcpu_reset_fpu(struct vcpu *v)
 {
+    struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(v);
+
     v->fpu_initialised = false;
-    *v->arch.xsave_area = (struct xsave_struct) {
+    *xsave_area = (struct xsave_struct) {
         .xsave_hdr.xstate_bv = X86_XCR0_X87,
     };
 
     /* Old gcc doesn't permit these to be part of the initializer. */
-    v->arch.xsave_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
-    v->arch.xsave_area->fpu_sse.fcw = FCW_RESET;
-    v->arch.xsave_area->fpu_sse.ftw = FXSAVE_FTW_RESET;
+    xsave_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
+    xsave_area->fpu_sse.fcw = FCW_RESET;
+    xsave_area->fpu_sse.ftw = FXSAVE_FTW_RESET;
+
+    VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
 }
 
 void vcpu_setup_fpu(struct vcpu *v, const void *data)
 {
+    struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(v);
+
     v->fpu_initialised = true;
-    *v->arch.xsave_area = (struct xsave_struct) {
+    *xsave_area = (struct xsave_struct) {
         .fpu_sse = *(const fpusse_t*)data,
         .xsave_hdr.xstate_bv = XSTATE_FP_SSE,
     };
+
+    VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
 }
 
 /* Free FPU's context save area */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:56:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:56:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902609.1310630 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsz6-0005Wr-Ed; Wed, 05 Mar 2025 17:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902609.1310630; Wed, 05 Mar 2025 17:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsz6-0005Wj-Bs; Wed, 05 Mar 2025 17:56:44 +0000
Received: by outflank-mailman (input) for mailman id 902609;
 Wed, 05 Mar 2025 17:56:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpsz5-0005WS-5A
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:56:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsz5-003IGf-1B
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:56:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpsz5-008Y4r-0D
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:56:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yfI7uHqnT/4iOa/hzo9REcprorGCrw95WqcJbnBuJGQ=; b=RsPn+MdtXb85j8bXiASiOSJY28
	fRYohYXzyb1CIUFs4sQ+tQpTkH2PdGno/UBgyRv5qc5eakxshbP2MOy2jY6GARPO8pY7lWEOcOSMJ
	5He+Ejkyrjhh15foLp57+4g16pC4Le/xdW38GzUmf6uJcb2okNuBTZ9g/obY796GhOMo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/xstate: Map/unmap xsave area in xstate_set_init() and handle_setbv()
Message-Id: <E1tpsz5-008Y4r-0D@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:56:43 +0000

commit e628968f4ffb4a28d5951c122e5a163cb12586d0
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:35:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:35:57 2025 +0100

    x86/xstate: Map/unmap xsave area in xstate_set_init() and handle_setbv()
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/xstate.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index af9e345a7a..12004d7db2 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -993,7 +993,13 @@ int handle_xsetbv(u32 index, u64 new_bv)
 
         clts();
         if ( curr->fpu_dirtied )
-            asm ( "stmxcsr %0" : "=m" (curr->arch.xsave_area->fpu_sse.mxcsr) );
+        {
+            /* Has a fastpath for `current`, so there's no actual map */
+            struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(curr);
+
+            asm ( "stmxcsr %0" : "=m" (xsave_area->fpu_sse.mxcsr) );
+            VCPU_UNMAP_XSAVE_AREA(curr, xsave_area);
+        }
         else if ( xstate_all(curr) )
         {
             /* See the comment in i387.c:vcpu_restore_fpu_eager(). */
@@ -1048,7 +1054,7 @@ void xstate_set_init(uint64_t mask)
     unsigned long cr0 = read_cr0();
     unsigned long xcr0 = this_cpu(xcr0);
     struct vcpu *v = idle_vcpu[smp_processor_id()];
-    struct xsave_struct *xstate = v->arch.xsave_area;
+    struct xsave_struct *xstate;
 
     if ( ~xfeature_mask & mask )
     {
@@ -1061,8 +1067,10 @@ void xstate_set_init(uint64_t mask)
 
     clts();
 
+    xstate = VCPU_MAP_XSAVE_AREA(v);
     memset(&xstate->xsave_hdr, 0, sizeof(xstate->xsave_hdr));
     xrstor(v, mask);
+    VCPU_UNMAP_XSAVE_AREA(v, xstate);
 
     if ( cr0 & X86_CR0_TS )
         write_cr0(cr0);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:56:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:56:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902610.1310634 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpszG-0005Zg-Hb; Wed, 05 Mar 2025 17:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902610.1310634; Wed, 05 Mar 2025 17:56:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpszG-0005ZY-F5; Wed, 05 Mar 2025 17:56:54 +0000
Received: by outflank-mailman (input) for mailman id 902610;
 Wed, 05 Mar 2025 17:56:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpszF-0005ZN-7a
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:56:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpszF-003IGk-1R
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:56:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpszF-008Y5H-0b
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:56:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nz9e0JSjVFE5TsAaC2tD5SBiJkAh5biGUzXzFawm4vI=; b=RJLs7GqazF6MncO/2CD6azpGvb
	BWfeUpgwFMNNC9xphvzI0HJvu7JBANAXUh0IS7OS25o++G2VjrBw0hcbXEoEwBDTZ/ZhNKLZwW0KW
	Jg+3ffE5IYMXAo+DiojfAFLAUEzB5+BQW+MNCY0PVkoVHQlMoXiQGJ0pfi0WcxSLE+Mc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Map/unmap xsave area in hvmemul_{get,put}_fpu()
Message-Id: <E1tpszF-008Y5H-0b@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:56:53 +0000

commit c4a1b992e53dbdb86cae3e7aebba210106c6f02f
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:36:25 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:36:25 2025 +0100

    x86/hvm: Map/unmap xsave area in hvmemul_{get,put}_fpu()
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 5eb78ae275..1db14642b3 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2467,7 +2467,9 @@ static int cf_check hvmemul_get_fpu(
         alternative_vcall(hvm_funcs.fpu_dirty_intercept);
     else if ( type == X86EMUL_FPU_fpu )
     {
-        const fpusse_t *fpu_ctxt = &curr->arch.xsave_area->fpu_sse;
+        /* Has a fastpath for `current`, so there's no actual map */
+        const struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(curr);
+        const fpusse_t *fpu_ctxt = &xsave_area->fpu_sse;
 
         /*
          * Latch current register state so that we can back out changes
@@ -2493,6 +2495,8 @@ static int cf_check hvmemul_get_fpu(
             else
                 ASSERT(fcw == fpu_ctxt->fcw);
         }
+
+        VCPU_UNMAP_XSAVE_AREA(curr, xsave_area);
     }
 
     return X86EMUL_OKAY;
@@ -2507,7 +2511,9 @@ static void cf_check hvmemul_put_fpu(
 
     if ( aux )
     {
-        fpusse_t *fpu_ctxt = &curr->arch.xsave_area->fpu_sse;
+        /* Has a fastpath for `current`, so there's no actual map */
+        struct xsave_struct *xsave_area = VCPU_MAP_XSAVE_AREA(curr);
+        fpusse_t *fpu_ctxt = &xsave_area->fpu_sse;
         bool dval = aux->dval;
         int mode = hvm_guest_x86_mode(curr);
 
@@ -2563,6 +2569,8 @@ static void cf_check hvmemul_put_fpu(
 
         fpu_ctxt->fop = aux->op;
 
+        VCPU_UNMAP_XSAVE_AREA(curr, xsave_area);
+
         /* Re-use backout code below. */
         backout = X86EMUL_FPU_fpu;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:57:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:57:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902611.1310639 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpszQ-0005c9-JS; Wed, 05 Mar 2025 17:57:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902611.1310639; Wed, 05 Mar 2025 17:57:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpszQ-0005c1-GT; Wed, 05 Mar 2025 17:57:04 +0000
Received: by outflank-mailman (input) for mailman id 902611;
 Wed, 05 Mar 2025 17:57:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpszP-0005bq-Au
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:57:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpszP-003IH7-1l
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:57:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpszP-008Y6F-0q
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:57:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DjApQ+ekRVeTShIqQvH22FvBvkcORyBTuYqvqxGVtkY=; b=3bmP2d7fzvnuqCfiOkK3PeGqlq
	JVbK8wV6VhjsxJkaRYgj79hDHwv4lo+zp5+tuFxxpUJyAXuELxQzCWh2gsD0r4SV6Qhby2YZx9z1m
	ffqqyHy2CziHT/Bgu7u0RzkwA9gTo/3u1Q2ScOoVpuVa84E6y+oV7Cfw52pApwgsvQ4A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/domctl: Map/unmap xsave area in arch_get_info_guest()
Message-Id: <E1tpszP-008Y6F-0q@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:57:03 +0000

commit 29adbf4961c8fcb6b39857f8827eae7a4f7b84c0
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:37:02 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:37:02 2025 +0100

    x86/domctl: Map/unmap xsave area in arch_get_info_guest()
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domctl.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 5f01111619..3044f706de 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1377,16 +1377,17 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
     unsigned int i;
     const struct domain *d = v->domain;
     bool compat = is_pv_32bit_domain(d);
+    const struct xsave_struct *xsave_area;
 #ifdef CONFIG_COMPAT
 #define c(fld) (!compat ? (c.nat->fld) : (c.cmp->fld))
 #else
 #define c(fld) (c.nat->fld)
 #endif
 
-    BUILD_BUG_ON(sizeof(c.nat->fpu_ctxt) !=
-                 sizeof(v->arch.xsave_area->fpu_sse));
-    memcpy(&c.nat->fpu_ctxt, &v->arch.xsave_area->fpu_sse,
-           sizeof(c.nat->fpu_ctxt));
+    xsave_area = VCPU_MAP_XSAVE_AREA(v);
+    BUILD_BUG_ON(sizeof(c.nat->fpu_ctxt) != sizeof(xsave_area->fpu_sse));
+    memcpy(&c.nat->fpu_ctxt, &xsave_area->fpu_sse, sizeof(c.nat->fpu_ctxt));
+    VCPU_UNMAP_XSAVE_AREA(v, xsave_area);
 
     if ( is_pv_domain(d) )
         c(flags = v->arch.pv.vgc_flags & ~(VGCF_i387_valid|VGCF_in_kernel));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:57:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:57:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902612.1310642 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsza-0005eg-KP; Wed, 05 Mar 2025 17:57:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902612.1310642; Wed, 05 Mar 2025 17:57:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpsza-0005eY-Hs; Wed, 05 Mar 2025 17:57:14 +0000
Received: by outflank-mailman (input) for mailman id 902612;
 Wed, 05 Mar 2025 17:57:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpszZ-0005eQ-DZ
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:57:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpszZ-003IHB-21
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:57:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpszZ-008Y6d-1B
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:57:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VGiB3qRwSYokjKU9yTUMIwIYgpZpw3z/NmpQoMtF9zY=; b=2PcbGgtxl40vrFE9nciIb9P8gY
	Ugxw8YMVfGFo5LKrBiMQ0LEGhpEbsYvxTZC1/3xvTF0a3EL3zUvJMCV3RFwRU7Nck/wUbV/dZcJ2E
	ms24/lQOoGp6a3XAeg51D335rXoftzpv5ZXELIIFCmCo3n+OeWtgtXmZT2IKw43hI6vk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/xstate: Map/unmap xsave area in {compress,expand}_xsave_states()
Message-Id: <E1tpszZ-008Y6d-1B@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:57:13 +0000

commit c2e3d122de58476961dec25869f51026aed34168
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Wed Mar 5 16:37:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:37:14 2025 +0100

    x86/xstate: Map/unmap xsave area in {compress,expand}_xsave_states()
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/xstate.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 12004d7db2..3d249518a1 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -177,7 +177,7 @@ static void setup_xstate_comp(uint16_t *comp_offsets,
  */
 void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size)
 {
-    const struct xsave_struct *xstate = v->arch.xsave_area;
+    const struct xsave_struct *xstate = VCPU_MAP_XSAVE_AREA(v);
     const void *src;
     uint16_t comp_offsets[sizeof(xfeature_mask)*8];
     u64 xstate_bv = xstate->xsave_hdr.xstate_bv;
@@ -191,7 +191,7 @@ void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size)
     if ( !(xstate->xsave_hdr.xcomp_bv & XSTATE_COMPACTION_ENABLED) )
     {
         memcpy(dest, xstate, size);
-        return;
+        goto out;
     }
 
     ASSERT(xsave_area_compressed(xstate));
@@ -228,6 +228,9 @@ void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size)
 
         valid &= ~feature;
     }
+
+ out:
+    VCPU_UNMAP_XSAVE_AREA(v, xstate);
 }
 
 /*
@@ -242,7 +245,7 @@ void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size)
  */
 void compress_xsave_states(struct vcpu *v, const void *src, unsigned int size)
 {
-    struct xsave_struct *xstate = v->arch.xsave_area;
+    struct xsave_struct *xstate = VCPU_MAP_XSAVE_AREA(v);
     void *dest;
     uint16_t comp_offsets[sizeof(xfeature_mask)*8];
     u64 xstate_bv, valid;
@@ -256,7 +259,7 @@ void compress_xsave_states(struct vcpu *v, const void *src, unsigned int size)
     if ( !(v->arch.xcr0_accum & XSTATE_XSAVES_ONLY) )
     {
         memcpy(xstate, src, size);
-        return;
+        goto out;
     }
 
     /*
@@ -294,6 +297,9 @@ void compress_xsave_states(struct vcpu *v, const void *src, unsigned int size)
 
         valid &= ~feature;
     }
+
+ out:
+    VCPU_UNMAP_XSAVE_AREA(v, xstate);
 }
 
 void xsave(struct vcpu *v, uint64_t mask)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:57:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:57:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902613.1310646 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpszk-0005hR-M6; Wed, 05 Mar 2025 17:57:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902613.1310646; Wed, 05 Mar 2025 17:57:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpszk-0005hJ-JI; Wed, 05 Mar 2025 17:57:24 +0000
Received: by outflank-mailman (input) for mailman id 902613;
 Wed, 05 Mar 2025 17:57:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpszj-0005h4-GB
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:57:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpszj-003IHL-2I
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:57:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpszj-008Y70-1R
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:57:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PvX0sW2weT/Io/JpUbeIBLPfNRcZ2vj40X0SOnO/XsM=; b=xVjXWbHgiVI4I725VK62ocBSqt
	7dMpxhcQwr3qDG6ix45OCU9uNPumOmD7yvRAHlzFI3JCpTlmnWDYT3os9O9TQs4IQtfyHHywHV2Ye
	OAx4NVPk0QsP1BV8tPRHhTCtbK42bALX7ohFMuIpXyo3hfOVQ3dzmmZ1yJgcyITx9siw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xl: fix channel configuration setting
Message-Id: <E1tpszj-008Y70-1R@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:57:23 +0000

commit e1ccced4afe465d6541c5825a0f8d1b8f5fa4253
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Mar 5 16:37:37 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 16:37:37 2025 +0100

    tools/xl: fix channel configuration setting
    
    Channels work differently than other device types: their devid should
    be -1 initially in order to distinguish them from the primary console
    which has the devid of 0.
    
    So when parsing the channel configuration, use
    ARRAY_EXTEND_INIT_NODEVID() in order to avoid overwriting the devid
    set by libxl_device_channel_init().
    
    Fixes: 3a6679634766 ("libxl: set channel devid when not provided by application")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xl/xl_parse.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 3d85be7dd4..089a88935a 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2423,8 +2423,9 @@ void parse_config_data(const char *config_source,
             char *path = NULL;
             int len;
 
-            chn = ARRAY_EXTEND_INIT(d_config->channels, d_config->num_channels,
-                                   libxl_device_channel_init);
+            chn = ARRAY_EXTEND_INIT_NODEVID(d_config->channels,
+                                            d_config->num_channels,
+                                            libxl_device_channel_init);
 
             split_string_into_string_list(buf, ",", &pairs);
             len = libxl_string_list_length(&pairs);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 17:57:35 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 17:57:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902616.1310661 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpszu-0005zn-V6; Wed, 05 Mar 2025 17:57:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902616.1310661; Wed, 05 Mar 2025 17:57:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpszu-0005zf-S3; Wed, 05 Mar 2025 17:57:34 +0000
Received: by outflank-mailman (input) for mailman id 902616;
 Wed, 05 Mar 2025 17:57:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpszt-0005yx-Iy
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 17:57:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpszt-003IHS-2Y
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:57:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpszt-008Y7b-1h
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 17:57:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0N3HVBs835IfB5QIqqWYkS0mA+Ynn9XcWviUToo6VUU=; b=1S28ZG2ko21GjX6fQEe2inYliX
	Vo0p7HDHHR0y1+htmc/mEyMZDnXbf1igCuQx72XQPx8WN5U5xN3I5Q6/DsIlpSnQ4D2hPki4Xg+WJ
	PGSX7JAXzfoO/qTZ8eUd9udJqF7eYeO7lP6KP4C7Jug7ekxlUlerEZF5hfRZ0xAui2SI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "xen/riscv: drop CONFIG_RISCV_ISA_RV64G"
Message-Id: <E1tpszt-008Y7b-1h@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 17:57:33 +0000

commit c658d4f75887fc64cd3b8e4b3d0cbae07fa300e6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 5 17:06:23 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 5 17:06:23 2025 +0100

    Revert "xen/riscv: drop CONFIG_RISCV_ISA_RV64G"
    
    This reverts commit 86b1b8ec3d9d0508a95540e368432291b883837f. It
    fails in CI without an adjustment there.
---
 xen/arch/riscv/Kconfig | 18 ++++++++++++++++++
 xen/arch/riscv/arch.mk |  8 +++-----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index d882e0a059..fa95cd0a42 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -23,6 +23,24 @@ endmenu
 
 menu "ISA Selection"
 
+choice
+	prompt "Base ISA"
+	default RISCV_ISA_RV64G if RISCV_64
+	help
+	  This selects the base ISA extensions that Xen will target.
+
+config RISCV_ISA_RV64G
+	bool "RV64G"
+	help
+	  Use the RV64I base ISA, plus
+	  "M" for multiply/divide,
+	  "A" for atomic instructions,
+	  “F”/"D" for  {single/double}-precision floating-point instructions,
+	  "Zicsr" for control and status register access,
+	  "Zifencei" for instruction-fetch fence.
+
+endchoice
+
 config RISCV_ISA_C
 	bool "Compressed extension"
 	default y
diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 3034da76cb..17827c302c 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -6,12 +6,10 @@ $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 riscv-abi-$(CONFIG_RISCV_32) := -mabi=ilp32
 riscv-abi-$(CONFIG_RISCV_64) := -mabi=lp64
 
-riscv-march-$(CONFIG_RISCV_64) := rv64
-riscv-march-y += ima
-riscv-march-$(CONFIG_RISCV_ISA_C) += c
-riscv-march-y += _zicsr_zifencei
+riscv-march-$(CONFIG_RISCV_ISA_RV64G) := rv64g
+riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
 
-riscv-generic-flags := $(riscv-abi-y) -march=$(subst $(space),,$(riscv-march-y))
+riscv-generic-flags := $(riscv-abi-y) -march=$(riscv-march-y)
 
 # check-extension: Check whether extenstion is supported by a compiler and
 #                  an assembler.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 19:11:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 19:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902673.1310687 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpu91-0005Tk-0m; Wed, 05 Mar 2025 19:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902673.1310687; Wed, 05 Mar 2025 19:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpu90-0005Ta-SV; Wed, 05 Mar 2025 19:11:02 +0000
Received: by outflank-mailman (input) for mailman id 902673;
 Wed, 05 Mar 2025 19:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpu90-0005TO-18
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 19:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpu8z-003Joc-31
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 19:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpu8z-008e5a-1q
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 19:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C8Hnb84XWBH1qB2vCRg0Ou9/GcKybjZ05v4G4BLbfIM=; b=stpZm9jUmNAvaE0C5S3IHFOswe
	bJbGX1PuZyYYTdSm0ty1G+yiiSoxPBN8oEdZKYapp9MFBIsBQufFC8bFFF0OJKh0TbzagS992eXtK
	ncsqSnb30fwFGXhXkYo+NIdhpHN5wbU5estKmdZPAERiYpOx+vhfnaBDYct+7fBFDxHM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/lib: Introduce SHA2-256
Message-Id: <E1tpu8z-008e5a-1q@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 19:11:01 +0000

commit 372af524411f5a013bcb0b117073d8d07c026563
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 13 14:34:00 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 5 19:04:37 2025 +0000

    xen/lib: Introduce SHA2-256
    
    A future change will need to calculate SHA2-256 digests.  Introduce an
    implementation in lib/, derived from Trenchboot which itself is derived from
    Linux.
    
    In order to be useful to other architectures, it is careful with endianness
    and misaligned accesses as well as being more MISRA friendly, but is only
    wired up for x86 in the short term.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/include/xen/sha2.h |  15 +++
 xen/lib/Makefile       |   1 +
 xen/lib/sha2-256.c     | 264 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 280 insertions(+)

diff --git a/xen/include/xen/sha2.h b/xen/include/xen/sha2.h
new file mode 100644
index 0000000000..47d97fbf01
--- /dev/null
+++ b/xen/include/xen/sha2.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * SHA2-256: https://csrc.nist.gov/pubs/fips/180-2/upd1/final
+ */
+#ifndef XEN_SHA2_H
+#define XEN_SHA2_H
+
+#include <xen/types.h>
+
+#define SHA2_256_DIGEST_SIZE 32
+
+void sha2_256_digest(uint8_t digest[SHA2_256_DIGEST_SIZE],
+                     const void *msg, size_t len);
+
+#endif /* XEN_SHA2_H */
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 54440f628a..76dc86fab0 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -17,6 +17,7 @@ lib-y += memset.o
 lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
+lib-$(CONFIG_X86) += sha2-256.o
 lib-y += sort.o
 lib-y += strcasecmp.o
 lib-y += strchr.o
diff --git a/xen/lib/sha2-256.c b/xen/lib/sha2-256.c
new file mode 100644
index 0000000000..4aeb8aa204
--- /dev/null
+++ b/xen/lib/sha2-256.c
@@ -0,0 +1,264 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * SHA2-256: https://csrc.nist.gov/pubs/fips/180-2/upd1/final
+ *
+ * Originally derived from Linux.  Modified substantially to optimise for size
+ * and Xen's expected usecases.
+ */
+#include <xen/bitops.h>
+#include <xen/sha2.h>
+#include <xen/string.h>
+#include <xen/unaligned.h>
+
+struct sha2_256_state {
+    uint32_t state[SHA2_256_DIGEST_SIZE / sizeof(uint32_t)];
+    uint8_t buf[64];
+    size_t count; /* Byte count. */
+};
+
+static uint32_t choose(uint32_t x, uint32_t y, uint32_t z)
+{
+    return z ^ (x & (y ^ z));
+}
+
+static uint32_t majority(uint32_t x, uint32_t y, uint32_t z)
+{
+    return (x & y) | (z & (x | y));
+}
+
+static uint32_t e0(uint32_t x)
+{
+    return ror32(x, 2) ^ ror32(x, 13) ^ ror32(x, 22);
+}
+
+static uint32_t e1(uint32_t x)
+{
+    return ror32(x, 6) ^ ror32(x, 11) ^ ror32(x, 25);
+}
+
+static uint32_t s0(uint32_t x)
+{
+    return ror32(x, 7) ^ ror32(x, 18) ^ (x >> 3);
+}
+
+static uint32_t s1(uint32_t x)
+{
+    return ror32(x, 17) ^ ror32(x, 19) ^ (x >> 10);
+}
+
+static uint32_t blend(uint32_t W[16], unsigned int i)
+{
+#define W(i) W[(i) & 15]
+
+    return W(i) += s1(W(i - 2)) + W(i - 7) + s0(W(i - 15));
+
+#undef W
+}
+
+static const uint32_t K[] = {
+    0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
+    0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+    0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+    0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+    0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+    0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+    0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
+    0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+    0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
+    0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+    0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
+    0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+    0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
+    0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+    0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+    0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
+};
+
+static void sha2_256_transform(uint32_t *state, const void *_input)
+{
+    const uint32_t *input = _input;
+    uint32_t a, b, c, d, e, f, g, h, t1, t2;
+    uint32_t W[16];
+    unsigned int i;
+
+    for ( i = 0; i < 16; i++ )
+        W[i] = get_unaligned_be32(&input[i]);
+
+    a = state[0]; b = state[1]; c = state[2]; d = state[3];
+    e = state[4]; f = state[5]; g = state[6]; h = state[7];
+
+    for ( i = 0; i < 16; i += 8 )
+    {
+        t1 = h + e1(e) + choose(e, f, g) + K[i + 0] + W[i + 0];
+        t2 = e0(a) + majority(a, b, c);    d += t1;    h = t1 + t2;
+        t1 = g + e1(d) + choose(d, e, f) + K[i + 1] + W[i + 1];
+        t2 = e0(h) + majority(h, a, b);    c += t1;    g = t1 + t2;
+        t1 = f + e1(c) + choose(c, d, e) + K[i + 2] + W[i + 2];
+        t2 = e0(g) + majority(g, h, a);    b += t1;    f = t1 + t2;
+        t1 = e + e1(b) + choose(b, c, d) + K[i + 3] + W[i + 3];
+        t2 = e0(f) + majority(f, g, h);    a += t1;    e = t1 + t2;
+        t1 = d + e1(a) + choose(a, b, c) + K[i + 4] + W[i + 4];
+        t2 = e0(e) + majority(e, f, g);    h += t1;    d = t1 + t2;
+        t1 = c + e1(h) + choose(h, a, b) + K[i + 5] + W[i + 5];
+        t2 = e0(d) + majority(d, e, f);    g += t1;    c = t1 + t2;
+        t1 = b + e1(g) + choose(g, h, a) + K[i + 6] + W[i + 6];
+        t2 = e0(c) + majority(c, d, e);    f += t1;    b = t1 + t2;
+        t1 = a + e1(f) + choose(f, g, h) + K[i + 7] + W[i + 7];
+        t2 = e0(b) + majority(b, c, d);    e += t1;    a = t1 + t2;
+    }
+
+    for ( ; i < 64; i += 8 )
+    {
+        t1 = h + e1(e) + choose(e, f, g) + K[i + 0] + blend(W, i + 0);
+        t2 = e0(a) + majority(a, b, c);    d += t1;    h = t1 + t2;
+        t1 = g + e1(d) + choose(d, e, f) + K[i + 1] + blend(W, i + 1);
+        t2 = e0(h) + majority(h, a, b);    c += t1;    g = t1 + t2;
+        t1 = f + e1(c) + choose(c, d, e) + K[i + 2] + blend(W, i + 2);
+        t2 = e0(g) + majority(g, h, a);    b += t1;    f = t1 + t2;
+        t1 = e + e1(b) + choose(b, c, d) + K[i + 3] + blend(W, i + 3);
+        t2 = e0(f) + majority(f, g, h);    a += t1;    e = t1 + t2;
+        t1 = d + e1(a) + choose(a, b, c) + K[i + 4] + blend(W, i + 4);
+        t2 = e0(e) + majority(e, f, g);    h += t1;    d = t1 + t2;
+        t1 = c + e1(h) + choose(h, a, b) + K[i + 5] + blend(W, i + 5);
+        t2 = e0(d) + majority(d, e, f);    g += t1;    c = t1 + t2;
+        t1 = b + e1(g) + choose(g, h, a) + K[i + 6] + blend(W, i + 6);
+        t2 = e0(c) + majority(c, d, e);    f += t1;    b = t1 + t2;
+        t1 = a + e1(f) + choose(f, g, h) + K[i + 7] + blend(W, i + 7);
+        t2 = e0(b) + majority(b, c, d);    e += t1;    a = t1 + t2;
+    }
+
+    state[0] += a; state[1] += b; state[2] += c; state[3] += d;
+    state[4] += e; state[5] += f; state[6] += g; state[7] += h;
+}
+
+static void sha2_256_init(struct sha2_256_state *s)
+{
+    *s = (struct sha2_256_state){
+        .state = {
+            0x6a09e667UL,
+            0xbb67ae85UL,
+            0x3c6ef372UL,
+            0xa54ff53aUL,
+            0x510e527fUL,
+            0x9b05688cUL,
+            0x1f83d9abUL,
+            0x5be0cd19UL,
+        },
+    };
+}
+
+static void sha2_256_update(struct sha2_256_state *s, const void *msg,
+                            size_t len)
+{
+    unsigned int partial = s->count & 63;
+
+    s->count += len;
+
+    if ( (partial + len) >= 64 )
+    {
+        if ( partial )
+        {
+            unsigned int rem = 64 - partial;
+
+            /* Fill the partial block. */
+            memcpy(s->buf + partial, msg, rem);
+            msg += rem;
+            len -= rem;
+
+            sha2_256_transform(s->state, s->buf);
+            partial = 0;
+        }
+
+        for ( ; len >= 64; msg += 64, len -= 64 )
+            sha2_256_transform(s->state, msg);
+    }
+
+    /* Remaining data becomes partial. */
+    memcpy(s->buf + partial, msg, len);
+}
+
+static void sha2_256_final(struct sha2_256_state *s, void *_dst)
+{
+    uint32_t *dst = _dst;
+    unsigned int i, partial = s->count & 63;
+
+    /* Start padding */
+    s->buf[partial++] = 0x80;
+
+    if ( partial > 56 )
+    {
+        /* Need one extra block - pad to 64 */
+        memset(s->buf + partial, 0, 64 - partial);
+        sha2_256_transform(s->state, s->buf);
+        partial = 0;
+    }
+    /* Pad to 56 */
+    memset(s->buf + partial, 0, 56 - partial);
+
+    /* Append the bit count */
+    put_unaligned_be64((uint64_t)s->count << 3, &s->buf[56]);
+    sha2_256_transform(s->state, s->buf);
+
+    /* Store state in digest */
+    for ( i = 0; i < 8; i++ )
+        put_unaligned_be32(s->state[i], &dst[i]);
+}
+
+void sha2_256_digest(uint8_t digest[SHA2_256_DIGEST_SIZE],
+                     const void *msg, size_t len)
+{
+    struct sha2_256_state s;
+
+    sha2_256_init(&s);
+    sha2_256_update(&s, msg, len);
+    sha2_256_final(&s, digest);
+}
+
+#ifdef CONFIG_SELF_TESTS
+
+#include <xen/init.h>
+#include <xen/lib.h>
+
+static const struct test {
+    const char *msg;
+    uint8_t digest[SHA2_256_DIGEST_SIZE];
+} tests[] __initconst = {
+    {
+        .msg = "abc",
+        .digest = {
+            0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
+            0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
+            0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
+            0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad,
+        },
+    },
+    {
+        .msg = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
+        .digest = {
+            0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
+            0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
+            0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
+            0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1,
+        },
+    },
+};
+
+static void __init __constructor test_sha2_256(void)
+{
+    for ( unsigned int i = 0; i < ARRAY_SIZE(tests); ++i )
+    {
+        const struct test *t = &tests[i];
+        uint8_t res[SHA2_256_DIGEST_SIZE] = {};
+
+        sha2_256_digest(res, t->msg, strlen(t->msg));
+
+        if ( memcmp(res, t->digest, sizeof(t->digest)) == 0 )
+            continue;
+
+        panic("%s() msg '%s' failed\n"
+              "  expected %" STR(SHA2_256_DIGEST_SIZE) "phN\n"
+              "       got %" STR(SHA2_256_DIGEST_SIZE) "phN\n",
+              __func__, t->msg, t->digest, res);
+    }
+}
+#endif /* CONFIG_SELF_TESTS */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 19:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 19:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902674.1310690 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpu9B-00067G-2O; Wed, 05 Mar 2025 19:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902674.1310690; Wed, 05 Mar 2025 19:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpu9A-000676-Vf; Wed, 05 Mar 2025 19:11:12 +0000
Received: by outflank-mailman (input) for mailman id 902674;
 Wed, 05 Mar 2025 19:11:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpu99-000650-R3
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 19:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpu9A-003Joi-07
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 19:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpu99-008e7J-2T
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 19:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/t8ub8F0L74tIv72RuNE8BO5HmnX8LY+p3aX7if58V8=; b=K+dbGIsFZpddK56L0Jh9ovn3Ih
	n454cwnJalLy5Gu232yEBNrFzpdphl1OTCA3PHIVDV8wnlswfVCt0blQCMpqPFh2F9HbWLYWqPmvq
	VTLNoHLVUUzNbJTW+lFS/8O4MFudiniqy99L51SEcDjK0YDO07a3v9+C5l5L2guyFdCw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ucode: Perform extra SHA2 checks on AMD Fam17h/19h microcode
Message-Id: <E1tpu99-008e7J-2T@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 19:11:11 +0000

commit 630e8875ab368b97cc7231aaf3809e3d7d5687e1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 13 14:34:00 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 5 19:04:37 2025 +0000

    x86/ucode: Perform extra SHA2 checks on AMD Fam17h/19h microcode
    
    Collisions have been found in the microcode signing algorithm used by AMD
    Fam17h/19h CPUs, and now anyone can sign their own.
    
    For more details, see:
      https://bughunters.google.com/blog/5424842357473280/zen-and-the-art-of-microcode-hacking
      https://www.amd.com/en/resources/product-security/bulletin/amd-sb-7033.html
    
    As a stopgap mitigation, check the digest of patches against a table of blobs
    with known provenance.  These are all Fam17h and Fam19h blobs included in
    linux-firwmare at the time of writing, specifically:
    
      https://git.kernel.org/firmware/linux-firmware/c/48bb90cceb882cab8e9ab692bc5779d3bf3a13b8
    
    This checks can be opted out of by booting with ucode=no-digest-check, but
    doing so is not recommended.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 docs/misc/xen-command-line.pandoc              |  10 +-
 xen/arch/x86/cpu/microcode/amd-patch-digests.c | 226 +++++++++++++++++++++++++
 xen/arch/x86/cpu/microcode/amd.c               |  66 +++++++-
 xen/arch/x86/cpu/microcode/core.c              |   3 +
 xen/arch/x86/cpu/microcode/private.h           |   2 +
 5 files changed, 304 insertions(+), 3 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 7e0f81adab..89db6e83be 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2735,10 +2735,10 @@ performance.
    Alternatively, selecting `tsx=1` will re-enable TSX at the users own risk.
 
 ### ucode
-> `= List of [ <integer> | scan=<bool>, nmi=<bool> ]`
+> `= List of [ <integer> | scan=<bool>, nmi=<bool>, digest-check=<bool> ]`
 
     Applicability: x86
-    Default: `scan` is selectable via Kconfig, `nmi=true`
+    Default: `scan` is selectable via Kconfig, `nmi,digest-check`
 
 Controls for CPU microcode loading. For early loading, this parameter can
 specify how and where to find the microcode update blob. For late loading,
@@ -2768,6 +2768,12 @@ precedence over `scan`. The default value for `scan` is set with
 stop_machine context. In NMI handler, even NMIs are blocked, which is
 considered safer. The default value is `true`.
 
+The `digest-check=` option is active by default and controls whether to
+perform additional authenticity checks.  Collisions in the signature algorithm
+used by AMD Fam17h/19h processors have been found.  Xen contains a table of
+digests of microcode patches with known-good provenance, and will block
+loading of patches that do not match.
+
 ### unrestricted_guest (Intel)
 > `= <boolean>`
 
diff --git a/xen/arch/x86/cpu/microcode/amd-patch-digests.c b/xen/arch/x86/cpu/microcode/amd-patch-digests.c
new file mode 100644
index 0000000000..d327612267
--- /dev/null
+++ b/xen/arch/x86/cpu/microcode/amd-patch-digests.c
@@ -0,0 +1,226 @@
+/* Generated from linux-firmware. */
+{
+    .patch_id = 0x0800126f,
+    .digest = {
+        0x2b, 0x5a, 0xf2, 0x9c, 0xdd, 0xd2, 0x7f, 0xec,
+        0xec, 0x96, 0x09, 0x57, 0xb0, 0x96, 0x29, 0x8b,
+        0x2e, 0x26, 0x91, 0xf0, 0x49, 0x33, 0x42, 0x18,
+        0xdd, 0x4b, 0x65, 0x5a, 0xd4, 0x15, 0x3d, 0x33,
+    },
+},
+{
+    .patch_id = 0x0800820d,
+    .digest = {
+        0x68, 0x98, 0x83, 0xcd, 0x22, 0x0d, 0xdd, 0x59,
+        0x73, 0x2c, 0x5b, 0x37, 0x1f, 0x84, 0x0e, 0x67,
+        0x96, 0x43, 0x83, 0x0c, 0x46, 0x44, 0xab, 0x7c,
+        0x7b, 0x65, 0x9e, 0x57, 0xb5, 0x90, 0x4b, 0x0e,
+    },
+},
+{
+    .patch_id = 0x0830107c,
+    .digest = {
+        0x21, 0x64, 0xde, 0xfb, 0x9f, 0x68, 0x96, 0x47,
+        0x70, 0x5c, 0xe2, 0x8f, 0x18, 0x52, 0x6a, 0xac,
+        0xa4, 0xd2, 0x2e, 0xe0, 0xde, 0x68, 0x66, 0xc3,
+        0xeb, 0x1e, 0xd3, 0x3f, 0xbc, 0x51, 0x1d, 0x38,
+    },
+},
+{
+    .patch_id = 0x0860010d,
+    .digest = {
+        0x86, 0xb6, 0x15, 0x83, 0xbc, 0x3b, 0x9c, 0xe0,
+        0xb3, 0xef, 0x1d, 0x99, 0x84, 0x35, 0x15, 0xf7,
+        0x7c, 0x2a, 0xc6, 0x42, 0xdb, 0x73, 0x07, 0x5c,
+        0x7d, 0xc3, 0x02, 0xb5, 0x43, 0x06, 0x5e, 0xf8,
+    },
+},
+{
+    .patch_id = 0x08608108,
+    .digest = {
+        0x14, 0xfe, 0x57, 0x86, 0x49, 0xc8, 0x68, 0xe2,
+        0x11, 0xa3, 0xcb, 0x6e, 0xff, 0x6e, 0xd5, 0x38,
+        0xfe, 0x89, 0x1a, 0xe0, 0x67, 0xbf, 0xc4, 0xcc,
+        0x1b, 0x9f, 0x84, 0x77, 0x2b, 0x9f, 0xaa, 0xbd,
+    },
+},
+{
+    .patch_id = 0x08701034,
+    .digest = {
+        0xc3, 0x14, 0x09, 0xa8, 0x9c, 0x3f, 0x8d, 0x83,
+        0x9b, 0x4c, 0xa5, 0xb7, 0x64, 0x8b, 0x91, 0x5d,
+        0x85, 0x6a, 0x39, 0x26, 0x1e, 0x14, 0x41, 0xa8,
+        0x75, 0xea, 0xa6, 0xf9, 0xc9, 0xd1, 0xea, 0x2b,
+    },
+},
+{
+    .patch_id = 0x08a0000a,
+    .digest = {
+        0x73, 0x31, 0x26, 0x22, 0xd4, 0xf9, 0xee, 0x3c,
+        0x07, 0x06, 0xe7, 0xb9, 0xad, 0xd8, 0x72, 0x44,
+        0x33, 0x31, 0xaa, 0x7d, 0xc3, 0x67, 0x0e, 0xdb,
+        0x47, 0xb5, 0xaa, 0xbc, 0xf5, 0xbb, 0xd9, 0x20,
+    },
+},
+{
+    .patch_id = 0x0a00107a,
+    .digest = {
+        0x5f, 0x92, 0xca, 0xff, 0xc3, 0x59, 0x22, 0x5f,
+        0x02, 0xa0, 0x91, 0x3b, 0x4a, 0x45, 0x10, 0xfd,
+        0x19, 0xe1, 0x8a, 0x6d, 0x9a, 0x92, 0xc1, 0x3f,
+        0x75, 0x78, 0xac, 0x78, 0x03, 0x1d, 0xdb, 0x18,
+    },
+},
+{
+    .patch_id = 0x0a0011d5,
+    .digest = {
+        0xed, 0x69, 0x89, 0xf4, 0xeb, 0x64, 0xc2, 0x13,
+        0xe0, 0x51, 0x1f, 0x03, 0x26, 0x52, 0x7d, 0xb7,
+        0x93, 0x5d, 0x65, 0xca, 0xb8, 0x12, 0x1d, 0x62,
+        0x0d, 0x5b, 0x65, 0x34, 0x69, 0xb2, 0x62, 0x21,
+    },
+},
+{
+    .patch_id = 0x0a001238,
+    .digest = {
+        0x72, 0xf7, 0x4b, 0x0c, 0x7d, 0x58, 0x65, 0xcc,
+        0x00, 0xcc, 0x57, 0x16, 0x68, 0x16, 0xf8, 0x2a,
+        0x1b, 0xb3, 0x8b, 0xe1, 0xb6, 0x83, 0x8c, 0x7e,
+        0xc0, 0xcd, 0x33, 0xf2, 0x8d, 0xf9, 0xef, 0x59,
+    },
+},
+{
+    .patch_id = 0x0a00820c,
+    .digest = {
+        0xa8, 0x0c, 0x81, 0xc0, 0xa6, 0x00, 0xe7, 0xf3,
+        0x5f, 0x65, 0xd3, 0xb9, 0x6f, 0xea, 0x93, 0x63,
+        0xf1, 0x8c, 0x88, 0x45, 0xd7, 0x82, 0x80, 0xd1,
+        0xe1, 0x3b, 0x8d, 0xb2, 0xf8, 0x22, 0x03, 0xe2,
+    },
+},
+{
+    .patch_id = 0x0a101148,
+    .digest = {
+        0x20, 0xd5, 0x6f, 0x40, 0x4a, 0xf6, 0x48, 0x90,
+        0xc2, 0x93, 0x9a, 0xc2, 0xfd, 0xac, 0xef, 0x4f,
+        0xfa, 0xc0, 0x3d, 0x92, 0x3c, 0x6d, 0x01, 0x08,
+        0xf1, 0x5e, 0xb0, 0xde, 0xb4, 0x98, 0xae, 0xc4,
+    },
+},
+{
+    .patch_id = 0x0a101248,
+    .digest = {
+        0xed, 0x3b, 0x95, 0xa6, 0x68, 0xa7, 0x77, 0x3e,
+        0xfc, 0x17, 0x26, 0xe2, 0x7b, 0xd5, 0x56, 0x22,
+        0x2c, 0x1d, 0xef, 0xeb, 0x56, 0xdd, 0xba, 0x6e,
+        0x1b, 0x7d, 0x64, 0x9d, 0x4b, 0x53, 0x13, 0x75,
+    },
+},
+{
+    .patch_id = 0x0a108108,
+    .digest = {
+        0xed, 0xc2, 0xec, 0xa1, 0x15, 0xc6, 0x65, 0xe9,
+        0xd0, 0xef, 0x39, 0xaa, 0x7f, 0x55, 0x06, 0xc6,
+        0xf5, 0xd4, 0x3f, 0x7b, 0x14, 0xd5, 0x60, 0x2c,
+        0x28, 0x1e, 0x9c, 0x59, 0x69, 0x99, 0x4d, 0x16,
+    },
+},
+{
+    .patch_id = 0x0a20102d,
+    .digest = {
+        0xf9, 0x6e, 0xf2, 0x32, 0xd3, 0x0f, 0x5f, 0x11,
+        0x59, 0xa1, 0xfe, 0xcc, 0xcd, 0x9b, 0x42, 0x89,
+        0x8b, 0x89, 0x2f, 0xb5, 0xbb, 0x82, 0xef, 0x23,
+        0x8c, 0xe9, 0x19, 0x3e, 0xcc, 0x3f, 0x7b, 0xb4,
+    },
+},
+{
+    .patch_id = 0x0a201210,
+    .digest = {
+        0xe8, 0x6d, 0x51, 0x6a, 0x8e, 0x72, 0xf3, 0xfe,
+        0x6e, 0x16, 0xbc, 0x62, 0x59, 0x40, 0x17, 0xe9,
+        0x6d, 0x3d, 0x0e, 0x6b, 0xa7, 0xac, 0xe3, 0x68,
+        0xf7, 0x55, 0xf0, 0x13, 0xbb, 0x22, 0xf6, 0x41,
+    },
+},
+{
+    .patch_id = 0x0a404107,
+    .digest = {
+        0xbb, 0x04, 0x4e, 0x47, 0xdd, 0x5e, 0x26, 0x45,
+        0x1a, 0xc9, 0x56, 0x24, 0xa4, 0x4c, 0x82, 0xb0,
+        0x8b, 0x0d, 0x9f, 0xf9, 0x3a, 0xdf, 0xc6, 0x81,
+        0x13, 0xbc, 0xc5, 0x25, 0xe4, 0xc5, 0xc3, 0x99,
+    },
+},
+{
+    .patch_id = 0x0a500011,
+    .digest = {
+        0x23, 0x3d, 0x70, 0x7d, 0x03, 0xc3, 0xc4, 0xf4,
+        0x2b, 0x82, 0xc6, 0x05, 0xda, 0x80, 0x0a, 0xf1,
+        0xd7, 0x5b, 0x65, 0x3a, 0x7d, 0xab, 0xdf, 0xa2,
+        0x11, 0x5e, 0x96, 0x7e, 0x71, 0xe9, 0xfc, 0x74,
+    },
+},
+{
+    .patch_id = 0x0a601209,
+    .digest = {
+        0x66, 0x48, 0xd4, 0x09, 0x05, 0xcb, 0x29, 0x32,
+        0x66, 0xb7, 0x9a, 0x76, 0xcd, 0x11, 0xf3, 0x30,
+        0x15, 0x86, 0xcc, 0x5d, 0x97, 0x0f, 0xc0, 0x46,
+        0xe8, 0x73, 0xe2, 0xd6, 0xdb, 0xd2, 0x77, 0x1d,
+    },
+},
+{
+    .patch_id = 0x0a704107,
+    .digest = {
+        0xf3, 0xc6, 0x58, 0x26, 0xee, 0xac, 0x3f, 0xd6,
+        0xce, 0xa1, 0x72, 0x47, 0x3b, 0xba, 0x2b, 0x93,
+        0x2a, 0xad, 0x8e, 0x6b, 0xea, 0x9b, 0xb7, 0xc2,
+        0x64, 0x39, 0x71, 0x8c, 0xce, 0xe7, 0x41, 0x39,
+    },
+},
+{
+    .patch_id = 0x0a705206,
+    .digest = {
+        0x8d, 0xc0, 0x76, 0xbd, 0x58, 0x9f, 0x8f, 0xa4,
+        0x12, 0x9d, 0x21, 0xfb, 0x48, 0x21, 0xbc, 0xe7,
+        0x67, 0x6f, 0x04, 0x18, 0xae, 0x20, 0x87, 0x4b,
+        0x03, 0x35, 0xe9, 0xbe, 0xfb, 0x06, 0xdf, 0xfc,
+    },
+},
+{
+    .patch_id = 0x0a708007,
+    .digest = {
+        0x6b, 0x76, 0xcc, 0x78, 0xc5, 0x8a, 0xa3, 0xe3,
+        0x32, 0x2d, 0x79, 0xe4, 0xc3, 0x80, 0xdb, 0xb2,
+        0x07, 0xaa, 0x3a, 0xe0, 0x57, 0x13, 0x72, 0x80,
+        0xdf, 0x92, 0x73, 0x84, 0x87, 0x3c, 0x73, 0x93,
+    },
+},
+{
+    .patch_id = 0x0a70c005,
+    .digest = {
+        0x88, 0x5d, 0xfb, 0x79, 0x64, 0xd8, 0x46, 0x3b,
+        0x4a, 0x83, 0x8e, 0x77, 0x7e, 0xcf, 0xb3, 0x0f,
+        0x1f, 0x1f, 0xf1, 0x97, 0xeb, 0xfe, 0x56, 0x55,
+        0xee, 0x49, 0xac, 0xe1, 0x8b, 0x13, 0xc5, 0x13,
+    },
+},
+{
+    .patch_id = 0x0aa00116,
+    .digest = {
+        0xe8, 0x4c, 0x2c, 0x88, 0xa1, 0xac, 0x24, 0x63,
+        0x65, 0xe5, 0xaa, 0x2d, 0x16, 0xa9, 0xc3, 0xf5,
+        0xfe, 0x1d, 0x5e, 0x65, 0xc7, 0xaa, 0x92, 0x4d,
+        0x91, 0xee, 0x76, 0xbb, 0x4c, 0x66, 0x78, 0xc9,
+    },
+},
+{
+    .patch_id = 0x0aa00215,
+    .digest = {
+        0x55, 0xd3, 0x28, 0xcb, 0x87, 0xa9, 0x32, 0xe9,
+        0x4e, 0x85, 0x4b, 0x7c, 0x6b, 0xd5, 0x7c, 0xd4,
+        0x1b, 0x51, 0x71, 0x3a, 0x0e, 0x0b, 0xdc, 0x9b,
+        0x68, 0x2f, 0x46, 0xee, 0xfe, 0xc6, 0x6d, 0xef,
+    },
+},
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 9ee455b007..27caed1028 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -14,9 +14,11 @@
  *  License version 2. See file COPYING for details.
  */
 
+#include <xen/bsearch.h>
 #include <xen/err.h>
 #include <xen/init.h>
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
+#include <xen/sha2.h>
 
 #include <asm/msr.h>
 
@@ -90,6 +92,59 @@ static struct {
     uint16_t id;
 } equiv __read_mostly;
 
+static const struct patch_digest {
+    uint32_t patch_id;
+    uint8_t digest[SHA2_256_DIGEST_SIZE];
+} patch_digests[] = {
+#include "amd-patch-digests.c"
+};
+
+static int cmp_patch_id(const void *key, const void *elem)
+{
+    const struct patch_digest *pd = elem;
+    uint32_t patch_id = *(uint32_t *)key;
+
+    if ( patch_id == pd->patch_id )
+        return 0;
+    else if ( patch_id < pd->patch_id )
+        return -1;
+    return 1;
+}
+
+static bool check_digest(const struct container_microcode *mc)
+{
+    const struct microcode_patch *patch = mc->patch;
+    const struct patch_digest *pd;
+    uint8_t digest[SHA2_256_DIGEST_SIZE];
+
+    /* Only Fam17h/19h are known to need extra checks.  Skip other families. */
+    if ( boot_cpu_data.x86 < 0x17 || boot_cpu_data.x86 > 0x19 ||
+         !opt_digest_check )
+        return true;
+
+    pd = bsearch(&patch->patch_id, patch_digests, ARRAY_SIZE(patch_digests),
+                 sizeof(struct patch_digest), cmp_patch_id);
+    if ( !pd )
+    {
+        printk(XENLOG_WARNING "No digest found for patch_id %08x\n",
+               patch->patch_id);
+        return false;
+    }
+
+    sha2_256_digest(digest, patch, mc->len);
+
+    if ( memcmp(digest, pd->digest, sizeof(digest)) )
+    {
+        printk(XENLOG_WARNING "Patch %08x SHA256 mismatch:\n"
+               "  expected %" STR(SHA2_256_DIGEST_SIZE) "phN\n"
+               "       got %" STR(SHA2_256_DIGEST_SIZE) "phN\n",
+               patch->patch_id, pd->digest, digest);
+        return false;
+    }
+
+    return true;
+}
+
 static void cf_check collect_cpu_info(void)
 {
     struct cpu_signature *csig = &this_cpu(cpu_sig);
@@ -397,7 +452,8 @@ static struct microcode_patch *cf_check cpu_request_microcode(
             if ( microcode_fits_cpu(mc->patch) &&
                  (!saved ||
                   compare_revisions(saved->patch_id,
-                                    mc->patch->patch_id) == NEW_UCODE) )
+                                    mc->patch->patch_id) == NEW_UCODE) &&
+                 check_digest(mc) )
             {
                 saved = mc->patch;
                 saved_size = mc->len;
@@ -456,6 +512,14 @@ static const struct microcode_ops __initconst_cf_clobber amd_ucode_ops = {
 
 void __init ucode_probe_amd(struct microcode_ops *ops)
 {
+    if ( !opt_digest_check &&
+         boot_cpu_data.x86 >= 0x17 && boot_cpu_data.x86 <= 0x19 )
+    {
+        printk(XENLOG_WARNING
+               "Microcode patch additional digest checks disabled");
+        add_taint(TAINT_CPU_OUT_OF_SPEC);
+    }
+
     if ( boot_cpu_data.x86 < 0x10 )
         return;
 
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 9fe86942a3..34a94cd25b 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -101,6 +101,7 @@ static struct microcode_patch *microcode_cache;
  */
 static int __initdata opt_mod_idx;
 static bool __initdata opt_scan = IS_ENABLED(CONFIG_UCODE_SCAN_DEFAULT);
+bool __ro_after_init opt_digest_check = true;
 
 /*
  * Used by the EFI path only, when xen.cfg identifies an explicit microcode
@@ -130,6 +131,8 @@ static int __init cf_check parse_ucode(const char *s)
 
         if ( (val = parse_boolean("nmi", s, ss)) >= 0 )
             ucode_in_nmi = val;
+        else if ( (val = parse_boolean("digest-check", s, ss)) >= 0 )
+            opt_digest_check = val;
         else if ( !ucode_mod_forced ) /* Not forced by EFI */
         {
             if ( (val = parse_boolean("scan", s, ss)) >= 0 )
diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h
index 74bb2f0a65..f5e2bfee00 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -67,6 +67,8 @@ struct microcode_ops {
     const char *cpio_path;
 };
 
+extern bool opt_digest_check;
+
 /*
  * Microcode loading falls into one of 3 states.
  *   - No support at all
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 05 23:33:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 05 Mar 2025 23:33:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902955.1310890 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpyEZ-0006Cc-AC; Wed, 05 Mar 2025 23:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902955.1310890; Wed, 05 Mar 2025 23:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpyEZ-0006CU-7U; Wed, 05 Mar 2025 23:33:03 +0000
Received: by outflank-mailman (input) for mailman id 902955;
 Wed, 05 Mar 2025 23:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpyEY-0006Al-3O
 for xen-changelog@lists.xenproject.org; Wed, 05 Mar 2025 23:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpyEY-003PNF-0V
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 23:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpyEX-008yT9-2g
 for xen-changelog@lists.xenproject.org;
 Wed, 05 Mar 2025 23:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MrEIb/KaZXunDQIjwrsJ6jcdptsOlokPXJr023w4vSE=; b=Jc2kEYXpKs7/eD+YCbdDpNQSMz
	VoTdK9XrQEYxGvG6FOgEqEF7f4+NqJYPo4J3dLjC7JC+jPcgsewfpCAXvu/DqkEXmgJcQzR/bnf7u
	MmGP3XX4Ig29Ehc5+WwYTFBrhUhYI/F7vMRw56P9HiHR65xWaGamMuvR4YArI6MAz6ls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Xen: CI fixes from XSN-2
Message-Id: <E1tpyEX-008yT9-2g@xenbits.xenproject.org>
Date: Wed, 05 Mar 2025 23:33:01 +0000

commit 15fe2eb5f1bac8a212c0ba3d6dfe60d1fdf851cf
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Mar 5 22:17:22 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 5 23:27:53 2025 +0000

    Xen: CI fixes from XSN-2
    
     * Add cf_check annotation to cmp_patch_id() used by bsearch().
     * Add U suffix to the K[] table to fix MISRA Rule 7.2 violations.
    
    Fixes: 372af524411f ("xen/lib: Introduce SHA2-256")
    Fixes: 630e8875ab36 ("x86/ucode: Perform extra SHA2 checks on AMD Fam17h/19h microcode")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/x86/cpu/microcode/amd.c |  2 +-
 xen/lib/sha2-256.c               | 32 ++++++++++++++++----------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 27caed1028..ee7de5282b 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -99,7 +99,7 @@ static const struct patch_digest {
 #include "amd-patch-digests.c"
 };
 
-static int cmp_patch_id(const void *key, const void *elem)
+static int cf_check cmp_patch_id(const void *key, const void *elem)
 {
     const struct patch_digest *pd = elem;
     uint32_t patch_id = *(uint32_t *)key;
diff --git a/xen/lib/sha2-256.c b/xen/lib/sha2-256.c
index 4aeb8aa204..19e8252188 100644
--- a/xen/lib/sha2-256.c
+++ b/xen/lib/sha2-256.c
@@ -56,22 +56,22 @@ static uint32_t blend(uint32_t W[16], unsigned int i)
 }
 
 static const uint32_t K[] = {
-    0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
-    0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
-    0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
-    0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
-    0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
-    0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
-    0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
-    0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
-    0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
-    0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
-    0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
-    0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
-    0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
-    0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
-    0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
-    0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
+    0x428a2f98U, 0x71374491U, 0xb5c0fbcfU, 0xe9b5dba5U,
+    0x3956c25bU, 0x59f111f1U, 0x923f82a4U, 0xab1c5ed5U,
+    0xd807aa98U, 0x12835b01U, 0x243185beU, 0x550c7dc3U,
+    0x72be5d74U, 0x80deb1feU, 0x9bdc06a7U, 0xc19bf174U,
+    0xe49b69c1U, 0xefbe4786U, 0x0fc19dc6U, 0x240ca1ccU,
+    0x2de92c6fU, 0x4a7484aaU, 0x5cb0a9dcU, 0x76f988daU,
+    0x983e5152U, 0xa831c66dU, 0xb00327c8U, 0xbf597fc7U,
+    0xc6e00bf3U, 0xd5a79147U, 0x06ca6351U, 0x14292967U,
+    0x27b70a85U, 0x2e1b2138U, 0x4d2c6dfcU, 0x53380d13U,
+    0x650a7354U, 0x766a0abbU, 0x81c2c92eU, 0x92722c85U,
+    0xa2bfe8a1U, 0xa81a664bU, 0xc24b8b70U, 0xc76c51a3U,
+    0xd192e819U, 0xd6990624U, 0xf40e3585U, 0x106aa070U,
+    0x19a4c116U, 0x1e376c08U, 0x2748774cU, 0x34b0bcb5U,
+    0x391c0cb3U, 0x4ed8aa4aU, 0x5b9cca4fU, 0x682e6ff3U,
+    0x748f82eeU, 0x78a5636fU, 0x84c87814U, 0x8cc70208U,
+    0x90befffaU, 0xa4506cebU, 0xbef9a3f7U, 0xc67178f2U,
 };
 
 static void sha2_256_transform(uint32_t *state, const void *_input)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 00:44:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 00:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902979.1310894 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpzLH-0006sv-NK; Thu, 06 Mar 2025 00:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902979.1310894; Thu, 06 Mar 2025 00:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpzLH-0006sn-KD; Thu, 06 Mar 2025 00:44:03 +0000
Received: by outflank-mailman (input) for mailman id 902979;
 Thu, 06 Mar 2025 00:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpzLG-0006sh-5s
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 00:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpzLG-003RIy-0L
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 00:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpzLF-009387-2Q
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 00:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZtSwyhlu0JKK5wMr53c6nDq6BJNG3ovUEEutG+QzCOA=; b=WbYZ5dsozhBBXkZwEiN8d2PWxp
	syV0kNJDOWdztrTp9iYXaOSs34AMpEd/1n/dJ9eBMvpGWmdSEcz8lWmJRb8Yla8zXSZ/9f1VM65XD
	XBcF4JJlugY7U5S7U+XSIhEgSNDgAbfk03asil2XqTOGngDxuyi2EXzXoOlwzY9KD8tI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/lib: Introduce SHA2-256
Message-Id: <E1tpzLF-009387-2Q@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 00:44:01 +0000

commit 372af524411f5a013bcb0b117073d8d07c026563
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 13 14:34:00 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 5 19:04:37 2025 +0000

    xen/lib: Introduce SHA2-256
    
    A future change will need to calculate SHA2-256 digests.  Introduce an
    implementation in lib/, derived from Trenchboot which itself is derived from
    Linux.
    
    In order to be useful to other architectures, it is careful with endianness
    and misaligned accesses as well as being more MISRA friendly, but is only
    wired up for x86 in the short term.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/include/xen/sha2.h |  15 +++
 xen/lib/Makefile       |   1 +
 xen/lib/sha2-256.c     | 264 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 280 insertions(+)

diff --git a/xen/include/xen/sha2.h b/xen/include/xen/sha2.h
new file mode 100644
index 0000000000..47d97fbf01
--- /dev/null
+++ b/xen/include/xen/sha2.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * SHA2-256: https://csrc.nist.gov/pubs/fips/180-2/upd1/final
+ */
+#ifndef XEN_SHA2_H
+#define XEN_SHA2_H
+
+#include <xen/types.h>
+
+#define SHA2_256_DIGEST_SIZE 32
+
+void sha2_256_digest(uint8_t digest[SHA2_256_DIGEST_SIZE],
+                     const void *msg, size_t len);
+
+#endif /* XEN_SHA2_H */
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 54440f628a..76dc86fab0 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -17,6 +17,7 @@ lib-y += memset.o
 lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
+lib-$(CONFIG_X86) += sha2-256.o
 lib-y += sort.o
 lib-y += strcasecmp.o
 lib-y += strchr.o
diff --git a/xen/lib/sha2-256.c b/xen/lib/sha2-256.c
new file mode 100644
index 0000000000..4aeb8aa204
--- /dev/null
+++ b/xen/lib/sha2-256.c
@@ -0,0 +1,264 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * SHA2-256: https://csrc.nist.gov/pubs/fips/180-2/upd1/final
+ *
+ * Originally derived from Linux.  Modified substantially to optimise for size
+ * and Xen's expected usecases.
+ */
+#include <xen/bitops.h>
+#include <xen/sha2.h>
+#include <xen/string.h>
+#include <xen/unaligned.h>
+
+struct sha2_256_state {
+    uint32_t state[SHA2_256_DIGEST_SIZE / sizeof(uint32_t)];
+    uint8_t buf[64];
+    size_t count; /* Byte count. */
+};
+
+static uint32_t choose(uint32_t x, uint32_t y, uint32_t z)
+{
+    return z ^ (x & (y ^ z));
+}
+
+static uint32_t majority(uint32_t x, uint32_t y, uint32_t z)
+{
+    return (x & y) | (z & (x | y));
+}
+
+static uint32_t e0(uint32_t x)
+{
+    return ror32(x, 2) ^ ror32(x, 13) ^ ror32(x, 22);
+}
+
+static uint32_t e1(uint32_t x)
+{
+    return ror32(x, 6) ^ ror32(x, 11) ^ ror32(x, 25);
+}
+
+static uint32_t s0(uint32_t x)
+{
+    return ror32(x, 7) ^ ror32(x, 18) ^ (x >> 3);
+}
+
+static uint32_t s1(uint32_t x)
+{
+    return ror32(x, 17) ^ ror32(x, 19) ^ (x >> 10);
+}
+
+static uint32_t blend(uint32_t W[16], unsigned int i)
+{
+#define W(i) W[(i) & 15]
+
+    return W(i) += s1(W(i - 2)) + W(i - 7) + s0(W(i - 15));
+
+#undef W
+}
+
+static const uint32_t K[] = {
+    0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
+    0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+    0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+    0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+    0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+    0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+    0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
+    0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+    0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
+    0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+    0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
+    0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+    0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
+    0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+    0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+    0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
+};
+
+static void sha2_256_transform(uint32_t *state, const void *_input)
+{
+    const uint32_t *input = _input;
+    uint32_t a, b, c, d, e, f, g, h, t1, t2;
+    uint32_t W[16];
+    unsigned int i;
+
+    for ( i = 0; i < 16; i++ )
+        W[i] = get_unaligned_be32(&input[i]);
+
+    a = state[0]; b = state[1]; c = state[2]; d = state[3];
+    e = state[4]; f = state[5]; g = state[6]; h = state[7];
+
+    for ( i = 0; i < 16; i += 8 )
+    {
+        t1 = h + e1(e) + choose(e, f, g) + K[i + 0] + W[i + 0];
+        t2 = e0(a) + majority(a, b, c);    d += t1;    h = t1 + t2;
+        t1 = g + e1(d) + choose(d, e, f) + K[i + 1] + W[i + 1];
+        t2 = e0(h) + majority(h, a, b);    c += t1;    g = t1 + t2;
+        t1 = f + e1(c) + choose(c, d, e) + K[i + 2] + W[i + 2];
+        t2 = e0(g) + majority(g, h, a);    b += t1;    f = t1 + t2;
+        t1 = e + e1(b) + choose(b, c, d) + K[i + 3] + W[i + 3];
+        t2 = e0(f) + majority(f, g, h);    a += t1;    e = t1 + t2;
+        t1 = d + e1(a) + choose(a, b, c) + K[i + 4] + W[i + 4];
+        t2 = e0(e) + majority(e, f, g);    h += t1;    d = t1 + t2;
+        t1 = c + e1(h) + choose(h, a, b) + K[i + 5] + W[i + 5];
+        t2 = e0(d) + majority(d, e, f);    g += t1;    c = t1 + t2;
+        t1 = b + e1(g) + choose(g, h, a) + K[i + 6] + W[i + 6];
+        t2 = e0(c) + majority(c, d, e);    f += t1;    b = t1 + t2;
+        t1 = a + e1(f) + choose(f, g, h) + K[i + 7] + W[i + 7];
+        t2 = e0(b) + majority(b, c, d);    e += t1;    a = t1 + t2;
+    }
+
+    for ( ; i < 64; i += 8 )
+    {
+        t1 = h + e1(e) + choose(e, f, g) + K[i + 0] + blend(W, i + 0);
+        t2 = e0(a) + majority(a, b, c);    d += t1;    h = t1 + t2;
+        t1 = g + e1(d) + choose(d, e, f) + K[i + 1] + blend(W, i + 1);
+        t2 = e0(h) + majority(h, a, b);    c += t1;    g = t1 + t2;
+        t1 = f + e1(c) + choose(c, d, e) + K[i + 2] + blend(W, i + 2);
+        t2 = e0(g) + majority(g, h, a);    b += t1;    f = t1 + t2;
+        t1 = e + e1(b) + choose(b, c, d) + K[i + 3] + blend(W, i + 3);
+        t2 = e0(f) + majority(f, g, h);    a += t1;    e = t1 + t2;
+        t1 = d + e1(a) + choose(a, b, c) + K[i + 4] + blend(W, i + 4);
+        t2 = e0(e) + majority(e, f, g);    h += t1;    d = t1 + t2;
+        t1 = c + e1(h) + choose(h, a, b) + K[i + 5] + blend(W, i + 5);
+        t2 = e0(d) + majority(d, e, f);    g += t1;    c = t1 + t2;
+        t1 = b + e1(g) + choose(g, h, a) + K[i + 6] + blend(W, i + 6);
+        t2 = e0(c) + majority(c, d, e);    f += t1;    b = t1 + t2;
+        t1 = a + e1(f) + choose(f, g, h) + K[i + 7] + blend(W, i + 7);
+        t2 = e0(b) + majority(b, c, d);    e += t1;    a = t1 + t2;
+    }
+
+    state[0] += a; state[1] += b; state[2] += c; state[3] += d;
+    state[4] += e; state[5] += f; state[6] += g; state[7] += h;
+}
+
+static void sha2_256_init(struct sha2_256_state *s)
+{
+    *s = (struct sha2_256_state){
+        .state = {
+            0x6a09e667UL,
+            0xbb67ae85UL,
+            0x3c6ef372UL,
+            0xa54ff53aUL,
+            0x510e527fUL,
+            0x9b05688cUL,
+            0x1f83d9abUL,
+            0x5be0cd19UL,
+        },
+    };
+}
+
+static void sha2_256_update(struct sha2_256_state *s, const void *msg,
+                            size_t len)
+{
+    unsigned int partial = s->count & 63;
+
+    s->count += len;
+
+    if ( (partial + len) >= 64 )
+    {
+        if ( partial )
+        {
+            unsigned int rem = 64 - partial;
+
+            /* Fill the partial block. */
+            memcpy(s->buf + partial, msg, rem);
+            msg += rem;
+            len -= rem;
+
+            sha2_256_transform(s->state, s->buf);
+            partial = 0;
+        }
+
+        for ( ; len >= 64; msg += 64, len -= 64 )
+            sha2_256_transform(s->state, msg);
+    }
+
+    /* Remaining data becomes partial. */
+    memcpy(s->buf + partial, msg, len);
+}
+
+static void sha2_256_final(struct sha2_256_state *s, void *_dst)
+{
+    uint32_t *dst = _dst;
+    unsigned int i, partial = s->count & 63;
+
+    /* Start padding */
+    s->buf[partial++] = 0x80;
+
+    if ( partial > 56 )
+    {
+        /* Need one extra block - pad to 64 */
+        memset(s->buf + partial, 0, 64 - partial);
+        sha2_256_transform(s->state, s->buf);
+        partial = 0;
+    }
+    /* Pad to 56 */
+    memset(s->buf + partial, 0, 56 - partial);
+
+    /* Append the bit count */
+    put_unaligned_be64((uint64_t)s->count << 3, &s->buf[56]);
+    sha2_256_transform(s->state, s->buf);
+
+    /* Store state in digest */
+    for ( i = 0; i < 8; i++ )
+        put_unaligned_be32(s->state[i], &dst[i]);
+}
+
+void sha2_256_digest(uint8_t digest[SHA2_256_DIGEST_SIZE],
+                     const void *msg, size_t len)
+{
+    struct sha2_256_state s;
+
+    sha2_256_init(&s);
+    sha2_256_update(&s, msg, len);
+    sha2_256_final(&s, digest);
+}
+
+#ifdef CONFIG_SELF_TESTS
+
+#include <xen/init.h>
+#include <xen/lib.h>
+
+static const struct test {
+    const char *msg;
+    uint8_t digest[SHA2_256_DIGEST_SIZE];
+} tests[] __initconst = {
+    {
+        .msg = "abc",
+        .digest = {
+            0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
+            0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
+            0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
+            0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad,
+        },
+    },
+    {
+        .msg = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
+        .digest = {
+            0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
+            0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
+            0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
+            0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1,
+        },
+    },
+};
+
+static void __init __constructor test_sha2_256(void)
+{
+    for ( unsigned int i = 0; i < ARRAY_SIZE(tests); ++i )
+    {
+        const struct test *t = &tests[i];
+        uint8_t res[SHA2_256_DIGEST_SIZE] = {};
+
+        sha2_256_digest(res, t->msg, strlen(t->msg));
+
+        if ( memcmp(res, t->digest, sizeof(t->digest)) == 0 )
+            continue;
+
+        panic("%s() msg '%s' failed\n"
+              "  expected %" STR(SHA2_256_DIGEST_SIZE) "phN\n"
+              "       got %" STR(SHA2_256_DIGEST_SIZE) "phN\n",
+              __func__, t->msg, t->digest, res);
+    }
+}
+#endif /* CONFIG_SELF_TESTS */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 00:44:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 00:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902980.1310898 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpzLQ-0006ul-Qk; Thu, 06 Mar 2025 00:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902980.1310898; Thu, 06 Mar 2025 00:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpzLQ-0006ud-Nt; Thu, 06 Mar 2025 00:44:12 +0000
Received: by outflank-mailman (input) for mailman id 902980;
 Thu, 06 Mar 2025 00:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpzLQ-0006uR-3b
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 00:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpzLQ-003RJ8-0f
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 00:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpzLP-00938y-30
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 00:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Jz5HNFhD0fWPPVt2gHSHzSAgYCa6RJIWhWEzCY1NL4s=; b=j7MFZ8fC9Z1g4CXH+0or21rVRx
	x2Ghq4Sh3JgC7rMumslNY2umD2dKnBvCTGXwgZSoIbBJx+Pn+81HnsrPkYvXoBnvmOmXr7rWmmoU7
	fUTj3t22m16t2Bqm6khAwvWrfDHe6RUFqAQRNWKssy+Ik88jlE6rX9McjBqYq7dLFOxs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: Perform extra SHA2 checks on AMD Fam17h/19h microcode
Message-Id: <E1tpzLP-00938y-30@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 00:44:11 +0000

commit 630e8875ab368b97cc7231aaf3809e3d7d5687e1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 13 14:34:00 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 5 19:04:37 2025 +0000

    x86/ucode: Perform extra SHA2 checks on AMD Fam17h/19h microcode
    
    Collisions have been found in the microcode signing algorithm used by AMD
    Fam17h/19h CPUs, and now anyone can sign their own.
    
    For more details, see:
      https://bughunters.google.com/blog/5424842357473280/zen-and-the-art-of-microcode-hacking
      https://www.amd.com/en/resources/product-security/bulletin/amd-sb-7033.html
    
    As a stopgap mitigation, check the digest of patches against a table of blobs
    with known provenance.  These are all Fam17h and Fam19h blobs included in
    linux-firwmare at the time of writing, specifically:
    
      https://git.kernel.org/firmware/linux-firmware/c/48bb90cceb882cab8e9ab692bc5779d3bf3a13b8
    
    This checks can be opted out of by booting with ucode=no-digest-check, but
    doing so is not recommended.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 docs/misc/xen-command-line.pandoc              |  10 +-
 xen/arch/x86/cpu/microcode/amd-patch-digests.c | 226 +++++++++++++++++++++++++
 xen/arch/x86/cpu/microcode/amd.c               |  66 +++++++-
 xen/arch/x86/cpu/microcode/core.c              |   3 +
 xen/arch/x86/cpu/microcode/private.h           |   2 +
 5 files changed, 304 insertions(+), 3 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 7e0f81adab..89db6e83be 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2735,10 +2735,10 @@ performance.
    Alternatively, selecting `tsx=1` will re-enable TSX at the users own risk.
 
 ### ucode
-> `= List of [ <integer> | scan=<bool>, nmi=<bool> ]`
+> `= List of [ <integer> | scan=<bool>, nmi=<bool>, digest-check=<bool> ]`
 
     Applicability: x86
-    Default: `scan` is selectable via Kconfig, `nmi=true`
+    Default: `scan` is selectable via Kconfig, `nmi,digest-check`
 
 Controls for CPU microcode loading. For early loading, this parameter can
 specify how and where to find the microcode update blob. For late loading,
@@ -2768,6 +2768,12 @@ precedence over `scan`. The default value for `scan` is set with
 stop_machine context. In NMI handler, even NMIs are blocked, which is
 considered safer. The default value is `true`.
 
+The `digest-check=` option is active by default and controls whether to
+perform additional authenticity checks.  Collisions in the signature algorithm
+used by AMD Fam17h/19h processors have been found.  Xen contains a table of
+digests of microcode patches with known-good provenance, and will block
+loading of patches that do not match.
+
 ### unrestricted_guest (Intel)
 > `= <boolean>`
 
diff --git a/xen/arch/x86/cpu/microcode/amd-patch-digests.c b/xen/arch/x86/cpu/microcode/amd-patch-digests.c
new file mode 100644
index 0000000000..d327612267
--- /dev/null
+++ b/xen/arch/x86/cpu/microcode/amd-patch-digests.c
@@ -0,0 +1,226 @@
+/* Generated from linux-firmware. */
+{
+    .patch_id = 0x0800126f,
+    .digest = {
+        0x2b, 0x5a, 0xf2, 0x9c, 0xdd, 0xd2, 0x7f, 0xec,
+        0xec, 0x96, 0x09, 0x57, 0xb0, 0x96, 0x29, 0x8b,
+        0x2e, 0x26, 0x91, 0xf0, 0x49, 0x33, 0x42, 0x18,
+        0xdd, 0x4b, 0x65, 0x5a, 0xd4, 0x15, 0x3d, 0x33,
+    },
+},
+{
+    .patch_id = 0x0800820d,
+    .digest = {
+        0x68, 0x98, 0x83, 0xcd, 0x22, 0x0d, 0xdd, 0x59,
+        0x73, 0x2c, 0x5b, 0x37, 0x1f, 0x84, 0x0e, 0x67,
+        0x96, 0x43, 0x83, 0x0c, 0x46, 0x44, 0xab, 0x7c,
+        0x7b, 0x65, 0x9e, 0x57, 0xb5, 0x90, 0x4b, 0x0e,
+    },
+},
+{
+    .patch_id = 0x0830107c,
+    .digest = {
+        0x21, 0x64, 0xde, 0xfb, 0x9f, 0x68, 0x96, 0x47,
+        0x70, 0x5c, 0xe2, 0x8f, 0x18, 0x52, 0x6a, 0xac,
+        0xa4, 0xd2, 0x2e, 0xe0, 0xde, 0x68, 0x66, 0xc3,
+        0xeb, 0x1e, 0xd3, 0x3f, 0xbc, 0x51, 0x1d, 0x38,
+    },
+},
+{
+    .patch_id = 0x0860010d,
+    .digest = {
+        0x86, 0xb6, 0x15, 0x83, 0xbc, 0x3b, 0x9c, 0xe0,
+        0xb3, 0xef, 0x1d, 0x99, 0x84, 0x35, 0x15, 0xf7,
+        0x7c, 0x2a, 0xc6, 0x42, 0xdb, 0x73, 0x07, 0x5c,
+        0x7d, 0xc3, 0x02, 0xb5, 0x43, 0x06, 0x5e, 0xf8,
+    },
+},
+{
+    .patch_id = 0x08608108,
+    .digest = {
+        0x14, 0xfe, 0x57, 0x86, 0x49, 0xc8, 0x68, 0xe2,
+        0x11, 0xa3, 0xcb, 0x6e, 0xff, 0x6e, 0xd5, 0x38,
+        0xfe, 0x89, 0x1a, 0xe0, 0x67, 0xbf, 0xc4, 0xcc,
+        0x1b, 0x9f, 0x84, 0x77, 0x2b, 0x9f, 0xaa, 0xbd,
+    },
+},
+{
+    .patch_id = 0x08701034,
+    .digest = {
+        0xc3, 0x14, 0x09, 0xa8, 0x9c, 0x3f, 0x8d, 0x83,
+        0x9b, 0x4c, 0xa5, 0xb7, 0x64, 0x8b, 0x91, 0x5d,
+        0x85, 0x6a, 0x39, 0x26, 0x1e, 0x14, 0x41, 0xa8,
+        0x75, 0xea, 0xa6, 0xf9, 0xc9, 0xd1, 0xea, 0x2b,
+    },
+},
+{
+    .patch_id = 0x08a0000a,
+    .digest = {
+        0x73, 0x31, 0x26, 0x22, 0xd4, 0xf9, 0xee, 0x3c,
+        0x07, 0x06, 0xe7, 0xb9, 0xad, 0xd8, 0x72, 0x44,
+        0x33, 0x31, 0xaa, 0x7d, 0xc3, 0x67, 0x0e, 0xdb,
+        0x47, 0xb5, 0xaa, 0xbc, 0xf5, 0xbb, 0xd9, 0x20,
+    },
+},
+{
+    .patch_id = 0x0a00107a,
+    .digest = {
+        0x5f, 0x92, 0xca, 0xff, 0xc3, 0x59, 0x22, 0x5f,
+        0x02, 0xa0, 0x91, 0x3b, 0x4a, 0x45, 0x10, 0xfd,
+        0x19, 0xe1, 0x8a, 0x6d, 0x9a, 0x92, 0xc1, 0x3f,
+        0x75, 0x78, 0xac, 0x78, 0x03, 0x1d, 0xdb, 0x18,
+    },
+},
+{
+    .patch_id = 0x0a0011d5,
+    .digest = {
+        0xed, 0x69, 0x89, 0xf4, 0xeb, 0x64, 0xc2, 0x13,
+        0xe0, 0x51, 0x1f, 0x03, 0x26, 0x52, 0x7d, 0xb7,
+        0x93, 0x5d, 0x65, 0xca, 0xb8, 0x12, 0x1d, 0x62,
+        0x0d, 0x5b, 0x65, 0x34, 0x69, 0xb2, 0x62, 0x21,
+    },
+},
+{
+    .patch_id = 0x0a001238,
+    .digest = {
+        0x72, 0xf7, 0x4b, 0x0c, 0x7d, 0x58, 0x65, 0xcc,
+        0x00, 0xcc, 0x57, 0x16, 0x68, 0x16, 0xf8, 0x2a,
+        0x1b, 0xb3, 0x8b, 0xe1, 0xb6, 0x83, 0x8c, 0x7e,
+        0xc0, 0xcd, 0x33, 0xf2, 0x8d, 0xf9, 0xef, 0x59,
+    },
+},
+{
+    .patch_id = 0x0a00820c,
+    .digest = {
+        0xa8, 0x0c, 0x81, 0xc0, 0xa6, 0x00, 0xe7, 0xf3,
+        0x5f, 0x65, 0xd3, 0xb9, 0x6f, 0xea, 0x93, 0x63,
+        0xf1, 0x8c, 0x88, 0x45, 0xd7, 0x82, 0x80, 0xd1,
+        0xe1, 0x3b, 0x8d, 0xb2, 0xf8, 0x22, 0x03, 0xe2,
+    },
+},
+{
+    .patch_id = 0x0a101148,
+    .digest = {
+        0x20, 0xd5, 0x6f, 0x40, 0x4a, 0xf6, 0x48, 0x90,
+        0xc2, 0x93, 0x9a, 0xc2, 0xfd, 0xac, 0xef, 0x4f,
+        0xfa, 0xc0, 0x3d, 0x92, 0x3c, 0x6d, 0x01, 0x08,
+        0xf1, 0x5e, 0xb0, 0xde, 0xb4, 0x98, 0xae, 0xc4,
+    },
+},
+{
+    .patch_id = 0x0a101248,
+    .digest = {
+        0xed, 0x3b, 0x95, 0xa6, 0x68, 0xa7, 0x77, 0x3e,
+        0xfc, 0x17, 0x26, 0xe2, 0x7b, 0xd5, 0x56, 0x22,
+        0x2c, 0x1d, 0xef, 0xeb, 0x56, 0xdd, 0xba, 0x6e,
+        0x1b, 0x7d, 0x64, 0x9d, 0x4b, 0x53, 0x13, 0x75,
+    },
+},
+{
+    .patch_id = 0x0a108108,
+    .digest = {
+        0xed, 0xc2, 0xec, 0xa1, 0x15, 0xc6, 0x65, 0xe9,
+        0xd0, 0xef, 0x39, 0xaa, 0x7f, 0x55, 0x06, 0xc6,
+        0xf5, 0xd4, 0x3f, 0x7b, 0x14, 0xd5, 0x60, 0x2c,
+        0x28, 0x1e, 0x9c, 0x59, 0x69, 0x99, 0x4d, 0x16,
+    },
+},
+{
+    .patch_id = 0x0a20102d,
+    .digest = {
+        0xf9, 0x6e, 0xf2, 0x32, 0xd3, 0x0f, 0x5f, 0x11,
+        0x59, 0xa1, 0xfe, 0xcc, 0xcd, 0x9b, 0x42, 0x89,
+        0x8b, 0x89, 0x2f, 0xb5, 0xbb, 0x82, 0xef, 0x23,
+        0x8c, 0xe9, 0x19, 0x3e, 0xcc, 0x3f, 0x7b, 0xb4,
+    },
+},
+{
+    .patch_id = 0x0a201210,
+    .digest = {
+        0xe8, 0x6d, 0x51, 0x6a, 0x8e, 0x72, 0xf3, 0xfe,
+        0x6e, 0x16, 0xbc, 0x62, 0x59, 0x40, 0x17, 0xe9,
+        0x6d, 0x3d, 0x0e, 0x6b, 0xa7, 0xac, 0xe3, 0x68,
+        0xf7, 0x55, 0xf0, 0x13, 0xbb, 0x22, 0xf6, 0x41,
+    },
+},
+{
+    .patch_id = 0x0a404107,
+    .digest = {
+        0xbb, 0x04, 0x4e, 0x47, 0xdd, 0x5e, 0x26, 0x45,
+        0x1a, 0xc9, 0x56, 0x24, 0xa4, 0x4c, 0x82, 0xb0,
+        0x8b, 0x0d, 0x9f, 0xf9, 0x3a, 0xdf, 0xc6, 0x81,
+        0x13, 0xbc, 0xc5, 0x25, 0xe4, 0xc5, 0xc3, 0x99,
+    },
+},
+{
+    .patch_id = 0x0a500011,
+    .digest = {
+        0x23, 0x3d, 0x70, 0x7d, 0x03, 0xc3, 0xc4, 0xf4,
+        0x2b, 0x82, 0xc6, 0x05, 0xda, 0x80, 0x0a, 0xf1,
+        0xd7, 0x5b, 0x65, 0x3a, 0x7d, 0xab, 0xdf, 0xa2,
+        0x11, 0x5e, 0x96, 0x7e, 0x71, 0xe9, 0xfc, 0x74,
+    },
+},
+{
+    .patch_id = 0x0a601209,
+    .digest = {
+        0x66, 0x48, 0xd4, 0x09, 0x05, 0xcb, 0x29, 0x32,
+        0x66, 0xb7, 0x9a, 0x76, 0xcd, 0x11, 0xf3, 0x30,
+        0x15, 0x86, 0xcc, 0x5d, 0x97, 0x0f, 0xc0, 0x46,
+        0xe8, 0x73, 0xe2, 0xd6, 0xdb, 0xd2, 0x77, 0x1d,
+    },
+},
+{
+    .patch_id = 0x0a704107,
+    .digest = {
+        0xf3, 0xc6, 0x58, 0x26, 0xee, 0xac, 0x3f, 0xd6,
+        0xce, 0xa1, 0x72, 0x47, 0x3b, 0xba, 0x2b, 0x93,
+        0x2a, 0xad, 0x8e, 0x6b, 0xea, 0x9b, 0xb7, 0xc2,
+        0x64, 0x39, 0x71, 0x8c, 0xce, 0xe7, 0x41, 0x39,
+    },
+},
+{
+    .patch_id = 0x0a705206,
+    .digest = {
+        0x8d, 0xc0, 0x76, 0xbd, 0x58, 0x9f, 0x8f, 0xa4,
+        0x12, 0x9d, 0x21, 0xfb, 0x48, 0x21, 0xbc, 0xe7,
+        0x67, 0x6f, 0x04, 0x18, 0xae, 0x20, 0x87, 0x4b,
+        0x03, 0x35, 0xe9, 0xbe, 0xfb, 0x06, 0xdf, 0xfc,
+    },
+},
+{
+    .patch_id = 0x0a708007,
+    .digest = {
+        0x6b, 0x76, 0xcc, 0x78, 0xc5, 0x8a, 0xa3, 0xe3,
+        0x32, 0x2d, 0x79, 0xe4, 0xc3, 0x80, 0xdb, 0xb2,
+        0x07, 0xaa, 0x3a, 0xe0, 0x57, 0x13, 0x72, 0x80,
+        0xdf, 0x92, 0x73, 0x84, 0x87, 0x3c, 0x73, 0x93,
+    },
+},
+{
+    .patch_id = 0x0a70c005,
+    .digest = {
+        0x88, 0x5d, 0xfb, 0x79, 0x64, 0xd8, 0x46, 0x3b,
+        0x4a, 0x83, 0x8e, 0x77, 0x7e, 0xcf, 0xb3, 0x0f,
+        0x1f, 0x1f, 0xf1, 0x97, 0xeb, 0xfe, 0x56, 0x55,
+        0xee, 0x49, 0xac, 0xe1, 0x8b, 0x13, 0xc5, 0x13,
+    },
+},
+{
+    .patch_id = 0x0aa00116,
+    .digest = {
+        0xe8, 0x4c, 0x2c, 0x88, 0xa1, 0xac, 0x24, 0x63,
+        0x65, 0xe5, 0xaa, 0x2d, 0x16, 0xa9, 0xc3, 0xf5,
+        0xfe, 0x1d, 0x5e, 0x65, 0xc7, 0xaa, 0x92, 0x4d,
+        0x91, 0xee, 0x76, 0xbb, 0x4c, 0x66, 0x78, 0xc9,
+    },
+},
+{
+    .patch_id = 0x0aa00215,
+    .digest = {
+        0x55, 0xd3, 0x28, 0xcb, 0x87, 0xa9, 0x32, 0xe9,
+        0x4e, 0x85, 0x4b, 0x7c, 0x6b, 0xd5, 0x7c, 0xd4,
+        0x1b, 0x51, 0x71, 0x3a, 0x0e, 0x0b, 0xdc, 0x9b,
+        0x68, 0x2f, 0x46, 0xee, 0xfe, 0xc6, 0x6d, 0xef,
+    },
+},
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 9ee455b007..27caed1028 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -14,9 +14,11 @@
  *  License version 2. See file COPYING for details.
  */
 
+#include <xen/bsearch.h>
 #include <xen/err.h>
 #include <xen/init.h>
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
+#include <xen/sha2.h>
 
 #include <asm/msr.h>
 
@@ -90,6 +92,59 @@ static struct {
     uint16_t id;
 } equiv __read_mostly;
 
+static const struct patch_digest {
+    uint32_t patch_id;
+    uint8_t digest[SHA2_256_DIGEST_SIZE];
+} patch_digests[] = {
+#include "amd-patch-digests.c"
+};
+
+static int cmp_patch_id(const void *key, const void *elem)
+{
+    const struct patch_digest *pd = elem;
+    uint32_t patch_id = *(uint32_t *)key;
+
+    if ( patch_id == pd->patch_id )
+        return 0;
+    else if ( patch_id < pd->patch_id )
+        return -1;
+    return 1;
+}
+
+static bool check_digest(const struct container_microcode *mc)
+{
+    const struct microcode_patch *patch = mc->patch;
+    const struct patch_digest *pd;
+    uint8_t digest[SHA2_256_DIGEST_SIZE];
+
+    /* Only Fam17h/19h are known to need extra checks.  Skip other families. */
+    if ( boot_cpu_data.x86 < 0x17 || boot_cpu_data.x86 > 0x19 ||
+         !opt_digest_check )
+        return true;
+
+    pd = bsearch(&patch->patch_id, patch_digests, ARRAY_SIZE(patch_digests),
+                 sizeof(struct patch_digest), cmp_patch_id);
+    if ( !pd )
+    {
+        printk(XENLOG_WARNING "No digest found for patch_id %08x\n",
+               patch->patch_id);
+        return false;
+    }
+
+    sha2_256_digest(digest, patch, mc->len);
+
+    if ( memcmp(digest, pd->digest, sizeof(digest)) )
+    {
+        printk(XENLOG_WARNING "Patch %08x SHA256 mismatch:\n"
+               "  expected %" STR(SHA2_256_DIGEST_SIZE) "phN\n"
+               "       got %" STR(SHA2_256_DIGEST_SIZE) "phN\n",
+               patch->patch_id, pd->digest, digest);
+        return false;
+    }
+
+    return true;
+}
+
 static void cf_check collect_cpu_info(void)
 {
     struct cpu_signature *csig = &this_cpu(cpu_sig);
@@ -397,7 +452,8 @@ static struct microcode_patch *cf_check cpu_request_microcode(
             if ( microcode_fits_cpu(mc->patch) &&
                  (!saved ||
                   compare_revisions(saved->patch_id,
-                                    mc->patch->patch_id) == NEW_UCODE) )
+                                    mc->patch->patch_id) == NEW_UCODE) &&
+                 check_digest(mc) )
             {
                 saved = mc->patch;
                 saved_size = mc->len;
@@ -456,6 +512,14 @@ static const struct microcode_ops __initconst_cf_clobber amd_ucode_ops = {
 
 void __init ucode_probe_amd(struct microcode_ops *ops)
 {
+    if ( !opt_digest_check &&
+         boot_cpu_data.x86 >= 0x17 && boot_cpu_data.x86 <= 0x19 )
+    {
+        printk(XENLOG_WARNING
+               "Microcode patch additional digest checks disabled");
+        add_taint(TAINT_CPU_OUT_OF_SPEC);
+    }
+
     if ( boot_cpu_data.x86 < 0x10 )
         return;
 
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 9fe86942a3..34a94cd25b 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -101,6 +101,7 @@ static struct microcode_patch *microcode_cache;
  */
 static int __initdata opt_mod_idx;
 static bool __initdata opt_scan = IS_ENABLED(CONFIG_UCODE_SCAN_DEFAULT);
+bool __ro_after_init opt_digest_check = true;
 
 /*
  * Used by the EFI path only, when xen.cfg identifies an explicit microcode
@@ -130,6 +131,8 @@ static int __init cf_check parse_ucode(const char *s)
 
         if ( (val = parse_boolean("nmi", s, ss)) >= 0 )
             ucode_in_nmi = val;
+        else if ( (val = parse_boolean("digest-check", s, ss)) >= 0 )
+            opt_digest_check = val;
         else if ( !ucode_mod_forced ) /* Not forced by EFI */
         {
             if ( (val = parse_boolean("scan", s, ss)) >= 0 )
diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h
index 74bb2f0a65..f5e2bfee00 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -67,6 +67,8 @@ struct microcode_ops {
     const char *cpio_path;
 };
 
+extern bool opt_digest_check;
+
 /*
  * Microcode loading falls into one of 3 states.
  *   - No support at all
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 00:44:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 00:44:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.902981.1310902 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpzLa-0006y4-SA; Thu, 06 Mar 2025 00:44:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 902981.1310902; Thu, 06 Mar 2025 00:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tpzLa-0006xw-PS; Thu, 06 Mar 2025 00:44:22 +0000
Received: by outflank-mailman (input) for mailman id 902981;
 Thu, 06 Mar 2025 00:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tpzLa-0006xq-3G
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 00:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpzLa-003RJC-0z
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 00:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tpzLa-00939X-04
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 00:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jmBmX2DDSiFIm08KmYDT9fSIdtl4tchTfJNxkx/MEnI=; b=YQOmP3O1GMvLBP6mdLk3p9aViq
	7KLFCkck/ibWFwdNEI1ACdlNwP2td2ZcYj6OF2+Lh5sxk6JzRFDuN/bL7D97CwoQrToyilnp9yPgS
	25P57d8qS733AtZ6FEmecmG07l58xgcPA46tvZJq1Gt/y12vHCMmAreWJ98rfptDJevg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Xen: CI fixes from XSN-2
Message-Id: <E1tpzLa-00939X-04@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 00:44:22 +0000

commit 15fe2eb5f1bac8a212c0ba3d6dfe60d1fdf851cf
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Mar 5 22:17:22 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 5 23:27:53 2025 +0000

    Xen: CI fixes from XSN-2
    
     * Add cf_check annotation to cmp_patch_id() used by bsearch().
     * Add U suffix to the K[] table to fix MISRA Rule 7.2 violations.
    
    Fixes: 372af524411f ("xen/lib: Introduce SHA2-256")
    Fixes: 630e8875ab36 ("x86/ucode: Perform extra SHA2 checks on AMD Fam17h/19h microcode")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/x86/cpu/microcode/amd.c |  2 +-
 xen/lib/sha2-256.c               | 32 ++++++++++++++++----------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 27caed1028..ee7de5282b 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -99,7 +99,7 @@ static const struct patch_digest {
 #include "amd-patch-digests.c"
 };
 
-static int cmp_patch_id(const void *key, const void *elem)
+static int cf_check cmp_patch_id(const void *key, const void *elem)
 {
     const struct patch_digest *pd = elem;
     uint32_t patch_id = *(uint32_t *)key;
diff --git a/xen/lib/sha2-256.c b/xen/lib/sha2-256.c
index 4aeb8aa204..19e8252188 100644
--- a/xen/lib/sha2-256.c
+++ b/xen/lib/sha2-256.c
@@ -56,22 +56,22 @@ static uint32_t blend(uint32_t W[16], unsigned int i)
 }
 
 static const uint32_t K[] = {
-    0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
-    0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
-    0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
-    0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
-    0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
-    0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
-    0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
-    0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
-    0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
-    0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
-    0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
-    0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
-    0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
-    0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
-    0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
-    0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
+    0x428a2f98U, 0x71374491U, 0xb5c0fbcfU, 0xe9b5dba5U,
+    0x3956c25bU, 0x59f111f1U, 0x923f82a4U, 0xab1c5ed5U,
+    0xd807aa98U, 0x12835b01U, 0x243185beU, 0x550c7dc3U,
+    0x72be5d74U, 0x80deb1feU, 0x9bdc06a7U, 0xc19bf174U,
+    0xe49b69c1U, 0xefbe4786U, 0x0fc19dc6U, 0x240ca1ccU,
+    0x2de92c6fU, 0x4a7484aaU, 0x5cb0a9dcU, 0x76f988daU,
+    0x983e5152U, 0xa831c66dU, 0xb00327c8U, 0xbf597fc7U,
+    0xc6e00bf3U, 0xd5a79147U, 0x06ca6351U, 0x14292967U,
+    0x27b70a85U, 0x2e1b2138U, 0x4d2c6dfcU, 0x53380d13U,
+    0x650a7354U, 0x766a0abbU, 0x81c2c92eU, 0x92722c85U,
+    0xa2bfe8a1U, 0xa81a664bU, 0xc24b8b70U, 0xc76c51a3U,
+    0xd192e819U, 0xd6990624U, 0xf40e3585U, 0x106aa070U,
+    0x19a4c116U, 0x1e376c08U, 0x2748774cU, 0x34b0bcb5U,
+    0x391c0cb3U, 0x4ed8aa4aU, 0x5b9cca4fU, 0x682e6ff3U,
+    0x748f82eeU, 0x78a5636fU, 0x84c87814U, 0x8cc70208U,
+    0x90befffaU, 0xa4506cebU, 0xbef9a3f7U, 0xc67178f2U,
 };
 
 static void sha2_256_transform(uint32_t *state, const void *_input)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 07:22:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 07:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903002.1310916 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tq5YR-0001WZ-PQ; Thu, 06 Mar 2025 07:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903002.1310916; Thu, 06 Mar 2025 07:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tq5YR-0001WR-MW; Thu, 06 Mar 2025 07:22:03 +0000
Received: by outflank-mailman (input) for mailman id 903002;
 Thu, 06 Mar 2025 07:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tq5YQ-0001WL-OU
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 07:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tq5YQ-004xsP-2A
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 07:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tq5YQ-009hkY-1F
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 07:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lSC9GnMACzaxgaVYlU+jC1l1rjtamiaN9zgnQdi0FPk=; b=YXVA5fLMfLNL90V1gRxeKd4B13
	U7IwV1Xp9CWEQLLKPvTlodhqNLKTIREIDaYmvHpWTTLq6P2uTJdjh1Z09VxO82g4YGk39eTUBPLmN
	Ps+mnTTOxiA5cePD1gZMYXl4lHiINGm4K/sb8/BMmtBmaTPd1EdXOiohQUb50uY1slbA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: mpu: Move some of the definitions to common file
Message-Id: <E1tq5YQ-009hkY-1F@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 07:22:02 +0000

commit 9e6c7b78f2d53a70c4a10a9f7c7850c436ec94ae
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Mar 4 17:57:07 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 6 08:09:29 2025 +0100

    xen/arm: mpu: Move some of the definitions to common file
    
    For AArch32, refer to ARM DDI 0568A.c ID110520.
    MPU_REGION_SHIFT is same between AArch32 and AArch64 (HPRBAR).
    Also, NUM_MPU_REGIONS_SHIFT is same between AArch32 and AArch64
    (HMPUIR).
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm64/mpu/head.S           |  2 +-
 xen/arch/arm/include/asm/arm64/mpu.h    | 25 -------------------------
 xen/arch/arm/include/asm/early_printk.h |  2 +-
 xen/arch/arm/include/asm/mpu.h          | 26 ++++++++++++++++++++++++++
 4 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S
index e4f2021f45..4d00de4869 100644
--- a/xen/arch/arm/arm64/mpu/head.S
+++ b/xen/arch/arm/arm64/mpu/head.S
@@ -3,8 +3,8 @@
  * Start-of-day code for an Armv8-R MPU system.
  */
 
-#include <asm/arm64/mpu.h>
 #include <asm/early_printk.h>
+#include <asm/mpu.h>
 
 /* Backgroud region enable/disable */
 #define SCTLR_ELx_BR    BIT(17, UL)
diff --git a/xen/arch/arm/include/asm/arm64/mpu.h b/xen/arch/arm/include/asm/arm64/mpu.h
deleted file mode 100644
index f8a029f1a1..0000000000
--- a/xen/arch/arm/include/asm/arm64/mpu.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * mpu.h: Arm Memory Protection Unit definitions.
- */
-
-#ifndef __ARM64_MPU_H__
-#define __ARM64_MPU_H__
-
-#define MPU_REGION_SHIFT  6
-#define MPU_REGION_ALIGN  (_AC(1, UL) << MPU_REGION_SHIFT)
-#define MPU_REGION_MASK   (~(MPU_REGION_ALIGN - 1))
-
-#define NUM_MPU_REGIONS_SHIFT   8
-#define NUM_MPU_REGIONS         (_AC(1, UL) << NUM_MPU_REGIONS_SHIFT)
-#define NUM_MPU_REGIONS_MASK    (NUM_MPU_REGIONS - 1)
-#endif /* __ARM64_MPU_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/arm/include/asm/early_printk.h b/xen/arch/arm/include/asm/early_printk.h
index 219705a8b6..a8af5bbd4b 100644
--- a/xen/arch/arm/include/asm/early_printk.h
+++ b/xen/arch/arm/include/asm/early_printk.h
@@ -11,8 +11,8 @@
 #define __ARM_EARLY_PRINTK_H__
 
 #include <xen/page-size.h>
-#include <asm/arm64/mpu.h>
 #include <asm/fixmap.h>
+#include <asm/mpu.h>
 
 #ifdef CONFIG_EARLY_PRINTK
 
diff --git a/xen/arch/arm/include/asm/mpu.h b/xen/arch/arm/include/asm/mpu.h
new file mode 100644
index 0000000000..d4ec4248b6
--- /dev/null
+++ b/xen/arch/arm/include/asm/mpu.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * mpu.h: Arm Memory Protection Unit definitions.
+ */
+
+#ifndef __ARM_MPU_H__
+#define __ARM_MPU_H__
+
+#define MPU_REGION_SHIFT  6
+#define MPU_REGION_ALIGN  (_AC(1, UL) << MPU_REGION_SHIFT)
+#define MPU_REGION_MASK   (~(MPU_REGION_ALIGN - 1))
+
+#define NUM_MPU_REGIONS_SHIFT   8
+#define NUM_MPU_REGIONS         (_AC(1, UL) << NUM_MPU_REGIONS_SHIFT)
+#define NUM_MPU_REGIONS_MASK    (NUM_MPU_REGIONS - 1)
+
+#endif /* __ARM_MPU_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 07:22:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 07:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903003.1310920 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tq5Yb-0001YC-Qn; Thu, 06 Mar 2025 07:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903003.1310920; Thu, 06 Mar 2025 07:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tq5Yb-0001Y4-Nx; Thu, 06 Mar 2025 07:22:13 +0000
Received: by outflank-mailman (input) for mailman id 903003;
 Thu, 06 Mar 2025 07:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tq5Ya-0001Xs-Ig
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 07:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tq5Ya-004xsa-2W
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 07:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tq5Ya-009hlQ-1a
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 07:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5fcu09cJPdetnQ0ha0lXGD+aL3fXQ7WqdRfb6f9vebs=; b=jPxr5Zy+uTaOEzWzByT11AJHFb
	EKyfqZtud9p9FNiUj5+9swm86sCPNCUmF0ULReB5zXaU85wHlK0idLqTtsb63sXj+4GZHMqB3HOmo
	zwNcwOPF4Gf5NM+BStVQu5z5Vry3azM6yNrUAq1pXzPhQP+qzxwTP+rjwRDq7wTPXYSY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: mpu: Ensure that the page size is 4KB
Message-Id: <E1tq5Ya-009hlQ-1a@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 07:22:12 +0000

commit de0254b90922a8644bb2c4c1593786d45c80ea22
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Mar 4 17:57:08 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 6 08:09:29 2025 +0100

    xen/arm: mpu: Ensure that the page size is 4KB
    
    Similar to commit (d736b6eb451b, "xen/arm: mpu: Define Xen start address for
    MPU systems"), one needs to add a build assertion to ensure that the page size
    is 4KB on arm32 based systems as well.
    The existing build assertion is moved under "xen/arch/arm/mpu" as it applies
    for both arm64 and arm32 based systems.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/arch/arm/Makefile           |  1 +
 xen/arch/arm/arm64/mpu/Makefile |  1 -
 xen/arch/arm/arm64/mpu/mm.c     | 15 ---------------
 xen/arch/arm/mpu/Makefile       |  1 +
 xen/arch/arm/mpu/mm.c           | 15 +++++++++++++++
 5 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 43ab5e8f25..fb0948f067 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -1,6 +1,7 @@
 obj-$(CONFIG_ARM_32) += arm32/
 obj-$(CONFIG_ARM_64) += arm64/
 obj-$(CONFIG_MMU) += mmu/
+obj-$(CONFIG_MPU) += mpu/
 obj-$(CONFIG_ACPI) += acpi/
 obj-$(CONFIG_HAS_PCI) += pci/
 ifneq ($(CONFIG_NO_PLAT),y)
diff --git a/xen/arch/arm/arm64/mpu/Makefile b/xen/arch/arm/arm64/mpu/Makefile
index a8a750a3d0..3340058c08 100644
--- a/xen/arch/arm/arm64/mpu/Makefile
+++ b/xen/arch/arm/arm64/mpu/Makefile
@@ -1,2 +1 @@
 obj-y += head.o
-obj-y += mm.o
diff --git a/xen/arch/arm/arm64/mpu/mm.c b/xen/arch/arm/arm64/mpu/mm.c
deleted file mode 100644
index 0b8748e575..0000000000
--- a/xen/arch/arm/arm64/mpu/mm.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <xen/lib.h>
-#include <xen/init.h>
-#include <xen/sizes.h>
-
-static void __init __maybe_unused build_assertions(void)
-{
-    /*
-     * Unlike MMU, MPU does not use pages for translation. However, we continue
-     * to use PAGE_SIZE to denote 4KB. This is so that the existing memory
-     * management based on pages, continue to work for now.
-     */
-    BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
-}
diff --git a/xen/arch/arm/mpu/Makefile b/xen/arch/arm/mpu/Makefile
new file mode 100644
index 0000000000..b18cec4836
--- /dev/null
+++ b/xen/arch/arm/mpu/Makefile
@@ -0,0 +1 @@
+obj-y += mm.o
diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c
new file mode 100644
index 0000000000..0b8748e575
--- /dev/null
+++ b/xen/arch/arm/mpu/mm.c
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/lib.h>
+#include <xen/init.h>
+#include <xen/sizes.h>
+
+static void __init __maybe_unused build_assertions(void)
+{
+    /*
+     * Unlike MMU, MPU does not use pages for translation. However, we continue
+     * to use PAGE_SIZE to denote 4KB. This is so that the existing memory
+     * management based on pages, continue to work for now.
+     */
+    BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 08:33:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 08:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903099.1311017 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tq6f9-0001gZ-Ut; Thu, 06 Mar 2025 08:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903099.1311017; Thu, 06 Mar 2025 08:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tq6f9-0001gQ-S6; Thu, 06 Mar 2025 08:33:03 +0000
Received: by outflank-mailman (input) for mailman id 903099;
 Thu, 06 Mar 2025 08:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tq6f8-0001gI-IQ
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 08:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tq6f8-004zks-1p
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 08:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tq6f8-009pkk-0w
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 08:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vBa9vuHqOCxGOid7F/ABDo7m850ig2zd0KV5NvUToPA=; b=WfSMAAImTeJ+od58yLpSW5i1Qn
	fM3274852zSpGE509rBxhdpZEvbYDpE5MGEDt9/Gwn66DBcPjSiuKIhmKpBTGvyKRjbSxFoh5tDtS
	nyFxrgqp3USn9yhFcelMekVYNoxRpczDOf5zTRA0LNdY2Fenr//gAIc32N0QzpOOm2t4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: mpu: Move some of the definitions to common file
Message-Id: <E1tq6f8-009pkk-0w@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 08:33:02 +0000

commit 9e6c7b78f2d53a70c4a10a9f7c7850c436ec94ae
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Mar 4 17:57:07 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 6 08:09:29 2025 +0100

    xen/arm: mpu: Move some of the definitions to common file
    
    For AArch32, refer to ARM DDI 0568A.c ID110520.
    MPU_REGION_SHIFT is same between AArch32 and AArch64 (HPRBAR).
    Also, NUM_MPU_REGIONS_SHIFT is same between AArch32 and AArch64
    (HMPUIR).
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm64/mpu/head.S           |  2 +-
 xen/arch/arm/include/asm/arm64/mpu.h    | 25 -------------------------
 xen/arch/arm/include/asm/early_printk.h |  2 +-
 xen/arch/arm/include/asm/mpu.h          | 26 ++++++++++++++++++++++++++
 4 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S
index e4f2021f45..4d00de4869 100644
--- a/xen/arch/arm/arm64/mpu/head.S
+++ b/xen/arch/arm/arm64/mpu/head.S
@@ -3,8 +3,8 @@
  * Start-of-day code for an Armv8-R MPU system.
  */
 
-#include <asm/arm64/mpu.h>
 #include <asm/early_printk.h>
+#include <asm/mpu.h>
 
 /* Backgroud region enable/disable */
 #define SCTLR_ELx_BR    BIT(17, UL)
diff --git a/xen/arch/arm/include/asm/arm64/mpu.h b/xen/arch/arm/include/asm/arm64/mpu.h
deleted file mode 100644
index f8a029f1a1..0000000000
--- a/xen/arch/arm/include/asm/arm64/mpu.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * mpu.h: Arm Memory Protection Unit definitions.
- */
-
-#ifndef __ARM64_MPU_H__
-#define __ARM64_MPU_H__
-
-#define MPU_REGION_SHIFT  6
-#define MPU_REGION_ALIGN  (_AC(1, UL) << MPU_REGION_SHIFT)
-#define MPU_REGION_MASK   (~(MPU_REGION_ALIGN - 1))
-
-#define NUM_MPU_REGIONS_SHIFT   8
-#define NUM_MPU_REGIONS         (_AC(1, UL) << NUM_MPU_REGIONS_SHIFT)
-#define NUM_MPU_REGIONS_MASK    (NUM_MPU_REGIONS - 1)
-#endif /* __ARM64_MPU_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/arm/include/asm/early_printk.h b/xen/arch/arm/include/asm/early_printk.h
index 219705a8b6..a8af5bbd4b 100644
--- a/xen/arch/arm/include/asm/early_printk.h
+++ b/xen/arch/arm/include/asm/early_printk.h
@@ -11,8 +11,8 @@
 #define __ARM_EARLY_PRINTK_H__
 
 #include <xen/page-size.h>
-#include <asm/arm64/mpu.h>
 #include <asm/fixmap.h>
+#include <asm/mpu.h>
 
 #ifdef CONFIG_EARLY_PRINTK
 
diff --git a/xen/arch/arm/include/asm/mpu.h b/xen/arch/arm/include/asm/mpu.h
new file mode 100644
index 0000000000..d4ec4248b6
--- /dev/null
+++ b/xen/arch/arm/include/asm/mpu.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * mpu.h: Arm Memory Protection Unit definitions.
+ */
+
+#ifndef __ARM_MPU_H__
+#define __ARM_MPU_H__
+
+#define MPU_REGION_SHIFT  6
+#define MPU_REGION_ALIGN  (_AC(1, UL) << MPU_REGION_SHIFT)
+#define MPU_REGION_MASK   (~(MPU_REGION_ALIGN - 1))
+
+#define NUM_MPU_REGIONS_SHIFT   8
+#define NUM_MPU_REGIONS         (_AC(1, UL) << NUM_MPU_REGIONS_SHIFT)
+#define NUM_MPU_REGIONS_MASK    (NUM_MPU_REGIONS - 1)
+
+#endif /* __ARM_MPU_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 08:33:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 08:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903100.1311020 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tq6fK-0001iW-04; Thu, 06 Mar 2025 08:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903100.1311020; Thu, 06 Mar 2025 08:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tq6fJ-0001iN-TX; Thu, 06 Mar 2025 08:33:13 +0000
Received: by outflank-mailman (input) for mailman id 903100;
 Thu, 06 Mar 2025 08:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tq6fI-0001iF-Ei
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 08:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tq6fI-004zkw-27
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 08:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tq6fI-009plm-1F
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 08:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5ohzLgMTrM8x4LKtHujwmMHGz+reCEY5mzobRufNp80=; b=P3KKV6yj+ACsNgcbRnsFjxsuhT
	P8Sf1SKe5NPKC68ejLZd/TjYvqtX31+BnnErNCS5sRoSgK4BhCcyCNfUGrI58lzwycL6e5UJ+KHOM
	6qY4KfkwuVsJiR2s95yMzRSxvY+EVmCLruPaiczMei1iQZlrT8Ma0pMMEpf+e6hPu3jE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: mpu: Ensure that the page size is 4KB
Message-Id: <E1tq6fI-009plm-1F@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 08:33:12 +0000

commit de0254b90922a8644bb2c4c1593786d45c80ea22
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Mar 4 17:57:08 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 6 08:09:29 2025 +0100

    xen/arm: mpu: Ensure that the page size is 4KB
    
    Similar to commit (d736b6eb451b, "xen/arm: mpu: Define Xen start address for
    MPU systems"), one needs to add a build assertion to ensure that the page size
    is 4KB on arm32 based systems as well.
    The existing build assertion is moved under "xen/arch/arm/mpu" as it applies
    for both arm64 and arm32 based systems.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/arch/arm/Makefile           |  1 +
 xen/arch/arm/arm64/mpu/Makefile |  1 -
 xen/arch/arm/arm64/mpu/mm.c     | 15 ---------------
 xen/arch/arm/mpu/Makefile       |  1 +
 xen/arch/arm/mpu/mm.c           | 15 +++++++++++++++
 5 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 43ab5e8f25..fb0948f067 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -1,6 +1,7 @@
 obj-$(CONFIG_ARM_32) += arm32/
 obj-$(CONFIG_ARM_64) += arm64/
 obj-$(CONFIG_MMU) += mmu/
+obj-$(CONFIG_MPU) += mpu/
 obj-$(CONFIG_ACPI) += acpi/
 obj-$(CONFIG_HAS_PCI) += pci/
 ifneq ($(CONFIG_NO_PLAT),y)
diff --git a/xen/arch/arm/arm64/mpu/Makefile b/xen/arch/arm/arm64/mpu/Makefile
index a8a750a3d0..3340058c08 100644
--- a/xen/arch/arm/arm64/mpu/Makefile
+++ b/xen/arch/arm/arm64/mpu/Makefile
@@ -1,2 +1 @@
 obj-y += head.o
-obj-y += mm.o
diff --git a/xen/arch/arm/arm64/mpu/mm.c b/xen/arch/arm/arm64/mpu/mm.c
deleted file mode 100644
index 0b8748e575..0000000000
--- a/xen/arch/arm/arm64/mpu/mm.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <xen/lib.h>
-#include <xen/init.h>
-#include <xen/sizes.h>
-
-static void __init __maybe_unused build_assertions(void)
-{
-    /*
-     * Unlike MMU, MPU does not use pages for translation. However, we continue
-     * to use PAGE_SIZE to denote 4KB. This is so that the existing memory
-     * management based on pages, continue to work for now.
-     */
-    BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
-}
diff --git a/xen/arch/arm/mpu/Makefile b/xen/arch/arm/mpu/Makefile
new file mode 100644
index 0000000000..b18cec4836
--- /dev/null
+++ b/xen/arch/arm/mpu/Makefile
@@ -0,0 +1 @@
+obj-y += mm.o
diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c
new file mode 100644
index 0000000000..0b8748e575
--- /dev/null
+++ b/xen/arch/arm/mpu/mm.c
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/lib.h>
+#include <xen/init.h>
+#include <xen/sizes.h>
+
+static void __init __maybe_unused build_assertions(void)
+{
+    /*
+     * Unlike MMU, MPU does not use pages for translation. However, we continue
+     * to use PAGE_SIZE to denote 4KB. This is so that the existing memory
+     * management based on pages, continue to work for now.
+     */
+    BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:11:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903485.1311365 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB0B-0006ML-6b; Thu, 06 Mar 2025 13:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903485.1311365; Thu, 06 Mar 2025 13:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB0B-0006MD-45; Thu, 06 Mar 2025 13:11:03 +0000
Received: by outflank-mailman (input) for mailman id 903485;
 Thu, 06 Mar 2025 13:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB0A-0006Lz-4N
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB0A-0055Z3-0Z
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB09-00AJTQ-2s
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UQ5EN5turrpBlxJyLOK54ViaWXQwymXsVTqyffRgDg0=; b=WG00zfLTVl+0/ZxfSp+dcX6SOV
	HoFDVh71L/561H5RvunPtd53SFI3CPGaNk/K55+2HluGID5BmMPJEpLhh/4Xrz+PvY6DwFKW7v9NU
	LZikIaRLyvkSO3WjpTKUheUPhbVa7RCkPY4VuHGKkvipTJ32iXAtsb43FjAsTUtjYbnc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] EFI: Avoid crash calling PrintErrMesg() from efi_multiboot2()
Message-Id: <E1tqB09-00AJTQ-2s@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:11:01 +0000

commit eaed0d185ab8b73cd18ac2830878520b3011f5ab
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Thu Mar 6 13:51:01 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:51:01 2025 +0100

    EFI: Avoid crash calling PrintErrMesg() from efi_multiboot2()
    
    Although code is compiled with -fpic option data is not position
    independent. This causes data pointer to become invalid if
    code is not relocated properly which is what happens for
    efi_multiboot2 which is called by multiboot entry code.
    
    Code tested adding
       PrintErrMesg(L"Test message", EFI_BUFFER_TOO_SMALL);
    in efi_multiboot2 before calling efi_arch_edd (this function
    can potentially call PrintErrMesg).
    
    Before the patch (XenServer installation on Qemu, xen replaced
    with vanilla xen.gz):
      Booting `XenServer (Serial)'Booting `XenServer (Serial)'
      Test message: !!!! X64 Exception Type - 0E(#PF - Page-Fault)  CPU Apic ID - 00000000 !!!!
      ExceptionData - 0000000000000000  I:0 R:0 U:0 W:0 P:0 PK:0 SS:0 SGX:0
      RIP  - 000000007EE21E9A, CS  - 0000000000000038, RFLAGS - 0000000000210246
      RAX  - 000000007FF0C1B5, RCX - 0000000000000050, RDX - 0000000000000010
      RBX  - 0000000000000000, RSP - 000000007FF0C180, RBP - 000000007FF0C210
      RSI  - FFFF82D040467CE8, RDI - 0000000000000000
      R8   - 000000007FF0C1C8, R9  - 000000007FF0C1C0, R10 - 0000000000000000
      R11  - 0000000000001020, R12 - FFFF82D040467CE8, R13 - 000000007FF0C1B8
      R14  - 000000007EA33328, R15 - 000000007EA332D8
      DS   - 0000000000000030, ES  - 0000000000000030, FS  - 0000000000000030
      GS   - 0000000000000030, SS  - 0000000000000030
      CR0  - 0000000080010033, CR2 - FFFF82D040467CE8, CR3 - 000000007FC01000
      CR4  - 0000000000000668, CR8 - 0000000000000000
      DR0  - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000
      DR3  - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400
      GDTR - 000000007F9DB000 0000000000000047, LDTR - 0000000000000000
      IDTR - 000000007F48E018 0000000000000FFF,   TR - 0000000000000000
      FXSAVE_STATE - 000000007FF0BDE0
      !!!! Find image based on IP(0x7EE21E9A) (No PDB)  (ImageBase=000000007EE20000, EntryPoint=000000007EE23935) !!!!
    
    After the patch:
      Booting `XenServer (Serial)'Booting `XenServer (Serial)'
      Test message: Buffer too small
      BdsDxe: loading Boot0000 "UiApp" from Fv(7CB8BDC9-F8EB-4F34-AAEA-3EE4AF6516A1)/FvFile(462CAA21-7614-4503-836E-8AB6F4662331)
      BdsDxe: starting Boot0000 "UiApp" from Fv(7CB8BDC9-F8EB-4F34-AAEA-3EE4AF6516A1)/FvFile(462CAA21-7614-4503-836E-8AB6F4662331)
    
    This partially rollback commit 00d5d5ce23e6.
    
    Fixes: 9180f5365524 ("x86: add multiboot2 protocol support for EFI platforms")
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/efi/boot.c        | 58 +++++++++++++++++++++++++++++---------------
 xen/common/efi/efi-common.mk |  1 +
 2 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index efbec00af9..143b5681ba 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -287,33 +287,53 @@ static bool __init match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2)
 /* generic routine for printing error messages */
 static void __init PrintErrMesg(const CHAR16 *mesg, EFI_STATUS ErrCode)
 {
-    static const CHAR16* const ErrCodeToStr[] __initconstrel = {
-        [~EFI_ERROR_MASK & EFI_NOT_FOUND]           = L"Not found",
-        [~EFI_ERROR_MASK & EFI_NO_MEDIA]            = L"The device has no media",
-        [~EFI_ERROR_MASK & EFI_MEDIA_CHANGED]       = L"Media changed",
-        [~EFI_ERROR_MASK & EFI_DEVICE_ERROR]        = L"Device error",
-        [~EFI_ERROR_MASK & EFI_VOLUME_CORRUPTED]    = L"Volume corrupted",
-        [~EFI_ERROR_MASK & EFI_ACCESS_DENIED]       = L"Access denied",
-        [~EFI_ERROR_MASK & EFI_OUT_OF_RESOURCES]    = L"Out of resources",
-        [~EFI_ERROR_MASK & EFI_VOLUME_FULL]         = L"Volume is full",
-        [~EFI_ERROR_MASK & EFI_SECURITY_VIOLATION]  = L"Security violation",
-        [~EFI_ERROR_MASK & EFI_CRC_ERROR]           = L"CRC error",
-        [~EFI_ERROR_MASK & EFI_COMPROMISED_DATA]    = L"Compromised data",
-        [~EFI_ERROR_MASK & EFI_BUFFER_TOO_SMALL]    = L"Buffer too small",
-    };
-    EFI_STATUS ErrIdx = ErrCode & ~EFI_ERROR_MASK;
-
     StdOut = StdErr;
     PrintErr(mesg);
     PrintErr(L": ");
 
-    if( (ErrIdx < ARRAY_SIZE(ErrCodeToStr)) && ErrCodeToStr[ErrIdx] )
-        mesg = ErrCodeToStr[ErrIdx];
-    else
+    switch (ErrCode)
     {
+    case EFI_NOT_FOUND:
+        mesg = L"Not found";
+        break;
+    case EFI_NO_MEDIA:
+        mesg = L"The device has no media";
+        break;
+    case EFI_MEDIA_CHANGED:
+        mesg = L"Media changed";
+        break;
+    case EFI_DEVICE_ERROR:
+        mesg = L"Device error";
+        break;
+    case EFI_VOLUME_CORRUPTED:
+        mesg = L"Volume corrupted";
+        break;
+    case EFI_ACCESS_DENIED:
+        mesg = L"Access denied";
+        break;
+    case EFI_OUT_OF_RESOURCES:
+        mesg = L"Out of resources";
+        break;
+    case EFI_VOLUME_FULL:
+        mesg = L"Volume is full";
+        break;
+    case EFI_SECURITY_VIOLATION:
+        mesg = L"Security violation";
+        break;
+    case EFI_CRC_ERROR:
+        mesg = L"CRC error";
+        break;
+    case EFI_COMPROMISED_DATA:
+        mesg = L"Compromised data";
+        break;
+    case EFI_BUFFER_TOO_SMALL:
+        mesg = L"Buffer too small";
+        break;
+    default:
         PrintErr(L"ErrCode: ");
         DisplayUint(ErrCode, 0);
         mesg = NULL;
+        break;
     }
     blexit(mesg);
 }
diff --git a/xen/common/efi/efi-common.mk b/xen/common/efi/efi-common.mk
index 23cafcf20c..06b1c19674 100644
--- a/xen/common/efi/efi-common.mk
+++ b/xen/common/efi/efi-common.mk
@@ -2,6 +2,7 @@ EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
 EFIOBJ-$(CONFIG_COMPAT) += compat.o
 
 CFLAGS-y += -fshort-wchar
+CFLAGS-y += -fno-jump-tables
 CFLAGS-y += -iquote $(srctree)/common/efi
 CFLAGS-y += -iquote $(srcdir)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903486.1311370 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB0L-0006OQ-94; Thu, 06 Mar 2025 13:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903486.1311370; Thu, 06 Mar 2025 13:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB0L-0006OF-5V; Thu, 06 Mar 2025 13:11:13 +0000
Received: by outflank-mailman (input) for mailman id 903486;
 Thu, 06 Mar 2025 13:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB0K-0006Nz-4G
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB0K-0055Z7-0u
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB0K-00AJU6-01
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7vVHVy0XdeFWzJpFkhyYiiMQxNSeSTg4dSpvVWY3bF0=; b=WU6FuvZTkFKf9nndIU3ucRQQxV
	mqonCZ/lsDAjyywkOC1qRUhYKEN+bKhFSrZkOqgjDwOobB9Ukh/koWG22Hvi1Y1w27y/Ch/OvCSDl
	WmZHsDf+QGrCcMb1J3C3CajJ/H/H4sDFnc6sSPqZGkwcer3qxcjcTZcXEL2x7GuEG1Ss=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/events: don't allow binding a global virq from any domain
Message-Id: <E1tqB0K-00AJU6-01@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:11:12 +0000

commit eba922abdb8595846ce3b9cb22c8e4233ce16932
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 13:51:35 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:51:35 2025 +0100

    xen/events: don't allow binding a global virq from any domain
    
    Today Xen will happily allow binding a global virq by a domain which
    isn't configured to receive it. This won't result in any bad actions,
    but the bind will appear to have succeeded with no event ever being
    received by that event channel.
    
    Instead of allowing the bind, error out if the domain isn't set to
    handle that virq. Note that this check is inside the write_lock() on
    purpose, as a future patch will put a related check into
    set_global_virq_handler() with the addition of using the same lock.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/event_channel.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 46281b16ce..cd6f5a1211 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -120,6 +120,13 @@ static uint8_t get_xen_consumer(xen_event_channel_notification_t fn)
 /* Get the notification function for a given Xen-bound event channel. */
 #define xen_notification_fn(e) (xen_consumers[(e)->xen_consumer-1])
 
+static struct domain *__read_mostly global_virq_handlers[NR_VIRQS];
+
+static struct domain *get_global_virq_handler(unsigned int virq)
+{
+    return global_virq_handlers[virq] ?: hardware_domain;
+}
+
 static bool virq_is_global(unsigned int virq)
 {
     switch ( virq )
@@ -469,6 +476,7 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     struct domain *d = current->domain;
     int            virq = bind->virq, vcpu = bind->vcpu;
     int            rc = 0;
+    bool           is_global;
 
     if ( (virq < 0) || (virq >= ARRAY_SIZE(v->virq_to_evtchn)) )
         return -EINVAL;
@@ -478,8 +486,9 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     * speculative execution.
     */
     virq = array_index_nospec(virq, ARRAY_SIZE(v->virq_to_evtchn));
+    is_global = virq_is_global(virq);
 
-    if ( virq_is_global(virq) && (vcpu != 0) )
+    if ( is_global && vcpu != 0 )
         return -EINVAL;
 
     if ( (v = domain_vcpu(d, vcpu)) == NULL )
@@ -487,6 +496,12 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
 
     write_lock(&d->event_lock);
 
+    if ( is_global && get_global_virq_handler(virq) != d )
+    {
+        rc = -EBUSY;
+        goto out;
+    }
+
     if ( read_atomic(&v->virq_to_evtchn[virq]) )
     {
         rc = -EEXIST;
@@ -965,15 +980,13 @@ void send_guest_pirq(struct domain *d, const struct pirq *pirq)
     }
 }
 
-static struct domain *global_virq_handlers[NR_VIRQS] __read_mostly;
-
 static DEFINE_SPINLOCK(global_virq_handlers_lock);
 
 void send_global_virq(uint32_t virq)
 {
     ASSERT(virq_is_global(virq));
 
-    send_guest_global_virq(global_virq_handlers[virq] ?: hardware_domain, virq);
+    send_guest_global_virq(get_global_virq_handler(virq), virq);
 }
 
 int set_global_virq_handler(struct domain *d, uint32_t virq)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:11:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903487.1311373 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB0W-0006RJ-9a; Thu, 06 Mar 2025 13:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903487.1311373; Thu, 06 Mar 2025 13:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB0W-0006RB-6w; Thu, 06 Mar 2025 13:11:24 +0000
Received: by outflank-mailman (input) for mailman id 903487;
 Thu, 06 Mar 2025 13:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB0U-0006Qy-6e
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB0U-0055ZF-1K
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB0U-00AJV5-0L
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VnWnM54Or2RIbYnUEV9JT049+3Qcjtzl6MhVNoBVoZU=; b=IoksVW2yfQa4MRBt1i5z6xZRIN
	+8aBHRzXsnCz1RcWlrHNf64l6MXr7j+OtgqQPUN88+lJWPgAIvSAMk+jn06eDmrAqGdwCWNhAa8Qw
	bXhmaWMVhkmSoUySIwG2K0Fqh/yieBAITZHyYw/NEejMa76Rfabel0KEONGzU022f4iU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/events: allow setting of global virq handler only for unbound virqs
Message-Id: <E1tqB0U-00AJV5-0L@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:11:22 +0000

commit 980822c5edd122ecb21080079f5ed801fef30f51
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 13:51:55 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:51:55 2025 +0100

    xen/events: allow setting of global virq handler only for unbound virqs
    
    XEN_DOMCTL_set_virq_handler will happily steal a global virq from the
    current domain having bound it and assign it to another domain. The
    former domain will just never receive any further events for that
    virq without knowing what happened.
    
    Change the behavior to allow XEN_DOMCTL_set_virq_handler only if the
    virq in question is not bound by the current domain allowed to use it.
    
    Currently the only user of XEN_DOMCTL_set_virq_handler in the Xen code
    base is init-xenstore-domain, so changing the behavior like above will
    not cause any problems.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/event_channel.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index cd6f5a1211..4dba59efa2 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -991,7 +991,8 @@ void send_global_virq(uint32_t virq)
 
 int set_global_virq_handler(struct domain *d, uint32_t virq)
 {
-    struct domain *old;
+    struct domain *old, *hdl;
+    const struct vcpu *v;
     int rc = 0;
 
     if (virq >= NR_VIRQS)
@@ -1023,7 +1024,22 @@ int set_global_virq_handler(struct domain *d, uint32_t virq)
     else
     {
         old = global_virq_handlers[virq];
-        global_virq_handlers[virq] = d;
+        hdl = get_global_virq_handler(virq);
+        if ( hdl != d )
+        {
+            read_lock(&hdl->event_lock);
+
+            v = hdl->vcpu[0];
+            if ( v && read_atomic(&v->virq_to_evtchn[virq]) )
+            {
+                rc = -EBUSY;
+                old = d;
+            }
+            else
+                global_virq_handlers[virq] = d;
+
+            read_unlock(&hdl->event_lock);
+        }
     }
 
     spin_unlock(&global_virq_handlers_lock);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:11:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903488.1311377 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB0g-0006U0-B6; Thu, 06 Mar 2025 13:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903488.1311377; Thu, 06 Mar 2025 13:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB0g-0006Ts-8F; Thu, 06 Mar 2025 13:11:34 +0000
Received: by outflank-mailman (input) for mailman id 903488;
 Thu, 06 Mar 2025 13:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB0e-0006Tc-B6
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB0e-0055a7-1h
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB0e-00AJVl-0l
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wC98RcUvGu2Ms/aSOyWd2jZoTQGFlx7KJBYOsLbcGgc=; b=eARropdC5ch8Jjnp3Pisv94FD0
	Xzoaiv2CetQUbaT2EsalAYAGf2XilHRzWShSCLy5k8C3wU2HXX4c7em+AzkHzOlZlu9dzhX1GeIM6
	H4QztfYncL5IVuKAuc4ja0Y0mY56AStmGVx0R90rHdFuE4ru8ZCponICQhvK6ktIdP4o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: add bitmap to indicate per-domain state changes
Message-Id: <E1tqB0e-00AJVl-0l@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:11:32 +0000

commit f94360a7fe9b98728c25b0a5eba76dcb16c6aa24
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 13:52:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:52:14 2025 +0100

    xen: add bitmap to indicate per-domain state changes
    
    Add a bitmap with one bit per possible domid indicating the respective
    domain has changed its state (created, deleted, dying, crashed,
    shutdown).
    
    Registering the VIRQ_DOM_EXC event will result in setting the bits for
    all existing domains and resetting all other bits.
    
    As the usage of this bitmap is tightly coupled with the VIRQ_DOM_EXC
    event, it is meant to be used only by a single consumer in the system,
    just like the VIRQ_DOM_EXC event.
    
    Resetting a bit will be done in a future patch.
    
    This information is needed for Xenstore to keep track of all domains.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/domain.c        | 51 ++++++++++++++++++++++++++++++++++++++++++++++
 xen/common/event_channel.c | 31 ++++++++++++++++++++++++++++
 xen/include/xen/event.h    |  4 ++++
 xen/include/xen/sched.h    |  3 +++
 4 files changed, 89 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 0c4cc77111..1c1d6da885 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -35,6 +35,7 @@
 #include <xen/irq.h>
 #include <xen/argo.h>
 #include <xen/llc-coloring.h>
+#include <xen/xvmalloc.h>
 #include <asm/p2m.h>
 #include <asm/processor.h>
 #include <public/sched.h>
@@ -139,6 +140,51 @@ bool __read_mostly vmtrace_available;
 
 bool __read_mostly vpmu_is_available;
 
+static unsigned long *__read_mostly dom_state_changed;
+
+int domain_init_states(void)
+{
+    const struct domain *d;
+
+    ASSERT(!dom_state_changed);
+    ASSERT(rw_is_write_locked_by_me(&current->domain->event_lock));
+
+    dom_state_changed = xvzalloc_array(unsigned long,
+                                       BITS_TO_LONGS(DOMID_FIRST_RESERVED));
+    if ( !dom_state_changed )
+        return -ENOMEM;
+
+    rcu_read_lock(&domlist_read_lock);
+
+    for_each_domain ( d )
+        __set_bit(d->domain_id, dom_state_changed);
+
+    rcu_read_unlock(&domlist_read_lock);
+
+    return 0;
+}
+
+void domain_deinit_states(const struct domain *d)
+{
+    ASSERT(rw_is_write_locked_by_me(&d->event_lock));
+
+    XVFREE(dom_state_changed);
+}
+
+static void domain_changed_state(const struct domain *d)
+{
+    struct domain *hdl;
+
+    hdl = lock_dom_exc_handler();
+    if ( unlikely(!hdl) )
+        return;
+
+    if ( dom_state_changed )
+        set_bit(d->domain_id, dom_state_changed);
+
+    unlock_dom_exc_handler(hdl);
+}
+
 static void __domain_finalise_shutdown(struct domain *d)
 {
     struct vcpu *v;
@@ -153,6 +199,7 @@ static void __domain_finalise_shutdown(struct domain *d)
             return;
 
     d->is_shut_down = 1;
+    domain_changed_state(d);
     if ( (d->shutdown_code == SHUTDOWN_suspend) && d->suspend_evtchn )
         evtchn_send(d, d->suspend_evtchn);
     else
@@ -840,6 +887,7 @@ struct domain *domain_create(domid_t domid,
      */
     domlist_insert(d);
 
+    domain_changed_state(d);
     memcpy(d->handle, config->handle, sizeof(d->handle));
 
     return d;
@@ -1105,6 +1153,7 @@ int domain_kill(struct domain *d)
         /* Mem event cleanup has to go here because the rings 
          * have to be put before we call put_domain. */
         vm_event_cleanup(d);
+        domain_changed_state(d);
         put_domain(d);
         send_global_virq(VIRQ_DOM_EXC);
         /* fallthrough */
@@ -1294,6 +1343,8 @@ static void cf_check complete_domain_destroy(struct rcu_head *head)
 
     xfree(d->vcpu);
 
+    domain_changed_state(d);
+
     _domain_destroy(d);
 
     send_global_virq(VIRQ_DOM_EXC);
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 4dba59efa2..4ee6b6b4ce 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -509,10 +509,18 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
         goto out;
     }
 
+    if ( virq == VIRQ_DOM_EXC )
+    {
+        rc = domain_init_states();
+        if ( rc )
+            goto out;
+    }
+
     port = rc = evtchn_get_port(d, port);
     if ( rc < 0 )
     {
         gdprintk(XENLOG_WARNING, "EVTCHNOP failure: error %d\n", rc);
+        domain_deinit_states(d);
         goto out;
     }
 
@@ -745,6 +753,9 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
         struct vcpu *v;
         unsigned long flags;
 
+        if ( chn1->u.virq == VIRQ_DOM_EXC )
+            domain_deinit_states(d1);
+
         v = d1->vcpu[virq_is_global(chn1->u.virq) ? 0 : chn1->notify_vcpu_id];
 
         write_lock_irqsave(&v->virq_lock, flags);
@@ -1075,6 +1086,26 @@ static void clear_global_virq_handlers(struct domain *d)
     }
 }
 
+struct domain *lock_dom_exc_handler(void)
+{
+    struct domain *d;
+
+    d = get_global_virq_handler(VIRQ_DOM_EXC);
+    if ( unlikely(!get_domain(d)) )
+        return NULL;
+
+    read_lock(&d->event_lock);
+
+    return d;
+}
+
+void unlock_dom_exc_handler(struct domain *d)
+{
+    read_unlock(&d->event_lock);
+
+    put_domain(d);
+}
+
 int evtchn_status(evtchn_status_t *status)
 {
     struct domain   *d;
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index 48b79f3d62..5c0ba90c9f 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -100,6 +100,10 @@ bool evtchn_virq_enabled(const struct vcpu *v, unsigned int virq);
 /* Notify remote end of a Xen-attached event channel.*/
 void notify_via_xen_event_channel(struct domain *ld, int lport);
 
+/* Lock/unlock of VIRQ_DOM_EXC associated data (read_lock(d->event_lock)). */
+struct domain *lock_dom_exc_handler(void);
+void unlock_dom_exc_handler(struct domain *d);
+
 /*
  * Internal event channel object storage.
  *
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 037c83fda2..9d9b89ec27 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -805,6 +805,9 @@ void domain_resume(struct domain *d);
 
 int domain_soft_reset(struct domain *d, bool resuming);
 
+int domain_init_states(void);
+void domain_deinit_states(const struct domain *d);
+
 int vcpu_start_shutdown_deferral(struct vcpu *v);
 void vcpu_end_shutdown_deferral(struct vcpu *v);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:11:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903489.1311381 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB0q-0006WT-CU; Thu, 06 Mar 2025 13:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903489.1311381; Thu, 06 Mar 2025 13:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB0q-0006WL-9j; Thu, 06 Mar 2025 13:11:44 +0000
Received: by outflank-mailman (input) for mailman id 903489;
 Thu, 06 Mar 2025 13:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB0o-0006W6-Ej
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB0o-0055bq-28
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB0o-00AJXC-1B
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LTeq4UlpTkZh+vL71pkfIaTF1JQc/3IuI/28ExhvrPw=; b=GKWPsuS9YaUcfDmfdcfW1fR2xu
	Mmn+l7CgENXRMoUPdyvKre8b8t+150JU2cnoZr1MVX3atBbJ8EHE3uSTuoAjmBIb6r6iIaVTwRwzr
	Yqai6vCyG8Va15Pe4T5eqp4RswlWlPuNjuHzGEvZy7F+HONmEm4Ce23hS13mHoQdeu+E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: add new domctl get_domain_state
Message-Id: <E1tqB0o-00AJXC-1B@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:11:42 +0000

commit 3ad3df1bd0aabae628e031fbac2a2bfbb45b09ba
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 13:52:38 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:52:38 2025 +0100

    xen: add new domctl get_domain_state
    
    Add a new domctl sub-function to get data of a domain having changed
    state (this is needed by Xenstore).
    
    The returned state just contains the domid, the domain unique id,
    and some flags (existing, shutdown, dying).
    
    In order to enable Xenstore stubdom being built for multiple Xen
    versions, make this domctl stable.  For stable domctls the
    interface_version is always 0.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/flask/policy/modules/dom0.te     |  1 +
 tools/flask/policy/modules/xen.if      |  5 ++-
 tools/flask/policy/modules/xenstore.te |  1 +
 xen/common/domain.c                    | 74 ++++++++++++++++++++++++++++++++++
 xen/common/domctl.c                    | 18 ++++++++-
 xen/include/public/domctl.h            | 26 ++++++++++++
 xen/include/xen/sched.h                |  2 +
 xen/include/xsm/dummy.h                |  8 ++++
 xen/include/xsm/xsm.h                  |  6 +++
 xen/xsm/dummy.c                        |  1 +
 xen/xsm/flask/hooks.c                  |  7 ++++
 xen/xsm/flask/policy/access_vectors    |  2 +
 12 files changed, 148 insertions(+), 3 deletions(-)

diff --git a/tools/flask/policy/modules/dom0.te b/tools/flask/policy/modules/dom0.te
index f148bfbf27..ccadbd6469 100644
--- a/tools/flask/policy/modules/dom0.te
+++ b/tools/flask/policy/modules/dom0.te
@@ -41,6 +41,7 @@ allow dom0_t dom0_t:domain {
 allow dom0_t dom0_t:domain2 {
 	set_cpu_policy gettsc settsc setscheduler set_vnumainfo
 	get_vnumainfo psr_cmt_op psr_alloc get_cpu_policy dt_overlay
+	get_domain_state
 };
 allow dom0_t dom0_t:resource { add remove };
 
diff --git a/tools/flask/policy/modules/xen.if b/tools/flask/policy/modules/xen.if
index f7cf7c43c8..cff51febbf 100644
--- a/tools/flask/policy/modules/xen.if
+++ b/tools/flask/policy/modules/xen.if
@@ -54,7 +54,8 @@ define(`create_domain_common', `
 	allow $1 $2:domain2 { set_cpu_policy settsc setscheduler setclaim
 			set_vnumainfo get_vnumainfo cacheflush
 			psr_cmt_op psr_alloc soft_reset
-			resource_map get_cpu_policy vuart_op set_llc_colors };
+			resource_map get_cpu_policy vuart_op set_llc_colors
+			get_domain_state };
 	allow $1 $2:security check_context;
 	allow $1 $2:shadow enable;
 	allow $1 $2:mmu { map_read map_write adjust memorymap physmap pinpage mmuext_op updatemp };
@@ -94,7 +95,7 @@ define(`manage_domain', `
 			getaddrsize pause unpause trigger shutdown destroy
 			setaffinity setdomainmaxmem getscheduler resume
 			setpodtarget getpodtarget getpagingmempool setpagingmempool };
-    allow $1 $2:domain2 { set_vnumainfo dt_overlay };
+    allow $1 $2:domain2 { set_vnumainfo dt_overlay get_domain_state };
 ')
 
 # migrate_domain_out(priv, target)
diff --git a/tools/flask/policy/modules/xenstore.te b/tools/flask/policy/modules/xenstore.te
index 519566ab81..49de53ebe2 100644
--- a/tools/flask/policy/modules/xenstore.te
+++ b/tools/flask/policy/modules/xenstore.te
@@ -13,6 +13,7 @@ allow dom0_t xenstore_t:domain set_virq_handler;
 allow xenstore_t xen_t:xen writeconsole;
 # Xenstore queries domaininfo on all domains
 allow xenstore_t domain_type:domain getdomaininfo;
+allow xenstore_t domain_type:domain2 get_domain_state;
 
 # As a shortcut, the following 3 rules are used instead of adding a domain_comms
 # rule between xenstore_t and every domain type that talks to xenstore
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 1c1d6da885..b887c60ecc 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -185,6 +185,80 @@ static void domain_changed_state(const struct domain *d)
     unlock_dom_exc_handler(hdl);
 }
 
+static void set_domain_state_info(struct xen_domctl_get_domain_state *info,
+                                  const struct domain *d)
+{
+    info->state = XEN_DOMCTL_GETDOMSTATE_STATE_EXIST;
+    if ( d->is_shut_down )
+        info->state |= XEN_DOMCTL_GETDOMSTATE_STATE_SHUTDOWN;
+    if ( d->is_dying == DOMDYING_dying )
+        info->state |= XEN_DOMCTL_GETDOMSTATE_STATE_DYING;
+    if ( d->is_dying == DOMDYING_dead )
+        info->state |= XEN_DOMCTL_GETDOMSTATE_STATE_DEAD;
+    info->unique_id = d->unique_id;
+}
+
+int get_domain_state(struct xen_domctl_get_domain_state *info, struct domain *d,
+                     domid_t *domid)
+{
+    unsigned int dom;
+    int rc = -ENOENT;
+    struct domain *hdl;
+
+    if ( info->pad0 || info->pad1 )
+        return -EINVAL;
+
+    if ( d )
+    {
+        set_domain_state_info(info, d);
+
+        return 0;
+    }
+
+    hdl = lock_dom_exc_handler();
+
+    /*
+     * Only domain registered for VIRQ_DOM_EXC event is allowed to query
+     * domains having changed state.
+     */
+    if ( current->domain != hdl )
+    {
+        rc = -EACCES;
+        goto out;
+    }
+
+    while ( dom_state_changed )
+    {
+        dom = find_first_bit(dom_state_changed, DOMID_MASK + 1);
+        if ( dom >= DOMID_FIRST_RESERVED )
+            break;
+        if ( test_and_clear_bit(dom, dom_state_changed) )
+        {
+            *domid = dom;
+
+            d = rcu_lock_domain_by_id(dom);
+
+            if ( d )
+            {
+                set_domain_state_info(info, d);
+
+                rcu_unlock_domain(d);
+            }
+            else
+                memset(info, 0, sizeof(*info));
+
+            rc = 0;
+
+            break;
+        }
+    }
+
+ out:
+    unlock_dom_exc_handler(hdl);
+
+    return rc;
+}
+
 static void __domain_finalise_shutdown(struct domain *d)
 {
     struct vcpu *v;
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 05abb581a0..b897ca8723 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -279,6 +279,11 @@ static struct vnuma_info *vnuma_init(const struct xen_domctl_vnuma *uinfo,
     return ERR_PTR(ret);
 }
 
+static bool is_stable_domctl(uint32_t cmd)
+{
+    return cmd == XEN_DOMCTL_get_domain_state;
+}
+
 long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
 {
     long ret = 0;
@@ -289,7 +294,8 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
     if ( copy_from_guest(op, u_domctl, 1) )
         return -EFAULT;
 
-    if ( op->interface_version != XEN_DOMCTL_INTERFACE_VERSION )
+    if ( op->interface_version !=
+         (is_stable_domctl(op->cmd) ? 0 : XEN_DOMCTL_INTERFACE_VERSION) )
         return -EACCES;
 
     switch ( op->cmd )
@@ -310,6 +316,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         fallthrough;
     case XEN_DOMCTL_test_assign_device:
     case XEN_DOMCTL_vm_event_op:
+    case XEN_DOMCTL_get_domain_state:
         if ( op->domain == DOMID_INVALID )
         {
             d = NULL;
@@ -876,6 +883,15 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             ret = -EOPNOTSUPP;
         break;
 
+    case XEN_DOMCTL_get_domain_state:
+        ret = xsm_get_domain_state(XSM_XS_PRIV, d);
+        if ( ret )
+            break;
+
+        copyback = 1;
+        ret = get_domain_state(&op->u.get_domain_state, d, &op->domain);
+        break;
+
     default:
         ret = arch_do_domctl(op, d, u_domctl);
         break;
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index e2d392d1e5..5b2063eed9 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -28,6 +28,7 @@
  * Pure additions (e.g. new sub-commands) or compatible interface changes
  * (e.g. adding semantics to 0-checked input fields or data to zeroed output
  * fields) don't require a change of the version.
+ * Stable ops are NOT covered by XEN_DOMCTL_INTERFACE_VERSION!
  *
  * Last version bump: Xen 4.19
  */
@@ -1243,7 +1244,30 @@ struct xen_domctl_set_llc_colors {
     XEN_GUEST_HANDLE_64(uint32) llc_colors;
 };
 
+/*
+ * XEN_DOMCTL_get_domain_state (stable interface)
+ *
+ * Get state information of a domain.
+ *
+ * In case domain is DOMID_INVALID, return information about a domain having
+ * changed state and reset the state change indicator for that domain. This
+ * function is usable only by a domain having registered the VIRQ_DOM_EXC
+ * event (normally Xenstore).
+ * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
+ */
+struct xen_domctl_get_domain_state {
+    uint16_t state;
+#define XEN_DOMCTL_GETDOMSTATE_STATE_EXIST     0x0001  /* Domain is existing. */
+#define XEN_DOMCTL_GETDOMSTATE_STATE_SHUTDOWN  0x0002  /* Shutdown finished. */
+#define XEN_DOMCTL_GETDOMSTATE_STATE_DYING     0x0004  /* Domain dying. */
+#define XEN_DOMCTL_GETDOMSTATE_STATE_DEAD      0x0008  /* Domain dead. */
+    uint16_t pad0;           /* Must be 0 on input, returned as 0. */
+    uint32_t pad1;           /* Must be 0 on input, returned as 0. */
+    uint64_t unique_id;      /* Unique domain identifier. */
+};
+
 struct xen_domctl {
+/* Stable domctl ops: interface_version is required to be 0.  */
     uint32_t cmd;
 #define XEN_DOMCTL_createdomain                   1
 #define XEN_DOMCTL_destroydomain                  2
@@ -1333,6 +1357,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_dt_overlay                    87
 #define XEN_DOMCTL_gsi_permission                88
 #define XEN_DOMCTL_set_llc_colors                89
+#define XEN_DOMCTL_get_domain_state              90 /* stable interface */
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -1400,6 +1425,7 @@ struct xen_domctl {
         struct xen_domctl_dt_overlay        dt_overlay;
 #endif
         struct xen_domctl_set_llc_colors    set_llc_colors;
+        struct xen_domctl_get_domain_state  get_domain_state;
         uint8_t                             pad[128];
     } u;
 };
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 9d9b89ec27..ea63ca1c79 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -807,6 +807,8 @@ int domain_soft_reset(struct domain *d, bool resuming);
 
 int domain_init_states(void);
 void domain_deinit_states(const struct domain *d);
+int get_domain_state(struct xen_domctl_get_domain_state *info,
+                     struct domain *d, domid_t *domid);
 
 int vcpu_start_shutdown_deferral(struct vcpu *v);
 void vcpu_end_shutdown_deferral(struct vcpu *v);
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 6a2fc33c3b..a8d06de6b0 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -173,6 +173,7 @@ static XSM_INLINE int cf_check xsm_domctl(
     case XEN_DOMCTL_unbind_pt_irq:
         return xsm_default_action(XSM_DM_PRIV, current->domain, d);
     case XEN_DOMCTL_getdomaininfo:
+    case XEN_DOMCTL_get_domain_state:
         return xsm_default_action(XSM_XS_PRIV, current->domain, d);
     default:
         return xsm_default_action(XSM_PRIV, current->domain, d);
@@ -815,6 +816,13 @@ static XSM_INLINE int cf_check xsm_argo_send(
 
 #endif /* CONFIG_ARGO */
 
+static XSM_INLINE int cf_check xsm_get_domain_state(
+    XSM_DEFAULT_ARG struct domain *d)
+{
+    XSM_ASSERT_ACTION(XSM_XS_PRIV);
+    return xsm_default_action(action, current->domain, d);
+}
+
 #include <public/version.h>
 static XSM_INLINE int cf_check xsm_xen_version(XSM_DEFAULT_ARG uint32_t op)
 {
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 4dbff9d866..0689bf5c9f 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -200,6 +200,7 @@ struct xsm_ops {
     int (*argo_register_any_source)(const struct domain *d);
     int (*argo_send)(const struct domain *d, const struct domain *t);
 #endif
+    int (*get_domain_state)(struct domain *d);
 };
 
 #ifdef CONFIG_XSM
@@ -774,6 +775,11 @@ static inline int xsm_argo_send(const struct domain *d, const struct domain *t)
 
 #endif /* CONFIG_ARGO */
 
+static inline int xsm_get_domain_state(struct domain *d)
+{
+    return alternative_call(xsm_ops.get_domain_state, d);
+}
+
 #endif /* XSM_NO_WRAPPERS */
 
 #ifdef CONFIG_MULTIBOOT
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index e6ffa948f7..ce6fbdc6c5 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -148,6 +148,7 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
     .argo_register_any_source      = xsm_argo_register_any_source,
     .argo_send                     = xsm_argo_send,
 #endif
+    .get_domain_state              = xsm_get_domain_state,
 };
 
 void __init xsm_fixup_ops(struct xsm_ops *ops)
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 14d84df9ca..389707a164 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -688,6 +688,7 @@ static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
     case XEN_DOMCTL_memory_mapping:
     case XEN_DOMCTL_set_target:
     case XEN_DOMCTL_vm_event_op:
+    case XEN_DOMCTL_get_domain_state:
 
     /* These have individual XSM hooks (arch/../domctl.c) */
     case XEN_DOMCTL_bind_pt_irq:
@@ -1869,6 +1870,11 @@ static int cf_check flask_argo_send(
 
 #endif
 
+static int cf_check flask_get_domain_state(struct domain *d)
+{
+    return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__GET_DOMAIN_STATE);
+}
+
 static const struct xsm_ops __initconst_cf_clobber flask_ops = {
     .set_system_active = flask_set_system_active,
     .security_domaininfo = flask_security_domaininfo,
@@ -2005,6 +2011,7 @@ static const struct xsm_ops __initconst_cf_clobber flask_ops = {
     .argo_register_any_source = flask_argo_register_any_source,
     .argo_send = flask_argo_send,
 #endif
+    .get_domain_state = flask_get_domain_state,
 };
 
 const struct xsm_ops *__init flask_init(
diff --git a/xen/xsm/flask/policy/access_vectors b/xen/xsm/flask/policy/access_vectors
index 320d77706d..51a1577a66 100644
--- a/xen/xsm/flask/policy/access_vectors
+++ b/xen/xsm/flask/policy/access_vectors
@@ -257,6 +257,8 @@ class domain2
     dt_overlay
 # XEN_DOMCTL_set_llc_colors
     set_llc_colors
+# XEN_DOMCTL_get_domain_state
+    get_domain_state
 }
 
 # Similar to class domain, but primarily contains domctls related to HVM domains
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:11:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903490.1311385 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB10-0006Ze-G1; Thu, 06 Mar 2025 13:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903490.1311385; Thu, 06 Mar 2025 13:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB10-0006ZX-DF; Thu, 06 Mar 2025 13:11:54 +0000
Received: by outflank-mailman (input) for mailman id 903490;
 Thu, 06 Mar 2025 13:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB0y-0006ZG-IC
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB0y-0055bu-2U
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB0y-00AJY1-1Z
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DD4ffVX4sRNag/Gaz9vkrfIx/FMrL0Cp57++9lrfgNs=; b=BmicZgo9SwfheeVedkLJRcnmF4
	NBudtwPjDdrKuOBBx5NuCdSUz62LpW8ZvpcgQkupeENSDQIKCohSMkjhJ3V2X53hpS2nTFRHp15Zd
	0GLzgoqn9Ju9KojpICPBEO7LTMTsRhYY2Bppxl1A/YvBeqwDjl93G4k9RqN4KeSnUitU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs: add a new libxenmanage library
Message-Id: <E1tqB0y-00AJY1-1Z@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:11:52 +0000

commit e995055d6993cda88780a7bf0037243cda34874e
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 13:53:56 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:53:56 2025 +0100

    tools/libs: add a new libxenmanage library
    
    In order to have a stable interface in user land for using stable
    domctl and possibly later sysctl interfaces, add a new library
    libxenmanage.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xenmanage.h          |  92 ++++++++++++++++++++
 tools/libs/Makefile                |   1 +
 tools/libs/manage/Makefile         |  10 +++
 tools/libs/manage/Makefile.common  |   3 +
 tools/libs/manage/core.c           | 168 +++++++++++++++++++++++++++++++++++++
 tools/libs/manage/libxenmanage.map |   8 ++
 tools/libs/uselibs.mk              |   2 +
 7 files changed, 284 insertions(+)

diff --git a/tools/include/xenmanage.h b/tools/include/xenmanage.h
new file mode 100644
index 0000000000..956b7a0a44
--- /dev/null
+++ b/tools/include/xenmanage.h
@@ -0,0 +1,92 @@
+/* SPDX-License-Identifier: LGPL-2.1-only */
+/*
+ * Copyright (c) 2024 SUSE Software Solutions Germany GmbH
+ *
+ * Interfaces of libxenmanage.
+ *
+ * libxenmanage provides management functions for the host using stable
+ * hypercall interfaces.
+ */
+#ifndef XENMANAGE_H
+#define XENMANAGE_H
+
+#include <stdint.h>
+
+/* Avoid the need to #include <xentoollog.h> */
+struct xentoollog_logger;
+
+typedef struct xenmanage_handle xenmanage_handle;
+
+/*
+ * Open libxenmanage.
+ *
+ * Get a handle of the xenmanage library. The handle is required for all
+ * further operations of the library.
+ * Parameters:
+ *   logger:     Logging function to use. If NULL logging is done to stderr.
+ *   open_flags: Only 0 supported.
+ * Return value: Handle or NULL if error.
+ */
+xenmanage_handle *xenmanage_open(struct xentoollog_logger *logger,
+                                 unsigned int open_flags);
+
+/*
+ * Close libxenmanage.
+ *
+ * Return a handle of the xenmanage library.
+ * Parameters:
+ *    hdl: Handle obtained by xenmanage_open().
+ * Return value: always 0.
+ */
+int xenmanage_close(xenmanage_handle *hdl);
+
+#define XENMANAGE_GETDOMSTATE_STATE_EXIST     0x0001  /* Domain is existing. */
+#define XENMANAGE_GETDOMSTATE_STATE_SHUTDOWN  0x0002  /* Shutdown finished. */
+#define XENMANAGE_GETDOMSTATE_STATE_DYING     0x0004  /* Domain dying. */
+#define XENMANAGE_GETDOMSTATE_STATE_DEAD      0x0008  /* Domain dead. */
+
+/*
+ * Return state information of an existing domain.
+ *
+ * Returns the domain state and unique id of the given domain.
+ * Parameters:
+ *   hdl:       handle returned by xenmanage_open()
+ *   domid:     domain id of the domain to get the information for
+ *   state:     where to store the state (XENMANAGE_GETDOMSTATE_STATE_ flags,
+ *              nothing stored if NULL)
+ *   unique_id: where to store the unique id of the domain (nothing stored if
+ *              NULL)
+ * Return value: 0 if information was stored, -1 else (errno is set)
+ */
+int xenmanage_get_domain_info(xenmanage_handle *hdl, unsigned int domid,
+                              unsigned int *state, uint64_t *unique_id);
+
+/*
+ * Return information of a domain having changed state recently.
+ *
+ * Returns the domain id, state and unique id of a domain having changed
+ * state (any of the state bits was modified) since the last time information
+ * for that domain was returned by this function. Only usable by callers who
+ * have registered the VIRQ_DOM_EXC event (normally Xenstore).
+ * Parameters:
+ *   hdl:       handle returned by xenmanage_open()
+ *   domid:     where to store the domid of the domain (not NULL)
+ *   state:     where to store the state (XENMANAGE_GETDOMSTATE_STATE_ flags,
+ *              nothing stored if NULL)
+ *   unique_id: where to store the unique id of the domain (nothing stored if
+ *              NULL)
+ * Return value: 0 if information was stored, -1 else (errno is set)
+ */
+int xenmanage_poll_changed_domain(xenmanage_handle *hdl, unsigned int *domid,
+                                  unsigned int *state, uint64_t *unique_id);
+#endif /* XENMANAGE_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/tools/libs/Makefile b/tools/libs/Makefile
index 1afcd12e2b..d39516c1b3 100644
--- a/tools/libs/Makefile
+++ b/tools/libs/Makefile
@@ -12,6 +12,7 @@ SUBDIRS-y += devicemodel
 SUBDIRS-y += ctrl
 SUBDIRS-y += guest
 SUBDIRS-y += hypfs
+SUBDIRS-y += manage
 SUBDIRS-y += store
 SUBDIRS-y += stat
 SUBDIRS-$(CONFIG_Linux) += vchan
diff --git a/tools/libs/manage/Makefile b/tools/libs/manage/Makefile
new file mode 100644
index 0000000000..dbfe70d259
--- /dev/null
+++ b/tools/libs/manage/Makefile
@@ -0,0 +1,10 @@
+XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+MAJOR    = 1
+MINOR    = 0
+version-script := libxenmanage.map
+
+include Makefile.common
+
+include $(XEN_ROOT)/tools/libs/libs.mk
diff --git a/tools/libs/manage/Makefile.common b/tools/libs/manage/Makefile.common
new file mode 100644
index 0000000000..533ba30fba
--- /dev/null
+++ b/tools/libs/manage/Makefile.common
@@ -0,0 +1,3 @@
+CFLAGS += -D__XEN_TOOLS__
+
+OBJS-y  += core.o
diff --git a/tools/libs/manage/core.c b/tools/libs/manage/core.c
new file mode 100644
index 0000000000..8fb421df41
--- /dev/null
+++ b/tools/libs/manage/core.c
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2024 SUSE Software Solutions Germany GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define _GNU_SOURCE
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <xentoollog.h>
+#include <xenmanage.h>
+#include <xencall.h>
+#include <xentoolcore_internal.h>
+
+#include <xen/xen.h>
+#include <xen/domctl.h>
+
+struct xenmanage_handle {
+    xentoollog_logger *logger, *logger_tofree;
+    unsigned int flags;
+    xencall_handle *xcall;
+};
+
+xenmanage_handle *xenmanage_open(xentoollog_logger *logger,
+                                 unsigned int open_flags)
+{
+    xenmanage_handle *hdl = calloc(1, sizeof(*hdl));
+    int saved_errno;
+
+    if ( !hdl )
+        return NULL;
+
+    if ( open_flags )
+    {
+        errno = EINVAL;
+        goto err;
+    }
+
+    hdl->flags = open_flags;
+    hdl->logger = logger;
+    hdl->logger_tofree = NULL;
+
+    if ( !hdl->logger )
+    {
+        hdl->logger = hdl->logger_tofree =
+            (xentoollog_logger *)
+            xtl_createlogger_stdiostream(stderr, XTL_PROGRESS, 0);
+        if ( !hdl->logger )
+            goto err;
+    }
+
+    hdl->xcall = xencall_open(hdl->logger, 0);
+    if ( !hdl->xcall )
+        goto err;
+
+    return hdl;
+
+err:
+    saved_errno = errno;
+    xenmanage_close(hdl);
+    errno = saved_errno;
+
+    return NULL;
+}
+
+int xenmanage_close(xenmanage_handle *hdl)
+{
+    if ( !hdl )
+        return 0;
+
+    xencall_close(hdl->xcall);
+    xtl_logger_destroy(hdl->logger_tofree);
+    free(hdl);
+    return 0;
+}
+
+static int xenmanage_do_domctl_get_domain_state(xenmanage_handle *hdl,
+                                                unsigned int domid_in,
+                                                unsigned int *domid_out,
+                                                unsigned int *state,
+                                                uint64_t *unique_id)
+{
+    struct xen_domctl *buf;
+    int saved_errno;
+    int ret;
+
+    buf = xencall_alloc_buffer(hdl->xcall, sizeof(*buf));
+    if ( !buf )
+    {
+        errno = ENOMEM;
+        return -1;
+    }
+
+    memset(buf, 0, sizeof(*buf));
+
+    buf->cmd = XEN_DOMCTL_get_domain_state;
+    buf->domain = domid_in;
+
+    ret = xencall1(hdl->xcall, __HYPERVISOR_domctl, (unsigned long)buf);
+    saved_errno = errno;
+    if ( !ret )
+    {
+        struct xen_domctl_get_domain_state *st = &buf->u.get_domain_state;
+
+        if ( domid_out )
+            *domid_out = buf->domain;
+        if ( state )
+        {
+            *state = 0;
+            if ( st->state & XEN_DOMCTL_GETDOMSTATE_STATE_EXIST )
+                *state |= XENMANAGE_GETDOMSTATE_STATE_EXIST;
+            if ( st->state & XEN_DOMCTL_GETDOMSTATE_STATE_SHUTDOWN )
+                *state |= XENMANAGE_GETDOMSTATE_STATE_SHUTDOWN;
+            if ( st->state & XEN_DOMCTL_GETDOMSTATE_STATE_DYING )
+                *state |= XENMANAGE_GETDOMSTATE_STATE_DYING;
+            if ( st->state & XEN_DOMCTL_GETDOMSTATE_STATE_DEAD )
+                *state |= XENMANAGE_GETDOMSTATE_STATE_DEAD;
+        }
+        if ( unique_id )
+            *unique_id = st->unique_id;
+    }
+
+    xencall_free_buffer(hdl->xcall, buf);
+
+    errno = saved_errno;
+
+    return ret;
+}
+
+int xenmanage_get_domain_info(xenmanage_handle *hdl, unsigned int domid,
+                              unsigned int *state, uint64_t *unique_id)
+{
+    if ( !hdl || domid >= DOMID_FIRST_RESERVED )
+    {
+        errno = EINVAL;
+        return -1;
+    }
+
+    return xenmanage_do_domctl_get_domain_state(hdl, domid, NULL, state,
+                                                unique_id);
+}
+
+int xenmanage_poll_changed_domain(xenmanage_handle *hdl, unsigned int *domid,
+                                  unsigned int *state, uint64_t *unique_id)
+{
+    if ( !hdl || !domid )
+    {
+        errno = EINVAL;
+        return -1;
+    }
+
+    return xenmanage_do_domctl_get_domain_state(hdl, DOMID_INVALID, domid,
+                                                state, unique_id);
+}
diff --git a/tools/libs/manage/libxenmanage.map b/tools/libs/manage/libxenmanage.map
new file mode 100644
index 0000000000..64c793e603
--- /dev/null
+++ b/tools/libs/manage/libxenmanage.map
@@ -0,0 +1,8 @@
+VERS_1.0 {
+	global:
+		xenmanage_open;
+		xenmanage_close;
+		xenmanage_get_domain_info;
+		xenmanage_poll_changed_domain;
+	local: *; /* Do not expose anything by default */
+};
diff --git a/tools/libs/uselibs.mk b/tools/libs/uselibs.mk
index 7aa8d83e06..c0a234cfec 100644
--- a/tools/libs/uselibs.mk
+++ b/tools/libs/uselibs.mk
@@ -16,6 +16,8 @@ LIBS_LIBS += devicemodel
 USELIBS_devicemodel := toollog toolcore call
 LIBS_LIBS += hypfs
 USELIBS_hypfs := toollog toolcore call
+LIBS_LIBS += manage
+USELIBS_manage := toollog toolcore call
 LIBS_LIBS += ctrl
 USELIBS_ctrl := toollog call evtchn gnttab foreignmemory devicemodel
 LIBS_LIBS += guest
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:12:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903491.1311389 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB19-0006c7-HP; Thu, 06 Mar 2025 13:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903491.1311389; Thu, 06 Mar 2025 13:12:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB19-0006bz-En; Thu, 06 Mar 2025 13:12:03 +0000
Received: by outflank-mailman (input) for mailman id 903491;
 Thu, 06 Mar 2025 13:12:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB18-0006bt-Ky
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB18-0055cZ-2k
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB18-00AJZH-1u
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9HdljliVB/NpOr7xagXuTvuVmSoxIN/daBrKXz189/o=; b=cVTQb+sb855scOBtHQdqHulnqT
	lodfpRAhwEFgYghBgezI1gVFsf2QndRtEGRNHgCnZIvl1tHk01Np0TA+7nDPSGYsJ5OGDjwWaMgXi
	6xHI39j9zJA64QLWfQEYn+qGLUdmxpVAVmY8yD3P5HDUIiW+KjPEuHaOpZ4ZIW4NrQZM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: use new stable interface instead of libxenctrl
Message-Id: <E1tqB18-00AJZH-1u@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:12:02 +0000

commit 42630ceddfd30fea9d6f8ffc216ba5975824433b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 13:54:55 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:54:55 2025 +0100

    tools/xenstored: use new stable interface instead of libxenctrl
    
    Replace the current use of the unstable xc_domain_getinfo_single()
    interface with the stable domctl XEN_DOMCTL_get_domain_state call
    via the new libxenmanage library.
    
    This will remove the last usage of libxenctrl by Xenstore, so update
    the library dependencies accordingly.
    
    For now only do a direct replacement without using the functionality
    of obtaining information about domains having changed the state.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 stubdom/Makefile                |  8 +++----
 stubdom/mini-os.mk              |  1 +
 tools/xenstored/Makefile        |  2 +-
 tools/xenstored/Makefile.common |  2 +-
 tools/xenstored/core.h          |  1 -
 tools/xenstored/domain.c        | 52 +++++++++++++++--------------------------
 tools/xenstored/lu.c            |  1 +
 tools/xenstored/lu_daemon.c     |  1 +
 8 files changed, 28 insertions(+), 40 deletions(-)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index c6978caa5a..724ce40365 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -308,7 +308,7 @@ endif
 # libraries under tools/libs
 #######
 
-STUB_LIBS := toolcore toollog evtchn gnttab call foreignmemory devicemodel ctrl guest
+STUB_LIBS := toolcore toollog evtchn gnttab call foreignmemory devicemodel ctrl guest manage
 
 LIBDEP_guest := cross-zlib
 
@@ -466,7 +466,7 @@ grub: cross-polarssl grub-upstream $(CROSS_ROOT) grub-$(XEN_TARGET_ARCH)-minios-
 # xenstore
 ##########
 
-xenstore-minios.gen.cfg: APP_LIBS = gnttab evtchn toollog ctrl
+xenstore-minios.gen.cfg: APP_LIBS = gnttab evtchn toollog manage
 xenstore-minios.gen.cfg: xenstore-minios.cfg Makefile
 	$(GEN_config) >$@
 
@@ -481,7 +481,7 @@ xenstore: $(CROSS_ROOT) xenstore-minios-config.mk
 # xenstorepvh
 #############
 
-xenstorepvh-minios.gen.cfg: APP_LIBS = gnttab evtchn toollog ctrl
+xenstorepvh-minios.gen.cfg: APP_LIBS = gnttab evtchn toollog manage
 xenstorepvh-minios.gen.cfg: xenstorepvh-minios.cfg Makefile
 	$(GEN_config) >$@
 
@@ -524,7 +524,7 @@ else
 pv-grub-if-enabled:
 endif
 
-XENSTORE_DEPS := libxenevtchn libxengnttab libxenctrl
+XENSTORE_DEPS := libxenevtchn libxengnttab libxenmanage
 
 .PHONY: xenstore-stubdom
 xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore $(XENSTORE_DEPS) xenstore
diff --git a/stubdom/mini-os.mk b/stubdom/mini-os.mk
index 7e4968e026..be32302f9e 100644
--- a/stubdom/mini-os.mk
+++ b/stubdom/mini-os.mk
@@ -13,5 +13,6 @@ GNTTAB_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab
 CALL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call
 FOREIGNMEMORY_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory
 DEVICEMODEL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/devicemodel
+MANAGE_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/manage
 CTRL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/ctrl
 GUEST_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/guest
diff --git a/tools/xenstored/Makefile b/tools/xenstored/Makefile
index 09adfe1d50..81c42838e0 100644
--- a/tools/xenstored/Makefile
+++ b/tools/xenstored/Makefile
@@ -5,7 +5,7 @@ include Makefile.common
 
 xenstored: LDLIBS += $(LDLIBS_libxenevtchn)
 xenstored: LDLIBS += $(LDLIBS_libxengnttab)
-xenstored: LDLIBS += $(LDLIBS_libxenctrl)
+xenstored: LDLIBS += $(LDLIBS_libxenmanage)
 xenstored: LDLIBS += -lrt
 xenstored: LDLIBS += $(SOCKET_LIBS)
 
diff --git a/tools/xenstored/Makefile.common b/tools/xenstored/Makefile.common
index 27fdb3b49e..271134fcc1 100644
--- a/tools/xenstored/Makefile.common
+++ b/tools/xenstored/Makefile.common
@@ -12,7 +12,7 @@ XENSTORED_OBJS-$(CONFIG_MiniOS) += minios.o lu_minios.o
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 CFLAGS += $(CFLAGS_libxenevtchn)
-CFLAGS += $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_libxenmanage)
 CFLAGS += $(CFLAGS_libxentoolcore)
 
 $(XENSTORED_OBJS-y): CFLAGS += $(CFLAGS_libxengnttab)
diff --git a/tools/xenstored/core.h b/tools/xenstored/core.h
index e58779e88c..632886cecf 100644
--- a/tools/xenstored/core.h
+++ b/tools/xenstored/core.h
@@ -19,7 +19,6 @@
 #ifndef _XENSTORED_CORE_H
 #define _XENSTORED_CORE_H
 
-#include <xenctrl.h>
 #include <xengnttab.h>
 
 #include <sys/types.h>
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index 64c8fd0cc3..a6506a5bb2 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -34,14 +34,15 @@
 #include "control.h"
 
 #include <xenevtchn.h>
-#include <xenctrl.h>
+#include <xenmanage.h>
+#include <xen-barrier.h>
 #include <xen/grant_table.h>
 
 #ifdef __MINIOS__
 #include <mini-os/xenbus.h>
 #endif
 
-static xc_interface **xc_handle;
+static xenmanage_handle *xm_handle;
 xengnttab_handle **xgt_handle;
 static evtchn_port_t virq_port;
 
@@ -619,32 +620,28 @@ static int destroy_domain(void *_domain)
 	return 0;
 }
 
-static bool get_domain_info(unsigned int domid, xc_domaininfo_t *dominfo)
-{
-	return xc_domain_getinfo_single(*xc_handle, domid, dominfo) == 0;
-}
-
 static int check_domain(const void *k, void *v, void *arg)
 {
-	xc_domaininfo_t dominfo;
+	unsigned int state;
 	struct connection *conn;
-	bool dom_valid;
+	int dom_invalid;
 	struct domain *domain = v;
 	bool *notify = arg;
 
-	dom_valid = get_domain_info(domain->domid, &dominfo);
+	dom_invalid = xenmanage_get_domain_info(xm_handle, domain->domid,
+						&state, NULL);
 	if (!domain->introduced) {
-		if (!dom_valid)
+		if (dom_invalid)
 			talloc_free(domain);
 		return 0;
 	}
-	if (dom_valid) {
-		if ((dominfo.flags & XEN_DOMINF_shutdown)
+	if (!dom_invalid) {
+		if ((state & XENMANAGE_GETDOMSTATE_STATE_SHUTDOWN)
 		    && !domain->shutdown) {
 			domain->shutdown = true;
 			*notify = true;
 		}
-		if (!(dominfo.flags & XEN_DOMINF_dying))
+		if (!(state & XENMANAGE_GETDOMSTATE_STATE_DEAD))
 			return 0;
 	}
 	if (domain->conn) {
@@ -786,10 +783,9 @@ static struct domain *find_or_alloc_domain(const void *ctx, unsigned int domid)
 static struct domain *find_or_alloc_existing_domain(unsigned int domid)
 {
 	struct domain *domain;
-	xc_domaininfo_t dominfo;
 
 	domain = find_domain_struct(domid);
-	if (!domain && get_domain_info(domid, &dominfo))
+	if (!domain && !xenmanage_get_domain_info(xm_handle, domid, NULL, NULL))
 		domain = alloc_domain(NULL, domid);
 
 	return domain;
@@ -1187,12 +1183,6 @@ int do_reset_watches(const void *ctx, struct connection *conn,
 	return 0;
 }
 
-static int close_xc_handle(void *_handle)
-{
-	xc_interface_close(*(xc_interface**)_handle);
-	return 0;
-}
-
 static int close_xgt_handle(void *_handle)
 {
 	xengnttab_close(*(xengnttab_handle **)_handle);
@@ -1258,15 +1248,9 @@ void domain_early_init(void)
 	if (!domhash)
 		barf_perror("Failed to allocate domain hashtable");
 
-	xc_handle = talloc(talloc_autofree_context(), xc_interface*);
-	if (!xc_handle)
-		barf_perror("Failed to allocate domain handle");
-
-	*xc_handle = xc_interface_open(0,0,0);
-	if (!*xc_handle)
-		barf_perror("Failed to open connection to hypervisor");
-
-	talloc_set_destructor(xc_handle, close_xc_handle);
+	xm_handle = xenmanage_open(NULL, 0);
+	if (!xm_handle)
+		barf_perror("Failed to open connection to libxenmanage");
 
 	xgt_handle = talloc(talloc_autofree_context(), xengnttab_handle*);
 	if (!xgt_handle)
@@ -1306,6 +1290,8 @@ void domain_deinit(void)
 {
 	if (virq_port)
 		xenevtchn_unbind(xce_handle, virq_port);
+
+	xenmanage_close(xm_handle);
 }
 
 /*
@@ -1335,13 +1321,13 @@ int domain_alloc_permrefs(struct node_perms *perms)
 {
 	unsigned int i, domid;
 	struct domain *d;
-	xc_domaininfo_t dominfo;
 
 	for (i = 0; i < perms->num; i++) {
 		domid = perms->p[i].id;
 		d = find_domain_struct(domid);
 		if (!d) {
-			if (!get_domain_info(domid, &dominfo))
+			if (xenmanage_get_domain_info(xm_handle, domid,
+						      NULL, NULL))
 				perms->p[i].perms |= XS_PERM_IGNORE;
 			else if (!alloc_domain(NULL, domid))
 				return ENOMEM;
diff --git a/tools/xenstored/lu.c b/tools/xenstored/lu.c
index bec2a84e10..4fccbbc195 100644
--- a/tools/xenstored/lu.c
+++ b/tools/xenstored/lu.c
@@ -11,6 +11,7 @@
 #include <stdlib.h>
 #include <syslog.h>
 #include <time.h>
+#include <unistd.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 
diff --git a/tools/xenstored/lu_daemon.c b/tools/xenstored/lu_daemon.c
index 6df6c80a2a..88d8d9e1b3 100644
--- a/tools/xenstored/lu_daemon.c
+++ b/tools/xenstored/lu_daemon.c
@@ -6,6 +6,7 @@
  */
 
 #include <syslog.h>
+#include <unistd.h>
 #include <sys/stat.h>
 
 #include "talloc.h"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:12:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:12:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903492.1311393 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB1J-0006el-Iq; Thu, 06 Mar 2025 13:12:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903492.1311393; Thu, 06 Mar 2025 13:12:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB1J-0006ed-GM; Thu, 06 Mar 2025 13:12:13 +0000
Received: by outflank-mailman (input) for mailman id 903492;
 Thu, 06 Mar 2025 13:12:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB1I-0006eV-Ou
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:12:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB1I-0055ce-39
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB1I-00AJaR-2E
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CC7Dg/VMN2I0pSVxY6KTxLxGGkf7M64PQ+mJd+/6Q0M=; b=chyZDq1tYcXNRGhpQBdDYITzLm
	s3RFHTWkN7saTTH6kJcZV3nhs6xLisr0bBdu/M3Mo2RyerBD/12NfLoy0XW0ldjhwM5ilK6WCTGaT
	kcJ9iIMo6nBVVRqheSb2dOwBWD7kyYp0hXyGjzEjgiH2ZZKeLJoIqTndhFDSQw9Y6/C4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: improve CET-IBT pruning of ENDBR
Message-Id: <E1tqB1I-00AJaR-2E@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:12:12 +0000

commit 82457157cbd3cf99619b51d75751f72657cb122e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:56:21 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:56:21 2025 +0100

    x86/HVM: improve CET-IBT pruning of ENDBR
    
    __init{const,data}_cf_clobber can have an effect only for pointers
    actually populated in the respective tables. While not the case for SVM
    right now, VMX installs a number of pointers only under certain
    conditions. Hence the respective functions would have their ENDBR purged
    only when those conditions are met. Invoke "pruning" functions after
    having copied the respective tables, for them to install any "missing"
    pointers.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/hvm.c             |  9 ++++++++-
 xen/arch/x86/hvm/svm/svm.c         | 13 +++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c         | 24 ++++++++++++++++++++++++
 xen/arch/x86/include/asm/hvm/hvm.h |  3 +++
 4 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 969e43c2f2..2f31180b6f 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -160,10 +160,17 @@ static int __init cf_check hvm_enable(void)
     else if ( using_svm() )
         fns = start_svm();
 
+    if ( fns )
+        hvm_funcs = *fns;
+
+    if ( IS_ENABLED(CONFIG_INTEL_VMX) )
+        vmx_fill_funcs();
+    if ( IS_ENABLED(CONFIG_AMD_SVM) )
+        svm_fill_funcs();
+
     if ( fns == NULL )
         return 0;
 
-    hvm_funcs = *fns;
     hvm_enabled = 1;
 
     printk("HVM: %s enabled\n", fns->name);
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index ea78da4f42..42128e33ce 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2531,6 +2531,19 @@ const struct hvm_function_table * __init start_svm(void)
     return &svm_function_table;
 }
 
+void __init svm_fill_funcs(void)
+{
+    /*
+     * Now that svm_function_table was copied, populate all function pointers
+     * which may have been left at NULL, for __initdata_cf_clobber to have as
+     * much of an effect as possible.
+     */
+    if ( !cpu_has_xen_ibt )
+        return;
+
+    /* Nothing at present. */
+}
+
 void asmlinkage svm_vmexit_handler(void)
 {
     struct cpu_user_regs *regs = guest_cpu_user_regs();
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index d87da427ad..1911e79517 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3064,6 +3064,30 @@ const struct hvm_function_table * __init start_vmx(void)
     return &vmx_function_table;
 }
 
+void __init vmx_fill_funcs(void)
+{
+    /*
+     * Now that vmx_function_table was copied, populate all function pointers
+     * which may have been left at NULL, for __initdata_cf_clobber to have as
+     * much of an effect as possible.
+     */
+    if ( !cpu_has_xen_ibt )
+        return;
+
+    vmx_function_table.set_descriptor_access_exiting =
+        vmx_set_descriptor_access_exiting;
+
+    vmx_function_table.update_eoi_exit_bitmap = vmx_update_eoi_exit_bitmap;
+    vmx_function_table.process_isr            = vmx_process_isr;
+    vmx_function_table.handle_eoi             = vmx_handle_eoi;
+
+    vmx_function_table.pi_update_irte = vmx_pi_update_irte;
+
+    vmx_function_table.deliver_posted_intr = vmx_deliver_posted_intr;
+    vmx_function_table.sync_pir_to_irr     = vmx_sync_pir_to_irr;
+    vmx_function_table.test_pir            = vmx_test_pir;
+}
+
 /*
  * Not all cases receive valid value in the VM-exit instruction length field.
  * Callers must know what they're doing!
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index cad3a94278..963e820113 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -260,6 +260,9 @@ extern int8_t hvm_port80_allowed;
 extern const struct hvm_function_table *start_svm(void);
 extern const struct hvm_function_table *start_vmx(void);
 
+void svm_fill_funcs(void);
+void vmx_fill_funcs(void);
+
 int hvm_domain_initialise(struct domain *d,
                           const struct xen_domctl_createdomain *config);
 void hvm_domain_relinquish_resources(struct domain *d);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:12:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:12:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903493.1311397 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB1T-0006hv-Lj; Thu, 06 Mar 2025 13:12:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903493.1311397; Thu, 06 Mar 2025 13:12:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB1T-0006hn-J5; Thu, 06 Mar 2025 13:12:23 +0000
Received: by outflank-mailman (input) for mailman id 903493;
 Thu, 06 Mar 2025 13:12:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB1S-0006hf-Rt
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:12:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB1T-0055cn-0E
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB1S-00AJbL-2b
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:12:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N/NITnP6rCiAFZ1HV0xFGyTsQnkzKlRsDE2XVC9JvWk=; b=6qnWZ2BUaWj5jg9NbbfcHnmsMO
	0FK5+jIi3FvJRCYNdyYOC2t0TLhWWVx1WVGKNQVlwQGJ1XjkfgihRr2nsSrMjfhqRBTfI0NMJVT0n
	htlGDnrKCgQaqdOLDV8Lnf2EyMm0LUnAvNVIkb3HX18ws9ZKSQqOtl1Y4QKSjcXn0ZTc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: drop vmcs_revision_id
Message-Id: <E1tqB1S-00AJbL-2b@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:12:22 +0000

commit b13f2a901cc81f02f8d40be6b4e86251075abf96
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:56:49 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:56:49 2025 +0100

    VMX: drop vmcs_revision_id
    
    It's effectively redundant with vmx_basic_msr. For the #define
    replacement to work, struct vmcs_struct's respective field name also
    needs to change: Drop the not really meaningful "vmcs_" prefix from it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             |  5 ++---
 xen/arch/x86/hvm/vmx/vvmx.c             | 12 ++++++------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 20ab2d0f26..0622ef40db 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -177,7 +177,7 @@ static DEFINE_PER_CPU(paddr_t, current_vmcs);
 static DEFINE_PER_CPU(struct list_head, active_vmcs_list);
 DEFINE_PER_CPU(bool, vmxon);
 
-static u32 vmcs_revision_id __read_mostly;
+#define vmcs_revision_id (vmx_basic_msr & VMX_BASIC_REVISION_MASK)
 u64 __read_mostly vmx_basic_msr;
 
 static void __init vmx_display_features(void)
@@ -503,7 +503,6 @@ static int vmx_init_vmcs_config(bool bsp)
     if ( !vmx_pin_based_exec_control )
     {
         /* First time through. */
-        vmcs_revision_id           = vmx_basic_msr_low & VMX_BASIC_REVISION_MASK;
         vmx_pin_based_exec_control = _vmx_pin_based_exec_control;
         vmx_cpu_based_exec_control = _vmx_cpu_based_exec_control;
         vmx_secondary_exec_control = _vmx_secondary_exec_control;
@@ -615,7 +614,7 @@ static paddr_t vmx_alloc_vmcs(void)
 
     vmcs = __map_domain_page(pg);
     clear_page(vmcs);
-    vmcs->vmcs_revision_id = vmcs_revision_id;
+    vmcs->revision_id = vmcs_revision_id;
     unmap_domain_page(vmcs);
 
     return page_to_maddr(pg);
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index cf47d61b14..a3d7d1e4d7 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1166,7 +1166,7 @@ static void nvmx_set_vmcs_pointer(struct vcpu *v, struct vmcs_struct *vvmcs)
     paddr_t vvmcs_maddr = v->arch.hvm.vmx.vmcs_shadow_maddr;
 
     __vmpclear(vvmcs_maddr);
-    vvmcs->vmcs_revision_id |= VMCS_RID_TYPE_MASK;
+    vvmcs->revision_id |= VMCS_RID_TYPE_MASK;
     v->arch.hvm.vmx.secondary_exec_control |=
         SECONDARY_EXEC_ENABLE_VMCS_SHADOWING;
     __vmwrite(SECONDARY_VM_EXEC_CONTROL,
@@ -1181,7 +1181,7 @@ static void nvmx_clear_vmcs_pointer(struct vcpu *v, struct vmcs_struct *vvmcs)
     paddr_t vvmcs_maddr = v->arch.hvm.vmx.vmcs_shadow_maddr;
 
     __vmpclear(vvmcs_maddr);
-    vvmcs->vmcs_revision_id &= ~VMCS_RID_TYPE_MASK;
+    vvmcs->revision_id &= ~VMCS_RID_TYPE_MASK;
     v->arch.hvm.vmx.secondary_exec_control &=
         ~SECONDARY_EXEC_ENABLE_VMCS_SHADOWING;
     __vmwrite(SECONDARY_VM_EXEC_CONTROL,
@@ -1799,10 +1799,10 @@ static int nvmx_handle_vmptrld(struct cpu_user_regs *regs)
             {
                 struct vmcs_struct *vvmcs = vvmcx;
 
-                if ( ((vvmcs->vmcs_revision_id ^ vmx_basic_msr) &
-                                         VMX_BASIC_REVISION_MASK) ||
+                if ( ((vvmcs->revision_id ^ vmx_basic_msr) &
+                      VMX_BASIC_REVISION_MASK) ||
                      (!cpu_has_vmx_vmcs_shadowing &&
-                      (vvmcs->vmcs_revision_id & ~VMX_BASIC_REVISION_MASK)) )
+                      (vvmcs->revision_id & ~VMX_BASIC_REVISION_MASK)) )
                 {
                     hvm_unmap_guest_frame(vvmcx, 1);
                     vmfail(regs, VMX_INSN_VMPTRLD_INCORRECT_VMCS_ID);
@@ -2215,7 +2215,7 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 *msr_content)
             map_domain_page(_mfn(PFN_DOWN(v->arch.hvm.vmx.vmcs_pa)));
 
         data = (host_data & (~0ul << 32)) |
-               (vmcs->vmcs_revision_id & 0x7fffffff);
+               (vmcs->revision_id & 0x7fffffff);
         unmap_domain_page(vmcs);
 
         if ( !cpu_has_vmx_vmcs_shadowing )
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index bfb2341011..d9d64764ef 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -17,7 +17,7 @@ int cf_check vmx_cpu_up(void);
 void cf_check vmx_cpu_down(void);
 
 struct vmcs_struct {
-    u32 vmcs_revision_id;
+    uint32_t revision_id;
     unsigned char data [0]; /* vmcs size is read from MSR */
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:12:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:12:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903494.1311401 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB1d-0006l3-N6; Thu, 06 Mar 2025 13:12:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903494.1311401; Thu, 06 Mar 2025 13:12:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB1d-0006kt-KP; Thu, 06 Mar 2025 13:12:33 +0000
Received: by outflank-mailman (input) for mailman id 903494;
 Thu, 06 Mar 2025 13:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB1c-0006kj-VF
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:12:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB1d-0055d4-0Y
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:12:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB1c-00AJbp-2t
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:12:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CDLkCHJvaTFKYHnrByoGqUryX1kMc0is1Hw+8dAOVFk=; b=ThhHknupwkjsCz0vro5StL9o6L
	cD7aPDERRdsILskw/R60At5YAl+JB80aYPo9zqt/wD0lZnfcwDItHl40P7e7OH5tNFpiQVMkXmiyL
	2u2jpKuEXbERdpNvRyQ9inxymj6A/4lKCj0x1QwRqzK5kMyDSYClpZf80Rx1UI+tpQ8Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: convert vmx_basic_msr
Message-Id: <E1tqB1c-00AJbp-2t@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:12:32 +0000

commit f7a31ac57281abc95159872e0b006b48b52efe98
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:57:21 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:57:21 2025 +0100

    VMX: convert vmx_basic_msr
    
    ... to a struct field, which is then going to be accompanied by other
    capability/control data presently living in individual variables. As
    this structure isn't supposed to be altered post-boot, put it in
    .data.ro_after_init right away.
    
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 12 ++++++------
 xen/arch/x86/hvm/vmx/vvmx.c             |  6 +++---
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  9 +++++++--
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 0622ef40db..bd0d931063 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -163,6 +163,7 @@ static int cf_check parse_ept_param_runtime(const char *s)
 #endif
 
 /* Dynamic (run-time adjusted) execution control flags. */
+struct vmx_caps __ro_after_init vmx_caps;
 u32 vmx_pin_based_exec_control __read_mostly;
 u32 vmx_cpu_based_exec_control __read_mostly;
 u32 vmx_secondary_exec_control __read_mostly;
@@ -177,8 +178,7 @@ static DEFINE_PER_CPU(paddr_t, current_vmcs);
 static DEFINE_PER_CPU(struct list_head, active_vmcs_list);
 DEFINE_PER_CPU(bool, vmxon);
 
-#define vmcs_revision_id (vmx_basic_msr & VMX_BASIC_REVISION_MASK)
-u64 __read_mostly vmx_basic_msr;
+#define vmcs_revision_id (vmx_caps.basic_msr & VMX_BASIC_REVISION_MASK)
 
 static void __init vmx_display_features(void)
 {
@@ -510,8 +510,8 @@ static int vmx_init_vmcs_config(bool bsp)
         vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
         vmx_vmexit_control         = _vmx_vmexit_control;
         vmx_vmentry_control        = _vmx_vmentry_control;
-        vmx_basic_msr              = ((u64)vmx_basic_msr_high << 32) |
-                                     vmx_basic_msr_low;
+        vmx_caps.basic_msr = ((uint64_t)vmx_basic_msr_high << 32) |
+                             vmx_basic_msr_low;
         vmx_vmfunc                 = _vmx_vmfunc;
 
         vmx_display_features();
@@ -565,7 +565,7 @@ static int vmx_init_vmcs_config(bool bsp)
             mismatch = 1;
         }
         if ( (vmx_basic_msr_high & (VMX_BASIC_VMCS_SIZE_MASK >> 32)) !=
-             ((vmx_basic_msr & VMX_BASIC_VMCS_SIZE_MASK) >> 32) )
+             ((vmx_caps.basic_msr & VMX_BASIC_VMCS_SIZE_MASK) >> 32) )
         {
             printk("VMX: CPU%d unexpected VMCS size %Lu\n",
                    smp_processor_id(),
@@ -2230,7 +2230,7 @@ int __init vmx_vmcs_init(void)
          * _vmx_vcpu_up() may have made it past feature identification.
          * Make sure all dependent features are off as well.
          */
-        vmx_basic_msr              = 0;
+        memset(&vmx_caps, 0, sizeof(vmx_caps));
         vmx_pin_based_exec_control = 0;
         vmx_cpu_based_exec_control = 0;
         vmx_secondary_exec_control = 0;
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index a3d7d1e4d7..87ac43c5c4 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1561,7 +1561,7 @@ static int nvmx_handle_vmxon(struct cpu_user_regs *regs)
     rc = hvm_copy_from_guest_phys(&nvmcs_revid, gpa, sizeof(nvmcs_revid));
     if ( rc != HVMTRANS_okay ||
          (nvmcs_revid & ~VMX_BASIC_REVISION_MASK) ||
-         ((nvmcs_revid ^ vmx_basic_msr) & VMX_BASIC_REVISION_MASK) )
+         ((nvmcs_revid ^ vmx_caps.basic_msr) & VMX_BASIC_REVISION_MASK) )
     {
         vmfail_invalid(regs);
         return X86EMUL_OKAY;
@@ -1799,7 +1799,7 @@ static int nvmx_handle_vmptrld(struct cpu_user_regs *regs)
             {
                 struct vmcs_struct *vvmcs = vvmcx;
 
-                if ( ((vvmcs->revision_id ^ vmx_basic_msr) &
+                if ( ((vvmcs->revision_id ^ vmx_caps.basic_msr) &
                       VMX_BASIC_REVISION_MASK) ||
                      (!cpu_has_vmx_vmcs_shadowing &&
                       (vvmcs->revision_id & ~VMX_BASIC_REVISION_MASK)) )
@@ -2193,7 +2193,7 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 *msr_content)
     case MSR_IA32_VMX_TRUE_PROCBASED_CTLS:
     case MSR_IA32_VMX_TRUE_EXIT_CTLS:
     case MSR_IA32_VMX_TRUE_ENTRY_CTLS:
-        if ( !(vmx_basic_msr & VMX_BASIC_DEFAULT1_ZERO) )
+        if ( !(vmx_caps.basic_msr & VMX_BASIC_DEFAULT1_ZERO) )
             return 0;
         break;
 
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index d9d64764ef..5efa3e9659 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -300,6 +300,12 @@ extern u64 vmx_ept_vpid_cap;
 
 #define VMX_TSC_MULTIPLIER_MAX                  0xffffffffffffffffULL
 
+/* Capabilities and dynamic (run-time adjusted) execution control flags. */
+struct vmx_caps {
+    uint64_t basic_msr;
+};
+extern struct vmx_caps vmx_caps;
+
 #define cpu_has_wbinvd_exiting \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      vmx_secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING)
@@ -415,9 +421,8 @@ extern u64 vmx_ept_vpid_cap;
  */
 #define VMX_BASIC_DEFAULT1_ZERO		(1ULL << 55)
 
-extern u64 vmx_basic_msr;
 #define cpu_has_vmx_ins_outs_instr_info \
-    (!!(vmx_basic_msr & VMX_BASIC_INS_OUT_INFO))
+    (!!(vmx_caps.basic_msr & VMX_BASIC_INS_OUT_INFO))
 
 /* Guest interrupt status */
 #define VMX_GUEST_INTR_STATUS_SUBFIELD_BITMASK  0x0FF
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:12:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:12:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903495.1311405 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB1n-0006nG-Oc; Thu, 06 Mar 2025 13:12:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903495.1311405; Thu, 06 Mar 2025 13:12:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB1n-0006n8-Ls; Thu, 06 Mar 2025 13:12:43 +0000
Received: by outflank-mailman (input) for mailman id 903495;
 Thu, 06 Mar 2025 13:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB1n-0006n1-2N
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB1n-0055dC-0t
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB1n-00AJeb-00
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Hpp+eN3reorQh7M24W115Ir6frZlTPwU77St648W+vw=; b=CrJR7xBLCTnJyih5GDBZCcALsj
	Q19JgOhZn8jlaHWnBXA7z926h3/qO0jkyFqUq3OP9GEt/Q1wdZPV2APOpOV5Ca04+Evw+ilZKHzL9
	FPohp25y6OczXalMZmE+w0ZgNifCrGx+7jT/qPHdC/KVrGog1M3kO829plsEnXVL1wKA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: convert vmx_pin_based_exec_control
Message-Id: <E1tqB1n-00AJeb-00@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:12:43 +0000

commit 403f3dc2cb2429c26c46cf26f0f621da0d7512a3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:57:41 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:57:41 2025 +0100

    VMX: convert vmx_pin_based_exec_control
    
    ... to a field in the capability/controls struct. Use an instance of
    that struct also in vmx_init_vmcs_config().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 22 ++++++++++------------
 xen/arch/x86/hvm/vmx/vvmx.c             |  2 +-
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  6 +++---
 3 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index bd0d931063..ecac859f7e 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-u32 vmx_pin_based_exec_control __read_mostly;
 u32 vmx_cpu_based_exec_control __read_mostly;
 u32 vmx_secondary_exec_control __read_mostly;
 uint64_t vmx_tertiary_exec_control __read_mostly;
@@ -265,7 +264,7 @@ static bool cap_check(
 static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
-    u32 _vmx_pin_based_exec_control;
+    struct vmx_caps caps = {};
     u32 _vmx_cpu_based_exec_control;
     u32 _vmx_secondary_exec_control = 0;
     uint64_t _vmx_tertiary_exec_control = 0;
@@ -282,7 +281,7 @@ static int vmx_init_vmcs_config(bool bsp)
            PIN_BASED_NMI_EXITING);
     opt = (PIN_BASED_VIRTUAL_NMIS |
            PIN_BASED_POSTED_INTERRUPT);
-    _vmx_pin_based_exec_control = adjust_vmx_controls(
+    caps.pin_based_exec_control = adjust_vmx_controls(
         "Pin-Based Exec Control", min, opt,
         MSR_IA32_VMX_PINBASED_CTLS, &mismatch);
 
@@ -445,7 +444,7 @@ static int vmx_init_vmcs_config(bool bsp)
     if ( (_vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING) &&
           ple_gap == 0 )
     {
-        if ( !vmx_pin_based_exec_control )
+        if ( !vmx_caps.pin_based_exec_control )
             printk(XENLOG_INFO "Disable Pause-Loop Exiting.\n");
         _vmx_secondary_exec_control &= ~ SECONDARY_EXEC_PAUSE_LOOP_EXITING;
     }
@@ -463,10 +462,10 @@ static int vmx_init_vmcs_config(bool bsp)
      * is a minimal requirement, only check the former, which is optional.
      */
     if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) )
-        _vmx_pin_based_exec_control &= ~PIN_BASED_POSTED_INTERRUPT;
+        caps.pin_based_exec_control &= ~PIN_BASED_POSTED_INTERRUPT;
 
     if ( iommu_intpost &&
-         !(_vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT) )
+         !(caps.pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT) )
     {
         printk("Intel VT-d Posted Interrupt is disabled for CPU-side Posted "
                "Interrupt is not enabled\n");
@@ -500,10 +499,10 @@ static int vmx_init_vmcs_config(bool bsp)
     if ( mismatch )
         return -EINVAL;
 
-    if ( !vmx_pin_based_exec_control )
+    if ( !vmx_caps.pin_based_exec_control )
     {
         /* First time through. */
-        vmx_pin_based_exec_control = _vmx_pin_based_exec_control;
+        vmx_caps = caps;
         vmx_cpu_based_exec_control = _vmx_cpu_based_exec_control;
         vmx_secondary_exec_control = _vmx_secondary_exec_control;
         vmx_tertiary_exec_control  = _vmx_tertiary_exec_control;
@@ -534,7 +533,7 @@ static int vmx_init_vmcs_config(bool bsp)
             vmcs_revision_id, vmx_basic_msr_low & VMX_BASIC_REVISION_MASK);
         mismatch |= cap_check(
             "Pin-Based Exec Control",
-            vmx_pin_based_exec_control, _vmx_pin_based_exec_control);
+            vmx_caps.pin_based_exec_control, caps.pin_based_exec_control);
         mismatch |= cap_check(
             "CPU-Based Exec Control",
             vmx_cpu_based_exec_control, _vmx_cpu_based_exec_control);
@@ -1115,7 +1114,7 @@ static int construct_vmcs(struct vcpu *v)
     vmx_vmcs_enter(v);
 
     /* VMCS controls. */
-    __vmwrite(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_control);
+    __vmwrite(PIN_BASED_VM_EXEC_CONTROL, vmx_caps.pin_based_exec_control);
 
     v->arch.hvm.vmx.exec_control = vmx_cpu_based_exec_control;
     if ( d->arch.vtsc && !cpu_has_vmx_tsc_scaling )
@@ -2152,7 +2151,7 @@ void vmcs_dump_vcpu(struct vcpu *v)
     printk("TSC Offset = 0x%016lx  TSC Multiplier = 0x%016lx\n",
            vmr(TSC_OFFSET), vmr(TSC_MULTIPLIER));
     if ( (v->arch.hvm.vmx.exec_control & CPU_BASED_TPR_SHADOW) ||
-         (vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT) )
+         (vmx_caps.pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT) )
         printk("TPR Threshold = 0x%02x  PostedIntrVec = 0x%02x\n",
                vmr32(TPR_THRESHOLD), vmr16(POSTED_INTR_NOTIFICATION_VECTOR));
     if ( (v->arch.hvm.vmx.secondary_exec_control &
@@ -2231,7 +2230,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_pin_based_exec_control = 0;
         vmx_cpu_based_exec_control = 0;
         vmx_secondary_exec_control = 0;
         vmx_tertiary_exec_control  = 0;
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 87ac43c5c4..99bf423a2d 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1057,7 +1057,7 @@ static void load_shadow_control(struct vcpu *v)
      * and EXCEPTION
      * Enforce the removed features
      */
-    nvmx_update_pin_control(v, vmx_pin_based_exec_control);
+    nvmx_update_pin_control(v, vmx_caps.pin_based_exec_control);
     vmx_update_cpu_exec_control(v);
     vmx_update_secondary_exec_control(v);
     nvmx_update_exit_control(v, vmx_vmexit_control);
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 5efa3e9659..28afad568f 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -217,7 +217,6 @@ extern u32 vmx_cpu_based_exec_control;
 #define PIN_BASED_VIRTUAL_NMIS          0x00000020
 #define PIN_BASED_PREEMPT_TIMER         0x00000040
 #define PIN_BASED_POSTED_INTERRUPT      0x00000080
-extern u32 vmx_pin_based_exec_control;
 
 #define VM_EXIT_SAVE_DEBUG_CNTRLS       0x00000004
 #define VM_EXIT_IA32E_MODE              0x00000200
@@ -303,6 +302,7 @@ extern u64 vmx_ept_vpid_cap;
 /* Capabilities and dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps {
     uint64_t basic_msr;
+    uint32_t pin_based_exec_control;
 };
 extern struct vmx_caps vmx_caps;
 
@@ -317,7 +317,7 @@ extern struct vmx_caps vmx_caps;
      vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW)
 #define cpu_has_vmx_vnmi \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_pin_based_exec_control & PIN_BASED_VIRTUAL_NMIS)
+     (vmx_caps.pin_based_exec_control & PIN_BASED_VIRTUAL_NMIS))
 #define cpu_has_vmx_msr_bitmap \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP)
@@ -371,7 +371,7 @@ extern struct vmx_caps vmx_caps;
      vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)
 #define cpu_has_vmx_posted_intr_processing \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT)
+     (vmx_caps.pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT))
 #define cpu_has_vmx_vmcs_shadowing \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VMCS_SHADOWING)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:12:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:12:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903496.1311410 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB1x-0006pc-QW; Thu, 06 Mar 2025 13:12:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903496.1311410; Thu, 06 Mar 2025 13:12:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB1x-0006pU-NH; Thu, 06 Mar 2025 13:12:53 +0000
Received: by outflank-mailman (input) for mailman id 903496;
 Thu, 06 Mar 2025 13:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB1x-0006pM-5t
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB1x-0055dG-1F
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB1x-00AJex-0K
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BlaCpuMRDXtIHdplBfSLUWG9zqW7eNd8iaU8kgei3U4=; b=IBjhXXkAs03ATghfWs36qWD6G2
	Vr9aBzJxa+5Tpeww1VeEBP/HH+FBke50Cul9+Y6agvH1TWt0156Kv2N9j9+o3iF7WJeLgGlGMJwJi
	9dwSD/cpjbIRuRgdKq4TU5V5iX89M6lly7YM0U6Vi0jvSYVLf96sMd1T8CMdQnZDZdgw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: convert vmx_cpu_based_exec_control
Message-Id: <E1tqB1x-00AJex-0K@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:12:53 +0000

commit 6bd5e5ec3d14a73a76c1b06ebdd7cb0754753ca2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:58:04 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:58:04 2025 +0100

    VMX: convert vmx_cpu_based_exec_control
    
    ... to a field in the capability/controls struct.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 22 +++++++++-------------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 12 ++++++------
 2 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index ecac859f7e..bf73babac0 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-u32 vmx_cpu_based_exec_control __read_mostly;
 u32 vmx_secondary_exec_control __read_mostly;
 uint64_t vmx_tertiary_exec_control __read_mostly;
 u32 vmx_vmexit_control __read_mostly;
@@ -265,7 +264,6 @@ static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     struct vmx_caps caps = {};
-    u32 _vmx_cpu_based_exec_control;
     u32 _vmx_secondary_exec_control = 0;
     uint64_t _vmx_tertiary_exec_control = 0;
     u64 _vmx_ept_vpid_cap = 0;
@@ -303,12 +301,12 @@ static int vmx_init_vmcs_config(bool bsp)
            CPU_BASED_MONITOR_TRAP_FLAG |
            CPU_BASED_ACTIVATE_SECONDARY_CONTROLS |
            CPU_BASED_ACTIVATE_TERTIARY_CONTROLS);
-    _vmx_cpu_based_exec_control = adjust_vmx_controls(
+    caps.cpu_based_exec_control = adjust_vmx_controls(
         "CPU-Based Exec Control", min, opt,
         MSR_IA32_VMX_PROCBASED_CTLS, &mismatch);
-    _vmx_cpu_based_exec_control &= ~CPU_BASED_RDTSC_EXITING;
-    if ( _vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW )
-        _vmx_cpu_based_exec_control &=
+    caps.cpu_based_exec_control &= ~CPU_BASED_RDTSC_EXITING;
+    if ( caps.cpu_based_exec_control & CPU_BASED_TPR_SHADOW )
+        caps.cpu_based_exec_control &=
             ~(CPU_BASED_CR8_LOAD_EXITING | CPU_BASED_CR8_STORE_EXITING);
 
     rdmsrl(MSR_IA32_VMX_MISC, _vmx_misc_cap);
@@ -325,7 +323,7 @@ static int vmx_init_vmcs_config(bool bsp)
         return -EINVAL;
     }
 
-    if ( _vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS )
+    if ( caps.cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS )
     {
         min = 0;
         opt = (SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
@@ -355,7 +353,7 @@ static int vmx_init_vmcs_config(bool bsp)
          * "APIC Register Virtualization" and "Virtual Interrupt Delivery"
          * can be set only when "use TPR shadow" is set
          */
-        if ( (_vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW) &&
+        if ( (caps.cpu_based_exec_control & CPU_BASED_TPR_SHADOW) &&
              opt_apicv_enabled )
             opt |= SECONDARY_EXEC_APIC_REGISTER_VIRT |
                    SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
@@ -366,7 +364,7 @@ static int vmx_init_vmcs_config(bool bsp)
             MSR_IA32_VMX_PROCBASED_CTLS2, &mismatch);
     }
 
-    if ( _vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS )
+    if ( caps.cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS )
     {
         uint64_t opt = (TERTIARY_EXEC_VIRT_SPEC_CTRL |
                         TERTIARY_EXEC_EPT_PAGING_WRITE);
@@ -503,7 +501,6 @@ static int vmx_init_vmcs_config(bool bsp)
     {
         /* First time through. */
         vmx_caps = caps;
-        vmx_cpu_based_exec_control = _vmx_cpu_based_exec_control;
         vmx_secondary_exec_control = _vmx_secondary_exec_control;
         vmx_tertiary_exec_control  = _vmx_tertiary_exec_control;
         vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
@@ -536,7 +533,7 @@ static int vmx_init_vmcs_config(bool bsp)
             vmx_caps.pin_based_exec_control, caps.pin_based_exec_control);
         mismatch |= cap_check(
             "CPU-Based Exec Control",
-            vmx_cpu_based_exec_control, _vmx_cpu_based_exec_control);
+            vmx_caps.cpu_based_exec_control, caps.cpu_based_exec_control);
         mismatch |= cap_check(
             "Secondary Exec Control",
             vmx_secondary_exec_control, _vmx_secondary_exec_control);
@@ -1116,7 +1113,7 @@ static int construct_vmcs(struct vcpu *v)
     /* VMCS controls. */
     __vmwrite(PIN_BASED_VM_EXEC_CONTROL, vmx_caps.pin_based_exec_control);
 
-    v->arch.hvm.vmx.exec_control = vmx_cpu_based_exec_control;
+    v->arch.hvm.vmx.exec_control = vmx_caps.cpu_based_exec_control;
     if ( d->arch.vtsc && !cpu_has_vmx_tsc_scaling )
         v->arch.hvm.vmx.exec_control |= CPU_BASED_RDTSC_EXITING;
 
@@ -2230,7 +2227,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_cpu_based_exec_control = 0;
         vmx_secondary_exec_control = 0;
         vmx_tertiary_exec_control  = 0;
         vmx_vmexit_control         = 0;
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 28afad568f..685a28c336 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -210,7 +210,6 @@ void vmx_vmcs_reload(struct vcpu *v);
 #define CPU_BASED_MONITOR_EXITING             0x20000000U
 #define CPU_BASED_PAUSE_EXITING               0x40000000U
 #define CPU_BASED_ACTIVATE_SECONDARY_CONTROLS 0x80000000U
-extern u32 vmx_cpu_based_exec_control;
 
 #define PIN_BASED_EXT_INTR_MASK         0x00000001
 #define PIN_BASED_NMI_EXITING           0x00000008
@@ -303,6 +302,7 @@ extern u64 vmx_ept_vpid_cap;
 struct vmx_caps {
     uint64_t basic_msr;
     uint32_t pin_based_exec_control;
+    uint32_t cpu_based_exec_control;
 };
 extern struct vmx_caps vmx_caps;
 
@@ -314,19 +314,19 @@ extern struct vmx_caps vmx_caps;
      vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)
 #define cpu_has_vmx_tpr_shadow \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW)
+     (vmx_caps.cpu_based_exec_control & CPU_BASED_TPR_SHADOW))
 #define cpu_has_vmx_vnmi \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.pin_based_exec_control & PIN_BASED_VIRTUAL_NMIS))
 #define cpu_has_vmx_msr_bitmap \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP)
+     (vmx_caps.cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP))
 #define cpu_has_vmx_secondary_exec_control \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)
+     (vmx_caps.cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS))
 #define cpu_has_vmx_tertiary_exec_control \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS)
+     (vmx_caps.cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS))
 #define cpu_has_vmx_ept \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT)
@@ -341,7 +341,7 @@ extern struct vmx_caps vmx_caps;
      vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID)
 #define cpu_has_monitor_trap_flag \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_cpu_based_exec_control & CPU_BASED_MONITOR_TRAP_FLAG)
+     (vmx_caps.cpu_based_exec_control & CPU_BASED_MONITOR_TRAP_FLAG))
 #define cpu_has_vmx_pat \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_PAT)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:13:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:13:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903497.1311413 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB27-0006tC-Tq; Thu, 06 Mar 2025 13:13:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903497.1311413; Thu, 06 Mar 2025 13:13:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB27-0006t4-R8; Thu, 06 Mar 2025 13:13:03 +0000
Received: by outflank-mailman (input) for mailman id 903497;
 Thu, 06 Mar 2025 13:13:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB27-0006sv-9H
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:13:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB27-0055dt-1a
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB27-00AJfd-0f
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Mx3vasquSxrB7F5xp2Akd+xALqHwtsOtf36PFDTUD5I=; b=h/Hem0HYKyf+9wHyXw65kadceN
	xWATgUo8IgPgYS0Ui1KxZT6T7Y26f1YqKqZx213hbl90AqN0Gp+yMVA+gvmfUAj1cXw7k5wjOtztF
	AomSQo38NcYIjiWMrMBb2UxF2CwpxVTB/GkQcBT0P6A3KuHIH76Jwb5qnQbK3Zfq+t5Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: convert vmx_secondary_exec_control
Message-Id: <E1tqB27-00AJfd-0f@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:13:03 +0000

commit 11077f166085054631d133cc70465ceb9e4a9ac5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:58:24 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:58:24 2025 +0100

    VMX: convert vmx_secondary_exec_control
    
    ... to a field in the capability/controls struct.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 42 +++++++++++++++------------------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 42 ++++++++++++++++-----------------
 2 files changed, 40 insertions(+), 44 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index bf73babac0..46dcdc21ec 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-u32 vmx_secondary_exec_control __read_mostly;
 uint64_t vmx_tertiary_exec_control __read_mostly;
 u32 vmx_vmexit_control __read_mostly;
 u32 vmx_vmentry_control __read_mostly;
@@ -264,7 +263,6 @@ static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     struct vmx_caps caps = {};
-    u32 _vmx_secondary_exec_control = 0;
     uint64_t _vmx_tertiary_exec_control = 0;
     u64 _vmx_ept_vpid_cap = 0;
     u64 _vmx_misc_cap = 0;
@@ -359,7 +357,7 @@ static int vmx_init_vmcs_config(bool bsp)
                    SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
                    SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE;
 
-        _vmx_secondary_exec_control = adjust_vmx_controls(
+        caps.secondary_exec_control = adjust_vmx_controls(
             "Secondary Exec Control", min, opt,
             MSR_IA32_VMX_PROCBASED_CTLS2, &mismatch);
     }
@@ -375,7 +373,7 @@ static int vmx_init_vmcs_config(bool bsp)
     }
 
     /* The IA32_VMX_EPT_VPID_CAP MSR exists only when EPT or VPID available */
-    if ( _vmx_secondary_exec_control & (SECONDARY_EXEC_ENABLE_EPT |
+    if ( caps.secondary_exec_control & (SECONDARY_EXEC_ENABLE_EPT |
                                         SECONDARY_EXEC_ENABLE_VPID) )
     {
         rdmsrl(MSR_IA32_VMX_EPT_VPID_CAP, _vmx_ept_vpid_cap);
@@ -397,7 +395,7 @@ static int vmx_init_vmcs_config(bool bsp)
         if ( !(_vmx_ept_vpid_cap & VMX_EPT_MEMORY_TYPE_WB) ||
              !(_vmx_ept_vpid_cap & VMX_EPT_WALK_LENGTH_4_SUPPORTED) ||
              !(_vmx_ept_vpid_cap & VMX_EPT_INVEPT_ALL_CONTEXT) )
-            _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_EPT;
+            caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_EPT;
 
         /*
          * the CPU must support INVVPID all context invalidation, because we
@@ -406,14 +404,14 @@ static int vmx_init_vmcs_config(bool bsp)
          * Or we just don't use VPID.
          */
         if ( !(_vmx_ept_vpid_cap & VMX_VPID_INVVPID_ALL_CONTEXT) )
-            _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VPID;
+            caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VPID;
 
         /* EPT A/D bits is required for PML */
         if ( !(_vmx_ept_vpid_cap & VMX_EPT_AD_BIT) )
-            _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
+            caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
     }
 
-    if ( _vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT )
+    if ( caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT )
     {
         /*
          * To use EPT we expect to be able to clear certain intercepts.
@@ -426,25 +424,25 @@ static int vmx_init_vmcs_config(bool bsp)
         if ( must_be_one & (CPU_BASED_INVLPG_EXITING |
                             CPU_BASED_CR3_LOAD_EXITING |
                             CPU_BASED_CR3_STORE_EXITING) )
-            _vmx_secondary_exec_control &=
+            caps.secondary_exec_control &=
                 ~(SECONDARY_EXEC_ENABLE_EPT |
                   SECONDARY_EXEC_UNRESTRICTED_GUEST);
     }
 
     /* PML cannot be supported if EPT is not used */
-    if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT) )
-        _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
+    if ( !(caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT) )
+        caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
 
     /* Turn off opt_ept_pml if PML feature is not present. */
-    if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_PML) )
+    if ( !(caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_PML) )
         opt_ept_pml = false;
 
-    if ( (_vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING) &&
+    if ( (caps.secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING) &&
           ple_gap == 0 )
     {
         if ( !vmx_caps.pin_based_exec_control )
             printk(XENLOG_INFO "Disable Pause-Loop Exiting.\n");
-        _vmx_secondary_exec_control &= ~ SECONDARY_EXEC_PAUSE_LOOP_EXITING;
+        caps.secondary_exec_control &= ~ SECONDARY_EXEC_PAUSE_LOOP_EXITING;
     }
 
     min = VM_EXIT_ACK_INTR_ON_EXIT;
@@ -459,7 +457,7 @@ static int vmx_init_vmcs_config(bool bsp)
      * delivery" and "acknowledge interrupt on exit" is set. For the latter
      * is a minimal requirement, only check the former, which is optional.
      */
-    if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) )
+    if ( !(caps.secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) )
         caps.pin_based_exec_control &= ~PIN_BASED_POSTED_INTERRUPT;
 
     if ( iommu_intpost &&
@@ -471,7 +469,7 @@ static int vmx_init_vmcs_config(bool bsp)
     }
 
     /* The IA32_VMX_VMFUNC MSR exists only when VMFUNC is available */
-    if ( _vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS )
+    if ( caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS )
     {
         rdmsrl(MSR_IA32_VMX_VMFUNC, _vmx_vmfunc);
 
@@ -481,12 +479,12 @@ static int vmx_init_vmcs_config(bool bsp)
          * Or we just don't use VMFUNC.
          */
         if ( !(_vmx_vmfunc & VMX_VMFUNC_EPTP_SWITCHING) )
-            _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VM_FUNCTIONS;
+            caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VM_FUNCTIONS;
     }
 
     /* Virtualization exceptions are only enabled if VMFUNC is enabled */
-    if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS) )
-        _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS;
+    if ( !(caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS) )
+        caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS;
 
     min = 0;
     opt = (VM_ENTRY_LOAD_GUEST_PAT | VM_ENTRY_LOAD_GUEST_EFER |
@@ -501,7 +499,6 @@ static int vmx_init_vmcs_config(bool bsp)
     {
         /* First time through. */
         vmx_caps = caps;
-        vmx_secondary_exec_control = _vmx_secondary_exec_control;
         vmx_tertiary_exec_control  = _vmx_tertiary_exec_control;
         vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
         vmx_vmexit_control         = _vmx_vmexit_control;
@@ -536,7 +533,7 @@ static int vmx_init_vmcs_config(bool bsp)
             vmx_caps.cpu_based_exec_control, caps.cpu_based_exec_control);
         mismatch |= cap_check(
             "Secondary Exec Control",
-            vmx_secondary_exec_control, _vmx_secondary_exec_control);
+            vmx_caps.secondary_exec_control, caps.secondary_exec_control);
         mismatch |= cap_check(
             "Tertiary Exec Control",
             vmx_tertiary_exec_control, _vmx_tertiary_exec_control);
@@ -1117,7 +1114,7 @@ static int construct_vmcs(struct vcpu *v)
     if ( d->arch.vtsc && !cpu_has_vmx_tsc_scaling )
         v->arch.hvm.vmx.exec_control |= CPU_BASED_RDTSC_EXITING;
 
-    v->arch.hvm.vmx.secondary_exec_control = vmx_secondary_exec_control;
+    v->arch.hvm.vmx.secondary_exec_control = vmx_caps.secondary_exec_control;
     v->arch.hvm.vmx.tertiary_exec_control  = vmx_tertiary_exec_control;
 
     /*
@@ -2227,7 +2224,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_secondary_exec_control = 0;
         vmx_tertiary_exec_control  = 0;
         vmx_vmexit_control         = 0;
         vmx_vmentry_control        = 0;
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 685a28c336..968d8706f7 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -258,7 +258,6 @@ extern u32 vmx_vmentry_control;
 #define SECONDARY_EXEC_TSC_SCALING              0x02000000U
 #define SECONDARY_EXEC_BUS_LOCK_DETECTION       0x40000000U
 #define SECONDARY_EXEC_NOTIFY_VM_EXITING        0x80000000U
-extern u32 vmx_secondary_exec_control;
 
 #define TERTIARY_EXEC_LOADIWKEY_EXITING         BIT(0, UL)
 #define TERTIARY_EXEC_ENABLE_HLAT               BIT(1, UL)
@@ -303,15 +302,16 @@ struct vmx_caps {
     uint64_t basic_msr;
     uint32_t pin_based_exec_control;
     uint32_t cpu_based_exec_control;
+    uint32_t secondary_exec_control;
 };
 extern struct vmx_caps vmx_caps;
 
 #define cpu_has_wbinvd_exiting \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING))
 #define cpu_has_vmx_virtualize_apic_accesses \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES))
 #define cpu_has_vmx_tpr_shadow \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.cpu_based_exec_control & CPU_BASED_TPR_SHADOW))
@@ -329,16 +329,16 @@ extern struct vmx_caps vmx_caps;
      (vmx_caps.cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS))
 #define cpu_has_vmx_ept \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT))
 #define cpu_has_vmx_dt_exiting \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING))
 #define cpu_has_vmx_rdtscp \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_RDTSCP)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_RDTSCP))
 #define cpu_has_vmx_vpid \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID))
 #define cpu_has_monitor_trap_flag \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.cpu_based_exec_control & CPU_BASED_MONITOR_TRAP_FLAG))
@@ -350,56 +350,56 @@ extern struct vmx_caps vmx_caps;
      vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_EFER)
 #define cpu_has_vmx_unrestricted_guest \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_UNRESTRICTED_GUEST)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_UNRESTRICTED_GUEST))
 #define vmx_unrestricted_guest(v)               \
     ((v)->arch.hvm.vmx.secondary_exec_control & \
      SECONDARY_EXEC_UNRESTRICTED_GUEST)
 #define cpu_has_vmx_ple \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING))
 #define cpu_has_vmx_invpcid \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_INVPCID)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_INVPCID))
 #define cpu_has_vmx_apic_reg_virt \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_APIC_REGISTER_VIRT)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_APIC_REGISTER_VIRT))
 #define cpu_has_vmx_virtual_intr_delivery \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY))
 #define cpu_has_vmx_virtualize_x2apic_mode \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE))
 #define cpu_has_vmx_posted_intr_processing \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT))
 #define cpu_has_vmx_vmcs_shadowing \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VMCS_SHADOWING)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VMCS_SHADOWING))
 #define cpu_has_vmx_vmfunc \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS))
 #define cpu_has_vmx_virt_exceptions \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS))
 #define cpu_has_vmx_pml \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_PML)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_PML))
 #define cpu_has_vmx_mpx \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_vmexit_control & VM_EXIT_CLEAR_BNDCFGS) && \
      (vmx_vmentry_control & VM_ENTRY_LOAD_BNDCFGS))
 #define cpu_has_vmx_xsaves \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_XSAVES)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_XSAVES))
 #define cpu_has_vmx_tsc_scaling \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_TSC_SCALING)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_TSC_SCALING))
 #define cpu_has_vmx_bus_lock_detection \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION))
 #define cpu_has_vmx_notify_vm_exiting \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_NOTIFY_VM_EXITING)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_NOTIFY_VM_EXITING))
 
 #define VMCS_RID_TYPE_MASK              0x80000000U
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:13:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:13:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903498.1311417 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB2H-0006vv-VM; Thu, 06 Mar 2025 13:13:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903498.1311417; Thu, 06 Mar 2025 13:13:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB2H-0006vn-Sd; Thu, 06 Mar 2025 13:13:13 +0000
Received: by outflank-mailman (input) for mailman id 903498;
 Thu, 06 Mar 2025 13:13:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB2H-0006vh-CG
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:13:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB2H-0055dx-1t
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB2H-00AJgH-11
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:13:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RmPQMx6M93yzfigp/eIXBv9P6dApVoy6Bc0BxsgTVPA=; b=xGAV3u1DhUn3gSUzXATr3SUw6K
	ak/+CSsONkIbG96VX+nIi76OBXwzIwq2962qm9Mo9OUBLkapjS3vBh0CW0JY6CwTA9F7abX25wyjk
	kq8B1jiXkNz5nUMOENjqs1+oJ6i1ncWf7Bs2EO4y8azzccriZ1EsNZGVBPYupPt7hNXY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: convert vmx_tertiary_exec_control
Message-Id: <E1tqB2H-00AJgH-11@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:13:13 +0000

commit 5d8cbdd465f1fcfc28aec933aee5a1b8faf92f87
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:58:47 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:58:47 2025 +0100

    VMX: convert vmx_tertiary_exec_control
    
    ... to a field in the capability/controls struct.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 10 +++-------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  6 +++---
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 46dcdc21ec..9763478527 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-uint64_t vmx_tertiary_exec_control __read_mostly;
 u32 vmx_vmexit_control __read_mostly;
 u32 vmx_vmentry_control __read_mostly;
 u64 vmx_ept_vpid_cap __read_mostly;
@@ -263,7 +262,6 @@ static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     struct vmx_caps caps = {};
-    uint64_t _vmx_tertiary_exec_control = 0;
     u64 _vmx_ept_vpid_cap = 0;
     u64 _vmx_misc_cap = 0;
     u32 _vmx_vmexit_control;
@@ -367,7 +365,7 @@ static int vmx_init_vmcs_config(bool bsp)
         uint64_t opt = (TERTIARY_EXEC_VIRT_SPEC_CTRL |
                         TERTIARY_EXEC_EPT_PAGING_WRITE);
 
-        _vmx_tertiary_exec_control = adjust_vmx_controls2(
+        caps.tertiary_exec_control = adjust_vmx_controls2(
             "Tertiary Exec Control", 0, opt,
             MSR_IA32_VMX_PROCBASED_CTLS3, &mismatch);
     }
@@ -499,7 +497,6 @@ static int vmx_init_vmcs_config(bool bsp)
     {
         /* First time through. */
         vmx_caps = caps;
-        vmx_tertiary_exec_control  = _vmx_tertiary_exec_control;
         vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
         vmx_vmexit_control         = _vmx_vmexit_control;
         vmx_vmentry_control        = _vmx_vmentry_control;
@@ -536,7 +533,7 @@ static int vmx_init_vmcs_config(bool bsp)
             vmx_caps.secondary_exec_control, caps.secondary_exec_control);
         mismatch |= cap_check(
             "Tertiary Exec Control",
-            vmx_tertiary_exec_control, _vmx_tertiary_exec_control);
+            vmx_caps.tertiary_exec_control, caps.tertiary_exec_control);
         mismatch |= cap_check(
             "VMExit Control",
             vmx_vmexit_control, _vmx_vmexit_control);
@@ -1115,7 +1112,7 @@ static int construct_vmcs(struct vcpu *v)
         v->arch.hvm.vmx.exec_control |= CPU_BASED_RDTSC_EXITING;
 
     v->arch.hvm.vmx.secondary_exec_control = vmx_caps.secondary_exec_control;
-    v->arch.hvm.vmx.tertiary_exec_control  = vmx_tertiary_exec_control;
+    v->arch.hvm.vmx.tertiary_exec_control  = vmx_caps.tertiary_exec_control;
 
     /*
      * Disable features which we don't want active by default:
@@ -2224,7 +2221,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_tertiary_exec_control  = 0;
         vmx_vmexit_control         = 0;
         vmx_vmentry_control        = 0;
         vmx_ept_vpid_cap           = 0;
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 968d8706f7..fc85bd6a5b 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -265,13 +265,12 @@ extern u32 vmx_vmentry_control;
 #define TERTIARY_EXEC_GUEST_PAGING_VERIFY       BIT(3, UL)
 #define TERTIARY_EXEC_IPI_VIRT                  BIT(4, UL)
 #define TERTIARY_EXEC_VIRT_SPEC_CTRL            BIT(7, UL)
-extern uint64_t vmx_tertiary_exec_control;
 
 #define cpu_has_vmx_virt_spec_ctrl \
-     (vmx_tertiary_exec_control & TERTIARY_EXEC_VIRT_SPEC_CTRL)
+     (vmx_caps.tertiary_exec_control & TERTIARY_EXEC_VIRT_SPEC_CTRL)
 
 #define cpu_has_vmx_ept_paging_write \
-     (vmx_tertiary_exec_control & TERTIARY_EXEC_EPT_PAGING_WRITE)
+     (vmx_caps.tertiary_exec_control & TERTIARY_EXEC_EPT_PAGING_WRITE)
 
 #define VMX_EPT_EXEC_ONLY_SUPPORTED                         0x00000001
 #define VMX_EPT_WALK_LENGTH_4_SUPPORTED                     0x00000040
@@ -303,6 +302,7 @@ struct vmx_caps {
     uint32_t pin_based_exec_control;
     uint32_t cpu_based_exec_control;
     uint32_t secondary_exec_control;
+    uint64_t tertiary_exec_control;
 };
 extern struct vmx_caps vmx_caps;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:13:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:13:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903499.1311420 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB2S-0006yu-0M; Thu, 06 Mar 2025 13:13:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903499.1311420; Thu, 06 Mar 2025 13:13:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB2R-0006ym-U3; Thu, 06 Mar 2025 13:13:23 +0000
Received: by outflank-mailman (input) for mailman id 903499;
 Thu, 06 Mar 2025 13:13:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB2R-0006yg-F3
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:13:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB2R-0055e3-2A
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB2R-00AJiA-1L
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:13:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bdLaLgwr47jW5W/XfQxMrMkTSd9qBwTbkbioq7ajbhE=; b=6LHYMra7zN5B4rgGoAcuxi7rkU
	8u4sHuJrXEillEzeu+QYuDntAuPCc8DPM/15QrQk22EKFBfjSeOG8Jg/XOIcE47jziEwIpSLC5CTL
	Taf3OkzIMv5JK2bQJy/pdgRLMeLledNg1a0JXbwpOUGYveBnttvedr7H3dOjFsFw31lQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: convert vmx_vmexit_control
Message-Id: <E1tqB2R-00AJiA-1L@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:13:23 +0000

commit eddd93709418201fb8de09a8e3c9f6a26325b151
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:59:09 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:59:09 2025 +0100

    VMX: convert vmx_vmexit_control
    
    ... to a field in the capability/controls struct.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 10 +++-------
 xen/arch/x86/hvm/vmx/vvmx.c             |  2 +-
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  4 ++--
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 9763478527..6eff60c139 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-u32 vmx_vmexit_control __read_mostly;
 u32 vmx_vmentry_control __read_mostly;
 u64 vmx_ept_vpid_cap __read_mostly;
 static uint64_t __read_mostly vmx_vmfunc;
@@ -264,7 +263,6 @@ static int vmx_init_vmcs_config(bool bsp)
     struct vmx_caps caps = {};
     u64 _vmx_ept_vpid_cap = 0;
     u64 _vmx_misc_cap = 0;
-    u32 _vmx_vmexit_control;
     u32 _vmx_vmentry_control;
     u64 _vmx_vmfunc = 0;
     bool mismatch = false;
@@ -447,7 +445,7 @@ static int vmx_init_vmcs_config(bool bsp)
     opt = (VM_EXIT_SAVE_GUEST_PAT | VM_EXIT_LOAD_HOST_PAT |
            VM_EXIT_LOAD_HOST_EFER | VM_EXIT_CLEAR_BNDCFGS);
     min |= VM_EXIT_IA32E_MODE;
-    _vmx_vmexit_control = adjust_vmx_controls(
+    caps.vmexit_control = adjust_vmx_controls(
         "VMExit Control", min, opt, MSR_IA32_VMX_EXIT_CTLS, &mismatch);
 
     /*
@@ -498,7 +496,6 @@ static int vmx_init_vmcs_config(bool bsp)
         /* First time through. */
         vmx_caps = caps;
         vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
-        vmx_vmexit_control         = _vmx_vmexit_control;
         vmx_vmentry_control        = _vmx_vmentry_control;
         vmx_caps.basic_msr = ((uint64_t)vmx_basic_msr_high << 32) |
                              vmx_basic_msr_low;
@@ -536,7 +533,7 @@ static int vmx_init_vmcs_config(bool bsp)
             vmx_caps.tertiary_exec_control, caps.tertiary_exec_control);
         mismatch |= cap_check(
             "VMExit Control",
-            vmx_vmexit_control, _vmx_vmexit_control);
+            vmx_caps.vmexit_control, caps.vmexit_control);
         mismatch |= cap_check(
             "VMEntry Control",
             vmx_vmentry_control, _vmx_vmentry_control);
@@ -1098,7 +1095,7 @@ void nocall vmx_asm_vmexit_handler(void);
 static int construct_vmcs(struct vcpu *v)
 {
     struct domain *d = v->domain;
-    u32 vmexit_ctl = vmx_vmexit_control;
+    uint32_t vmexit_ctl = vmx_caps.vmexit_control;
     u32 vmentry_ctl = vmx_vmentry_control;
     int rc = 0;
 
@@ -2221,7 +2218,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_vmexit_control         = 0;
         vmx_vmentry_control        = 0;
         vmx_ept_vpid_cap           = 0;
         vmx_vmfunc                 = 0;
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 99bf423a2d..ceb5e5a322 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1060,7 +1060,7 @@ static void load_shadow_control(struct vcpu *v)
     nvmx_update_pin_control(v, vmx_caps.pin_based_exec_control);
     vmx_update_cpu_exec_control(v);
     vmx_update_secondary_exec_control(v);
-    nvmx_update_exit_control(v, vmx_vmexit_control);
+    nvmx_update_exit_control(v, vmx_caps.vmexit_control);
     nvmx_update_entry_control(v);
     vmx_update_exception_bitmap(v);
     nvmx_update_apic_access_address(v);
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index fc85bd6a5b..b907f015d7 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -227,7 +227,6 @@ void vmx_vmcs_reload(struct vcpu *v);
 #define VM_EXIT_LOAD_HOST_EFER          0x00200000
 #define VM_EXIT_SAVE_PREEMPT_TIMER      0x00400000
 #define VM_EXIT_CLEAR_BNDCFGS           0x00800000
-extern u32 vmx_vmexit_control;
 
 #define VM_ENTRY_IA32E_MODE             0x00000200
 #define VM_ENTRY_SMM                    0x00000400
@@ -303,6 +302,7 @@ struct vmx_caps {
     uint32_t cpu_based_exec_control;
     uint32_t secondary_exec_control;
     uint64_t tertiary_exec_control;
+    uint32_t vmexit_control;
 };
 extern struct vmx_caps vmx_caps;
 
@@ -386,7 +386,7 @@ extern struct vmx_caps vmx_caps;
      (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_PML))
 #define cpu_has_vmx_mpx \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     (vmx_vmexit_control & VM_EXIT_CLEAR_BNDCFGS) && \
+     (vmx_caps.vmexit_control & VM_EXIT_CLEAR_BNDCFGS) && \
      (vmx_vmentry_control & VM_ENTRY_LOAD_BNDCFGS))
 #define cpu_has_vmx_xsaves \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:13:35 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:13:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903501.1311437 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB2d-0007Iy-CN; Thu, 06 Mar 2025 13:13:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903501.1311437; Thu, 06 Mar 2025 13:13:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB2d-0007Ip-8D; Thu, 06 Mar 2025 13:13:35 +0000
Received: by outflank-mailman (input) for mailman id 903501;
 Thu, 06 Mar 2025 13:13:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB2b-0007H3-Hw
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:13:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB2b-0055eC-2S
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:13:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB2b-00AJj3-1b
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:13:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QBd6xv4f97RKLSbUaT7BM2VMf/GdxoyBbJNBiaa3lig=; b=NCM/Zyidkko+eSZx85XbYhVjZx
	WfH1QK/fnH8IgQF6Xormx+y+BF7bbcTuQvqjzG0xncgGV7LXNBA8n7tMgpxys3nTEwtBKq1XV9kBV
	hlhiKyPNX98OxAS3TOaAjQhn+dFlLKlk04I72ebeSnms7YvM0JVAoQm2/p23T2fPjmt0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: convert vmx_vmentry_control
Message-Id: <E1tqB2b-00AJj3-1b@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:13:33 +0000

commit c25bcd2b5e9dd6c106102a846e5433f6ff269959
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:59:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:59:30 2025 +0100

    VMX: convert vmx_vmentry_control
    
    ... to a field in the capability/controls struct.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 10 +++-------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  8 ++++----
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 6eff60c139..138baf907f 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-u32 vmx_vmentry_control __read_mostly;
 u64 vmx_ept_vpid_cap __read_mostly;
 static uint64_t __read_mostly vmx_vmfunc;
 
@@ -263,7 +262,6 @@ static int vmx_init_vmcs_config(bool bsp)
     struct vmx_caps caps = {};
     u64 _vmx_ept_vpid_cap = 0;
     u64 _vmx_misc_cap = 0;
-    u32 _vmx_vmentry_control;
     u64 _vmx_vmfunc = 0;
     bool mismatch = false;
 
@@ -485,7 +483,7 @@ static int vmx_init_vmcs_config(bool bsp)
     min = 0;
     opt = (VM_ENTRY_LOAD_GUEST_PAT | VM_ENTRY_LOAD_GUEST_EFER |
            VM_ENTRY_LOAD_BNDCFGS);
-    _vmx_vmentry_control = adjust_vmx_controls(
+    caps.vmentry_control = adjust_vmx_controls(
         "VMEntry Control", min, opt, MSR_IA32_VMX_ENTRY_CTLS, &mismatch);
 
     if ( mismatch )
@@ -496,7 +494,6 @@ static int vmx_init_vmcs_config(bool bsp)
         /* First time through. */
         vmx_caps = caps;
         vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
-        vmx_vmentry_control        = _vmx_vmentry_control;
         vmx_caps.basic_msr = ((uint64_t)vmx_basic_msr_high << 32) |
                              vmx_basic_msr_low;
         vmx_vmfunc                 = _vmx_vmfunc;
@@ -536,7 +533,7 @@ static int vmx_init_vmcs_config(bool bsp)
             vmx_caps.vmexit_control, caps.vmexit_control);
         mismatch |= cap_check(
             "VMEntry Control",
-            vmx_vmentry_control, _vmx_vmentry_control);
+            vmx_caps.vmentry_control, caps.vmentry_control);
         mismatch |= cap_check(
             "EPT and VPID Capability",
             vmx_ept_vpid_cap, _vmx_ept_vpid_cap);
@@ -1096,7 +1093,7 @@ static int construct_vmcs(struct vcpu *v)
 {
     struct domain *d = v->domain;
     uint32_t vmexit_ctl = vmx_caps.vmexit_control;
-    u32 vmentry_ctl = vmx_vmentry_control;
+    u32 vmentry_ctl = vmx_caps.vmentry_control;
     int rc = 0;
 
     vmx_vmcs_enter(v);
@@ -2218,7 +2215,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_vmentry_control        = 0;
         vmx_ept_vpid_cap           = 0;
         vmx_vmfunc                 = 0;
     }
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index b907f015d7..6a4e3cb70f 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -235,7 +235,6 @@ void vmx_vmcs_reload(struct vcpu *v);
 #define VM_ENTRY_LOAD_GUEST_PAT         0x00004000
 #define VM_ENTRY_LOAD_GUEST_EFER        0x00008000
 #define VM_ENTRY_LOAD_BNDCFGS           0x00010000
-extern u32 vmx_vmentry_control;
 
 #define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001U
 #define SECONDARY_EXEC_ENABLE_EPT               0x00000002U
@@ -303,6 +302,7 @@ struct vmx_caps {
     uint32_t secondary_exec_control;
     uint64_t tertiary_exec_control;
     uint32_t vmexit_control;
+    uint32_t vmentry_control;
 };
 extern struct vmx_caps vmx_caps;
 
@@ -344,10 +344,10 @@ extern struct vmx_caps vmx_caps;
      (vmx_caps.cpu_based_exec_control & CPU_BASED_MONITOR_TRAP_FLAG))
 #define cpu_has_vmx_pat \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_PAT)
+     (vmx_caps.vmentry_control & VM_ENTRY_LOAD_GUEST_PAT))
 #define cpu_has_vmx_efer \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_EFER)
+     (vmx_caps.vmentry_control & VM_ENTRY_LOAD_GUEST_EFER))
 #define cpu_has_vmx_unrestricted_guest \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.secondary_exec_control & SECONDARY_EXEC_UNRESTRICTED_GUEST))
@@ -387,7 +387,7 @@ extern struct vmx_caps vmx_caps;
 #define cpu_has_vmx_mpx \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.vmexit_control & VM_EXIT_CLEAR_BNDCFGS) && \
-     (vmx_vmentry_control & VM_ENTRY_LOAD_BNDCFGS))
+     (vmx_caps.vmentry_control & VM_ENTRY_LOAD_BNDCFGS))
 #define cpu_has_vmx_xsaves \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.secondary_exec_control & SECONDARY_EXEC_XSAVES))
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:13:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:13:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903504.1311439 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB2n-0007RL-CP; Thu, 06 Mar 2025 13:13:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903504.1311439; Thu, 06 Mar 2025 13:13:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB2n-0007RD-9h; Thu, 06 Mar 2025 13:13:45 +0000
Received: by outflank-mailman (input) for mailman id 903504;
 Thu, 06 Mar 2025 13:13:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB2l-0007Os-Ki
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:13:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB2l-0055eK-2k
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:13:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB2l-00AJjU-1t
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:13:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mrWKmlrCqeh4q1xzcrhYa9w3PthklBF69h11jj7dsXg=; b=yDCPmasrj2OTZ04SCgBUdhJzdD
	G/bO4rHTB7oKm8aMJWD+ywMKoEn5U7l5rPYeYcSTfh5HGB0wqCgaj5xSKpc+KQBJ3da/pn/1HcAsb
	hMCMs5915JedeureEe83Rd9VYvnFa70R0LbfAQzRB33FlS2siKv9FM0pLEz9SjzutkhI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: convert vmx_ept_vpid_cap
Message-Id: <E1tqB2l-00AJjU-1t@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:13:43 +0000

commit 3d18d6afa9fdefad5c15fcdb984d4623d5c67c1c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:59:56 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:59:56 2025 +0100

    VMX: convert vmx_ept_vpid_cap
    
    ... to fields in the capability/controls struct: Take the opportunity
    and split the two halves into separate EPT and VPID fields.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 23 +++++++++--------------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 13 +++++++------
 xen/arch/x86/include/asm/hvm/vmx/vmx.h  | 22 +++++++++++-----------
 3 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 138baf907f..d8e58bd648 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-u64 vmx_ept_vpid_cap __read_mostly;
 static uint64_t __read_mostly vmx_vmfunc;
 
 static DEFINE_PER_CPU_READ_MOSTLY(paddr_t, vmxon_region);
@@ -260,7 +259,6 @@ static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     struct vmx_caps caps = {};
-    u64 _vmx_ept_vpid_cap = 0;
     u64 _vmx_misc_cap = 0;
     u64 _vmx_vmfunc = 0;
     bool mismatch = false;
@@ -370,10 +368,10 @@ static int vmx_init_vmcs_config(bool bsp)
     if ( caps.secondary_exec_control & (SECONDARY_EXEC_ENABLE_EPT |
                                         SECONDARY_EXEC_ENABLE_VPID) )
     {
-        rdmsrl(MSR_IA32_VMX_EPT_VPID_CAP, _vmx_ept_vpid_cap);
+        rdmsr(MSR_IA32_VMX_EPT_VPID_CAP, caps.ept, caps.vpid);
 
         if ( !opt_ept_ad )
-            _vmx_ept_vpid_cap &= ~VMX_EPT_AD_BIT;
+            caps.ept &= ~VMX_EPT_AD_BIT;
 
         /*
          * Additional sanity checking before using EPT:
@@ -386,9 +384,9 @@ static int vmx_init_vmcs_config(bool bsp)
          *
          * Or we just don't use EPT.
          */
-        if ( !(_vmx_ept_vpid_cap & VMX_EPT_MEMORY_TYPE_WB) ||
-             !(_vmx_ept_vpid_cap & VMX_EPT_WALK_LENGTH_4_SUPPORTED) ||
-             !(_vmx_ept_vpid_cap & VMX_EPT_INVEPT_ALL_CONTEXT) )
+        if ( !(caps.ept & VMX_EPT_MEMORY_TYPE_WB) ||
+             !(caps.ept & VMX_EPT_WALK_LENGTH_4_SUPPORTED) ||
+             !(caps.ept & VMX_EPT_INVEPT_ALL_CONTEXT) )
             caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_EPT;
 
         /*
@@ -397,11 +395,11 @@ static int vmx_init_vmcs_config(bool bsp)
          *
          * Or we just don't use VPID.
          */
-        if ( !(_vmx_ept_vpid_cap & VMX_VPID_INVVPID_ALL_CONTEXT) )
+        if ( !(caps.vpid & VMX_VPID_INVVPID_ALL_CONTEXT) )
             caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VPID;
 
         /* EPT A/D bits is required for PML */
-        if ( !(_vmx_ept_vpid_cap & VMX_EPT_AD_BIT) )
+        if ( !(caps.ept & VMX_EPT_AD_BIT) )
             caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
     }
 
@@ -493,7 +491,6 @@ static int vmx_init_vmcs_config(bool bsp)
     {
         /* First time through. */
         vmx_caps = caps;
-        vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
         vmx_caps.basic_msr = ((uint64_t)vmx_basic_msr_high << 32) |
                              vmx_basic_msr_low;
         vmx_vmfunc                 = _vmx_vmfunc;
@@ -534,9 +531,8 @@ static int vmx_init_vmcs_config(bool bsp)
         mismatch |= cap_check(
             "VMEntry Control",
             vmx_caps.vmentry_control, caps.vmentry_control);
-        mismatch |= cap_check(
-            "EPT and VPID Capability",
-            vmx_ept_vpid_cap, _vmx_ept_vpid_cap);
+        mismatch |= cap_check("EPT Capability", vmx_caps.ept, caps.ept);
+        mismatch |= cap_check("VPID Capability", vmx_caps.vpid, caps.vpid);
         mismatch |= cap_check(
             "VMFUNC Capability",
             vmx_vmfunc, _vmx_vmfunc);
@@ -2215,7 +2211,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_ept_vpid_cap           = 0;
         vmx_vmfunc                 = 0;
     }
 
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 6a4e3cb70f..5e2af6e7cd 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -280,12 +280,11 @@ void vmx_vmcs_reload(struct vcpu *v);
 #define VMX_EPT_AD_BIT                                      0x00200000
 #define VMX_EPT_INVEPT_SINGLE_CONTEXT                       0x02000000
 #define VMX_EPT_INVEPT_ALL_CONTEXT                          0x04000000
-#define VMX_VPID_INVVPID_INSTRUCTION                     0x00100000000ULL
-#define VMX_VPID_INVVPID_INDIVIDUAL_ADDR                 0x10000000000ULL
-#define VMX_VPID_INVVPID_SINGLE_CONTEXT                  0x20000000000ULL
-#define VMX_VPID_INVVPID_ALL_CONTEXT                     0x40000000000ULL
-#define VMX_VPID_INVVPID_SINGLE_CONTEXT_RETAINING_GLOBAL 0x80000000000ULL
-extern u64 vmx_ept_vpid_cap;
+#define VMX_VPID_INVVPID_INSTRUCTION                        0x00000001
+#define VMX_VPID_INVVPID_INDIVIDUAL_ADDR                    0x00000100
+#define VMX_VPID_INVVPID_SINGLE_CONTEXT                     0x00000200
+#define VMX_VPID_INVVPID_ALL_CONTEXT                        0x00000400
+#define VMX_VPID_INVVPID_SINGLE_CONTEXT_RETAINING_GLOBAL    0x00000800
 
 #define VMX_MISC_ACTIVITY_MASK                  0x000001c0
 #define VMX_MISC_PROC_TRACE                     0x00004000
@@ -303,6 +302,8 @@ struct vmx_caps {
     uint64_t tertiary_exec_control;
     uint32_t vmexit_control;
     uint32_t vmentry_control;
+    uint32_t ept;
+    uint32_t vpid;
 };
 extern struct vmx_caps vmx_caps;
 
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index d920de96b7..843f8591b9 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -278,17 +278,17 @@ typedef union cr_access_qual {
 extern uint8_t posted_intr_vector;
 
 #define cpu_has_vmx_ept_exec_only_supported        \
-    (vmx_ept_vpid_cap & VMX_EPT_EXEC_ONLY_SUPPORTED)
+    (vmx_caps.ept & VMX_EPT_EXEC_ONLY_SUPPORTED)
 
 #define cpu_has_vmx_ept_wl4_supported           \
-    (vmx_ept_vpid_cap & VMX_EPT_WALK_LENGTH_4_SUPPORTED)
-#define cpu_has_vmx_ept_mt_uc (vmx_ept_vpid_cap & VMX_EPT_MEMORY_TYPE_UC)
-#define cpu_has_vmx_ept_mt_wb (vmx_ept_vpid_cap & VMX_EPT_MEMORY_TYPE_WB)
-#define cpu_has_vmx_ept_2mb   (vmx_ept_vpid_cap & VMX_EPT_SUPERPAGE_2MB)
-#define cpu_has_vmx_ept_1gb   (vmx_ept_vpid_cap & VMX_EPT_SUPERPAGE_1GB)
-#define cpu_has_vmx_ept_ad    (vmx_ept_vpid_cap & VMX_EPT_AD_BIT)
+    (vmx_caps.ept & VMX_EPT_WALK_LENGTH_4_SUPPORTED)
+#define cpu_has_vmx_ept_mt_uc (vmx_caps.ept & VMX_EPT_MEMORY_TYPE_UC)
+#define cpu_has_vmx_ept_mt_wb (vmx_caps.ept & VMX_EPT_MEMORY_TYPE_WB)
+#define cpu_has_vmx_ept_2mb   (vmx_caps.ept & VMX_EPT_SUPERPAGE_2MB)
+#define cpu_has_vmx_ept_1gb   (vmx_caps.ept & VMX_EPT_SUPERPAGE_1GB)
+#define cpu_has_vmx_ept_ad    (vmx_caps.ept & VMX_EPT_AD_BIT)
 #define cpu_has_vmx_ept_invept_single_context   \
-    (vmx_ept_vpid_cap & VMX_EPT_INVEPT_SINGLE_CONTEXT)
+    (vmx_caps.ept & VMX_EPT_INVEPT_SINGLE_CONTEXT)
 
 #define EPT_2MB_SHIFT     16
 #define EPT_1GB_SHIFT     17
@@ -299,11 +299,11 @@ extern uint8_t posted_intr_vector;
 #define INVEPT_ALL_CONTEXT      2
 
 #define cpu_has_vmx_vpid_invvpid_individual_addr                    \
-    (vmx_ept_vpid_cap & VMX_VPID_INVVPID_INDIVIDUAL_ADDR)
+    (vmx_caps.vpid & VMX_VPID_INVVPID_INDIVIDUAL_ADDR)
 #define cpu_has_vmx_vpid_invvpid_single_context                     \
-    (vmx_ept_vpid_cap & VMX_VPID_INVVPID_SINGLE_CONTEXT)
+    (vmx_caps.vpid & VMX_VPID_INVVPID_SINGLE_CONTEXT)
 #define cpu_has_vmx_vpid_invvpid_single_context_retaining_global    \
-    (vmx_ept_vpid_cap & VMX_VPID_INVVPID_SINGLE_CONTEXT_RETAINING_GLOBAL)
+    (vmx_caps.vpid & VMX_VPID_INVVPID_SINGLE_CONTEXT_RETAINING_GLOBAL)
 
 #define INVVPID_INDIVIDUAL_ADDR                 0
 #define INVVPID_SINGLE_CONTEXT                  1
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:13:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:13:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903506.1311443 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB2x-0007Yl-Di; Thu, 06 Mar 2025 13:13:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903506.1311443; Thu, 06 Mar 2025 13:13:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB2x-0007Yd-B9; Thu, 06 Mar 2025 13:13:55 +0000
Received: by outflank-mailman (input) for mailman id 903506;
 Thu, 06 Mar 2025 13:13:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB2v-0007Ws-P3
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:13:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB2v-0055eP-3A
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:13:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB2v-00AJk8-2E
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:13:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=llMejy5JIvn4xLRgkyVBfdvTEajqISDwfMFyjDOQT7E=; b=ZW0CpL1kVZ7r43eZ1CjOeEF+Hn
	/6SDh/Ds7EtC7H0wWEihW8QeWnjrp/KDgU9FagMb4cRehKYYbdpffg6iJ6TBhtR1e+gF497kclff0
	YF3l40ilKzQrTlWPNiJCGryEeeNQYlQhpWdgl1T+FzHyr4SyBaajG9e/5Ecy0mlgCEiM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: convert vmx_vmfunc
Message-Id: <E1tqB2v-00AJk8-2E@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:13:53 +0000

commit 7e32553fa86b9fa85d97c5959a631cbe1fef5c9c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 14:00:25 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:00:25 2025 +0100

    VMX: convert vmx_vmfunc
    
    ... to a field in the capability/controls struct.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 10 +++-------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  1 +
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index d8e58bd648..cfb541de13 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-static uint64_t __read_mostly vmx_vmfunc;
 
 static DEFINE_PER_CPU_READ_MOSTLY(paddr_t, vmxon_region);
 static DEFINE_PER_CPU(paddr_t, current_vmcs);
@@ -260,7 +259,6 @@ static int vmx_init_vmcs_config(bool bsp)
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     struct vmx_caps caps = {};
     u64 _vmx_misc_cap = 0;
-    u64 _vmx_vmfunc = 0;
     bool mismatch = false;
 
     rdmsr(MSR_IA32_VMX_BASIC, vmx_basic_msr_low, vmx_basic_msr_high);
@@ -463,14 +461,14 @@ static int vmx_init_vmcs_config(bool bsp)
     /* The IA32_VMX_VMFUNC MSR exists only when VMFUNC is available */
     if ( caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS )
     {
-        rdmsrl(MSR_IA32_VMX_VMFUNC, _vmx_vmfunc);
+        rdmsrl(MSR_IA32_VMX_VMFUNC, caps.vmfunc);
 
         /*
          * VMFUNC leaf 0 (EPTP switching) must be supported.
          *
          * Or we just don't use VMFUNC.
          */
-        if ( !(_vmx_vmfunc & VMX_VMFUNC_EPTP_SWITCHING) )
+        if ( !(caps.vmfunc & VMX_VMFUNC_EPTP_SWITCHING) )
             caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VM_FUNCTIONS;
     }
 
@@ -493,7 +491,6 @@ static int vmx_init_vmcs_config(bool bsp)
         vmx_caps = caps;
         vmx_caps.basic_msr = ((uint64_t)vmx_basic_msr_high << 32) |
                              vmx_basic_msr_low;
-        vmx_vmfunc                 = _vmx_vmfunc;
 
         vmx_display_features();
 
@@ -535,7 +532,7 @@ static int vmx_init_vmcs_config(bool bsp)
         mismatch |= cap_check("VPID Capability", vmx_caps.vpid, caps.vpid);
         mismatch |= cap_check(
             "VMFUNC Capability",
-            vmx_vmfunc, _vmx_vmfunc);
+            vmx_caps.vmfunc, caps.vmfunc);
         if ( cpu_has_vmx_ins_outs_instr_info !=
              !!(vmx_basic_msr_high & (VMX_BASIC_INS_OUT_INFO >> 32)) )
         {
@@ -2211,7 +2208,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_vmfunc                 = 0;
     }
 
     return ret;
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 5e2af6e7cd..cde4fe011b 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -304,6 +304,7 @@ struct vmx_caps {
     uint32_t vmentry_control;
     uint32_t ept;
     uint32_t vpid;
+    uint64_t vmfunc;
 };
 extern struct vmx_caps vmx_caps;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:14:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:14:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903508.1311447 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB37-0007cq-FG; Thu, 06 Mar 2025 13:14:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903508.1311447; Thu, 06 Mar 2025 13:14:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB37-0007ci-Cf; Thu, 06 Mar 2025 13:14:05 +0000
Received: by outflank-mailman (input) for mailman id 903508;
 Thu, 06 Mar 2025 13:14:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB35-0007cY-SX
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:14:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB36-0055eu-0H
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:14:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB35-00AJl2-2a
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:14:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eQU4XvL5umlT4jctaz8oGEAvW3ANNASVnQmzdVNE65U=; b=uHIgdxHZ0kACmllMF6drA0JqW3
	tdzl9/FM9TIOVfO4Drre6XoOweG+DxZq3DHRujOCK0uyc2GwFm4mR4qHOl1/5u9f0Q1nUWLA04ika
	Ar0m5OfyNeXIi09og4Gzypy/U5axyVoaCRpylR+u1gGz4TtEkadBNTLSZedMDqvgXp6A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: drop debian:11-riscv64 container
Message-Id: <E1tqB35-00AJl2-2a@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:14:03 +0000

commit bd9bda50553b2db6f935dc8a285d817c4220d976
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Mar 6 14:01:07 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:01:07 2025 +0100

    automation: drop debian:11-riscv64 container
    
    There are two reasons for that:
    1. In the README, GCC baseline is chosen to be 12.2, whereas Debian 11
       uses GCC 10.2.1.
    2. Xen requires mandatory some Z extensions, but GCC 10.2.1 does not
       support Z extensions in -march, causing the compilation to fail.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/build.yaml | 14 --------------
 automation/scripts/containerize |  1 -
 2 files changed, 15 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 4fd800e996..034d6d9c3a 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -729,20 +729,6 @@ debian-12-ppc64le-gcc:
     HYPERVISOR_ONLY: y
 
 # RISC-V 64 cross-build
-debian-11-riscv64-gcc:
-  extends: .gcc-riscv64-cross-build
-  variables:
-    CONTAINER: debian:11-riscv64
-    KBUILD_DEFCONFIG: tiny64_defconfig
-    HYPERVISOR_ONLY: y
-
-debian-11-riscv64-gcc-debug:
-  extends: .gcc-riscv64-cross-build-debug
-  variables:
-    CONTAINER: debian:11-riscv64
-    KBUILD_DEFCONFIG: tiny64_defconfig
-    HYPERVISOR_ONLY: y
-
 debian-12-riscv64-gcc:
   extends: .gcc-riscv64-cross-build
   variables:
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index bc43136078..0953e0728c 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -31,7 +31,6 @@ case "_${CONTAINER}" in
     _fedora) CONTAINER="${BASE}/fedora:41-x86_64";;
     _bullseye-ppc64le) CONTAINER="${BASE}/debian:11-ppc64le" ;;
     _bookworm-ppc64le) CONTAINER="${BASE}/debian:12-ppc64le" ;;
-    _bullseye-riscv64) CONTAINER="${BASE}/debian:11-riscv64" ;;
     _bookworm-riscv64) CONTAINER="${BASE}/debian:12-riscv64" ;;
     _bookworm-x86_64-gcc-ibt) CONTAINER="${BASE}/debian:12-x86_64-gcc-ibt" ;;
     _bookworm|_bookworm-x86_64|_) CONTAINER="${BASE}/debian:12-x86_64" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:14:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:14:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903511.1311453 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB3H-0007h0-IL; Thu, 06 Mar 2025 13:14:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903511.1311453; Thu, 06 Mar 2025 13:14:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB3H-0007gs-E5; Thu, 06 Mar 2025 13:14:15 +0000
Received: by outflank-mailman (input) for mailman id 903511;
 Thu, 06 Mar 2025 13:14:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB3F-0007gc-VP
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:14:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB3G-0055ey-0a
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:14:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB3F-00AJod-2y
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:14:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=awdAaMj+GrG5pznw57VrKRJiv0I1Il/lKyWZlDT+Kn0=; b=1qG6yHqBxVLKe17OGc9baeUUoR
	KI4T3BpuMmKC0Z5KDdH/odoVivIyV12NTPPv3vuHWfXf7pwwNYytwQooGeHvWsTqHVY4nrSlUkW29
	oNN4EkEwpPgINC0gtVPkHFf5RiUq68IYDspYgraB3DV9Kevb4qab3fXUP9ikqlV2k0Qw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: drop CONFIG_RISCV_ISA_RV64G
Message-Id: <E1tqB3F-00AJod-2y@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:14:13 +0000

commit 60def0d6e49f6fc032c534649a7e05ef2c4c30c0
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Mar 6 14:01:26 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:01:26 2025 +0100

    xen/riscv: drop CONFIG_RISCV_ISA_RV64G
    
    'G' stands for "imafd_zicsr_zifencei".
    
    Extensions 'f' and 'd' aren't really needed for Xen, and allowing floating
    point registers to be used can lead to crashes.
    
    Extensions 'i', 'm', 'a', 'zicsr', and 'zifencei' are necessary for the
    operation of Xen, which is why they are used explicitly (unconditionally)
    in -march.
    
    Drop "Base ISA" choice from riscv/Kconfig as it is always empty.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Kconfig | 18 ------------------
 xen/arch/riscv/arch.mk |  8 +++++---
 2 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index fa95cd0a42..d882e0a059 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -23,24 +23,6 @@ endmenu
 
 menu "ISA Selection"
 
-choice
-	prompt "Base ISA"
-	default RISCV_ISA_RV64G if RISCV_64
-	help
-	  This selects the base ISA extensions that Xen will target.
-
-config RISCV_ISA_RV64G
-	bool "RV64G"
-	help
-	  Use the RV64I base ISA, plus
-	  "M" for multiply/divide,
-	  "A" for atomic instructions,
-	  “F”/"D" for  {single/double}-precision floating-point instructions,
-	  "Zicsr" for control and status register access,
-	  "Zifencei" for instruction-fetch fence.
-
-endchoice
-
 config RISCV_ISA_C
 	bool "Compressed extension"
 	default y
diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 17827c302c..3034da76cb 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -6,10 +6,12 @@ $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 riscv-abi-$(CONFIG_RISCV_32) := -mabi=ilp32
 riscv-abi-$(CONFIG_RISCV_64) := -mabi=lp64
 
-riscv-march-$(CONFIG_RISCV_ISA_RV64G) := rv64g
-riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
+riscv-march-$(CONFIG_RISCV_64) := rv64
+riscv-march-y += ima
+riscv-march-$(CONFIG_RISCV_ISA_C) += c
+riscv-march-y += _zicsr_zifencei
 
-riscv-generic-flags := $(riscv-abi-y) -march=$(riscv-march-y)
+riscv-generic-flags := $(riscv-abi-y) -march=$(subst $(space),,$(riscv-march-y))
 
 # check-extension: Check whether extenstion is supported by a compiler and
 #                  an assembler.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:14:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:14:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903512.1311455 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB3R-0007ko-JS; Thu, 06 Mar 2025 13:14:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903512.1311455; Thu, 06 Mar 2025 13:14:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB3R-0007ke-Gd; Thu, 06 Mar 2025 13:14:25 +0000
Received: by outflank-mailman (input) for mailman id 903512;
 Thu, 06 Mar 2025 13:14:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB3Q-0007kO-3x
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:14:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB3Q-0055f2-13
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:14:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB3Q-00AJzX-01
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:14:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=o5wjVRj7fcOQq6LjL4YmIM8oKiqzLZZVqgqk3gtURHU=; b=2em5NVNME1WJpJdTSCRFl9p7Kt
	YNJnTENKepvrM6+21lFgl8hlhgt5df9XX1GOIY48qcqAcetmX14kerDH/xHA75Hu5r1CMB/sZ2W9H
	U5kasAjCr7fSEXPnpQVoitzHTdDX5atBXumPs688sL839sRv/Voml9QM2zH0pPhd1vRo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: make zbb as mandatory
Message-Id: <E1tqB3Q-00AJzX-01@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:14:24 +0000

commit 4c91847903915aa99172d054e1add85e65afc264
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Mar 6 14:01:53 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:01:53 2025 +0100

    xen/riscv: make zbb as mandatory
    
    According to riscv/booting.txt, it is expected that Zbb should be supported.
    
    Drop ANDN_INSN() in asm/cmpxchg.h as Zbb is mandatory now so `andn`
    instruction could be used directly.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/arch.mk               |  7 ++-----
 xen/arch/riscv/include/asm/cmpxchg.h | 15 +--------------
 2 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 3034da76cb..236ea7c8a6 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -9,7 +9,7 @@ riscv-abi-$(CONFIG_RISCV_64) := -mabi=lp64
 riscv-march-$(CONFIG_RISCV_64) := rv64
 riscv-march-y += ima
 riscv-march-$(CONFIG_RISCV_ISA_C) += c
-riscv-march-y += _zicsr_zifencei
+riscv-march-y += _zicsr_zifencei_zbb
 
 riscv-generic-flags := $(riscv-abi-y) -march=$(subst $(space),,$(riscv-march-y))
 
@@ -25,13 +25,10 @@ $(eval $(1) := \
 	$(call as-insn,$(CC) $(riscv-generic-flags)_$(1),$(value $(1)-insn),_$(1)))
 endef
 
-zbb-insn := "andn t0$(comma)t0$(comma)t0"
-$(call check-extension,zbb)
-
 zihintpause-insn := "pause"
 $(call check-extension,zihintpause)
 
-extensions := $(zbb) $(zihintpause)
+extensions := $(zihintpause)
 
 extensions := $(subst $(space),,$(extensions))
 
diff --git a/xen/arch/riscv/include/asm/cmpxchg.h b/xen/arch/riscv/include/asm/cmpxchg.h
index 662d3fd5d4..7d7c89b6fa 100644
--- a/xen/arch/riscv/include/asm/cmpxchg.h
+++ b/xen/arch/riscv/include/asm/cmpxchg.h
@@ -18,19 +18,6 @@
         : "r" (new) \
         : "memory" );
 
-/*
- * To not face an issue that gas doesn't understand ANDN instruction
- * it is encoded using .insn directive.
- */
-#ifdef __riscv_zbb
-#define ANDN_INSN(rd, rs1, rs2)                 \
-    ".insn r OP, 0x7, 0x20, " rd ", " rs1 ", " rs2 "\n"
-#else
-#define ANDN_INSN(rd, rs1, rs2)                 \
-    "not " rd ", " rs2 "\n"                     \
-    "and " rd ", " rs1 ", " rd "\n"
-#endif
-
 /*
  * For LR and SC, the A extension requires that the address held in rs1 be
  * naturally aligned to the size of the operand (i.e., eight-byte aligned
@@ -61,7 +48,7 @@
     \
     asm volatile ( \
         "0: lr.w" lr_sfx " %[old], %[ptr_]\n" \
-        ANDN_INSN("%[scratch]", "%[old]", "%[mask]") \
+        "   andn  %[scratch], %[old], %[mask]\n" \
         "   or   %[scratch], %[scratch], %z[new_]\n" \
         "   sc.w" sc_sfx " %[scratch], %[scratch], %[ptr_]\n" \
         "   bnez %[scratch], 0b\n" \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:14:35 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:14:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903513.1311459 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB3b-0007nn-Kl; Thu, 06 Mar 2025 13:14:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903513.1311459; Thu, 06 Mar 2025 13:14:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB3b-0007nf-I1; Thu, 06 Mar 2025 13:14:35 +0000
Received: by outflank-mailman (input) for mailman id 903513;
 Thu, 06 Mar 2025 13:14:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB3a-0007nT-6V
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:14:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB3a-0055f9-1J
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:14:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB3a-00AK0S-0T
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:14:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=28qar8/izW+u20f0aPgNNDiTLeWkm1V+brhRDeXQxpw=; b=kTU6jo6YfDiuH8vJ9lgXLCkVF7
	mbJJTmDYfnYobIki3xbo32DzBzBbZYnenOUmnWQcGpf1E4REUesX4OpdcUktkpdiY8yRY3C9c5ONs
	egdHikTTbNrj1iUkcP+O/WhFBl84zlZaRAtNPeLY0eVbzNlhFVApin2sw5jgOx/3+oac=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: identify specific ISA supported by cpu
Message-Id: <E1tqB3a-00AK0S-0T@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:14:34 +0000

commit f74ebf58b51826841bf1859cd42f1361549ef1e1
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Mar 6 14:02:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:02:51 2025 +0100

    xen/riscv: identify specific ISA supported by cpu
    
    Supported ISA extensions are specified in the device tree within the CPU
    node, using two properties: `riscv,isa-extensions` and `riscv,isa`.
    
    Currently, Xen does not support the `riscv,isa-extensions` property and
    will be added in the future.
    
    The `riscv,isa` property is parsed for each CPU, and the common extensions
    are stored in the `host_riscv_isa` bitmap.
    This bitmap is then used by `riscv_isa_extension_available()` to check
    if a specific extension is supported.
    
    The current implementation is based on Linux kernel v6.12-rc3
    implementation with the following changes:
     - Drop unconditional setting of {RISCV_ISA_EXT_ZICSR,
       RISCV_ISA_EXT_ZIFENCEI, RISCV_ISA_EXT_ZICNTR, RISCV_ISA_EXT_ZIHPM} because
       Xen is going to run on hardware produced after the aforementioned
       extensions were split out of "i".
     - Remove saving of the ISA for each CPU, only the common available ISA is
       saved.
     - Remove ACPI-related code as ACPI is not supported by Xen.
     - Drop handling of elf_hwcap, since Xen does not provide hwcap to
       userspace.
     - Replace of_cpu_device_node_get() API, which is not available in Xen,
       with a combination of dt_for_each_child_node(), dt_device_type_is_equal(),
       and dt_get_cpuid_from_node() to retrieve cpuid and riscv,isa in
       riscv_fill_hwcap_from_isa_string().
     - Rename arguments of __RISCV_ISA_EXT_DATA() from _name to ext_name, and
       _id to ext_id for clarity.
     - Replace instances of __RISCV_ISA_EXT_DATA with RISCV_ISA_EXT_DATA.
     - Replace instances of __riscv_isa_extension_available with
       riscv_isa_extension_available for consistency. Also, update the type of
       `bit` argument of riscv_isa_extension_available().
     - Redefine RISCV_ISA_EXT_DATA() to work only with ext_name and ext_id,
       as other fields are not used in Xen currently. Also RISCV_ISA_EXT_DATA()
       is reworked in the way to take only one argument `ext_name`.
     - Add check of first 4 letters of riscv,isa string to
       riscv_isa_parse_string() as Xen doesn't do this check before so it is
       necessary to check correctness of riscv,isa string. ( it should start with
       rv{32,64} with taking into account upper and lower case of "rv").
       Additionally, check also that 'i' goes after 'rv{32,64}' to be sure that
       `out_bitmap` can't be empty.
     - Drop an argument of riscv_fill_hwcap() and riscv_fill_hwcap_from_isa_string()
       as it isn't used, at the moment.
     - Update the comment message about QEMU workaround.
     - Apply Xen coding style.
     - s/pr_info/printk.
     - Drop handling of uppercase letters of riscv,isa in riscv_isa_parse_string() as
       Xen checks that riscv,isa should be in lowercase according to the device tree
       bindings.
     - Update logic of riscv_isa_parse_string(): now it stops parsing of riscv,isa
       if illegal symbol was found instead of ignoring them.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Makefile                 |   1 +
 xen/arch/riscv/cpufeature.c             | 504 ++++++++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/cpufeature.h |  59 ++++
 xen/arch/riscv/setup.c                  |   3 +
 4 files changed, 567 insertions(+)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index a5eb2aed4b..b0c8270a99 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -1,3 +1,4 @@
+obj-y += cpufeature.o
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 obj-y += entry.o
 obj-y += mm.o
diff --git a/xen/arch/riscv/cpufeature.c b/xen/arch/riscv/cpufeature.c
new file mode 100644
index 0000000000..bf09aa1170
--- /dev/null
+++ b/xen/arch/riscv/cpufeature.c
@@ -0,0 +1,504 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Originally taken for Linux kernel v6.12-rc3.
+ *
+ * Copyright (C) 2015 ARM Ltd.
+ * Copyright (C) 2017 SiFive
+ * Copyright (C) 2024 Vates
+ */
+
+#include <xen/bitmap.h>
+#include <xen/ctype.h>
+#include <xen/device_tree.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/sections.h>
+
+#include <asm/cpufeature.h>
+
+#ifdef CONFIG_ACPI
+# error "cpufeature.c functions should be updated to support ACPI"
+#endif
+
+struct riscv_isa_ext_data {
+    unsigned int id;
+    const char *name;
+};
+
+#define RISCV_ISA_EXT_DATA(ext_name)            \
+{                                               \
+    .id = RISCV_ISA_EXT_ ## ext_name,           \
+    .name = #ext_name,                          \
+}
+
+/* Host ISA bitmap */
+static __ro_after_init DECLARE_BITMAP(riscv_isa, RISCV_ISA_EXT_MAX);
+
+static int __init dt_get_cpuid_from_node(const struct dt_device_node *cpu,
+                                         unsigned long *dt_cpuid)
+{
+    const __be32 *prop;
+    unsigned int reg_len;
+
+    /*
+     * For debug purpose check dt_n_size_cells(cpu) value.
+     *
+     * Based on DT's bindings [1] and RISC-V's DTS files in kernel #size-cells
+     * for cpu node is expected to be 0.
+     *
+     * [1] https://www.kernel.org/doc/Documentation/devicetree/bindings/riscv/cpus.txt
+     */
+    if ( dt_n_size_cells(cpu) != 0 )
+        printk("DT's cpu node `%s`: #size-cells %d\n",
+               dt_node_full_name(cpu), dt_n_size_cells(cpu));
+
+    prop = dt_get_property(cpu, "reg", &reg_len);
+    if ( !prop )
+    {
+        printk("cpu node `%s`: has no reg property\n", dt_node_full_name(cpu));
+        return -EINVAL;
+    }
+
+    if ( reg_len < dt_cells_to_size(dt_n_addr_cells(cpu)) )
+    {
+        printk("cpu node `%s`: reg property too short\n",
+               dt_node_full_name(cpu));
+        return -EINVAL;
+    }
+
+    /*
+     * It is safe to convert `paddr_t` to `unsigned long` as dt_read_paddr()
+     * in the context of this function returns cpuid which according to RISC-V
+     * specification could be from 0 to ((1ULL << (MXLEN)) - 1), where
+     * MXLEN=32 for RV32 and MXLEN=64 for RV64.
+     */
+    *dt_cpuid = dt_read_paddr(prop, dt_n_addr_cells(cpu));
+
+    return 0;
+}
+
+/*
+ * The canonical order of ISA extension names in the ISA string is defined in
+ * chapter 27 of the unprivileged specification.
+ *
+ * The specification uses vague wording, such as should, when it comes to
+ * ordering, so for our purposes the following rules apply:
+ *
+ * 1. All multi-letter extensions must be separated from other extensions by an
+ *    underscore.
+ *
+ * 2. Additional standard extensions (starting with 'Z') must be sorted after
+ *    single-letter extensions and before any higher-privileged extensions.
+ *
+ * 3. The first letter following the 'Z' conventionally indicates the most
+ *    closely related alphabetical extension category, IMAFDQLCBKJTPVH.
+ *    If multiple 'Z' extensions are named, they must be ordered first by
+ *    category, then alphabetically within a category.
+ *
+ * 4. Standard supervisor-level extensions (starting with 'S') must be listed
+ *    after standard unprivileged extensions.  If multiple supervisor-level
+ *    extensions are listed, they must be ordered alphabetically.
+ *
+ * 5. Standard machine-level extensions (starting with 'Zxm') must be listed
+ *    after any lower-privileged, standard extensions.  If multiple
+ *    machine-level extensions are listed, they must be ordered
+ *    alphabetically.
+ *
+ * 6. Non-standard extensions (starting with 'X') must be listed after all
+ *    standard extensions. If multiple non-standard extensions are listed, they
+ *    must be ordered alphabetically.
+ *
+ * An example string following the order is:
+ *    rv64imadc_zifoo_zigoo_zafoo_sbar_scar_zxmbaz_xqux_xrux
+ *
+ * New entries to this struct should follow the ordering rules described above.
+ *
+ * Extension name must be all lowercase (according to device-tree binding)
+ * and strncmp() is used in match_isa_ext() to compare extension names instead
+ * of strncasecmp().
+ */
+const struct riscv_isa_ext_data __initconst riscv_isa_ext[] = {
+    RISCV_ISA_EXT_DATA(i),
+    RISCV_ISA_EXT_DATA(m),
+    RISCV_ISA_EXT_DATA(a),
+    RISCV_ISA_EXT_DATA(f),
+    RISCV_ISA_EXT_DATA(d),
+    RISCV_ISA_EXT_DATA(q),
+    RISCV_ISA_EXT_DATA(c),
+    RISCV_ISA_EXT_DATA(h),
+    RISCV_ISA_EXT_DATA(zicntr),
+    RISCV_ISA_EXT_DATA(zicsr),
+    RISCV_ISA_EXT_DATA(zifencei),
+    RISCV_ISA_EXT_DATA(zihintpause),
+    RISCV_ISA_EXT_DATA(zihpm),
+    RISCV_ISA_EXT_DATA(zba),
+    RISCV_ISA_EXT_DATA(zbb),
+    RISCV_ISA_EXT_DATA(zbs),
+    RISCV_ISA_EXT_DATA(smaia),
+    RISCV_ISA_EXT_DATA(ssaia),
+};
+
+static const struct riscv_isa_ext_data __initconst required_extensions[] = {
+    RISCV_ISA_EXT_DATA(i),
+    RISCV_ISA_EXT_DATA(m),
+    RISCV_ISA_EXT_DATA(a),
+#ifdef CONFIG_RISCV_ISA_C
+    RISCV_ISA_EXT_DATA(c),
+#endif
+    RISCV_ISA_EXT_DATA(zicsr),
+    RISCV_ISA_EXT_DATA(zifencei),
+    RISCV_ISA_EXT_DATA(zihintpause),
+    RISCV_ISA_EXT_DATA(zbb),
+};
+
+static bool __init is_lowercase_extension_name(const char *str)
+{
+    /*
+     * `str` could contain full riscv,isa string from device tree so one
+     * of the stop conditions is checking for '_' as extensions are
+     * separated by '_'.
+     */
+    for ( unsigned int i = 0; (str[i] != '\0') && (str[i] != '_'); i++ )
+        if ( !isdigit(str[i]) && !islower(str[i]) )
+            return false;
+
+    return true;
+}
+
+static void __init match_isa_ext(const char *name, const char *name_end,
+                                 unsigned long *bitmap)
+{
+    const size_t riscv_isa_ext_count = ARRAY_SIZE(riscv_isa_ext);
+
+    for ( unsigned int i = 0; i < riscv_isa_ext_count; i++ )
+    {
+        const struct riscv_isa_ext_data *ext = &riscv_isa_ext[i];
+
+        /*
+         * `ext->name` (according to initialization of riscv_isa_ext[]
+         * elements) must be all in lowercase.
+         */
+        ASSERT(is_lowercase_extension_name(ext->name));
+
+        if ( (name_end - name == strlen(ext->name)) &&
+             !memcmp(name, ext->name, name_end - name) )
+        {
+            __set_bit(ext->id, bitmap);
+            break;
+        }
+    }
+}
+
+static int __init riscv_isa_parse_string(const char *isa,
+                                         unsigned long *out_bitmap)
+{
+    if ( (isa[0] != 'r') && (isa[1] != 'v') )
+        return -EINVAL;
+
+#if defined(CONFIG_RISCV_32)
+    if ( isa[2] != '3' && isa[3] != '2' )
+        return -EINVAL;
+#elif defined(CONFIG_RISCV_64)
+    if ( isa[2] != '6' && isa[3] != '4' )
+        return -EINVAL;
+#else
+# error "unsupported RISC-V bitness"
+#endif
+
+    /*
+     * In unpriv. specification (*_20240411) is mentioned the following:
+     * (1) A RISC-V ISA is defined as a base integer ISA, which must be
+     *     present in any implementation, plus optional extensions to
+     *     the base ISA.
+     * (2) Chapter 6 describes the RV32E and RV64E subset variants of
+     *     the RV32I or RV64I base instruction sets respectively, which
+     *     have been added to support small microcontrollers, and which
+     *     have half the number of integer registers.
+     *
+     * What means that isa should contain, at least, I or E.
+     *
+     * As Xen isn't expected to be run on microcontrollers and according
+     * to device tree binding the first extension should be "i".
+     */
+    if ( isa[4] != 'i' )
+        return -EINVAL;
+
+    isa += 4;
+
+    while ( *isa )
+    {
+        const char *ext = isa++;
+        const char *ext_end = isa;
+
+        switch ( *ext )
+        {
+        case 'x':
+            printk_once("Vendor extensions are ignored in riscv,isa\n");
+            /*
+             * To skip an extension, we find its end.
+             * As multi-letter extensions must be split from other multi-letter
+             * extensions with an "_", the end of a multi-letter extension will
+             * either be the null character or the "_" at the start of the next
+             * multi-letter extension.
+             */
+            for ( ; *isa && *isa != '_'; ++isa )
+                if ( unlikely(!isalnum(*isa)) )
+                    goto riscv_isa_parse_string_err;
+
+            ext_end = NULL;
+            break;
+
+        case 's':
+            /*
+             * Workaround for invalid single-letter 's' & 'u' (QEMU):
+             *   Before QEMU 7.1 it was an issue with misa to ISA string
+             *   conversion:
+             *     https://patchwork.kernel.org/project/qemu-devel/patch/dee09d708405075420b29115c1e9e87910b8da55.1648270894.git.research_trasio@irq.a4lg.com/#24792587
+             *   Additional details of the workaround on Linux kernel side:
+             *     https://lore.kernel.org/linux-riscv/ae93358e-e117-b43d-faad-772c529f846c@irq.a4lg.com/#t
+             *
+             * No need to set the bit in riscv_isa as 's' & 'u' are
+             * not valid ISA extensions. It works unless the first
+             * multi-letter extension in the ISA string begins with
+             * "Su" and is not prefixed with an underscore.
+             */
+            if ( ext[-1] != '_' && ext[1] == 'u' )
+            {
+                ++isa;
+                ext_end = NULL;
+                break;
+            }
+            fallthrough;
+        case 'z':
+            /*
+             * Before attempting to parse the extension itself, we find its end.
+             * As multi-letter extensions must be split from other multi-letter
+             * extensions with an "_", the end of a multi-letter extension will
+             * either be the null character or the "_" at the start of the next
+             * multi-letter extension.
+             *
+             * Next, as the extensions version is currently ignored, we
+             * eliminate that portion. This is done by parsing backwards from
+             * the end of the extension, removing any numbers. This may be a
+             * major or minor number however, so the process is repeated if a
+             * minor number was found.
+             *
+             * ext_end is intended to represent the first character *after* the
+             * name portion of an extension, but will be decremented to the last
+             * character itself while eliminating the extensions version number.
+             * A simple re-increment solves this problem.
+             */
+            for ( ; *isa && *isa != '_'; ++isa )
+                if ( unlikely(!isalnum(*isa)) )
+                    goto riscv_isa_parse_string_err;
+
+            ext_end = isa;
+
+            if ( !isdigit(ext_end[-1]) )
+                break;
+
+            while ( isdigit(*--ext_end) )
+                ;
+
+            if ( ext_end[0] != 'p' || !isdigit(ext_end[-1]) )
+            {
+                ++ext_end;
+                break;
+            }
+
+            while ( isdigit(*--ext_end) )
+                ;
+
+            ++ext_end;
+            break;
+
+        /*
+         * If someone mentioned `b` extension in riscv,isa instead of Zb{a,b,s}
+         * explicitly then set bits exlicitly in out_bitmap to satisfy
+         * requirement of Zbb (mentioned in required_extensions[]).
+         */
+        case 'b':
+            __set_bit(RISCV_ISA_EXT_zba, out_bitmap);
+            __set_bit(RISCV_ISA_EXT_zbb, out_bitmap);
+            __set_bit(RISCV_ISA_EXT_zbs, out_bitmap);
+            fallthrough;
+        default:
+            /*
+             * Things are a little easier for single-letter extensions, as they
+             * are parsed forwards.
+             *
+             * After checking that our starting position is valid, we need to
+             * ensure that, when isa was incremented at the start of the loop,
+             * that it arrived at the start of the next extension.
+             *
+             * If we are already on a non-digit, there is nothing to do. Either
+             * we have a multi-letter extension's _, or the start of an
+             * extension.
+             *
+             * Otherwise we have found the current extension's major version
+             * number. Parse past it, and a subsequent p/minor version number
+             * if present. The `p` extension must not appear immediately after
+             * a number, so there is no fear of missing it.
+             */
+            if ( unlikely(!isalpha(*ext)) )
+                goto riscv_isa_parse_string_err;
+
+            if ( !isdigit(*isa) )
+                break;
+
+            while ( isdigit(*++isa) )
+                ;
+
+            if ( *isa != 'p' )
+                break;
+
+            if ( !isdigit(*++isa) )
+            {
+                --isa;
+                break;
+            }
+
+            while ( isdigit(*++isa) )
+                ;
+
+            break;
+        }
+
+        /*
+         * The parser expects that at the start of an iteration isa points to the
+         * first character of the next extension. As we stop parsing an extension
+         * on meeting a non-alphanumeric character, an extra increment is needed
+         * where the succeeding extension is a multi-letter prefixed with an "_".
+         */
+        if ( *isa == '_' )
+            ++isa;
+
+        if ( unlikely(!ext_end) )
+            continue;
+
+        match_isa_ext(ext, ext_end, out_bitmap);
+    }
+
+    return 0;
+
+ riscv_isa_parse_string_err:
+    printk("illegal symbol '%c' in riscv,isa string\n", *isa);
+    return -EINVAL;
+}
+
+static void __init riscv_fill_hwcap_from_isa_string(void)
+{
+    const struct dt_device_node *cpus = dt_find_node_by_path("/cpus");
+    const struct dt_device_node *cpu;
+
+    if ( !cpus )
+    {
+        printk("Missing /cpus node in the device tree?\n");
+        return;
+    }
+
+    dt_for_each_child_node(cpus, cpu)
+    {
+        DECLARE_BITMAP(this_isa, RISCV_ISA_EXT_MAX);
+        const char *isa;
+        unsigned long cpuid;
+
+        if ( !dt_device_type_is_equal(cpu, "cpu") )
+            continue;
+
+        if ( dt_get_cpuid_from_node(cpu, &cpuid) < 0 )
+            continue;
+
+        if ( dt_property_read_string(cpu, "riscv,isa", &isa) )
+        {
+            printk("Unable to find \"riscv,isa\" devicetree entry "
+                   "for DT's cpu%ld node\n", cpuid);
+            continue;
+        }
+
+        for ( unsigned int i = 0; (isa[i] != '\0'); i++ )
+            if ( !isdigit(isa[i]) && (isa[i] != '_') && !islower(isa[i]) )
+                panic("According to DT binding riscv,isa must be lowercase\n");
+
+        if ( riscv_isa_parse_string(isa, this_isa) )
+            panic("Check riscv,isa in dts file\n");
+
+        if ( bitmap_empty(riscv_isa, RISCV_ISA_EXT_MAX) )
+            bitmap_copy(riscv_isa, this_isa, RISCV_ISA_EXT_MAX);
+        else
+            bitmap_and(riscv_isa, riscv_isa, this_isa, RISCV_ISA_EXT_MAX);
+    }
+}
+
+static bool __init has_isa_extensions_property(void)
+{
+    const struct dt_device_node *cpus = dt_find_node_by_path("/cpus");
+    const struct dt_device_node *cpu;
+
+    if ( !cpus )
+    {
+        printk("Missing /cpus node in the device tree?\n");
+        return false;
+    }
+
+    dt_for_each_child_node(cpus, cpu)
+    {
+        const char *isa;
+
+        if ( !dt_device_type_is_equal(cpu, "cpu") )
+            continue;
+
+        if ( dt_property_read_string(cpu, "riscv,isa-extensions", &isa) )
+            continue;
+
+        return true;
+    }
+
+    return false;
+}
+
+bool riscv_isa_extension_available(const unsigned long *isa_bitmap,
+                                   enum riscv_isa_ext_id id)
+{
+    if ( !isa_bitmap )
+        isa_bitmap = riscv_isa;
+
+    if ( id >= RISCV_ISA_EXT_MAX )
+        return false;
+
+    return test_bit(id, isa_bitmap);
+}
+
+void __init riscv_fill_hwcap(void)
+{
+    unsigned int i;
+    const size_t req_extns_amount = ARRAY_SIZE(required_extensions);
+    bool all_extns_available = true;
+
+    riscv_fill_hwcap_from_isa_string();
+
+    if ( bitmap_empty(riscv_isa, RISCV_ISA_EXT_MAX) )
+    {
+        const char *failure_msg = has_isa_extensions_property() ?
+                                  "\"riscv,isa-extension\" isn't supported" :
+                                  "\"riscv,isa\" parsing failed";
+
+        panic("HW capabilities parsing failed: %s\n", failure_msg);
+    }
+
+    for ( i = 0; i < req_extns_amount; i++ )
+    {
+        const struct riscv_isa_ext_data ext = required_extensions[i];
+
+        if ( !riscv_isa_extension_available(NULL, ext.id) )
+        {
+            printk("Xen requires extension: %s\n", ext.name);
+            all_extns_available = false;
+        }
+    }
+
+    if ( !all_extns_available )
+        panic("Look why the extensions above are needed in "
+              "https://xenbits.xenproject.org/docs/unstable/misc/riscv/booting.txt\n");
+}
diff --git a/xen/arch/riscv/include/asm/cpufeature.h b/xen/arch/riscv/include/asm/cpufeature.h
new file mode 100644
index 0000000000..1015b6ee44
--- /dev/null
+++ b/xen/arch/riscv/include/asm/cpufeature.h
@@ -0,0 +1,59 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef ASM__RISCV__CPUFEATURE_H
+#define ASM__RISCV__CPUFEATURE_H
+
+#ifndef __ASSEMBLY__
+
+#include <xen/stdbool.h>
+
+/*
+ * These macros represent the logical IDs of each multi-letter RISC-V ISA
+ * extension and are used in the ISA bitmap. The logical IDs start from
+ * RISCV_ISA_EXT_BASE, which allows the 0-25 range to be reserved for single
+ * letter extensions and are used in enum riscv_isa_ext_id.
+ *
+ * New extensions should just be added to the bottom, rather than added
+ * alphabetically, in order to avoid unnecessary shuffling.
+ */
+#define RISCV_ISA_EXT_BASE  26
+
+enum riscv_isa_ext_id {
+    RISCV_ISA_EXT_a,
+    RISCV_ISA_EXT_c,
+    RISCV_ISA_EXT_d,
+    RISCV_ISA_EXT_f,
+    RISCV_ISA_EXT_h,
+    RISCV_ISA_EXT_i,
+    RISCV_ISA_EXT_m,
+    RISCV_ISA_EXT_q,
+    RISCV_ISA_EXT_v,
+    RISCV_ISA_EXT_zicntr = RISCV_ISA_EXT_BASE,
+    RISCV_ISA_EXT_zicsr,
+    RISCV_ISA_EXT_zifencei,
+    RISCV_ISA_EXT_zihintpause,
+    RISCV_ISA_EXT_zihpm,
+    RISCV_ISA_EXT_zba,
+    RISCV_ISA_EXT_zbb,
+    RISCV_ISA_EXT_zbs,
+    RISCV_ISA_EXT_smaia,
+    RISCV_ISA_EXT_ssaia,
+    RISCV_ISA_EXT_MAX
+};
+
+void riscv_fill_hwcap(void);
+
+bool riscv_isa_extension_available(const unsigned long *isa_bitmap,
+                                   enum riscv_isa_ext_id id);
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* ASM__RISCV__CPUFEATURE_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index f2b6e684ac..b0e587678e 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -13,6 +13,7 @@
 
 #include <public/version.h>
 
+#include <asm/cpufeature.h>
 #include <asm/early_printk.h>
 #include <asm/fixmap.h>
 #include <asm/sbi.h>
@@ -123,6 +124,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
         panic("Booting using ACPI isn't supported\n");
     }
 
+    riscv_fill_hwcap();
+
     printk("All set up\n");
 
     machine_halt();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:14:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:14:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903515.1311462 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB3l-0007qX-M6; Thu, 06 Mar 2025 13:14:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903515.1311462; Thu, 06 Mar 2025 13:14:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB3l-0007qP-JY; Thu, 06 Mar 2025 13:14:45 +0000
Received: by outflank-mailman (input) for mailman id 903515;
 Thu, 06 Mar 2025 13:14:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB3k-0007qC-8o
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:14:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB3k-0055fE-1Y
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:14:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB3k-00AK0v-0i
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:14:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vg7hXFSS6PCOIqNwa87n2FE7whRpoUfEmjWYGZLi9W4=; b=PzpFgEDhCkrjD1irDqM9/5oTx0
	tYO1sdG3LWPCN0718iuDJ/tchy/gLyol2KxASrwEbjRyIQFHKa3YdwLbL2aql9pmFONkSSQGIjI0k
	uKIWn5PgEe1zPJ+WOhidbXedhOPtp6Jmsiz8bLmwYLvVJcJcNnkej/lumG5jg2ghSMcE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] RISCV/bitops: Use Zbb to provide arch-optimised bitops
Message-Id: <E1tqB3k-00AK0v-0i@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:14:44 +0000

commit 7388912f275653a58769d8e77ac4d4cd452b7d37
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 6 14:03:15 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:03:15 2025 +0100

    RISCV/bitops: Use Zbb to provide arch-optimised bitops
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/riscv/include/asm/bitops.h | 7 +++++++
 xen/arch/riscv/include/asm/config.h | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/xen/arch/riscv/include/asm/bitops.h b/xen/arch/riscv/include/asm/bitops.h
index d22eec1e87..72a4a8c155 100644
--- a/xen/arch/riscv/include/asm/bitops.h
+++ b/xen/arch/riscv/include/asm/bitops.h
@@ -125,6 +125,13 @@ static inline void clear_bit(int nr, volatile void *p)
 #undef NOT
 #undef __AMO
 
+#define arch_ffs(x)     ((x) ? 1 + __builtin_ctz(x) : 0)
+#define arch_ffsl(x)    ((x) ? 1 + __builtin_ctzl(x) : 0)
+#define arch_fls(x)     ((x) ? BITS_PER_INT - __builtin_clz(x) : 0)
+#define arch_flsl(x)    ((x) ? BITS_PER_LONG - __builtin_clzl(x) : 0)
+
+#define arch_hweightl(x) __builtin_popcountl(x)
+
 #endif /* ASM__RISCV__BITOPS_H */
 
 /*
diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/asm/config.h
index 826e5c7172..7141bd9e46 100644
--- a/xen/arch/riscv/include/asm/config.h
+++ b/xen/arch/riscv/include/asm/config.h
@@ -119,6 +119,7 @@
 #define HYPERVISOR_VIRT_START XEN_VIRT_START
 
 #if defined(CONFIG_RISCV_64)
+# define INT_BYTEORDER 2
 # define LONG_BYTEORDER 3
 # define ELFSIZE 64
 # define MAX_VIRT_CPUS 128u
@@ -126,6 +127,9 @@
 # error "Unsupported RISCV variant"
 #endif
 
+#define BYTES_PER_INT  (1 << INT_BYTEORDER)
+#define BITS_PER_INT  (BYTES_PER_INT << 3)
+
 #define BYTES_PER_LONG (1 << LONG_BYTEORDER)
 #define BITS_PER_LONG  (BYTES_PER_LONG << 3)
 #define POINTER_ALIGN  BYTES_PER_LONG
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:14:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:14:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903516.1311467 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB3v-0007u0-Oq; Thu, 06 Mar 2025 13:14:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903516.1311467; Thu, 06 Mar 2025 13:14:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB3v-0007ts-MH; Thu, 06 Mar 2025 13:14:55 +0000
Received: by outflank-mailman (input) for mailman id 903516;
 Thu, 06 Mar 2025 13:14:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB3u-0007td-D8
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:14:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB3u-0055fI-1o
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:14:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB3u-00AK1P-0y
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:14:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gtv+UehYzJgWmZCUU052HK+zAdiPJYT6hsbn/RtJnIU=; b=6Wdr2+Zkmg2+jI3iVpFlaBLxoa
	quNcZESYqJbQDU72ktP0m9V/iT2uG9bRZO5nWLX9BDKdWgs1WQYxMo4Ui/C/NliDpMHkj9s7Xq7jE
	i8HRypkxAeZ5PLNc1cFrRDVLBc2gZZImE1GU7Lp+zgmSbmkAwUxI8aLMBz305OM+7R9Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/public: remove some unused defines from xs_wire.h
Message-Id: <E1tqB3u-00AK1P-0y@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:14:54 +0000

commit dbdc8d5a54bcc5d8ca07771d524947eb76803f92
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 14:03:37 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:03:37 2025 +0100

    xen/public: remove some unused defines from xs_wire.h
    
    xs_wire.h contains some defines XS_WRITE_* which seem to be leftovers
    from some decades ago. They haven't been used in the Xen tree since at
    least Xen 2.0 and they make no sense anyway.
    
    Remove them, as they seem not to be related to any Xen interface we
    have today.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/io/xs_wire.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/include/public/io/xs_wire.h b/xen/include/public/io/xs_wire.h
index 04e6849feb..0d9f49ac89 100644
--- a/xen/include/public/io/xs_wire.h
+++ b/xen/include/public/io/xs_wire.h
@@ -41,10 +41,6 @@ enum xsd_sockmsg_type
     XS_INVALID = 0xffff /* Guaranteed to remain an invalid type */
 };
 
-#define XS_WRITE_NONE "NONE"
-#define XS_WRITE_CREATE "CREATE"
-#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
-
 /* We hand errors as strings, for portability. */
 struct xsd_errors
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:15:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:15:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903517.1311472 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB45-0007wq-Qn; Thu, 06 Mar 2025 13:15:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903517.1311472; Thu, 06 Mar 2025 13:15:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqB45-0007wi-Nd; Thu, 06 Mar 2025 13:15:05 +0000
Received: by outflank-mailman (input) for mailman id 903517;
 Thu, 06 Mar 2025 13:15:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqB44-0007wR-Dz
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:15:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB44-0055g3-24
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:15:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqB44-00AK28-1D
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:15:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MaMl/nHcGcbDSDJL6WUub2dFcLKi5Al/gx/3I4pLQfk=; b=UqJ7DJ7iH2eMM6Lz6gZWnWlz/Y
	LseDhbzAHcbmRJe9dvw//3i9dBPeaw4uroFJTn616S57IXslVL/I2ICO5s/zr/gFlc551KCCp3pkU
	SryXz3/viRHrLdFgDOzzgGy+2jV1PcLeu433PuoVIO2ZQQyX5DOzSYyG5ssrwRWox+i4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/public: add missing Xenstore commands to xs_wire.h
Message-Id: <E1tqB44-00AK28-1D@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:15:04 +0000

commit 0fd49cc7dbdfc13faced294ccc970e7a57d08907
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 14:03:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:03:51 2025 +0100

    xen/public: add missing Xenstore commands to xs_wire.h
    
    The GET_FEATURE, SET_FEATURE, GET_QUOTA and SET_QUOTA Xenstore commands
    are defined in docs/misc/xenstore.txt, but they are missing in
    xs_wire.h.
    
    Add the missing commands to xs_wire.h
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/io/xs_wire.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/include/public/io/xs_wire.h b/xen/include/public/io/xs_wire.h
index 0d9f49ac89..e92a87a07b 100644
--- a/xen/include/public/io/xs_wire.h
+++ b/xen/include/public/io/xs_wire.h
@@ -35,6 +35,10 @@ enum xsd_sockmsg_type
     /* XS_RESTRICT has been removed */
     XS_RESET_WATCHES = XS_SET_TARGET + 2,
     XS_DIRECTORY_PART,
+    XS_GET_FEATURE,
+    XS_SET_FEATURE,
+    XS_GET_QUOTA,
+    XS_SET_QUOTA,
 
     XS_TYPE_COUNT,      /* Number of valid types. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 13:55:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 13:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903569.1311525 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqBgl-0002aa-U9; Thu, 06 Mar 2025 13:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903569.1311525; Thu, 06 Mar 2025 13:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqBgl-0002aR-Rc; Thu, 06 Mar 2025 13:55:03 +0000
Received: by outflank-mailman (input) for mailman id 903569;
 Thu, 06 Mar 2025 13:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqBgk-0002a2-K7
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 13:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqBgk-0056QR-1Z
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqBgk-00AOrE-0b
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 13:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vA6DwtWfwfT1uA+nwNoMm20oYF+gx66duU0ZL30nSlY=; b=MFCgbPgnkehRbKa/XgQj12ngld
	bQimy7sgubO/2kjIs8W1WreQfejgRhyVEZe6PMSrBzNynYXBKddc/hu7ax4IbNTVtDdokcO/u9BvR
	wSzDTiDionpFczXsEl1/1aI/6BZjsNsv674x/iBgW0c8LSApHgZtdb++QuBzsBPY3/PY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] config: add support for libxenmanage
Message-Id: <E1tqBgk-00AOrE-0b@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 13:55:02 +0000

commit d273a44cec90dad5d3f0bc361a6fea41e0288a56
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 14:37:35 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:37:35 2025 +0100

    config: add support for libxenmanage
    
    Add CONFIG_LIBXENMANAGE support.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 Config.mk | 2 ++
 Makefile  | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/Config.mk b/Config.mk
index f59a0cf..e493533 100644
--- a/Config.mk
+++ b/Config.mk
@@ -46,6 +46,7 @@ GNTTAB_PATH ?= $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab
 CALL_PATH ?= $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call
 FOREIGNMEMORY_PATH ?= $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory
 DEVICEMODEL_PATH ?= $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/devicemodel
+MANAGE_PATH ?= $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/manage
 CTRL_PATH ?= $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)
 GUEST_PATH ?= $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)
 else
@@ -202,6 +203,7 @@ CONFIG-n += CONFIG_LIBXENGNTTAB
 CONFIG-n += CONFIG_LIBXENGUEST
 CONFIG-n += CONFIG_LIBXENTOOLCORE
 CONFIG-n += CONFIG_LIBXENTOOLLOG
+CONFIG-n += CONFIG_LIBXENMANAGE
 # Setting CONFIG_USE_XEN_CONSOLE copies all print output to the Xen emergency
 # console apart of standard dom0 handled console.
 CONFIG-n += CONFIG_USE_XEN_CONSOLE
diff --git a/Makefile b/Makefile
index ffa8d1a..d094858 100644
--- a/Makefile
+++ b/Makefile
@@ -159,6 +159,10 @@ ifeq ($(CONFIG_LIBXENCTRL),y)
 APP_LDLIBS += -L$(CTRL_PATH) -whole-archive -lxenctrl -no-whole-archive
 LIBS += $(CTRL_PATH)/libxenctrl.a
 endif
+ifeq ($(CONFIG_LIBXENMANAGE),y)
+APP_LDLIBS += -L$(MANAGE_PATH) -whole-archive -lxenmanage -no-whole-archive
+LIBS += $(MANAGE_PATH)/libxenmanage.a
+endif
 APP_LDLIBS += -lpci
 APP_LDLIBS += -lz
 APP_LDLIBS += -lm
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 14:00:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 14:00:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903585.1311539 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqBlb-0003t3-Ho; Thu, 06 Mar 2025 14:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903585.1311539; Thu, 06 Mar 2025 14:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqBlb-0003si-F2; Thu, 06 Mar 2025 14:00:03 +0000
Received: by outflank-mailman (input) for mailman id 903585;
 Thu, 06 Mar 2025 14:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqBlZ-0003ZO-V1
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 14:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqBla-0056cV-0Q
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 14:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqBlZ-00APOw-2l
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 14:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1bUdkmJE3GLXA7KYjy7Nd/Hmh3gT7ZMVUeYceC7lk08=; b=rE3Xj74nvVKT291UfmwgdGXXev
	amODxjqzdAL+AgzGA+5RCIME6JPJ/8HHNDRYK2k4Nm9krBLJdmzpYru+4nQkPhx1byGC0YHWK9fS1
	3ASp9rR25P8MV7ZsA+9K1sRnUKRkXUkzyT5NUdjMv2m1cLtP27kaYzliqFvlijW5qZ7M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] config: update Mini-OS commit
Message-Id: <E1tqBlZ-00APOw-2l@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 14:00:01 +0000

commit 0184bceaa889743846d2a6257217b28c66578ed7
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 14:54:50 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:54:50 2025 +0100

    config: update Mini-OS commit
    
    Update the Mini-OS upstream revision.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 8b426a580f..8a73f3da62 100644
--- a/Config.mk
+++ b/Config.mk
@@ -232,7 +232,7 @@ QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
 QEMU_UPSTREAM_REVISION ?= master
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= 6d5159e8410be16a47433bac1627e63f8adc7cd9
+MINIOS_UPSTREAM_REVISION ?= d273a44cec90dad5d3f0bc361a6fea41e0288a56
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.3
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 14:33:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 14:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903624.1311583 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqCHX-0004Dl-ML; Thu, 06 Mar 2025 14:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903624.1311583; Thu, 06 Mar 2025 14:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqCHX-0004Dd-Jk; Thu, 06 Mar 2025 14:33:03 +0000
Received: by outflank-mailman (input) for mailman id 903624;
 Thu, 06 Mar 2025 14:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqCHW-0004DX-GH
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 14:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqCHW-0057JX-1E
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 14:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqCHW-00ASne-0B
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 14:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UIORWKgBrgE4kv70ikI4aPdv0rb0Kl3ie6mjqEkw2Rk=; b=G5Akvse2mdPu9ZhtUcib7liu+/
	3jefJ3nZMp8edVUr3l/pwLHAriaRn0VyIuI301E1TLY8BNtrxN294bSuBLGvUBs6YEDMJqYN+P8Cj
	mZu6fbVuUutUOzhNqpi9fwbFwJOSjZq3quKdmA3vqNBrAa5jg/K6fgK2hLHEqFvaZFBE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "EFI: Avoid crash calling PrintErrMesg() from efi_multiboot2()"
Message-Id: <E1tqCHW-00ASne-0B@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 14:33:02 +0000

commit 2a0add9e32e84727e7807bf2a38e3433103c2155
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 15:20:39 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 15:20:39 2025 +0100

    Revert "EFI: Avoid crash calling PrintErrMesg() from efi_multiboot2()"
    
    This reverts commit eaed0d185ab8b73cd18ac2830878520b3011f5ab. It breaks the
    build with old Clang (3.8).
---
 xen/common/efi/boot.c        | 58 +++++++++++++++-----------------------------
 xen/common/efi/efi-common.mk |  1 -
 2 files changed, 19 insertions(+), 40 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 143b5681ba..efbec00af9 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -287,53 +287,33 @@ static bool __init match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2)
 /* generic routine for printing error messages */
 static void __init PrintErrMesg(const CHAR16 *mesg, EFI_STATUS ErrCode)
 {
+    static const CHAR16* const ErrCodeToStr[] __initconstrel = {
+        [~EFI_ERROR_MASK & EFI_NOT_FOUND]           = L"Not found",
+        [~EFI_ERROR_MASK & EFI_NO_MEDIA]            = L"The device has no media",
+        [~EFI_ERROR_MASK & EFI_MEDIA_CHANGED]       = L"Media changed",
+        [~EFI_ERROR_MASK & EFI_DEVICE_ERROR]        = L"Device error",
+        [~EFI_ERROR_MASK & EFI_VOLUME_CORRUPTED]    = L"Volume corrupted",
+        [~EFI_ERROR_MASK & EFI_ACCESS_DENIED]       = L"Access denied",
+        [~EFI_ERROR_MASK & EFI_OUT_OF_RESOURCES]    = L"Out of resources",
+        [~EFI_ERROR_MASK & EFI_VOLUME_FULL]         = L"Volume is full",
+        [~EFI_ERROR_MASK & EFI_SECURITY_VIOLATION]  = L"Security violation",
+        [~EFI_ERROR_MASK & EFI_CRC_ERROR]           = L"CRC error",
+        [~EFI_ERROR_MASK & EFI_COMPROMISED_DATA]    = L"Compromised data",
+        [~EFI_ERROR_MASK & EFI_BUFFER_TOO_SMALL]    = L"Buffer too small",
+    };
+    EFI_STATUS ErrIdx = ErrCode & ~EFI_ERROR_MASK;
+
     StdOut = StdErr;
     PrintErr(mesg);
     PrintErr(L": ");
 
-    switch (ErrCode)
+    if( (ErrIdx < ARRAY_SIZE(ErrCodeToStr)) && ErrCodeToStr[ErrIdx] )
+        mesg = ErrCodeToStr[ErrIdx];
+    else
     {
-    case EFI_NOT_FOUND:
-        mesg = L"Not found";
-        break;
-    case EFI_NO_MEDIA:
-        mesg = L"The device has no media";
-        break;
-    case EFI_MEDIA_CHANGED:
-        mesg = L"Media changed";
-        break;
-    case EFI_DEVICE_ERROR:
-        mesg = L"Device error";
-        break;
-    case EFI_VOLUME_CORRUPTED:
-        mesg = L"Volume corrupted";
-        break;
-    case EFI_ACCESS_DENIED:
-        mesg = L"Access denied";
-        break;
-    case EFI_OUT_OF_RESOURCES:
-        mesg = L"Out of resources";
-        break;
-    case EFI_VOLUME_FULL:
-        mesg = L"Volume is full";
-        break;
-    case EFI_SECURITY_VIOLATION:
-        mesg = L"Security violation";
-        break;
-    case EFI_CRC_ERROR:
-        mesg = L"CRC error";
-        break;
-    case EFI_COMPROMISED_DATA:
-        mesg = L"Compromised data";
-        break;
-    case EFI_BUFFER_TOO_SMALL:
-        mesg = L"Buffer too small";
-        break;
-    default:
         PrintErr(L"ErrCode: ");
         DisplayUint(ErrCode, 0);
         mesg = NULL;
-        break;
     }
     blexit(mesg);
 }
diff --git a/xen/common/efi/efi-common.mk b/xen/common/efi/efi-common.mk
index 06b1c19674..23cafcf20c 100644
--- a/xen/common/efi/efi-common.mk
+++ b/xen/common/efi/efi-common.mk
@@ -2,7 +2,6 @@ EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
 EFIOBJ-$(CONFIG_COMPAT) += compat.o
 
 CFLAGS-y += -fshort-wchar
-CFLAGS-y += -fno-jump-tables
 CFLAGS-y += -iquote $(srctree)/common/efi
 CFLAGS-y += -iquote $(srcdir)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 14:33:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 14:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903625.1311588 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqCHh-0004FI-O1; Thu, 06 Mar 2025 14:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903625.1311588; Thu, 06 Mar 2025 14:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqCHh-0004FA-L8; Thu, 06 Mar 2025 14:33:13 +0000
Received: by outflank-mailman (input) for mailman id 903625;
 Thu, 06 Mar 2025 14:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqCHg-0004Ey-9o
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 14:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqCHg-0057Jb-1c
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 14:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqCHg-00ASr6-0f
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 14:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HKrh1nkTMJYpRjTk2+YF9KdLVC5ajFdlij5XSbM6xsU=; b=xCxuBPbqyeLPip9xNg7oUVpAqB
	5bLio/pTT2zd0L70h3ziU6TAEHgvlRuOEMu25M559UvZ+tluZpuZOCk2LjNjG1+dCTZLYyYo3LrMa
	LIu6KOcL2pWs8G2GxjNIMW5eXxfejpRTMcVgLnQDZZxzg9GdZ0e5KWB3qq10rbKoJASg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] XSM: correct xsm_get_domain_state()
Message-Id: <E1tqCHg-00ASr6-0f@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 14:33:12 +0000

commit 033bfd20e8fb30e430ccfe6a8de0e1d56839e78c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 15:21:52 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 15:21:52 2025 +0100

    XSM: correct xsm_get_domain_state()
    
    Add the missing first parameter and move it next to a close relative.
    
    Fixes: 3ad3df1bd0aa ("xen: add new domctl get_domain_state")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/xsm/xsm.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 0689bf5c9f..8c33b055fc 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -231,6 +231,11 @@ static inline int xsm_getdomaininfo(xsm_default_t def, struct domain *d)
     return alternative_call(xsm_ops.getdomaininfo, d);
 }
 
+static inline int xsm_get_domain_state(xsm_default_t def, struct domain *d)
+{
+    return alternative_call(xsm_ops.get_domain_state, d);
+}
+
 static inline int xsm_domctl_scheduler_op(
     xsm_default_t def, struct domain *d, int cmd)
 {
@@ -775,11 +780,6 @@ static inline int xsm_argo_send(const struct domain *d, const struct domain *t)
 
 #endif /* CONFIG_ARGO */
 
-static inline int xsm_get_domain_state(struct domain *d)
-{
-    return alternative_call(xsm_ops.get_domain_state, d);
-}
-
 #endif /* XSM_NO_WRAPPERS */
 
 #ifdef CONFIG_MULTIBOOT
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 06 16:33:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 06 Mar 2025 16:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.903894.1311830 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqE9f-0004Ab-E0; Thu, 06 Mar 2025 16:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 903894.1311830; Thu, 06 Mar 2025 16:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqE9f-0004AT-BN; Thu, 06 Mar 2025 16:33:03 +0000
Received: by outflank-mailman (input) for mailman id 903894;
 Thu, 06 Mar 2025 16:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqE9e-0004AN-8a
 for xen-changelog@lists.xenproject.org; Thu, 06 Mar 2025 16:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqE9e-005AJh-0O
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 16:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqE9d-00AgVl-2g
 for xen-changelog@lists.xenproject.org;
 Thu, 06 Mar 2025 16:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YdPw7h5BDUs33F8WjJV4M7FyE6miV8vtcjwXJvHGgtM=; b=OrYmJo1dKmDtvqVnU38EzyuXro
	0F2Hdd2EZ7ijPtAt1ih7cVj1plQywpJnRQoVF7bGgX5r1yXj/vK+paDVEEJhFzfBJrz2Day828zzZ
	173bOPCeAwcbfAkdQhT1OJO3C5lOprVkDxyVY53SWDhDucnzg1/e/3CtnGaZaem2U2ZA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/events: fix get_global_virq_handler() usage without hardware domain
Message-Id: <E1tqE9d-00AgVl-2g@xenbits.xenproject.org>
Date: Thu, 06 Mar 2025 16:33:01 +0000

commit fe5757f25de6062732c088ae54e2180236632552
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 17:23:36 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 17:23:36 2025 +0100

    xen/events: fix get_global_virq_handler() usage without hardware domain
    
    Some use cases of get_global_virq_handler() didn't account for the
    case of running without hardware domain.
    
    Fix that by testing get_global_virq_handler() returning NULL where
    needed (e.g. when directly dereferencing the result).
    
    Fixes: 980822c5edd1 ("xen/events: allow setting of global virq handler only for unbound virqs")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/event_channel.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 4ee6b6b4ce..c68aa97135 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -1036,7 +1036,9 @@ int set_global_virq_handler(struct domain *d, uint32_t virq)
     {
         old = global_virq_handlers[virq];
         hdl = get_global_virq_handler(virq);
-        if ( hdl != d )
+        if ( !hdl )
+            global_virq_handlers[virq] = d;
+        else if ( hdl != d )
         {
             read_lock(&hdl->event_lock);
 
@@ -1091,7 +1093,7 @@ struct domain *lock_dom_exc_handler(void)
     struct domain *d;
 
     d = get_global_virq_handler(VIRQ_DOM_EXC);
-    if ( unlikely(!get_domain(d)) )
+    if ( unlikely(!d) || unlikely(!get_domain(d)) )
         return NULL;
 
     read_lock(&d->event_lock);
@@ -1101,6 +1103,9 @@ struct domain *lock_dom_exc_handler(void)
 
 void unlock_dom_exc_handler(struct domain *d)
 {
+    if ( likely(!d) )
+        return;
+
     read_unlock(&d->event_lock);
 
     put_domain(d);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 13:22:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 13:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905035.1312794 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqXeN-0004to-VP; Fri, 07 Mar 2025 13:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905035.1312794; Fri, 07 Mar 2025 13:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqXeN-0004tg-Sq; Fri, 07 Mar 2025 13:22:03 +0000
Received: by outflank-mailman (input) for mailman id 905035;
 Fri, 07 Mar 2025 13:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqXeM-0004tQ-Fc
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 13:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqXeM-006zGB-1t
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 13:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqXeM-00CXWG-0z
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 13:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/JkI/voTFaRNy0xcoyMnsz0l0GjIxNFWGKsnTlE7vsc=; b=EVR/b7s/WcMdaIGMZXfajrriiC
	xVXU67CI6I3g3iFnnPCFHSSJjbGZnKaztj1CSDZsF4WblINi5vhYrl5nVC4pi0JMBdg8BT6pVV5oD
	szaJJCDxAVVVY+7QV3wtELC0XpRAUvqgwJLfX1I321whMYvy7K45+kmqvNPJ6lSfWJMw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/events: fix global virq handling
Message-Id: <E1tqXeM-00CXWG-0z@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 13:22:02 +0000

commit bb1accab6903dc7ecbb63f505f9147e01d8e4c80
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 7 11:11:41 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 13:11:30 2025 +0000

    xen/events: fix global virq handling
    
    VIRQs are split into "global" and "per vcpu" ones. Unfortunately in
    reality there are "per domain" ones, too.
    
    send_global_virq() and set_global_virq_handler() make only sense for
    the real "global" ones, so replace virq_is_global() with a new
    function get_virq_type() returning one of the 3 possible types (global,
    domain, vcpu VIRQ).
    
    To make its intended purpose more clear, also rename
    send_guest_global_virq() to send_guest_domain_virq().
    
    Fixes: 980822c5edd1 ("xen/events: allow setting of global virq handler only for unbound virqs")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/arm/include/asm/event.h   |  4 ++--
 xen/arch/ppc/include/asm/event.h   |  4 ++--
 xen/arch/riscv/include/asm/event.h |  4 ++--
 xen/arch/x86/include/asm/event.h   |  6 +++---
 xen/common/argo.c                  |  2 +-
 xen/common/event_channel.c         | 38 +++++++++++++++++++++-----------------
 xen/include/xen/event.h            | 14 +++++++-------
 xen/include/xen/sched.h            |  6 ++++++
 8 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/xen/arch/arm/include/asm/event.h b/xen/arch/arm/include/asm/event.h
index b14c166ad6..509157b2b3 100644
--- a/xen/arch/arm/include/asm/event.h
+++ b/xen/arch/arm/include/asm/event.h
@@ -47,9 +47,9 @@ static inline void local_event_delivery_enable(void)
 }
 
 /* No arch specific virq definition now. Default to global. */
-static inline bool arch_virq_is_global(unsigned int virq)
+static inline enum virq_type arch_get_virq_type(unsigned int virq)
 {
-    return true;
+    return VIRQ_GLOBAL;
 }
 
 #endif
diff --git a/xen/arch/ppc/include/asm/event.h b/xen/arch/ppc/include/asm/event.h
index 1b95ee4f61..0f475c4b89 100644
--- a/xen/arch/ppc/include/asm/event.h
+++ b/xen/arch/ppc/include/asm/event.h
@@ -17,9 +17,9 @@ static inline int vcpu_event_delivery_is_enabled(struct vcpu *v)
 }
 
 /* No arch specific virq definition now. Default to global. */
-static inline bool arch_virq_is_global(unsigned int virq)
+static inline enum virq_type arch_get_virq_type(unsigned int virq)
 {
-    return true;
+    return VIRQ_GLOBAL;
 }
 
 static inline int local_events_need_delivery(void)
diff --git a/xen/arch/riscv/include/asm/event.h b/xen/arch/riscv/include/asm/event.h
index c7bb8c0fa6..116434c665 100644
--- a/xen/arch/riscv/include/asm/event.h
+++ b/xen/arch/riscv/include/asm/event.h
@@ -24,9 +24,9 @@ static inline void local_event_delivery_enable(void)
 }
 
 /* No arch specific virq definition now. Default to global. */
-static inline bool arch_virq_is_global(unsigned int virq)
+static inline enum virq_type arch_get_virq_type(unsigned int virq)
 {
-    return true;
+    return VIRQ_GLOBAL;
 }
 
 #endif /* ASM__RISCV__EVENT_H */
diff --git a/xen/arch/x86/include/asm/event.h b/xen/arch/x86/include/asm/event.h
index 5e09ede6d7..434f65007e 100644
--- a/xen/arch/x86/include/asm/event.h
+++ b/xen/arch/x86/include/asm/event.h
@@ -41,10 +41,10 @@ static inline void local_event_delivery_enable(void)
     vcpu_info(current, evtchn_upcall_mask) = 0;
 }
 
-/* No arch specific virq definition now. Default to global. */
-static inline bool arch_virq_is_global(unsigned int virq)
+/* Only global arch specific virq definitions. */
+static inline enum virq_type arch_get_virq_type(unsigned int virq)
 {
-    return true;
+    return VIRQ_GLOBAL;
 }
 
 #ifdef CONFIG_PV_SHIM
diff --git a/xen/common/argo.c b/xen/common/argo.c
index df19006744..cbe8911a43 100644
--- a/xen/common/argo.c
+++ b/xen/common/argo.c
@@ -440,7 +440,7 @@ signal_domain(struct domain *d)
 {
     argo_dprintk("signalling domid:%u\n", d->domain_id);
 
-    send_guest_global_virq(d, VIRQ_ARGO);
+    send_guest_domain_virq(d, VIRQ_ARGO);
 }
 
 static void
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index c68aa97135..c8c1bfa615 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -127,7 +127,7 @@ static struct domain *get_global_virq_handler(unsigned int virq)
     return global_virq_handlers[virq] ?: hardware_domain;
 }
 
-static bool virq_is_global(unsigned int virq)
+static enum virq_type get_virq_type(unsigned int virq)
 {
     switch ( virq )
     {
@@ -135,14 +135,17 @@ static bool virq_is_global(unsigned int virq)
     case VIRQ_DEBUG:
     case VIRQ_XENOPROF:
     case VIRQ_XENPMU:
-        return false;
+        return VIRQ_VCPU;
+
+    case VIRQ_ARGO:
+        return VIRQ_DOMAIN;
 
     case VIRQ_ARCH_0 ... VIRQ_ARCH_7:
-        return arch_virq_is_global(virq);
+        return arch_get_virq_type(virq);
     }
 
     ASSERT(virq < NR_VIRQS);
-    return true;
+    return VIRQ_GLOBAL;
 }
 
 static struct evtchn *_evtchn_from_port(const struct domain *d,
@@ -476,7 +479,7 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     struct domain *d = current->domain;
     int            virq = bind->virq, vcpu = bind->vcpu;
     int            rc = 0;
-    bool           is_global;
+    enum virq_type type;
 
     if ( (virq < 0) || (virq >= ARRAY_SIZE(v->virq_to_evtchn)) )
         return -EINVAL;
@@ -486,9 +489,9 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     * speculative execution.
     */
     virq = array_index_nospec(virq, ARRAY_SIZE(v->virq_to_evtchn));
-    is_global = virq_is_global(virq);
+    type = get_virq_type(virq);
 
-    if ( is_global && vcpu != 0 )
+    if ( type != VIRQ_VCPU && vcpu != 0 )
         return -EINVAL;
 
     if ( (v = domain_vcpu(d, vcpu)) == NULL )
@@ -496,7 +499,7 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
 
     write_lock(&d->event_lock);
 
-    if ( is_global && get_global_virq_handler(virq) != d )
+    if ( type == VIRQ_GLOBAL && get_global_virq_handler(virq) != d )
     {
         rc = -EBUSY;
         goto out;
@@ -756,7 +759,8 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
         if ( chn1->u.virq == VIRQ_DOM_EXC )
             domain_deinit_states(d1);
 
-        v = d1->vcpu[virq_is_global(chn1->u.virq) ? 0 : chn1->notify_vcpu_id];
+        v = d1->vcpu[get_virq_type(chn1->u.virq) != VIRQ_VCPU
+            ? 0 : chn1->notify_vcpu_id];
 
         write_lock_irqsave(&v->virq_lock, flags);
         ASSERT(read_atomic(&v->virq_to_evtchn[chn1->u.virq]) == port1);
@@ -900,7 +904,7 @@ bool evtchn_virq_enabled(const struct vcpu *v, unsigned int virq)
     if ( !v )
         return false;
 
-    if ( virq_is_global(virq) && v->vcpu_id )
+    if ( get_virq_type(virq) != VIRQ_VCPU && v->vcpu_id )
         v = domain_vcpu(v->domain, 0);
 
     return read_atomic(&v->virq_to_evtchn[virq]);
@@ -913,7 +917,7 @@ void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq)
     struct domain *d;
     struct evtchn *chn;
 
-    ASSERT(!virq_is_global(virq));
+    ASSERT(get_virq_type(virq) == VIRQ_VCPU);
 
     read_lock_irqsave(&v->virq_lock, flags);
 
@@ -933,14 +937,14 @@ void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq)
     read_unlock_irqrestore(&v->virq_lock, flags);
 }
 
-void send_guest_global_virq(struct domain *d, uint32_t virq)
+void send_guest_domain_virq(struct domain *d, uint32_t virq)
 {
     unsigned long flags;
     int port;
     struct vcpu *v;
     struct evtchn *chn;
 
-    ASSERT(virq_is_global(virq));
+    ASSERT(get_virq_type(virq) != VIRQ_VCPU);
 
     if ( unlikely(d == NULL) || unlikely(d->vcpu == NULL) )
         return;
@@ -995,9 +999,9 @@ static DEFINE_SPINLOCK(global_virq_handlers_lock);
 
 void send_global_virq(uint32_t virq)
 {
-    ASSERT(virq_is_global(virq));
+    ASSERT(get_virq_type(virq) == VIRQ_GLOBAL);
 
-    send_guest_global_virq(get_global_virq_handler(virq), virq);
+    send_guest_domain_virq(get_global_virq_handler(virq), virq);
 }
 
 int set_global_virq_handler(struct domain *d, uint32_t virq)
@@ -1008,7 +1012,7 @@ int set_global_virq_handler(struct domain *d, uint32_t virq)
 
     if (virq >= NR_VIRQS)
         return -EINVAL;
-    if (!virq_is_global(virq))
+    if (get_virq_type(virq) != VIRQ_GLOBAL)
         return -EINVAL;
 
     if (global_virq_handlers[virq] == d)
@@ -1204,7 +1208,7 @@ int evtchn_bind_vcpu(evtchn_port_t port, unsigned int vcpu_id)
     switch ( chn->state )
     {
     case ECS_VIRQ:
-        if ( virq_is_global(chn->u.virq) )
+        if ( get_virq_type(chn->u.virq) != VIRQ_VCPU )
             chn->notify_vcpu_id = v->vcpu_id;
         else
             rc = -EINVAL;
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index 5c0ba90c9f..930190054c 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -24,17 +24,17 @@
 void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq);
 
 /*
- * send_global_virq: Notify the domain handling a global VIRQ.
- *  @virq:     Virtual IRQ number (VIRQ_*)
+ * send_guest_domain_virq:
+ *  @d:        Domain to which VIRQ should be sent
+ *  @virq:     Virtual IRQ number (VIRQ_*), may not be per-vCPU
  */
-void send_global_virq(uint32_t virq);
+void send_guest_domain_virq(struct domain *d, uint32_t virq);
 
 /*
- * send_guest_global_virq:
- *  @d:        Domain to which VIRQ should be sent
- *  @virq:     Virtual IRQ number (VIRQ_*), must be global
+ * send_global_virq: Notify the domain handling a global VIRQ.
+ *  @virq:     Virtual IRQ number (VIRQ_*)
  */
-void send_guest_global_virq(struct domain *d, uint32_t virq);
+void send_global_virq(uint32_t virq);
 
 /*
  * sent_global_virq_handler: Set a global VIRQ handler.
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index ea63ca1c79..75add0f216 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -84,6 +84,12 @@ extern domid_t hardware_domid;
 #define XEN_CONSUMER_BITS 3
 #define NR_XEN_CONSUMERS ((1 << XEN_CONSUMER_BITS) - 1)
 
+enum virq_type {
+    VIRQ_GLOBAL,
+    VIRQ_DOMAIN,
+    VIRQ_VCPU,
+};
+
 struct evtchn
 {
     rwlock_t lock;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 13:22:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 13:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905037.1312798 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqXeY-0004wK-0x; Fri, 07 Mar 2025 13:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905037.1312798; Fri, 07 Mar 2025 13:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqXeX-0004wC-UO; Fri, 07 Mar 2025 13:22:13 +0000
Received: by outflank-mailman (input) for mailman id 905037;
 Fri, 07 Mar 2025 13:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqXeW-0004w4-Fq
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 13:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqXeW-006zGa-2F
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 13:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqXeW-00CXYk-1J
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 13:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8Xh+QhcEqgl+GieNvPF8dUmRl5ObK527AUrUXaVEbHU=; b=kJcEmlq8ur3WYFx9sjZb5Ymy4s
	51KkN9Se+OQ95mxy2V4dCx8r2LaDvCmmDRHAZRvjpWay7EyZMMMtCFL4lugLQFS5lRlKCuReBMAW4
	tIxAN7FH53piueXWOv/zcREZOBlbFJwm4m0UhxOpoUmMY1TBIUIgaPhIXsUHhT6EQMD4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/public: Fix documentation of VIRQs
Message-Id: <E1tqXeW-00CXYk-1J@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 13:22:12 +0000

commit 4d4725901e474fb3a61814e3c7bcb563cbdd857a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 7 11:34:04 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 13:11:30 2025 +0000

    xen/public: Fix documentation of VIRQs
    
    It has been discovered that VIRQ_ARGO is a 3rd type of VIRQ.  Also, recent
    work has prevented global VIRQs from being stolen from the owning domain.
    
    Rewrite the description of VIRQ classifications.  Drop the (DOM0) comment from
    the global VIRQs; it's not been true for a long time.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/event_channel.h |  8 ++++----
 xen/include/public/xen.h           | 37 +++++++++++++++++++++++--------------
 2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/xen/include/public/event_channel.h b/xen/include/public/event_channel.h
index 0d91a1c4af..c5548d206c 100644
--- a/xen/include/public/event_channel.h
+++ b/xen/include/public/event_channel.h
@@ -114,10 +114,10 @@ typedef struct evtchn_bind_interdomain evtchn_bind_interdomain_t;
  * EVTCHNOP_bind_virq: Bind a local event channel to VIRQ <irq> on specified
  * vcpu.
  * NOTES:
- *  1. Virtual IRQs are classified as per-vcpu or global. See the VIRQ list
- *     in xen.h for the classification of each VIRQ.
- *  2. Global VIRQs must be allocated on VCPU0 but can subsequently be
- *     re-bound via EVTCHNOP_bind_vcpu.
+ *  1. Virtual IRQs are classified as per-vcpu, per-domain or global. See the
+ *     VIRQ list in xen.h for the classification of each VIRQ.
+ *  2. Per-domain and global VIRQs must be allocated on vCPU0 but can
+ *     subsequently be re-bound via EVTCHNOP_bind_vcpu.
  *  3. Per-vcpu VIRQs may be bound to at most one event channel per vcpu.
  *     The allocated event channel is bound to the specified vcpu and the
  *     binding cannot be changed.
diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index e051f989a5..75b1c1d597 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -159,25 +159,34 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
  *
  * Virtual interrupts that a guest OS may receive from Xen.
  *
- * In the side comments, 'V.' denotes a per-VCPU VIRQ while 'G.' denotes a
- * global VIRQ. The former can be bound once per VCPU and cannot be re-bound.
- * The latter can be allocated only once per guest: they must initially be
- * allocated to VCPU0 but can subsequently be re-bound.
+ * There are three types:
+ *
+ * 1. (V) Per-vcpu:
+ *    These can be bound once per vCPU, each using a different evtchn port.
+ *    An evtchn for one vCPU cannot be rebound to a different vCPU.
+ *
+ * 2. (D) Per-domain:
+ *    These can be bound once per domain.  They must be bound on vCPU 0 first,
+ *    but can be rebound to other vCPUs afterwards.
+ *
+ * 3. (G) Global:
+ *    Like per-domain, but can only be bound to a single domain at a time.
+ *    The owning domain must unbind before a new domain can bind.
  */
 /* ` enum virq { */
 #define VIRQ_TIMER      0  /* V. Timebase update, and/or requested timeout.  */
 #define VIRQ_DEBUG      1  /* V. Request guest to dump debug info.           */
-#define VIRQ_CONSOLE    2  /* G. (DOM0) Bytes received on emergency console. */
-#define VIRQ_DOM_EXC    3  /* G. (DOM0) Exceptional event for some domain.   */
-#define VIRQ_TBUF       4  /* G. (DOM0) Trace buffer has records available.  */
-#define VIRQ_DEBUGGER   6  /* G. (DOM0) A domain has paused for debugging.   */
+#define VIRQ_CONSOLE    2  /* G. Bytes received on emergency console.        */
+#define VIRQ_DOM_EXC    3  /* G. Exceptional event for some domain.          */
+#define VIRQ_TBUF       4  /* G. Trace buffer has records available.         */
+#define VIRQ_DEBUGGER   6  /* G. A domain has paused for debugging.          */
 #define VIRQ_XENOPROF   7  /* V. XenOprofile interrupt: new sample available */
-#define VIRQ_CON_RING   8  /* G. (DOM0) Bytes received on console            */
-#define VIRQ_PCPU_STATE 9  /* G. (DOM0) PCPU state changed                   */
-#define VIRQ_MEM_EVENT  10 /* G. (DOM0) A memory event has occurred          */
-#define VIRQ_ARGO       11 /* G. Argo interdomain message notification       */
-#define VIRQ_ENOMEM     12 /* G. (DOM0) Low on heap memory       */
-#define VIRQ_XENPMU     13 /* V.  PMC interrupt                              */
+#define VIRQ_CON_RING   8  /* G. Bytes received on console                   */
+#define VIRQ_PCPU_STATE 9  /* G. PCPU state changed                          */
+#define VIRQ_MEM_EVENT  10 /* G. A memory event has occurred                 */
+#define VIRQ_ARGO       11 /* D. Argo interdomain message notification       */
+#define VIRQ_ENOMEM     12 /* G. Low on heap memory                          */
+#define VIRQ_XENPMU     13 /* V. PMC interrupt                               */
 
 /* Architecture-specific VIRQ definitions. */
 #define VIRQ_ARCH_0    16
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905083.1312822 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ6N-0005Bh-Od; Fri, 07 Mar 2025 14:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905083.1312822; Fri, 07 Mar 2025 14:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ6N-0005BZ-Lh; Fri, 07 Mar 2025 14:55:03 +0000
Received: by outflank-mailman (input) for mailman id 905083;
 Fri, 07 Mar 2025 14:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ6M-0005BT-M4
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ6M-0071B7-2R
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ6M-00CeK2-1X
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h3vr6khdf7a7b6G3/Rkg7NcWyl+++MRDChw1hemE3+M=; b=rh9c0xOQeAqjbc6wtsaKZemzMP
	0fmsEFQfMPCQiqA7tl1MrrWF564mqJaT0oxUTIX5RClulpuwTVLw2G84VE8apnkJRmdj6eYNO8KCM
	T13ye1aITy/+nUEAdKjTyYG+dVprdf2/okgCo8JlVB5Kiv3sXG08t97bZs+QsIVMzfmI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] EFI: Avoid crash calling PrintErrMesg() from efi_multiboot2()
Message-Id: <E1tqZ6M-00CeK2-1X@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:55:02 +0000

commit eaed0d185ab8b73cd18ac2830878520b3011f5ab
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Thu Mar 6 13:51:01 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:51:01 2025 +0100

    EFI: Avoid crash calling PrintErrMesg() from efi_multiboot2()
    
    Although code is compiled with -fpic option data is not position
    independent. This causes data pointer to become invalid if
    code is not relocated properly which is what happens for
    efi_multiboot2 which is called by multiboot entry code.
    
    Code tested adding
       PrintErrMesg(L"Test message", EFI_BUFFER_TOO_SMALL);
    in efi_multiboot2 before calling efi_arch_edd (this function
    can potentially call PrintErrMesg).
    
    Before the patch (XenServer installation on Qemu, xen replaced
    with vanilla xen.gz):
      Booting `XenServer (Serial)'Booting `XenServer (Serial)'
      Test message: !!!! X64 Exception Type - 0E(#PF - Page-Fault)  CPU Apic ID - 00000000 !!!!
      ExceptionData - 0000000000000000  I:0 R:0 U:0 W:0 P:0 PK:0 SS:0 SGX:0
      RIP  - 000000007EE21E9A, CS  - 0000000000000038, RFLAGS - 0000000000210246
      RAX  - 000000007FF0C1B5, RCX - 0000000000000050, RDX - 0000000000000010
      RBX  - 0000000000000000, RSP - 000000007FF0C180, RBP - 000000007FF0C210
      RSI  - FFFF82D040467CE8, RDI - 0000000000000000
      R8   - 000000007FF0C1C8, R9  - 000000007FF0C1C0, R10 - 0000000000000000
      R11  - 0000000000001020, R12 - FFFF82D040467CE8, R13 - 000000007FF0C1B8
      R14  - 000000007EA33328, R15 - 000000007EA332D8
      DS   - 0000000000000030, ES  - 0000000000000030, FS  - 0000000000000030
      GS   - 0000000000000030, SS  - 0000000000000030
      CR0  - 0000000080010033, CR2 - FFFF82D040467CE8, CR3 - 000000007FC01000
      CR4  - 0000000000000668, CR8 - 0000000000000000
      DR0  - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000
      DR3  - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400
      GDTR - 000000007F9DB000 0000000000000047, LDTR - 0000000000000000
      IDTR - 000000007F48E018 0000000000000FFF,   TR - 0000000000000000
      FXSAVE_STATE - 000000007FF0BDE0
      !!!! Find image based on IP(0x7EE21E9A) (No PDB)  (ImageBase=000000007EE20000, EntryPoint=000000007EE23935) !!!!
    
    After the patch:
      Booting `XenServer (Serial)'Booting `XenServer (Serial)'
      Test message: Buffer too small
      BdsDxe: loading Boot0000 "UiApp" from Fv(7CB8BDC9-F8EB-4F34-AAEA-3EE4AF6516A1)/FvFile(462CAA21-7614-4503-836E-8AB6F4662331)
      BdsDxe: starting Boot0000 "UiApp" from Fv(7CB8BDC9-F8EB-4F34-AAEA-3EE4AF6516A1)/FvFile(462CAA21-7614-4503-836E-8AB6F4662331)
    
    This partially rollback commit 00d5d5ce23e6.
    
    Fixes: 9180f5365524 ("x86: add multiboot2 protocol support for EFI platforms")
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/efi/boot.c        | 58 +++++++++++++++++++++++++++++---------------
 xen/common/efi/efi-common.mk |  1 +
 2 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index efbec00af9..143b5681ba 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -287,33 +287,53 @@ static bool __init match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2)
 /* generic routine for printing error messages */
 static void __init PrintErrMesg(const CHAR16 *mesg, EFI_STATUS ErrCode)
 {
-    static const CHAR16* const ErrCodeToStr[] __initconstrel = {
-        [~EFI_ERROR_MASK & EFI_NOT_FOUND]           = L"Not found",
-        [~EFI_ERROR_MASK & EFI_NO_MEDIA]            = L"The device has no media",
-        [~EFI_ERROR_MASK & EFI_MEDIA_CHANGED]       = L"Media changed",
-        [~EFI_ERROR_MASK & EFI_DEVICE_ERROR]        = L"Device error",
-        [~EFI_ERROR_MASK & EFI_VOLUME_CORRUPTED]    = L"Volume corrupted",
-        [~EFI_ERROR_MASK & EFI_ACCESS_DENIED]       = L"Access denied",
-        [~EFI_ERROR_MASK & EFI_OUT_OF_RESOURCES]    = L"Out of resources",
-        [~EFI_ERROR_MASK & EFI_VOLUME_FULL]         = L"Volume is full",
-        [~EFI_ERROR_MASK & EFI_SECURITY_VIOLATION]  = L"Security violation",
-        [~EFI_ERROR_MASK & EFI_CRC_ERROR]           = L"CRC error",
-        [~EFI_ERROR_MASK & EFI_COMPROMISED_DATA]    = L"Compromised data",
-        [~EFI_ERROR_MASK & EFI_BUFFER_TOO_SMALL]    = L"Buffer too small",
-    };
-    EFI_STATUS ErrIdx = ErrCode & ~EFI_ERROR_MASK;
-
     StdOut = StdErr;
     PrintErr(mesg);
     PrintErr(L": ");
 
-    if( (ErrIdx < ARRAY_SIZE(ErrCodeToStr)) && ErrCodeToStr[ErrIdx] )
-        mesg = ErrCodeToStr[ErrIdx];
-    else
+    switch (ErrCode)
     {
+    case EFI_NOT_FOUND:
+        mesg = L"Not found";
+        break;
+    case EFI_NO_MEDIA:
+        mesg = L"The device has no media";
+        break;
+    case EFI_MEDIA_CHANGED:
+        mesg = L"Media changed";
+        break;
+    case EFI_DEVICE_ERROR:
+        mesg = L"Device error";
+        break;
+    case EFI_VOLUME_CORRUPTED:
+        mesg = L"Volume corrupted";
+        break;
+    case EFI_ACCESS_DENIED:
+        mesg = L"Access denied";
+        break;
+    case EFI_OUT_OF_RESOURCES:
+        mesg = L"Out of resources";
+        break;
+    case EFI_VOLUME_FULL:
+        mesg = L"Volume is full";
+        break;
+    case EFI_SECURITY_VIOLATION:
+        mesg = L"Security violation";
+        break;
+    case EFI_CRC_ERROR:
+        mesg = L"CRC error";
+        break;
+    case EFI_COMPROMISED_DATA:
+        mesg = L"Compromised data";
+        break;
+    case EFI_BUFFER_TOO_SMALL:
+        mesg = L"Buffer too small";
+        break;
+    default:
         PrintErr(L"ErrCode: ");
         DisplayUint(ErrCode, 0);
         mesg = NULL;
+        break;
     }
     blexit(mesg);
 }
diff --git a/xen/common/efi/efi-common.mk b/xen/common/efi/efi-common.mk
index 23cafcf20c..06b1c19674 100644
--- a/xen/common/efi/efi-common.mk
+++ b/xen/common/efi/efi-common.mk
@@ -2,6 +2,7 @@ EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
 EFIOBJ-$(CONFIG_COMPAT) += compat.o
 
 CFLAGS-y += -fshort-wchar
+CFLAGS-y += -fno-jump-tables
 CFLAGS-y += -iquote $(srctree)/common/efi
 CFLAGS-y += -iquote $(srcdir)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905084.1312826 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ6X-0005DQ-Pl; Fri, 07 Mar 2025 14:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905084.1312826; Fri, 07 Mar 2025 14:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ6X-0005DG-N8; Fri, 07 Mar 2025 14:55:13 +0000
Received: by outflank-mailman (input) for mailman id 905084;
 Fri, 07 Mar 2025 14:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ6W-0005D5-Ku
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ6W-0071BB-2k
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ6W-00CeL0-1r
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=B5GH/EPqICgU9tSPxWl4ZW1aEb9jMZEAzqiaf68gPIQ=; b=QGAPuo8p1QzKckz/CI0Zde9iyM
	/urUOIMd48ad+7X2AKYLi0LQGKyFv9Rc6JNS47ilackBuQpoCdl7gKdgOP/+tO35c5z6uAjjn5/Xw
	KHpJtxSIlJO3MNORH4xSo0B1HmqtwvxnIFwKie16XgmlXyKE9XfMmulcscX437Levh1U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/events: don't allow binding a global virq from any domain
Message-Id: <E1tqZ6W-00CeL0-1r@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:55:12 +0000

commit eba922abdb8595846ce3b9cb22c8e4233ce16932
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 13:51:35 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:51:35 2025 +0100

    xen/events: don't allow binding a global virq from any domain
    
    Today Xen will happily allow binding a global virq by a domain which
    isn't configured to receive it. This won't result in any bad actions,
    but the bind will appear to have succeeded with no event ever being
    received by that event channel.
    
    Instead of allowing the bind, error out if the domain isn't set to
    handle that virq. Note that this check is inside the write_lock() on
    purpose, as a future patch will put a related check into
    set_global_virq_handler() with the addition of using the same lock.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/event_channel.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 46281b16ce..cd6f5a1211 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -120,6 +120,13 @@ static uint8_t get_xen_consumer(xen_event_channel_notification_t fn)
 /* Get the notification function for a given Xen-bound event channel. */
 #define xen_notification_fn(e) (xen_consumers[(e)->xen_consumer-1])
 
+static struct domain *__read_mostly global_virq_handlers[NR_VIRQS];
+
+static struct domain *get_global_virq_handler(unsigned int virq)
+{
+    return global_virq_handlers[virq] ?: hardware_domain;
+}
+
 static bool virq_is_global(unsigned int virq)
 {
     switch ( virq )
@@ -469,6 +476,7 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     struct domain *d = current->domain;
     int            virq = bind->virq, vcpu = bind->vcpu;
     int            rc = 0;
+    bool           is_global;
 
     if ( (virq < 0) || (virq >= ARRAY_SIZE(v->virq_to_evtchn)) )
         return -EINVAL;
@@ -478,8 +486,9 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     * speculative execution.
     */
     virq = array_index_nospec(virq, ARRAY_SIZE(v->virq_to_evtchn));
+    is_global = virq_is_global(virq);
 
-    if ( virq_is_global(virq) && (vcpu != 0) )
+    if ( is_global && vcpu != 0 )
         return -EINVAL;
 
     if ( (v = domain_vcpu(d, vcpu)) == NULL )
@@ -487,6 +496,12 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
 
     write_lock(&d->event_lock);
 
+    if ( is_global && get_global_virq_handler(virq) != d )
+    {
+        rc = -EBUSY;
+        goto out;
+    }
+
     if ( read_atomic(&v->virq_to_evtchn[virq]) )
     {
         rc = -EEXIST;
@@ -965,15 +980,13 @@ void send_guest_pirq(struct domain *d, const struct pirq *pirq)
     }
 }
 
-static struct domain *global_virq_handlers[NR_VIRQS] __read_mostly;
-
 static DEFINE_SPINLOCK(global_virq_handlers_lock);
 
 void send_global_virq(uint32_t virq)
 {
     ASSERT(virq_is_global(virq));
 
-    send_guest_global_virq(global_virq_handlers[virq] ?: hardware_domain, virq);
+    send_guest_global_virq(get_global_virq_handler(virq), virq);
 }
 
 int set_global_virq_handler(struct domain *d, uint32_t virq)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905085.1312831 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ6h-0005Gm-Tj; Fri, 07 Mar 2025 14:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905085.1312831; Fri, 07 Mar 2025 14:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ6h-0005Ge-Pw; Fri, 07 Mar 2025 14:55:23 +0000
Received: by outflank-mailman (input) for mailman id 905085;
 Fri, 07 Mar 2025 14:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ6g-0005GU-Of
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ6g-0071Ba-37
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ6g-00CeLj-2B
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GTa0zT02AxrILaP0Tmlzob5F7SGqqMWMn6Rl7xOGuoQ=; b=NbcwD09Z9qR4rvYcBfocccSIP4
	1q0mqAu6sPfOeGlL5V0DSYNrPbuOFZfom40Bkp+XO4yWOfhVV6tgEhLZdvPtIoAZ1WjX5d4Fbv0Uv
	1oBCT1iU7keG2xM/gJB5pXmkHp/nak7XO+Pt/5X1hCc561n/6uD/k5pwC7V/P2z1oyk4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/events: allow setting of global virq handler only for unbound virqs
Message-Id: <E1tqZ6g-00CeLj-2B@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:55:22 +0000

commit 980822c5edd122ecb21080079f5ed801fef30f51
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 13:51:55 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:51:55 2025 +0100

    xen/events: allow setting of global virq handler only for unbound virqs
    
    XEN_DOMCTL_set_virq_handler will happily steal a global virq from the
    current domain having bound it and assign it to another domain. The
    former domain will just never receive any further events for that
    virq without knowing what happened.
    
    Change the behavior to allow XEN_DOMCTL_set_virq_handler only if the
    virq in question is not bound by the current domain allowed to use it.
    
    Currently the only user of XEN_DOMCTL_set_virq_handler in the Xen code
    base is init-xenstore-domain, so changing the behavior like above will
    not cause any problems.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/event_channel.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index cd6f5a1211..4dba59efa2 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -991,7 +991,8 @@ void send_global_virq(uint32_t virq)
 
 int set_global_virq_handler(struct domain *d, uint32_t virq)
 {
-    struct domain *old;
+    struct domain *old, *hdl;
+    const struct vcpu *v;
     int rc = 0;
 
     if (virq >= NR_VIRQS)
@@ -1023,7 +1024,22 @@ int set_global_virq_handler(struct domain *d, uint32_t virq)
     else
     {
         old = global_virq_handlers[virq];
-        global_virq_handlers[virq] = d;
+        hdl = get_global_virq_handler(virq);
+        if ( hdl != d )
+        {
+            read_lock(&hdl->event_lock);
+
+            v = hdl->vcpu[0];
+            if ( v && read_atomic(&v->virq_to_evtchn[virq]) )
+            {
+                rc = -EBUSY;
+                old = d;
+            }
+            else
+                global_virq_handlers[virq] = d;
+
+            read_unlock(&hdl->event_lock);
+        }
     }
 
     spin_unlock(&global_virq_handlers_lock);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905086.1312833 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ6r-0005JL-U1; Fri, 07 Mar 2025 14:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905086.1312833; Fri, 07 Mar 2025 14:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ6r-0005JD-RN; Fri, 07 Mar 2025 14:55:33 +0000
Received: by outflank-mailman (input) for mailman id 905086;
 Fri, 07 Mar 2025 14:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ6q-0005J7-SW
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ6r-0071Be-0H
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ6q-00CeVA-2Z
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p6ArnTSyokzyAWPqsmWeLebttQdKbNvUh/pHgLzThs0=; b=w2D8I+196B4d+XBHRp1NCOijiN
	QYhrJH0d47+CkJNq0ShOcnT+TOoQrHUE2hIkXkDovty1BfuFPt+rm2f9KAAELguNKRHA/EW+hqauq
	ReFsQy2WnUsg4vRHhpS4kO61na7aknViYICleRV+bbfxG0d9E1TKTO7R9csln06dlq4E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: add bitmap to indicate per-domain state changes
Message-Id: <E1tqZ6q-00CeVA-2Z@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:55:32 +0000

commit f94360a7fe9b98728c25b0a5eba76dcb16c6aa24
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 13:52:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:52:14 2025 +0100

    xen: add bitmap to indicate per-domain state changes
    
    Add a bitmap with one bit per possible domid indicating the respective
    domain has changed its state (created, deleted, dying, crashed,
    shutdown).
    
    Registering the VIRQ_DOM_EXC event will result in setting the bits for
    all existing domains and resetting all other bits.
    
    As the usage of this bitmap is tightly coupled with the VIRQ_DOM_EXC
    event, it is meant to be used only by a single consumer in the system,
    just like the VIRQ_DOM_EXC event.
    
    Resetting a bit will be done in a future patch.
    
    This information is needed for Xenstore to keep track of all domains.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/domain.c        | 51 ++++++++++++++++++++++++++++++++++++++++++++++
 xen/common/event_channel.c | 31 ++++++++++++++++++++++++++++
 xen/include/xen/event.h    |  4 ++++
 xen/include/xen/sched.h    |  3 +++
 4 files changed, 89 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 0c4cc77111..1c1d6da885 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -35,6 +35,7 @@
 #include <xen/irq.h>
 #include <xen/argo.h>
 #include <xen/llc-coloring.h>
+#include <xen/xvmalloc.h>
 #include <asm/p2m.h>
 #include <asm/processor.h>
 #include <public/sched.h>
@@ -139,6 +140,51 @@ bool __read_mostly vmtrace_available;
 
 bool __read_mostly vpmu_is_available;
 
+static unsigned long *__read_mostly dom_state_changed;
+
+int domain_init_states(void)
+{
+    const struct domain *d;
+
+    ASSERT(!dom_state_changed);
+    ASSERT(rw_is_write_locked_by_me(&current->domain->event_lock));
+
+    dom_state_changed = xvzalloc_array(unsigned long,
+                                       BITS_TO_LONGS(DOMID_FIRST_RESERVED));
+    if ( !dom_state_changed )
+        return -ENOMEM;
+
+    rcu_read_lock(&domlist_read_lock);
+
+    for_each_domain ( d )
+        __set_bit(d->domain_id, dom_state_changed);
+
+    rcu_read_unlock(&domlist_read_lock);
+
+    return 0;
+}
+
+void domain_deinit_states(const struct domain *d)
+{
+    ASSERT(rw_is_write_locked_by_me(&d->event_lock));
+
+    XVFREE(dom_state_changed);
+}
+
+static void domain_changed_state(const struct domain *d)
+{
+    struct domain *hdl;
+
+    hdl = lock_dom_exc_handler();
+    if ( unlikely(!hdl) )
+        return;
+
+    if ( dom_state_changed )
+        set_bit(d->domain_id, dom_state_changed);
+
+    unlock_dom_exc_handler(hdl);
+}
+
 static void __domain_finalise_shutdown(struct domain *d)
 {
     struct vcpu *v;
@@ -153,6 +199,7 @@ static void __domain_finalise_shutdown(struct domain *d)
             return;
 
     d->is_shut_down = 1;
+    domain_changed_state(d);
     if ( (d->shutdown_code == SHUTDOWN_suspend) && d->suspend_evtchn )
         evtchn_send(d, d->suspend_evtchn);
     else
@@ -840,6 +887,7 @@ struct domain *domain_create(domid_t domid,
      */
     domlist_insert(d);
 
+    domain_changed_state(d);
     memcpy(d->handle, config->handle, sizeof(d->handle));
 
     return d;
@@ -1105,6 +1153,7 @@ int domain_kill(struct domain *d)
         /* Mem event cleanup has to go here because the rings 
          * have to be put before we call put_domain. */
         vm_event_cleanup(d);
+        domain_changed_state(d);
         put_domain(d);
         send_global_virq(VIRQ_DOM_EXC);
         /* fallthrough */
@@ -1294,6 +1343,8 @@ static void cf_check complete_domain_destroy(struct rcu_head *head)
 
     xfree(d->vcpu);
 
+    domain_changed_state(d);
+
     _domain_destroy(d);
 
     send_global_virq(VIRQ_DOM_EXC);
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 4dba59efa2..4ee6b6b4ce 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -509,10 +509,18 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
         goto out;
     }
 
+    if ( virq == VIRQ_DOM_EXC )
+    {
+        rc = domain_init_states();
+        if ( rc )
+            goto out;
+    }
+
     port = rc = evtchn_get_port(d, port);
     if ( rc < 0 )
     {
         gdprintk(XENLOG_WARNING, "EVTCHNOP failure: error %d\n", rc);
+        domain_deinit_states(d);
         goto out;
     }
 
@@ -745,6 +753,9 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
         struct vcpu *v;
         unsigned long flags;
 
+        if ( chn1->u.virq == VIRQ_DOM_EXC )
+            domain_deinit_states(d1);
+
         v = d1->vcpu[virq_is_global(chn1->u.virq) ? 0 : chn1->notify_vcpu_id];
 
         write_lock_irqsave(&v->virq_lock, flags);
@@ -1075,6 +1086,26 @@ static void clear_global_virq_handlers(struct domain *d)
     }
 }
 
+struct domain *lock_dom_exc_handler(void)
+{
+    struct domain *d;
+
+    d = get_global_virq_handler(VIRQ_DOM_EXC);
+    if ( unlikely(!get_domain(d)) )
+        return NULL;
+
+    read_lock(&d->event_lock);
+
+    return d;
+}
+
+void unlock_dom_exc_handler(struct domain *d)
+{
+    read_unlock(&d->event_lock);
+
+    put_domain(d);
+}
+
 int evtchn_status(evtchn_status_t *status)
 {
     struct domain   *d;
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index 48b79f3d62..5c0ba90c9f 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -100,6 +100,10 @@ bool evtchn_virq_enabled(const struct vcpu *v, unsigned int virq);
 /* Notify remote end of a Xen-attached event channel.*/
 void notify_via_xen_event_channel(struct domain *ld, int lport);
 
+/* Lock/unlock of VIRQ_DOM_EXC associated data (read_lock(d->event_lock)). */
+struct domain *lock_dom_exc_handler(void);
+void unlock_dom_exc_handler(struct domain *d);
+
 /*
  * Internal event channel object storage.
  *
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 037c83fda2..9d9b89ec27 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -805,6 +805,9 @@ void domain_resume(struct domain *d);
 
 int domain_soft_reset(struct domain *d, bool resuming);
 
+int domain_init_states(void);
+void domain_deinit_states(const struct domain *d);
+
 int vcpu_start_shutdown_deferral(struct vcpu *v);
 void vcpu_end_shutdown_deferral(struct vcpu *v);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:55:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905087.1312838 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ71-0005Lb-Vj; Fri, 07 Mar 2025 14:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905087.1312838; Fri, 07 Mar 2025 14:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ71-0005LT-Sv; Fri, 07 Mar 2025 14:55:43 +0000
Received: by outflank-mailman (input) for mailman id 905087;
 Fri, 07 Mar 2025 14:55:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ71-0005LN-0C
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:55:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ71-0071Bk-0e
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ70-00CeWR-2z
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hTthhpczUeR/7WiBVyFCmtPlHETUFoLZ2yREJ+TK+7I=; b=PWIlytahRKq61h3/AWtB2cDOew
	UWuj9K/bttrTiGp8asSDqpbzGL+hin5cQZ/8QU6spnt/bH56uFIsnOm2ya6EACfWAqFyf+6zIzU9z
	zSg/FJQrrNQXW5n0DEG/UPLORevWfld6C5NREHmoEwouH4TzXlGMCRSZ02CzLpywdj2o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: add new domctl get_domain_state
Message-Id: <E1tqZ70-00CeWR-2z@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:55:42 +0000

commit 3ad3df1bd0aabae628e031fbac2a2bfbb45b09ba
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 13:52:38 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:52:38 2025 +0100

    xen: add new domctl get_domain_state
    
    Add a new domctl sub-function to get data of a domain having changed
    state (this is needed by Xenstore).
    
    The returned state just contains the domid, the domain unique id,
    and some flags (existing, shutdown, dying).
    
    In order to enable Xenstore stubdom being built for multiple Xen
    versions, make this domctl stable.  For stable domctls the
    interface_version is always 0.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/flask/policy/modules/dom0.te     |  1 +
 tools/flask/policy/modules/xen.if      |  5 ++-
 tools/flask/policy/modules/xenstore.te |  1 +
 xen/common/domain.c                    | 74 ++++++++++++++++++++++++++++++++++
 xen/common/domctl.c                    | 18 ++++++++-
 xen/include/public/domctl.h            | 26 ++++++++++++
 xen/include/xen/sched.h                |  2 +
 xen/include/xsm/dummy.h                |  8 ++++
 xen/include/xsm/xsm.h                  |  6 +++
 xen/xsm/dummy.c                        |  1 +
 xen/xsm/flask/hooks.c                  |  7 ++++
 xen/xsm/flask/policy/access_vectors    |  2 +
 12 files changed, 148 insertions(+), 3 deletions(-)

diff --git a/tools/flask/policy/modules/dom0.te b/tools/flask/policy/modules/dom0.te
index f148bfbf27..ccadbd6469 100644
--- a/tools/flask/policy/modules/dom0.te
+++ b/tools/flask/policy/modules/dom0.te
@@ -41,6 +41,7 @@ allow dom0_t dom0_t:domain {
 allow dom0_t dom0_t:domain2 {
 	set_cpu_policy gettsc settsc setscheduler set_vnumainfo
 	get_vnumainfo psr_cmt_op psr_alloc get_cpu_policy dt_overlay
+	get_domain_state
 };
 allow dom0_t dom0_t:resource { add remove };
 
diff --git a/tools/flask/policy/modules/xen.if b/tools/flask/policy/modules/xen.if
index f7cf7c43c8..cff51febbf 100644
--- a/tools/flask/policy/modules/xen.if
+++ b/tools/flask/policy/modules/xen.if
@@ -54,7 +54,8 @@ define(`create_domain_common', `
 	allow $1 $2:domain2 { set_cpu_policy settsc setscheduler setclaim
 			set_vnumainfo get_vnumainfo cacheflush
 			psr_cmt_op psr_alloc soft_reset
-			resource_map get_cpu_policy vuart_op set_llc_colors };
+			resource_map get_cpu_policy vuart_op set_llc_colors
+			get_domain_state };
 	allow $1 $2:security check_context;
 	allow $1 $2:shadow enable;
 	allow $1 $2:mmu { map_read map_write adjust memorymap physmap pinpage mmuext_op updatemp };
@@ -94,7 +95,7 @@ define(`manage_domain', `
 			getaddrsize pause unpause trigger shutdown destroy
 			setaffinity setdomainmaxmem getscheduler resume
 			setpodtarget getpodtarget getpagingmempool setpagingmempool };
-    allow $1 $2:domain2 { set_vnumainfo dt_overlay };
+    allow $1 $2:domain2 { set_vnumainfo dt_overlay get_domain_state };
 ')
 
 # migrate_domain_out(priv, target)
diff --git a/tools/flask/policy/modules/xenstore.te b/tools/flask/policy/modules/xenstore.te
index 519566ab81..49de53ebe2 100644
--- a/tools/flask/policy/modules/xenstore.te
+++ b/tools/flask/policy/modules/xenstore.te
@@ -13,6 +13,7 @@ allow dom0_t xenstore_t:domain set_virq_handler;
 allow xenstore_t xen_t:xen writeconsole;
 # Xenstore queries domaininfo on all domains
 allow xenstore_t domain_type:domain getdomaininfo;
+allow xenstore_t domain_type:domain2 get_domain_state;
 
 # As a shortcut, the following 3 rules are used instead of adding a domain_comms
 # rule between xenstore_t and every domain type that talks to xenstore
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 1c1d6da885..b887c60ecc 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -185,6 +185,80 @@ static void domain_changed_state(const struct domain *d)
     unlock_dom_exc_handler(hdl);
 }
 
+static void set_domain_state_info(struct xen_domctl_get_domain_state *info,
+                                  const struct domain *d)
+{
+    info->state = XEN_DOMCTL_GETDOMSTATE_STATE_EXIST;
+    if ( d->is_shut_down )
+        info->state |= XEN_DOMCTL_GETDOMSTATE_STATE_SHUTDOWN;
+    if ( d->is_dying == DOMDYING_dying )
+        info->state |= XEN_DOMCTL_GETDOMSTATE_STATE_DYING;
+    if ( d->is_dying == DOMDYING_dead )
+        info->state |= XEN_DOMCTL_GETDOMSTATE_STATE_DEAD;
+    info->unique_id = d->unique_id;
+}
+
+int get_domain_state(struct xen_domctl_get_domain_state *info, struct domain *d,
+                     domid_t *domid)
+{
+    unsigned int dom;
+    int rc = -ENOENT;
+    struct domain *hdl;
+
+    if ( info->pad0 || info->pad1 )
+        return -EINVAL;
+
+    if ( d )
+    {
+        set_domain_state_info(info, d);
+
+        return 0;
+    }
+
+    hdl = lock_dom_exc_handler();
+
+    /*
+     * Only domain registered for VIRQ_DOM_EXC event is allowed to query
+     * domains having changed state.
+     */
+    if ( current->domain != hdl )
+    {
+        rc = -EACCES;
+        goto out;
+    }
+
+    while ( dom_state_changed )
+    {
+        dom = find_first_bit(dom_state_changed, DOMID_MASK + 1);
+        if ( dom >= DOMID_FIRST_RESERVED )
+            break;
+        if ( test_and_clear_bit(dom, dom_state_changed) )
+        {
+            *domid = dom;
+
+            d = rcu_lock_domain_by_id(dom);
+
+            if ( d )
+            {
+                set_domain_state_info(info, d);
+
+                rcu_unlock_domain(d);
+            }
+            else
+                memset(info, 0, sizeof(*info));
+
+            rc = 0;
+
+            break;
+        }
+    }
+
+ out:
+    unlock_dom_exc_handler(hdl);
+
+    return rc;
+}
+
 static void __domain_finalise_shutdown(struct domain *d)
 {
     struct vcpu *v;
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 05abb581a0..b897ca8723 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -279,6 +279,11 @@ static struct vnuma_info *vnuma_init(const struct xen_domctl_vnuma *uinfo,
     return ERR_PTR(ret);
 }
 
+static bool is_stable_domctl(uint32_t cmd)
+{
+    return cmd == XEN_DOMCTL_get_domain_state;
+}
+
 long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
 {
     long ret = 0;
@@ -289,7 +294,8 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
     if ( copy_from_guest(op, u_domctl, 1) )
         return -EFAULT;
 
-    if ( op->interface_version != XEN_DOMCTL_INTERFACE_VERSION )
+    if ( op->interface_version !=
+         (is_stable_domctl(op->cmd) ? 0 : XEN_DOMCTL_INTERFACE_VERSION) )
         return -EACCES;
 
     switch ( op->cmd )
@@ -310,6 +316,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         fallthrough;
     case XEN_DOMCTL_test_assign_device:
     case XEN_DOMCTL_vm_event_op:
+    case XEN_DOMCTL_get_domain_state:
         if ( op->domain == DOMID_INVALID )
         {
             d = NULL;
@@ -876,6 +883,15 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             ret = -EOPNOTSUPP;
         break;
 
+    case XEN_DOMCTL_get_domain_state:
+        ret = xsm_get_domain_state(XSM_XS_PRIV, d);
+        if ( ret )
+            break;
+
+        copyback = 1;
+        ret = get_domain_state(&op->u.get_domain_state, d, &op->domain);
+        break;
+
     default:
         ret = arch_do_domctl(op, d, u_domctl);
         break;
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index e2d392d1e5..5b2063eed9 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -28,6 +28,7 @@
  * Pure additions (e.g. new sub-commands) or compatible interface changes
  * (e.g. adding semantics to 0-checked input fields or data to zeroed output
  * fields) don't require a change of the version.
+ * Stable ops are NOT covered by XEN_DOMCTL_INTERFACE_VERSION!
  *
  * Last version bump: Xen 4.19
  */
@@ -1243,7 +1244,30 @@ struct xen_domctl_set_llc_colors {
     XEN_GUEST_HANDLE_64(uint32) llc_colors;
 };
 
+/*
+ * XEN_DOMCTL_get_domain_state (stable interface)
+ *
+ * Get state information of a domain.
+ *
+ * In case domain is DOMID_INVALID, return information about a domain having
+ * changed state and reset the state change indicator for that domain. This
+ * function is usable only by a domain having registered the VIRQ_DOM_EXC
+ * event (normally Xenstore).
+ * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
+ */
+struct xen_domctl_get_domain_state {
+    uint16_t state;
+#define XEN_DOMCTL_GETDOMSTATE_STATE_EXIST     0x0001  /* Domain is existing. */
+#define XEN_DOMCTL_GETDOMSTATE_STATE_SHUTDOWN  0x0002  /* Shutdown finished. */
+#define XEN_DOMCTL_GETDOMSTATE_STATE_DYING     0x0004  /* Domain dying. */
+#define XEN_DOMCTL_GETDOMSTATE_STATE_DEAD      0x0008  /* Domain dead. */
+    uint16_t pad0;           /* Must be 0 on input, returned as 0. */
+    uint32_t pad1;           /* Must be 0 on input, returned as 0. */
+    uint64_t unique_id;      /* Unique domain identifier. */
+};
+
 struct xen_domctl {
+/* Stable domctl ops: interface_version is required to be 0.  */
     uint32_t cmd;
 #define XEN_DOMCTL_createdomain                   1
 #define XEN_DOMCTL_destroydomain                  2
@@ -1333,6 +1357,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_dt_overlay                    87
 #define XEN_DOMCTL_gsi_permission                88
 #define XEN_DOMCTL_set_llc_colors                89
+#define XEN_DOMCTL_get_domain_state              90 /* stable interface */
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -1400,6 +1425,7 @@ struct xen_domctl {
         struct xen_domctl_dt_overlay        dt_overlay;
 #endif
         struct xen_domctl_set_llc_colors    set_llc_colors;
+        struct xen_domctl_get_domain_state  get_domain_state;
         uint8_t                             pad[128];
     } u;
 };
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 9d9b89ec27..ea63ca1c79 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -807,6 +807,8 @@ int domain_soft_reset(struct domain *d, bool resuming);
 
 int domain_init_states(void);
 void domain_deinit_states(const struct domain *d);
+int get_domain_state(struct xen_domctl_get_domain_state *info,
+                     struct domain *d, domid_t *domid);
 
 int vcpu_start_shutdown_deferral(struct vcpu *v);
 void vcpu_end_shutdown_deferral(struct vcpu *v);
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 6a2fc33c3b..a8d06de6b0 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -173,6 +173,7 @@ static XSM_INLINE int cf_check xsm_domctl(
     case XEN_DOMCTL_unbind_pt_irq:
         return xsm_default_action(XSM_DM_PRIV, current->domain, d);
     case XEN_DOMCTL_getdomaininfo:
+    case XEN_DOMCTL_get_domain_state:
         return xsm_default_action(XSM_XS_PRIV, current->domain, d);
     default:
         return xsm_default_action(XSM_PRIV, current->domain, d);
@@ -815,6 +816,13 @@ static XSM_INLINE int cf_check xsm_argo_send(
 
 #endif /* CONFIG_ARGO */
 
+static XSM_INLINE int cf_check xsm_get_domain_state(
+    XSM_DEFAULT_ARG struct domain *d)
+{
+    XSM_ASSERT_ACTION(XSM_XS_PRIV);
+    return xsm_default_action(action, current->domain, d);
+}
+
 #include <public/version.h>
 static XSM_INLINE int cf_check xsm_xen_version(XSM_DEFAULT_ARG uint32_t op)
 {
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 4dbff9d866..0689bf5c9f 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -200,6 +200,7 @@ struct xsm_ops {
     int (*argo_register_any_source)(const struct domain *d);
     int (*argo_send)(const struct domain *d, const struct domain *t);
 #endif
+    int (*get_domain_state)(struct domain *d);
 };
 
 #ifdef CONFIG_XSM
@@ -774,6 +775,11 @@ static inline int xsm_argo_send(const struct domain *d, const struct domain *t)
 
 #endif /* CONFIG_ARGO */
 
+static inline int xsm_get_domain_state(struct domain *d)
+{
+    return alternative_call(xsm_ops.get_domain_state, d);
+}
+
 #endif /* XSM_NO_WRAPPERS */
 
 #ifdef CONFIG_MULTIBOOT
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index e6ffa948f7..ce6fbdc6c5 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -148,6 +148,7 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
     .argo_register_any_source      = xsm_argo_register_any_source,
     .argo_send                     = xsm_argo_send,
 #endif
+    .get_domain_state              = xsm_get_domain_state,
 };
 
 void __init xsm_fixup_ops(struct xsm_ops *ops)
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 14d84df9ca..389707a164 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -688,6 +688,7 @@ static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
     case XEN_DOMCTL_memory_mapping:
     case XEN_DOMCTL_set_target:
     case XEN_DOMCTL_vm_event_op:
+    case XEN_DOMCTL_get_domain_state:
 
     /* These have individual XSM hooks (arch/../domctl.c) */
     case XEN_DOMCTL_bind_pt_irq:
@@ -1869,6 +1870,11 @@ static int cf_check flask_argo_send(
 
 #endif
 
+static int cf_check flask_get_domain_state(struct domain *d)
+{
+    return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__GET_DOMAIN_STATE);
+}
+
 static const struct xsm_ops __initconst_cf_clobber flask_ops = {
     .set_system_active = flask_set_system_active,
     .security_domaininfo = flask_security_domaininfo,
@@ -2005,6 +2011,7 @@ static const struct xsm_ops __initconst_cf_clobber flask_ops = {
     .argo_register_any_source = flask_argo_register_any_source,
     .argo_send = flask_argo_send,
 #endif
+    .get_domain_state = flask_get_domain_state,
 };
 
 const struct xsm_ops *__init flask_init(
diff --git a/xen/xsm/flask/policy/access_vectors b/xen/xsm/flask/policy/access_vectors
index 320d77706d..51a1577a66 100644
--- a/xen/xsm/flask/policy/access_vectors
+++ b/xen/xsm/flask/policy/access_vectors
@@ -257,6 +257,8 @@ class domain2
     dt_overlay
 # XEN_DOMCTL_set_llc_colors
     set_llc_colors
+# XEN_DOMCTL_get_domain_state
+    get_domain_state
 }
 
 # Similar to class domain, but primarily contains domctls related to HVM domains
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:55:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905088.1312841 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ7C-0005O6-0o; Fri, 07 Mar 2025 14:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905088.1312841; Fri, 07 Mar 2025 14:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ7B-0005Ny-UM; Fri, 07 Mar 2025 14:55:53 +0000
Received: by outflank-mailman (input) for mailman id 905088;
 Fri, 07 Mar 2025 14:55:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ7B-0005Nl-3e
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:55:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ7B-0071Bo-0z
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ7B-00CeXE-05
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:55:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IhUdw9mhz7N2Ahn4q89CGXNNkLMc/5xj4qMzAUWCvuw=; b=W7FVwZCH44PUMET5BevNu6yT4Z
	Y/gbPxoJriHNVXMC3O7S/NrFhdq9855h6MCS4X9z50ETX53cx6uGl5ygZCiirqVanOyQbPpzgFnd7
	uMcbjSgoRSestL1wMjXUJzQclIdqx58ADgtynAyAiq+YS5XrQ8BavTulCEOqBFIrkiL8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs: add a new libxenmanage library
Message-Id: <E1tqZ7B-00CeXE-05@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:55:53 +0000

commit e995055d6993cda88780a7bf0037243cda34874e
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 13:53:56 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:53:56 2025 +0100

    tools/libs: add a new libxenmanage library
    
    In order to have a stable interface in user land for using stable
    domctl and possibly later sysctl interfaces, add a new library
    libxenmanage.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xenmanage.h          |  92 ++++++++++++++++++++
 tools/libs/Makefile                |   1 +
 tools/libs/manage/Makefile         |  10 +++
 tools/libs/manage/Makefile.common  |   3 +
 tools/libs/manage/core.c           | 168 +++++++++++++++++++++++++++++++++++++
 tools/libs/manage/libxenmanage.map |   8 ++
 tools/libs/uselibs.mk              |   2 +
 7 files changed, 284 insertions(+)

diff --git a/tools/include/xenmanage.h b/tools/include/xenmanage.h
new file mode 100644
index 0000000000..956b7a0a44
--- /dev/null
+++ b/tools/include/xenmanage.h
@@ -0,0 +1,92 @@
+/* SPDX-License-Identifier: LGPL-2.1-only */
+/*
+ * Copyright (c) 2024 SUSE Software Solutions Germany GmbH
+ *
+ * Interfaces of libxenmanage.
+ *
+ * libxenmanage provides management functions for the host using stable
+ * hypercall interfaces.
+ */
+#ifndef XENMANAGE_H
+#define XENMANAGE_H
+
+#include <stdint.h>
+
+/* Avoid the need to #include <xentoollog.h> */
+struct xentoollog_logger;
+
+typedef struct xenmanage_handle xenmanage_handle;
+
+/*
+ * Open libxenmanage.
+ *
+ * Get a handle of the xenmanage library. The handle is required for all
+ * further operations of the library.
+ * Parameters:
+ *   logger:     Logging function to use. If NULL logging is done to stderr.
+ *   open_flags: Only 0 supported.
+ * Return value: Handle or NULL if error.
+ */
+xenmanage_handle *xenmanage_open(struct xentoollog_logger *logger,
+                                 unsigned int open_flags);
+
+/*
+ * Close libxenmanage.
+ *
+ * Return a handle of the xenmanage library.
+ * Parameters:
+ *    hdl: Handle obtained by xenmanage_open().
+ * Return value: always 0.
+ */
+int xenmanage_close(xenmanage_handle *hdl);
+
+#define XENMANAGE_GETDOMSTATE_STATE_EXIST     0x0001  /* Domain is existing. */
+#define XENMANAGE_GETDOMSTATE_STATE_SHUTDOWN  0x0002  /* Shutdown finished. */
+#define XENMANAGE_GETDOMSTATE_STATE_DYING     0x0004  /* Domain dying. */
+#define XENMANAGE_GETDOMSTATE_STATE_DEAD      0x0008  /* Domain dead. */
+
+/*
+ * Return state information of an existing domain.
+ *
+ * Returns the domain state and unique id of the given domain.
+ * Parameters:
+ *   hdl:       handle returned by xenmanage_open()
+ *   domid:     domain id of the domain to get the information for
+ *   state:     where to store the state (XENMANAGE_GETDOMSTATE_STATE_ flags,
+ *              nothing stored if NULL)
+ *   unique_id: where to store the unique id of the domain (nothing stored if
+ *              NULL)
+ * Return value: 0 if information was stored, -1 else (errno is set)
+ */
+int xenmanage_get_domain_info(xenmanage_handle *hdl, unsigned int domid,
+                              unsigned int *state, uint64_t *unique_id);
+
+/*
+ * Return information of a domain having changed state recently.
+ *
+ * Returns the domain id, state and unique id of a domain having changed
+ * state (any of the state bits was modified) since the last time information
+ * for that domain was returned by this function. Only usable by callers who
+ * have registered the VIRQ_DOM_EXC event (normally Xenstore).
+ * Parameters:
+ *   hdl:       handle returned by xenmanage_open()
+ *   domid:     where to store the domid of the domain (not NULL)
+ *   state:     where to store the state (XENMANAGE_GETDOMSTATE_STATE_ flags,
+ *              nothing stored if NULL)
+ *   unique_id: where to store the unique id of the domain (nothing stored if
+ *              NULL)
+ * Return value: 0 if information was stored, -1 else (errno is set)
+ */
+int xenmanage_poll_changed_domain(xenmanage_handle *hdl, unsigned int *domid,
+                                  unsigned int *state, uint64_t *unique_id);
+#endif /* XENMANAGE_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/tools/libs/Makefile b/tools/libs/Makefile
index 1afcd12e2b..d39516c1b3 100644
--- a/tools/libs/Makefile
+++ b/tools/libs/Makefile
@@ -12,6 +12,7 @@ SUBDIRS-y += devicemodel
 SUBDIRS-y += ctrl
 SUBDIRS-y += guest
 SUBDIRS-y += hypfs
+SUBDIRS-y += manage
 SUBDIRS-y += store
 SUBDIRS-y += stat
 SUBDIRS-$(CONFIG_Linux) += vchan
diff --git a/tools/libs/manage/Makefile b/tools/libs/manage/Makefile
new file mode 100644
index 0000000000..dbfe70d259
--- /dev/null
+++ b/tools/libs/manage/Makefile
@@ -0,0 +1,10 @@
+XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+MAJOR    = 1
+MINOR    = 0
+version-script := libxenmanage.map
+
+include Makefile.common
+
+include $(XEN_ROOT)/tools/libs/libs.mk
diff --git a/tools/libs/manage/Makefile.common b/tools/libs/manage/Makefile.common
new file mode 100644
index 0000000000..533ba30fba
--- /dev/null
+++ b/tools/libs/manage/Makefile.common
@@ -0,0 +1,3 @@
+CFLAGS += -D__XEN_TOOLS__
+
+OBJS-y  += core.o
diff --git a/tools/libs/manage/core.c b/tools/libs/manage/core.c
new file mode 100644
index 0000000000..8fb421df41
--- /dev/null
+++ b/tools/libs/manage/core.c
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2024 SUSE Software Solutions Germany GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define _GNU_SOURCE
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <xentoollog.h>
+#include <xenmanage.h>
+#include <xencall.h>
+#include <xentoolcore_internal.h>
+
+#include <xen/xen.h>
+#include <xen/domctl.h>
+
+struct xenmanage_handle {
+    xentoollog_logger *logger, *logger_tofree;
+    unsigned int flags;
+    xencall_handle *xcall;
+};
+
+xenmanage_handle *xenmanage_open(xentoollog_logger *logger,
+                                 unsigned int open_flags)
+{
+    xenmanage_handle *hdl = calloc(1, sizeof(*hdl));
+    int saved_errno;
+
+    if ( !hdl )
+        return NULL;
+
+    if ( open_flags )
+    {
+        errno = EINVAL;
+        goto err;
+    }
+
+    hdl->flags = open_flags;
+    hdl->logger = logger;
+    hdl->logger_tofree = NULL;
+
+    if ( !hdl->logger )
+    {
+        hdl->logger = hdl->logger_tofree =
+            (xentoollog_logger *)
+            xtl_createlogger_stdiostream(stderr, XTL_PROGRESS, 0);
+        if ( !hdl->logger )
+            goto err;
+    }
+
+    hdl->xcall = xencall_open(hdl->logger, 0);
+    if ( !hdl->xcall )
+        goto err;
+
+    return hdl;
+
+err:
+    saved_errno = errno;
+    xenmanage_close(hdl);
+    errno = saved_errno;
+
+    return NULL;
+}
+
+int xenmanage_close(xenmanage_handle *hdl)
+{
+    if ( !hdl )
+        return 0;
+
+    xencall_close(hdl->xcall);
+    xtl_logger_destroy(hdl->logger_tofree);
+    free(hdl);
+    return 0;
+}
+
+static int xenmanage_do_domctl_get_domain_state(xenmanage_handle *hdl,
+                                                unsigned int domid_in,
+                                                unsigned int *domid_out,
+                                                unsigned int *state,
+                                                uint64_t *unique_id)
+{
+    struct xen_domctl *buf;
+    int saved_errno;
+    int ret;
+
+    buf = xencall_alloc_buffer(hdl->xcall, sizeof(*buf));
+    if ( !buf )
+    {
+        errno = ENOMEM;
+        return -1;
+    }
+
+    memset(buf, 0, sizeof(*buf));
+
+    buf->cmd = XEN_DOMCTL_get_domain_state;
+    buf->domain = domid_in;
+
+    ret = xencall1(hdl->xcall, __HYPERVISOR_domctl, (unsigned long)buf);
+    saved_errno = errno;
+    if ( !ret )
+    {
+        struct xen_domctl_get_domain_state *st = &buf->u.get_domain_state;
+
+        if ( domid_out )
+            *domid_out = buf->domain;
+        if ( state )
+        {
+            *state = 0;
+            if ( st->state & XEN_DOMCTL_GETDOMSTATE_STATE_EXIST )
+                *state |= XENMANAGE_GETDOMSTATE_STATE_EXIST;
+            if ( st->state & XEN_DOMCTL_GETDOMSTATE_STATE_SHUTDOWN )
+                *state |= XENMANAGE_GETDOMSTATE_STATE_SHUTDOWN;
+            if ( st->state & XEN_DOMCTL_GETDOMSTATE_STATE_DYING )
+                *state |= XENMANAGE_GETDOMSTATE_STATE_DYING;
+            if ( st->state & XEN_DOMCTL_GETDOMSTATE_STATE_DEAD )
+                *state |= XENMANAGE_GETDOMSTATE_STATE_DEAD;
+        }
+        if ( unique_id )
+            *unique_id = st->unique_id;
+    }
+
+    xencall_free_buffer(hdl->xcall, buf);
+
+    errno = saved_errno;
+
+    return ret;
+}
+
+int xenmanage_get_domain_info(xenmanage_handle *hdl, unsigned int domid,
+                              unsigned int *state, uint64_t *unique_id)
+{
+    if ( !hdl || domid >= DOMID_FIRST_RESERVED )
+    {
+        errno = EINVAL;
+        return -1;
+    }
+
+    return xenmanage_do_domctl_get_domain_state(hdl, domid, NULL, state,
+                                                unique_id);
+}
+
+int xenmanage_poll_changed_domain(xenmanage_handle *hdl, unsigned int *domid,
+                                  unsigned int *state, uint64_t *unique_id)
+{
+    if ( !hdl || !domid )
+    {
+        errno = EINVAL;
+        return -1;
+    }
+
+    return xenmanage_do_domctl_get_domain_state(hdl, DOMID_INVALID, domid,
+                                                state, unique_id);
+}
diff --git a/tools/libs/manage/libxenmanage.map b/tools/libs/manage/libxenmanage.map
new file mode 100644
index 0000000000..64c793e603
--- /dev/null
+++ b/tools/libs/manage/libxenmanage.map
@@ -0,0 +1,8 @@
+VERS_1.0 {
+	global:
+		xenmanage_open;
+		xenmanage_close;
+		xenmanage_get_domain_info;
+		xenmanage_poll_changed_domain;
+	local: *; /* Do not expose anything by default */
+};
diff --git a/tools/libs/uselibs.mk b/tools/libs/uselibs.mk
index 7aa8d83e06..c0a234cfec 100644
--- a/tools/libs/uselibs.mk
+++ b/tools/libs/uselibs.mk
@@ -16,6 +16,8 @@ LIBS_LIBS += devicemodel
 USELIBS_devicemodel := toollog toolcore call
 LIBS_LIBS += hypfs
 USELIBS_hypfs := toollog toolcore call
+LIBS_LIBS += manage
+USELIBS_manage := toollog toolcore call
 LIBS_LIBS += ctrl
 USELIBS_ctrl := toollog call evtchn gnttab foreignmemory devicemodel
 LIBS_LIBS += guest
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:56:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905089.1312846 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ7M-0005RK-3d; Fri, 07 Mar 2025 14:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905089.1312846; Fri, 07 Mar 2025 14:56:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ7M-0005RB-14; Fri, 07 Mar 2025 14:56:04 +0000
Received: by outflank-mailman (input) for mailman id 905089;
 Fri, 07 Mar 2025 14:56:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ7L-0005R2-6U
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:56:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ7L-0071C5-1J
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ7L-00CeYk-0S
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:56:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ls3k2UmS59andC+M1YtHkACg4ElzS1wtEsS2akDX+4k=; b=4lkgz/4HXuA9bn2dLwtOPT62gi
	QGdZ67TaERiZiOECRK05uHeWmfLtuHgQH+JwwVJBTMTpSEuvfG43U02r3QuL2zwzFmTbyPNqDUW4b
	o79HOSUWzbmFCOsUE++Ru1sJeMmdmFrIyi8nKdM9pKiWqrIGYF0KLVkxcKwN+PkfxJcY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: use new stable interface instead of libxenctrl
Message-Id: <E1tqZ7L-00CeYk-0S@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:56:03 +0000

commit 42630ceddfd30fea9d6f8ffc216ba5975824433b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 13:54:55 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:54:55 2025 +0100

    tools/xenstored: use new stable interface instead of libxenctrl
    
    Replace the current use of the unstable xc_domain_getinfo_single()
    interface with the stable domctl XEN_DOMCTL_get_domain_state call
    via the new libxenmanage library.
    
    This will remove the last usage of libxenctrl by Xenstore, so update
    the library dependencies accordingly.
    
    For now only do a direct replacement without using the functionality
    of obtaining information about domains having changed the state.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 stubdom/Makefile                |  8 +++----
 stubdom/mini-os.mk              |  1 +
 tools/xenstored/Makefile        |  2 +-
 tools/xenstored/Makefile.common |  2 +-
 tools/xenstored/core.h          |  1 -
 tools/xenstored/domain.c        | 52 +++++++++++++++--------------------------
 tools/xenstored/lu.c            |  1 +
 tools/xenstored/lu_daemon.c     |  1 +
 8 files changed, 28 insertions(+), 40 deletions(-)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index c6978caa5a..724ce40365 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -308,7 +308,7 @@ endif
 # libraries under tools/libs
 #######
 
-STUB_LIBS := toolcore toollog evtchn gnttab call foreignmemory devicemodel ctrl guest
+STUB_LIBS := toolcore toollog evtchn gnttab call foreignmemory devicemodel ctrl guest manage
 
 LIBDEP_guest := cross-zlib
 
@@ -466,7 +466,7 @@ grub: cross-polarssl grub-upstream $(CROSS_ROOT) grub-$(XEN_TARGET_ARCH)-minios-
 # xenstore
 ##########
 
-xenstore-minios.gen.cfg: APP_LIBS = gnttab evtchn toollog ctrl
+xenstore-minios.gen.cfg: APP_LIBS = gnttab evtchn toollog manage
 xenstore-minios.gen.cfg: xenstore-minios.cfg Makefile
 	$(GEN_config) >$@
 
@@ -481,7 +481,7 @@ xenstore: $(CROSS_ROOT) xenstore-minios-config.mk
 # xenstorepvh
 #############
 
-xenstorepvh-minios.gen.cfg: APP_LIBS = gnttab evtchn toollog ctrl
+xenstorepvh-minios.gen.cfg: APP_LIBS = gnttab evtchn toollog manage
 xenstorepvh-minios.gen.cfg: xenstorepvh-minios.cfg Makefile
 	$(GEN_config) >$@
 
@@ -524,7 +524,7 @@ else
 pv-grub-if-enabled:
 endif
 
-XENSTORE_DEPS := libxenevtchn libxengnttab libxenctrl
+XENSTORE_DEPS := libxenevtchn libxengnttab libxenmanage
 
 .PHONY: xenstore-stubdom
 xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore $(XENSTORE_DEPS) xenstore
diff --git a/stubdom/mini-os.mk b/stubdom/mini-os.mk
index 7e4968e026..be32302f9e 100644
--- a/stubdom/mini-os.mk
+++ b/stubdom/mini-os.mk
@@ -13,5 +13,6 @@ GNTTAB_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab
 CALL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call
 FOREIGNMEMORY_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory
 DEVICEMODEL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/devicemodel
+MANAGE_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/manage
 CTRL_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/ctrl
 GUEST_PATH = $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/guest
diff --git a/tools/xenstored/Makefile b/tools/xenstored/Makefile
index 09adfe1d50..81c42838e0 100644
--- a/tools/xenstored/Makefile
+++ b/tools/xenstored/Makefile
@@ -5,7 +5,7 @@ include Makefile.common
 
 xenstored: LDLIBS += $(LDLIBS_libxenevtchn)
 xenstored: LDLIBS += $(LDLIBS_libxengnttab)
-xenstored: LDLIBS += $(LDLIBS_libxenctrl)
+xenstored: LDLIBS += $(LDLIBS_libxenmanage)
 xenstored: LDLIBS += -lrt
 xenstored: LDLIBS += $(SOCKET_LIBS)
 
diff --git a/tools/xenstored/Makefile.common b/tools/xenstored/Makefile.common
index 27fdb3b49e..271134fcc1 100644
--- a/tools/xenstored/Makefile.common
+++ b/tools/xenstored/Makefile.common
@@ -12,7 +12,7 @@ XENSTORED_OBJS-$(CONFIG_MiniOS) += minios.o lu_minios.o
 # Include configure output (config.h)
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 CFLAGS += $(CFLAGS_libxenevtchn)
-CFLAGS += $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_libxenmanage)
 CFLAGS += $(CFLAGS_libxentoolcore)
 
 $(XENSTORED_OBJS-y): CFLAGS += $(CFLAGS_libxengnttab)
diff --git a/tools/xenstored/core.h b/tools/xenstored/core.h
index e58779e88c..632886cecf 100644
--- a/tools/xenstored/core.h
+++ b/tools/xenstored/core.h
@@ -19,7 +19,6 @@
 #ifndef _XENSTORED_CORE_H
 #define _XENSTORED_CORE_H
 
-#include <xenctrl.h>
 #include <xengnttab.h>
 
 #include <sys/types.h>
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index 64c8fd0cc3..a6506a5bb2 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -34,14 +34,15 @@
 #include "control.h"
 
 #include <xenevtchn.h>
-#include <xenctrl.h>
+#include <xenmanage.h>
+#include <xen-barrier.h>
 #include <xen/grant_table.h>
 
 #ifdef __MINIOS__
 #include <mini-os/xenbus.h>
 #endif
 
-static xc_interface **xc_handle;
+static xenmanage_handle *xm_handle;
 xengnttab_handle **xgt_handle;
 static evtchn_port_t virq_port;
 
@@ -619,32 +620,28 @@ static int destroy_domain(void *_domain)
 	return 0;
 }
 
-static bool get_domain_info(unsigned int domid, xc_domaininfo_t *dominfo)
-{
-	return xc_domain_getinfo_single(*xc_handle, domid, dominfo) == 0;
-}
-
 static int check_domain(const void *k, void *v, void *arg)
 {
-	xc_domaininfo_t dominfo;
+	unsigned int state;
 	struct connection *conn;
-	bool dom_valid;
+	int dom_invalid;
 	struct domain *domain = v;
 	bool *notify = arg;
 
-	dom_valid = get_domain_info(domain->domid, &dominfo);
+	dom_invalid = xenmanage_get_domain_info(xm_handle, domain->domid,
+						&state, NULL);
 	if (!domain->introduced) {
-		if (!dom_valid)
+		if (dom_invalid)
 			talloc_free(domain);
 		return 0;
 	}
-	if (dom_valid) {
-		if ((dominfo.flags & XEN_DOMINF_shutdown)
+	if (!dom_invalid) {
+		if ((state & XENMANAGE_GETDOMSTATE_STATE_SHUTDOWN)
 		    && !domain->shutdown) {
 			domain->shutdown = true;
 			*notify = true;
 		}
-		if (!(dominfo.flags & XEN_DOMINF_dying))
+		if (!(state & XENMANAGE_GETDOMSTATE_STATE_DEAD))
 			return 0;
 	}
 	if (domain->conn) {
@@ -786,10 +783,9 @@ static struct domain *find_or_alloc_domain(const void *ctx, unsigned int domid)
 static struct domain *find_or_alloc_existing_domain(unsigned int domid)
 {
 	struct domain *domain;
-	xc_domaininfo_t dominfo;
 
 	domain = find_domain_struct(domid);
-	if (!domain && get_domain_info(domid, &dominfo))
+	if (!domain && !xenmanage_get_domain_info(xm_handle, domid, NULL, NULL))
 		domain = alloc_domain(NULL, domid);
 
 	return domain;
@@ -1187,12 +1183,6 @@ int do_reset_watches(const void *ctx, struct connection *conn,
 	return 0;
 }
 
-static int close_xc_handle(void *_handle)
-{
-	xc_interface_close(*(xc_interface**)_handle);
-	return 0;
-}
-
 static int close_xgt_handle(void *_handle)
 {
 	xengnttab_close(*(xengnttab_handle **)_handle);
@@ -1258,15 +1248,9 @@ void domain_early_init(void)
 	if (!domhash)
 		barf_perror("Failed to allocate domain hashtable");
 
-	xc_handle = talloc(talloc_autofree_context(), xc_interface*);
-	if (!xc_handle)
-		barf_perror("Failed to allocate domain handle");
-
-	*xc_handle = xc_interface_open(0,0,0);
-	if (!*xc_handle)
-		barf_perror("Failed to open connection to hypervisor");
-
-	talloc_set_destructor(xc_handle, close_xc_handle);
+	xm_handle = xenmanage_open(NULL, 0);
+	if (!xm_handle)
+		barf_perror("Failed to open connection to libxenmanage");
 
 	xgt_handle = talloc(talloc_autofree_context(), xengnttab_handle*);
 	if (!xgt_handle)
@@ -1306,6 +1290,8 @@ void domain_deinit(void)
 {
 	if (virq_port)
 		xenevtchn_unbind(xce_handle, virq_port);
+
+	xenmanage_close(xm_handle);
 }
 
 /*
@@ -1335,13 +1321,13 @@ int domain_alloc_permrefs(struct node_perms *perms)
 {
 	unsigned int i, domid;
 	struct domain *d;
-	xc_domaininfo_t dominfo;
 
 	for (i = 0; i < perms->num; i++) {
 		domid = perms->p[i].id;
 		d = find_domain_struct(domid);
 		if (!d) {
-			if (!get_domain_info(domid, &dominfo))
+			if (xenmanage_get_domain_info(xm_handle, domid,
+						      NULL, NULL))
 				perms->p[i].perms |= XS_PERM_IGNORE;
 			else if (!alloc_domain(NULL, domid))
 				return ENOMEM;
diff --git a/tools/xenstored/lu.c b/tools/xenstored/lu.c
index bec2a84e10..4fccbbc195 100644
--- a/tools/xenstored/lu.c
+++ b/tools/xenstored/lu.c
@@ -11,6 +11,7 @@
 #include <stdlib.h>
 #include <syslog.h>
 #include <time.h>
+#include <unistd.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 
diff --git a/tools/xenstored/lu_daemon.c b/tools/xenstored/lu_daemon.c
index 6df6c80a2a..88d8d9e1b3 100644
--- a/tools/xenstored/lu_daemon.c
+++ b/tools/xenstored/lu_daemon.c
@@ -6,6 +6,7 @@
  */
 
 #include <syslog.h>
+#include <unistd.h>
 #include <sys/stat.h>
 
 #include "talloc.h"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:56:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905091.1312861 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ7W-0005iE-Cs; Fri, 07 Mar 2025 14:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905091.1312861; Fri, 07 Mar 2025 14:56:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ7W-0005i6-9a; Fri, 07 Mar 2025 14:56:14 +0000
Received: by outflank-mailman (input) for mailman id 905091;
 Fri, 07 Mar 2025 14:56:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ7V-0005hm-AK
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:56:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ7V-0071CD-1h
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ7V-00CeZM-0n
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:56:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HHp9yszBlpAOttOpxLnIYUxVmVU1pB9U6ufWCp+tIeE=; b=g5PCnYfZibATIWLmp4is7mdzeY
	Ae3u4OiOroZGxq0IOOngUcRNNyArjfAA6FI+PqItv7r7qjLGaKIQsBN6Nlqe5fndftIuVAGSru6YA
	czcbakvl5LVtyyJuR/sDEtf3bdqpNReYV9ZA4PgpMLK8wsi875DWviQaC+8FUp9XkzZU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: improve CET-IBT pruning of ENDBR
Message-Id: <E1tqZ7V-00CeZM-0n@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:56:13 +0000

commit 82457157cbd3cf99619b51d75751f72657cb122e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:56:21 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:56:21 2025 +0100

    x86/HVM: improve CET-IBT pruning of ENDBR
    
    __init{const,data}_cf_clobber can have an effect only for pointers
    actually populated in the respective tables. While not the case for SVM
    right now, VMX installs a number of pointers only under certain
    conditions. Hence the respective functions would have their ENDBR purged
    only when those conditions are met. Invoke "pruning" functions after
    having copied the respective tables, for them to install any "missing"
    pointers.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/hvm.c             |  9 ++++++++-
 xen/arch/x86/hvm/svm/svm.c         | 13 +++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c         | 24 ++++++++++++++++++++++++
 xen/arch/x86/include/asm/hvm/hvm.h |  3 +++
 4 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 969e43c2f2..2f31180b6f 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -160,10 +160,17 @@ static int __init cf_check hvm_enable(void)
     else if ( using_svm() )
         fns = start_svm();
 
+    if ( fns )
+        hvm_funcs = *fns;
+
+    if ( IS_ENABLED(CONFIG_INTEL_VMX) )
+        vmx_fill_funcs();
+    if ( IS_ENABLED(CONFIG_AMD_SVM) )
+        svm_fill_funcs();
+
     if ( fns == NULL )
         return 0;
 
-    hvm_funcs = *fns;
     hvm_enabled = 1;
 
     printk("HVM: %s enabled\n", fns->name);
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index ea78da4f42..42128e33ce 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2531,6 +2531,19 @@ const struct hvm_function_table * __init start_svm(void)
     return &svm_function_table;
 }
 
+void __init svm_fill_funcs(void)
+{
+    /*
+     * Now that svm_function_table was copied, populate all function pointers
+     * which may have been left at NULL, for __initdata_cf_clobber to have as
+     * much of an effect as possible.
+     */
+    if ( !cpu_has_xen_ibt )
+        return;
+
+    /* Nothing at present. */
+}
+
 void asmlinkage svm_vmexit_handler(void)
 {
     struct cpu_user_regs *regs = guest_cpu_user_regs();
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index d87da427ad..1911e79517 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3064,6 +3064,30 @@ const struct hvm_function_table * __init start_vmx(void)
     return &vmx_function_table;
 }
 
+void __init vmx_fill_funcs(void)
+{
+    /*
+     * Now that vmx_function_table was copied, populate all function pointers
+     * which may have been left at NULL, for __initdata_cf_clobber to have as
+     * much of an effect as possible.
+     */
+    if ( !cpu_has_xen_ibt )
+        return;
+
+    vmx_function_table.set_descriptor_access_exiting =
+        vmx_set_descriptor_access_exiting;
+
+    vmx_function_table.update_eoi_exit_bitmap = vmx_update_eoi_exit_bitmap;
+    vmx_function_table.process_isr            = vmx_process_isr;
+    vmx_function_table.handle_eoi             = vmx_handle_eoi;
+
+    vmx_function_table.pi_update_irte = vmx_pi_update_irte;
+
+    vmx_function_table.deliver_posted_intr = vmx_deliver_posted_intr;
+    vmx_function_table.sync_pir_to_irr     = vmx_sync_pir_to_irr;
+    vmx_function_table.test_pir            = vmx_test_pir;
+}
+
 /*
  * Not all cases receive valid value in the VM-exit instruction length field.
  * Callers must know what they're doing!
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index cad3a94278..963e820113 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -260,6 +260,9 @@ extern int8_t hvm_port80_allowed;
 extern const struct hvm_function_table *start_svm(void);
 extern const struct hvm_function_table *start_vmx(void);
 
+void svm_fill_funcs(void);
+void vmx_fill_funcs(void);
+
 int hvm_domain_initialise(struct domain *d,
                           const struct xen_domctl_createdomain *config);
 void hvm_domain_relinquish_resources(struct domain *d);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:56:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905094.1312865 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ7g-0005oQ-Dw; Fri, 07 Mar 2025 14:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905094.1312865; Fri, 07 Mar 2025 14:56:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ7g-0005oI-B3; Fri, 07 Mar 2025 14:56:24 +0000
Received: by outflank-mailman (input) for mailman id 905094;
 Fri, 07 Mar 2025 14:56:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ7f-0005nk-EO
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:56:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ7f-0071CZ-26
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ7f-00Cea5-1A
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:56:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mH87RCusALKY0SbwBNLSmpyvi4hzvtTRMVEH+wpdnqY=; b=PpxdUZ/61hAtcDZWvtchDMWyCt
	d/yAcaJ6MavsfoTNq3MBYhFmOJhZ9gkqy14qf5GyYqBgv7QNe47LKPcCw0pSJerjiart2tt4+70H1
	hhTs+SO904oi/wBduE+/dZWpx6IO5rE7Fd6a9hdWVphNV+PrHzJyeXYZ9RgR4UVDak1M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: drop vmcs_revision_id
Message-Id: <E1tqZ7f-00Cea5-1A@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:56:23 +0000

commit b13f2a901cc81f02f8d40be6b4e86251075abf96
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:56:49 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:56:49 2025 +0100

    VMX: drop vmcs_revision_id
    
    It's effectively redundant with vmx_basic_msr. For the #define
    replacement to work, struct vmcs_struct's respective field name also
    needs to change: Drop the not really meaningful "vmcs_" prefix from it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             |  5 ++---
 xen/arch/x86/hvm/vmx/vvmx.c             | 12 ++++++------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 20ab2d0f26..0622ef40db 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -177,7 +177,7 @@ static DEFINE_PER_CPU(paddr_t, current_vmcs);
 static DEFINE_PER_CPU(struct list_head, active_vmcs_list);
 DEFINE_PER_CPU(bool, vmxon);
 
-static u32 vmcs_revision_id __read_mostly;
+#define vmcs_revision_id (vmx_basic_msr & VMX_BASIC_REVISION_MASK)
 u64 __read_mostly vmx_basic_msr;
 
 static void __init vmx_display_features(void)
@@ -503,7 +503,6 @@ static int vmx_init_vmcs_config(bool bsp)
     if ( !vmx_pin_based_exec_control )
     {
         /* First time through. */
-        vmcs_revision_id           = vmx_basic_msr_low & VMX_BASIC_REVISION_MASK;
         vmx_pin_based_exec_control = _vmx_pin_based_exec_control;
         vmx_cpu_based_exec_control = _vmx_cpu_based_exec_control;
         vmx_secondary_exec_control = _vmx_secondary_exec_control;
@@ -615,7 +614,7 @@ static paddr_t vmx_alloc_vmcs(void)
 
     vmcs = __map_domain_page(pg);
     clear_page(vmcs);
-    vmcs->vmcs_revision_id = vmcs_revision_id;
+    vmcs->revision_id = vmcs_revision_id;
     unmap_domain_page(vmcs);
 
     return page_to_maddr(pg);
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index cf47d61b14..a3d7d1e4d7 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1166,7 +1166,7 @@ static void nvmx_set_vmcs_pointer(struct vcpu *v, struct vmcs_struct *vvmcs)
     paddr_t vvmcs_maddr = v->arch.hvm.vmx.vmcs_shadow_maddr;
 
     __vmpclear(vvmcs_maddr);
-    vvmcs->vmcs_revision_id |= VMCS_RID_TYPE_MASK;
+    vvmcs->revision_id |= VMCS_RID_TYPE_MASK;
     v->arch.hvm.vmx.secondary_exec_control |=
         SECONDARY_EXEC_ENABLE_VMCS_SHADOWING;
     __vmwrite(SECONDARY_VM_EXEC_CONTROL,
@@ -1181,7 +1181,7 @@ static void nvmx_clear_vmcs_pointer(struct vcpu *v, struct vmcs_struct *vvmcs)
     paddr_t vvmcs_maddr = v->arch.hvm.vmx.vmcs_shadow_maddr;
 
     __vmpclear(vvmcs_maddr);
-    vvmcs->vmcs_revision_id &= ~VMCS_RID_TYPE_MASK;
+    vvmcs->revision_id &= ~VMCS_RID_TYPE_MASK;
     v->arch.hvm.vmx.secondary_exec_control &=
         ~SECONDARY_EXEC_ENABLE_VMCS_SHADOWING;
     __vmwrite(SECONDARY_VM_EXEC_CONTROL,
@@ -1799,10 +1799,10 @@ static int nvmx_handle_vmptrld(struct cpu_user_regs *regs)
             {
                 struct vmcs_struct *vvmcs = vvmcx;
 
-                if ( ((vvmcs->vmcs_revision_id ^ vmx_basic_msr) &
-                                         VMX_BASIC_REVISION_MASK) ||
+                if ( ((vvmcs->revision_id ^ vmx_basic_msr) &
+                      VMX_BASIC_REVISION_MASK) ||
                      (!cpu_has_vmx_vmcs_shadowing &&
-                      (vvmcs->vmcs_revision_id & ~VMX_BASIC_REVISION_MASK)) )
+                      (vvmcs->revision_id & ~VMX_BASIC_REVISION_MASK)) )
                 {
                     hvm_unmap_guest_frame(vvmcx, 1);
                     vmfail(regs, VMX_INSN_VMPTRLD_INCORRECT_VMCS_ID);
@@ -2215,7 +2215,7 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 *msr_content)
             map_domain_page(_mfn(PFN_DOWN(v->arch.hvm.vmx.vmcs_pa)));
 
         data = (host_data & (~0ul << 32)) |
-               (vmcs->vmcs_revision_id & 0x7fffffff);
+               (vmcs->revision_id & 0x7fffffff);
         unmap_domain_page(vmcs);
 
         if ( !cpu_has_vmx_vmcs_shadowing )
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index bfb2341011..d9d64764ef 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -17,7 +17,7 @@ int cf_check vmx_cpu_up(void);
 void cf_check vmx_cpu_down(void);
 
 struct vmcs_struct {
-    u32 vmcs_revision_id;
+    uint32_t revision_id;
     unsigned char data [0]; /* vmcs size is read from MSR */
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:56:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905097.1312868 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ7q-0005xB-FM; Fri, 07 Mar 2025 14:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905097.1312868; Fri, 07 Mar 2025 14:56:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ7q-0005x3-CY; Fri, 07 Mar 2025 14:56:34 +0000
Received: by outflank-mailman (input) for mailman id 905097;
 Fri, 07 Mar 2025 14:56:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ7p-0005wq-HB
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:56:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ7p-0071Cg-2N
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:56:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ7p-00CebA-1X
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:56:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nQ3pTrOuU/HmnxpthHtEmiBe/VFwfILVSkoKeQ6YqXs=; b=EB0nEe6TBextrNEDq6TB8HuuIs
	zXZBfsr+mpIvvbmysGFDABmlZfBouzIQ/a5O/aKDyoezDf8aFTMQfx8o/s4LCH5ehAkQGKLJieLbt
	w6tmpqG4EVx+ksrJG5qn+1qHoQ5rvc3RVbHOeFCYjlvu2cJaSVeOffJhDPvU+NGI0UhM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: convert vmx_basic_msr
Message-Id: <E1tqZ7p-00CebA-1X@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:56:33 +0000

commit f7a31ac57281abc95159872e0b006b48b52efe98
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:57:21 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:57:21 2025 +0100

    VMX: convert vmx_basic_msr
    
    ... to a struct field, which is then going to be accompanied by other
    capability/control data presently living in individual variables. As
    this structure isn't supposed to be altered post-boot, put it in
    .data.ro_after_init right away.
    
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 12 ++++++------
 xen/arch/x86/hvm/vmx/vvmx.c             |  6 +++---
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  9 +++++++--
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 0622ef40db..bd0d931063 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -163,6 +163,7 @@ static int cf_check parse_ept_param_runtime(const char *s)
 #endif
 
 /* Dynamic (run-time adjusted) execution control flags. */
+struct vmx_caps __ro_after_init vmx_caps;
 u32 vmx_pin_based_exec_control __read_mostly;
 u32 vmx_cpu_based_exec_control __read_mostly;
 u32 vmx_secondary_exec_control __read_mostly;
@@ -177,8 +178,7 @@ static DEFINE_PER_CPU(paddr_t, current_vmcs);
 static DEFINE_PER_CPU(struct list_head, active_vmcs_list);
 DEFINE_PER_CPU(bool, vmxon);
 
-#define vmcs_revision_id (vmx_basic_msr & VMX_BASIC_REVISION_MASK)
-u64 __read_mostly vmx_basic_msr;
+#define vmcs_revision_id (vmx_caps.basic_msr & VMX_BASIC_REVISION_MASK)
 
 static void __init vmx_display_features(void)
 {
@@ -510,8 +510,8 @@ static int vmx_init_vmcs_config(bool bsp)
         vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
         vmx_vmexit_control         = _vmx_vmexit_control;
         vmx_vmentry_control        = _vmx_vmentry_control;
-        vmx_basic_msr              = ((u64)vmx_basic_msr_high << 32) |
-                                     vmx_basic_msr_low;
+        vmx_caps.basic_msr = ((uint64_t)vmx_basic_msr_high << 32) |
+                             vmx_basic_msr_low;
         vmx_vmfunc                 = _vmx_vmfunc;
 
         vmx_display_features();
@@ -565,7 +565,7 @@ static int vmx_init_vmcs_config(bool bsp)
             mismatch = 1;
         }
         if ( (vmx_basic_msr_high & (VMX_BASIC_VMCS_SIZE_MASK >> 32)) !=
-             ((vmx_basic_msr & VMX_BASIC_VMCS_SIZE_MASK) >> 32) )
+             ((vmx_caps.basic_msr & VMX_BASIC_VMCS_SIZE_MASK) >> 32) )
         {
             printk("VMX: CPU%d unexpected VMCS size %Lu\n",
                    smp_processor_id(),
@@ -2230,7 +2230,7 @@ int __init vmx_vmcs_init(void)
          * _vmx_vcpu_up() may have made it past feature identification.
          * Make sure all dependent features are off as well.
          */
-        vmx_basic_msr              = 0;
+        memset(&vmx_caps, 0, sizeof(vmx_caps));
         vmx_pin_based_exec_control = 0;
         vmx_cpu_based_exec_control = 0;
         vmx_secondary_exec_control = 0;
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index a3d7d1e4d7..87ac43c5c4 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1561,7 +1561,7 @@ static int nvmx_handle_vmxon(struct cpu_user_regs *regs)
     rc = hvm_copy_from_guest_phys(&nvmcs_revid, gpa, sizeof(nvmcs_revid));
     if ( rc != HVMTRANS_okay ||
          (nvmcs_revid & ~VMX_BASIC_REVISION_MASK) ||
-         ((nvmcs_revid ^ vmx_basic_msr) & VMX_BASIC_REVISION_MASK) )
+         ((nvmcs_revid ^ vmx_caps.basic_msr) & VMX_BASIC_REVISION_MASK) )
     {
         vmfail_invalid(regs);
         return X86EMUL_OKAY;
@@ -1799,7 +1799,7 @@ static int nvmx_handle_vmptrld(struct cpu_user_regs *regs)
             {
                 struct vmcs_struct *vvmcs = vvmcx;
 
-                if ( ((vvmcs->revision_id ^ vmx_basic_msr) &
+                if ( ((vvmcs->revision_id ^ vmx_caps.basic_msr) &
                       VMX_BASIC_REVISION_MASK) ||
                      (!cpu_has_vmx_vmcs_shadowing &&
                       (vvmcs->revision_id & ~VMX_BASIC_REVISION_MASK)) )
@@ -2193,7 +2193,7 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 *msr_content)
     case MSR_IA32_VMX_TRUE_PROCBASED_CTLS:
     case MSR_IA32_VMX_TRUE_EXIT_CTLS:
     case MSR_IA32_VMX_TRUE_ENTRY_CTLS:
-        if ( !(vmx_basic_msr & VMX_BASIC_DEFAULT1_ZERO) )
+        if ( !(vmx_caps.basic_msr & VMX_BASIC_DEFAULT1_ZERO) )
             return 0;
         break;
 
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index d9d64764ef..5efa3e9659 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -300,6 +300,12 @@ extern u64 vmx_ept_vpid_cap;
 
 #define VMX_TSC_MULTIPLIER_MAX                  0xffffffffffffffffULL
 
+/* Capabilities and dynamic (run-time adjusted) execution control flags. */
+struct vmx_caps {
+    uint64_t basic_msr;
+};
+extern struct vmx_caps vmx_caps;
+
 #define cpu_has_wbinvd_exiting \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      vmx_secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING)
@@ -415,9 +421,8 @@ extern u64 vmx_ept_vpid_cap;
  */
 #define VMX_BASIC_DEFAULT1_ZERO		(1ULL << 55)
 
-extern u64 vmx_basic_msr;
 #define cpu_has_vmx_ins_outs_instr_info \
-    (!!(vmx_basic_msr & VMX_BASIC_INS_OUT_INFO))
+    (!!(vmx_caps.basic_msr & VMX_BASIC_INS_OUT_INFO))
 
 /* Guest interrupt status */
 #define VMX_GUEST_INTR_STATUS_SUBFIELD_BITMASK  0x0FF
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:56:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:56:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905100.1312872 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ81-000657-IF; Fri, 07 Mar 2025 14:56:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905100.1312872; Fri, 07 Mar 2025 14:56:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ81-00064z-FA; Fri, 07 Mar 2025 14:56:45 +0000
Received: by outflank-mailman (input) for mailman id 905100;
 Fri, 07 Mar 2025 14:56:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ7z-00064N-KA
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:56:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ7z-0071Co-2g
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:56:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ7z-00Cec7-1p
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:56:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IhpykiW4ZHOCBLnHL1XQtTrXCXShaISFdZlFSSbopQM=; b=RrC6WbW9wI38jcC1DG0YOQ2ZOV
	SI8bv1ZjignnYDL2bUqVGffT3x73cwYDnFkSs4mQQb7ggoEQKEvnisdItuJ7lZPx5jyNGCNmHkHAz
	gXHCIHXI4fh2eamCwKrd33CcvP2IqHzSUGrKp1LdKrAibIN/odnmmV9DxZy7D6UXqFEg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: convert vmx_pin_based_exec_control
Message-Id: <E1tqZ7z-00Cec7-1p@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:56:43 +0000

commit 403f3dc2cb2429c26c46cf26f0f621da0d7512a3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:57:41 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:57:41 2025 +0100

    VMX: convert vmx_pin_based_exec_control
    
    ... to a field in the capability/controls struct. Use an instance of
    that struct also in vmx_init_vmcs_config().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 22 ++++++++++------------
 xen/arch/x86/hvm/vmx/vvmx.c             |  2 +-
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  6 +++---
 3 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index bd0d931063..ecac859f7e 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-u32 vmx_pin_based_exec_control __read_mostly;
 u32 vmx_cpu_based_exec_control __read_mostly;
 u32 vmx_secondary_exec_control __read_mostly;
 uint64_t vmx_tertiary_exec_control __read_mostly;
@@ -265,7 +264,7 @@ static bool cap_check(
 static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
-    u32 _vmx_pin_based_exec_control;
+    struct vmx_caps caps = {};
     u32 _vmx_cpu_based_exec_control;
     u32 _vmx_secondary_exec_control = 0;
     uint64_t _vmx_tertiary_exec_control = 0;
@@ -282,7 +281,7 @@ static int vmx_init_vmcs_config(bool bsp)
            PIN_BASED_NMI_EXITING);
     opt = (PIN_BASED_VIRTUAL_NMIS |
            PIN_BASED_POSTED_INTERRUPT);
-    _vmx_pin_based_exec_control = adjust_vmx_controls(
+    caps.pin_based_exec_control = adjust_vmx_controls(
         "Pin-Based Exec Control", min, opt,
         MSR_IA32_VMX_PINBASED_CTLS, &mismatch);
 
@@ -445,7 +444,7 @@ static int vmx_init_vmcs_config(bool bsp)
     if ( (_vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING) &&
           ple_gap == 0 )
     {
-        if ( !vmx_pin_based_exec_control )
+        if ( !vmx_caps.pin_based_exec_control )
             printk(XENLOG_INFO "Disable Pause-Loop Exiting.\n");
         _vmx_secondary_exec_control &= ~ SECONDARY_EXEC_PAUSE_LOOP_EXITING;
     }
@@ -463,10 +462,10 @@ static int vmx_init_vmcs_config(bool bsp)
      * is a minimal requirement, only check the former, which is optional.
      */
     if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) )
-        _vmx_pin_based_exec_control &= ~PIN_BASED_POSTED_INTERRUPT;
+        caps.pin_based_exec_control &= ~PIN_BASED_POSTED_INTERRUPT;
 
     if ( iommu_intpost &&
-         !(_vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT) )
+         !(caps.pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT) )
     {
         printk("Intel VT-d Posted Interrupt is disabled for CPU-side Posted "
                "Interrupt is not enabled\n");
@@ -500,10 +499,10 @@ static int vmx_init_vmcs_config(bool bsp)
     if ( mismatch )
         return -EINVAL;
 
-    if ( !vmx_pin_based_exec_control )
+    if ( !vmx_caps.pin_based_exec_control )
     {
         /* First time through. */
-        vmx_pin_based_exec_control = _vmx_pin_based_exec_control;
+        vmx_caps = caps;
         vmx_cpu_based_exec_control = _vmx_cpu_based_exec_control;
         vmx_secondary_exec_control = _vmx_secondary_exec_control;
         vmx_tertiary_exec_control  = _vmx_tertiary_exec_control;
@@ -534,7 +533,7 @@ static int vmx_init_vmcs_config(bool bsp)
             vmcs_revision_id, vmx_basic_msr_low & VMX_BASIC_REVISION_MASK);
         mismatch |= cap_check(
             "Pin-Based Exec Control",
-            vmx_pin_based_exec_control, _vmx_pin_based_exec_control);
+            vmx_caps.pin_based_exec_control, caps.pin_based_exec_control);
         mismatch |= cap_check(
             "CPU-Based Exec Control",
             vmx_cpu_based_exec_control, _vmx_cpu_based_exec_control);
@@ -1115,7 +1114,7 @@ static int construct_vmcs(struct vcpu *v)
     vmx_vmcs_enter(v);
 
     /* VMCS controls. */
-    __vmwrite(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_control);
+    __vmwrite(PIN_BASED_VM_EXEC_CONTROL, vmx_caps.pin_based_exec_control);
 
     v->arch.hvm.vmx.exec_control = vmx_cpu_based_exec_control;
     if ( d->arch.vtsc && !cpu_has_vmx_tsc_scaling )
@@ -2152,7 +2151,7 @@ void vmcs_dump_vcpu(struct vcpu *v)
     printk("TSC Offset = 0x%016lx  TSC Multiplier = 0x%016lx\n",
            vmr(TSC_OFFSET), vmr(TSC_MULTIPLIER));
     if ( (v->arch.hvm.vmx.exec_control & CPU_BASED_TPR_SHADOW) ||
-         (vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT) )
+         (vmx_caps.pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT) )
         printk("TPR Threshold = 0x%02x  PostedIntrVec = 0x%02x\n",
                vmr32(TPR_THRESHOLD), vmr16(POSTED_INTR_NOTIFICATION_VECTOR));
     if ( (v->arch.hvm.vmx.secondary_exec_control &
@@ -2231,7 +2230,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_pin_based_exec_control = 0;
         vmx_cpu_based_exec_control = 0;
         vmx_secondary_exec_control = 0;
         vmx_tertiary_exec_control  = 0;
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 87ac43c5c4..99bf423a2d 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1057,7 +1057,7 @@ static void load_shadow_control(struct vcpu *v)
      * and EXCEPTION
      * Enforce the removed features
      */
-    nvmx_update_pin_control(v, vmx_pin_based_exec_control);
+    nvmx_update_pin_control(v, vmx_caps.pin_based_exec_control);
     vmx_update_cpu_exec_control(v);
     vmx_update_secondary_exec_control(v);
     nvmx_update_exit_control(v, vmx_vmexit_control);
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 5efa3e9659..28afad568f 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -217,7 +217,6 @@ extern u32 vmx_cpu_based_exec_control;
 #define PIN_BASED_VIRTUAL_NMIS          0x00000020
 #define PIN_BASED_PREEMPT_TIMER         0x00000040
 #define PIN_BASED_POSTED_INTERRUPT      0x00000080
-extern u32 vmx_pin_based_exec_control;
 
 #define VM_EXIT_SAVE_DEBUG_CNTRLS       0x00000004
 #define VM_EXIT_IA32E_MODE              0x00000200
@@ -303,6 +302,7 @@ extern u64 vmx_ept_vpid_cap;
 /* Capabilities and dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps {
     uint64_t basic_msr;
+    uint32_t pin_based_exec_control;
 };
 extern struct vmx_caps vmx_caps;
 
@@ -317,7 +317,7 @@ extern struct vmx_caps vmx_caps;
      vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW)
 #define cpu_has_vmx_vnmi \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_pin_based_exec_control & PIN_BASED_VIRTUAL_NMIS)
+     (vmx_caps.pin_based_exec_control & PIN_BASED_VIRTUAL_NMIS))
 #define cpu_has_vmx_msr_bitmap \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP)
@@ -371,7 +371,7 @@ extern struct vmx_caps vmx_caps;
      vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)
 #define cpu_has_vmx_posted_intr_processing \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT)
+     (vmx_caps.pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT))
 #define cpu_has_vmx_vmcs_shadowing \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VMCS_SHADOWING)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:56:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:56:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905102.1312875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ8B-00067s-JU; Fri, 07 Mar 2025 14:56:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905102.1312875; Fri, 07 Mar 2025 14:56:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ8B-00067k-Ge; Fri, 07 Mar 2025 14:56:55 +0000
Received: by outflank-mailman (input) for mailman id 905102;
 Fri, 07 Mar 2025 14:56:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ89-00067V-NO
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:56:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ89-0071Cs-2x
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:56:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ89-00Cede-27
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:56:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3Pq0kI1XPzQ1pDELPN7fiyra9y/5bbNZHuvE14Q5q28=; b=uDOO1LeVuWv3Rt3PQHX+Tso6s7
	4Li0mKottnLLIxPaZRBqAETruuIDwe9gR+9q0mVQ6Sbvt6jLWIHthHuYyZaSkXLk/YlbrjsLH2Fiu
	C50Z+yMOMoHAjo3PvKbr4oS2+DE63F7OrNAvfg8AE34zjeAHZ74Teu5m8uxFXf5onIzY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: convert vmx_cpu_based_exec_control
Message-Id: <E1tqZ89-00Cede-27@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:56:53 +0000

commit 6bd5e5ec3d14a73a76c1b06ebdd7cb0754753ca2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:58:04 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:58:04 2025 +0100

    VMX: convert vmx_cpu_based_exec_control
    
    ... to a field in the capability/controls struct.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 22 +++++++++-------------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 12 ++++++------
 2 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index ecac859f7e..bf73babac0 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-u32 vmx_cpu_based_exec_control __read_mostly;
 u32 vmx_secondary_exec_control __read_mostly;
 uint64_t vmx_tertiary_exec_control __read_mostly;
 u32 vmx_vmexit_control __read_mostly;
@@ -265,7 +264,6 @@ static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     struct vmx_caps caps = {};
-    u32 _vmx_cpu_based_exec_control;
     u32 _vmx_secondary_exec_control = 0;
     uint64_t _vmx_tertiary_exec_control = 0;
     u64 _vmx_ept_vpid_cap = 0;
@@ -303,12 +301,12 @@ static int vmx_init_vmcs_config(bool bsp)
            CPU_BASED_MONITOR_TRAP_FLAG |
            CPU_BASED_ACTIVATE_SECONDARY_CONTROLS |
            CPU_BASED_ACTIVATE_TERTIARY_CONTROLS);
-    _vmx_cpu_based_exec_control = adjust_vmx_controls(
+    caps.cpu_based_exec_control = adjust_vmx_controls(
         "CPU-Based Exec Control", min, opt,
         MSR_IA32_VMX_PROCBASED_CTLS, &mismatch);
-    _vmx_cpu_based_exec_control &= ~CPU_BASED_RDTSC_EXITING;
-    if ( _vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW )
-        _vmx_cpu_based_exec_control &=
+    caps.cpu_based_exec_control &= ~CPU_BASED_RDTSC_EXITING;
+    if ( caps.cpu_based_exec_control & CPU_BASED_TPR_SHADOW )
+        caps.cpu_based_exec_control &=
             ~(CPU_BASED_CR8_LOAD_EXITING | CPU_BASED_CR8_STORE_EXITING);
 
     rdmsrl(MSR_IA32_VMX_MISC, _vmx_misc_cap);
@@ -325,7 +323,7 @@ static int vmx_init_vmcs_config(bool bsp)
         return -EINVAL;
     }
 
-    if ( _vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS )
+    if ( caps.cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS )
     {
         min = 0;
         opt = (SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
@@ -355,7 +353,7 @@ static int vmx_init_vmcs_config(bool bsp)
          * "APIC Register Virtualization" and "Virtual Interrupt Delivery"
          * can be set only when "use TPR shadow" is set
          */
-        if ( (_vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW) &&
+        if ( (caps.cpu_based_exec_control & CPU_BASED_TPR_SHADOW) &&
              opt_apicv_enabled )
             opt |= SECONDARY_EXEC_APIC_REGISTER_VIRT |
                    SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
@@ -366,7 +364,7 @@ static int vmx_init_vmcs_config(bool bsp)
             MSR_IA32_VMX_PROCBASED_CTLS2, &mismatch);
     }
 
-    if ( _vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS )
+    if ( caps.cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS )
     {
         uint64_t opt = (TERTIARY_EXEC_VIRT_SPEC_CTRL |
                         TERTIARY_EXEC_EPT_PAGING_WRITE);
@@ -503,7 +501,6 @@ static int vmx_init_vmcs_config(bool bsp)
     {
         /* First time through. */
         vmx_caps = caps;
-        vmx_cpu_based_exec_control = _vmx_cpu_based_exec_control;
         vmx_secondary_exec_control = _vmx_secondary_exec_control;
         vmx_tertiary_exec_control  = _vmx_tertiary_exec_control;
         vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
@@ -536,7 +533,7 @@ static int vmx_init_vmcs_config(bool bsp)
             vmx_caps.pin_based_exec_control, caps.pin_based_exec_control);
         mismatch |= cap_check(
             "CPU-Based Exec Control",
-            vmx_cpu_based_exec_control, _vmx_cpu_based_exec_control);
+            vmx_caps.cpu_based_exec_control, caps.cpu_based_exec_control);
         mismatch |= cap_check(
             "Secondary Exec Control",
             vmx_secondary_exec_control, _vmx_secondary_exec_control);
@@ -1116,7 +1113,7 @@ static int construct_vmcs(struct vcpu *v)
     /* VMCS controls. */
     __vmwrite(PIN_BASED_VM_EXEC_CONTROL, vmx_caps.pin_based_exec_control);
 
-    v->arch.hvm.vmx.exec_control = vmx_cpu_based_exec_control;
+    v->arch.hvm.vmx.exec_control = vmx_caps.cpu_based_exec_control;
     if ( d->arch.vtsc && !cpu_has_vmx_tsc_scaling )
         v->arch.hvm.vmx.exec_control |= CPU_BASED_RDTSC_EXITING;
 
@@ -2230,7 +2227,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_cpu_based_exec_control = 0;
         vmx_secondary_exec_control = 0;
         vmx_tertiary_exec_control  = 0;
         vmx_vmexit_control         = 0;
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 28afad568f..685a28c336 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -210,7 +210,6 @@ void vmx_vmcs_reload(struct vcpu *v);
 #define CPU_BASED_MONITOR_EXITING             0x20000000U
 #define CPU_BASED_PAUSE_EXITING               0x40000000U
 #define CPU_BASED_ACTIVATE_SECONDARY_CONTROLS 0x80000000U
-extern u32 vmx_cpu_based_exec_control;
 
 #define PIN_BASED_EXT_INTR_MASK         0x00000001
 #define PIN_BASED_NMI_EXITING           0x00000008
@@ -303,6 +302,7 @@ extern u64 vmx_ept_vpid_cap;
 struct vmx_caps {
     uint64_t basic_msr;
     uint32_t pin_based_exec_control;
+    uint32_t cpu_based_exec_control;
 };
 extern struct vmx_caps vmx_caps;
 
@@ -314,19 +314,19 @@ extern struct vmx_caps vmx_caps;
      vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)
 #define cpu_has_vmx_tpr_shadow \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW)
+     (vmx_caps.cpu_based_exec_control & CPU_BASED_TPR_SHADOW))
 #define cpu_has_vmx_vnmi \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.pin_based_exec_control & PIN_BASED_VIRTUAL_NMIS))
 #define cpu_has_vmx_msr_bitmap \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP)
+     (vmx_caps.cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP))
 #define cpu_has_vmx_secondary_exec_control \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)
+     (vmx_caps.cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS))
 #define cpu_has_vmx_tertiary_exec_control \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS)
+     (vmx_caps.cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS))
 #define cpu_has_vmx_ept \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT)
@@ -341,7 +341,7 @@ extern struct vmx_caps vmx_caps;
      vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID)
 #define cpu_has_monitor_trap_flag \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_cpu_based_exec_control & CPU_BASED_MONITOR_TRAP_FLAG)
+     (vmx_caps.cpu_based_exec_control & CPU_BASED_MONITOR_TRAP_FLAG))
 #define cpu_has_vmx_pat \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_PAT)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:57:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:57:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905104.1312880 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ8L-0006B0-L7; Fri, 07 Mar 2025 14:57:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905104.1312880; Fri, 07 Mar 2025 14:57:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ8L-0006As-I6; Fri, 07 Mar 2025 14:57:05 +0000
Received: by outflank-mailman (input) for mailman id 905104;
 Fri, 07 Mar 2025 14:57:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ8J-0006AT-Ps
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:57:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ8K-0071E2-01
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:57:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ8J-00Ceeh-2O
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:57:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+Tchi+CGvzg/GoP04iD102mNv3EQEndb3rnDegPAMB0=; b=eHEWXodcJaD3mQAFTYsQ7POFdd
	3mtJYIzP9hO1GTcZ/flfsZ9hxbZB2uG+v/ydJIOoNLcNJrBwQkiQ34UJMmPYe7oC3bnNHHqhaR+0s
	sLMK2BVGtU27OsB6PuZ31iU+yvbcZNqI7bnHYCOe+Ex6cWJ5Uu+Jl9HvE2ODyXI69i5c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: convert vmx_secondary_exec_control
Message-Id: <E1tqZ8J-00Ceeh-2O@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:57:03 +0000

commit 11077f166085054631d133cc70465ceb9e4a9ac5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:58:24 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:58:24 2025 +0100

    VMX: convert vmx_secondary_exec_control
    
    ... to a field in the capability/controls struct.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 42 +++++++++++++++------------------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 42 ++++++++++++++++-----------------
 2 files changed, 40 insertions(+), 44 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index bf73babac0..46dcdc21ec 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-u32 vmx_secondary_exec_control __read_mostly;
 uint64_t vmx_tertiary_exec_control __read_mostly;
 u32 vmx_vmexit_control __read_mostly;
 u32 vmx_vmentry_control __read_mostly;
@@ -264,7 +263,6 @@ static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     struct vmx_caps caps = {};
-    u32 _vmx_secondary_exec_control = 0;
     uint64_t _vmx_tertiary_exec_control = 0;
     u64 _vmx_ept_vpid_cap = 0;
     u64 _vmx_misc_cap = 0;
@@ -359,7 +357,7 @@ static int vmx_init_vmcs_config(bool bsp)
                    SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
                    SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE;
 
-        _vmx_secondary_exec_control = adjust_vmx_controls(
+        caps.secondary_exec_control = adjust_vmx_controls(
             "Secondary Exec Control", min, opt,
             MSR_IA32_VMX_PROCBASED_CTLS2, &mismatch);
     }
@@ -375,7 +373,7 @@ static int vmx_init_vmcs_config(bool bsp)
     }
 
     /* The IA32_VMX_EPT_VPID_CAP MSR exists only when EPT or VPID available */
-    if ( _vmx_secondary_exec_control & (SECONDARY_EXEC_ENABLE_EPT |
+    if ( caps.secondary_exec_control & (SECONDARY_EXEC_ENABLE_EPT |
                                         SECONDARY_EXEC_ENABLE_VPID) )
     {
         rdmsrl(MSR_IA32_VMX_EPT_VPID_CAP, _vmx_ept_vpid_cap);
@@ -397,7 +395,7 @@ static int vmx_init_vmcs_config(bool bsp)
         if ( !(_vmx_ept_vpid_cap & VMX_EPT_MEMORY_TYPE_WB) ||
              !(_vmx_ept_vpid_cap & VMX_EPT_WALK_LENGTH_4_SUPPORTED) ||
              !(_vmx_ept_vpid_cap & VMX_EPT_INVEPT_ALL_CONTEXT) )
-            _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_EPT;
+            caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_EPT;
 
         /*
          * the CPU must support INVVPID all context invalidation, because we
@@ -406,14 +404,14 @@ static int vmx_init_vmcs_config(bool bsp)
          * Or we just don't use VPID.
          */
         if ( !(_vmx_ept_vpid_cap & VMX_VPID_INVVPID_ALL_CONTEXT) )
-            _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VPID;
+            caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VPID;
 
         /* EPT A/D bits is required for PML */
         if ( !(_vmx_ept_vpid_cap & VMX_EPT_AD_BIT) )
-            _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
+            caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
     }
 
-    if ( _vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT )
+    if ( caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT )
     {
         /*
          * To use EPT we expect to be able to clear certain intercepts.
@@ -426,25 +424,25 @@ static int vmx_init_vmcs_config(bool bsp)
         if ( must_be_one & (CPU_BASED_INVLPG_EXITING |
                             CPU_BASED_CR3_LOAD_EXITING |
                             CPU_BASED_CR3_STORE_EXITING) )
-            _vmx_secondary_exec_control &=
+            caps.secondary_exec_control &=
                 ~(SECONDARY_EXEC_ENABLE_EPT |
                   SECONDARY_EXEC_UNRESTRICTED_GUEST);
     }
 
     /* PML cannot be supported if EPT is not used */
-    if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT) )
-        _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
+    if ( !(caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT) )
+        caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
 
     /* Turn off opt_ept_pml if PML feature is not present. */
-    if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_PML) )
+    if ( !(caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_PML) )
         opt_ept_pml = false;
 
-    if ( (_vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING) &&
+    if ( (caps.secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING) &&
           ple_gap == 0 )
     {
         if ( !vmx_caps.pin_based_exec_control )
             printk(XENLOG_INFO "Disable Pause-Loop Exiting.\n");
-        _vmx_secondary_exec_control &= ~ SECONDARY_EXEC_PAUSE_LOOP_EXITING;
+        caps.secondary_exec_control &= ~ SECONDARY_EXEC_PAUSE_LOOP_EXITING;
     }
 
     min = VM_EXIT_ACK_INTR_ON_EXIT;
@@ -459,7 +457,7 @@ static int vmx_init_vmcs_config(bool bsp)
      * delivery" and "acknowledge interrupt on exit" is set. For the latter
      * is a minimal requirement, only check the former, which is optional.
      */
-    if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) )
+    if ( !(caps.secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) )
         caps.pin_based_exec_control &= ~PIN_BASED_POSTED_INTERRUPT;
 
     if ( iommu_intpost &&
@@ -471,7 +469,7 @@ static int vmx_init_vmcs_config(bool bsp)
     }
 
     /* The IA32_VMX_VMFUNC MSR exists only when VMFUNC is available */
-    if ( _vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS )
+    if ( caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS )
     {
         rdmsrl(MSR_IA32_VMX_VMFUNC, _vmx_vmfunc);
 
@@ -481,12 +479,12 @@ static int vmx_init_vmcs_config(bool bsp)
          * Or we just don't use VMFUNC.
          */
         if ( !(_vmx_vmfunc & VMX_VMFUNC_EPTP_SWITCHING) )
-            _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VM_FUNCTIONS;
+            caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VM_FUNCTIONS;
     }
 
     /* Virtualization exceptions are only enabled if VMFUNC is enabled */
-    if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS) )
-        _vmx_secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS;
+    if ( !(caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS) )
+        caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS;
 
     min = 0;
     opt = (VM_ENTRY_LOAD_GUEST_PAT | VM_ENTRY_LOAD_GUEST_EFER |
@@ -501,7 +499,6 @@ static int vmx_init_vmcs_config(bool bsp)
     {
         /* First time through. */
         vmx_caps = caps;
-        vmx_secondary_exec_control = _vmx_secondary_exec_control;
         vmx_tertiary_exec_control  = _vmx_tertiary_exec_control;
         vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
         vmx_vmexit_control         = _vmx_vmexit_control;
@@ -536,7 +533,7 @@ static int vmx_init_vmcs_config(bool bsp)
             vmx_caps.cpu_based_exec_control, caps.cpu_based_exec_control);
         mismatch |= cap_check(
             "Secondary Exec Control",
-            vmx_secondary_exec_control, _vmx_secondary_exec_control);
+            vmx_caps.secondary_exec_control, caps.secondary_exec_control);
         mismatch |= cap_check(
             "Tertiary Exec Control",
             vmx_tertiary_exec_control, _vmx_tertiary_exec_control);
@@ -1117,7 +1114,7 @@ static int construct_vmcs(struct vcpu *v)
     if ( d->arch.vtsc && !cpu_has_vmx_tsc_scaling )
         v->arch.hvm.vmx.exec_control |= CPU_BASED_RDTSC_EXITING;
 
-    v->arch.hvm.vmx.secondary_exec_control = vmx_secondary_exec_control;
+    v->arch.hvm.vmx.secondary_exec_control = vmx_caps.secondary_exec_control;
     v->arch.hvm.vmx.tertiary_exec_control  = vmx_tertiary_exec_control;
 
     /*
@@ -2227,7 +2224,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_secondary_exec_control = 0;
         vmx_tertiary_exec_control  = 0;
         vmx_vmexit_control         = 0;
         vmx_vmentry_control        = 0;
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 685a28c336..968d8706f7 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -258,7 +258,6 @@ extern u32 vmx_vmentry_control;
 #define SECONDARY_EXEC_TSC_SCALING              0x02000000U
 #define SECONDARY_EXEC_BUS_LOCK_DETECTION       0x40000000U
 #define SECONDARY_EXEC_NOTIFY_VM_EXITING        0x80000000U
-extern u32 vmx_secondary_exec_control;
 
 #define TERTIARY_EXEC_LOADIWKEY_EXITING         BIT(0, UL)
 #define TERTIARY_EXEC_ENABLE_HLAT               BIT(1, UL)
@@ -303,15 +302,16 @@ struct vmx_caps {
     uint64_t basic_msr;
     uint32_t pin_based_exec_control;
     uint32_t cpu_based_exec_control;
+    uint32_t secondary_exec_control;
 };
 extern struct vmx_caps vmx_caps;
 
 #define cpu_has_wbinvd_exiting \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING))
 #define cpu_has_vmx_virtualize_apic_accesses \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES))
 #define cpu_has_vmx_tpr_shadow \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.cpu_based_exec_control & CPU_BASED_TPR_SHADOW))
@@ -329,16 +329,16 @@ extern struct vmx_caps vmx_caps;
      (vmx_caps.cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS))
 #define cpu_has_vmx_ept \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT))
 #define cpu_has_vmx_dt_exiting \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING))
 #define cpu_has_vmx_rdtscp \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_RDTSCP)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_RDTSCP))
 #define cpu_has_vmx_vpid \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID))
 #define cpu_has_monitor_trap_flag \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.cpu_based_exec_control & CPU_BASED_MONITOR_TRAP_FLAG))
@@ -350,56 +350,56 @@ extern struct vmx_caps vmx_caps;
      vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_EFER)
 #define cpu_has_vmx_unrestricted_guest \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_UNRESTRICTED_GUEST)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_UNRESTRICTED_GUEST))
 #define vmx_unrestricted_guest(v)               \
     ((v)->arch.hvm.vmx.secondary_exec_control & \
      SECONDARY_EXEC_UNRESTRICTED_GUEST)
 #define cpu_has_vmx_ple \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING))
 #define cpu_has_vmx_invpcid \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_INVPCID)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_INVPCID))
 #define cpu_has_vmx_apic_reg_virt \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_APIC_REGISTER_VIRT)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_APIC_REGISTER_VIRT))
 #define cpu_has_vmx_virtual_intr_delivery \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY))
 #define cpu_has_vmx_virtualize_x2apic_mode \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE))
 #define cpu_has_vmx_posted_intr_processing \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT))
 #define cpu_has_vmx_vmcs_shadowing \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VMCS_SHADOWING)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VMCS_SHADOWING))
 #define cpu_has_vmx_vmfunc \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS))
 #define cpu_has_vmx_virt_exceptions \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS))
 #define cpu_has_vmx_pml \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_PML)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_PML))
 #define cpu_has_vmx_mpx \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_vmexit_control & VM_EXIT_CLEAR_BNDCFGS) && \
      (vmx_vmentry_control & VM_ENTRY_LOAD_BNDCFGS))
 #define cpu_has_vmx_xsaves \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_XSAVES)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_XSAVES))
 #define cpu_has_vmx_tsc_scaling \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_TSC_SCALING)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_TSC_SCALING))
 #define cpu_has_vmx_bus_lock_detection \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION))
 #define cpu_has_vmx_notify_vm_exiting \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_secondary_exec_control & SECONDARY_EXEC_NOTIFY_VM_EXITING)
+     (vmx_caps.secondary_exec_control & SECONDARY_EXEC_NOTIFY_VM_EXITING))
 
 #define VMCS_RID_TYPE_MASK              0x80000000U
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:57:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:57:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905105.1312884 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ8V-0006EE-Nd; Fri, 07 Mar 2025 14:57:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905105.1312884; Fri, 07 Mar 2025 14:57:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ8V-0006E7-Kz; Fri, 07 Mar 2025 14:57:15 +0000
Received: by outflank-mailman (input) for mailman id 905105;
 Fri, 07 Mar 2025 14:57:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ8T-0006Ds-SY
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:57:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ8U-0071Fl-0I
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:57:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ8T-00Cefi-2g
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:57:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Fvupxy1xsAhTRqSbArjGshCWDlAxRDxuE+KrLYVCceg=; b=0hZUwyymvruRQhoQ99z5Jo+KbQ
	swLMQUn8a0L2cdpgEWnjlJf56dwJfeDMbKX9TSj72yDPODZJkS6eHFj1fvB5iAK+lvRAR9sNWKyYk
	MEMfyNCsTP5Eu175cUvLUVjsCfvawh+9n7HzJ319kGBKrEEUh71RqxpbqDf9DCQ2/vjA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: convert vmx_tertiary_exec_control
Message-Id: <E1tqZ8T-00Cefi-2g@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:57:13 +0000

commit 5d8cbdd465f1fcfc28aec933aee5a1b8faf92f87
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:58:47 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:58:47 2025 +0100

    VMX: convert vmx_tertiary_exec_control
    
    ... to a field in the capability/controls struct.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 10 +++-------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  6 +++---
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 46dcdc21ec..9763478527 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-uint64_t vmx_tertiary_exec_control __read_mostly;
 u32 vmx_vmexit_control __read_mostly;
 u32 vmx_vmentry_control __read_mostly;
 u64 vmx_ept_vpid_cap __read_mostly;
@@ -263,7 +262,6 @@ static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     struct vmx_caps caps = {};
-    uint64_t _vmx_tertiary_exec_control = 0;
     u64 _vmx_ept_vpid_cap = 0;
     u64 _vmx_misc_cap = 0;
     u32 _vmx_vmexit_control;
@@ -367,7 +365,7 @@ static int vmx_init_vmcs_config(bool bsp)
         uint64_t opt = (TERTIARY_EXEC_VIRT_SPEC_CTRL |
                         TERTIARY_EXEC_EPT_PAGING_WRITE);
 
-        _vmx_tertiary_exec_control = adjust_vmx_controls2(
+        caps.tertiary_exec_control = adjust_vmx_controls2(
             "Tertiary Exec Control", 0, opt,
             MSR_IA32_VMX_PROCBASED_CTLS3, &mismatch);
     }
@@ -499,7 +497,6 @@ static int vmx_init_vmcs_config(bool bsp)
     {
         /* First time through. */
         vmx_caps = caps;
-        vmx_tertiary_exec_control  = _vmx_tertiary_exec_control;
         vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
         vmx_vmexit_control         = _vmx_vmexit_control;
         vmx_vmentry_control        = _vmx_vmentry_control;
@@ -536,7 +533,7 @@ static int vmx_init_vmcs_config(bool bsp)
             vmx_caps.secondary_exec_control, caps.secondary_exec_control);
         mismatch |= cap_check(
             "Tertiary Exec Control",
-            vmx_tertiary_exec_control, _vmx_tertiary_exec_control);
+            vmx_caps.tertiary_exec_control, caps.tertiary_exec_control);
         mismatch |= cap_check(
             "VMExit Control",
             vmx_vmexit_control, _vmx_vmexit_control);
@@ -1115,7 +1112,7 @@ static int construct_vmcs(struct vcpu *v)
         v->arch.hvm.vmx.exec_control |= CPU_BASED_RDTSC_EXITING;
 
     v->arch.hvm.vmx.secondary_exec_control = vmx_caps.secondary_exec_control;
-    v->arch.hvm.vmx.tertiary_exec_control  = vmx_tertiary_exec_control;
+    v->arch.hvm.vmx.tertiary_exec_control  = vmx_caps.tertiary_exec_control;
 
     /*
      * Disable features which we don't want active by default:
@@ -2224,7 +2221,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_tertiary_exec_control  = 0;
         vmx_vmexit_control         = 0;
         vmx_vmentry_control        = 0;
         vmx_ept_vpid_cap           = 0;
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 968d8706f7..fc85bd6a5b 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -265,13 +265,12 @@ extern u32 vmx_vmentry_control;
 #define TERTIARY_EXEC_GUEST_PAGING_VERIFY       BIT(3, UL)
 #define TERTIARY_EXEC_IPI_VIRT                  BIT(4, UL)
 #define TERTIARY_EXEC_VIRT_SPEC_CTRL            BIT(7, UL)
-extern uint64_t vmx_tertiary_exec_control;
 
 #define cpu_has_vmx_virt_spec_ctrl \
-     (vmx_tertiary_exec_control & TERTIARY_EXEC_VIRT_SPEC_CTRL)
+     (vmx_caps.tertiary_exec_control & TERTIARY_EXEC_VIRT_SPEC_CTRL)
 
 #define cpu_has_vmx_ept_paging_write \
-     (vmx_tertiary_exec_control & TERTIARY_EXEC_EPT_PAGING_WRITE)
+     (vmx_caps.tertiary_exec_control & TERTIARY_EXEC_EPT_PAGING_WRITE)
 
 #define VMX_EPT_EXEC_ONLY_SUPPORTED                         0x00000001
 #define VMX_EPT_WALK_LENGTH_4_SUPPORTED                     0x00000040
@@ -303,6 +302,7 @@ struct vmx_caps {
     uint32_t pin_based_exec_control;
     uint32_t cpu_based_exec_control;
     uint32_t secondary_exec_control;
+    uint64_t tertiary_exec_control;
 };
 extern struct vmx_caps vmx_caps;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:57:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:57:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905106.1312888 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ8f-0006Gs-PC; Fri, 07 Mar 2025 14:57:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905106.1312888; Fri, 07 Mar 2025 14:57:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ8f-0006Gk-MX; Fri, 07 Mar 2025 14:57:25 +0000
Received: by outflank-mailman (input) for mailman id 905106;
 Fri, 07 Mar 2025 14:57:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ8d-0006GL-VL
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:57:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ8e-0071GF-0Z
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:57:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ8d-00CegU-2x
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:57:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hgK6AkV8l1RFYbv/FHBg+hui2OYNYPYaCB/4w5ncy3Q=; b=HzCTNHVGQlaR/kpeYnOi11LL4W
	AIMCVSRZFK5JXbKxkjprSjrbLmVJYwqpuW9MuUwdAYmBYABYJ07UQukqPfpPX9PXhrLnJAUIGdI5y
	uLt8j8q8f4zZn6KcIGjA7b5jWK5S8O/peTAbvVZmreF2DpUwi/MFPjAdMOMW/i2T8G9w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: convert vmx_vmexit_control
Message-Id: <E1tqZ8d-00CegU-2x@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:57:23 +0000

commit eddd93709418201fb8de09a8e3c9f6a26325b151
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:59:09 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:59:09 2025 +0100

    VMX: convert vmx_vmexit_control
    
    ... to a field in the capability/controls struct.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 10 +++-------
 xen/arch/x86/hvm/vmx/vvmx.c             |  2 +-
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  4 ++--
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 9763478527..6eff60c139 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-u32 vmx_vmexit_control __read_mostly;
 u32 vmx_vmentry_control __read_mostly;
 u64 vmx_ept_vpid_cap __read_mostly;
 static uint64_t __read_mostly vmx_vmfunc;
@@ -264,7 +263,6 @@ static int vmx_init_vmcs_config(bool bsp)
     struct vmx_caps caps = {};
     u64 _vmx_ept_vpid_cap = 0;
     u64 _vmx_misc_cap = 0;
-    u32 _vmx_vmexit_control;
     u32 _vmx_vmentry_control;
     u64 _vmx_vmfunc = 0;
     bool mismatch = false;
@@ -447,7 +445,7 @@ static int vmx_init_vmcs_config(bool bsp)
     opt = (VM_EXIT_SAVE_GUEST_PAT | VM_EXIT_LOAD_HOST_PAT |
            VM_EXIT_LOAD_HOST_EFER | VM_EXIT_CLEAR_BNDCFGS);
     min |= VM_EXIT_IA32E_MODE;
-    _vmx_vmexit_control = adjust_vmx_controls(
+    caps.vmexit_control = adjust_vmx_controls(
         "VMExit Control", min, opt, MSR_IA32_VMX_EXIT_CTLS, &mismatch);
 
     /*
@@ -498,7 +496,6 @@ static int vmx_init_vmcs_config(bool bsp)
         /* First time through. */
         vmx_caps = caps;
         vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
-        vmx_vmexit_control         = _vmx_vmexit_control;
         vmx_vmentry_control        = _vmx_vmentry_control;
         vmx_caps.basic_msr = ((uint64_t)vmx_basic_msr_high << 32) |
                              vmx_basic_msr_low;
@@ -536,7 +533,7 @@ static int vmx_init_vmcs_config(bool bsp)
             vmx_caps.tertiary_exec_control, caps.tertiary_exec_control);
         mismatch |= cap_check(
             "VMExit Control",
-            vmx_vmexit_control, _vmx_vmexit_control);
+            vmx_caps.vmexit_control, caps.vmexit_control);
         mismatch |= cap_check(
             "VMEntry Control",
             vmx_vmentry_control, _vmx_vmentry_control);
@@ -1098,7 +1095,7 @@ void nocall vmx_asm_vmexit_handler(void);
 static int construct_vmcs(struct vcpu *v)
 {
     struct domain *d = v->domain;
-    u32 vmexit_ctl = vmx_vmexit_control;
+    uint32_t vmexit_ctl = vmx_caps.vmexit_control;
     u32 vmentry_ctl = vmx_vmentry_control;
     int rc = 0;
 
@@ -2221,7 +2218,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_vmexit_control         = 0;
         vmx_vmentry_control        = 0;
         vmx_ept_vpid_cap           = 0;
         vmx_vmfunc                 = 0;
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 99bf423a2d..ceb5e5a322 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1060,7 +1060,7 @@ static void load_shadow_control(struct vcpu *v)
     nvmx_update_pin_control(v, vmx_caps.pin_based_exec_control);
     vmx_update_cpu_exec_control(v);
     vmx_update_secondary_exec_control(v);
-    nvmx_update_exit_control(v, vmx_vmexit_control);
+    nvmx_update_exit_control(v, vmx_caps.vmexit_control);
     nvmx_update_entry_control(v);
     vmx_update_exception_bitmap(v);
     nvmx_update_apic_access_address(v);
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index fc85bd6a5b..b907f015d7 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -227,7 +227,6 @@ void vmx_vmcs_reload(struct vcpu *v);
 #define VM_EXIT_LOAD_HOST_EFER          0x00200000
 #define VM_EXIT_SAVE_PREEMPT_TIMER      0x00400000
 #define VM_EXIT_CLEAR_BNDCFGS           0x00800000
-extern u32 vmx_vmexit_control;
 
 #define VM_ENTRY_IA32E_MODE             0x00000200
 #define VM_ENTRY_SMM                    0x00000400
@@ -303,6 +302,7 @@ struct vmx_caps {
     uint32_t cpu_based_exec_control;
     uint32_t secondary_exec_control;
     uint64_t tertiary_exec_control;
+    uint32_t vmexit_control;
 };
 extern struct vmx_caps vmx_caps;
 
@@ -386,7 +386,7 @@ extern struct vmx_caps vmx_caps;
      (vmx_caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_PML))
 #define cpu_has_vmx_mpx \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     (vmx_vmexit_control & VM_EXIT_CLEAR_BNDCFGS) && \
+     (vmx_caps.vmexit_control & VM_EXIT_CLEAR_BNDCFGS) && \
      (vmx_vmentry_control & VM_ENTRY_LOAD_BNDCFGS))
 #define cpu_has_vmx_xsaves \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:57:35 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:57:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905107.1312892 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ8p-0006JY-Qc; Fri, 07 Mar 2025 14:57:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905107.1312892; Fri, 07 Mar 2025 14:57:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ8p-0006JQ-Ny; Fri, 07 Mar 2025 14:57:35 +0000
Received: by outflank-mailman (input) for mailman id 905107;
 Fri, 07 Mar 2025 14:57:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ8o-0006JF-1k
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:57:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ8o-0071GM-0q
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:57:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ8o-00CehI-00
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:57:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7qZnUekbkbWGvSVaTCQkhZMqxibnf0tXkKMtZ99notA=; b=GuUQdiIlD55/0v1VF3VBG88I7b
	CkLeyIvBT2FKEtSgoAmXkl9bY8sWEztCU5uTbTrnSnW7B5shMbxh8sxb/dP0FTFLfbU7G+x68AFYm
	xmmT4LS4FamuJkB1NrOYij1Ax6LVAMmPm6YlYIQonJULM7G8cGUXU7wQalVMvyNXJ1jI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: convert vmx_vmentry_control
Message-Id: <E1tqZ8o-00CehI-00@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:57:34 +0000

commit c25bcd2b5e9dd6c106102a846e5433f6ff269959
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:59:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:59:30 2025 +0100

    VMX: convert vmx_vmentry_control
    
    ... to a field in the capability/controls struct.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 10 +++-------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  8 ++++----
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 6eff60c139..138baf907f 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-u32 vmx_vmentry_control __read_mostly;
 u64 vmx_ept_vpid_cap __read_mostly;
 static uint64_t __read_mostly vmx_vmfunc;
 
@@ -263,7 +262,6 @@ static int vmx_init_vmcs_config(bool bsp)
     struct vmx_caps caps = {};
     u64 _vmx_ept_vpid_cap = 0;
     u64 _vmx_misc_cap = 0;
-    u32 _vmx_vmentry_control;
     u64 _vmx_vmfunc = 0;
     bool mismatch = false;
 
@@ -485,7 +483,7 @@ static int vmx_init_vmcs_config(bool bsp)
     min = 0;
     opt = (VM_ENTRY_LOAD_GUEST_PAT | VM_ENTRY_LOAD_GUEST_EFER |
            VM_ENTRY_LOAD_BNDCFGS);
-    _vmx_vmentry_control = adjust_vmx_controls(
+    caps.vmentry_control = adjust_vmx_controls(
         "VMEntry Control", min, opt, MSR_IA32_VMX_ENTRY_CTLS, &mismatch);
 
     if ( mismatch )
@@ -496,7 +494,6 @@ static int vmx_init_vmcs_config(bool bsp)
         /* First time through. */
         vmx_caps = caps;
         vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
-        vmx_vmentry_control        = _vmx_vmentry_control;
         vmx_caps.basic_msr = ((uint64_t)vmx_basic_msr_high << 32) |
                              vmx_basic_msr_low;
         vmx_vmfunc                 = _vmx_vmfunc;
@@ -536,7 +533,7 @@ static int vmx_init_vmcs_config(bool bsp)
             vmx_caps.vmexit_control, caps.vmexit_control);
         mismatch |= cap_check(
             "VMEntry Control",
-            vmx_vmentry_control, _vmx_vmentry_control);
+            vmx_caps.vmentry_control, caps.vmentry_control);
         mismatch |= cap_check(
             "EPT and VPID Capability",
             vmx_ept_vpid_cap, _vmx_ept_vpid_cap);
@@ -1096,7 +1093,7 @@ static int construct_vmcs(struct vcpu *v)
 {
     struct domain *d = v->domain;
     uint32_t vmexit_ctl = vmx_caps.vmexit_control;
-    u32 vmentry_ctl = vmx_vmentry_control;
+    u32 vmentry_ctl = vmx_caps.vmentry_control;
     int rc = 0;
 
     vmx_vmcs_enter(v);
@@ -2218,7 +2215,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_vmentry_control        = 0;
         vmx_ept_vpid_cap           = 0;
         vmx_vmfunc                 = 0;
     }
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index b907f015d7..6a4e3cb70f 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -235,7 +235,6 @@ void vmx_vmcs_reload(struct vcpu *v);
 #define VM_ENTRY_LOAD_GUEST_PAT         0x00004000
 #define VM_ENTRY_LOAD_GUEST_EFER        0x00008000
 #define VM_ENTRY_LOAD_BNDCFGS           0x00010000
-extern u32 vmx_vmentry_control;
 
 #define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001U
 #define SECONDARY_EXEC_ENABLE_EPT               0x00000002U
@@ -303,6 +302,7 @@ struct vmx_caps {
     uint32_t secondary_exec_control;
     uint64_t tertiary_exec_control;
     uint32_t vmexit_control;
+    uint32_t vmentry_control;
 };
 extern struct vmx_caps vmx_caps;
 
@@ -344,10 +344,10 @@ extern struct vmx_caps vmx_caps;
      (vmx_caps.cpu_based_exec_control & CPU_BASED_MONITOR_TRAP_FLAG))
 #define cpu_has_vmx_pat \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_PAT)
+     (vmx_caps.vmentry_control & VM_ENTRY_LOAD_GUEST_PAT))
 #define cpu_has_vmx_efer \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
-     vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_EFER)
+     (vmx_caps.vmentry_control & VM_ENTRY_LOAD_GUEST_EFER))
 #define cpu_has_vmx_unrestricted_guest \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.secondary_exec_control & SECONDARY_EXEC_UNRESTRICTED_GUEST))
@@ -387,7 +387,7 @@ extern struct vmx_caps vmx_caps;
 #define cpu_has_vmx_mpx \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.vmexit_control & VM_EXIT_CLEAR_BNDCFGS) && \
-     (vmx_vmentry_control & VM_ENTRY_LOAD_BNDCFGS))
+     (vmx_caps.vmentry_control & VM_ENTRY_LOAD_BNDCFGS))
 #define cpu_has_vmx_xsaves \
     (IS_ENABLED(CONFIG_INTEL_VMX) && \
      (vmx_caps.secondary_exec_control & SECONDARY_EXEC_XSAVES))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:57:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:57:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905108.1312896 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ8z-0006MX-SY; Fri, 07 Mar 2025 14:57:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905108.1312896; Fri, 07 Mar 2025 14:57:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ8z-0006MP-PR; Fri, 07 Mar 2025 14:57:45 +0000
Received: by outflank-mailman (input) for mailman id 905108;
 Fri, 07 Mar 2025 14:57:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ8y-0006Ln-51
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:57:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ8y-0071GU-1A
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:57:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ8y-00CekD-0H
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:57:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hjqeSz+/xcsbqyTN3p3bwN4tu7BGidhXCarMBKfBMMo=; b=EglETo8ddfVFbg7BaT/W2j7fGL
	1XcVXgvjcwhYMfCTFw0fhqX2ngYlskrDXtyp/QjtiHpp78vIWJqm2KUk2TMb2Z/EeyO6AHjgPh9sZ
	g4i8wTcjQohkaFVOjgFhb3/A0u2mY/1O1fcumuYImY59Tvav4boMW5jGzrsR2675qpZs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: convert vmx_ept_vpid_cap
Message-Id: <E1tqZ8y-00CekD-0H@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:57:44 +0000

commit 3d18d6afa9fdefad5c15fcdb984d4623d5c67c1c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 13:59:56 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 13:59:56 2025 +0100

    VMX: convert vmx_ept_vpid_cap
    
    ... to fields in the capability/controls struct: Take the opportunity
    and split the two halves into separate EPT and VPID fields.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 23 +++++++++--------------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 13 +++++++------
 xen/arch/x86/include/asm/hvm/vmx/vmx.h  | 22 +++++++++++-----------
 3 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 138baf907f..d8e58bd648 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-u64 vmx_ept_vpid_cap __read_mostly;
 static uint64_t __read_mostly vmx_vmfunc;
 
 static DEFINE_PER_CPU_READ_MOSTLY(paddr_t, vmxon_region);
@@ -260,7 +259,6 @@ static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     struct vmx_caps caps = {};
-    u64 _vmx_ept_vpid_cap = 0;
     u64 _vmx_misc_cap = 0;
     u64 _vmx_vmfunc = 0;
     bool mismatch = false;
@@ -370,10 +368,10 @@ static int vmx_init_vmcs_config(bool bsp)
     if ( caps.secondary_exec_control & (SECONDARY_EXEC_ENABLE_EPT |
                                         SECONDARY_EXEC_ENABLE_VPID) )
     {
-        rdmsrl(MSR_IA32_VMX_EPT_VPID_CAP, _vmx_ept_vpid_cap);
+        rdmsr(MSR_IA32_VMX_EPT_VPID_CAP, caps.ept, caps.vpid);
 
         if ( !opt_ept_ad )
-            _vmx_ept_vpid_cap &= ~VMX_EPT_AD_BIT;
+            caps.ept &= ~VMX_EPT_AD_BIT;
 
         /*
          * Additional sanity checking before using EPT:
@@ -386,9 +384,9 @@ static int vmx_init_vmcs_config(bool bsp)
          *
          * Or we just don't use EPT.
          */
-        if ( !(_vmx_ept_vpid_cap & VMX_EPT_MEMORY_TYPE_WB) ||
-             !(_vmx_ept_vpid_cap & VMX_EPT_WALK_LENGTH_4_SUPPORTED) ||
-             !(_vmx_ept_vpid_cap & VMX_EPT_INVEPT_ALL_CONTEXT) )
+        if ( !(caps.ept & VMX_EPT_MEMORY_TYPE_WB) ||
+             !(caps.ept & VMX_EPT_WALK_LENGTH_4_SUPPORTED) ||
+             !(caps.ept & VMX_EPT_INVEPT_ALL_CONTEXT) )
             caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_EPT;
 
         /*
@@ -397,11 +395,11 @@ static int vmx_init_vmcs_config(bool bsp)
          *
          * Or we just don't use VPID.
          */
-        if ( !(_vmx_ept_vpid_cap & VMX_VPID_INVVPID_ALL_CONTEXT) )
+        if ( !(caps.vpid & VMX_VPID_INVVPID_ALL_CONTEXT) )
             caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VPID;
 
         /* EPT A/D bits is required for PML */
-        if ( !(_vmx_ept_vpid_cap & VMX_EPT_AD_BIT) )
+        if ( !(caps.ept & VMX_EPT_AD_BIT) )
             caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
     }
 
@@ -493,7 +491,6 @@ static int vmx_init_vmcs_config(bool bsp)
     {
         /* First time through. */
         vmx_caps = caps;
-        vmx_ept_vpid_cap           = _vmx_ept_vpid_cap;
         vmx_caps.basic_msr = ((uint64_t)vmx_basic_msr_high << 32) |
                              vmx_basic_msr_low;
         vmx_vmfunc                 = _vmx_vmfunc;
@@ -534,9 +531,8 @@ static int vmx_init_vmcs_config(bool bsp)
         mismatch |= cap_check(
             "VMEntry Control",
             vmx_caps.vmentry_control, caps.vmentry_control);
-        mismatch |= cap_check(
-            "EPT and VPID Capability",
-            vmx_ept_vpid_cap, _vmx_ept_vpid_cap);
+        mismatch |= cap_check("EPT Capability", vmx_caps.ept, caps.ept);
+        mismatch |= cap_check("VPID Capability", vmx_caps.vpid, caps.vpid);
         mismatch |= cap_check(
             "VMFUNC Capability",
             vmx_vmfunc, _vmx_vmfunc);
@@ -2215,7 +2211,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_ept_vpid_cap           = 0;
         vmx_vmfunc                 = 0;
     }
 
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 6a4e3cb70f..5e2af6e7cd 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -280,12 +280,11 @@ void vmx_vmcs_reload(struct vcpu *v);
 #define VMX_EPT_AD_BIT                                      0x00200000
 #define VMX_EPT_INVEPT_SINGLE_CONTEXT                       0x02000000
 #define VMX_EPT_INVEPT_ALL_CONTEXT                          0x04000000
-#define VMX_VPID_INVVPID_INSTRUCTION                     0x00100000000ULL
-#define VMX_VPID_INVVPID_INDIVIDUAL_ADDR                 0x10000000000ULL
-#define VMX_VPID_INVVPID_SINGLE_CONTEXT                  0x20000000000ULL
-#define VMX_VPID_INVVPID_ALL_CONTEXT                     0x40000000000ULL
-#define VMX_VPID_INVVPID_SINGLE_CONTEXT_RETAINING_GLOBAL 0x80000000000ULL
-extern u64 vmx_ept_vpid_cap;
+#define VMX_VPID_INVVPID_INSTRUCTION                        0x00000001
+#define VMX_VPID_INVVPID_INDIVIDUAL_ADDR                    0x00000100
+#define VMX_VPID_INVVPID_SINGLE_CONTEXT                     0x00000200
+#define VMX_VPID_INVVPID_ALL_CONTEXT                        0x00000400
+#define VMX_VPID_INVVPID_SINGLE_CONTEXT_RETAINING_GLOBAL    0x00000800
 
 #define VMX_MISC_ACTIVITY_MASK                  0x000001c0
 #define VMX_MISC_PROC_TRACE                     0x00004000
@@ -303,6 +302,8 @@ struct vmx_caps {
     uint64_t tertiary_exec_control;
     uint32_t vmexit_control;
     uint32_t vmentry_control;
+    uint32_t ept;
+    uint32_t vpid;
 };
 extern struct vmx_caps vmx_caps;
 
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index d920de96b7..843f8591b9 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -278,17 +278,17 @@ typedef union cr_access_qual {
 extern uint8_t posted_intr_vector;
 
 #define cpu_has_vmx_ept_exec_only_supported        \
-    (vmx_ept_vpid_cap & VMX_EPT_EXEC_ONLY_SUPPORTED)
+    (vmx_caps.ept & VMX_EPT_EXEC_ONLY_SUPPORTED)
 
 #define cpu_has_vmx_ept_wl4_supported           \
-    (vmx_ept_vpid_cap & VMX_EPT_WALK_LENGTH_4_SUPPORTED)
-#define cpu_has_vmx_ept_mt_uc (vmx_ept_vpid_cap & VMX_EPT_MEMORY_TYPE_UC)
-#define cpu_has_vmx_ept_mt_wb (vmx_ept_vpid_cap & VMX_EPT_MEMORY_TYPE_WB)
-#define cpu_has_vmx_ept_2mb   (vmx_ept_vpid_cap & VMX_EPT_SUPERPAGE_2MB)
-#define cpu_has_vmx_ept_1gb   (vmx_ept_vpid_cap & VMX_EPT_SUPERPAGE_1GB)
-#define cpu_has_vmx_ept_ad    (vmx_ept_vpid_cap & VMX_EPT_AD_BIT)
+    (vmx_caps.ept & VMX_EPT_WALK_LENGTH_4_SUPPORTED)
+#define cpu_has_vmx_ept_mt_uc (vmx_caps.ept & VMX_EPT_MEMORY_TYPE_UC)
+#define cpu_has_vmx_ept_mt_wb (vmx_caps.ept & VMX_EPT_MEMORY_TYPE_WB)
+#define cpu_has_vmx_ept_2mb   (vmx_caps.ept & VMX_EPT_SUPERPAGE_2MB)
+#define cpu_has_vmx_ept_1gb   (vmx_caps.ept & VMX_EPT_SUPERPAGE_1GB)
+#define cpu_has_vmx_ept_ad    (vmx_caps.ept & VMX_EPT_AD_BIT)
 #define cpu_has_vmx_ept_invept_single_context   \
-    (vmx_ept_vpid_cap & VMX_EPT_INVEPT_SINGLE_CONTEXT)
+    (vmx_caps.ept & VMX_EPT_INVEPT_SINGLE_CONTEXT)
 
 #define EPT_2MB_SHIFT     16
 #define EPT_1GB_SHIFT     17
@@ -299,11 +299,11 @@ extern uint8_t posted_intr_vector;
 #define INVEPT_ALL_CONTEXT      2
 
 #define cpu_has_vmx_vpid_invvpid_individual_addr                    \
-    (vmx_ept_vpid_cap & VMX_VPID_INVVPID_INDIVIDUAL_ADDR)
+    (vmx_caps.vpid & VMX_VPID_INVVPID_INDIVIDUAL_ADDR)
 #define cpu_has_vmx_vpid_invvpid_single_context                     \
-    (vmx_ept_vpid_cap & VMX_VPID_INVVPID_SINGLE_CONTEXT)
+    (vmx_caps.vpid & VMX_VPID_INVVPID_SINGLE_CONTEXT)
 #define cpu_has_vmx_vpid_invvpid_single_context_retaining_global    \
-    (vmx_ept_vpid_cap & VMX_VPID_INVVPID_SINGLE_CONTEXT_RETAINING_GLOBAL)
+    (vmx_caps.vpid & VMX_VPID_INVVPID_SINGLE_CONTEXT_RETAINING_GLOBAL)
 
 #define INVVPID_INDIVIDUAL_ADDR                 0
 #define INVVPID_SINGLE_CONTEXT                  1
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:57:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:57:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905109.1312900 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ99-0006Pm-V0; Fri, 07 Mar 2025 14:57:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905109.1312900; Fri, 07 Mar 2025 14:57:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ99-0006Pe-SG; Fri, 07 Mar 2025 14:57:55 +0000
Received: by outflank-mailman (input) for mailman id 905109;
 Fri, 07 Mar 2025 14:57:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ98-0006PX-8E
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:57:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ98-0071GY-1U
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:57:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ98-00Cekq-0b
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:57:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lUO271gssg3bDDIz2S686ThgSh/TGN1NyCkBTzuIYT0=; b=GrlVVyYLU3Nb+Z0eaNssD7k+LM
	DOLgv/JsGikbSMgRy0BEyOlfknZM7rHq9gFvZhgsHUoRhqU+66T8dNj6fRZr9wrbIjLNFh0xnVSvh
	plqBDR11zR+0+0Bv+66kXXwY6v4OgLMXrd/URCdWnXqtTpijAbZtZQTnWIQc9dP8l6iY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: convert vmx_vmfunc
Message-Id: <E1tqZ98-00Cekq-0b@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:57:54 +0000

commit 7e32553fa86b9fa85d97c5959a631cbe1fef5c9c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 14:00:25 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:00:25 2025 +0100

    VMX: convert vmx_vmfunc
    
    ... to a field in the capability/controls struct.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             | 10 +++-------
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  1 +
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index d8e58bd648..cfb541de13 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -164,7 +164,6 @@ static int cf_check parse_ept_param_runtime(const char *s)
 
 /* Dynamic (run-time adjusted) execution control flags. */
 struct vmx_caps __ro_after_init vmx_caps;
-static uint64_t __read_mostly vmx_vmfunc;
 
 static DEFINE_PER_CPU_READ_MOSTLY(paddr_t, vmxon_region);
 static DEFINE_PER_CPU(paddr_t, current_vmcs);
@@ -260,7 +259,6 @@ static int vmx_init_vmcs_config(bool bsp)
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     struct vmx_caps caps = {};
     u64 _vmx_misc_cap = 0;
-    u64 _vmx_vmfunc = 0;
     bool mismatch = false;
 
     rdmsr(MSR_IA32_VMX_BASIC, vmx_basic_msr_low, vmx_basic_msr_high);
@@ -463,14 +461,14 @@ static int vmx_init_vmcs_config(bool bsp)
     /* The IA32_VMX_VMFUNC MSR exists only when VMFUNC is available */
     if ( caps.secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS )
     {
-        rdmsrl(MSR_IA32_VMX_VMFUNC, _vmx_vmfunc);
+        rdmsrl(MSR_IA32_VMX_VMFUNC, caps.vmfunc);
 
         /*
          * VMFUNC leaf 0 (EPTP switching) must be supported.
          *
          * Or we just don't use VMFUNC.
          */
-        if ( !(_vmx_vmfunc & VMX_VMFUNC_EPTP_SWITCHING) )
+        if ( !(caps.vmfunc & VMX_VMFUNC_EPTP_SWITCHING) )
             caps.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VM_FUNCTIONS;
     }
 
@@ -493,7 +491,6 @@ static int vmx_init_vmcs_config(bool bsp)
         vmx_caps = caps;
         vmx_caps.basic_msr = ((uint64_t)vmx_basic_msr_high << 32) |
                              vmx_basic_msr_low;
-        vmx_vmfunc                 = _vmx_vmfunc;
 
         vmx_display_features();
 
@@ -535,7 +532,7 @@ static int vmx_init_vmcs_config(bool bsp)
         mismatch |= cap_check("VPID Capability", vmx_caps.vpid, caps.vpid);
         mismatch |= cap_check(
             "VMFUNC Capability",
-            vmx_vmfunc, _vmx_vmfunc);
+            vmx_caps.vmfunc, caps.vmfunc);
         if ( cpu_has_vmx_ins_outs_instr_info !=
              !!(vmx_basic_msr_high & (VMX_BASIC_INS_OUT_INFO >> 32)) )
         {
@@ -2211,7 +2208,6 @@ int __init vmx_vmcs_init(void)
          * Make sure all dependent features are off as well.
          */
         memset(&vmx_caps, 0, sizeof(vmx_caps));
-        vmx_vmfunc                 = 0;
     }
 
     return ret;
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 5e2af6e7cd..cde4fe011b 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -304,6 +304,7 @@ struct vmx_caps {
     uint32_t vmentry_control;
     uint32_t ept;
     uint32_t vpid;
+    uint64_t vmfunc;
 };
 extern struct vmx_caps vmx_caps;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:58:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:58:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905110.1312904 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ9J-0006Sf-W9; Fri, 07 Mar 2025 14:58:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905110.1312904; Fri, 07 Mar 2025 14:58:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ9J-0006SX-Tc; Fri, 07 Mar 2025 14:58:05 +0000
Received: by outflank-mailman (input) for mailman id 905110;
 Fri, 07 Mar 2025 14:58:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ9I-0006SJ-BG
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:58:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ9I-0071Gq-1l
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:58:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ9I-00CemU-0u
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:58:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NTAMOIpFDUqczRfujE1Of6o0XPkaX9Uy0xM/qsbYEqo=; b=H7HwwZTRwb0S2HlFqPKP5v+vFd
	JDCC5RJ8aTwlr0hGmz8720uCP8NBGL1ouEOuepAdZxjNgbKyaEMIpFsGeGMnqcClPBvuCna+KTb1I
	0SYwfeplU2SgHuXok9KBswzX5dDp9/1OSwZfpaYl6cA6gUD7zppPSnh8McekMyJSXPZo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: drop debian:11-riscv64 container
Message-Id: <E1tqZ9I-00CemU-0u@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:58:04 +0000

commit bd9bda50553b2db6f935dc8a285d817c4220d976
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Mar 6 14:01:07 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:01:07 2025 +0100

    automation: drop debian:11-riscv64 container
    
    There are two reasons for that:
    1. In the README, GCC baseline is chosen to be 12.2, whereas Debian 11
       uses GCC 10.2.1.
    2. Xen requires mandatory some Z extensions, but GCC 10.2.1 does not
       support Z extensions in -march, causing the compilation to fail.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/build.yaml | 14 --------------
 automation/scripts/containerize |  1 -
 2 files changed, 15 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 4fd800e996..034d6d9c3a 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -729,20 +729,6 @@ debian-12-ppc64le-gcc:
     HYPERVISOR_ONLY: y
 
 # RISC-V 64 cross-build
-debian-11-riscv64-gcc:
-  extends: .gcc-riscv64-cross-build
-  variables:
-    CONTAINER: debian:11-riscv64
-    KBUILD_DEFCONFIG: tiny64_defconfig
-    HYPERVISOR_ONLY: y
-
-debian-11-riscv64-gcc-debug:
-  extends: .gcc-riscv64-cross-build-debug
-  variables:
-    CONTAINER: debian:11-riscv64
-    KBUILD_DEFCONFIG: tiny64_defconfig
-    HYPERVISOR_ONLY: y
-
 debian-12-riscv64-gcc:
   extends: .gcc-riscv64-cross-build
   variables:
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index bc43136078..0953e0728c 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -31,7 +31,6 @@ case "_${CONTAINER}" in
     _fedora) CONTAINER="${BASE}/fedora:41-x86_64";;
     _bullseye-ppc64le) CONTAINER="${BASE}/debian:11-ppc64le" ;;
     _bookworm-ppc64le) CONTAINER="${BASE}/debian:12-ppc64le" ;;
-    _bullseye-riscv64) CONTAINER="${BASE}/debian:11-riscv64" ;;
     _bookworm-riscv64) CONTAINER="${BASE}/debian:12-riscv64" ;;
     _bookworm-x86_64-gcc-ibt) CONTAINER="${BASE}/debian:12-x86_64-gcc-ibt" ;;
     _bookworm|_bookworm-x86_64|_) CONTAINER="${BASE}/debian:12-x86_64" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:58:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:58:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905111.1312908 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ9T-0006VF-1O; Fri, 07 Mar 2025 14:58:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905111.1312908; Fri, 07 Mar 2025 14:58:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ9S-0006V7-Uy; Fri, 07 Mar 2025 14:58:14 +0000
Received: by outflank-mailman (input) for mailman id 905111;
 Fri, 07 Mar 2025 14:58:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ9S-0006V1-EL
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:58:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ9S-0071Gw-26
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:58:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ9S-00CenN-1B
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:58:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gZkqCNeOCyDofzVfQYhWaF1ITZJONYSm8+bp3MuyZ3k=; b=t8lBPzI/a1a2E5xbPLBKUjk+Kt
	O4kL4s94HIwUpOYZFRqMPW8YrdXmT/2KpNVoOnRue8veXHwSn+OD//Kc0udpqurv+CMMzXEua/lZa
	BOpt6t6TSw6RcawA1cIE7g7NWWXF6SsZgkPLwyhPzgt9wwzm/TjHisv/GFLbWUUGjawE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: drop CONFIG_RISCV_ISA_RV64G
Message-Id: <E1tqZ9S-00CenN-1B@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:58:14 +0000

commit 60def0d6e49f6fc032c534649a7e05ef2c4c30c0
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Mar 6 14:01:26 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:01:26 2025 +0100

    xen/riscv: drop CONFIG_RISCV_ISA_RV64G
    
    'G' stands for "imafd_zicsr_zifencei".
    
    Extensions 'f' and 'd' aren't really needed for Xen, and allowing floating
    point registers to be used can lead to crashes.
    
    Extensions 'i', 'm', 'a', 'zicsr', and 'zifencei' are necessary for the
    operation of Xen, which is why they are used explicitly (unconditionally)
    in -march.
    
    Drop "Base ISA" choice from riscv/Kconfig as it is always empty.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Kconfig | 18 ------------------
 xen/arch/riscv/arch.mk |  8 +++++---
 2 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index fa95cd0a42..d882e0a059 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -23,24 +23,6 @@ endmenu
 
 menu "ISA Selection"
 
-choice
-	prompt "Base ISA"
-	default RISCV_ISA_RV64G if RISCV_64
-	help
-	  This selects the base ISA extensions that Xen will target.
-
-config RISCV_ISA_RV64G
-	bool "RV64G"
-	help
-	  Use the RV64I base ISA, plus
-	  "M" for multiply/divide,
-	  "A" for atomic instructions,
-	  “F”/"D" for  {single/double}-precision floating-point instructions,
-	  "Zicsr" for control and status register access,
-	  "Zifencei" for instruction-fetch fence.
-
-endchoice
-
 config RISCV_ISA_C
 	bool "Compressed extension"
 	default y
diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 17827c302c..3034da76cb 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -6,10 +6,12 @@ $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 riscv-abi-$(CONFIG_RISCV_32) := -mabi=ilp32
 riscv-abi-$(CONFIG_RISCV_64) := -mabi=lp64
 
-riscv-march-$(CONFIG_RISCV_ISA_RV64G) := rv64g
-riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
+riscv-march-$(CONFIG_RISCV_64) := rv64
+riscv-march-y += ima
+riscv-march-$(CONFIG_RISCV_ISA_C) += c
+riscv-march-y += _zicsr_zifencei
 
-riscv-generic-flags := $(riscv-abi-y) -march=$(riscv-march-y)
+riscv-generic-flags := $(riscv-abi-y) -march=$(subst $(space),,$(riscv-march-y))
 
 # check-extension: Check whether extenstion is supported by a compiler and
 #                  an assembler.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:58:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:58:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905112.1312912 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ9d-0006Y5-2t; Fri, 07 Mar 2025 14:58:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905112.1312912; Fri, 07 Mar 2025 14:58:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ9d-0006Xx-0A; Fri, 07 Mar 2025 14:58:25 +0000
Received: by outflank-mailman (input) for mailman id 905112;
 Fri, 07 Mar 2025 14:58:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ9c-0006Xr-Gm
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:58:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ9c-0071HQ-2L
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:58:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ9c-00Ceok-1W
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:58:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Zczr+agwn4csPaxUgx40AZ5u7m21rMurzYcrLZ+64f0=; b=r9x4qPxr78i7CY0BvbkLXEKAWF
	D0j1Kmt0aEs13KQvoXuylvsz86arhvjAO+WnO43yCZdkCWL5w8S36leR98Si+fSZiQMGDeTQmBKDw
	8rWJwjYbkjWoH0TfEEfdneQAxSo3iu+TS06h9X5NNMcdVDQAgndBmpxuBui8ljNqmfWc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: make zbb as mandatory
Message-Id: <E1tqZ9c-00Ceok-1W@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:58:24 +0000

commit 4c91847903915aa99172d054e1add85e65afc264
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Mar 6 14:01:53 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:01:53 2025 +0100

    xen/riscv: make zbb as mandatory
    
    According to riscv/booting.txt, it is expected that Zbb should be supported.
    
    Drop ANDN_INSN() in asm/cmpxchg.h as Zbb is mandatory now so `andn`
    instruction could be used directly.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/arch.mk               |  7 ++-----
 xen/arch/riscv/include/asm/cmpxchg.h | 15 +--------------
 2 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 3034da76cb..236ea7c8a6 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -9,7 +9,7 @@ riscv-abi-$(CONFIG_RISCV_64) := -mabi=lp64
 riscv-march-$(CONFIG_RISCV_64) := rv64
 riscv-march-y += ima
 riscv-march-$(CONFIG_RISCV_ISA_C) += c
-riscv-march-y += _zicsr_zifencei
+riscv-march-y += _zicsr_zifencei_zbb
 
 riscv-generic-flags := $(riscv-abi-y) -march=$(subst $(space),,$(riscv-march-y))
 
@@ -25,13 +25,10 @@ $(eval $(1) := \
 	$(call as-insn,$(CC) $(riscv-generic-flags)_$(1),$(value $(1)-insn),_$(1)))
 endef
 
-zbb-insn := "andn t0$(comma)t0$(comma)t0"
-$(call check-extension,zbb)
-
 zihintpause-insn := "pause"
 $(call check-extension,zihintpause)
 
-extensions := $(zbb) $(zihintpause)
+extensions := $(zihintpause)
 
 extensions := $(subst $(space),,$(extensions))
 
diff --git a/xen/arch/riscv/include/asm/cmpxchg.h b/xen/arch/riscv/include/asm/cmpxchg.h
index 662d3fd5d4..7d7c89b6fa 100644
--- a/xen/arch/riscv/include/asm/cmpxchg.h
+++ b/xen/arch/riscv/include/asm/cmpxchg.h
@@ -18,19 +18,6 @@
         : "r" (new) \
         : "memory" );
 
-/*
- * To not face an issue that gas doesn't understand ANDN instruction
- * it is encoded using .insn directive.
- */
-#ifdef __riscv_zbb
-#define ANDN_INSN(rd, rs1, rs2)                 \
-    ".insn r OP, 0x7, 0x20, " rd ", " rs1 ", " rs2 "\n"
-#else
-#define ANDN_INSN(rd, rs1, rs2)                 \
-    "not " rd ", " rs2 "\n"                     \
-    "and " rd ", " rs1 ", " rd "\n"
-#endif
-
 /*
  * For LR and SC, the A extension requires that the address held in rs1 be
  * naturally aligned to the size of the operand (i.e., eight-byte aligned
@@ -61,7 +48,7 @@
     \
     asm volatile ( \
         "0: lr.w" lr_sfx " %[old], %[ptr_]\n" \
-        ANDN_INSN("%[scratch]", "%[old]", "%[mask]") \
+        "   andn  %[scratch], %[old], %[mask]\n" \
         "   or   %[scratch], %[scratch], %z[new_]\n" \
         "   sc.w" sc_sfx " %[scratch], %[scratch], %[ptr_]\n" \
         "   bnez %[scratch], 0b\n" \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:58:35 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:58:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905113.1312916 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ9n-0006ad-4j; Fri, 07 Mar 2025 14:58:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905113.1312916; Fri, 07 Mar 2025 14:58:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ9n-0006aV-1Y; Fri, 07 Mar 2025 14:58:35 +0000
Received: by outflank-mailman (input) for mailman id 905113;
 Fri, 07 Mar 2025 14:58:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ9m-0006aP-Jv
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:58:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ9m-0071HV-2e
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:58:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ9m-00Cepi-1m
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:58:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y1gGdhR4iiBKqOlLt9FQcZsvJWPHiWl+J+eFOxxi+Do=; b=AA53qBQReADPsUySpLU5ql8w3r
	VqTxJgKYhg263LaVLu+auOPbQOkFgPzUyyZ1XF33jKuAziUjaYmilOOqqcn9XRL+3liHsupypaxxr
	kJkoQC5inLDMbx5XW/qw4HxA9F9dcNgFv7rFid+pYS0v9Ulfs6I9rlFt+Wd2+bu1LmWY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: identify specific ISA supported by cpu
Message-Id: <E1tqZ9m-00Cepi-1m@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:58:34 +0000

commit f74ebf58b51826841bf1859cd42f1361549ef1e1
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Mar 6 14:02:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:02:51 2025 +0100

    xen/riscv: identify specific ISA supported by cpu
    
    Supported ISA extensions are specified in the device tree within the CPU
    node, using two properties: `riscv,isa-extensions` and `riscv,isa`.
    
    Currently, Xen does not support the `riscv,isa-extensions` property and
    will be added in the future.
    
    The `riscv,isa` property is parsed for each CPU, and the common extensions
    are stored in the `host_riscv_isa` bitmap.
    This bitmap is then used by `riscv_isa_extension_available()` to check
    if a specific extension is supported.
    
    The current implementation is based on Linux kernel v6.12-rc3
    implementation with the following changes:
     - Drop unconditional setting of {RISCV_ISA_EXT_ZICSR,
       RISCV_ISA_EXT_ZIFENCEI, RISCV_ISA_EXT_ZICNTR, RISCV_ISA_EXT_ZIHPM} because
       Xen is going to run on hardware produced after the aforementioned
       extensions were split out of "i".
     - Remove saving of the ISA for each CPU, only the common available ISA is
       saved.
     - Remove ACPI-related code as ACPI is not supported by Xen.
     - Drop handling of elf_hwcap, since Xen does not provide hwcap to
       userspace.
     - Replace of_cpu_device_node_get() API, which is not available in Xen,
       with a combination of dt_for_each_child_node(), dt_device_type_is_equal(),
       and dt_get_cpuid_from_node() to retrieve cpuid and riscv,isa in
       riscv_fill_hwcap_from_isa_string().
     - Rename arguments of __RISCV_ISA_EXT_DATA() from _name to ext_name, and
       _id to ext_id for clarity.
     - Replace instances of __RISCV_ISA_EXT_DATA with RISCV_ISA_EXT_DATA.
     - Replace instances of __riscv_isa_extension_available with
       riscv_isa_extension_available for consistency. Also, update the type of
       `bit` argument of riscv_isa_extension_available().
     - Redefine RISCV_ISA_EXT_DATA() to work only with ext_name and ext_id,
       as other fields are not used in Xen currently. Also RISCV_ISA_EXT_DATA()
       is reworked in the way to take only one argument `ext_name`.
     - Add check of first 4 letters of riscv,isa string to
       riscv_isa_parse_string() as Xen doesn't do this check before so it is
       necessary to check correctness of riscv,isa string. ( it should start with
       rv{32,64} with taking into account upper and lower case of "rv").
       Additionally, check also that 'i' goes after 'rv{32,64}' to be sure that
       `out_bitmap` can't be empty.
     - Drop an argument of riscv_fill_hwcap() and riscv_fill_hwcap_from_isa_string()
       as it isn't used, at the moment.
     - Update the comment message about QEMU workaround.
     - Apply Xen coding style.
     - s/pr_info/printk.
     - Drop handling of uppercase letters of riscv,isa in riscv_isa_parse_string() as
       Xen checks that riscv,isa should be in lowercase according to the device tree
       bindings.
     - Update logic of riscv_isa_parse_string(): now it stops parsing of riscv,isa
       if illegal symbol was found instead of ignoring them.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Makefile                 |   1 +
 xen/arch/riscv/cpufeature.c             | 504 ++++++++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/cpufeature.h |  59 ++++
 xen/arch/riscv/setup.c                  |   3 +
 4 files changed, 567 insertions(+)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index a5eb2aed4b..b0c8270a99 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -1,3 +1,4 @@
+obj-y += cpufeature.o
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 obj-y += entry.o
 obj-y += mm.o
diff --git a/xen/arch/riscv/cpufeature.c b/xen/arch/riscv/cpufeature.c
new file mode 100644
index 0000000000..bf09aa1170
--- /dev/null
+++ b/xen/arch/riscv/cpufeature.c
@@ -0,0 +1,504 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Originally taken for Linux kernel v6.12-rc3.
+ *
+ * Copyright (C) 2015 ARM Ltd.
+ * Copyright (C) 2017 SiFive
+ * Copyright (C) 2024 Vates
+ */
+
+#include <xen/bitmap.h>
+#include <xen/ctype.h>
+#include <xen/device_tree.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/sections.h>
+
+#include <asm/cpufeature.h>
+
+#ifdef CONFIG_ACPI
+# error "cpufeature.c functions should be updated to support ACPI"
+#endif
+
+struct riscv_isa_ext_data {
+    unsigned int id;
+    const char *name;
+};
+
+#define RISCV_ISA_EXT_DATA(ext_name)            \
+{                                               \
+    .id = RISCV_ISA_EXT_ ## ext_name,           \
+    .name = #ext_name,                          \
+}
+
+/* Host ISA bitmap */
+static __ro_after_init DECLARE_BITMAP(riscv_isa, RISCV_ISA_EXT_MAX);
+
+static int __init dt_get_cpuid_from_node(const struct dt_device_node *cpu,
+                                         unsigned long *dt_cpuid)
+{
+    const __be32 *prop;
+    unsigned int reg_len;
+
+    /*
+     * For debug purpose check dt_n_size_cells(cpu) value.
+     *
+     * Based on DT's bindings [1] and RISC-V's DTS files in kernel #size-cells
+     * for cpu node is expected to be 0.
+     *
+     * [1] https://www.kernel.org/doc/Documentation/devicetree/bindings/riscv/cpus.txt
+     */
+    if ( dt_n_size_cells(cpu) != 0 )
+        printk("DT's cpu node `%s`: #size-cells %d\n",
+               dt_node_full_name(cpu), dt_n_size_cells(cpu));
+
+    prop = dt_get_property(cpu, "reg", &reg_len);
+    if ( !prop )
+    {
+        printk("cpu node `%s`: has no reg property\n", dt_node_full_name(cpu));
+        return -EINVAL;
+    }
+
+    if ( reg_len < dt_cells_to_size(dt_n_addr_cells(cpu)) )
+    {
+        printk("cpu node `%s`: reg property too short\n",
+               dt_node_full_name(cpu));
+        return -EINVAL;
+    }
+
+    /*
+     * It is safe to convert `paddr_t` to `unsigned long` as dt_read_paddr()
+     * in the context of this function returns cpuid which according to RISC-V
+     * specification could be from 0 to ((1ULL << (MXLEN)) - 1), where
+     * MXLEN=32 for RV32 and MXLEN=64 for RV64.
+     */
+    *dt_cpuid = dt_read_paddr(prop, dt_n_addr_cells(cpu));
+
+    return 0;
+}
+
+/*
+ * The canonical order of ISA extension names in the ISA string is defined in
+ * chapter 27 of the unprivileged specification.
+ *
+ * The specification uses vague wording, such as should, when it comes to
+ * ordering, so for our purposes the following rules apply:
+ *
+ * 1. All multi-letter extensions must be separated from other extensions by an
+ *    underscore.
+ *
+ * 2. Additional standard extensions (starting with 'Z') must be sorted after
+ *    single-letter extensions and before any higher-privileged extensions.
+ *
+ * 3. The first letter following the 'Z' conventionally indicates the most
+ *    closely related alphabetical extension category, IMAFDQLCBKJTPVH.
+ *    If multiple 'Z' extensions are named, they must be ordered first by
+ *    category, then alphabetically within a category.
+ *
+ * 4. Standard supervisor-level extensions (starting with 'S') must be listed
+ *    after standard unprivileged extensions.  If multiple supervisor-level
+ *    extensions are listed, they must be ordered alphabetically.
+ *
+ * 5. Standard machine-level extensions (starting with 'Zxm') must be listed
+ *    after any lower-privileged, standard extensions.  If multiple
+ *    machine-level extensions are listed, they must be ordered
+ *    alphabetically.
+ *
+ * 6. Non-standard extensions (starting with 'X') must be listed after all
+ *    standard extensions. If multiple non-standard extensions are listed, they
+ *    must be ordered alphabetically.
+ *
+ * An example string following the order is:
+ *    rv64imadc_zifoo_zigoo_zafoo_sbar_scar_zxmbaz_xqux_xrux
+ *
+ * New entries to this struct should follow the ordering rules described above.
+ *
+ * Extension name must be all lowercase (according to device-tree binding)
+ * and strncmp() is used in match_isa_ext() to compare extension names instead
+ * of strncasecmp().
+ */
+const struct riscv_isa_ext_data __initconst riscv_isa_ext[] = {
+    RISCV_ISA_EXT_DATA(i),
+    RISCV_ISA_EXT_DATA(m),
+    RISCV_ISA_EXT_DATA(a),
+    RISCV_ISA_EXT_DATA(f),
+    RISCV_ISA_EXT_DATA(d),
+    RISCV_ISA_EXT_DATA(q),
+    RISCV_ISA_EXT_DATA(c),
+    RISCV_ISA_EXT_DATA(h),
+    RISCV_ISA_EXT_DATA(zicntr),
+    RISCV_ISA_EXT_DATA(zicsr),
+    RISCV_ISA_EXT_DATA(zifencei),
+    RISCV_ISA_EXT_DATA(zihintpause),
+    RISCV_ISA_EXT_DATA(zihpm),
+    RISCV_ISA_EXT_DATA(zba),
+    RISCV_ISA_EXT_DATA(zbb),
+    RISCV_ISA_EXT_DATA(zbs),
+    RISCV_ISA_EXT_DATA(smaia),
+    RISCV_ISA_EXT_DATA(ssaia),
+};
+
+static const struct riscv_isa_ext_data __initconst required_extensions[] = {
+    RISCV_ISA_EXT_DATA(i),
+    RISCV_ISA_EXT_DATA(m),
+    RISCV_ISA_EXT_DATA(a),
+#ifdef CONFIG_RISCV_ISA_C
+    RISCV_ISA_EXT_DATA(c),
+#endif
+    RISCV_ISA_EXT_DATA(zicsr),
+    RISCV_ISA_EXT_DATA(zifencei),
+    RISCV_ISA_EXT_DATA(zihintpause),
+    RISCV_ISA_EXT_DATA(zbb),
+};
+
+static bool __init is_lowercase_extension_name(const char *str)
+{
+    /*
+     * `str` could contain full riscv,isa string from device tree so one
+     * of the stop conditions is checking for '_' as extensions are
+     * separated by '_'.
+     */
+    for ( unsigned int i = 0; (str[i] != '\0') && (str[i] != '_'); i++ )
+        if ( !isdigit(str[i]) && !islower(str[i]) )
+            return false;
+
+    return true;
+}
+
+static void __init match_isa_ext(const char *name, const char *name_end,
+                                 unsigned long *bitmap)
+{
+    const size_t riscv_isa_ext_count = ARRAY_SIZE(riscv_isa_ext);
+
+    for ( unsigned int i = 0; i < riscv_isa_ext_count; i++ )
+    {
+        const struct riscv_isa_ext_data *ext = &riscv_isa_ext[i];
+
+        /*
+         * `ext->name` (according to initialization of riscv_isa_ext[]
+         * elements) must be all in lowercase.
+         */
+        ASSERT(is_lowercase_extension_name(ext->name));
+
+        if ( (name_end - name == strlen(ext->name)) &&
+             !memcmp(name, ext->name, name_end - name) )
+        {
+            __set_bit(ext->id, bitmap);
+            break;
+        }
+    }
+}
+
+static int __init riscv_isa_parse_string(const char *isa,
+                                         unsigned long *out_bitmap)
+{
+    if ( (isa[0] != 'r') && (isa[1] != 'v') )
+        return -EINVAL;
+
+#if defined(CONFIG_RISCV_32)
+    if ( isa[2] != '3' && isa[3] != '2' )
+        return -EINVAL;
+#elif defined(CONFIG_RISCV_64)
+    if ( isa[2] != '6' && isa[3] != '4' )
+        return -EINVAL;
+#else
+# error "unsupported RISC-V bitness"
+#endif
+
+    /*
+     * In unpriv. specification (*_20240411) is mentioned the following:
+     * (1) A RISC-V ISA is defined as a base integer ISA, which must be
+     *     present in any implementation, plus optional extensions to
+     *     the base ISA.
+     * (2) Chapter 6 describes the RV32E and RV64E subset variants of
+     *     the RV32I or RV64I base instruction sets respectively, which
+     *     have been added to support small microcontrollers, and which
+     *     have half the number of integer registers.
+     *
+     * What means that isa should contain, at least, I or E.
+     *
+     * As Xen isn't expected to be run on microcontrollers and according
+     * to device tree binding the first extension should be "i".
+     */
+    if ( isa[4] != 'i' )
+        return -EINVAL;
+
+    isa += 4;
+
+    while ( *isa )
+    {
+        const char *ext = isa++;
+        const char *ext_end = isa;
+
+        switch ( *ext )
+        {
+        case 'x':
+            printk_once("Vendor extensions are ignored in riscv,isa\n");
+            /*
+             * To skip an extension, we find its end.
+             * As multi-letter extensions must be split from other multi-letter
+             * extensions with an "_", the end of a multi-letter extension will
+             * either be the null character or the "_" at the start of the next
+             * multi-letter extension.
+             */
+            for ( ; *isa && *isa != '_'; ++isa )
+                if ( unlikely(!isalnum(*isa)) )
+                    goto riscv_isa_parse_string_err;
+
+            ext_end = NULL;
+            break;
+
+        case 's':
+            /*
+             * Workaround for invalid single-letter 's' & 'u' (QEMU):
+             *   Before QEMU 7.1 it was an issue with misa to ISA string
+             *   conversion:
+             *     https://patchwork.kernel.org/project/qemu-devel/patch/dee09d708405075420b29115c1e9e87910b8da55.1648270894.git.research_trasio@irq.a4lg.com/#24792587
+             *   Additional details of the workaround on Linux kernel side:
+             *     https://lore.kernel.org/linux-riscv/ae93358e-e117-b43d-faad-772c529f846c@irq.a4lg.com/#t
+             *
+             * No need to set the bit in riscv_isa as 's' & 'u' are
+             * not valid ISA extensions. It works unless the first
+             * multi-letter extension in the ISA string begins with
+             * "Su" and is not prefixed with an underscore.
+             */
+            if ( ext[-1] != '_' && ext[1] == 'u' )
+            {
+                ++isa;
+                ext_end = NULL;
+                break;
+            }
+            fallthrough;
+        case 'z':
+            /*
+             * Before attempting to parse the extension itself, we find its end.
+             * As multi-letter extensions must be split from other multi-letter
+             * extensions with an "_", the end of a multi-letter extension will
+             * either be the null character or the "_" at the start of the next
+             * multi-letter extension.
+             *
+             * Next, as the extensions version is currently ignored, we
+             * eliminate that portion. This is done by parsing backwards from
+             * the end of the extension, removing any numbers. This may be a
+             * major or minor number however, so the process is repeated if a
+             * minor number was found.
+             *
+             * ext_end is intended to represent the first character *after* the
+             * name portion of an extension, but will be decremented to the last
+             * character itself while eliminating the extensions version number.
+             * A simple re-increment solves this problem.
+             */
+            for ( ; *isa && *isa != '_'; ++isa )
+                if ( unlikely(!isalnum(*isa)) )
+                    goto riscv_isa_parse_string_err;
+
+            ext_end = isa;
+
+            if ( !isdigit(ext_end[-1]) )
+                break;
+
+            while ( isdigit(*--ext_end) )
+                ;
+
+            if ( ext_end[0] != 'p' || !isdigit(ext_end[-1]) )
+            {
+                ++ext_end;
+                break;
+            }
+
+            while ( isdigit(*--ext_end) )
+                ;
+
+            ++ext_end;
+            break;
+
+        /*
+         * If someone mentioned `b` extension in riscv,isa instead of Zb{a,b,s}
+         * explicitly then set bits exlicitly in out_bitmap to satisfy
+         * requirement of Zbb (mentioned in required_extensions[]).
+         */
+        case 'b':
+            __set_bit(RISCV_ISA_EXT_zba, out_bitmap);
+            __set_bit(RISCV_ISA_EXT_zbb, out_bitmap);
+            __set_bit(RISCV_ISA_EXT_zbs, out_bitmap);
+            fallthrough;
+        default:
+            /*
+             * Things are a little easier for single-letter extensions, as they
+             * are parsed forwards.
+             *
+             * After checking that our starting position is valid, we need to
+             * ensure that, when isa was incremented at the start of the loop,
+             * that it arrived at the start of the next extension.
+             *
+             * If we are already on a non-digit, there is nothing to do. Either
+             * we have a multi-letter extension's _, or the start of an
+             * extension.
+             *
+             * Otherwise we have found the current extension's major version
+             * number. Parse past it, and a subsequent p/minor version number
+             * if present. The `p` extension must not appear immediately after
+             * a number, so there is no fear of missing it.
+             */
+            if ( unlikely(!isalpha(*ext)) )
+                goto riscv_isa_parse_string_err;
+
+            if ( !isdigit(*isa) )
+                break;
+
+            while ( isdigit(*++isa) )
+                ;
+
+            if ( *isa != 'p' )
+                break;
+
+            if ( !isdigit(*++isa) )
+            {
+                --isa;
+                break;
+            }
+
+            while ( isdigit(*++isa) )
+                ;
+
+            break;
+        }
+
+        /*
+         * The parser expects that at the start of an iteration isa points to the
+         * first character of the next extension. As we stop parsing an extension
+         * on meeting a non-alphanumeric character, an extra increment is needed
+         * where the succeeding extension is a multi-letter prefixed with an "_".
+         */
+        if ( *isa == '_' )
+            ++isa;
+
+        if ( unlikely(!ext_end) )
+            continue;
+
+        match_isa_ext(ext, ext_end, out_bitmap);
+    }
+
+    return 0;
+
+ riscv_isa_parse_string_err:
+    printk("illegal symbol '%c' in riscv,isa string\n", *isa);
+    return -EINVAL;
+}
+
+static void __init riscv_fill_hwcap_from_isa_string(void)
+{
+    const struct dt_device_node *cpus = dt_find_node_by_path("/cpus");
+    const struct dt_device_node *cpu;
+
+    if ( !cpus )
+    {
+        printk("Missing /cpus node in the device tree?\n");
+        return;
+    }
+
+    dt_for_each_child_node(cpus, cpu)
+    {
+        DECLARE_BITMAP(this_isa, RISCV_ISA_EXT_MAX);
+        const char *isa;
+        unsigned long cpuid;
+
+        if ( !dt_device_type_is_equal(cpu, "cpu") )
+            continue;
+
+        if ( dt_get_cpuid_from_node(cpu, &cpuid) < 0 )
+            continue;
+
+        if ( dt_property_read_string(cpu, "riscv,isa", &isa) )
+        {
+            printk("Unable to find \"riscv,isa\" devicetree entry "
+                   "for DT's cpu%ld node\n", cpuid);
+            continue;
+        }
+
+        for ( unsigned int i = 0; (isa[i] != '\0'); i++ )
+            if ( !isdigit(isa[i]) && (isa[i] != '_') && !islower(isa[i]) )
+                panic("According to DT binding riscv,isa must be lowercase\n");
+
+        if ( riscv_isa_parse_string(isa, this_isa) )
+            panic("Check riscv,isa in dts file\n");
+
+        if ( bitmap_empty(riscv_isa, RISCV_ISA_EXT_MAX) )
+            bitmap_copy(riscv_isa, this_isa, RISCV_ISA_EXT_MAX);
+        else
+            bitmap_and(riscv_isa, riscv_isa, this_isa, RISCV_ISA_EXT_MAX);
+    }
+}
+
+static bool __init has_isa_extensions_property(void)
+{
+    const struct dt_device_node *cpus = dt_find_node_by_path("/cpus");
+    const struct dt_device_node *cpu;
+
+    if ( !cpus )
+    {
+        printk("Missing /cpus node in the device tree?\n");
+        return false;
+    }
+
+    dt_for_each_child_node(cpus, cpu)
+    {
+        const char *isa;
+
+        if ( !dt_device_type_is_equal(cpu, "cpu") )
+            continue;
+
+        if ( dt_property_read_string(cpu, "riscv,isa-extensions", &isa) )
+            continue;
+
+        return true;
+    }
+
+    return false;
+}
+
+bool riscv_isa_extension_available(const unsigned long *isa_bitmap,
+                                   enum riscv_isa_ext_id id)
+{
+    if ( !isa_bitmap )
+        isa_bitmap = riscv_isa;
+
+    if ( id >= RISCV_ISA_EXT_MAX )
+        return false;
+
+    return test_bit(id, isa_bitmap);
+}
+
+void __init riscv_fill_hwcap(void)
+{
+    unsigned int i;
+    const size_t req_extns_amount = ARRAY_SIZE(required_extensions);
+    bool all_extns_available = true;
+
+    riscv_fill_hwcap_from_isa_string();
+
+    if ( bitmap_empty(riscv_isa, RISCV_ISA_EXT_MAX) )
+    {
+        const char *failure_msg = has_isa_extensions_property() ?
+                                  "\"riscv,isa-extension\" isn't supported" :
+                                  "\"riscv,isa\" parsing failed";
+
+        panic("HW capabilities parsing failed: %s\n", failure_msg);
+    }
+
+    for ( i = 0; i < req_extns_amount; i++ )
+    {
+        const struct riscv_isa_ext_data ext = required_extensions[i];
+
+        if ( !riscv_isa_extension_available(NULL, ext.id) )
+        {
+            printk("Xen requires extension: %s\n", ext.name);
+            all_extns_available = false;
+        }
+    }
+
+    if ( !all_extns_available )
+        panic("Look why the extensions above are needed in "
+              "https://xenbits.xenproject.org/docs/unstable/misc/riscv/booting.txt\n");
+}
diff --git a/xen/arch/riscv/include/asm/cpufeature.h b/xen/arch/riscv/include/asm/cpufeature.h
new file mode 100644
index 0000000000..1015b6ee44
--- /dev/null
+++ b/xen/arch/riscv/include/asm/cpufeature.h
@@ -0,0 +1,59 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef ASM__RISCV__CPUFEATURE_H
+#define ASM__RISCV__CPUFEATURE_H
+
+#ifndef __ASSEMBLY__
+
+#include <xen/stdbool.h>
+
+/*
+ * These macros represent the logical IDs of each multi-letter RISC-V ISA
+ * extension and are used in the ISA bitmap. The logical IDs start from
+ * RISCV_ISA_EXT_BASE, which allows the 0-25 range to be reserved for single
+ * letter extensions and are used in enum riscv_isa_ext_id.
+ *
+ * New extensions should just be added to the bottom, rather than added
+ * alphabetically, in order to avoid unnecessary shuffling.
+ */
+#define RISCV_ISA_EXT_BASE  26
+
+enum riscv_isa_ext_id {
+    RISCV_ISA_EXT_a,
+    RISCV_ISA_EXT_c,
+    RISCV_ISA_EXT_d,
+    RISCV_ISA_EXT_f,
+    RISCV_ISA_EXT_h,
+    RISCV_ISA_EXT_i,
+    RISCV_ISA_EXT_m,
+    RISCV_ISA_EXT_q,
+    RISCV_ISA_EXT_v,
+    RISCV_ISA_EXT_zicntr = RISCV_ISA_EXT_BASE,
+    RISCV_ISA_EXT_zicsr,
+    RISCV_ISA_EXT_zifencei,
+    RISCV_ISA_EXT_zihintpause,
+    RISCV_ISA_EXT_zihpm,
+    RISCV_ISA_EXT_zba,
+    RISCV_ISA_EXT_zbb,
+    RISCV_ISA_EXT_zbs,
+    RISCV_ISA_EXT_smaia,
+    RISCV_ISA_EXT_ssaia,
+    RISCV_ISA_EXT_MAX
+};
+
+void riscv_fill_hwcap(void);
+
+bool riscv_isa_extension_available(const unsigned long *isa_bitmap,
+                                   enum riscv_isa_ext_id id);
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* ASM__RISCV__CPUFEATURE_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index f2b6e684ac..b0e587678e 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -13,6 +13,7 @@
 
 #include <public/version.h>
 
+#include <asm/cpufeature.h>
 #include <asm/early_printk.h>
 #include <asm/fixmap.h>
 #include <asm/sbi.h>
@@ -123,6 +124,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
         panic("Booting using ACPI isn't supported\n");
     }
 
+    riscv_fill_hwcap();
+
     printk("All set up\n");
 
     machine_halt();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:58:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:58:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905114.1312920 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ9x-0006dd-7F; Fri, 07 Mar 2025 14:58:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905114.1312920; Fri, 07 Mar 2025 14:58:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZ9x-0006dV-4W; Fri, 07 Mar 2025 14:58:45 +0000
Received: by outflank-mailman (input) for mailman id 905114;
 Fri, 07 Mar 2025 14:58:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZ9w-0006dP-MX
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:58:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ9w-0071Hd-2v
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:58:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZ9w-00CeqW-24
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:58:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UaYVdSlJAXTO4lri5xaya+W06Z5pNEnDfpO7Ke68e38=; b=W0NRUrUFWWxI48aori4b2SKlcG
	L4Jc5XUeQ+lag+QrnhGxJBGv0t5bGyP2LEfaYjq8unqv+aeDsY9AlRq7eDWk2ESuCbfzEqSIbTQcE
	H8Bhthf2r2x/kUogmrCXzY76D+ElDP+iY4byRO2K3EVTZJdAzW+ooGCDmyxZIxyHXQV4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] RISCV/bitops: Use Zbb to provide arch-optimised bitops
Message-Id: <E1tqZ9w-00CeqW-24@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:58:44 +0000

commit 7388912f275653a58769d8e77ac4d4cd452b7d37
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 6 14:03:15 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:03:15 2025 +0100

    RISCV/bitops: Use Zbb to provide arch-optimised bitops
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/riscv/include/asm/bitops.h | 7 +++++++
 xen/arch/riscv/include/asm/config.h | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/xen/arch/riscv/include/asm/bitops.h b/xen/arch/riscv/include/asm/bitops.h
index d22eec1e87..72a4a8c155 100644
--- a/xen/arch/riscv/include/asm/bitops.h
+++ b/xen/arch/riscv/include/asm/bitops.h
@@ -125,6 +125,13 @@ static inline void clear_bit(int nr, volatile void *p)
 #undef NOT
 #undef __AMO
 
+#define arch_ffs(x)     ((x) ? 1 + __builtin_ctz(x) : 0)
+#define arch_ffsl(x)    ((x) ? 1 + __builtin_ctzl(x) : 0)
+#define arch_fls(x)     ((x) ? BITS_PER_INT - __builtin_clz(x) : 0)
+#define arch_flsl(x)    ((x) ? BITS_PER_LONG - __builtin_clzl(x) : 0)
+
+#define arch_hweightl(x) __builtin_popcountl(x)
+
 #endif /* ASM__RISCV__BITOPS_H */
 
 /*
diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/asm/config.h
index 826e5c7172..7141bd9e46 100644
--- a/xen/arch/riscv/include/asm/config.h
+++ b/xen/arch/riscv/include/asm/config.h
@@ -119,6 +119,7 @@
 #define HYPERVISOR_VIRT_START XEN_VIRT_START
 
 #if defined(CONFIG_RISCV_64)
+# define INT_BYTEORDER 2
 # define LONG_BYTEORDER 3
 # define ELFSIZE 64
 # define MAX_VIRT_CPUS 128u
@@ -126,6 +127,9 @@
 # error "Unsupported RISCV variant"
 #endif
 
+#define BYTES_PER_INT  (1 << INT_BYTEORDER)
+#define BITS_PER_INT  (BYTES_PER_INT << 3)
+
 #define BYTES_PER_LONG (1 << LONG_BYTEORDER)
 #define BITS_PER_LONG  (BYTES_PER_LONG << 3)
 #define POINTER_ALIGN  BYTES_PER_LONG
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:58:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:58:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905115.1312925 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZA7-0006g3-8x; Fri, 07 Mar 2025 14:58:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905115.1312925; Fri, 07 Mar 2025 14:58:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZA7-0006fv-60; Fri, 07 Mar 2025 14:58:55 +0000
Received: by outflank-mailman (input) for mailman id 905115;
 Fri, 07 Mar 2025 14:58:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZA6-0006fp-PM
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:58:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZA6-0071Hi-3C
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:58:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZA6-00Ceun-2L
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:58:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NmqTA6zT5Jvi4MmqVhjNWOi8JSEzx40AC8vFVAelm3o=; b=At/bQCtoHTsSYN3e/l+ZqHNmfq
	P0r9Lle+59eDyfAPxQ0EVSjMeHj9RJF++X1Mma3mBCSfODJrRmBjM7dbplsVvsNt1yZvRAGLlklk1
	/NKOWsda1GktqOkMMW++SOHRVXzHtIxaY7UaTXRW48jzXxesIHFzTvXmZGra2Q5xXEFo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/public: remove some unused defines from xs_wire.h
Message-Id: <E1tqZA6-00Ceun-2L@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:58:54 +0000

commit dbdc8d5a54bcc5d8ca07771d524947eb76803f92
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 14:03:37 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:03:37 2025 +0100

    xen/public: remove some unused defines from xs_wire.h
    
    xs_wire.h contains some defines XS_WRITE_* which seem to be leftovers
    from some decades ago. They haven't been used in the Xen tree since at
    least Xen 2.0 and they make no sense anyway.
    
    Remove them, as they seem not to be related to any Xen interface we
    have today.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/io/xs_wire.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/include/public/io/xs_wire.h b/xen/include/public/io/xs_wire.h
index 04e6849feb..0d9f49ac89 100644
--- a/xen/include/public/io/xs_wire.h
+++ b/xen/include/public/io/xs_wire.h
@@ -41,10 +41,6 @@ enum xsd_sockmsg_type
     XS_INVALID = 0xffff /* Guaranteed to remain an invalid type */
 };
 
-#define XS_WRITE_NONE "NONE"
-#define XS_WRITE_CREATE "CREATE"
-#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
-
 /* We hand errors as strings, for portability. */
 struct xsd_errors
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:59:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:59:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905116.1312928 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZAH-0006iS-AN; Fri, 07 Mar 2025 14:59:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905116.1312928; Fri, 07 Mar 2025 14:59:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZAH-0006iL-7T; Fri, 07 Mar 2025 14:59:05 +0000
Received: by outflank-mailman (input) for mailman id 905116;
 Fri, 07 Mar 2025 14:59:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZAG-0006iD-Rx
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:59:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZAH-0071Hx-0E
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:59:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZAG-00Cevd-2b
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:59:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=snvCy1xjwyPx3v3GWsMXhf04Znof1Zlc3GFLesfT1kA=; b=TnBmFm7vSmCV1EsEYm+hTTPbev
	RgYpAyiLdlLfpqMn5gAzTjYHGCextpZT4QJLHfGkkVKFqPS+W4IIRwihm09L/RedQ6Dagq7+G9tmH
	uXcDigrgmo/GF5IVH5xXBEvezgZVjyaH7qgPdC+fMdlBZDG5rS8zrSKYX0befi/HDuLY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/public: add missing Xenstore commands to xs_wire.h
Message-Id: <E1tqZAG-00Cevd-2b@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:59:04 +0000

commit 0fd49cc7dbdfc13faced294ccc970e7a57d08907
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 14:03:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:03:51 2025 +0100

    xen/public: add missing Xenstore commands to xs_wire.h
    
    The GET_FEATURE, SET_FEATURE, GET_QUOTA and SET_QUOTA Xenstore commands
    are defined in docs/misc/xenstore.txt, but they are missing in
    xs_wire.h.
    
    Add the missing commands to xs_wire.h
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/io/xs_wire.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/include/public/io/xs_wire.h b/xen/include/public/io/xs_wire.h
index 0d9f49ac89..e92a87a07b 100644
--- a/xen/include/public/io/xs_wire.h
+++ b/xen/include/public/io/xs_wire.h
@@ -35,6 +35,10 @@ enum xsd_sockmsg_type
     /* XS_RESTRICT has been removed */
     XS_RESET_WATCHES = XS_SET_TARGET + 2,
     XS_DIRECTORY_PART,
+    XS_GET_FEATURE,
+    XS_SET_FEATURE,
+    XS_GET_QUOTA,
+    XS_SET_QUOTA,
 
     XS_TYPE_COUNT,      /* Number of valid types. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:59:16 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:59:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905117.1312932 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZAS-0006kl-Bp; Fri, 07 Mar 2025 14:59:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905117.1312932; Fri, 07 Mar 2025 14:59:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZAS-0006kd-93; Fri, 07 Mar 2025 14:59:16 +0000
Received: by outflank-mailman (input) for mailman id 905117;
 Fri, 07 Mar 2025 14:59:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZAQ-0006kM-Uw
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:59:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZAR-0071I1-0X
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:59:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZAQ-00CewU-2s
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:59:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=srF8DBgSGWvJSItvTLYFr3LiXixoYYNdWT/gTo+Z3ho=; b=z7I6DLDgMfcU9+rORNAlFwFm2q
	FNYRsVui39R8OsDsDzNjyWhsLpzFoB8gHc0jVKzm1BOoGDwn+b7aA/euBOOw4kN4bcPzlMeonomtb
	UmA6MW3kY+3exSVBgPuwy4CGbyMMcXEt8F4PcUegLsy+EtB6trNMqHY/9e+gZFzq5NNY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] config: update Mini-OS commit
Message-Id: <E1tqZAQ-00CewU-2s@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:59:14 +0000

commit 0184bceaa889743846d2a6257217b28c66578ed7
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 14:54:50 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 14:54:50 2025 +0100

    config: update Mini-OS commit
    
    Update the Mini-OS upstream revision.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 8b426a580f..8a73f3da62 100644
--- a/Config.mk
+++ b/Config.mk
@@ -232,7 +232,7 @@ QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
 QEMU_UPSTREAM_REVISION ?= master
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= 6d5159e8410be16a47433bac1627e63f8adc7cd9
+MINIOS_UPSTREAM_REVISION ?= d273a44cec90dad5d3f0bc361a6fea41e0288a56
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.3
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:59:26 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:59:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905118.1312936 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZAc-0006ok-D4; Fri, 07 Mar 2025 14:59:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905118.1312936; Fri, 07 Mar 2025 14:59:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZAc-0006oc-AS; Fri, 07 Mar 2025 14:59:26 +0000
Received: by outflank-mailman (input) for mailman id 905118;
 Fri, 07 Mar 2025 14:59:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZAb-0006oT-1F
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:59:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZAb-0071IP-0n
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:59:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZAa-00Ceya-3B
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:59:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SwBKrk8sys7AaKQH9EMguwHZup2Sw3jwqnLBNDc020Q=; b=kYolLJgiC9xFtohW0SBP9T+j+m
	lTEDUab3t5+e80A3xGTe44Qn165KCX2x72t2B9yigZACyhqZjv4/xZ4RBk2dRZ2kAaKIcfU2QcY1v
	gg8kShtagHFAvUvnZ0AUb7ljZJ+ArIatTG0dPH7Uo1r463w8QG3m7l2IX0lIBZJOLLSQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "EFI: Avoid crash calling PrintErrMesg() from efi_multiboot2()"
Message-Id: <E1tqZAa-00Ceya-3B@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:59:24 +0000

commit 2a0add9e32e84727e7807bf2a38e3433103c2155
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 15:20:39 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 15:20:39 2025 +0100

    Revert "EFI: Avoid crash calling PrintErrMesg() from efi_multiboot2()"
    
    This reverts commit eaed0d185ab8b73cd18ac2830878520b3011f5ab. It breaks the
    build with old Clang (3.8).
---
 xen/common/efi/boot.c        | 58 +++++++++++++++-----------------------------
 xen/common/efi/efi-common.mk |  1 -
 2 files changed, 19 insertions(+), 40 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 143b5681ba..efbec00af9 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -287,53 +287,33 @@ static bool __init match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2)
 /* generic routine for printing error messages */
 static void __init PrintErrMesg(const CHAR16 *mesg, EFI_STATUS ErrCode)
 {
+    static const CHAR16* const ErrCodeToStr[] __initconstrel = {
+        [~EFI_ERROR_MASK & EFI_NOT_FOUND]           = L"Not found",
+        [~EFI_ERROR_MASK & EFI_NO_MEDIA]            = L"The device has no media",
+        [~EFI_ERROR_MASK & EFI_MEDIA_CHANGED]       = L"Media changed",
+        [~EFI_ERROR_MASK & EFI_DEVICE_ERROR]        = L"Device error",
+        [~EFI_ERROR_MASK & EFI_VOLUME_CORRUPTED]    = L"Volume corrupted",
+        [~EFI_ERROR_MASK & EFI_ACCESS_DENIED]       = L"Access denied",
+        [~EFI_ERROR_MASK & EFI_OUT_OF_RESOURCES]    = L"Out of resources",
+        [~EFI_ERROR_MASK & EFI_VOLUME_FULL]         = L"Volume is full",
+        [~EFI_ERROR_MASK & EFI_SECURITY_VIOLATION]  = L"Security violation",
+        [~EFI_ERROR_MASK & EFI_CRC_ERROR]           = L"CRC error",
+        [~EFI_ERROR_MASK & EFI_COMPROMISED_DATA]    = L"Compromised data",
+        [~EFI_ERROR_MASK & EFI_BUFFER_TOO_SMALL]    = L"Buffer too small",
+    };
+    EFI_STATUS ErrIdx = ErrCode & ~EFI_ERROR_MASK;
+
     StdOut = StdErr;
     PrintErr(mesg);
     PrintErr(L": ");
 
-    switch (ErrCode)
+    if( (ErrIdx < ARRAY_SIZE(ErrCodeToStr)) && ErrCodeToStr[ErrIdx] )
+        mesg = ErrCodeToStr[ErrIdx];
+    else
     {
-    case EFI_NOT_FOUND:
-        mesg = L"Not found";
-        break;
-    case EFI_NO_MEDIA:
-        mesg = L"The device has no media";
-        break;
-    case EFI_MEDIA_CHANGED:
-        mesg = L"Media changed";
-        break;
-    case EFI_DEVICE_ERROR:
-        mesg = L"Device error";
-        break;
-    case EFI_VOLUME_CORRUPTED:
-        mesg = L"Volume corrupted";
-        break;
-    case EFI_ACCESS_DENIED:
-        mesg = L"Access denied";
-        break;
-    case EFI_OUT_OF_RESOURCES:
-        mesg = L"Out of resources";
-        break;
-    case EFI_VOLUME_FULL:
-        mesg = L"Volume is full";
-        break;
-    case EFI_SECURITY_VIOLATION:
-        mesg = L"Security violation";
-        break;
-    case EFI_CRC_ERROR:
-        mesg = L"CRC error";
-        break;
-    case EFI_COMPROMISED_DATA:
-        mesg = L"Compromised data";
-        break;
-    case EFI_BUFFER_TOO_SMALL:
-        mesg = L"Buffer too small";
-        break;
-    default:
         PrintErr(L"ErrCode: ");
         DisplayUint(ErrCode, 0);
         mesg = NULL;
-        break;
     }
     blexit(mesg);
 }
diff --git a/xen/common/efi/efi-common.mk b/xen/common/efi/efi-common.mk
index 06b1c19674..23cafcf20c 100644
--- a/xen/common/efi/efi-common.mk
+++ b/xen/common/efi/efi-common.mk
@@ -2,7 +2,6 @@ EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
 EFIOBJ-$(CONFIG_COMPAT) += compat.o
 
 CFLAGS-y += -fshort-wchar
-CFLAGS-y += -fno-jump-tables
 CFLAGS-y += -iquote $(srctree)/common/efi
 CFLAGS-y += -iquote $(srcdir)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:59:36 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:59:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905119.1312940 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZAm-0006rQ-EO; Fri, 07 Mar 2025 14:59:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905119.1312940; Fri, 07 Mar 2025 14:59:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZAm-0006rI-Br; Fri, 07 Mar 2025 14:59:36 +0000
Received: by outflank-mailman (input) for mailman id 905119;
 Fri, 07 Mar 2025 14:59:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZAl-0006r5-3g
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:59:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZAl-0071IV-12
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:59:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZAl-00Cf1K-0D
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:59:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dv/gP6AhBgFV46iAXov6SHyuf2ue/6y2pm3/CjEPuSE=; b=HuHkPXDVYqp9BYKJpC3CrnF857
	gy1xvZ5m/RNLmVEOp5APrxY9V6kQNZp51xVh9qYdpn6w5ZVh5WOTvxwTLgEFD4NA7KbJMUfGxF99s
	AUmMo7S5dOQNyjJ/IplKImGgGNhtiT9BdhGPuTg06XNxlVRTmJzaWb7wzQmJdgiMH3gg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] XSM: correct xsm_get_domain_state()
Message-Id: <E1tqZAl-00Cf1K-0D@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:59:35 +0000

commit 033bfd20e8fb30e430ccfe6a8de0e1d56839e78c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 6 15:21:52 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 15:21:52 2025 +0100

    XSM: correct xsm_get_domain_state()
    
    Add the missing first parameter and move it next to a close relative.
    
    Fixes: 3ad3df1bd0aa ("xen: add new domctl get_domain_state")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/xsm/xsm.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 0689bf5c9f..8c33b055fc 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -231,6 +231,11 @@ static inline int xsm_getdomaininfo(xsm_default_t def, struct domain *d)
     return alternative_call(xsm_ops.getdomaininfo, d);
 }
 
+static inline int xsm_get_domain_state(xsm_default_t def, struct domain *d)
+{
+    return alternative_call(xsm_ops.get_domain_state, d);
+}
+
 static inline int xsm_domctl_scheduler_op(
     xsm_default_t def, struct domain *d, int cmd)
 {
@@ -775,11 +780,6 @@ static inline int xsm_argo_send(const struct domain *d, const struct domain *t)
 
 #endif /* CONFIG_ARGO */
 
-static inline int xsm_get_domain_state(struct domain *d)
-{
-    return alternative_call(xsm_ops.get_domain_state, d);
-}
-
 #endif /* XSM_NO_WRAPPERS */
 
 #ifdef CONFIG_MULTIBOOT
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:59:46 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:59:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905120.1312944 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZAw-0006uG-G6; Fri, 07 Mar 2025 14:59:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905120.1312944; Fri, 07 Mar 2025 14:59:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZAw-0006u7-DJ; Fri, 07 Mar 2025 14:59:46 +0000
Received: by outflank-mailman (input) for mailman id 905120;
 Fri, 07 Mar 2025 14:59:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZAv-0006td-6K
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:59:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZAv-0071IZ-1I
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:59:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZAv-00Cf2w-0S
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:59:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SlCSGzEG7V6jzuUe5q5dKlRADFMCyijM/ZqfQpZlkew=; b=RV4BEG97MZlxQpJGTRnHIY+9R5
	n18STZKDyMgsTurrO3kGYSQ8bcuN/MXlZ+9Mbh0wwCwAlNqPXi2hrIplT5itl7ANM1DuK5ttzvCdk
	VxIfsot0qEjbmBdwi/zz81x+RTqF2qHrQ1tntUZtWt1hVwUvgPaXKHKjtvG/WHexfrYE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/events: fix get_global_virq_handler() usage without hardware domain
Message-Id: <E1tqZAv-00Cf2w-0S@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:59:45 +0000

commit fe5757f25de6062732c088ae54e2180236632552
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 17:23:36 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 6 17:23:36 2025 +0100

    xen/events: fix get_global_virq_handler() usage without hardware domain
    
    Some use cases of get_global_virq_handler() didn't account for the
    case of running without hardware domain.
    
    Fix that by testing get_global_virq_handler() returning NULL where
    needed (e.g. when directly dereferencing the result).
    
    Fixes: 980822c5edd1 ("xen/events: allow setting of global virq handler only for unbound virqs")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/event_channel.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 4ee6b6b4ce..c68aa97135 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -1036,7 +1036,9 @@ int set_global_virq_handler(struct domain *d, uint32_t virq)
     {
         old = global_virq_handlers[virq];
         hdl = get_global_virq_handler(virq);
-        if ( hdl != d )
+        if ( !hdl )
+            global_virq_handlers[virq] = d;
+        else if ( hdl != d )
         {
             read_lock(&hdl->event_lock);
 
@@ -1091,7 +1093,7 @@ struct domain *lock_dom_exc_handler(void)
     struct domain *d;
 
     d = get_global_virq_handler(VIRQ_DOM_EXC);
-    if ( unlikely(!get_domain(d)) )
+    if ( unlikely(!d) || unlikely(!get_domain(d)) )
         return NULL;
 
     read_lock(&d->event_lock);
@@ -1101,6 +1103,9 @@ struct domain *lock_dom_exc_handler(void)
 
 void unlock_dom_exc_handler(struct domain *d)
 {
+    if ( likely(!d) )
+        return;
+
     read_unlock(&d->event_lock);
 
     put_domain(d);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 14:59:56 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 14:59:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905121.1312947 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZB6-0006wf-HL; Fri, 07 Mar 2025 14:59:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905121.1312947; Fri, 07 Mar 2025 14:59:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZB6-0006wY-Eo; Fri, 07 Mar 2025 14:59:56 +0000
Received: by outflank-mailman (input) for mailman id 905121;
 Fri, 07 Mar 2025 14:59:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZB5-0006wQ-9N
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 14:59:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZB5-0071If-1b
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:59:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZB5-00Cf3p-0m
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 14:59:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZsF0/4GCQKRHWpjTPfB8Wd7f9t4elFudGBuKuhPC19g=; b=td70KayrDxx9IDFkLSnbXQ/FZt
	QprawVPrY/nhkjwTIB6K5UysqT2QY6LJJKqpz4C3mSJ6NMS/QuRWLjYtZ0D8EbTC5bBrCxU9M06Dk
	XQwWWOmKlHQjbIPyHu2hR16NUiNYN1P7ahN3Y+0OwML16FUMjoYO5fNlicsIH6GJm7kI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/events: fix global virq handling
Message-Id: <E1tqZB5-00Cf3p-0m@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 14:59:55 +0000

commit bb1accab6903dc7ecbb63f505f9147e01d8e4c80
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 7 11:11:41 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 13:11:30 2025 +0000

    xen/events: fix global virq handling
    
    VIRQs are split into "global" and "per vcpu" ones. Unfortunately in
    reality there are "per domain" ones, too.
    
    send_global_virq() and set_global_virq_handler() make only sense for
    the real "global" ones, so replace virq_is_global() with a new
    function get_virq_type() returning one of the 3 possible types (global,
    domain, vcpu VIRQ).
    
    To make its intended purpose more clear, also rename
    send_guest_global_virq() to send_guest_domain_virq().
    
    Fixes: 980822c5edd1 ("xen/events: allow setting of global virq handler only for unbound virqs")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/arm/include/asm/event.h   |  4 ++--
 xen/arch/ppc/include/asm/event.h   |  4 ++--
 xen/arch/riscv/include/asm/event.h |  4 ++--
 xen/arch/x86/include/asm/event.h   |  6 +++---
 xen/common/argo.c                  |  2 +-
 xen/common/event_channel.c         | 38 +++++++++++++++++++++-----------------
 xen/include/xen/event.h            | 14 +++++++-------
 xen/include/xen/sched.h            |  6 ++++++
 8 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/xen/arch/arm/include/asm/event.h b/xen/arch/arm/include/asm/event.h
index b14c166ad6..509157b2b3 100644
--- a/xen/arch/arm/include/asm/event.h
+++ b/xen/arch/arm/include/asm/event.h
@@ -47,9 +47,9 @@ static inline void local_event_delivery_enable(void)
 }
 
 /* No arch specific virq definition now. Default to global. */
-static inline bool arch_virq_is_global(unsigned int virq)
+static inline enum virq_type arch_get_virq_type(unsigned int virq)
 {
-    return true;
+    return VIRQ_GLOBAL;
 }
 
 #endif
diff --git a/xen/arch/ppc/include/asm/event.h b/xen/arch/ppc/include/asm/event.h
index 1b95ee4f61..0f475c4b89 100644
--- a/xen/arch/ppc/include/asm/event.h
+++ b/xen/arch/ppc/include/asm/event.h
@@ -17,9 +17,9 @@ static inline int vcpu_event_delivery_is_enabled(struct vcpu *v)
 }
 
 /* No arch specific virq definition now. Default to global. */
-static inline bool arch_virq_is_global(unsigned int virq)
+static inline enum virq_type arch_get_virq_type(unsigned int virq)
 {
-    return true;
+    return VIRQ_GLOBAL;
 }
 
 static inline int local_events_need_delivery(void)
diff --git a/xen/arch/riscv/include/asm/event.h b/xen/arch/riscv/include/asm/event.h
index c7bb8c0fa6..116434c665 100644
--- a/xen/arch/riscv/include/asm/event.h
+++ b/xen/arch/riscv/include/asm/event.h
@@ -24,9 +24,9 @@ static inline void local_event_delivery_enable(void)
 }
 
 /* No arch specific virq definition now. Default to global. */
-static inline bool arch_virq_is_global(unsigned int virq)
+static inline enum virq_type arch_get_virq_type(unsigned int virq)
 {
-    return true;
+    return VIRQ_GLOBAL;
 }
 
 #endif /* ASM__RISCV__EVENT_H */
diff --git a/xen/arch/x86/include/asm/event.h b/xen/arch/x86/include/asm/event.h
index 5e09ede6d7..434f65007e 100644
--- a/xen/arch/x86/include/asm/event.h
+++ b/xen/arch/x86/include/asm/event.h
@@ -41,10 +41,10 @@ static inline void local_event_delivery_enable(void)
     vcpu_info(current, evtchn_upcall_mask) = 0;
 }
 
-/* No arch specific virq definition now. Default to global. */
-static inline bool arch_virq_is_global(unsigned int virq)
+/* Only global arch specific virq definitions. */
+static inline enum virq_type arch_get_virq_type(unsigned int virq)
 {
-    return true;
+    return VIRQ_GLOBAL;
 }
 
 #ifdef CONFIG_PV_SHIM
diff --git a/xen/common/argo.c b/xen/common/argo.c
index df19006744..cbe8911a43 100644
--- a/xen/common/argo.c
+++ b/xen/common/argo.c
@@ -440,7 +440,7 @@ signal_domain(struct domain *d)
 {
     argo_dprintk("signalling domid:%u\n", d->domain_id);
 
-    send_guest_global_virq(d, VIRQ_ARGO);
+    send_guest_domain_virq(d, VIRQ_ARGO);
 }
 
 static void
diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index c68aa97135..c8c1bfa615 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -127,7 +127,7 @@ static struct domain *get_global_virq_handler(unsigned int virq)
     return global_virq_handlers[virq] ?: hardware_domain;
 }
 
-static bool virq_is_global(unsigned int virq)
+static enum virq_type get_virq_type(unsigned int virq)
 {
     switch ( virq )
     {
@@ -135,14 +135,17 @@ static bool virq_is_global(unsigned int virq)
     case VIRQ_DEBUG:
     case VIRQ_XENOPROF:
     case VIRQ_XENPMU:
-        return false;
+        return VIRQ_VCPU;
+
+    case VIRQ_ARGO:
+        return VIRQ_DOMAIN;
 
     case VIRQ_ARCH_0 ... VIRQ_ARCH_7:
-        return arch_virq_is_global(virq);
+        return arch_get_virq_type(virq);
     }
 
     ASSERT(virq < NR_VIRQS);
-    return true;
+    return VIRQ_GLOBAL;
 }
 
 static struct evtchn *_evtchn_from_port(const struct domain *d,
@@ -476,7 +479,7 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     struct domain *d = current->domain;
     int            virq = bind->virq, vcpu = bind->vcpu;
     int            rc = 0;
-    bool           is_global;
+    enum virq_type type;
 
     if ( (virq < 0) || (virq >= ARRAY_SIZE(v->virq_to_evtchn)) )
         return -EINVAL;
@@ -486,9 +489,9 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
     * speculative execution.
     */
     virq = array_index_nospec(virq, ARRAY_SIZE(v->virq_to_evtchn));
-    is_global = virq_is_global(virq);
+    type = get_virq_type(virq);
 
-    if ( is_global && vcpu != 0 )
+    if ( type != VIRQ_VCPU && vcpu != 0 )
         return -EINVAL;
 
     if ( (v = domain_vcpu(d, vcpu)) == NULL )
@@ -496,7 +499,7 @@ int evtchn_bind_virq(evtchn_bind_virq_t *bind, evtchn_port_t port)
 
     write_lock(&d->event_lock);
 
-    if ( is_global && get_global_virq_handler(virq) != d )
+    if ( type == VIRQ_GLOBAL && get_global_virq_handler(virq) != d )
     {
         rc = -EBUSY;
         goto out;
@@ -756,7 +759,8 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
         if ( chn1->u.virq == VIRQ_DOM_EXC )
             domain_deinit_states(d1);
 
-        v = d1->vcpu[virq_is_global(chn1->u.virq) ? 0 : chn1->notify_vcpu_id];
+        v = d1->vcpu[get_virq_type(chn1->u.virq) != VIRQ_VCPU
+            ? 0 : chn1->notify_vcpu_id];
 
         write_lock_irqsave(&v->virq_lock, flags);
         ASSERT(read_atomic(&v->virq_to_evtchn[chn1->u.virq]) == port1);
@@ -900,7 +904,7 @@ bool evtchn_virq_enabled(const struct vcpu *v, unsigned int virq)
     if ( !v )
         return false;
 
-    if ( virq_is_global(virq) && v->vcpu_id )
+    if ( get_virq_type(virq) != VIRQ_VCPU && v->vcpu_id )
         v = domain_vcpu(v->domain, 0);
 
     return read_atomic(&v->virq_to_evtchn[virq]);
@@ -913,7 +917,7 @@ void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq)
     struct domain *d;
     struct evtchn *chn;
 
-    ASSERT(!virq_is_global(virq));
+    ASSERT(get_virq_type(virq) == VIRQ_VCPU);
 
     read_lock_irqsave(&v->virq_lock, flags);
 
@@ -933,14 +937,14 @@ void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq)
     read_unlock_irqrestore(&v->virq_lock, flags);
 }
 
-void send_guest_global_virq(struct domain *d, uint32_t virq)
+void send_guest_domain_virq(struct domain *d, uint32_t virq)
 {
     unsigned long flags;
     int port;
     struct vcpu *v;
     struct evtchn *chn;
 
-    ASSERT(virq_is_global(virq));
+    ASSERT(get_virq_type(virq) != VIRQ_VCPU);
 
     if ( unlikely(d == NULL) || unlikely(d->vcpu == NULL) )
         return;
@@ -995,9 +999,9 @@ static DEFINE_SPINLOCK(global_virq_handlers_lock);
 
 void send_global_virq(uint32_t virq)
 {
-    ASSERT(virq_is_global(virq));
+    ASSERT(get_virq_type(virq) == VIRQ_GLOBAL);
 
-    send_guest_global_virq(get_global_virq_handler(virq), virq);
+    send_guest_domain_virq(get_global_virq_handler(virq), virq);
 }
 
 int set_global_virq_handler(struct domain *d, uint32_t virq)
@@ -1008,7 +1012,7 @@ int set_global_virq_handler(struct domain *d, uint32_t virq)
 
     if (virq >= NR_VIRQS)
         return -EINVAL;
-    if (!virq_is_global(virq))
+    if (get_virq_type(virq) != VIRQ_GLOBAL)
         return -EINVAL;
 
     if (global_virq_handlers[virq] == d)
@@ -1204,7 +1208,7 @@ int evtchn_bind_vcpu(evtchn_port_t port, unsigned int vcpu_id)
     switch ( chn->state )
     {
     case ECS_VIRQ:
-        if ( virq_is_global(chn->u.virq) )
+        if ( get_virq_type(chn->u.virq) != VIRQ_VCPU )
             chn->notify_vcpu_id = v->vcpu_id;
         else
             rc = -EINVAL;
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index 5c0ba90c9f..930190054c 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -24,17 +24,17 @@
 void send_guest_vcpu_virq(struct vcpu *v, uint32_t virq);
 
 /*
- * send_global_virq: Notify the domain handling a global VIRQ.
- *  @virq:     Virtual IRQ number (VIRQ_*)
+ * send_guest_domain_virq:
+ *  @d:        Domain to which VIRQ should be sent
+ *  @virq:     Virtual IRQ number (VIRQ_*), may not be per-vCPU
  */
-void send_global_virq(uint32_t virq);
+void send_guest_domain_virq(struct domain *d, uint32_t virq);
 
 /*
- * send_guest_global_virq:
- *  @d:        Domain to which VIRQ should be sent
- *  @virq:     Virtual IRQ number (VIRQ_*), must be global
+ * send_global_virq: Notify the domain handling a global VIRQ.
+ *  @virq:     Virtual IRQ number (VIRQ_*)
  */
-void send_guest_global_virq(struct domain *d, uint32_t virq);
+void send_global_virq(uint32_t virq);
 
 /*
  * sent_global_virq_handler: Set a global VIRQ handler.
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index ea63ca1c79..75add0f216 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -84,6 +84,12 @@ extern domid_t hardware_domid;
 #define XEN_CONSUMER_BITS 3
 #define NR_XEN_CONSUMERS ((1 << XEN_CONSUMER_BITS) - 1)
 
+enum virq_type {
+    VIRQ_GLOBAL,
+    VIRQ_DOMAIN,
+    VIRQ_VCPU,
+};
+
 struct evtchn
 {
     rwlock_t lock;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 15:00:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 15:00:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905122.1312953 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZBG-0007wu-LK; Fri, 07 Mar 2025 15:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905122.1312953; Fri, 07 Mar 2025 15:00:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqZBG-0007wl-Hd; Fri, 07 Mar 2025 15:00:06 +0000
Received: by outflank-mailman (input) for mailman id 905122;
 Fri, 07 Mar 2025 15:00:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqZBF-0007oh-Na
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 15:00:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZBF-0071L3-1t
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 15:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqZBF-00Cf7X-12
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 15:00:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FhQOHEnNHq/VM7knnrBnrOhrc6+5nY9R2GnDZEJzJA0=; b=D3RVzsk8mkFIJlYZ4tatMfcHjE
	BYpOkXShuhnkh+mjKpZbVxuX3PwZZ8b4e5dPBn1mdUqkUuCuNQJifVVcw88Tqn7OkwDzEuy/Rw+Dg
	BRseHeVRz8qQoOnPR7xDjHByhvZ2qPHIQqKvS7TU+wD9zxz8YjifgOk9NVBzNE+XpL3Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/public: Fix documentation of VIRQs
Message-Id: <E1tqZBF-00Cf7X-12@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 15:00:05 +0000

commit 4d4725901e474fb3a61814e3c7bcb563cbdd857a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 7 11:34:04 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 13:11:30 2025 +0000

    xen/public: Fix documentation of VIRQs
    
    It has been discovered that VIRQ_ARGO is a 3rd type of VIRQ.  Also, recent
    work has prevented global VIRQs from being stolen from the owning domain.
    
    Rewrite the description of VIRQ classifications.  Drop the (DOM0) comment from
    the global VIRQs; it's not been true for a long time.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/event_channel.h |  8 ++++----
 xen/include/public/xen.h           | 37 +++++++++++++++++++++++--------------
 2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/xen/include/public/event_channel.h b/xen/include/public/event_channel.h
index 0d91a1c4af..c5548d206c 100644
--- a/xen/include/public/event_channel.h
+++ b/xen/include/public/event_channel.h
@@ -114,10 +114,10 @@ typedef struct evtchn_bind_interdomain evtchn_bind_interdomain_t;
  * EVTCHNOP_bind_virq: Bind a local event channel to VIRQ <irq> on specified
  * vcpu.
  * NOTES:
- *  1. Virtual IRQs are classified as per-vcpu or global. See the VIRQ list
- *     in xen.h for the classification of each VIRQ.
- *  2. Global VIRQs must be allocated on VCPU0 but can subsequently be
- *     re-bound via EVTCHNOP_bind_vcpu.
+ *  1. Virtual IRQs are classified as per-vcpu, per-domain or global. See the
+ *     VIRQ list in xen.h for the classification of each VIRQ.
+ *  2. Per-domain and global VIRQs must be allocated on vCPU0 but can
+ *     subsequently be re-bound via EVTCHNOP_bind_vcpu.
  *  3. Per-vcpu VIRQs may be bound to at most one event channel per vcpu.
  *     The allocated event channel is bound to the specified vcpu and the
  *     binding cannot be changed.
diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index e051f989a5..75b1c1d597 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -159,25 +159,34 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
  *
  * Virtual interrupts that a guest OS may receive from Xen.
  *
- * In the side comments, 'V.' denotes a per-VCPU VIRQ while 'G.' denotes a
- * global VIRQ. The former can be bound once per VCPU and cannot be re-bound.
- * The latter can be allocated only once per guest: they must initially be
- * allocated to VCPU0 but can subsequently be re-bound.
+ * There are three types:
+ *
+ * 1. (V) Per-vcpu:
+ *    These can be bound once per vCPU, each using a different evtchn port.
+ *    An evtchn for one vCPU cannot be rebound to a different vCPU.
+ *
+ * 2. (D) Per-domain:
+ *    These can be bound once per domain.  They must be bound on vCPU 0 first,
+ *    but can be rebound to other vCPUs afterwards.
+ *
+ * 3. (G) Global:
+ *    Like per-domain, but can only be bound to a single domain at a time.
+ *    The owning domain must unbind before a new domain can bind.
  */
 /* ` enum virq { */
 #define VIRQ_TIMER      0  /* V. Timebase update, and/or requested timeout.  */
 #define VIRQ_DEBUG      1  /* V. Request guest to dump debug info.           */
-#define VIRQ_CONSOLE    2  /* G. (DOM0) Bytes received on emergency console. */
-#define VIRQ_DOM_EXC    3  /* G. (DOM0) Exceptional event for some domain.   */
-#define VIRQ_TBUF       4  /* G. (DOM0) Trace buffer has records available.  */
-#define VIRQ_DEBUGGER   6  /* G. (DOM0) A domain has paused for debugging.   */
+#define VIRQ_CONSOLE    2  /* G. Bytes received on emergency console.        */
+#define VIRQ_DOM_EXC    3  /* G. Exceptional event for some domain.          */
+#define VIRQ_TBUF       4  /* G. Trace buffer has records available.         */
+#define VIRQ_DEBUGGER   6  /* G. A domain has paused for debugging.          */
 #define VIRQ_XENOPROF   7  /* V. XenOprofile interrupt: new sample available */
-#define VIRQ_CON_RING   8  /* G. (DOM0) Bytes received on console            */
-#define VIRQ_PCPU_STATE 9  /* G. (DOM0) PCPU state changed                   */
-#define VIRQ_MEM_EVENT  10 /* G. (DOM0) A memory event has occurred          */
-#define VIRQ_ARGO       11 /* G. Argo interdomain message notification       */
-#define VIRQ_ENOMEM     12 /* G. (DOM0) Low on heap memory       */
-#define VIRQ_XENPMU     13 /* V.  PMC interrupt                              */
+#define VIRQ_CON_RING   8  /* G. Bytes received on console                   */
+#define VIRQ_PCPU_STATE 9  /* G. PCPU state changed                          */
+#define VIRQ_MEM_EVENT  10 /* G. A memory event has occurred                 */
+#define VIRQ_ARGO       11 /* D. Argo interdomain message notification       */
+#define VIRQ_ENOMEM     12 /* G. Low on heap memory                          */
+#define VIRQ_XENPMU     13 /* V. PMC interrupt                               */
 
 /* Architecture-specific VIRQ definitions. */
 #define VIRQ_ARCH_0    16
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 16:00:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 16:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905160.1312976 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa7I-0003OF-9O; Fri, 07 Mar 2025 16:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905160.1312976; Fri, 07 Mar 2025 16:00:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa7I-0003Nh-5y; Fri, 07 Mar 2025 16:00:04 +0000
Received: by outflank-mailman (input) for mailman id 905160;
 Fri, 07 Mar 2025 16:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqa7G-0002h7-9x
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 16:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa7G-0072o4-1E
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa7G-00CllY-0E
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3EZDuyC4a1vg4vS8yJUVlOr7belEBWDtvANC5Ne8BcQ=; b=vGcnqN2lp+M27fL33TDKDCKoex
	QYLb9aYMKaqj8WHeJmDpVRzjcfPFG0W0xT7vDJSrBN5TIRnlnYhbKsSrSD3EKbtdsJdtr87beN6qC
	6AN09VkoBD+JVRwDGvgwiwmosHsTb8rGPkfwX34tMzTDC2Zr9cKXnCj3BE6be3buIcEI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/IDT: Rename idt_table[] to bsp_idt[]
Message-Id: <E1tqa7G-00CllY-0E@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 16:00:02 +0000

commit b7cfb45aaf0bbc74efda8f4534d3d5cb95daefe3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 2 17:17:30 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/IDT: Rename idt_table[] to bsp_idt[]
    
    Having variables named idt_table[] and idt_tables[] is not ideal.
    
    Use X86_IDT_VECTORS and remove IDT_ENTRIES.  State the size of bsp_idt[] in
    idt.h so that load_system_tables() and cpu_smpboot_alloc() can use sizeof()
    rather than opencoding the calculation.
    
    Move the variable into a new traps-setup.c, to make a start at splitting
    traps.c in half.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Makefile          |  1 +
 xen/arch/x86/cpu/common.c      |  2 +-
 xen/arch/x86/include/asm/idt.h |  3 +--
 xen/arch/x86/pv/traps.c        |  4 ++--
 xen/arch/x86/smpboot.c         |  2 +-
 xen/arch/x86/traps-setup.c     |  9 +++++++++
 xen/arch/x86/traps.c           | 14 +++++---------
 7 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index b35fd5196c..c763f80b0b 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -65,6 +65,7 @@ obj-y += spec_ctrl.o
 obj-y += srat.o
 obj-y += string.o
 obj-y += time.o
+obj-y += traps-setup.o
 obj-y += traps.o
 obj-$(CONFIG_INTEL) += tsx.o
 obj-y += usercopy.o
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 1540ab0007..e8b355ebcf 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -831,7 +831,7 @@ void load_system_tables(void)
 	};
 	const struct desc_ptr idtr = {
 		.base = (unsigned long)idt_tables[cpu],
-		.limit = (IDT_ENTRIES * sizeof(idt_entry_t)) - 1,
+		.limit = sizeof(bsp_idt) - 1,
 	};
 
 	/*
diff --git a/xen/arch/x86/include/asm/idt.h b/xen/arch/x86/include/asm/idt.h
index 3689fdecbe..f00368f28c 100644
--- a/xen/arch/x86/include/asm/idt.h
+++ b/xen/arch/x86/include/asm/idt.h
@@ -28,8 +28,7 @@ typedef union {
     };
 } idt_entry_t;
 
-#define IDT_ENTRIES 256
-extern idt_entry_t idt_table[];
+extern idt_entry_t bsp_idt[X86_IDT_VECTORS];
 extern idt_entry_t *idt_tables[];
 
 /*
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 77b034e4dc..4aeb6cab52 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -148,12 +148,12 @@ void __init pv_trap_init(void)
 {
 #ifdef CONFIG_PV32
     /* The 32-on-64 hypercall vector is only accessible from ring 1. */
-    _set_gate(idt_table + HYPERCALL_VECTOR,
+    _set_gate(bsp_idt + HYPERCALL_VECTOR,
               SYS_DESC_irq_gate, 1, entry_int82);
 #endif
 
     /* Fast trap for int80 (faster than taking the #GP-fixup path). */
-    _set_gate(idt_table + LEGACY_SYSCALL_VECTOR, SYS_DESC_irq_gate, 3,
+    _set_gate(bsp_idt + LEGACY_SYSCALL_VECTOR, SYS_DESC_irq_gate, 3,
               &entry_int80);
 
     open_softirq(NMI_SOFTIRQ, nmi_softirq);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index f3d60d5bae..dc65f9e452 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1080,7 +1080,7 @@ static int cpu_smpboot_alloc(unsigned int cpu)
         idt_tables[cpu] = alloc_xenheap_pages(0, memflags);
     if ( idt_tables[cpu] == NULL )
         goto out;
-    memcpy(idt_tables[cpu], idt_table, IDT_ENTRIES * sizeof(idt_entry_t));
+    memcpy(idt_tables[cpu], bsp_idt, sizeof(bsp_idt));
     disable_each_ist(idt_tables[cpu]);
 
     for ( stub_page = 0, i = cpu & ~(STUBS_PER_PAGE - 1);
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
new file mode 100644
index 0000000000..b172ea9336
--- /dev/null
+++ b/xen/arch/x86/traps-setup.c
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Configuration of event handling for all CPUs.
+ */
+#include <asm/idt.h>
+#include <asm/page.h>
+
+idt_entry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
+    bsp_idt[X86_IDT_VECTORS];
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 4d1aaa78e7..7a68996b02 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -98,10 +98,6 @@ DEFINE_PER_CPU_READ_MOSTLY(seg_desc_t *, compat_gdt);
 DEFINE_PER_CPU_READ_MOSTLY(l1_pgentry_t, compat_gdt_l1e);
 #endif
 
-/* Master table, used by CPU0. */
-idt_entry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
-    idt_table[IDT_ENTRIES];
-
 /* Pointer to the IDT of every CPU. */
 idt_entry_t *idt_tables[NR_CPUS] __read_mostly;
 
@@ -1874,7 +1870,7 @@ void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
 static void __init noinline __set_intr_gate(unsigned int n,
                                             uint32_t dpl, void *addr)
 {
-    _set_gate(&idt_table[n], SYS_DESC_irq_gate, dpl, addr);
+    _set_gate(&bsp_idt[n], SYS_DESC_irq_gate, dpl, addr);
 }
 
 static void __init set_swint_gate(unsigned int n, void *addr)
@@ -1940,10 +1936,10 @@ void __init init_idt_traps(void)
     set_intr_gate (X86_EXC_CP,  entry_CP);
 
     /* Specify dedicated interrupt stacks for NMI, #DF, and #MC. */
-    enable_each_ist(idt_table);
+    enable_each_ist(bsp_idt);
 
     /* CPU0 uses the master IDT. */
-    idt_tables[0] = idt_table;
+    idt_tables[0] = bsp_idt;
 
     this_cpu(gdt) = boot_gdt;
     if ( IS_ENABLED(CONFIG_PV32) )
@@ -2001,13 +1997,13 @@ void __init trap_init(void)
         if ( autogen_entrypoints[vector] )
         {
             /* Found autogen entry: check we won't clobber an existing trap. */
-            ASSERT(idt_table[vector].b == 0);
+            ASSERT(bsp_idt[vector].b == 0);
             set_intr_gate(vector, autogen_entrypoints[vector]);
         }
         else
         {
             /* No entry point: confirm we have an existing trap in place. */
-            ASSERT(idt_table[vector].b != 0);
+            ASSERT(bsp_idt[vector].b != 0);
         }
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 16:00:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 16:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905161.1312981 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa7S-0003te-B0; Fri, 07 Mar 2025 16:00:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905161.1312981; Fri, 07 Mar 2025 16:00:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa7S-0003tV-7R; Fri, 07 Mar 2025 16:00:14 +0000
Received: by outflank-mailman (input) for mailman id 905161;
 Fri, 07 Mar 2025 16:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqa7Q-0003tG-C4
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 16:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa7Q-00730N-1r
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa7Q-00ClnA-0i
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S0QFDzihqv+gQ7xPdBv0ukQlFwonvwWK25SqrETGXgw=; b=noKitA6iAYDIIGPnDVywGsP0eR
	jExJc/Nf+z0PsYVMC6HBhdby4KnTM19K+ueACDlyRkjXTi50Fv9etkE3eRcEZgf4LfUQFZHxn8ttF
	T0FoaBOIYFufpOTldzI17bm6CG2rVwOmcFRp7XF2wgHxitvATdCOWykggWhNKHh489iQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/IDT: Make idt_tables[] be per_cpu(idt)
Message-Id: <E1tqa7Q-00ClnA-0i@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 16:00:12 +0000

commit 9c20d3c5915d6e29054e2cdac91244f3a3424d08
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 2 17:47:24 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/IDT: Make idt_tables[] be per_cpu(idt)
    
    This can be a plain per_cpu() variable, and __read_mostly seeing as it's
    allocated once and not touched again during it's lifetime.
    
    This removes a NR_CPU's sized structure, and improves NUMA locality of access
    for both the the VT-x and SVM context switch paths.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c      |  5 +++--
 xen/arch/x86/crash.c           |  8 ++++----
 xen/arch/x86/domain.c          |  2 +-
 xen/arch/x86/hvm/svm/svm.c     |  4 ++--
 xen/arch/x86/hvm/vmx/vmcs.c    |  2 +-
 xen/arch/x86/include/asm/idt.h |  3 ++-
 xen/arch/x86/machine_kexec.c   |  7 +++++--
 xen/arch/x86/smpboot.c         | 14 +++++++-------
 xen/arch/x86/traps-setup.c     |  2 ++
 xen/arch/x86/traps.c           |  5 +----
 10 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index e8b355ebcf..e8d4ca3203 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -819,6 +819,7 @@ void load_system_tables(void)
 	 * support using ARRAY_SIZE against per-cpu variables.
 	 */
 	struct tss_page *tss_page = &this_cpu(tss_page);
+	idt_entry_t *idt = this_cpu(idt);
 
 	/* The TSS may be live.	 Disuade any clever optimisations. */
 	volatile struct tss64 *tss = &tss_page->tss;
@@ -830,7 +831,7 @@ void load_system_tables(void)
 		.limit = LAST_RESERVED_GDT_BYTE,
 	};
 	const struct desc_ptr idtr = {
-		.base = (unsigned long)idt_tables[cpu],
+		.base = (unsigned long)idt,
 		.limit = sizeof(bsp_idt) - 1,
 	};
 
@@ -914,7 +915,7 @@ void load_system_tables(void)
 	ltr(TSS_SELECTOR);
 	lldt(0);
 
-	enable_each_ist(idt_tables[cpu]);
+	enable_each_ist(idt);
 
 	/*
 	 * Bottom-of-stack must be 16-byte aligned!
diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 5f7d7b392a..1e4b0eeff2 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -63,7 +63,7 @@ static int noreturn cf_check do_nmi_crash(
          * This update is safe from a security point of view, as this
          * pcpu is never going to try to sysret back to a PV vcpu.
          */
-        set_ist(&idt_tables[cpu][X86_EXC_MC], IST_NONE);
+        set_ist(&per_cpu(idt, cpu)[X86_EXC_MC], IST_NONE);
 
         kexec_crash_save_cpu();
         __stop_this_cpu();
@@ -120,6 +120,7 @@ static void nmi_shootdown_cpus(void)
 {
     unsigned long msecs;
     unsigned int cpu = smp_processor_id();
+    idt_entry_t *idt = this_cpu(idt);
 
     disable_lapic_nmi_watchdog();
     local_irq_disable();
@@ -133,9 +134,8 @@ static void nmi_shootdown_cpus(void)
      * Disable IST for MCEs to avoid stack corruption race conditions, and
      * change the NMI handler to a nop to avoid deviation from this codepath.
      */
-    _set_gate_lower(&idt_tables[cpu][X86_EXC_NMI],
-                    SYS_DESC_irq_gate, 0, &trap_nop);
-    set_ist(&idt_tables[cpu][X86_EXC_MC], IST_NONE);
+    _set_gate_lower(&idt[X86_EXC_NMI], SYS_DESC_irq_gate, 0, &trap_nop);
+    set_ist(&idt[X86_EXC_MC], IST_NONE);
 
     set_nmi_callback(do_nmi_crash);
     smp_send_nmi_allbutself();
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index d3db76833f..a42fa54805 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -116,7 +116,7 @@ void play_dead(void)
     local_irq_disable();
 
     /* Change the NMI handler to a nop (see comment below). */
-    _set_gate_lower(&idt_tables[cpu][X86_EXC_NMI], SYS_DESC_irq_gate, 0,
+    _set_gate_lower(&this_cpu(idt)[X86_EXC_NMI], SYS_DESC_irq_gate, 0,
                     &trap_nop);
 
     /*
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 42128e33ce..4b24891096 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -915,7 +915,7 @@ static void cf_check svm_ctxt_switch_from(struct vcpu *v)
     svm_vmload_pa(per_cpu(host_vmcb, cpu));
 
     /* Resume use of ISTs now that the host TR is reinstated. */
-    enable_each_ist(idt_tables[cpu]);
+    enable_each_ist(per_cpu(idt, cpu));
 
     /*
      * Possibly clear previous guest selection of SSBD if set.  Note that
@@ -944,7 +944,7 @@ static void cf_check svm_ctxt_switch_to(struct vcpu *v)
      * Cannot use ISTs for NMI/#MC/#DF while we are running with the guest TR.
      * But this doesn't matter: the IST is only req'd to handle SYSCALL/SYSRET.
      */
-    disable_each_ist(idt_tables[cpu]);
+    disable_each_ist(per_cpu(idt, cpu));
 
     svm_restore_dr(v);
 
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index cfb541de13..0ba65becec 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -893,7 +893,7 @@ static void vmx_set_host_env(struct vcpu *v)
 
     __vmwrite(HOST_GDTR_BASE,
               (unsigned long)(this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY));
-    __vmwrite(HOST_IDTR_BASE, (unsigned long)idt_tables[cpu]);
+    __vmwrite(HOST_IDTR_BASE, (unsigned long)per_cpu(idt, cpu));
 
     __vmwrite(HOST_TR_BASE, (unsigned long)&per_cpu(tss_page, cpu).tss);
 
diff --git a/xen/arch/x86/include/asm/idt.h b/xen/arch/x86/include/asm/idt.h
index f00368f28c..d795798d3e 100644
--- a/xen/arch/x86/include/asm/idt.h
+++ b/xen/arch/x86/include/asm/idt.h
@@ -3,6 +3,7 @@
 #define X86_ASM_IDT_H
 
 #include <xen/bug.h>
+#include <xen/percpu.h>
 
 #include <asm/x86-defns.h>
 
@@ -29,7 +30,7 @@ typedef union {
 } idt_entry_t;
 
 extern idt_entry_t bsp_idt[X86_IDT_VECTORS];
-extern idt_entry_t *idt_tables[];
+DECLARE_PER_CPU(idt_entry_t *, idt);
 
 /*
  * Set the Interrupt Stack Table used by a particular IDT entry.  Typically
diff --git a/xen/arch/x86/machine_kexec.c b/xen/arch/x86/machine_kexec.c
index f775e526d5..35fa5c82e9 100644
--- a/xen/arch/x86/machine_kexec.c
+++ b/xen/arch/x86/machine_kexec.c
@@ -170,9 +170,12 @@ void machine_kexec(struct kexec_image *image)
      */
     for ( i = 0; i < nr_cpu_ids; i++ )
     {
-        if ( idt_tables[i] == NULL )
+        idt_entry_t *idt = per_cpu(idt, i);
+
+        if ( !idt )
             continue;
-        _update_gate_addr_lower(&idt_tables[i][X86_EXC_MC], &trap_nop);
+
+        _update_gate_addr_lower(&idt[X86_EXC_MC], &trap_nop);
     }
 
     /* Reset CPUID masking and faulting to the host's default. */
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index dc65f9e452..4e9f9ac4b2 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -863,7 +863,7 @@ int setup_cpu_root_pgt(unsigned int cpu)
         rc = clone_mapping(__va(__pa(stack_base[cpu])) + off, rpt);
 
     if ( !rc )
-        rc = clone_mapping(idt_tables[cpu], rpt);
+        rc = clone_mapping(per_cpu(idt, cpu), rpt);
     if ( !rc )
     {
         struct tss_page *ptr = &per_cpu(tss_page, cpu);
@@ -1009,7 +1009,7 @@ static void cpu_smpboot_free(unsigned int cpu, bool remove)
     if ( remove )
     {
         FREE_XENHEAP_PAGE(per_cpu(gdt, cpu));
-        FREE_XENHEAP_PAGE(idt_tables[cpu]);
+        FREE_XENHEAP_PAGE(per_cpu(idt, cpu));
 
         if ( stack_base[cpu] )
         {
@@ -1076,12 +1076,12 @@ static int cpu_smpboot_alloc(unsigned int cpu)
     gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a = cpu;
 #endif
 
-    if ( idt_tables[cpu] == NULL )
-        idt_tables[cpu] = alloc_xenheap_pages(0, memflags);
-    if ( idt_tables[cpu] == NULL )
+    if ( per_cpu(idt, cpu) == NULL )
+        per_cpu(idt, cpu) = alloc_xenheap_pages(0, memflags);
+    if ( per_cpu(idt, cpu) == NULL )
         goto out;
-    memcpy(idt_tables[cpu], bsp_idt, sizeof(bsp_idt));
-    disable_each_ist(idt_tables[cpu]);
+    memcpy(per_cpu(idt, cpu), bsp_idt, sizeof(bsp_idt));
+    disable_each_ist(per_cpu(idt, cpu));
 
     for ( stub_page = 0, i = cpu & ~(STUBS_PER_PAGE - 1);
           i < nr_cpu_ids && i <= (cpu | (STUBS_PER_PAGE - 1)); ++i )
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index b172ea9336..ae600526cb 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -7,3 +7,5 @@
 
 idt_entry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
     bsp_idt[X86_IDT_VECTORS];
+
+DEFINE_PER_CPU_READ_MOSTLY(idt_entry_t *, idt);
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 7a68996b02..d52840848d 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -98,9 +98,6 @@ DEFINE_PER_CPU_READ_MOSTLY(seg_desc_t *, compat_gdt);
 DEFINE_PER_CPU_READ_MOSTLY(l1_pgentry_t, compat_gdt_l1e);
 #endif
 
-/* Pointer to the IDT of every CPU. */
-idt_entry_t *idt_tables[NR_CPUS] __read_mostly;
-
 /*
  * The TSS is smaller than a page, but we give it a full page to avoid
  * adjacent per-cpu data leaking via Meltdown when XPTI is in use.
@@ -1939,7 +1936,7 @@ void __init init_idt_traps(void)
     enable_each_ist(bsp_idt);
 
     /* CPU0 uses the master IDT. */
-    idt_tables[0] = bsp_idt;
+    this_cpu(idt) = bsp_idt;
 
     this_cpu(gdt) = boot_gdt;
     if ( IS_ENABLED(CONFIG_PV32) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 16:00:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 16:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905162.1312984 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa7c-000444-C2; Fri, 07 Mar 2025 16:00:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905162.1312984; Fri, 07 Mar 2025 16:00:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa7c-00043w-90; Fri, 07 Mar 2025 16:00:24 +0000
Received: by outflank-mailman (input) for mailman id 905162;
 Fri, 07 Mar 2025 16:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqa7a-0003yk-Fy
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 16:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa7a-00735v-2D
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa7a-00Clop-1I
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oT3DL8oCl06qBfQmvdKyajuXbX66Ep62e2XQMxdyLKY=; b=5u8g+8szn7lNshlyaN0A5NWwDS
	0FOVFGyISHgTT2noglJd4fX+4s1rRL2nU8RYhlNnFajr01bQePN7hjaVHUkq/RSelDudG/LixF3EQ
	/qmFlb7SPo9OyqFhegrrWSCwDrweNHE14sfPJAA/RRGs+Ig6hz8PMIep7TXNotUQwzcM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/IDT: Generate bsp_idt[] at build time
Message-Id: <E1tqa7a-00Clop-1I@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 16:00:22 +0000

commit 3da2149cf4dc617e9599ab3e22e41186f81705a9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 3 14:44:19 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/IDT: Generate bsp_idt[] at build time
    
    ... rather than dynamically at boot time.  Aside from less runtime overhead,
    this approach is less fragile than the preexisting autogen stubs mechanism.
    
    We can manage this with some linker calculations.  See patch comments for full
    details.
    
    For simplicity, we create a new set of entry stubs here, and clean up the old
    ones in the subsequent patch.  bsp_idt[] needs to move from .bss to .data.
    
    No functional change yet; the boot path still (re)writes bsp_idt[] at this
    juncture.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/gen-idt.h     | 122 +++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/gen-idt.lds.h |  27 ++++++++
 xen/arch/x86/traps-setup.c             |   4 --
 xen/arch/x86/x86_64/entry.S            |  76 ++++++++++++++++++++
 xen/arch/x86/xen.lds.S                 |   2 +
 5 files changed, 227 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/include/asm/gen-idt.h b/xen/arch/x86/include/asm/gen-idt.h
new file mode 100644
index 0000000000..9c8810edf9
--- /dev/null
+++ b/xen/arch/x86/include/asm/gen-idt.h
@@ -0,0 +1,122 @@
+/* This file is intended to be included multiple times. */
+/*
+ * Generator for IDT entries.
+ *
+ * Caller to provide GEN(vector, symbol, dpl, autogen) macro
+ *
+ * Symbols are 'entry_0xYY' if there is no better name available.  Regular
+ * handlers set autogen=1, while manual (autogen=0) require the symbol to be
+ * implemented somewhere else.
+ */
+
+#define DPL0 0
+#define DPL1 1
+#define DPL3 3
+
+#define manual 0
+#define autogen 1
+
+#define GEN16(i) \
+    GEN(0x ## i ## 0, entry_0x ## i ## 0, DPL0, autogen); \
+    GEN(0x ## i ## 1, entry_0x ## i ## 1, DPL0, autogen); \
+    GEN(0x ## i ## 2, entry_0x ## i ## 2, DPL0, autogen); \
+    GEN(0x ## i ## 3, entry_0x ## i ## 3, DPL0, autogen); \
+    GEN(0x ## i ## 4, entry_0x ## i ## 4, DPL0, autogen); \
+    GEN(0x ## i ## 5, entry_0x ## i ## 5, DPL0, autogen); \
+    GEN(0x ## i ## 6, entry_0x ## i ## 6, DPL0, autogen); \
+    GEN(0x ## i ## 7, entry_0x ## i ## 7, DPL0, autogen); \
+    GEN(0x ## i ## 8, entry_0x ## i ## 8, DPL0, autogen); \
+    GEN(0x ## i ## 9, entry_0x ## i ## 9, DPL0, autogen); \
+    GEN(0x ## i ## a, entry_0x ## i ## a, DPL0, autogen); \
+    GEN(0x ## i ## b, entry_0x ## i ## b, DPL0, autogen); \
+    GEN(0x ## i ## c, entry_0x ## i ## c, DPL0, autogen); \
+    GEN(0x ## i ## d, entry_0x ## i ## d, DPL0, autogen); \
+    GEN(0x ## i ## e, entry_0x ## i ## e, DPL0, autogen); \
+    GEN(0x ## i ## f, entry_0x ## i ## f, DPL0, autogen)
+
+
+GEN(0x00, entry_DE,         DPL0, manual);
+GEN(0x01, entry_DB,         DPL0, manual);
+GEN(0x02, entry_NMI,        DPL0, manual);
+GEN(0x03, entry_BP,         DPL3, manual);
+GEN(0x04, entry_OF,         DPL3, manual);
+GEN(0x05, entry_BR,         DPL0, manual);
+GEN(0x06, entry_UD,         DPL0, manual);
+GEN(0x07, entry_NM,         DPL0, manual);
+GEN(0x08, entry_DF,         DPL0, manual);
+GEN(0x09, entry_0x09,       DPL0, autogen); /* Coprocessor Segment Overrun */
+GEN(0x0a, entry_TS,         DPL0, manual);
+GEN(0x0b, entry_NP,         DPL0, manual);
+GEN(0x0c, entry_SS,         DPL0, manual);
+GEN(0x0d, entry_GP,         DPL0, manual);
+GEN(0x0e, early_page_fault, DPL0, manual);
+GEN(0x0f, entry_0x0f,       DPL0, autogen); /* PIC Spurious Interrupt Vector */
+
+GEN(0x10, entry_MF,         DPL0, manual);
+GEN(0x11, entry_AC,         DPL0, manual);
+GEN(0x12, entry_MC,         DPL0, manual);
+GEN(0x13, entry_XM,         DPL0, manual);
+GEN(0x14, entry_VE,         DPL0, autogen);
+GEN(0x15, entry_CP,         DPL0, manual);
+GEN(0x16, entry_0x16,       DPL0, autogen);
+GEN(0x17, entry_0x17,       DPL0, autogen);
+GEN(0x18, entry_0x18,       DPL0, autogen);
+GEN(0x19, entry_0x19,       DPL0, autogen);
+GEN(0x1a, entry_0x1a,       DPL0, autogen);
+GEN(0x1b, entry_0x1b,       DPL0, autogen);
+GEN(0x1c, entry_HV,         DPL0, autogen);
+GEN(0x1d, entry_VC,         DPL0, autogen);
+GEN(0x1e, entry_SX,         DPL0, autogen);
+GEN(0x1f, entry_0x1f,       DPL0, autogen);
+
+GEN16(2);
+GEN16(3);
+GEN16(4);
+GEN16(5);
+GEN16(6);
+GEN16(7);
+
+#ifdef CONFIG_PV
+GEN(0x80, entry_int80,      DPL0, manual);
+#else
+GEN(0x80, entry_0x80,       DPL0, autogen);
+#endif
+
+GEN(0x81, entry_0x81,       DPL0, autogen);
+
+#ifdef CONFIG_PV32
+GEN(0x82, entry_int82,      DPL1, manual);
+#else
+GEN(0x82, entry_0x82,       DPL0, autogen);
+#endif
+
+GEN(0x83, entry_0x83,       DPL0, autogen);
+GEN(0x84, entry_0x84,       DPL0, autogen);
+GEN(0x85, entry_0x85,       DPL0, autogen);
+GEN(0x86, entry_0x86,       DPL0, autogen);
+GEN(0x87, entry_0x87,       DPL0, autogen);
+GEN(0x88, entry_0x88,       DPL0, autogen);
+GEN(0x89, entry_0x89,       DPL0, autogen);
+GEN(0x8a, entry_0x8a,       DPL0, autogen);
+GEN(0x8b, entry_0x8b,       DPL0, autogen);
+GEN(0x8c, entry_0x8c,       DPL0, autogen);
+GEN(0x8d, entry_0x8d,       DPL0, autogen);
+GEN(0x8e, entry_0x8e,       DPL0, autogen);
+GEN(0x8f, entry_0x8f,       DPL0, autogen);
+
+GEN16(9);
+GEN16(a);
+GEN16(b);
+GEN16(c);
+GEN16(d);
+GEN16(e);
+GEN16(f);
+
+#undef autogen
+#undef manual
+
+#undef DPL3
+#undef DPL1
+#undef DPL0
+
+#undef GEN16
diff --git a/xen/arch/x86/include/asm/gen-idt.lds.h b/xen/arch/x86/include/asm/gen-idt.lds.h
new file mode 100644
index 0000000000..a11ef7dd1c
--- /dev/null
+++ b/xen/arch/x86/include/asm/gen-idt.lds.h
@@ -0,0 +1,27 @@
+/*
+ * Linker file fragment to help format the IDT correctly
+ *
+ * The IDT, having grown compatibly since the 16 bit days, has the entrypoint
+ * address field split into 3.  x86 ELF lacks the @lo/@hi/etc relocation forms
+ * commonly found in other architectures for accessing a part of a resolved
+ * symbol address.
+ *
+ * However, the linker can perform the necessary calculations and provide them
+ * under new symbol names.  We use this to generate the low and next 16 bits
+ * of the address for each handler.
+ *
+ * The upper 32 bits are always a constant as Xen's .text/data/rodata sits in
+ * a single aligned 1G range, so do not need calculating in this manner.
+ */
+#ifndef X86_IDT_GEN_LDS_H
+#define X86_IDT_GEN_LDS_H
+
+#define GEN(vec, sym, dpl, auto)                                        \
+    PROVIDE_HIDDEN(IDT_ ## sym ## _ADDR1 = ABSOLUTE(((sym) & 0xffff))); \
+    PROVIDE_HIDDEN(IDT_ ## sym ## _ADDR2 = ABSOLUTE((((sym) >> 16) & 0xffff)))
+
+#include <asm/gen-idt.h>
+
+#undef GEN
+
+#endif /* X86_IDT_GEN_LDS_H */
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index ae600526cb..3ee2831958 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -3,9 +3,5 @@
  * Configuration of event handling for all CPUs.
  */
 #include <asm/idt.h>
-#include <asm/page.h>
-
-idt_entry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
-    bsp_idt[X86_IDT_VECTORS];
 
 DEFINE_PER_CPU_READ_MOSTLY(idt_entry_t *, idt);
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index d866e62625..84d0c29530 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -1229,6 +1229,82 @@ FUNC(trap_nop, 0)
         iretq
 END(trap_nop)
 
+/*
+ * Automatically generated entrypoints, and IDT
+ */
+
+        .pushsection .data.page_aligned, "aw", @progbits
+DATA(bsp_idt, PAGE_SIZE)
+        .popsection
+
+/*
+ * Write an IDT Entry.  The linker provides us new _ADDR1/2 symbols calculated
+ * from \sym.
+ */
+.macro write_idte sym, dpl
+        .pushsection .data.page_aligned, "aw", @progbits
+        .word IDT_\sym\()_ADDR1
+        .word __HYPERVISOR_CS
+        .word 0x8e00 | (\dpl << 13) /* Present, DPL, Interrupt Gate */
+        .word IDT_\sym\()_ADDR2
+        .long __XEN_VIRT_START >> 32
+        .long 0
+        .popsection
+.endm
+
+/*
+ * Write an automatically generated stub.  Vectors in the exception range keep
+ * the stack properly aligned by judging whether the CPU pushed an error code
+ * or not.
+ *
+ * Alignment is forced to 16 because that's the size of the interrupt stub
+ * with CET active.
+ */
+.macro gen_entry_stub vec, sym
+
+FUNC(\sym, 16)
+        ENDBR64
+
+        .if \vec < 0x20 /* Exception. */
+
+            test  $8, %spl       /* 64bit exception frames are 16 byte aligned, but the word */
+            jz    1f             /* size is 8 bytes.  Check whether the processor gave us an */
+            pushq $0             /* error code, and insert an empty one if not.              */
+1:          movb  $\vec, EFRAME_entry_vector(%rsp)
+            jmp   handle_exception
+
+        .else /* Interrupt. */
+
+            pushq $0
+            movb  $\vec, EFRAME_entry_vector(%rsp)
+            jmp   common_interrupt
+
+        .endif
+END(\sym)
+.endm
+
+/*
+ * Generator.  Write an entrypoint if necessary, and record an IDT entry.
+ */
+.macro gen vec, sym, dpl, auto
+
+        .if \auto
+            gen_entry_stub \vec, \sym
+        .endif
+
+        write_idte \sym, \dpl
+.endm
+#define GEN(v, s, d, a) gen vec=v, sym=s, dpl=d auto=a
+#include <asm/gen-idt.h>
+#undef GEN
+
+        .pushsection .data.page_aligned, "aw", @progbits
+END(bsp_idt)
+        .if . - bsp_idt != PAGE_SIZE
+            .error "Bad bsp_idt size, should be PAGE_SIZE"
+        .endif
+        .popsection
+
 /* Table of automatically generated entry points.  One per vector. */
         .pushsection .init.rodata, "a", @progbits
 DATA(autogen_entrypoints, 8)
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 42217eaf24..d4dd6434c4 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -8,6 +8,8 @@
 # define DECL_SECTION_WITH_LADDR
 #endif
 #include <xen/xen.lds.h>
+
+#include <asm/gen-idt.lds.h>
 #include <asm/page.h>
 #include <asm/trampoline.h>
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 16:00:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 16:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905163.1312988 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa7l-00046V-F9; Fri, 07 Mar 2025 16:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905163.1312988; Fri, 07 Mar 2025 16:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa7l-00046O-CJ; Fri, 07 Mar 2025 16:00:33 +0000
Received: by outflank-mailman (input) for mailman id 905163;
 Fri, 07 Mar 2025 16:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqa7k-00046I-R3
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 16:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa7k-00735z-2x
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa7k-00Clpr-1f
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/TFoqtpj9gOJahsMFrLPa/dz15XpXnOWhFCLqLJ/CIk=; b=hW0X8JljI191wpCa3CpAx1nrQQ
	DUtqeBSAzlK0L6FTRKhoT93O+nLt/is3eZVd5Qm8I3aDrxRaWKdSem9Q+veqWoeamt7cQ81GYeo0r
	ltb51NUPao2Sz7vptLvQcbKD4D0+DRJ2FLpCUY0hcxPZUqCOdPTDGGhU0HOBLzmdtHNY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/IDT: Don't rewrite bsp_idt[] at boot time
Message-Id: <E1tqa7k-00Clpr-1f@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 16:00:32 +0000

commit cb27499111a5784e20c7e482e6407a894d6fc48f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 3 15:16:45 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/IDT: Don't rewrite bsp_idt[] at boot time
    
    Now that bsp_idt[] is constructed at build time, we do not need to manually
    initialise it in init_idt_traps() and trap_init().
    
    When swapping the early pagefault handler for the normal one, switch to using
    _update_gate_addr_lower() as we do on the kexec path for NMI and #MC.
    
    This in turn allows us to drop set_{intr,swint}_gate() and the underlying
    infrastructure.  It also lets us drop autogen_entrypoints[] and that
    underlying infrastructure.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/idt.h | 16 ---------
 xen/arch/x86/pv/traps.c        | 13 --------
 xen/arch/x86/traps.c           | 76 +-----------------------------------------
 xen/arch/x86/x86_64/entry.S    | 60 ---------------------------------
 4 files changed, 1 insertion(+), 164 deletions(-)

diff --git a/xen/arch/x86/include/asm/idt.h b/xen/arch/x86/include/asm/idt.h
index d795798d3e..f613d5693e 100644
--- a/xen/arch/x86/include/asm/idt.h
+++ b/xen/arch/x86/include/asm/idt.h
@@ -60,22 +60,6 @@ static inline void disable_each_ist(idt_entry_t *idt)
     set_ist(&idt[X86_EXC_DB],  IST_NONE);
 }
 
-#define _set_gate(gate_addr,type,dpl,addr)               \
-do {                                                     \
-    (gate_addr)->a = 0;                                  \
-    smp_wmb(); /* disable gate /then/ rewrite */         \
-    (gate_addr)->b =                                     \
-        ((unsigned long)(addr) >> 32);                   \
-    smp_wmb(); /* rewrite /then/ enable gate */          \
-    (gate_addr)->a =                                     \
-        (((unsigned long)(addr) & 0xFFFF0000UL) << 32) | \
-        ((unsigned long)(dpl) << 45) |                   \
-        ((unsigned long)(type) << 40) |                  \
-        ((unsigned long)(addr) & 0xFFFFUL) |             \
-        ((unsigned long)__HYPERVISOR_CS << 16) |         \
-        (1UL << 47);                                     \
-} while (0)
-
 /*
  * Write the lower 64 bits of an IDT Entry. This relies on the upper 32
  * bits of the address not changing, which is a safe assumption as all
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 4aeb6cab52..932800555b 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -141,21 +141,8 @@ static void cf_check nmi_softirq(void)
     *v_ptr = NULL;
 }
 
-void nocall entry_int80(void);
-void nocall entry_int82(void);
-
 void __init pv_trap_init(void)
 {
-#ifdef CONFIG_PV32
-    /* The 32-on-64 hypercall vector is only accessible from ring 1. */
-    _set_gate(bsp_idt + HYPERCALL_VECTOR,
-              SYS_DESC_irq_gate, 1, entry_int82);
-#endif
-
-    /* Fast trap for int80 (faster than taking the #GP-fixup path). */
-    _set_gate(bsp_idt + LEGACY_SYSCALL_VECTOR, SYS_DESC_irq_gate, 3,
-              &entry_int80);
-
     open_softirq(NMI_SOFTIRQ, nmi_softirq);
 }
 
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index d52840848d..7698fa580e 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1864,22 +1864,6 @@ void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
     panic("CONTROL-FLOW PROTECTION FAULT: #CP[%04x] %s\n", ec, err);
 }
 
-static void __init noinline __set_intr_gate(unsigned int n,
-                                            uint32_t dpl, void *addr)
-{
-    _set_gate(&bsp_idt[n], SYS_DESC_irq_gate, dpl, addr);
-}
-
-static void __init set_swint_gate(unsigned int n, void *addr)
-{
-    __set_intr_gate(n, 3, addr);
-}
-
-static void __init set_intr_gate(unsigned int n, void *addr)
-{
-    __set_intr_gate(n, 0, addr);
-}
-
 void percpu_traps_init(void)
 {
     subarch_percpu_traps_init();
@@ -1888,50 +1872,10 @@ void percpu_traps_init(void)
         wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
 }
 
-/* Exception entries */
-void nocall entry_DE(void);
-void nocall entry_DB(void);
-void nocall entry_NMI(void);
-void nocall entry_BP(void);
-void nocall entry_OF(void);
-void nocall entry_BR(void);
-void nocall entry_UD(void);
-void nocall entry_NM(void);
-void nocall entry_DF(void);
-void nocall entry_TS(void);
-void nocall entry_NP(void);
-void nocall entry_SS(void);
-void nocall entry_GP(void);
-void nocall early_page_fault(void);
 void nocall entry_PF(void);
-void nocall entry_MF(void);
-void nocall entry_AC(void);
-void nocall entry_MC(void);
-void nocall entry_XM(void);
-void nocall entry_CP(void);
 
 void __init init_idt_traps(void)
 {
-    set_intr_gate (X86_EXC_DE,  entry_DE);
-    set_intr_gate (X86_EXC_DB,  entry_DB);
-    set_intr_gate (X86_EXC_NMI, entry_NMI);
-    set_swint_gate(X86_EXC_BP,  entry_BP);
-    set_swint_gate(X86_EXC_OF,  entry_OF);
-    set_intr_gate (X86_EXC_BR,  entry_BR);
-    set_intr_gate (X86_EXC_UD,  entry_UD);
-    set_intr_gate (X86_EXC_NM,  entry_NM);
-    set_intr_gate (X86_EXC_DF,  entry_DF);
-    set_intr_gate (X86_EXC_TS,  entry_TS);
-    set_intr_gate (X86_EXC_NP,  entry_NP);
-    set_intr_gate (X86_EXC_SS,  entry_SS);
-    set_intr_gate (X86_EXC_GP,  entry_GP);
-    set_intr_gate (X86_EXC_PF,  early_page_fault);
-    set_intr_gate (X86_EXC_MF,  entry_MF);
-    set_intr_gate (X86_EXC_AC,  entry_AC);
-    set_intr_gate (X86_EXC_MC,  entry_MC);
-    set_intr_gate (X86_EXC_XM,  entry_XM);
-    set_intr_gate (X86_EXC_CP,  entry_CP);
-
     /* Specify dedicated interrupt stacks for NMI, #DF, and #MC. */
     enable_each_ist(bsp_idt);
 
@@ -1979,31 +1923,13 @@ static void __init init_ler(void)
     setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
 }
 
-extern void (*const autogen_entrypoints[X86_IDT_VECTORS])(void);
 void __init trap_init(void)
 {
-    unsigned int vector;
-
     /* Replace early pagefault with real pagefault handler. */
-    set_intr_gate(X86_EXC_PF, entry_PF);
+    _update_gate_addr_lower(&bsp_idt[X86_EXC_PF], entry_PF);
 
     pv_trap_init();
 
-    for ( vector = 0; vector < X86_IDT_VECTORS; ++vector )
-    {
-        if ( autogen_entrypoints[vector] )
-        {
-            /* Found autogen entry: check we won't clobber an existing trap. */
-            ASSERT(bsp_idt[vector].b == 0);
-            set_intr_gate(vector, autogen_entrypoints[vector]);
-        }
-        else
-        {
-            /* No entry point: confirm we have an existing trap in place. */
-            ASSERT(bsp_idt[vector].b != 0);
-        }
-    }
-
     init_ler();
 
     /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 84d0c29530..d81a626d16 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -1304,63 +1304,3 @@ END(bsp_idt)
             .error "Bad bsp_idt size, should be PAGE_SIZE"
         .endif
         .popsection
-
-/* Table of automatically generated entry points.  One per vector. */
-        .pushsection .init.rodata, "a", @progbits
-DATA(autogen_entrypoints, 8)
-        /* pop into the .init.rodata section and record an entry point. */
-        .macro entrypoint ent
-        .pushsection .init.rodata, "a", @progbits
-        .quad \ent
-        .popsection
-        .endm
-
-        .popsection
-FUNC_LOCAL(autogen_stubs, 0) /* Automatically generated stubs. */
-
-        vec = 0
-        .rept X86_IDT_VECTORS
-
-        /* Common interrupts, heading towards do_IRQ(). */
-#if defined(CONFIG_PV32)
-        .if vec >= FIRST_IRQ_VECTOR && vec != HYPERCALL_VECTOR && vec != LEGACY_SYSCALL_VECTOR
-#elif defined(CONFIG_PV)
-        .if vec >= FIRST_IRQ_VECTOR && vec != LEGACY_SYSCALL_VECTOR
-#else
-        .if vec >= FIRST_IRQ_VECTOR
-#endif
-
-        .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL
-1:
-        ENDBR64
-        pushq $0
-        movb  $vec, EFRAME_entry_vector(%rsp)
-        jmp   common_interrupt
-
-        entrypoint 1b
-
-        /* Reserved exceptions, heading towards do_unhandled_trap(). */
-        .elseif vec == X86_EXC_CSO || vec == X86_EXC_SPV || \
-                vec == X86_EXC_VE  || (vec > X86_EXC_CP && vec < X86_EXC_NUM)
-
-1:
-        ENDBR64
-        test  $8,%spl        /* 64bit exception frames are 16 byte aligned, but the word */
-        jz    2f             /* size is 8 bytes.  Check whether the processor gave us an */
-        pushq $0             /* error code, and insert an empty one if not.              */
-2:      movb  $vec, EFRAME_entry_vector(%rsp)
-        jmp   handle_exception
-
-        entrypoint 1b
-
-        /* Hand crafted entry points above. */
-        .else
-        entrypoint 0
-        .endif
-
-        vec = vec + 1
-        .endr
-END(autogen_stubs)
-
-        .section .init.rodata, "a", @progbits
-END(autogen_entrypoints)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 16:00:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 16:00:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905164.1312992 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa7v-00049I-GX; Fri, 07 Mar 2025 16:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905164.1312992; Fri, 07 Mar 2025 16:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa7v-00049A-Dz; Fri, 07 Mar 2025 16:00:43 +0000
Received: by outflank-mailman (input) for mailman id 905164;
 Fri, 07 Mar 2025 16:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqa7u-000492-Rj
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 16:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa7v-007363-0C
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa7u-00ClqF-2O
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gDguucl1IrzGgQv67NQtd9481AwzMSlplAbSnKtX/dE=; b=ahc47Sfq73nNobfm0ZMezbtZ4q
	X23lTeCfOBiqxJ2KMOu6JOcTyYGwaNl3EuWYGwMT++I9ol2MpgJU17TA+BASoiVQOhcc0o1bvSQSJ
	RsR6HR2ojpPq3t4Q5LpzimWuPnMm435X/mR9/KdOqzdfuV7IWPQyib3KA45tD/huqB4E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Convert pv_trap_init() to being an initcall
Message-Id: <E1tqa7u-00ClqF-2O@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 16:00:42 +0000

commit 5b7ac8d86395da89a8ad76d973b1078baeab7755
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 3 17:17:38 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/traps: Convert pv_trap_init() to being an initcall
    
    With most of pv_trap_init() being done at build time, opening of NMI_SOFTIRQ
    can be a regular initcall, simplifying trap_init().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/pv/traps.h | 4 ----
 xen/arch/x86/pv/traps.c             | 5 ++++-
 xen/arch/x86/traps.c                | 2 --
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/include/asm/pv/traps.h b/xen/arch/x86/include/asm/pv/traps.h
index 404f5b169c..8c31d5a793 100644
--- a/xen/arch/x86/include/asm/pv/traps.h
+++ b/xen/arch/x86/include/asm/pv/traps.h
@@ -14,8 +14,6 @@
 
 #include <public/xen.h>
 
-void pv_trap_init(void);
-
 int pv_raise_nmi(struct vcpu *v);
 
 int pv_emulate_privileged_op(struct cpu_user_regs *regs);
@@ -32,8 +30,6 @@ static inline bool pv_trap_callback_registered(const struct vcpu *v,
 
 #include <xen/errno.h>
 
-static inline void pv_trap_init(void) {}
-
 static inline int pv_raise_nmi(struct vcpu *v) { return -EOPNOTSUPP; }
 
 static inline int pv_emulate_privileged_op(struct cpu_user_regs *regs) { return 0; }
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 932800555b..c3c0976c44 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -141,10 +141,13 @@ static void cf_check nmi_softirq(void)
     *v_ptr = NULL;
 }
 
-void __init pv_trap_init(void)
+static int __init cf_check pv_trap_init(void)
 {
     open_softirq(NMI_SOFTIRQ, nmi_softirq);
+
+    return 0;
 }
+__initcall(pv_trap_init);
 
 /*
  * Deliver NMI to PV guest. Return 0 on success.
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 7698fa580e..5addb1f903 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1928,8 +1928,6 @@ void __init trap_init(void)
     /* Replace early pagefault with real pagefault handler. */
     _update_gate_addr_lower(&bsp_idt[X86_EXC_PF], entry_PF);
 
-    pv_trap_init();
-
     init_ler();
 
     /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 16:00:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 16:00:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905165.1312997 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa85-0004CF-IY; Fri, 07 Mar 2025 16:00:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905165.1312997; Fri, 07 Mar 2025 16:00:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa85-0004C7-FO; Fri, 07 Mar 2025 16:00:53 +0000
Received: by outflank-mailman (input) for mailman id 905165;
 Fri, 07 Mar 2025 16:00:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqa84-0004Bu-VT
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 16:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa85-007369-0X
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa84-00Clr8-2q
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=o4LANnlTjwqStpPaycp7rD/hhYY2UDx4SFVpcBGt8yw=; b=qPcKUoZzMOhxwPyD0AkfFP9gBJ
	7uPu0BEzC6W32stwEshhDr6llF1+gJOlN9ukn9xNT0CJ7Pqa1ri3ICxctHOCJxPc/lc87Qk6frGxa
	LESdkXHSqt/0qwMKSzW7qQLNuCJyO1z12/TNk6DPG0/AUEPwUWsvsnTaggZnqMOdZ2Ew=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/domain: Annotate struct domain as page aligned
Message-Id: <E1tqa84-00Clr8-2q@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 16:00:52 +0000

commit 8c12e47a5d3b8ef7484b4a6d04b73bd6c61a82cf
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 18 23:01:11 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    xen/domain: Annotate struct domain as page aligned
    
    struct domain is always a page aligned allocation.  Update it's type to
    reflect this, so we can safely reuse the lower bits in the pointer for
    auxiliary information.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/xen/sched.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 75add0f216..559d201e0c 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -651,7 +651,7 @@ struct domain
     unsigned int num_llc_colors;
     const unsigned int *llc_colors;
 #endif
-};
+} __aligned(PAGE_SIZE);
 
 static inline struct page_list_head *page_to_list(
     struct domain *d, const struct page_info *pg)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 16:01:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 16:01:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905166.1313000 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa8F-0004En-JU; Fri, 07 Mar 2025 16:01:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905166.1313000; Fri, 07 Mar 2025 16:01:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa8F-0004Ef-Gk; Fri, 07 Mar 2025 16:01:03 +0000
Received: by outflank-mailman (input) for mailman id 905166;
 Fri, 07 Mar 2025 16:01:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqa8F-0004EU-2F
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 16:01:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa8F-00736S-0t
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:01:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa8E-00Clrx-3C
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GlshJjqNBSf68G97NhMYyvPA4hbS5j1AKJcgZXgoCQ8=; b=k0RHhWycje+kkdkWV4rPG0L4xG
	pPTfLMY7pkenCtLORz4WJYYdlmkhqvJCBmJuvTBpR8fb4XcxyzngenKFoiVw9X5EcROeTFVi1DCs8
	hsGv9dtLfsgXJvMOx5Gm+kyOEUZGw09UXFzIjuFkqwFv9G+K3nbEED+yAGX5zeDWLhhg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vmx: Rewrite vmx_sync_pir_to_irr() to be more efficient
Message-Id: <E1tqa8E-00Clrx-3C@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 16:01:02 +0000

commit e6dfe4250c6b8485d558a0531266f6dd01c91e46
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jun 25 17:23:12 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/vmx: Rewrite vmx_sync_pir_to_irr() to be more efficient
    
    There are two issues.  First, pi_test_and_clear_on() pulls the cache-line to
    the CPU and dirties it even if there's nothing outstanding, and second,
    bitmap_for_each() is O(256) when O(8) would do, and would avoid multiple
    atomic updates to the same IRR word.
    
    Rewrite it from scratch, explaining what's going on at each step.
    
    Bloat-o-meter reports 177 -> 145 (net -32), but real improvement is the
    removal of calls to __find_{first,next}_bit() hidden behind bitmap_for_each().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vmx/vmx.c | 70 ++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 62 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 1911e79517..0241303b4b 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2314,18 +2314,72 @@ static void cf_check vmx_deliver_posted_intr(struct vcpu *v, u8 vector)
 
 static void cf_check vmx_sync_pir_to_irr(struct vcpu *v)
 {
-    struct vlapic *vlapic = vcpu_vlapic(v);
-    unsigned int group, i;
-    DECLARE_BITMAP(pending_intr, X86_IDT_VECTORS);
+    struct pi_desc *desc = &v->arch.hvm.vmx.pi_desc;
+    union {
+        unsigned long _ul[X86_IDT_VECTORS / BITS_PER_LONG];
+        uint32_t      _32[X86_IDT_VECTORS / (sizeof(uint32_t) * 8)];
+    } vec;
+    uint32_t *irr;
+    bool on;
 
-    if ( !pi_test_and_clear_on(&v->arch.hvm.vmx.pi_desc) )
+    /*
+     * The PIR is a contended cacheline which bounces between the CPU(s) and
+     * IOMMU(s).  An IOMMU updates the entire PIR atomically, but we can't
+     * express the same on the CPU side, so care has to be taken.
+     *
+     * First, do a plain read of ON.  If the PIR hasn't been modified, this
+     * will keep the cacheline Shared and not pull it Exclusive on the current
+     * CPU.
+     */
+    if ( !pi_test_on(desc) )
         return;
 
-    for ( group = 0; group < ARRAY_SIZE(pending_intr); group++ )
-        pending_intr[group] = pi_get_pir(&v->arch.hvm.vmx.pi_desc, group);
+    /*
+     * Second, if the plain read said that ON was set, we must clear it with
+     * an atomic action.  This will bring the cacheline to Exclusive on the
+     * current CPU.
+     *
+     * This should always succeed because no-one else should be playing with
+     * the PIR behind our back, but assert so just in case.
+     */
+    on = pi_test_and_clear_on(desc);
+    ASSERT(on);
+
+    /*
+     * The cacheline will have become Exclusive on the current CPU, and
+     * because ON was set, some other entity (an IOMMU, or Xen on another CPU)
+     * has indicated that the PIR needs re-scanning.
+     *
+     * Note: Entities which can't update the entire cacheline atomically
+     *       (i.e. Xen on another CPU) are required to update PIR first, then
+     *       set ON.  Therefore, there is a corner case where we may have
+     *       found and processed the PIR updates "last time around" and only
+     *       found ON this time around.  This is fine; the logic still
+     *       operates correctly.
+     *
+     * Atomically read and clear the entire pending bitmap as fast as we can,
+     * to reduce the window where another entity may steal the cacheline back
+     * from us.  This is a performance concern, not a correctness concern; if
+     * another entity does steal the cacheline, we'll just wait for it to
+     * return.
+     */
+    for ( unsigned int i = 0; i < ARRAY_SIZE(vec._ul); ++i )
+        vec._ul[i] = xchg(&desc->pir[i], 0);
+
+    /*
+     * Finally, merge the pending vectors into IRR.  The IRR register is
+     * scattered in memory, so we have to do this 32 bits at a time.
+     */
+    irr = (uint32_t *)&vcpu_vlapic(v)->regs->data[APIC_IRR];
+    for ( unsigned int i = 0; i < ARRAY_SIZE(vec._32); ++i )
+    {
+        if ( !vec._32[i] )
+            continue;
 
-    bitmap_for_each ( i, pending_intr, X86_IDT_VECTORS )
-        vlapic_set_vector(i, &vlapic->regs->data[APIC_IRR]);
+        asm ( "lock or %[val], %[irr]"
+              : [irr] "+m" (irr[i * 4])
+              : [val] "r" (vec._32[i]) );
+    }
 }
 
 static bool cf_check vmx_test_pir(const struct vcpu *v, uint8_t vec)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 16:01:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 16:01:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905167.1313004 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa8P-0004HA-Ku; Fri, 07 Mar 2025 16:01:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905167.1313004; Fri, 07 Mar 2025 16:01:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa8P-0004H3-I9; Fri, 07 Mar 2025 16:01:13 +0000
Received: by outflank-mailman (input) for mailman id 905167;
 Fri, 07 Mar 2025 16:01:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqa8P-0004Gv-65
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 16:01:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa8P-00736W-1G
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:01:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa8P-00CltC-0K
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:01:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H4e2att/z6YL+EsXeWIv4dpeehh/DHCmvKXa4QLnuVw=; b=Dbkbc9E2/aze+BEqRW2mCmp389
	s03IbqOkHHvNpDy1Y2BqnpLvwmcx9+VY2zw7gPI7FstOx65+q5oZz3E7LK1sU3BiGvLPjMCJOFQdy
	hIXxJ54U+nuvB5qezfdT3Ro1INN814f2EiXjybhOqDaKDars4QkydsARMp7gQOJLrU8o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/trampoline: Rename entrypoints
Message-Id: <E1tqa8P-00CltC-0K@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 16:01:13 +0000

commit 7d6b66163b96a52bf4841a7245bf67f4b9124e4e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 25 15:28:04 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/trampoline: Rename entrypoints
    
    ... to be more concise, and to match our other entrypoints into Xen.
    
    In acpi_sleep_prepare(), calculate bootsym_phys() once, which GCC seems
    unwilling to of it's own accord.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/power.c             |  9 ++++++---
 xen/arch/x86/boot/trampoline.S        |  5 ++---
 xen/arch/x86/boot/wakeup.S            | 10 +++++-----
 xen/arch/x86/include/asm/trampoline.h |  4 ++--
 xen/arch/x86/smpboot.c                |  2 +-
 5 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index d0b67614d5..fe70257864 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -169,6 +169,7 @@ static void thaw_domains(void)
 static void acpi_sleep_prepare(u32 state)
 {
     void *wakeup_vector_va;
+    paddr_t entry_pa;
 
     if ( state != ACPI_STATE_S3 )
         return;
@@ -181,10 +182,12 @@ static void acpi_sleep_prepare(u32 state)
     wakeup_vector_va = fix_to_virt(FIX_ACPI_END) +
                        PAGE_OFFSET(acpi_sinfo.wakeup_vector);
 
+    entry_pa = bootsym_phys(entry_S3);
+
     if ( acpi_sinfo.vector_width == 32 )
-        *(uint32_t *)wakeup_vector_va = bootsym_phys(wakeup_start);
+        *(uint32_t *)wakeup_vector_va = entry_pa;
     else
-        *(uint64_t *)wakeup_vector_va = bootsym_phys(wakeup_start);
+        *(uint64_t *)wakeup_vector_va = entry_pa;
 
     clear_fixmap(FIX_ACPI_END);
 }
@@ -446,7 +449,7 @@ static void tboot_sleep(u8 sleep_state)
     g_tboot_shared->acpi_sinfo.wakeup_vector = acpi_sinfo.wakeup_vector;
     g_tboot_shared->acpi_sinfo.vector_width = acpi_sinfo.vector_width;
     g_tboot_shared->acpi_sinfo.kernel_s3_resume_vector =
-                                              bootsym_phys(wakeup_start);
+                                              bootsym_phys(entry_S3);
 
     switch ( sleep_state )
     {
diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S
index 924bda37c1..a92e399fbe 100644
--- a/xen/arch/x86/boot/trampoline.S
+++ b/xen/arch/x86/boot/trampoline.S
@@ -42,10 +42,9 @@
  * do_boot_cpu() programs the Startup-IPI to point here.  Due to the SIPI
  * format, the relocated entrypoint must be 4k aligned.
  *
- * It is entered in Real Mode, with %cs = trampoline_realmode_entry >> 4 and
- * %ip = 0.
+ * It is entered in Real Mode, with %cs = entry_SIPI16 >> 4 and %ip = 0.
  */
-GLOBAL(trampoline_realmode_entry)
+GLOBAL(entry_SIPI16)
         mov     %cs,%ax
         mov     %ax,%ds
         movb    $0xA5,bootsym(trampoline_cpu_started)
diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S
index bbf9aa6040..654e97005f 100644
--- a/xen/arch/x86/boot/wakeup.S
+++ b/xen/arch/x86/boot/wakeup.S
@@ -7,18 +7,18 @@
         .equ    wakeup_stack, trampoline_start + PAGE_SIZE
         .local  wakeup_stack
 
-#define wakesym(sym) (sym - wakeup_start)
+#define wakesym(sym) (sym - entry_S3)
 
 /*
  * acpi_sleep_prepare() programs the S3 wakeup vector to point here.
  *
  * The ACPI spec says that we shall be entered in Real Mode with:
- *   %cs = wakeup_start >> 4
- *   %ip = wakeup_start & 0xf
+ *   %cs = entry_S3 >> 4
+ *   %ip = entry_S3 & 0xf
  *
- * As wakeup_start is 16-byte aligned, %ip is 0 in practice.
+ * As entry_S3 is 16-byte aligned, %ip is 0 in practice.
  */
-ENTRY(wakeup_start)
+ENTRY(entry_S3)
         cli
         cld
 
diff --git a/xen/arch/x86/include/asm/trampoline.h b/xen/arch/x86/include/asm/trampoline.h
index 0c508d0222..dc536efe1f 100644
--- a/xen/arch/x86/include/asm/trampoline.h
+++ b/xen/arch/x86/include/asm/trampoline.h
@@ -130,10 +130,10 @@ extern uint32_t trampoline_phys;
 #define bootsym(sym) (*((typeof(sym) *)__va(bootsym_phys(sym))))
 
 /* The INIT-SIPI-SIPI entrypoint.  16-bit code. */
-void nocall trampoline_realmode_entry(void);
+void nocall entry_SIPI16(void);
 
 /* The S3 wakeup vector.  16-bit code. */
-void nocall wakeup_start(void);
+void nocall entry_S3(void);
 
 /*
  * A variable in the trampoline, containing Xen's physical address.  Amongst
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 4e9f9ac4b2..b63a9ce13e 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -572,7 +572,7 @@ static int do_boot_cpu(int apicid, int cpu)
 
     booting_cpu = cpu;
 
-    start_eip = bootsym_phys(trampoline_realmode_entry);
+    start_eip = bootsym_phys(entry_SIPI16);
 
     /* start_eip needs be page aligned, and below the 1M boundary. */
     if ( start_eip & ~0xff000 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 16:01:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 16:01:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905168.1313008 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa8a-0004KL-Nv; Fri, 07 Mar 2025 16:01:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905168.1313008; Fri, 07 Mar 2025 16:01:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa8a-0004KD-LJ; Fri, 07 Mar 2025 16:01:24 +0000
Received: by outflank-mailman (input) for mailman id 905168;
 Fri, 07 Mar 2025 16:01:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqa8Z-0004Jx-9N
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 16:01:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa8Z-00736y-1b
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:01:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa8Z-00CltY-0h
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:01:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5rkInyRlmcZrEZWom3TFPYDwdLRIKen7GvrxfUGOnbw=; b=cY9PZrSitkPxinLazEbBbcOw0A
	LyKtuP7kq1N805zdNUG1RHD7KcoLHhl7ikWIAgR58Nte7UMPBrRrr1bL4aRCyg6V7q+DVf1Jz3ZPA
	OKqCqIn5LLydAtZbDOvMcaIF0Fu2k6FlFrd0F7JzgNrtH0jO8oisLediEiKSJh+BbGQ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vlapic: Fix handling of writes to APIC_ESR
Message-Id: <E1tqa8Z-00CltY-0h@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 16:01:23 +0000

commit b28b590d4a23894672f1dd7fb98cdf9926ecb282
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Nov 28 00:47:36 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/vlapic: Fix handling of writes to APIC_ESR
    
    Xen currently presents APIC_ESR to guests as a simple read/write register.
    
    This is incorrect.  The SDM states:
    
      The ESR is a write/read register. Before attempt to read from the ESR,
      software should first write to it. (The value written does not affect the
      values read subsequently; only zero may be written in x2APIC mode.) This
      write clears any previously logged errors and updates the ESR with any
      errors detected since the last write to the ESR.
    
    Introduce a new pending_esr field in hvm_hw_lapic.
    
    Update vlapic_error() to accumulate errors here, and extend vlapic_reg_write()
    to discard the written value and transfer pending_esr into APIC_ESR.  Reads
    are still as before.
    
    Importantly, this means that guests no longer destroys the ESR value it's
    looking for in the LVTERR handler when following the SDM instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vlapic.c              | 17 +++++++++++++++--
 xen/include/public/arch-x86/hvm/save.h |  1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 91fc457165..d7dd430bd1 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -108,7 +108,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     uint32_t esr;
 
     spin_lock_irqsave(&vlapic->esr_lock, flags);
-    esr = vlapic_get_reg(vlapic, APIC_ESR);
+    esr = vlapic->hw.pending_esr;
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
@@ -127,7 +127,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
                  errmask |= APIC_ESR_RECVILL;
         }
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+        vlapic->hw.pending_esr |= errmask;
 
         if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
@@ -802,6 +802,19 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         vlapic_set_reg(vlapic, APIC_ID, val);
         break;
 
+    case APIC_ESR:
+    {
+        unsigned long flags;
+
+        spin_lock_irqsave(&vlapic->esr_lock, flags);
+        val = vlapic->hw.pending_esr;
+        vlapic->hw.pending_esr = 0;
+        spin_unlock_irqrestore(&vlapic->esr_lock, flags);
+
+        vlapic_set_reg(vlapic, APIC_ESR, val);
+        break;
+    }
+
     case APIC_TASKPRI:
         vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff);
         break;
diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h
index 7ecacadde1..9c4bfc7ebd 100644
--- a/xen/include/public/arch-x86/hvm/save.h
+++ b/xen/include/public/arch-x86/hvm/save.h
@@ -394,6 +394,7 @@ struct hvm_hw_lapic {
     uint32_t             disabled; /* VLAPIC_xx_DISABLED */
     uint32_t             timer_divisor;
     uint64_t             tdt_msr;
+    uint32_t             pending_esr;
 };
 
 DECLARE_HVM_SAVE_TYPE(LAPIC, 5, struct hvm_hw_lapic);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 16:01:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 16:01:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905169.1313012 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa8k-0004Mp-PM; Fri, 07 Mar 2025 16:01:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905169.1313012; Fri, 07 Mar 2025 16:01:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa8k-0004Mh-Mo; Fri, 07 Mar 2025 16:01:34 +0000
Received: by outflank-mailman (input) for mailman id 905169;
 Fri, 07 Mar 2025 16:01:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqa8j-0004MV-CB
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 16:01:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa8j-007375-1s
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:01:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa8j-00Clu9-11
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:01:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6vv1/+I57SvestmzyfwfywPUoA+Hv3QCng9OD0oeQDM=; b=ZI00alNo26+WyGiGOxVDl9Ov9l
	KQ1Op4w06FyrGJ5HqjcJdUEpKN1cCHJPnUd5ZVLGcnG84FD3OjCqT33p/6S436rG7evlBTBRxDj2R
	QtRkAtnEoRx6+U2MvQjomOs/geNAkPi1p7WtiJ1qnTakvIAB7u34WUz+TQZ5+qrIGYuU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vlapic: Drop vlapic->esr_lock
Message-Id: <E1tqa8j-00Clu9-11@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 16:01:33 +0000

commit 1ecc4effa7c56cc0072437e69bc68fea844345fe
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Nov 28 00:47:37 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/vlapic: Drop vlapic->esr_lock
    
    The exact behaviour of LVTERR interrupt generation is implementation
    specific.
    
     * Newer Intel CPUs generate an interrupt when pending_esr becomes
       nonzero.
    
     * Older Intel and all AMD CPUs generate an interrupt when any
       individual bit in pending_esr becomes nonzero.
    
    Neither vendor documents their behaviour very well.  Xen implements
    the per-bit behaviour and has done since support was added.
    
    Importantly, the per-bit behaviour can be expressed using the atomic
    operations available in the x86 architecture, whereas the
    former (interrupt only on pending_esr becoming nonzero) cannot.
    
    With vlapic->hw.pending_esr held outside of the main LAPIC register page,
    it's much easier to use atomic operations.
    
    Use xchg() in vlapic_reg_write(), and *set_bit() in vlapic_error().
    
    The only interesting change is that vlapic_error() now needs to take a
    single bit only, rather than a mask, but this fine for all current
    callers and forseable changes.
    
    No change from a guests perspective.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vlapic.c             | 41 +++++++++++++----------------------
 xen/arch/x86/include/asm/hvm/vlapic.h |  1 -
 2 files changed, 15 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index d7dd430bd1..065b2aab5b 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -102,14 +102,16 @@ static int vlapic_find_highest_irr(struct vlapic *vlapic)
     return vlapic_find_highest_vector(&vlapic->regs->data[APIC_IRR]);
 }
 
-static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
+static void vlapic_error(struct vlapic *vlapic, unsigned int err_bit)
 {
-    unsigned long flags;
-    uint32_t esr;
-
-    spin_lock_irqsave(&vlapic->esr_lock, flags);
-    esr = vlapic->hw.pending_esr;
-    if ( (esr & errmask) != errmask )
+    /*
+     * Whether LVTERR is delivered on a per-bit basis, or only on
+     * pending_esr becoming nonzero is implementation specific.
+     *
+     * Xen implements the per-bit behaviour as it can be expressed
+     * locklessly.
+     */
+    if ( !test_and_set_bit(err_bit, &vlapic->hw.pending_esr) )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
         bool inj = false;
@@ -122,17 +124,14 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
              * if it will succeed, and folding in RECVILL otherwise.
              */
             if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
-                 inj = true;
+                inj = true;
             else
-                 errmask |= APIC_ESR_RECVILL;
+                set_bit(ilog2(APIC_ESR_RECVILL), &vlapic->hw.pending_esr);
         }
 
-        vlapic->hw.pending_esr |= errmask;
-
         if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
     }
-    spin_unlock_irqrestore(&vlapic->esr_lock, flags);
 }
 
 bool vlapic_test_irq(const struct vlapic *vlapic, uint8_t vec)
@@ -153,7 +152,7 @@ void vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig)
 
     if ( unlikely(vec < 16) )
     {
-        vlapic_error(vlapic, APIC_ESR_RECVILL);
+        vlapic_error(vlapic, ilog2(APIC_ESR_RECVILL));
         return;
     }
 
@@ -525,7 +524,7 @@ void vlapic_ipi(
             vlapic_domain(vlapic), vlapic, short_hand, dest, dest_mode);
 
         if ( unlikely((icr_low & APIC_VECTOR_MASK) < 16) )
-            vlapic_error(vlapic, APIC_ESR_SENDILL);
+            vlapic_error(vlapic, ilog2(APIC_ESR_SENDILL));
         else if ( target )
             vlapic_accept_irq(vlapic_vcpu(target), icr_low);
         break;
@@ -534,7 +533,7 @@ void vlapic_ipi(
     case APIC_DM_FIXED:
         if ( unlikely((icr_low & APIC_VECTOR_MASK) < 16) )
         {
-            vlapic_error(vlapic, APIC_ESR_SENDILL);
+            vlapic_error(vlapic, ilog2(APIC_ESR_SENDILL));
             break;
         }
         /* fall through */
@@ -803,17 +802,9 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         break;
 
     case APIC_ESR:
-    {
-        unsigned long flags;
-
-        spin_lock_irqsave(&vlapic->esr_lock, flags);
-        val = vlapic->hw.pending_esr;
-        vlapic->hw.pending_esr = 0;
-        spin_unlock_irqrestore(&vlapic->esr_lock, flags);
-
+        val = xchg(&vlapic->hw.pending_esr, 0);
         vlapic_set_reg(vlapic, APIC_ESR, val);
         break;
-    }
 
     case APIC_TASKPRI:
         vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff);
@@ -1716,8 +1707,6 @@ int vlapic_init(struct vcpu *v)
 
     vlapic_reset(vlapic);
 
-    spin_lock_init(&vlapic->esr_lock);
-
     tasklet_init(&vlapic->init_sipi.tasklet, vlapic_init_sipi_action, v);
 
     if ( v->vcpu_id == 0 )
diff --git a/xen/arch/x86/include/asm/hvm/vlapic.h b/xen/arch/x86/include/asm/hvm/vlapic.h
index 2c4ff94ae7..c388551198 100644
--- a/xen/arch/x86/include/asm/hvm/vlapic.h
+++ b/xen/arch/x86/include/asm/hvm/vlapic.h
@@ -69,7 +69,6 @@ struct vlapic {
         bool                 hw, regs;
         uint32_t             id, ldr;
     }                        loaded;
-    spinlock_t               esr_lock;
     struct periodic_time     pt;
     s_time_t                 timer_last_update;
     struct page_info         *regs_page;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 16:01:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 16:01:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905170.1313016 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa8u-0004PJ-R7; Fri, 07 Mar 2025 16:01:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905170.1313016; Fri, 07 Mar 2025 16:01:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqa8u-0004PB-OI; Fri, 07 Mar 2025 16:01:44 +0000
Received: by outflank-mailman (input) for mailman id 905170;
 Fri, 07 Mar 2025 16:01:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqa8t-0004Oy-Ev
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 16:01:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa8t-007379-28
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:01:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqa8t-00Cluf-1I
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 16:01:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gSe0kU2JjF7hFMsGqcDht9ZkdqvCF+lMczWtAzPK/FU=; b=tlJiTWOIaCFx6qNlAIWJSsNumo
	ftEr0SsytPuLVNfII296Uz6Xkv0hDinP+wNoM4tX9IQM3KQVtSozsdCdjM2t8r54wRK/XS6DL4Avu
	k1rthlJi2KWd5S40Sgs9hU3ZJCfPvRdhqGrCBUPMfwCGoc+/37eh78y+5xZN2WWhPhbA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/e820: Remove opencoded vendor/feature checks
Message-Id: <E1tqa8t-00Cluf-1I@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 16:01:43 +0000

commit ac29d63a0fa6a3ed98ecf86f95995811c301308f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 6 23:21:07 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/e820: Remove opencoded vendor/feature checks
    
    We've already scanned features by the time init_e820() is called.  Remove the
    cpuid() calls.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/e820.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
index e052e84de7..ca577c0bde 100644
--- a/xen/arch/x86/e820.c
+++ b/xen/arch/x86/e820.c
@@ -421,21 +421,12 @@ static void __init clip_to_limit(uint64_t limit, const char *warnmsg)
 /* Conservative estimate of top-of-RAM by looking for MTRR WB regions. */
 static uint64_t __init mtrr_top_of_ram(void)
 {
-    uint32_t eax, ebx, ecx, edx;
     uint64_t mtrr_cap, mtrr_def, addr_mask, base, mask, top;
     unsigned int i;
 
     /* By default we check only Intel systems. */
     if ( e820_mtrr_clip == -1 )
-    {
-        char vendor[13];
-        cpuid(0x00000000, &eax,
-              (uint32_t *)&vendor[0],
-              (uint32_t *)&vendor[8],
-              (uint32_t *)&vendor[4]);
-        vendor[12] = '\0';
-        e820_mtrr_clip = !strcmp(vendor, "GenuineIntel");
-    }
+        e820_mtrr_clip = boot_cpu_data.x86_vendor == X86_VENDOR_INTEL;
 
     if ( !e820_mtrr_clip )
         return 0;
@@ -444,8 +435,7 @@ static uint64_t __init mtrr_top_of_ram(void)
         printk("Checking MTRR ranges...\n");
 
     /* Does the CPU support architectural MTRRs? */
-    cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
-    if ( !test_bit(X86_FEATURE_MTRR & 31, &edx) )
+    if ( !cpu_has_mtrr )
          return 0;
 
     /* paddr_bits must have been set at this point */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 17:11:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 17:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905243.1313089 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbE0-00041G-18; Fri, 07 Mar 2025 17:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905243.1313089; Fri, 07 Mar 2025 17:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbDz-000419-V0; Fri, 07 Mar 2025 17:11:03 +0000
Received: by outflank-mailman (input) for mailman id 905243;
 Fri, 07 Mar 2025 17:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqbDy-000413-RK
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 17:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbDy-0074Uk-2l
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbDy-00Cv53-1d
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p/JoaL/scniKqdtLQsT8OkglbWf3OkEOp+FxENuXO4I=; b=eUGIHrtZAsx/3B9F8tslNIqsQ6
	thLPz3xkxmojNq2+XCT9GqUjqZXNIXyG43H3VRA3RAYj2tF9xxJXwX3gUCk9mHDOtNiScJJ694aVn
	5FUQaz0pI2B4snvkubpdO2GFKTb84XskMqTrJa0QtmAIl8r6jPUGtWHjbhL0OKpXRbuI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/IDT: Rename idt_table[] to bsp_idt[]
Message-Id: <E1tqbDy-00Cv53-1d@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 17:11:02 +0000

commit b7cfb45aaf0bbc74efda8f4534d3d5cb95daefe3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 2 17:17:30 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/IDT: Rename idt_table[] to bsp_idt[]
    
    Having variables named idt_table[] and idt_tables[] is not ideal.
    
    Use X86_IDT_VECTORS and remove IDT_ENTRIES.  State the size of bsp_idt[] in
    idt.h so that load_system_tables() and cpu_smpboot_alloc() can use sizeof()
    rather than opencoding the calculation.
    
    Move the variable into a new traps-setup.c, to make a start at splitting
    traps.c in half.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Makefile          |  1 +
 xen/arch/x86/cpu/common.c      |  2 +-
 xen/arch/x86/include/asm/idt.h |  3 +--
 xen/arch/x86/pv/traps.c        |  4 ++--
 xen/arch/x86/smpboot.c         |  2 +-
 xen/arch/x86/traps-setup.c     |  9 +++++++++
 xen/arch/x86/traps.c           | 14 +++++---------
 7 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index b35fd5196c..c763f80b0b 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -65,6 +65,7 @@ obj-y += spec_ctrl.o
 obj-y += srat.o
 obj-y += string.o
 obj-y += time.o
+obj-y += traps-setup.o
 obj-y += traps.o
 obj-$(CONFIG_INTEL) += tsx.o
 obj-y += usercopy.o
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 1540ab0007..e8b355ebcf 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -831,7 +831,7 @@ void load_system_tables(void)
 	};
 	const struct desc_ptr idtr = {
 		.base = (unsigned long)idt_tables[cpu],
-		.limit = (IDT_ENTRIES * sizeof(idt_entry_t)) - 1,
+		.limit = sizeof(bsp_idt) - 1,
 	};
 
 	/*
diff --git a/xen/arch/x86/include/asm/idt.h b/xen/arch/x86/include/asm/idt.h
index 3689fdecbe..f00368f28c 100644
--- a/xen/arch/x86/include/asm/idt.h
+++ b/xen/arch/x86/include/asm/idt.h
@@ -28,8 +28,7 @@ typedef union {
     };
 } idt_entry_t;
 
-#define IDT_ENTRIES 256
-extern idt_entry_t idt_table[];
+extern idt_entry_t bsp_idt[X86_IDT_VECTORS];
 extern idt_entry_t *idt_tables[];
 
 /*
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 77b034e4dc..4aeb6cab52 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -148,12 +148,12 @@ void __init pv_trap_init(void)
 {
 #ifdef CONFIG_PV32
     /* The 32-on-64 hypercall vector is only accessible from ring 1. */
-    _set_gate(idt_table + HYPERCALL_VECTOR,
+    _set_gate(bsp_idt + HYPERCALL_VECTOR,
               SYS_DESC_irq_gate, 1, entry_int82);
 #endif
 
     /* Fast trap for int80 (faster than taking the #GP-fixup path). */
-    _set_gate(idt_table + LEGACY_SYSCALL_VECTOR, SYS_DESC_irq_gate, 3,
+    _set_gate(bsp_idt + LEGACY_SYSCALL_VECTOR, SYS_DESC_irq_gate, 3,
               &entry_int80);
 
     open_softirq(NMI_SOFTIRQ, nmi_softirq);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index f3d60d5bae..dc65f9e452 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1080,7 +1080,7 @@ static int cpu_smpboot_alloc(unsigned int cpu)
         idt_tables[cpu] = alloc_xenheap_pages(0, memflags);
     if ( idt_tables[cpu] == NULL )
         goto out;
-    memcpy(idt_tables[cpu], idt_table, IDT_ENTRIES * sizeof(idt_entry_t));
+    memcpy(idt_tables[cpu], bsp_idt, sizeof(bsp_idt));
     disable_each_ist(idt_tables[cpu]);
 
     for ( stub_page = 0, i = cpu & ~(STUBS_PER_PAGE - 1);
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
new file mode 100644
index 0000000000..b172ea9336
--- /dev/null
+++ b/xen/arch/x86/traps-setup.c
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Configuration of event handling for all CPUs.
+ */
+#include <asm/idt.h>
+#include <asm/page.h>
+
+idt_entry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
+    bsp_idt[X86_IDT_VECTORS];
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 4d1aaa78e7..7a68996b02 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -98,10 +98,6 @@ DEFINE_PER_CPU_READ_MOSTLY(seg_desc_t *, compat_gdt);
 DEFINE_PER_CPU_READ_MOSTLY(l1_pgentry_t, compat_gdt_l1e);
 #endif
 
-/* Master table, used by CPU0. */
-idt_entry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
-    idt_table[IDT_ENTRIES];
-
 /* Pointer to the IDT of every CPU. */
 idt_entry_t *idt_tables[NR_CPUS] __read_mostly;
 
@@ -1874,7 +1870,7 @@ void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
 static void __init noinline __set_intr_gate(unsigned int n,
                                             uint32_t dpl, void *addr)
 {
-    _set_gate(&idt_table[n], SYS_DESC_irq_gate, dpl, addr);
+    _set_gate(&bsp_idt[n], SYS_DESC_irq_gate, dpl, addr);
 }
 
 static void __init set_swint_gate(unsigned int n, void *addr)
@@ -1940,10 +1936,10 @@ void __init init_idt_traps(void)
     set_intr_gate (X86_EXC_CP,  entry_CP);
 
     /* Specify dedicated interrupt stacks for NMI, #DF, and #MC. */
-    enable_each_ist(idt_table);
+    enable_each_ist(bsp_idt);
 
     /* CPU0 uses the master IDT. */
-    idt_tables[0] = idt_table;
+    idt_tables[0] = bsp_idt;
 
     this_cpu(gdt) = boot_gdt;
     if ( IS_ENABLED(CONFIG_PV32) )
@@ -2001,13 +1997,13 @@ void __init trap_init(void)
         if ( autogen_entrypoints[vector] )
         {
             /* Found autogen entry: check we won't clobber an existing trap. */
-            ASSERT(idt_table[vector].b == 0);
+            ASSERT(bsp_idt[vector].b == 0);
             set_intr_gate(vector, autogen_entrypoints[vector]);
         }
         else
         {
             /* No entry point: confirm we have an existing trap in place. */
-            ASSERT(idt_table[vector].b != 0);
+            ASSERT(bsp_idt[vector].b != 0);
         }
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 17:11:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 17:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905244.1313094 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbEA-00042p-31; Fri, 07 Mar 2025 17:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905244.1313094; Fri, 07 Mar 2025 17:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbEA-00042h-0F; Fri, 07 Mar 2025 17:11:14 +0000
Received: by outflank-mailman (input) for mailman id 905244;
 Fri, 07 Mar 2025 17:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqbE8-00042Z-R1
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 17:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbE8-0074Uo-3B
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbE8-00Cv5T-2F
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=z/iMs2jwKs1RzcMZye0IohCsnUm4qj4BrSfAscULVnU=; b=3ltdIy/jwHS+WpLhFKuCOtDExo
	ni3SzHJdz8bzQfFW39Xl+t/LJvuPUTq47gpQwo3V+iX/dwmwmzduDF1jFU0W9ItvMrVFYTS6ZRDtz
	lCJTcIsmjgqdgXMbXl/hVZkZ64vqlvSV9MiBRkaDVcu9FP1kuhtegn7Q8SESiJDy2EKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/IDT: Make idt_tables[] be per_cpu(idt)
Message-Id: <E1tqbE8-00Cv5T-2F@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 17:11:12 +0000

commit 9c20d3c5915d6e29054e2cdac91244f3a3424d08
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 2 17:47:24 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/IDT: Make idt_tables[] be per_cpu(idt)
    
    This can be a plain per_cpu() variable, and __read_mostly seeing as it's
    allocated once and not touched again during it's lifetime.
    
    This removes a NR_CPU's sized structure, and improves NUMA locality of access
    for both the the VT-x and SVM context switch paths.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c      |  5 +++--
 xen/arch/x86/crash.c           |  8 ++++----
 xen/arch/x86/domain.c          |  2 +-
 xen/arch/x86/hvm/svm/svm.c     |  4 ++--
 xen/arch/x86/hvm/vmx/vmcs.c    |  2 +-
 xen/arch/x86/include/asm/idt.h |  3 ++-
 xen/arch/x86/machine_kexec.c   |  7 +++++--
 xen/arch/x86/smpboot.c         | 14 +++++++-------
 xen/arch/x86/traps-setup.c     |  2 ++
 xen/arch/x86/traps.c           |  5 +----
 10 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index e8b355ebcf..e8d4ca3203 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -819,6 +819,7 @@ void load_system_tables(void)
 	 * support using ARRAY_SIZE against per-cpu variables.
 	 */
 	struct tss_page *tss_page = &this_cpu(tss_page);
+	idt_entry_t *idt = this_cpu(idt);
 
 	/* The TSS may be live.	 Disuade any clever optimisations. */
 	volatile struct tss64 *tss = &tss_page->tss;
@@ -830,7 +831,7 @@ void load_system_tables(void)
 		.limit = LAST_RESERVED_GDT_BYTE,
 	};
 	const struct desc_ptr idtr = {
-		.base = (unsigned long)idt_tables[cpu],
+		.base = (unsigned long)idt,
 		.limit = sizeof(bsp_idt) - 1,
 	};
 
@@ -914,7 +915,7 @@ void load_system_tables(void)
 	ltr(TSS_SELECTOR);
 	lldt(0);
 
-	enable_each_ist(idt_tables[cpu]);
+	enable_each_ist(idt);
 
 	/*
 	 * Bottom-of-stack must be 16-byte aligned!
diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 5f7d7b392a..1e4b0eeff2 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -63,7 +63,7 @@ static int noreturn cf_check do_nmi_crash(
          * This update is safe from a security point of view, as this
          * pcpu is never going to try to sysret back to a PV vcpu.
          */
-        set_ist(&idt_tables[cpu][X86_EXC_MC], IST_NONE);
+        set_ist(&per_cpu(idt, cpu)[X86_EXC_MC], IST_NONE);
 
         kexec_crash_save_cpu();
         __stop_this_cpu();
@@ -120,6 +120,7 @@ static void nmi_shootdown_cpus(void)
 {
     unsigned long msecs;
     unsigned int cpu = smp_processor_id();
+    idt_entry_t *idt = this_cpu(idt);
 
     disable_lapic_nmi_watchdog();
     local_irq_disable();
@@ -133,9 +134,8 @@ static void nmi_shootdown_cpus(void)
      * Disable IST for MCEs to avoid stack corruption race conditions, and
      * change the NMI handler to a nop to avoid deviation from this codepath.
      */
-    _set_gate_lower(&idt_tables[cpu][X86_EXC_NMI],
-                    SYS_DESC_irq_gate, 0, &trap_nop);
-    set_ist(&idt_tables[cpu][X86_EXC_MC], IST_NONE);
+    _set_gate_lower(&idt[X86_EXC_NMI], SYS_DESC_irq_gate, 0, &trap_nop);
+    set_ist(&idt[X86_EXC_MC], IST_NONE);
 
     set_nmi_callback(do_nmi_crash);
     smp_send_nmi_allbutself();
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index d3db76833f..a42fa54805 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -116,7 +116,7 @@ void play_dead(void)
     local_irq_disable();
 
     /* Change the NMI handler to a nop (see comment below). */
-    _set_gate_lower(&idt_tables[cpu][X86_EXC_NMI], SYS_DESC_irq_gate, 0,
+    _set_gate_lower(&this_cpu(idt)[X86_EXC_NMI], SYS_DESC_irq_gate, 0,
                     &trap_nop);
 
     /*
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 42128e33ce..4b24891096 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -915,7 +915,7 @@ static void cf_check svm_ctxt_switch_from(struct vcpu *v)
     svm_vmload_pa(per_cpu(host_vmcb, cpu));
 
     /* Resume use of ISTs now that the host TR is reinstated. */
-    enable_each_ist(idt_tables[cpu]);
+    enable_each_ist(per_cpu(idt, cpu));
 
     /*
      * Possibly clear previous guest selection of SSBD if set.  Note that
@@ -944,7 +944,7 @@ static void cf_check svm_ctxt_switch_to(struct vcpu *v)
      * Cannot use ISTs for NMI/#MC/#DF while we are running with the guest TR.
      * But this doesn't matter: the IST is only req'd to handle SYSCALL/SYSRET.
      */
-    disable_each_ist(idt_tables[cpu]);
+    disable_each_ist(per_cpu(idt, cpu));
 
     svm_restore_dr(v);
 
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index cfb541de13..0ba65becec 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -893,7 +893,7 @@ static void vmx_set_host_env(struct vcpu *v)
 
     __vmwrite(HOST_GDTR_BASE,
               (unsigned long)(this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY));
-    __vmwrite(HOST_IDTR_BASE, (unsigned long)idt_tables[cpu]);
+    __vmwrite(HOST_IDTR_BASE, (unsigned long)per_cpu(idt, cpu));
 
     __vmwrite(HOST_TR_BASE, (unsigned long)&per_cpu(tss_page, cpu).tss);
 
diff --git a/xen/arch/x86/include/asm/idt.h b/xen/arch/x86/include/asm/idt.h
index f00368f28c..d795798d3e 100644
--- a/xen/arch/x86/include/asm/idt.h
+++ b/xen/arch/x86/include/asm/idt.h
@@ -3,6 +3,7 @@
 #define X86_ASM_IDT_H
 
 #include <xen/bug.h>
+#include <xen/percpu.h>
 
 #include <asm/x86-defns.h>
 
@@ -29,7 +30,7 @@ typedef union {
 } idt_entry_t;
 
 extern idt_entry_t bsp_idt[X86_IDT_VECTORS];
-extern idt_entry_t *idt_tables[];
+DECLARE_PER_CPU(idt_entry_t *, idt);
 
 /*
  * Set the Interrupt Stack Table used by a particular IDT entry.  Typically
diff --git a/xen/arch/x86/machine_kexec.c b/xen/arch/x86/machine_kexec.c
index f775e526d5..35fa5c82e9 100644
--- a/xen/arch/x86/machine_kexec.c
+++ b/xen/arch/x86/machine_kexec.c
@@ -170,9 +170,12 @@ void machine_kexec(struct kexec_image *image)
      */
     for ( i = 0; i < nr_cpu_ids; i++ )
     {
-        if ( idt_tables[i] == NULL )
+        idt_entry_t *idt = per_cpu(idt, i);
+
+        if ( !idt )
             continue;
-        _update_gate_addr_lower(&idt_tables[i][X86_EXC_MC], &trap_nop);
+
+        _update_gate_addr_lower(&idt[X86_EXC_MC], &trap_nop);
     }
 
     /* Reset CPUID masking and faulting to the host's default. */
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index dc65f9e452..4e9f9ac4b2 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -863,7 +863,7 @@ int setup_cpu_root_pgt(unsigned int cpu)
         rc = clone_mapping(__va(__pa(stack_base[cpu])) + off, rpt);
 
     if ( !rc )
-        rc = clone_mapping(idt_tables[cpu], rpt);
+        rc = clone_mapping(per_cpu(idt, cpu), rpt);
     if ( !rc )
     {
         struct tss_page *ptr = &per_cpu(tss_page, cpu);
@@ -1009,7 +1009,7 @@ static void cpu_smpboot_free(unsigned int cpu, bool remove)
     if ( remove )
     {
         FREE_XENHEAP_PAGE(per_cpu(gdt, cpu));
-        FREE_XENHEAP_PAGE(idt_tables[cpu]);
+        FREE_XENHEAP_PAGE(per_cpu(idt, cpu));
 
         if ( stack_base[cpu] )
         {
@@ -1076,12 +1076,12 @@ static int cpu_smpboot_alloc(unsigned int cpu)
     gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a = cpu;
 #endif
 
-    if ( idt_tables[cpu] == NULL )
-        idt_tables[cpu] = alloc_xenheap_pages(0, memflags);
-    if ( idt_tables[cpu] == NULL )
+    if ( per_cpu(idt, cpu) == NULL )
+        per_cpu(idt, cpu) = alloc_xenheap_pages(0, memflags);
+    if ( per_cpu(idt, cpu) == NULL )
         goto out;
-    memcpy(idt_tables[cpu], bsp_idt, sizeof(bsp_idt));
-    disable_each_ist(idt_tables[cpu]);
+    memcpy(per_cpu(idt, cpu), bsp_idt, sizeof(bsp_idt));
+    disable_each_ist(per_cpu(idt, cpu));
 
     for ( stub_page = 0, i = cpu & ~(STUBS_PER_PAGE - 1);
           i < nr_cpu_ids && i <= (cpu | (STUBS_PER_PAGE - 1)); ++i )
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index b172ea9336..ae600526cb 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -7,3 +7,5 @@
 
 idt_entry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
     bsp_idt[X86_IDT_VECTORS];
+
+DEFINE_PER_CPU_READ_MOSTLY(idt_entry_t *, idt);
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 7a68996b02..d52840848d 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -98,9 +98,6 @@ DEFINE_PER_CPU_READ_MOSTLY(seg_desc_t *, compat_gdt);
 DEFINE_PER_CPU_READ_MOSTLY(l1_pgentry_t, compat_gdt_l1e);
 #endif
 
-/* Pointer to the IDT of every CPU. */
-idt_entry_t *idt_tables[NR_CPUS] __read_mostly;
-
 /*
  * The TSS is smaller than a page, but we give it a full page to avoid
  * adjacent per-cpu data leaking via Meltdown when XPTI is in use.
@@ -1939,7 +1936,7 @@ void __init init_idt_traps(void)
     enable_each_ist(bsp_idt);
 
     /* CPU0 uses the master IDT. */
-    idt_tables[0] = bsp_idt;
+    this_cpu(idt) = bsp_idt;
 
     this_cpu(gdt) = boot_gdt;
     if ( IS_ENABLED(CONFIG_PV32) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 17:11:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 17:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905245.1313098 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbEK-000469-6s; Fri, 07 Mar 2025 17:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905245.1313098; Fri, 07 Mar 2025 17:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbEK-000461-4F; Fri, 07 Mar 2025 17:11:24 +0000
Received: by outflank-mailman (input) for mailman id 905245;
 Fri, 07 Mar 2025 17:11:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqbEI-00045u-V0
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 17:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbEJ-0074VB-0V
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbEI-00Cv5p-2c
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O3QGav2jak2+okGStNBauTHr8mGjlb/wJzQTj1PLOzg=; b=JJvQ++ejJOoy8pRk/T8ol1vIj5
	23rGZ8+50szwgmMq1H0GUgYaqdhpQWycpb7jYxs2w3bpFVpzr4l9lUYkZ3qjytU4onRY/lmydb/lH
	0DXqogH91fKzzwbrrtzOUuyKn8DDGow27daORgZBc1/fQforIaJ1S9Lz6FJEohtWP5wI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/IDT: Generate bsp_idt[] at build time
Message-Id: <E1tqbEI-00Cv5p-2c@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 17:11:22 +0000

commit 3da2149cf4dc617e9599ab3e22e41186f81705a9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 3 14:44:19 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/IDT: Generate bsp_idt[] at build time
    
    ... rather than dynamically at boot time.  Aside from less runtime overhead,
    this approach is less fragile than the preexisting autogen stubs mechanism.
    
    We can manage this with some linker calculations.  See patch comments for full
    details.
    
    For simplicity, we create a new set of entry stubs here, and clean up the old
    ones in the subsequent patch.  bsp_idt[] needs to move from .bss to .data.
    
    No functional change yet; the boot path still (re)writes bsp_idt[] at this
    juncture.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/gen-idt.h     | 122 +++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/gen-idt.lds.h |  27 ++++++++
 xen/arch/x86/traps-setup.c             |   4 --
 xen/arch/x86/x86_64/entry.S            |  76 ++++++++++++++++++++
 xen/arch/x86/xen.lds.S                 |   2 +
 5 files changed, 227 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/include/asm/gen-idt.h b/xen/arch/x86/include/asm/gen-idt.h
new file mode 100644
index 0000000000..9c8810edf9
--- /dev/null
+++ b/xen/arch/x86/include/asm/gen-idt.h
@@ -0,0 +1,122 @@
+/* This file is intended to be included multiple times. */
+/*
+ * Generator for IDT entries.
+ *
+ * Caller to provide GEN(vector, symbol, dpl, autogen) macro
+ *
+ * Symbols are 'entry_0xYY' if there is no better name available.  Regular
+ * handlers set autogen=1, while manual (autogen=0) require the symbol to be
+ * implemented somewhere else.
+ */
+
+#define DPL0 0
+#define DPL1 1
+#define DPL3 3
+
+#define manual 0
+#define autogen 1
+
+#define GEN16(i) \
+    GEN(0x ## i ## 0, entry_0x ## i ## 0, DPL0, autogen); \
+    GEN(0x ## i ## 1, entry_0x ## i ## 1, DPL0, autogen); \
+    GEN(0x ## i ## 2, entry_0x ## i ## 2, DPL0, autogen); \
+    GEN(0x ## i ## 3, entry_0x ## i ## 3, DPL0, autogen); \
+    GEN(0x ## i ## 4, entry_0x ## i ## 4, DPL0, autogen); \
+    GEN(0x ## i ## 5, entry_0x ## i ## 5, DPL0, autogen); \
+    GEN(0x ## i ## 6, entry_0x ## i ## 6, DPL0, autogen); \
+    GEN(0x ## i ## 7, entry_0x ## i ## 7, DPL0, autogen); \
+    GEN(0x ## i ## 8, entry_0x ## i ## 8, DPL0, autogen); \
+    GEN(0x ## i ## 9, entry_0x ## i ## 9, DPL0, autogen); \
+    GEN(0x ## i ## a, entry_0x ## i ## a, DPL0, autogen); \
+    GEN(0x ## i ## b, entry_0x ## i ## b, DPL0, autogen); \
+    GEN(0x ## i ## c, entry_0x ## i ## c, DPL0, autogen); \
+    GEN(0x ## i ## d, entry_0x ## i ## d, DPL0, autogen); \
+    GEN(0x ## i ## e, entry_0x ## i ## e, DPL0, autogen); \
+    GEN(0x ## i ## f, entry_0x ## i ## f, DPL0, autogen)
+
+
+GEN(0x00, entry_DE,         DPL0, manual);
+GEN(0x01, entry_DB,         DPL0, manual);
+GEN(0x02, entry_NMI,        DPL0, manual);
+GEN(0x03, entry_BP,         DPL3, manual);
+GEN(0x04, entry_OF,         DPL3, manual);
+GEN(0x05, entry_BR,         DPL0, manual);
+GEN(0x06, entry_UD,         DPL0, manual);
+GEN(0x07, entry_NM,         DPL0, manual);
+GEN(0x08, entry_DF,         DPL0, manual);
+GEN(0x09, entry_0x09,       DPL0, autogen); /* Coprocessor Segment Overrun */
+GEN(0x0a, entry_TS,         DPL0, manual);
+GEN(0x0b, entry_NP,         DPL0, manual);
+GEN(0x0c, entry_SS,         DPL0, manual);
+GEN(0x0d, entry_GP,         DPL0, manual);
+GEN(0x0e, early_page_fault, DPL0, manual);
+GEN(0x0f, entry_0x0f,       DPL0, autogen); /* PIC Spurious Interrupt Vector */
+
+GEN(0x10, entry_MF,         DPL0, manual);
+GEN(0x11, entry_AC,         DPL0, manual);
+GEN(0x12, entry_MC,         DPL0, manual);
+GEN(0x13, entry_XM,         DPL0, manual);
+GEN(0x14, entry_VE,         DPL0, autogen);
+GEN(0x15, entry_CP,         DPL0, manual);
+GEN(0x16, entry_0x16,       DPL0, autogen);
+GEN(0x17, entry_0x17,       DPL0, autogen);
+GEN(0x18, entry_0x18,       DPL0, autogen);
+GEN(0x19, entry_0x19,       DPL0, autogen);
+GEN(0x1a, entry_0x1a,       DPL0, autogen);
+GEN(0x1b, entry_0x1b,       DPL0, autogen);
+GEN(0x1c, entry_HV,         DPL0, autogen);
+GEN(0x1d, entry_VC,         DPL0, autogen);
+GEN(0x1e, entry_SX,         DPL0, autogen);
+GEN(0x1f, entry_0x1f,       DPL0, autogen);
+
+GEN16(2);
+GEN16(3);
+GEN16(4);
+GEN16(5);
+GEN16(6);
+GEN16(7);
+
+#ifdef CONFIG_PV
+GEN(0x80, entry_int80,      DPL0, manual);
+#else
+GEN(0x80, entry_0x80,       DPL0, autogen);
+#endif
+
+GEN(0x81, entry_0x81,       DPL0, autogen);
+
+#ifdef CONFIG_PV32
+GEN(0x82, entry_int82,      DPL1, manual);
+#else
+GEN(0x82, entry_0x82,       DPL0, autogen);
+#endif
+
+GEN(0x83, entry_0x83,       DPL0, autogen);
+GEN(0x84, entry_0x84,       DPL0, autogen);
+GEN(0x85, entry_0x85,       DPL0, autogen);
+GEN(0x86, entry_0x86,       DPL0, autogen);
+GEN(0x87, entry_0x87,       DPL0, autogen);
+GEN(0x88, entry_0x88,       DPL0, autogen);
+GEN(0x89, entry_0x89,       DPL0, autogen);
+GEN(0x8a, entry_0x8a,       DPL0, autogen);
+GEN(0x8b, entry_0x8b,       DPL0, autogen);
+GEN(0x8c, entry_0x8c,       DPL0, autogen);
+GEN(0x8d, entry_0x8d,       DPL0, autogen);
+GEN(0x8e, entry_0x8e,       DPL0, autogen);
+GEN(0x8f, entry_0x8f,       DPL0, autogen);
+
+GEN16(9);
+GEN16(a);
+GEN16(b);
+GEN16(c);
+GEN16(d);
+GEN16(e);
+GEN16(f);
+
+#undef autogen
+#undef manual
+
+#undef DPL3
+#undef DPL1
+#undef DPL0
+
+#undef GEN16
diff --git a/xen/arch/x86/include/asm/gen-idt.lds.h b/xen/arch/x86/include/asm/gen-idt.lds.h
new file mode 100644
index 0000000000..a11ef7dd1c
--- /dev/null
+++ b/xen/arch/x86/include/asm/gen-idt.lds.h
@@ -0,0 +1,27 @@
+/*
+ * Linker file fragment to help format the IDT correctly
+ *
+ * The IDT, having grown compatibly since the 16 bit days, has the entrypoint
+ * address field split into 3.  x86 ELF lacks the @lo/@hi/etc relocation forms
+ * commonly found in other architectures for accessing a part of a resolved
+ * symbol address.
+ *
+ * However, the linker can perform the necessary calculations and provide them
+ * under new symbol names.  We use this to generate the low and next 16 bits
+ * of the address for each handler.
+ *
+ * The upper 32 bits are always a constant as Xen's .text/data/rodata sits in
+ * a single aligned 1G range, so do not need calculating in this manner.
+ */
+#ifndef X86_IDT_GEN_LDS_H
+#define X86_IDT_GEN_LDS_H
+
+#define GEN(vec, sym, dpl, auto)                                        \
+    PROVIDE_HIDDEN(IDT_ ## sym ## _ADDR1 = ABSOLUTE(((sym) & 0xffff))); \
+    PROVIDE_HIDDEN(IDT_ ## sym ## _ADDR2 = ABSOLUTE((((sym) >> 16) & 0xffff)))
+
+#include <asm/gen-idt.h>
+
+#undef GEN
+
+#endif /* X86_IDT_GEN_LDS_H */
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index ae600526cb..3ee2831958 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -3,9 +3,5 @@
  * Configuration of event handling for all CPUs.
  */
 #include <asm/idt.h>
-#include <asm/page.h>
-
-idt_entry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
-    bsp_idt[X86_IDT_VECTORS];
 
 DEFINE_PER_CPU_READ_MOSTLY(idt_entry_t *, idt);
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index d866e62625..84d0c29530 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -1229,6 +1229,82 @@ FUNC(trap_nop, 0)
         iretq
 END(trap_nop)
 
+/*
+ * Automatically generated entrypoints, and IDT
+ */
+
+        .pushsection .data.page_aligned, "aw", @progbits
+DATA(bsp_idt, PAGE_SIZE)
+        .popsection
+
+/*
+ * Write an IDT Entry.  The linker provides us new _ADDR1/2 symbols calculated
+ * from \sym.
+ */
+.macro write_idte sym, dpl
+        .pushsection .data.page_aligned, "aw", @progbits
+        .word IDT_\sym\()_ADDR1
+        .word __HYPERVISOR_CS
+        .word 0x8e00 | (\dpl << 13) /* Present, DPL, Interrupt Gate */
+        .word IDT_\sym\()_ADDR2
+        .long __XEN_VIRT_START >> 32
+        .long 0
+        .popsection
+.endm
+
+/*
+ * Write an automatically generated stub.  Vectors in the exception range keep
+ * the stack properly aligned by judging whether the CPU pushed an error code
+ * or not.
+ *
+ * Alignment is forced to 16 because that's the size of the interrupt stub
+ * with CET active.
+ */
+.macro gen_entry_stub vec, sym
+
+FUNC(\sym, 16)
+        ENDBR64
+
+        .if \vec < 0x20 /* Exception. */
+
+            test  $8, %spl       /* 64bit exception frames are 16 byte aligned, but the word */
+            jz    1f             /* size is 8 bytes.  Check whether the processor gave us an */
+            pushq $0             /* error code, and insert an empty one if not.              */
+1:          movb  $\vec, EFRAME_entry_vector(%rsp)
+            jmp   handle_exception
+
+        .else /* Interrupt. */
+
+            pushq $0
+            movb  $\vec, EFRAME_entry_vector(%rsp)
+            jmp   common_interrupt
+
+        .endif
+END(\sym)
+.endm
+
+/*
+ * Generator.  Write an entrypoint if necessary, and record an IDT entry.
+ */
+.macro gen vec, sym, dpl, auto
+
+        .if \auto
+            gen_entry_stub \vec, \sym
+        .endif
+
+        write_idte \sym, \dpl
+.endm
+#define GEN(v, s, d, a) gen vec=v, sym=s, dpl=d auto=a
+#include <asm/gen-idt.h>
+#undef GEN
+
+        .pushsection .data.page_aligned, "aw", @progbits
+END(bsp_idt)
+        .if . - bsp_idt != PAGE_SIZE
+            .error "Bad bsp_idt size, should be PAGE_SIZE"
+        .endif
+        .popsection
+
 /* Table of automatically generated entry points.  One per vector. */
         .pushsection .init.rodata, "a", @progbits
 DATA(autogen_entrypoints, 8)
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 42217eaf24..d4dd6434c4 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -8,6 +8,8 @@
 # define DECL_SECTION_WITH_LADDR
 #endif
 #include <xen/xen.lds.h>
+
+#include <asm/gen-idt.lds.h>
 #include <asm/page.h>
 #include <asm/trampoline.h>
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 17:11:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 17:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905246.1313101 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbEU-00048m-8K; Fri, 07 Mar 2025 17:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905246.1313101; Fri, 07 Mar 2025 17:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbEU-00048e-5i; Fri, 07 Mar 2025 17:11:34 +0000
Received: by outflank-mailman (input) for mailman id 905246;
 Fri, 07 Mar 2025 17:11:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqbET-00048S-2I
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 17:11:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbET-0074VO-0t
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:11:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbES-00Cv6B-3B
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SfYHiAR7R1dkVX9Io5O3eLdKE2lTKC/QqP1rNEH4LnM=; b=Bf83SU1SMedV+AeDLJPgYY/YVa
	yGhBbtzYZ/STljNVHC3qxOFYXFHnRTVN0RhmZygadKeT5qFuAgGvezmCACrsfMxlp70GNIFEP4KHF
	gtGni8cU6GRmmsSZIqiHG9GqSXml9gS+SBxry8mZd7+fBIDbF0tG36RupWhZpNAeXVFU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/IDT: Don't rewrite bsp_idt[] at boot time
Message-Id: <E1tqbES-00Cv6B-3B@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 17:11:32 +0000

commit cb27499111a5784e20c7e482e6407a894d6fc48f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 3 15:16:45 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/IDT: Don't rewrite bsp_idt[] at boot time
    
    Now that bsp_idt[] is constructed at build time, we do not need to manually
    initialise it in init_idt_traps() and trap_init().
    
    When swapping the early pagefault handler for the normal one, switch to using
    _update_gate_addr_lower() as we do on the kexec path for NMI and #MC.
    
    This in turn allows us to drop set_{intr,swint}_gate() and the underlying
    infrastructure.  It also lets us drop autogen_entrypoints[] and that
    underlying infrastructure.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/idt.h | 16 ---------
 xen/arch/x86/pv/traps.c        | 13 --------
 xen/arch/x86/traps.c           | 76 +-----------------------------------------
 xen/arch/x86/x86_64/entry.S    | 60 ---------------------------------
 4 files changed, 1 insertion(+), 164 deletions(-)

diff --git a/xen/arch/x86/include/asm/idt.h b/xen/arch/x86/include/asm/idt.h
index d795798d3e..f613d5693e 100644
--- a/xen/arch/x86/include/asm/idt.h
+++ b/xen/arch/x86/include/asm/idt.h
@@ -60,22 +60,6 @@ static inline void disable_each_ist(idt_entry_t *idt)
     set_ist(&idt[X86_EXC_DB],  IST_NONE);
 }
 
-#define _set_gate(gate_addr,type,dpl,addr)               \
-do {                                                     \
-    (gate_addr)->a = 0;                                  \
-    smp_wmb(); /* disable gate /then/ rewrite */         \
-    (gate_addr)->b =                                     \
-        ((unsigned long)(addr) >> 32);                   \
-    smp_wmb(); /* rewrite /then/ enable gate */          \
-    (gate_addr)->a =                                     \
-        (((unsigned long)(addr) & 0xFFFF0000UL) << 32) | \
-        ((unsigned long)(dpl) << 45) |                   \
-        ((unsigned long)(type) << 40) |                  \
-        ((unsigned long)(addr) & 0xFFFFUL) |             \
-        ((unsigned long)__HYPERVISOR_CS << 16) |         \
-        (1UL << 47);                                     \
-} while (0)
-
 /*
  * Write the lower 64 bits of an IDT Entry. This relies on the upper 32
  * bits of the address not changing, which is a safe assumption as all
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 4aeb6cab52..932800555b 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -141,21 +141,8 @@ static void cf_check nmi_softirq(void)
     *v_ptr = NULL;
 }
 
-void nocall entry_int80(void);
-void nocall entry_int82(void);
-
 void __init pv_trap_init(void)
 {
-#ifdef CONFIG_PV32
-    /* The 32-on-64 hypercall vector is only accessible from ring 1. */
-    _set_gate(bsp_idt + HYPERCALL_VECTOR,
-              SYS_DESC_irq_gate, 1, entry_int82);
-#endif
-
-    /* Fast trap for int80 (faster than taking the #GP-fixup path). */
-    _set_gate(bsp_idt + LEGACY_SYSCALL_VECTOR, SYS_DESC_irq_gate, 3,
-              &entry_int80);
-
     open_softirq(NMI_SOFTIRQ, nmi_softirq);
 }
 
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index d52840848d..7698fa580e 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1864,22 +1864,6 @@ void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
     panic("CONTROL-FLOW PROTECTION FAULT: #CP[%04x] %s\n", ec, err);
 }
 
-static void __init noinline __set_intr_gate(unsigned int n,
-                                            uint32_t dpl, void *addr)
-{
-    _set_gate(&bsp_idt[n], SYS_DESC_irq_gate, dpl, addr);
-}
-
-static void __init set_swint_gate(unsigned int n, void *addr)
-{
-    __set_intr_gate(n, 3, addr);
-}
-
-static void __init set_intr_gate(unsigned int n, void *addr)
-{
-    __set_intr_gate(n, 0, addr);
-}
-
 void percpu_traps_init(void)
 {
     subarch_percpu_traps_init();
@@ -1888,50 +1872,10 @@ void percpu_traps_init(void)
         wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
 }
 
-/* Exception entries */
-void nocall entry_DE(void);
-void nocall entry_DB(void);
-void nocall entry_NMI(void);
-void nocall entry_BP(void);
-void nocall entry_OF(void);
-void nocall entry_BR(void);
-void nocall entry_UD(void);
-void nocall entry_NM(void);
-void nocall entry_DF(void);
-void nocall entry_TS(void);
-void nocall entry_NP(void);
-void nocall entry_SS(void);
-void nocall entry_GP(void);
-void nocall early_page_fault(void);
 void nocall entry_PF(void);
-void nocall entry_MF(void);
-void nocall entry_AC(void);
-void nocall entry_MC(void);
-void nocall entry_XM(void);
-void nocall entry_CP(void);
 
 void __init init_idt_traps(void)
 {
-    set_intr_gate (X86_EXC_DE,  entry_DE);
-    set_intr_gate (X86_EXC_DB,  entry_DB);
-    set_intr_gate (X86_EXC_NMI, entry_NMI);
-    set_swint_gate(X86_EXC_BP,  entry_BP);
-    set_swint_gate(X86_EXC_OF,  entry_OF);
-    set_intr_gate (X86_EXC_BR,  entry_BR);
-    set_intr_gate (X86_EXC_UD,  entry_UD);
-    set_intr_gate (X86_EXC_NM,  entry_NM);
-    set_intr_gate (X86_EXC_DF,  entry_DF);
-    set_intr_gate (X86_EXC_TS,  entry_TS);
-    set_intr_gate (X86_EXC_NP,  entry_NP);
-    set_intr_gate (X86_EXC_SS,  entry_SS);
-    set_intr_gate (X86_EXC_GP,  entry_GP);
-    set_intr_gate (X86_EXC_PF,  early_page_fault);
-    set_intr_gate (X86_EXC_MF,  entry_MF);
-    set_intr_gate (X86_EXC_AC,  entry_AC);
-    set_intr_gate (X86_EXC_MC,  entry_MC);
-    set_intr_gate (X86_EXC_XM,  entry_XM);
-    set_intr_gate (X86_EXC_CP,  entry_CP);
-
     /* Specify dedicated interrupt stacks for NMI, #DF, and #MC. */
     enable_each_ist(bsp_idt);
 
@@ -1979,31 +1923,13 @@ static void __init init_ler(void)
     setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
 }
 
-extern void (*const autogen_entrypoints[X86_IDT_VECTORS])(void);
 void __init trap_init(void)
 {
-    unsigned int vector;
-
     /* Replace early pagefault with real pagefault handler. */
-    set_intr_gate(X86_EXC_PF, entry_PF);
+    _update_gate_addr_lower(&bsp_idt[X86_EXC_PF], entry_PF);
 
     pv_trap_init();
 
-    for ( vector = 0; vector < X86_IDT_VECTORS; ++vector )
-    {
-        if ( autogen_entrypoints[vector] )
-        {
-            /* Found autogen entry: check we won't clobber an existing trap. */
-            ASSERT(bsp_idt[vector].b == 0);
-            set_intr_gate(vector, autogen_entrypoints[vector]);
-        }
-        else
-        {
-            /* No entry point: confirm we have an existing trap in place. */
-            ASSERT(bsp_idt[vector].b != 0);
-        }
-    }
-
     init_ler();
 
     /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 84d0c29530..d81a626d16 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -1304,63 +1304,3 @@ END(bsp_idt)
             .error "Bad bsp_idt size, should be PAGE_SIZE"
         .endif
         .popsection
-
-/* Table of automatically generated entry points.  One per vector. */
-        .pushsection .init.rodata, "a", @progbits
-DATA(autogen_entrypoints, 8)
-        /* pop into the .init.rodata section and record an entry point. */
-        .macro entrypoint ent
-        .pushsection .init.rodata, "a", @progbits
-        .quad \ent
-        .popsection
-        .endm
-
-        .popsection
-FUNC_LOCAL(autogen_stubs, 0) /* Automatically generated stubs. */
-
-        vec = 0
-        .rept X86_IDT_VECTORS
-
-        /* Common interrupts, heading towards do_IRQ(). */
-#if defined(CONFIG_PV32)
-        .if vec >= FIRST_IRQ_VECTOR && vec != HYPERCALL_VECTOR && vec != LEGACY_SYSCALL_VECTOR
-#elif defined(CONFIG_PV)
-        .if vec >= FIRST_IRQ_VECTOR && vec != LEGACY_SYSCALL_VECTOR
-#else
-        .if vec >= FIRST_IRQ_VECTOR
-#endif
-
-        .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL
-1:
-        ENDBR64
-        pushq $0
-        movb  $vec, EFRAME_entry_vector(%rsp)
-        jmp   common_interrupt
-
-        entrypoint 1b
-
-        /* Reserved exceptions, heading towards do_unhandled_trap(). */
-        .elseif vec == X86_EXC_CSO || vec == X86_EXC_SPV || \
-                vec == X86_EXC_VE  || (vec > X86_EXC_CP && vec < X86_EXC_NUM)
-
-1:
-        ENDBR64
-        test  $8,%spl        /* 64bit exception frames are 16 byte aligned, but the word */
-        jz    2f             /* size is 8 bytes.  Check whether the processor gave us an */
-        pushq $0             /* error code, and insert an empty one if not.              */
-2:      movb  $vec, EFRAME_entry_vector(%rsp)
-        jmp   handle_exception
-
-        entrypoint 1b
-
-        /* Hand crafted entry points above. */
-        .else
-        entrypoint 0
-        .endif
-
-        vec = vec + 1
-        .endr
-END(autogen_stubs)
-
-        .section .init.rodata, "a", @progbits
-END(autogen_entrypoints)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 17:11:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 17:11:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905247.1313106 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbEf-0004BG-9r; Fri, 07 Mar 2025 17:11:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905247.1313106; Fri, 07 Mar 2025 17:11:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbEf-0004B8-7B; Fri, 07 Mar 2025 17:11:45 +0000
Received: by outflank-mailman (input) for mailman id 905247;
 Fri, 07 Mar 2025 17:11:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqbEd-0004Ap-5a
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 17:11:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbEd-0074VS-1C
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:11:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbEd-00Cv6f-0K
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:11:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eX8ASKW7ge3ZZQLy33MtEJRwB/TI8yLsYxmcFIjf4eo=; b=ij333VQDDvbyGNmcX7W5AyH7tc
	xlSMOdC1VQs81RUoziKKBxRusnc9IVEHZnkIY8vnjouUZo+qM73oSqHNwCg3zg6j0PrYSHnjPiL+7
	bPBSOsTmEL4kA+6K8ZohNtPrV8oALX8qad61swPfFVu4XQt/UXJpcAbvD4VUKTF4vwT8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Convert pv_trap_init() to being an initcall
Message-Id: <E1tqbEd-00Cv6f-0K@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 17:11:43 +0000

commit 5b7ac8d86395da89a8ad76d973b1078baeab7755
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 3 17:17:38 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/traps: Convert pv_trap_init() to being an initcall
    
    With most of pv_trap_init() being done at build time, opening of NMI_SOFTIRQ
    can be a regular initcall, simplifying trap_init().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/pv/traps.h | 4 ----
 xen/arch/x86/pv/traps.c             | 5 ++++-
 xen/arch/x86/traps.c                | 2 --
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/include/asm/pv/traps.h b/xen/arch/x86/include/asm/pv/traps.h
index 404f5b169c..8c31d5a793 100644
--- a/xen/arch/x86/include/asm/pv/traps.h
+++ b/xen/arch/x86/include/asm/pv/traps.h
@@ -14,8 +14,6 @@
 
 #include <public/xen.h>
 
-void pv_trap_init(void);
-
 int pv_raise_nmi(struct vcpu *v);
 
 int pv_emulate_privileged_op(struct cpu_user_regs *regs);
@@ -32,8 +30,6 @@ static inline bool pv_trap_callback_registered(const struct vcpu *v,
 
 #include <xen/errno.h>
 
-static inline void pv_trap_init(void) {}
-
 static inline int pv_raise_nmi(struct vcpu *v) { return -EOPNOTSUPP; }
 
 static inline int pv_emulate_privileged_op(struct cpu_user_regs *regs) { return 0; }
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 932800555b..c3c0976c44 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -141,10 +141,13 @@ static void cf_check nmi_softirq(void)
     *v_ptr = NULL;
 }
 
-void __init pv_trap_init(void)
+static int __init cf_check pv_trap_init(void)
 {
     open_softirq(NMI_SOFTIRQ, nmi_softirq);
+
+    return 0;
 }
+__initcall(pv_trap_init);
 
 /*
  * Deliver NMI to PV guest. Return 0 on success.
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 7698fa580e..5addb1f903 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1928,8 +1928,6 @@ void __init trap_init(void)
     /* Replace early pagefault with real pagefault handler. */
     _update_gate_addr_lower(&bsp_idt[X86_EXC_PF], entry_PF);
 
-    pv_trap_init();
-
     init_ler();
 
     /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 17:11:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 17:11:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905248.1313110 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbEp-0004Ds-Be; Fri, 07 Mar 2025 17:11:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905248.1313110; Fri, 07 Mar 2025 17:11:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbEp-0004Dk-8U; Fri, 07 Mar 2025 17:11:55 +0000
Received: by outflank-mailman (input) for mailman id 905248;
 Fri, 07 Mar 2025 17:11:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqbEn-0004DY-Aj
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 17:11:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbEn-0074VW-1j
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:11:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbEn-00Cv71-0e
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:11:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aB1/Jimt2b0B1XIeXNL39tc7g1J8WbMTN/fsLCftGNU=; b=wbKOod95W/GsHZW1yF6NSh91J8
	ZxKAiPdwev6oH5XOCjNLMm2P5KTKIQKG/AKz3XgArmMoooFEZls1ai1jrKiqLeMM4/cE8abm1b1u3
	gNtRzG8j6JcusW4OE+DDqCJv9mm/Qe1cXnvDoo213xtY0H+yg8dg5h18vP4k9c1514XE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/domain: Annotate struct domain as page aligned
Message-Id: <E1tqbEn-00Cv71-0e@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 17:11:53 +0000

commit 8c12e47a5d3b8ef7484b4a6d04b73bd6c61a82cf
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 18 23:01:11 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    xen/domain: Annotate struct domain as page aligned
    
    struct domain is always a page aligned allocation.  Update it's type to
    reflect this, so we can safely reuse the lower bits in the pointer for
    auxiliary information.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/xen/sched.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 75add0f216..559d201e0c 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -651,7 +651,7 @@ struct domain
     unsigned int num_llc_colors;
     const unsigned int *llc_colors;
 #endif
-};
+} __aligned(PAGE_SIZE);
 
 static inline struct page_list_head *page_to_list(
     struct domain *d, const struct page_info *pg)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 17:12:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 17:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905249.1313114 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbEy-0004Go-EO; Fri, 07 Mar 2025 17:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905249.1313114; Fri, 07 Mar 2025 17:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbEy-0004Gg-BV; Fri, 07 Mar 2025 17:12:04 +0000
Received: by outflank-mailman (input) for mailman id 905249;
 Fri, 07 Mar 2025 17:12:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqbEx-0004GY-GP
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 17:12:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbEx-0074Vv-2I
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbEx-00Cv7z-1A
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f3Ln9VK03VzP0WABCC6qer9Hk0QLeZUx6Sk8nZXouxg=; b=OVS3LiFotFhhTUlbaYeUsupWoJ
	etoZbgo6AVX5PvmVODpemfE1g1Y7BjZpn1YxVg6PLR5p+mr5THqJxmzofCPAMberh8LzsR5UQ9Qlh
	WeyAWpf84Kbrb9ESJC5r0hkwSqvG/U/bTAOWqLRfJBNBILVqpCX7L1E5aXWJIMWUrDd8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: Rewrite vmx_sync_pir_to_irr() to be more efficient
Message-Id: <E1tqbEx-00Cv7z-1A@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 17:12:03 +0000

commit e6dfe4250c6b8485d558a0531266f6dd01c91e46
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jun 25 17:23:12 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/vmx: Rewrite vmx_sync_pir_to_irr() to be more efficient
    
    There are two issues.  First, pi_test_and_clear_on() pulls the cache-line to
    the CPU and dirties it even if there's nothing outstanding, and second,
    bitmap_for_each() is O(256) when O(8) would do, and would avoid multiple
    atomic updates to the same IRR word.
    
    Rewrite it from scratch, explaining what's going on at each step.
    
    Bloat-o-meter reports 177 -> 145 (net -32), but real improvement is the
    removal of calls to __find_{first,next}_bit() hidden behind bitmap_for_each().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vmx/vmx.c | 70 ++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 62 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 1911e79517..0241303b4b 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2314,18 +2314,72 @@ static void cf_check vmx_deliver_posted_intr(struct vcpu *v, u8 vector)
 
 static void cf_check vmx_sync_pir_to_irr(struct vcpu *v)
 {
-    struct vlapic *vlapic = vcpu_vlapic(v);
-    unsigned int group, i;
-    DECLARE_BITMAP(pending_intr, X86_IDT_VECTORS);
+    struct pi_desc *desc = &v->arch.hvm.vmx.pi_desc;
+    union {
+        unsigned long _ul[X86_IDT_VECTORS / BITS_PER_LONG];
+        uint32_t      _32[X86_IDT_VECTORS / (sizeof(uint32_t) * 8)];
+    } vec;
+    uint32_t *irr;
+    bool on;
 
-    if ( !pi_test_and_clear_on(&v->arch.hvm.vmx.pi_desc) )
+    /*
+     * The PIR is a contended cacheline which bounces between the CPU(s) and
+     * IOMMU(s).  An IOMMU updates the entire PIR atomically, but we can't
+     * express the same on the CPU side, so care has to be taken.
+     *
+     * First, do a plain read of ON.  If the PIR hasn't been modified, this
+     * will keep the cacheline Shared and not pull it Exclusive on the current
+     * CPU.
+     */
+    if ( !pi_test_on(desc) )
         return;
 
-    for ( group = 0; group < ARRAY_SIZE(pending_intr); group++ )
-        pending_intr[group] = pi_get_pir(&v->arch.hvm.vmx.pi_desc, group);
+    /*
+     * Second, if the plain read said that ON was set, we must clear it with
+     * an atomic action.  This will bring the cacheline to Exclusive on the
+     * current CPU.
+     *
+     * This should always succeed because no-one else should be playing with
+     * the PIR behind our back, but assert so just in case.
+     */
+    on = pi_test_and_clear_on(desc);
+    ASSERT(on);
+
+    /*
+     * The cacheline will have become Exclusive on the current CPU, and
+     * because ON was set, some other entity (an IOMMU, or Xen on another CPU)
+     * has indicated that the PIR needs re-scanning.
+     *
+     * Note: Entities which can't update the entire cacheline atomically
+     *       (i.e. Xen on another CPU) are required to update PIR first, then
+     *       set ON.  Therefore, there is a corner case where we may have
+     *       found and processed the PIR updates "last time around" and only
+     *       found ON this time around.  This is fine; the logic still
+     *       operates correctly.
+     *
+     * Atomically read and clear the entire pending bitmap as fast as we can,
+     * to reduce the window where another entity may steal the cacheline back
+     * from us.  This is a performance concern, not a correctness concern; if
+     * another entity does steal the cacheline, we'll just wait for it to
+     * return.
+     */
+    for ( unsigned int i = 0; i < ARRAY_SIZE(vec._ul); ++i )
+        vec._ul[i] = xchg(&desc->pir[i], 0);
+
+    /*
+     * Finally, merge the pending vectors into IRR.  The IRR register is
+     * scattered in memory, so we have to do this 32 bits at a time.
+     */
+    irr = (uint32_t *)&vcpu_vlapic(v)->regs->data[APIC_IRR];
+    for ( unsigned int i = 0; i < ARRAY_SIZE(vec._32); ++i )
+    {
+        if ( !vec._32[i] )
+            continue;
 
-    bitmap_for_each ( i, pending_intr, X86_IDT_VECTORS )
-        vlapic_set_vector(i, &vlapic->regs->data[APIC_IRR]);
+        asm ( "lock or %[val], %[irr]"
+              : [irr] "+m" (irr[i * 4])
+              : [val] "r" (vec._32[i]) );
+    }
 }
 
 static bool cf_check vmx_test_pir(const struct vcpu *v, uint8_t vec)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 17:12:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 17:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905250.1313118 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbF8-0004JK-Fn; Fri, 07 Mar 2025 17:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905250.1313118; Fri, 07 Mar 2025 17:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbF8-0004JC-Cz; Fri, 07 Mar 2025 17:12:14 +0000
Received: by outflank-mailman (input) for mailman id 905250;
 Fri, 07 Mar 2025 17:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqbF7-0004J3-Jh
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 17:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbF7-0074W0-2d
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbF7-00Cv8V-1j
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YsJESE8q1D6Xy75MwZeS339f9GR4UFuqFgvH7Iv+pgs=; b=ka8s2mokD3HROfbInLuObQqzcN
	xHIgP7jaPTguFZ2rrJ3RU//iEDK3GA6szy1dqgsIgwA6Tt4p6j/YaJMoOu1xxtxjIH6OGDxWeHw3U
	h4fRRTjqmamBWSzbejS+MKFjW2yf5aH+JS+taDcUuw434QBmDVjheajiXHGoeOgcnhSo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/trampoline: Rename entrypoints
Message-Id: <E1tqbF7-00Cv8V-1j@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 17:12:13 +0000

commit 7d6b66163b96a52bf4841a7245bf67f4b9124e4e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 25 15:28:04 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/trampoline: Rename entrypoints
    
    ... to be more concise, and to match our other entrypoints into Xen.
    
    In acpi_sleep_prepare(), calculate bootsym_phys() once, which GCC seems
    unwilling to of it's own accord.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/power.c             |  9 ++++++---
 xen/arch/x86/boot/trampoline.S        |  5 ++---
 xen/arch/x86/boot/wakeup.S            | 10 +++++-----
 xen/arch/x86/include/asm/trampoline.h |  4 ++--
 xen/arch/x86/smpboot.c                |  2 +-
 5 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index d0b67614d5..fe70257864 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -169,6 +169,7 @@ static void thaw_domains(void)
 static void acpi_sleep_prepare(u32 state)
 {
     void *wakeup_vector_va;
+    paddr_t entry_pa;
 
     if ( state != ACPI_STATE_S3 )
         return;
@@ -181,10 +182,12 @@ static void acpi_sleep_prepare(u32 state)
     wakeup_vector_va = fix_to_virt(FIX_ACPI_END) +
                        PAGE_OFFSET(acpi_sinfo.wakeup_vector);
 
+    entry_pa = bootsym_phys(entry_S3);
+
     if ( acpi_sinfo.vector_width == 32 )
-        *(uint32_t *)wakeup_vector_va = bootsym_phys(wakeup_start);
+        *(uint32_t *)wakeup_vector_va = entry_pa;
     else
-        *(uint64_t *)wakeup_vector_va = bootsym_phys(wakeup_start);
+        *(uint64_t *)wakeup_vector_va = entry_pa;
 
     clear_fixmap(FIX_ACPI_END);
 }
@@ -446,7 +449,7 @@ static void tboot_sleep(u8 sleep_state)
     g_tboot_shared->acpi_sinfo.wakeup_vector = acpi_sinfo.wakeup_vector;
     g_tboot_shared->acpi_sinfo.vector_width = acpi_sinfo.vector_width;
     g_tboot_shared->acpi_sinfo.kernel_s3_resume_vector =
-                                              bootsym_phys(wakeup_start);
+                                              bootsym_phys(entry_S3);
 
     switch ( sleep_state )
     {
diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S
index 924bda37c1..a92e399fbe 100644
--- a/xen/arch/x86/boot/trampoline.S
+++ b/xen/arch/x86/boot/trampoline.S
@@ -42,10 +42,9 @@
  * do_boot_cpu() programs the Startup-IPI to point here.  Due to the SIPI
  * format, the relocated entrypoint must be 4k aligned.
  *
- * It is entered in Real Mode, with %cs = trampoline_realmode_entry >> 4 and
- * %ip = 0.
+ * It is entered in Real Mode, with %cs = entry_SIPI16 >> 4 and %ip = 0.
  */
-GLOBAL(trampoline_realmode_entry)
+GLOBAL(entry_SIPI16)
         mov     %cs,%ax
         mov     %ax,%ds
         movb    $0xA5,bootsym(trampoline_cpu_started)
diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S
index bbf9aa6040..654e97005f 100644
--- a/xen/arch/x86/boot/wakeup.S
+++ b/xen/arch/x86/boot/wakeup.S
@@ -7,18 +7,18 @@
         .equ    wakeup_stack, trampoline_start + PAGE_SIZE
         .local  wakeup_stack
 
-#define wakesym(sym) (sym - wakeup_start)
+#define wakesym(sym) (sym - entry_S3)
 
 /*
  * acpi_sleep_prepare() programs the S3 wakeup vector to point here.
  *
  * The ACPI spec says that we shall be entered in Real Mode with:
- *   %cs = wakeup_start >> 4
- *   %ip = wakeup_start & 0xf
+ *   %cs = entry_S3 >> 4
+ *   %ip = entry_S3 & 0xf
  *
- * As wakeup_start is 16-byte aligned, %ip is 0 in practice.
+ * As entry_S3 is 16-byte aligned, %ip is 0 in practice.
  */
-ENTRY(wakeup_start)
+ENTRY(entry_S3)
         cli
         cld
 
diff --git a/xen/arch/x86/include/asm/trampoline.h b/xen/arch/x86/include/asm/trampoline.h
index 0c508d0222..dc536efe1f 100644
--- a/xen/arch/x86/include/asm/trampoline.h
+++ b/xen/arch/x86/include/asm/trampoline.h
@@ -130,10 +130,10 @@ extern uint32_t trampoline_phys;
 #define bootsym(sym) (*((typeof(sym) *)__va(bootsym_phys(sym))))
 
 /* The INIT-SIPI-SIPI entrypoint.  16-bit code. */
-void nocall trampoline_realmode_entry(void);
+void nocall entry_SIPI16(void);
 
 /* The S3 wakeup vector.  16-bit code. */
-void nocall wakeup_start(void);
+void nocall entry_S3(void);
 
 /*
  * A variable in the trampoline, containing Xen's physical address.  Amongst
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 4e9f9ac4b2..b63a9ce13e 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -572,7 +572,7 @@ static int do_boot_cpu(int apicid, int cpu)
 
     booting_cpu = cpu;
 
-    start_eip = bootsym_phys(trampoline_realmode_entry);
+    start_eip = bootsym_phys(entry_SIPI16);
 
     /* start_eip needs be page aligned, and below the 1M boundary. */
     if ( start_eip & ~0xff000 )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 17:12:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 17:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905251.1313122 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbFI-0004Le-Gz; Fri, 07 Mar 2025 17:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905251.1313122; Fri, 07 Mar 2025 17:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbFI-0004LW-EQ; Fri, 07 Mar 2025 17:12:24 +0000
Received: by outflank-mailman (input) for mailman id 905251;
 Fri, 07 Mar 2025 17:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqbFH-0004LL-Mj
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 17:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbFH-0074WO-2v
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbFH-00Cv9T-23
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7bj+l/MH3EpT5W6Pg8njnEsgtREUOmS+Rv/4/W0dYl4=; b=mTFUlDmBR41DH0ccqt4U0MGqh0
	ta5p2kFHd45HxrAL5OetZehuohXivihKE+xFZcArv0NkTeJZ1zHni8zhTrk5DK65T1n3+6CQfOfTL
	Hk23GZeDJdht5JZ4HAQeC3LFM9I5n2Ln1U19mon6KPa20fdDofN9KHBhIVvs3ZjDw77E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vlapic: Fix handling of writes to APIC_ESR
Message-Id: <E1tqbFH-00Cv9T-23@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 17:12:23 +0000

commit b28b590d4a23894672f1dd7fb98cdf9926ecb282
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Nov 28 00:47:36 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/vlapic: Fix handling of writes to APIC_ESR
    
    Xen currently presents APIC_ESR to guests as a simple read/write register.
    
    This is incorrect.  The SDM states:
    
      The ESR is a write/read register. Before attempt to read from the ESR,
      software should first write to it. (The value written does not affect the
      values read subsequently; only zero may be written in x2APIC mode.) This
      write clears any previously logged errors and updates the ESR with any
      errors detected since the last write to the ESR.
    
    Introduce a new pending_esr field in hvm_hw_lapic.
    
    Update vlapic_error() to accumulate errors here, and extend vlapic_reg_write()
    to discard the written value and transfer pending_esr into APIC_ESR.  Reads
    are still as before.
    
    Importantly, this means that guests no longer destroys the ESR value it's
    looking for in the LVTERR handler when following the SDM instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vlapic.c              | 17 +++++++++++++++--
 xen/include/public/arch-x86/hvm/save.h |  1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 91fc457165..d7dd430bd1 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -108,7 +108,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     uint32_t esr;
 
     spin_lock_irqsave(&vlapic->esr_lock, flags);
-    esr = vlapic_get_reg(vlapic, APIC_ESR);
+    esr = vlapic->hw.pending_esr;
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
@@ -127,7 +127,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
                  errmask |= APIC_ESR_RECVILL;
         }
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+        vlapic->hw.pending_esr |= errmask;
 
         if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
@@ -802,6 +802,19 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         vlapic_set_reg(vlapic, APIC_ID, val);
         break;
 
+    case APIC_ESR:
+    {
+        unsigned long flags;
+
+        spin_lock_irqsave(&vlapic->esr_lock, flags);
+        val = vlapic->hw.pending_esr;
+        vlapic->hw.pending_esr = 0;
+        spin_unlock_irqrestore(&vlapic->esr_lock, flags);
+
+        vlapic_set_reg(vlapic, APIC_ESR, val);
+        break;
+    }
+
     case APIC_TASKPRI:
         vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff);
         break;
diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h
index 7ecacadde1..9c4bfc7ebd 100644
--- a/xen/include/public/arch-x86/hvm/save.h
+++ b/xen/include/public/arch-x86/hvm/save.h
@@ -394,6 +394,7 @@ struct hvm_hw_lapic {
     uint32_t             disabled; /* VLAPIC_xx_DISABLED */
     uint32_t             timer_divisor;
     uint64_t             tdt_msr;
+    uint32_t             pending_esr;
 };
 
 DECLARE_HVM_SAVE_TYPE(LAPIC, 5, struct hvm_hw_lapic);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 17:12:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 17:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905252.1313128 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbFS-0004Nq-Jz; Fri, 07 Mar 2025 17:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905252.1313128; Fri, 07 Mar 2025 17:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbFS-0004Ni-Ft; Fri, 07 Mar 2025 17:12:34 +0000
Received: by outflank-mailman (input) for mailman id 905252;
 Fri, 07 Mar 2025 17:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqbFR-0004Na-PJ
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 17:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbFR-0074WV-3C
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbFR-00CvA5-2M
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wa+7xbM9fqPvFEqPSz0C0XNcKhBv1RSWJCOv0P3gN2Q=; b=3M4uqDAwY0cALlKX0iSZjiZknP
	2LZERmZ9Hm6zN8LUJBlkg6reHCr/Vea1hvsqwEPkp5B+gwCXEFaaSxn1GUp1oaQjOoxTT+7Ii8i3p
	LfMOZIrDSxINKE2G0ZSf2+A0I32D/uKmKuAApdnojRjBeB1EbhNP7fh3xtkek5toMd8s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vlapic: Drop vlapic->esr_lock
Message-Id: <E1tqbFR-00CvA5-2M@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 17:12:33 +0000

commit 1ecc4effa7c56cc0072437e69bc68fea844345fe
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Nov 28 00:47:37 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/vlapic: Drop vlapic->esr_lock
    
    The exact behaviour of LVTERR interrupt generation is implementation
    specific.
    
     * Newer Intel CPUs generate an interrupt when pending_esr becomes
       nonzero.
    
     * Older Intel and all AMD CPUs generate an interrupt when any
       individual bit in pending_esr becomes nonzero.
    
    Neither vendor documents their behaviour very well.  Xen implements
    the per-bit behaviour and has done since support was added.
    
    Importantly, the per-bit behaviour can be expressed using the atomic
    operations available in the x86 architecture, whereas the
    former (interrupt only on pending_esr becoming nonzero) cannot.
    
    With vlapic->hw.pending_esr held outside of the main LAPIC register page,
    it's much easier to use atomic operations.
    
    Use xchg() in vlapic_reg_write(), and *set_bit() in vlapic_error().
    
    The only interesting change is that vlapic_error() now needs to take a
    single bit only, rather than a mask, but this fine for all current
    callers and forseable changes.
    
    No change from a guests perspective.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vlapic.c             | 41 +++++++++++++----------------------
 xen/arch/x86/include/asm/hvm/vlapic.h |  1 -
 2 files changed, 15 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index d7dd430bd1..065b2aab5b 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -102,14 +102,16 @@ static int vlapic_find_highest_irr(struct vlapic *vlapic)
     return vlapic_find_highest_vector(&vlapic->regs->data[APIC_IRR]);
 }
 
-static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
+static void vlapic_error(struct vlapic *vlapic, unsigned int err_bit)
 {
-    unsigned long flags;
-    uint32_t esr;
-
-    spin_lock_irqsave(&vlapic->esr_lock, flags);
-    esr = vlapic->hw.pending_esr;
-    if ( (esr & errmask) != errmask )
+    /*
+     * Whether LVTERR is delivered on a per-bit basis, or only on
+     * pending_esr becoming nonzero is implementation specific.
+     *
+     * Xen implements the per-bit behaviour as it can be expressed
+     * locklessly.
+     */
+    if ( !test_and_set_bit(err_bit, &vlapic->hw.pending_esr) )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
         bool inj = false;
@@ -122,17 +124,14 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
              * if it will succeed, and folding in RECVILL otherwise.
              */
             if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
-                 inj = true;
+                inj = true;
             else
-                 errmask |= APIC_ESR_RECVILL;
+                set_bit(ilog2(APIC_ESR_RECVILL), &vlapic->hw.pending_esr);
         }
 
-        vlapic->hw.pending_esr |= errmask;
-
         if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
     }
-    spin_unlock_irqrestore(&vlapic->esr_lock, flags);
 }
 
 bool vlapic_test_irq(const struct vlapic *vlapic, uint8_t vec)
@@ -153,7 +152,7 @@ void vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig)
 
     if ( unlikely(vec < 16) )
     {
-        vlapic_error(vlapic, APIC_ESR_RECVILL);
+        vlapic_error(vlapic, ilog2(APIC_ESR_RECVILL));
         return;
     }
 
@@ -525,7 +524,7 @@ void vlapic_ipi(
             vlapic_domain(vlapic), vlapic, short_hand, dest, dest_mode);
 
         if ( unlikely((icr_low & APIC_VECTOR_MASK) < 16) )
-            vlapic_error(vlapic, APIC_ESR_SENDILL);
+            vlapic_error(vlapic, ilog2(APIC_ESR_SENDILL));
         else if ( target )
             vlapic_accept_irq(vlapic_vcpu(target), icr_low);
         break;
@@ -534,7 +533,7 @@ void vlapic_ipi(
     case APIC_DM_FIXED:
         if ( unlikely((icr_low & APIC_VECTOR_MASK) < 16) )
         {
-            vlapic_error(vlapic, APIC_ESR_SENDILL);
+            vlapic_error(vlapic, ilog2(APIC_ESR_SENDILL));
             break;
         }
         /* fall through */
@@ -803,17 +802,9 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         break;
 
     case APIC_ESR:
-    {
-        unsigned long flags;
-
-        spin_lock_irqsave(&vlapic->esr_lock, flags);
-        val = vlapic->hw.pending_esr;
-        vlapic->hw.pending_esr = 0;
-        spin_unlock_irqrestore(&vlapic->esr_lock, flags);
-
+        val = xchg(&vlapic->hw.pending_esr, 0);
         vlapic_set_reg(vlapic, APIC_ESR, val);
         break;
-    }
 
     case APIC_TASKPRI:
         vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff);
@@ -1716,8 +1707,6 @@ int vlapic_init(struct vcpu *v)
 
     vlapic_reset(vlapic);
 
-    spin_lock_init(&vlapic->esr_lock);
-
     tasklet_init(&vlapic->init_sipi.tasklet, vlapic_init_sipi_action, v);
 
     if ( v->vcpu_id == 0 )
diff --git a/xen/arch/x86/include/asm/hvm/vlapic.h b/xen/arch/x86/include/asm/hvm/vlapic.h
index 2c4ff94ae7..c388551198 100644
--- a/xen/arch/x86/include/asm/hvm/vlapic.h
+++ b/xen/arch/x86/include/asm/hvm/vlapic.h
@@ -69,7 +69,6 @@ struct vlapic {
         bool                 hw, regs;
         uint32_t             id, ldr;
     }                        loaded;
-    spinlock_t               esr_lock;
     struct periodic_time     pt;
     s_time_t                 timer_last_update;
     struct page_info         *regs_page;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 07 17:12:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Mar 2025 17:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905253.1313129 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbFc-0004Py-K0; Fri, 07 Mar 2025 17:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905253.1313129; Fri, 07 Mar 2025 17:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqbFc-0004Pq-HL; Fri, 07 Mar 2025 17:12:44 +0000
Received: by outflank-mailman (input) for mailman id 905253;
 Fri, 07 Mar 2025 17:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqbFb-0004Pi-UN
 for xen-changelog@lists.xenproject.org; Fri, 07 Mar 2025 17:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbFc-0074Wd-0I
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqbFb-00CvCQ-2c
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Mar 2025 17:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qvM5+dsCZ0qGjDkBiI+lhF2cAvtpcHyLKxE5v/Ua84Y=; b=Z4dY4znuoG27xQBGi0oN1qlgeS
	rmaO6EundchLs4HX5Q2VPnfVtHPyHMrjD3LT6jsfEeKEpxkkJNyDHtDwxKQ5kkSReAFeNneT81QGc
	o48+1gM/RWMtTj5H9UG5uB4X+TKLXjzs5LY1AvlvVYdPApmsCA9ZHePyGfts/41RcUS0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/e820: Remove opencoded vendor/feature checks
Message-Id: <E1tqbFb-00CvCQ-2c@xenbits.xenproject.org>
Date: Fri, 07 Mar 2025 17:12:43 +0000

commit ac29d63a0fa6a3ed98ecf86f95995811c301308f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 6 23:21:07 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 7 14:34:08 2025 +0000

    x86/e820: Remove opencoded vendor/feature checks
    
    We've already scanned features by the time init_e820() is called.  Remove the
    cpuid() calls.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/e820.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
index e052e84de7..ca577c0bde 100644
--- a/xen/arch/x86/e820.c
+++ b/xen/arch/x86/e820.c
@@ -421,21 +421,12 @@ static void __init clip_to_limit(uint64_t limit, const char *warnmsg)
 /* Conservative estimate of top-of-RAM by looking for MTRR WB regions. */
 static uint64_t __init mtrr_top_of_ram(void)
 {
-    uint32_t eax, ebx, ecx, edx;
     uint64_t mtrr_cap, mtrr_def, addr_mask, base, mask, top;
     unsigned int i;
 
     /* By default we check only Intel systems. */
     if ( e820_mtrr_clip == -1 )
-    {
-        char vendor[13];
-        cpuid(0x00000000, &eax,
-              (uint32_t *)&vendor[0],
-              (uint32_t *)&vendor[8],
-              (uint32_t *)&vendor[4]);
-        vendor[12] = '\0';
-        e820_mtrr_clip = !strcmp(vendor, "GenuineIntel");
-    }
+        e820_mtrr_clip = boot_cpu_data.x86_vendor == X86_VENDOR_INTEL;
 
     if ( !e820_mtrr_clip )
         return 0;
@@ -444,8 +435,7 @@ static uint64_t __init mtrr_top_of_ram(void)
         printk("Checking MTRR ranges...\n");
 
     /* Does the CPU support architectural MTRRs? */
-    cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
-    if ( !test_bit(X86_FEATURE_MTRR & 31, &edx) )
+    if ( !cpu_has_mtrr )
          return 0;
 
     /* paddr_bits must have been set at this point */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Mar 08 01:11:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 08 Mar 2025 01:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905533.1313343 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqiiV-0000NO-6Z; Sat, 08 Mar 2025 01:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905533.1313343; Sat, 08 Mar 2025 01:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqiiV-0000NF-3d; Sat, 08 Mar 2025 01:11:03 +0000
Received: by outflank-mailman (input) for mailman id 905533;
 Sat, 08 Mar 2025 01:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqiiT-0000N3-P2
 for xen-changelog@lists.xenproject.org; Sat, 08 Mar 2025 01:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqiiT-008c86-2o
 for xen-changelog@lists.xenproject.org;
 Sat, 08 Mar 2025 01:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqiiT-00DIb0-1s
 for xen-changelog@lists.xenproject.org;
 Sat, 08 Mar 2025 01:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oQ6vH2k6nhgLUu7lGY54dRpyte1wfbR2zGZmVISWGZs=; b=kGJ6rp1jZWdT2zSFphzZWUsnca
	hKpmkUm2gmK4ufBGZX7g2LLdCFivYaPc2+uO42fqT4gTJzfp+eQVoglU2MlHP6RI7meWjh0OdBMRo
	mzO2zm3WuEWwqropSWr2tIuSU261LnmVgKEZ9BiSFvW0z9jYtzb0fvUpfJUvR5nBD+ps=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: hardware runners setup
Message-Id: <E1tqiiT-00DIb0-1s@xenbits.xenproject.org>
Date: Sat, 08 Mar 2025 01:11:01 +0000

commit 55e2d86baaaecfa18cc8cfd3b1bb9eafafd9d61a
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Mar 7 16:57:44 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Mar 7 16:57:44 2025 -0800

    docs: hardware runners setup
    
    Document how to setup a new hardware runner
    
    Signed-off-by: Victor Lira <VictorM.Lira@amd.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 docs/misc/ci.rst | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/docs/misc/ci.rst b/docs/misc/ci.rst
index 7aee55c5d2..8d9ebfb39d 100644
--- a/docs/misc/ci.rst
+++ b/docs/misc/ci.rst
@@ -19,6 +19,55 @@ After getting access to relevant runners, few extra changes are necessary in set
 2. Expand "Variables" section and add ``QUBES_JOBS=true`` variable for Qubes runners.
 3. Go to Settings -> Repository, expand "Branch rules" section and add a rule for protected branches - only those branches will get tests on the hardware runners. It's okay to use a pattern for branch name, and it's okay to allow force push.
 
+How to Set Up a New Hardware Runner
+***********************************
+
+A hardware runner is a GitLab runner designed to execute Xen tests on real hardware, such as an embedded board or a laptop. The GitLab runner runs on a controller PC, which is connected to the target board used for Xen testing. The controller PC can be any system, from a workstation to a Raspberry Pi.
+
+Steps to Set Up the Controller PC:
+
+1. Install the Docker service
+   - Follow the instructions at: [Docker Installation Guide](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)
+
+2. Install the GitLab Runner service
+   - Follow the instructions at: [GitLab Runner Installation Guide](https://docs.gitlab.com/runner/install/linux-repository/#install-gitlab-runner)
+
+3. Register the runner with GitLab
+   - Generate a runner token with a specific tag to identify it.
+   - Run `gitlab-runner register` and enter the token. Accepting the default settings is sufficient.
+
+These steps are common for setting up any GitLab runner. However, for hardware runners, additional configurations are required to enable the controller PC to:
+
+- Power on and off the target board.
+- Connect to the serial interface of the target board.
+- Establish an Ethernet connection with the target board.
+- Run a TFTP server with a TFTP root directory accessible by GitLab container tests.
+  - This allows the test script to place binaries, such as Xen, in the TFTP root before powering on the target board.
+
+To enable the required capabilities, edit the GitLab Runner configuration file located at `/etc/gitlab-runner/config.toml`:
+
+- Map the TFTP boot directory.
+- Map the serial device of the target board.
+
+Example Configuration:
+
+    volumes = ["/scratch/gitlab-runner:/scratch/gitlab-runner"]
+    devices = ["/dev/ttyUSB0:/dev/ttyUSB0"]
+
+After making these changes, restart the GitLab Runner service:
+
+    gitlab-runner restart
+
+This completes the setup of the hardware runner. The system is now ready for executing Xen tests on real hardware. As an example, to execute tests on an AMD x86 embedded board, we currently use the following script:
+
+    automation/scripts/xilinx-smoke-dom0-x86_64.sh
+
+Other examples are available under automation/scripts, such as
+automation/scripts/qubes-x86-64.sh, and at external locations:
+`<https://www.qubes-os.org/news/2022/05/05/automated-os-testing-on-physical-laptops>`_,
+`<https://github.com/QubesOS/tests-hw-setup/blob/28aa8b86208a54fc2ac986f06c66c92230bf771e/states/gitlab-runner-conf.toml>`_.
+
+
 Selecting individual tests
 **************************
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Mar 08 07:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 08 Mar 2025 07:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.905596.1313358 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqp1U-0007Qa-4U; Sat, 08 Mar 2025 07:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 905596.1313358; Sat, 08 Mar 2025 07:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tqp1U-0007QS-1m; Sat, 08 Mar 2025 07:55:04 +0000
Received: by outflank-mailman (input) for mailman id 905596;
 Sat, 08 Mar 2025 07:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tqp1S-0007QM-3h
 for xen-changelog@lists.xenproject.org; Sat, 08 Mar 2025 07:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqp1R-008lXx-3D
 for xen-changelog@lists.xenproject.org;
 Sat, 08 Mar 2025 07:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tqp1R-00Di9P-2F
 for xen-changelog@lists.xenproject.org;
 Sat, 08 Mar 2025 07:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CnNjXV+c8vnVXvt5fGptHtIMp/u5yKQP4o97bfZMqgw=; b=vMf8T+haTxVy8Jo9Bi+Y5FtmkZ
	FbIsxnqZ70JWJs07+v9E7jrE1JeqC0UFrmbtyGTroG3W9DnbkfWAiHCQ6dH14pIj8l91Rea96T4DZ
	Snuohrus2HBNh92OBq7HmqyJmHjZHqB3Ckbn5ZN7ToUbgqURrRbs8cpS/orDkPdAgV+o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: hardware runners setup
Message-Id: <E1tqp1R-00Di9P-2F@xenbits.xenproject.org>
Date: Sat, 08 Mar 2025 07:55:01 +0000

commit 55e2d86baaaecfa18cc8cfd3b1bb9eafafd9d61a
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Mar 7 16:57:44 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Mar 7 16:57:44 2025 -0800

    docs: hardware runners setup
    
    Document how to setup a new hardware runner
    
    Signed-off-by: Victor Lira <VictorM.Lira@amd.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 docs/misc/ci.rst | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/docs/misc/ci.rst b/docs/misc/ci.rst
index 7aee55c5d2..8d9ebfb39d 100644
--- a/docs/misc/ci.rst
+++ b/docs/misc/ci.rst
@@ -19,6 +19,55 @@ After getting access to relevant runners, few extra changes are necessary in set
 2. Expand "Variables" section and add ``QUBES_JOBS=true`` variable for Qubes runners.
 3. Go to Settings -> Repository, expand "Branch rules" section and add a rule for protected branches - only those branches will get tests on the hardware runners. It's okay to use a pattern for branch name, and it's okay to allow force push.
 
+How to Set Up a New Hardware Runner
+***********************************
+
+A hardware runner is a GitLab runner designed to execute Xen tests on real hardware, such as an embedded board or a laptop. The GitLab runner runs on a controller PC, which is connected to the target board used for Xen testing. The controller PC can be any system, from a workstation to a Raspberry Pi.
+
+Steps to Set Up the Controller PC:
+
+1. Install the Docker service
+   - Follow the instructions at: [Docker Installation Guide](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)
+
+2. Install the GitLab Runner service
+   - Follow the instructions at: [GitLab Runner Installation Guide](https://docs.gitlab.com/runner/install/linux-repository/#install-gitlab-runner)
+
+3. Register the runner with GitLab
+   - Generate a runner token with a specific tag to identify it.
+   - Run `gitlab-runner register` and enter the token. Accepting the default settings is sufficient.
+
+These steps are common for setting up any GitLab runner. However, for hardware runners, additional configurations are required to enable the controller PC to:
+
+- Power on and off the target board.
+- Connect to the serial interface of the target board.
+- Establish an Ethernet connection with the target board.
+- Run a TFTP server with a TFTP root directory accessible by GitLab container tests.
+  - This allows the test script to place binaries, such as Xen, in the TFTP root before powering on the target board.
+
+To enable the required capabilities, edit the GitLab Runner configuration file located at `/etc/gitlab-runner/config.toml`:
+
+- Map the TFTP boot directory.
+- Map the serial device of the target board.
+
+Example Configuration:
+
+    volumes = ["/scratch/gitlab-runner:/scratch/gitlab-runner"]
+    devices = ["/dev/ttyUSB0:/dev/ttyUSB0"]
+
+After making these changes, restart the GitLab Runner service:
+
+    gitlab-runner restart
+
+This completes the setup of the hardware runner. The system is now ready for executing Xen tests on real hardware. As an example, to execute tests on an AMD x86 embedded board, we currently use the following script:
+
+    automation/scripts/xilinx-smoke-dom0-x86_64.sh
+
+Other examples are available under automation/scripts, such as
+automation/scripts/qubes-x86-64.sh, and at external locations:
+`<https://www.qubes-os.org/news/2022/05/05/automated-os-testing-on-physical-laptops>`_,
+`<https://github.com/QubesOS/tests-hw-setup/blob/28aa8b86208a54fc2ac986f06c66c92230bf771e/states/gitlab-runner-conf.toml>`_.
+
+
 Selecting individual tests
 **************************
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 09:00:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 09:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906243.1313681 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trYzT-00081X-AI; Mon, 10 Mar 2025 09:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906243.1313681; Mon, 10 Mar 2025 09:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trYzT-00081N-7g; Mon, 10 Mar 2025 09:00:03 +0000
Received: by outflank-mailman (input) for mailman id 906243;
 Mon, 10 Mar 2025 09:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trYzR-0007ib-Rd
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 09:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trYzR-00CaYx-39
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 09:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trYzR-001CY4-2E
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 09:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1Qeobm0oQh9cw8hXPJZPETUMU+Y+glL3tCNeE1S7Wgo=; b=IHOWe8tUDpGjxzUuL/c6qUc/0a
	pYCtXyw+kxpxnE0ZADH1xpw78isDJzjJmerF9lNQ7ulAWhH9XHPyLPL2oUl1xvOMowpke94991d4E
	jAZtXrfTMcDNwM2nNiiRZ006uyTk+oahlhkpwkMc8d99+TsZipAQlXdxu7t59uP+HBdQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/hvmloader: Retrieve APIC IDs from the APs themselves
Message-Id: <E1trYzR-001CY4-2E@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 09:00:01 +0000

commit 9ad0db58c7e2a6bd2b1c0d66ba3b2d73c8d11165
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Mon Mar 10 09:52:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 10 09:52:30 2025 +0100

    tools/hvmloader: Retrieve APIC IDs from the APs themselves
    
    Make it so the APs expose their own APIC IDs in a lookup table (LUT). We
    can use that LUT to populate the MADT, decoupling the algorithm that
    relates CPU IDs and APIC IDs from hvmloader.
    
    Modified the printf to also print the APIC ID of each CPU, as well as
    fixing a (benign) wrong specifier being used for the vcpu id.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/config.h |  2 ++
 tools/firmware/hvmloader/smp.c    | 43 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h
index cd716bf392..b32bcbf4a1 100644
--- a/tools/firmware/hvmloader/config.h
+++ b/tools/firmware/hvmloader/config.h
@@ -48,6 +48,8 @@ extern uint8_t ioapic_version;
 
 #define IOAPIC_ID           0x01
 
+extern uint32_t *cpu_to_apicid;
+
 #define LAPIC_BASE_ADDRESS  0xfee00000
 #define LAPIC_ID(vcpu_id)   ((vcpu_id) * 2)
 
diff --git a/tools/firmware/hvmloader/smp.c b/tools/firmware/hvmloader/smp.c
index 1b940cefd0..341fd6e0b6 100644
--- a/tools/firmware/hvmloader/smp.c
+++ b/tools/firmware/hvmloader/smp.c
@@ -31,9 +31,38 @@
 
 static int ap_callin;
 
+/** True if x2apic support is exposed to the guest. */
+static bool has_x2apic;
+
+/**
+ * Lookup table of APIC IDs.
+ *
+ * Each entry is populated for its respective CPU as they come online. This is
+ * required for generating the MADT with minimal assumptions about ID
+ * relationships.
+ */
+uint32_t *cpu_to_apicid;
+
+static uint32_t read_apic_id(void)
+{
+    uint32_t apic_id;
+
+    if ( has_x2apic )
+        cpuid(0xb, NULL, NULL, NULL, &apic_id);
+    else
+    {
+        cpuid(1, NULL, &apic_id, NULL, NULL);
+        apic_id >>= 24;
+    }
+
+    return apic_id;
+}
+
 static void cpu_setup(unsigned int cpu)
 {
-    printf(" - CPU%d ... ", cpu);
+    uint32_t apicid = cpu_to_apicid[cpu] = read_apic_id();
+
+    printf(" - CPU%u APIC ID %u ... ", cpu, apicid);
     cacheattr_init();
     printf("done.\n");
 
@@ -104,8 +133,20 @@ static void boot_cpu(unsigned int cpu)
 void smp_initialise(void)
 {
     unsigned int i, nr_cpus = hvm_info->nr_vcpus;
+    uint32_t ecx, max_leaf;
+
+    cpuid(0, &max_leaf, NULL, NULL, NULL);
+    if ( max_leaf >= 0xb )
+    {
+        cpuid(1, NULL, NULL, &ecx, NULL);
+        has_x2apic = (ecx >> 21) & 1;
+        if ( has_x2apic )
+            printf("x2APIC supported\n");
+    }
 
     printf("Multiprocessor initialisation:\n");
+    cpu_to_apicid = scratch_alloc(sizeof(*cpu_to_apicid) * nr_cpus,
+                                  sizeof(*cpu_to_apicid));
     cpu_setup(0);
     for ( i = 1; i < nr_cpus; i++ )
         boot_cpu(i);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 09:00:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 09:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906245.1313695 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trYzc-0000OG-IT; Mon, 10 Mar 2025 09:00:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906245.1313695; Mon, 10 Mar 2025 09:00:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trYzc-0000O8-FT; Mon, 10 Mar 2025 09:00:12 +0000
Received: by outflank-mailman (input) for mailman id 906245;
 Mon, 10 Mar 2025 09:00:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trYzb-0000Nq-SZ
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 09:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trYzc-00CaZ3-0I
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 09:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trYzb-001CaH-2b
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 09:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YynUFJKc/9Z6yDRxcVzCySxX7Ewx4DPW80udH3t9y54=; b=T3dftu6x7SsO22piGQbX5jJ/84
	Tf3LrWn2Pa3mTGl0l8aU/eyqUIvpXTFvSlokUrLR/NQEL9u31E6pZgdoC1NxCUiw8Ry187N3/xz9m
	9HVprwstNWgS3O+vHrR07BgJfSVJkOz2qI81fZSpWSl5TnRty9bn/QbAR6s93OSISVws=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/hvmloader: Replace LAPIC_ID() with cpu_to_apicid[]
Message-Id: <E1trYzb-001CaH-2b@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 09:00:11 +0000

commit 2c3dffbaa324e5f09e714fea3d0f05c7daabee43
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Mon Mar 10 09:52:39 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 10 09:52:39 2025 +0100

    tools/hvmloader: Replace LAPIC_ID() with cpu_to_apicid[]
    
    Replace uses of the LAPIC_ID() macro with accesses to the
    cpu_to_apicid[] lookup table. This table contains the APIC IDs of each
    vCPU as probed at runtime rather than assuming a predefined relation.
    
    Moved smp_initialise() ahead of apic_setup() in order to initialise
    cpu_to_apicid ASAP and avoid using it uninitialised. Note that bringing
    up the APs doesn't need the APIC in hvmloader becasue it always runs
    virtualized and uses the PV interface.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/config.h    | 1 -
 tools/firmware/hvmloader/hvmloader.c | 6 +++---
 tools/firmware/hvmloader/mp_tables.c | 2 +-
 tools/firmware/hvmloader/util.c      | 2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h
index b32bcbf4a1..6e1da137d7 100644
--- a/tools/firmware/hvmloader/config.h
+++ b/tools/firmware/hvmloader/config.h
@@ -51,7 +51,6 @@ extern uint8_t ioapic_version;
 extern uint32_t *cpu_to_apicid;
 
 #define LAPIC_BASE_ADDRESS  0xfee00000
-#define LAPIC_ID(vcpu_id)   ((vcpu_id) * 2)
 
 #define PCI_ISA_DEVFN       0x08    /* dev 1, fn 0 */
 #define PCI_ISA_IRQ_MASK    0x0c20U /* ISA IRQs 5,10,11 are PCI connected */
diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c
index f8af88fabf..4e330fc1e2 100644
--- a/tools/firmware/hvmloader/hvmloader.c
+++ b/tools/firmware/hvmloader/hvmloader.c
@@ -224,7 +224,7 @@ static void apic_setup(void)
 
     /* 8259A ExtInts are delivered through IOAPIC pin 0 (Virtual Wire Mode). */
     ioapic_write(0x10, APIC_DM_EXTINT);
-    ioapic_write(0x11, SET_APIC_ID(LAPIC_ID(0)));
+    ioapic_write(0x11, SET_APIC_ID(cpu_to_apicid[0]));
 }
 
 struct bios_info {
@@ -341,11 +341,11 @@ int main(void)
 
     printf("CPU speed is %u MHz\n", get_cpu_mhz());
 
+    smp_initialise();
+
     apic_setup();
     pci_setup();
 
-    smp_initialise();
-
     perform_tests();
 
     if ( bios->bios_info_setup )
diff --git a/tools/firmware/hvmloader/mp_tables.c b/tools/firmware/hvmloader/mp_tables.c
index 77d3010406..3c93a5c947 100644
--- a/tools/firmware/hvmloader/mp_tables.c
+++ b/tools/firmware/hvmloader/mp_tables.c
@@ -199,7 +199,7 @@ static void fill_mp_config_table(struct mp_config_table *mpct, int length)
 static void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
 {
     mppe->type = ENTRY_TYPE_PROCESSOR;
-    mppe->lapic_id = LAPIC_ID(vcpu_id);
+    mppe->lapic_id = cpu_to_apicid[vcpu_id];
     mppe->lapic_version = 0x11;
     mppe->cpu_flags = CPU_FLAG_ENABLED;
     if ( vcpu_id == 0 )
diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index d3b3f9038e..2d07ce1290 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -827,7 +827,7 @@ static void acpi_mem_free(struct acpi_ctxt *ctxt,
 
 static uint32_t acpi_lapic_id(unsigned cpu)
 {
-    return LAPIC_ID(cpu);
+    return cpu_to_apicid[cpu];
 }
 
 void hvmloader_acpi_build_tables(struct acpi_config *config,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 09:00:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 09:00:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906247.1313699 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trYzm-0000Tk-Kd; Mon, 10 Mar 2025 09:00:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906247.1313699; Mon, 10 Mar 2025 09:00:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trYzm-0000Tb-HB; Mon, 10 Mar 2025 09:00:22 +0000
Received: by outflank-mailman (input) for mailman id 906247;
 Mon, 10 Mar 2025 09:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trYzl-0000TE-Vc
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 09:00:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trYzm-00CaZW-0a
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 09:00:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trYzl-001Cbd-2w
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 09:00:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aY8AA4OhzYVHb0nZSakb5b62YtVW27SqLNYga6mAPsI=; b=hjlDFdEN+QB6IriLgjwztAR89d
	JqzayTf/9Dwus4Os64qNGpS6c9RXRFMYEPb/7Kk3kXqgH2IiHQkfI9G+QCX46jsdJqR3fnNsU3L4J
	9lpchJFM78rIYy07xEFGSb8Wbsx+QP2K9XMBwFmHVrYQdwfwVH39VJzzUSIDY1kVGIpw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/store: use single_with_domid() in xs_get_domain_path()
Message-Id: <E1trYzl-001Cbd-2w@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 09:00:21 +0000

commit 9495e6577a69bb3783bc72860927d0538f07bc7c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Mar 10 09:52:54 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 10 09:52:54 2025 +0100

    tools/libs/store: use single_with_domid() in xs_get_domain_path()
    
    xs_get_domain_path() can be simplified by using single_with_domid().
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/store/xs.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c
index e22f99b59f..cf3266807f 100644
--- a/tools/libs/store/xs.c
+++ b/tools/libs/store/xs.c
@@ -1345,11 +1345,7 @@ bool xs_resume_domain(struct xs_handle *h, unsigned int domid)
 
 char *xs_get_domain_path(struct xs_handle *h, unsigned int domid)
 {
-	char domid_str[MAX_STRLEN(domid)];
-
-	snprintf(domid_str, sizeof(domid_str), "%u", domid);
-
-	return xs_single(h, XBT_NULL, XS_GET_DOMAIN_PATH, domid_str, NULL);
+	return single_with_domid(h, XS_GET_DOMAIN_PATH, domid);
 }
 
 bool xs_path_is_subpath(const char *parent, const char *child)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 09:00:32 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 09:00:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906251.1313703 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trYzw-0000aP-LG; Mon, 10 Mar 2025 09:00:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906251.1313703; Mon, 10 Mar 2025 09:00:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trYzw-0000aD-IY; Mon, 10 Mar 2025 09:00:32 +0000
Received: by outflank-mailman (input) for mailman id 906251;
 Mon, 10 Mar 2025 09:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trYzw-0000a1-2V
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 09:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trYzw-00CaZa-0u
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 09:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trYzw-001Cew-02
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 09:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aMrZTB8fi/N+VR+eSUs5UpesiRhrvRGzE22Wsr4Rhqo=; b=y/n+zXHLGBXIIC2I5sWyjyT+Fp
	mzk2b8UDXdHc3lGbbTlzR2pZkESvuoQNpPI6BWKsTq5B/8U36YhjAvgRk03zIiCHhXIixfnRJYsJ6
	nOdW8o2EAD17DygS33ml8UeRXTSMmPowyAnuY1cHb+3UkPIz7Iqt5dcmzv09CdirWAZE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/consoled: clean up console handling for PV shim
Message-Id: <E1trYzw-001Cew-02@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 09:00:32 +0000

commit f147ccf2b3c8a9f32e0fb2f32255ff96c3caf43c
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Mon Mar 10 09:53:11 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 10 09:53:11 2025 +0100

    xen/consoled: clean up console handling for PV shim
    
    There are few places which check pv_shim console under CONFIG_PV_SHIM or
    CONFIG_X86 in xen console driver.
    
    Instead of inconsistent #ifdef-ing, introduce and use consoled_is_enabled() in
    switch_serial_input() and __serial_rx().
    
    PV shim case is fixed in __serial_rx() - should be under 'pv_shim &&
    pv_console' check.
    
    Signature of consoled_guest_{rx,tx} has changed so the errors can be logged
    on the callsites.
    
    Also, move get_initial_domain_id() to arch-independent header since it is now
    required by console driver.
    
    Lastly, add missing SPDX-License-Identifier to xen/consoled.h
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/pv/shim.h |  5 +++--
 xen/arch/x86/pv/shim.c             |  8 ++------
 xen/common/domain.c                |  9 +++++++++
 xen/drivers/char/console.c         | 15 ++++++---------
 xen/drivers/char/consoled.c        | 17 +++++++++++++----
 xen/include/xen/consoled.h         | 15 +++++++++++++--
 xen/include/xen/domain.h           |  2 ++
 7 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/include/asm/pv/shim.h b/xen/arch/x86/include/asm/pv/shim.h
index 6153e27005..27053d4f6f 100644
--- a/xen/arch/x86/include/asm/pv/shim.h
+++ b/xen/arch/x86/include/asm/pv/shim.h
@@ -31,7 +31,7 @@ long cf_check pv_shim_cpu_up(void *data);
 long cf_check pv_shim_cpu_down(void *data);
 void pv_shim_online_memory(unsigned int nr, unsigned int order);
 void pv_shim_offline_memory(unsigned int nr, unsigned int order);
-domid_t get_initial_domain_id(void);
+domid_t pv_shim_get_initial_domain_id(void);
 uint64_t pv_shim_mem(uint64_t avail);
 void pv_shim_fixup_e820(void);
 const struct platform_bad_page *pv_shim_reserved_pages(unsigned int *size);
@@ -76,8 +76,9 @@ static inline void pv_shim_offline_memory(unsigned int nr, unsigned int order)
 {
     ASSERT_UNREACHABLE();
 }
-static inline domid_t get_initial_domain_id(void)
+static inline domid_t pv_shim_get_initial_domain_id(void)
 {
+    ASSERT_UNREACHABLE();
     return 0;
 }
 static inline uint64_t pv_shim_mem(uint64_t avail)
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 81e4a0516d..c506cc0bec 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -603,8 +603,7 @@ long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
         if ( pv_console && send.port == pv_console_evtchn() )
         {
-            consoled_guest_rx();
-            rc = 0;
+            rc = consoled_guest_rx();
         }
         else
             rc = xen_hypercall_event_channel_op(EVTCHNOP_send, &send);
@@ -1016,13 +1015,10 @@ void pv_shim_offline_memory(unsigned int nr, unsigned int order)
     }
 }
 
-domid_t get_initial_domain_id(void)
+domid_t pv_shim_get_initial_domain_id(void)
 {
     uint32_t eax, ebx, ecx, edx;
 
-    if ( !pv_shim )
-        return 0;
-
     cpuid(xen_cpuid_base + 4, &eax, &ebx, &ecx, &edx);
 
     return (eax & XEN_HVM_CPUID_DOMID_PRESENT) ? ecx : 1;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index b887c60ecc..fd98534c88 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -2384,6 +2384,15 @@ int continue_hypercall_on_cpu(
     return 0;
 }
 
+domid_t get_initial_domain_id(void)
+{
+#ifdef CONFIG_X86
+    if ( pv_shim )
+        return pv_shim_get_initial_domain_id();
+#endif
+    return hardware_domid;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 2f028c5d44..ba428199d2 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -32,9 +32,9 @@
 #include <xen/pv_console.h>
 #include <asm/setup.h>
 #include <xen/sections.h>
+#include <xen/consoled.h>
 
 #ifdef CONFIG_X86
-#include <xen/consoled.h>
 #include <asm/guest.h>
 #endif
 #ifdef CONFIG_SBSA_VUART_CONSOLE
@@ -507,11 +507,9 @@ static void switch_serial_input(void)
             break;
         }
 
-#ifdef CONFIG_PV_SHIM
-        if ( next_rx == 1 )
+        if ( consoled_is_enabled() && next_rx == 1 )
             domid = get_initial_domain_id();
         else
-#endif
             domid = next_rx - 1;
         d = rcu_lock_domain_by_id(domid);
         if ( d )
@@ -562,16 +560,15 @@ static void __serial_rx(char c)
         rc = vpl011_rx_char_xen(d, c);
 #endif
 
+    if ( consoled_is_enabled() )
+        /* Deliver input to the PV shim console. */
+        rc = consoled_guest_tx(c);
+
     if ( rc )
         guest_printk(d,
                      XENLOG_WARNING "failed to process console input: %d\n",
                      rc);
 
-#ifdef CONFIG_X86
-    if ( pv_shim && pv_console )
-        consoled_guest_tx(c);
-#endif
-
     console_put_domain(d);
 }
 
diff --git a/xen/drivers/char/consoled.c b/xen/drivers/char/consoled.c
index b415b632ce..8704ec251e 100644
--- a/xen/drivers/char/consoled.c
+++ b/xen/drivers/char/consoled.c
@@ -43,13 +43,13 @@ struct xencons_interface *consoled_get_ring_addr(void)
 static char buf[BUF_SZ + 1];
 
 /* Receives characters from a domain's PV console */
-void consoled_guest_rx(void)
+int consoled_guest_rx(void)
 {
     size_t idx = 0;
     XENCONS_RING_IDX cons, prod;
 
     if ( !cons_ring )
-        return;
+        return -ENODEV;
 
     spin_lock(&rx_lock);
 
@@ -91,15 +91,17 @@ void consoled_guest_rx(void)
 
  out:
     spin_unlock(&rx_lock);
+
+    return 0;
 }
 
 /* Sends a character into a domain's PV console */
-void consoled_guest_tx(char c)
+int consoled_guest_tx(char c)
 {
     XENCONS_RING_IDX cons, prod;
 
     if ( !cons_ring )
-        return;
+        return -ENODEV;
 
     cons = ACCESS_ONCE(cons_ring->in_cons);
     prod = cons_ring->in_prod;
@@ -125,6 +127,13 @@ void consoled_guest_tx(char c)
  notify:
     /* Always notify the guest: prevents receive path from getting stuck. */
     pv_shim_inject_evtchn(pv_console_evtchn());
+
+    return 0;
+}
+
+bool consoled_is_enabled(void)
+{
+    return pv_shim && pv_console;
 }
 
 /*
diff --git a/xen/include/xen/consoled.h b/xen/include/xen/consoled.h
index bd7ab6329e..7bebc6bf5c 100644
--- a/xen/include/xen/consoled.h
+++ b/xen/include/xen/consoled.h
@@ -1,12 +1,23 @@
 #ifndef __XEN_CONSOLED_H__
 #define __XEN_CONSOLED_H__
 
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <public/io/console.h>
 
 void consoled_set_ring_addr(struct xencons_interface *ring);
 struct xencons_interface *consoled_get_ring_addr(void);
-void consoled_guest_rx(void);
-void consoled_guest_tx(char c);
+int consoled_guest_rx(void);
+int consoled_guest_tx(char c);
+
+#ifdef CONFIG_PV_SHIM
+
+bool consoled_is_enabled(void);
+
+#else
+
+#define consoled_is_enabled()   (false)
+
+#endif /* CONFIG_PV_SHIM */
 
 #endif /* __XEN_CONSOLED_H__ */
 /*
diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
index 3de5635291..83069de501 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -35,6 +35,8 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info);
 void arch_get_domain_info(const struct domain *d,
                           struct xen_domctl_getdomaininfo *info);
 
+domid_t get_initial_domain_id(void);
+
 /* CDF_* constant. Internal flags for domain creation. */
 /* Is this a privileged domain? */
 #define CDF_privileged           (1U << 0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 09:00:42 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 09:00:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906253.1313707 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trZ06-0000hO-Mf; Mon, 10 Mar 2025 09:00:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906253.1313707; Mon, 10 Mar 2025 09:00:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trZ06-0000hG-K1; Mon, 10 Mar 2025 09:00:42 +0000
Received: by outflank-mailman (input) for mailman id 906253;
 Mon, 10 Mar 2025 09:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trZ06-0000hA-5F
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 09:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trZ06-00CaZg-1C
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 09:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trZ06-001ChT-0L
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 09:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tu+Kmf3P2x1HGqWygaGtoFvFZ2Mn15xBu3inEIM0CUw=; b=w7UoADC5mGKsqqWGkdkyHWqqFI
	so00l3eJeH48NdUO4DmiHOTCvNCDrYUZnMkaRxJbUtucrBhYYXTJIBPB6fKcbkUEUP1dl9SRQGvub
	a6CJE/V6RDvJ9GASJ6jhMW3UqeVznpKPJPWz01SH664E4sqXsZfHL1N6swV8WBcOOM3c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Factor out construct_hwdom()
Message-Id: <E1trZ06-001ChT-0L@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 09:00:42 +0000

commit 659da11304665eed38a5d02ee80ed0881cb3eb9b
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Mon Mar 10 09:53:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 10 09:53:51 2025 +0100

    xen/arm: Factor out construct_hwdom()
    
    Factor out construct_hwdom() from construct_dom0().  This will be
    re-used by the dom0less code when building a domain with the hardware
    capability.
    
    iommu_hwdom_init(d) is moved into construct_hwdom() which moves it after
    kernel_probe().  kernel_probe() doesn't seem to depend on its setting.
    
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/domain_build.c             | 28 ++++++++++++++++++----------
 xen/arch/arm/include/asm/domain_build.h |  1 +
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index d4570bc0b4..7cc141ef75 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2296,8 +2296,6 @@ static int __init construct_dom0(struct domain *d)
         dom0_mem = MB(512);
     }
 
-    iommu_hwdom_init(d);
-
     d->max_pages = dom0_mem >> PAGE_SHIFT;
 
     kinfo.unassigned_mem = dom0_mem;
@@ -2307,17 +2305,27 @@ static int __init construct_dom0(struct domain *d)
     if ( rc < 0 )
         return rc;
 
+    return construct_hwdom(&kinfo);
+}
+
+int __init construct_hwdom(struct kernel_info *kinfo)
+{
+    struct domain *d = kinfo->d;
+    int rc;
+
+    iommu_hwdom_init(d);
+
 #ifdef CONFIG_ARM_64
     /* type must be set before allocate_memory */
-    d->arch.type = kinfo.type;
+    d->arch.type = kinfo->type;
 #endif
-    find_gnttab_region(d, &kinfo);
+    find_gnttab_region(d, kinfo);
     if ( is_domain_direct_mapped(d) )
-        allocate_memory_11(d, &kinfo);
+        allocate_memory_11(d, kinfo);
     else
-        allocate_memory(d, &kinfo);
+        allocate_memory(d, kinfo);
 
-    rc = process_shm_chosen(d, &kinfo);
+    rc = process_shm_chosen(d, kinfo);
     if ( rc < 0 )
         return rc;
 
@@ -2332,7 +2340,7 @@ static int __init construct_dom0(struct domain *d)
 
     if ( acpi_disabled )
     {
-        rc = prepare_dtb_hwdom(d, &kinfo);
+        rc = prepare_dtb_hwdom(d, kinfo);
         if ( rc < 0 )
             return rc;
 #ifdef CONFIG_HAS_PCI
@@ -2340,12 +2348,12 @@ static int __init construct_dom0(struct domain *d)
 #endif
     }
     else
-        rc = prepare_acpi(d, &kinfo);
+        rc = prepare_acpi(d, kinfo);
 
     if ( rc < 0 )
         return rc;
 
-    return construct_domain(d, &kinfo);
+    return construct_domain(d, kinfo);
 }
 
 void __init create_dom0(void)
diff --git a/xen/arch/arm/include/asm/domain_build.h b/xen/arch/arm/include/asm/domain_build.h
index 5d77af2e8b..134290853c 100644
--- a/xen/arch/arm/include/asm/domain_build.h
+++ b/xen/arch/arm/include/asm/domain_build.h
@@ -13,6 +13,7 @@ bool allocate_bank_memory(struct kernel_info *kinfo, gfn_t sgfn,
                           paddr_t tot_size);
 void allocate_memory(struct domain *d, struct kernel_info *kinfo);
 int construct_domain(struct domain *d, struct kernel_info *kinfo);
+int construct_hwdom(struct kernel_info *kinfo);
 int domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit);
 int make_chosen_node(const struct kernel_info *kinfo);
 int make_cpus_node(const struct domain *d, void *fdt);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 10:33:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 10:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906388.1313820 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1traRT-0000M1-Qh; Mon, 10 Mar 2025 10:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906388.1313820; Mon, 10 Mar 2025 10:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1traRT-0000Lt-No; Mon, 10 Mar 2025 10:33:03 +0000
Received: by outflank-mailman (input) for mailman id 906388;
 Mon, 10 Mar 2025 10:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1traRS-0000Ln-Gi
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 10:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1traRS-00CcSY-1H
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 10:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1traRS-001L7r-0C
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 10:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8wXrP5TwkRQKJJaJdN4sPu7JtCS/kQcJXfJyCYTsSkA=; b=WfvWoCZHp+1aBfmLt3yQD7ePe1
	aaXRMiUUEZ6OaCgnT+TW4qAVlmwObre1mwjcwYzj7b1u4zaCyCMgn51+vfJU0AX+JKb8DDfVnB4R+
	D+PHRmhVhGcRvl42zlkKJHod/x2Smk0BWdUQT3kFxwkDdPk/D4BnY4Rv/a67YB912VfU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/hvmloader: Retrieve APIC IDs from the APs themselves
Message-Id: <E1traRS-001L7r-0C@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 10:33:02 +0000

commit 9ad0db58c7e2a6bd2b1c0d66ba3b2d73c8d11165
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Mon Mar 10 09:52:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 10 09:52:30 2025 +0100

    tools/hvmloader: Retrieve APIC IDs from the APs themselves
    
    Make it so the APs expose their own APIC IDs in a lookup table (LUT). We
    can use that LUT to populate the MADT, decoupling the algorithm that
    relates CPU IDs and APIC IDs from hvmloader.
    
    Modified the printf to also print the APIC ID of each CPU, as well as
    fixing a (benign) wrong specifier being used for the vcpu id.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/config.h |  2 ++
 tools/firmware/hvmloader/smp.c    | 43 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h
index cd716bf392..b32bcbf4a1 100644
--- a/tools/firmware/hvmloader/config.h
+++ b/tools/firmware/hvmloader/config.h
@@ -48,6 +48,8 @@ extern uint8_t ioapic_version;
 
 #define IOAPIC_ID           0x01
 
+extern uint32_t *cpu_to_apicid;
+
 #define LAPIC_BASE_ADDRESS  0xfee00000
 #define LAPIC_ID(vcpu_id)   ((vcpu_id) * 2)
 
diff --git a/tools/firmware/hvmloader/smp.c b/tools/firmware/hvmloader/smp.c
index 1b940cefd0..341fd6e0b6 100644
--- a/tools/firmware/hvmloader/smp.c
+++ b/tools/firmware/hvmloader/smp.c
@@ -31,9 +31,38 @@
 
 static int ap_callin;
 
+/** True if x2apic support is exposed to the guest. */
+static bool has_x2apic;
+
+/**
+ * Lookup table of APIC IDs.
+ *
+ * Each entry is populated for its respective CPU as they come online. This is
+ * required for generating the MADT with minimal assumptions about ID
+ * relationships.
+ */
+uint32_t *cpu_to_apicid;
+
+static uint32_t read_apic_id(void)
+{
+    uint32_t apic_id;
+
+    if ( has_x2apic )
+        cpuid(0xb, NULL, NULL, NULL, &apic_id);
+    else
+    {
+        cpuid(1, NULL, &apic_id, NULL, NULL);
+        apic_id >>= 24;
+    }
+
+    return apic_id;
+}
+
 static void cpu_setup(unsigned int cpu)
 {
-    printf(" - CPU%d ... ", cpu);
+    uint32_t apicid = cpu_to_apicid[cpu] = read_apic_id();
+
+    printf(" - CPU%u APIC ID %u ... ", cpu, apicid);
     cacheattr_init();
     printf("done.\n");
 
@@ -104,8 +133,20 @@ static void boot_cpu(unsigned int cpu)
 void smp_initialise(void)
 {
     unsigned int i, nr_cpus = hvm_info->nr_vcpus;
+    uint32_t ecx, max_leaf;
+
+    cpuid(0, &max_leaf, NULL, NULL, NULL);
+    if ( max_leaf >= 0xb )
+    {
+        cpuid(1, NULL, NULL, &ecx, NULL);
+        has_x2apic = (ecx >> 21) & 1;
+        if ( has_x2apic )
+            printf("x2APIC supported\n");
+    }
 
     printf("Multiprocessor initialisation:\n");
+    cpu_to_apicid = scratch_alloc(sizeof(*cpu_to_apicid) * nr_cpus,
+                                  sizeof(*cpu_to_apicid));
     cpu_setup(0);
     for ( i = 1; i < nr_cpus; i++ )
         boot_cpu(i);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 10:33:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 10:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906389.1313827 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1traRd-0000OC-V7; Mon, 10 Mar 2025 10:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906389.1313827; Mon, 10 Mar 2025 10:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1traRd-0000O3-Qe; Mon, 10 Mar 2025 10:33:13 +0000
Received: by outflank-mailman (input) for mailman id 906389;
 Mon, 10 Mar 2025 10:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1traRc-0000Np-BE
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 10:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1traRc-00CcSc-1b
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 10:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1traRc-001LAI-0i
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 10:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n1H/ZuJNh9dw8XeKSC9VAJOrckfua0sh94tQbAs0Qd8=; b=gD6LIT+lEN9iwesPD+CqA3cBrn
	yRqjfAsbetBvKrLleu52+aJLMhmXpz+uVzSxEuWsKm57RZR8qutu6gAZYDRZnMvI3Q340BcM7eftL
	ASxX7PF2YdTn47qFiwFIkEp639H8SQs+S4cFusnVXUVjqagOyhW9cZRKt3H3vK2I7LT0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/hvmloader: Replace LAPIC_ID() with cpu_to_apicid[]
Message-Id: <E1traRc-001LAI-0i@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 10:33:12 +0000

commit 2c3dffbaa324e5f09e714fea3d0f05c7daabee43
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Mon Mar 10 09:52:39 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 10 09:52:39 2025 +0100

    tools/hvmloader: Replace LAPIC_ID() with cpu_to_apicid[]
    
    Replace uses of the LAPIC_ID() macro with accesses to the
    cpu_to_apicid[] lookup table. This table contains the APIC IDs of each
    vCPU as probed at runtime rather than assuming a predefined relation.
    
    Moved smp_initialise() ahead of apic_setup() in order to initialise
    cpu_to_apicid ASAP and avoid using it uninitialised. Note that bringing
    up the APs doesn't need the APIC in hvmloader becasue it always runs
    virtualized and uses the PV interface.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/config.h    | 1 -
 tools/firmware/hvmloader/hvmloader.c | 6 +++---
 tools/firmware/hvmloader/mp_tables.c | 2 +-
 tools/firmware/hvmloader/util.c      | 2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h
index b32bcbf4a1..6e1da137d7 100644
--- a/tools/firmware/hvmloader/config.h
+++ b/tools/firmware/hvmloader/config.h
@@ -51,7 +51,6 @@ extern uint8_t ioapic_version;
 extern uint32_t *cpu_to_apicid;
 
 #define LAPIC_BASE_ADDRESS  0xfee00000
-#define LAPIC_ID(vcpu_id)   ((vcpu_id) * 2)
 
 #define PCI_ISA_DEVFN       0x08    /* dev 1, fn 0 */
 #define PCI_ISA_IRQ_MASK    0x0c20U /* ISA IRQs 5,10,11 are PCI connected */
diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c
index f8af88fabf..4e330fc1e2 100644
--- a/tools/firmware/hvmloader/hvmloader.c
+++ b/tools/firmware/hvmloader/hvmloader.c
@@ -224,7 +224,7 @@ static void apic_setup(void)
 
     /* 8259A ExtInts are delivered through IOAPIC pin 0 (Virtual Wire Mode). */
     ioapic_write(0x10, APIC_DM_EXTINT);
-    ioapic_write(0x11, SET_APIC_ID(LAPIC_ID(0)));
+    ioapic_write(0x11, SET_APIC_ID(cpu_to_apicid[0]));
 }
 
 struct bios_info {
@@ -341,11 +341,11 @@ int main(void)
 
     printf("CPU speed is %u MHz\n", get_cpu_mhz());
 
+    smp_initialise();
+
     apic_setup();
     pci_setup();
 
-    smp_initialise();
-
     perform_tests();
 
     if ( bios->bios_info_setup )
diff --git a/tools/firmware/hvmloader/mp_tables.c b/tools/firmware/hvmloader/mp_tables.c
index 77d3010406..3c93a5c947 100644
--- a/tools/firmware/hvmloader/mp_tables.c
+++ b/tools/firmware/hvmloader/mp_tables.c
@@ -199,7 +199,7 @@ static void fill_mp_config_table(struct mp_config_table *mpct, int length)
 static void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
 {
     mppe->type = ENTRY_TYPE_PROCESSOR;
-    mppe->lapic_id = LAPIC_ID(vcpu_id);
+    mppe->lapic_id = cpu_to_apicid[vcpu_id];
     mppe->lapic_version = 0x11;
     mppe->cpu_flags = CPU_FLAG_ENABLED;
     if ( vcpu_id == 0 )
diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index d3b3f9038e..2d07ce1290 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -827,7 +827,7 @@ static void acpi_mem_free(struct acpi_ctxt *ctxt,
 
 static uint32_t acpi_lapic_id(unsigned cpu)
 {
-    return LAPIC_ID(cpu);
+    return cpu_to_apicid[cpu];
 }
 
 void hvmloader_acpi_build_tables(struct acpi_config *config,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 10:33:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 10:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906390.1313830 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1traRn-0000R3-Uz; Mon, 10 Mar 2025 10:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906390.1313830; Mon, 10 Mar 2025 10:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1traRn-0000Qv-S5; Mon, 10 Mar 2025 10:33:23 +0000
Received: by outflank-mailman (input) for mailman id 906390;
 Mon, 10 Mar 2025 10:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1traRm-0000Qm-Cg
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 10:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1traRm-00CcSy-1w
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 10:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1traRm-001LC3-11
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 10:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+8RpyX1x6Hd/zBfeJkVS4bSSF622ndskkv36CxVWlzQ=; b=hJwH5WhZX4gQSvO5FUvm/seoNP
	lY2CqD5FnpjOOdvceKr2GJbHP/V6y2MTMkM+5chNhBw6XcNJZZhXt+YKmNytyxvkY2dIcTJUfaGPl
	TaeDweag+QRssu/Dh37lDA/UkDOMQfZHVdzJ3KZKXTEeIqiCMpjJ/hljjMXgCTbMQcOk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/store: use single_with_domid() in xs_get_domain_path()
Message-Id: <E1traRm-001LC3-11@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 10:33:22 +0000

commit 9495e6577a69bb3783bc72860927d0538f07bc7c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Mar 10 09:52:54 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 10 09:52:54 2025 +0100

    tools/libs/store: use single_with_domid() in xs_get_domain_path()
    
    xs_get_domain_path() can be simplified by using single_with_domid().
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/store/xs.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c
index e22f99b59f..cf3266807f 100644
--- a/tools/libs/store/xs.c
+++ b/tools/libs/store/xs.c
@@ -1345,11 +1345,7 @@ bool xs_resume_domain(struct xs_handle *h, unsigned int domid)
 
 char *xs_get_domain_path(struct xs_handle *h, unsigned int domid)
 {
-	char domid_str[MAX_STRLEN(domid)];
-
-	snprintf(domid_str, sizeof(domid_str), "%u", domid);
-
-	return xs_single(h, XBT_NULL, XS_GET_DOMAIN_PATH, domid_str, NULL);
+	return single_with_domid(h, XS_GET_DOMAIN_PATH, domid);
 }
 
 bool xs_path_is_subpath(const char *parent, const char *child)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 10:33:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 10:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906391.1313833 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1traRy-0000Tp-09; Mon, 10 Mar 2025 10:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906391.1313833; Mon, 10 Mar 2025 10:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1traRx-0000Th-TU; Mon, 10 Mar 2025 10:33:33 +0000
Received: by outflank-mailman (input) for mailman id 906391;
 Mon, 10 Mar 2025 10:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1traRw-0000TN-GB
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 10:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1traRw-00CcT3-2G
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 10:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1traRw-001LCo-1O
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 10:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FMMP065QsbaDE4zeWs1M2FMNVuK3BiaWgK0OC91GvkA=; b=ypV9fcuzmfZORF9kD05wY8x+3e
	1CtnMp/uLCVsA0yXaF8TZEjza0NOTWwnYMnoxrBT1xj7jzHZ8Ihg5bVtESr7bhb0ZNB1t/CmgCrF6
	RMW9i1ruqZORwaeEwao+LKy/IDYop3g05czzANtbcRoYQmstrX8KjNfmnNGtBN4J19xE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/consoled: clean up console handling for PV shim
Message-Id: <E1traRw-001LCo-1O@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 10:33:32 +0000

commit f147ccf2b3c8a9f32e0fb2f32255ff96c3caf43c
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Mon Mar 10 09:53:11 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 10 09:53:11 2025 +0100

    xen/consoled: clean up console handling for PV shim
    
    There are few places which check pv_shim console under CONFIG_PV_SHIM or
    CONFIG_X86 in xen console driver.
    
    Instead of inconsistent #ifdef-ing, introduce and use consoled_is_enabled() in
    switch_serial_input() and __serial_rx().
    
    PV shim case is fixed in __serial_rx() - should be under 'pv_shim &&
    pv_console' check.
    
    Signature of consoled_guest_{rx,tx} has changed so the errors can be logged
    on the callsites.
    
    Also, move get_initial_domain_id() to arch-independent header since it is now
    required by console driver.
    
    Lastly, add missing SPDX-License-Identifier to xen/consoled.h
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/pv/shim.h |  5 +++--
 xen/arch/x86/pv/shim.c             |  8 ++------
 xen/common/domain.c                |  9 +++++++++
 xen/drivers/char/console.c         | 15 ++++++---------
 xen/drivers/char/consoled.c        | 17 +++++++++++++----
 xen/include/xen/consoled.h         | 15 +++++++++++++--
 xen/include/xen/domain.h           |  2 ++
 7 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/include/asm/pv/shim.h b/xen/arch/x86/include/asm/pv/shim.h
index 6153e27005..27053d4f6f 100644
--- a/xen/arch/x86/include/asm/pv/shim.h
+++ b/xen/arch/x86/include/asm/pv/shim.h
@@ -31,7 +31,7 @@ long cf_check pv_shim_cpu_up(void *data);
 long cf_check pv_shim_cpu_down(void *data);
 void pv_shim_online_memory(unsigned int nr, unsigned int order);
 void pv_shim_offline_memory(unsigned int nr, unsigned int order);
-domid_t get_initial_domain_id(void);
+domid_t pv_shim_get_initial_domain_id(void);
 uint64_t pv_shim_mem(uint64_t avail);
 void pv_shim_fixup_e820(void);
 const struct platform_bad_page *pv_shim_reserved_pages(unsigned int *size);
@@ -76,8 +76,9 @@ static inline void pv_shim_offline_memory(unsigned int nr, unsigned int order)
 {
     ASSERT_UNREACHABLE();
 }
-static inline domid_t get_initial_domain_id(void)
+static inline domid_t pv_shim_get_initial_domain_id(void)
 {
+    ASSERT_UNREACHABLE();
     return 0;
 }
 static inline uint64_t pv_shim_mem(uint64_t avail)
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 81e4a0516d..c506cc0bec 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -603,8 +603,7 @@ long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
         if ( pv_console && send.port == pv_console_evtchn() )
         {
-            consoled_guest_rx();
-            rc = 0;
+            rc = consoled_guest_rx();
         }
         else
             rc = xen_hypercall_event_channel_op(EVTCHNOP_send, &send);
@@ -1016,13 +1015,10 @@ void pv_shim_offline_memory(unsigned int nr, unsigned int order)
     }
 }
 
-domid_t get_initial_domain_id(void)
+domid_t pv_shim_get_initial_domain_id(void)
 {
     uint32_t eax, ebx, ecx, edx;
 
-    if ( !pv_shim )
-        return 0;
-
     cpuid(xen_cpuid_base + 4, &eax, &ebx, &ecx, &edx);
 
     return (eax & XEN_HVM_CPUID_DOMID_PRESENT) ? ecx : 1;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index b887c60ecc..fd98534c88 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -2384,6 +2384,15 @@ int continue_hypercall_on_cpu(
     return 0;
 }
 
+domid_t get_initial_domain_id(void)
+{
+#ifdef CONFIG_X86
+    if ( pv_shim )
+        return pv_shim_get_initial_domain_id();
+#endif
+    return hardware_domid;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 2f028c5d44..ba428199d2 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -32,9 +32,9 @@
 #include <xen/pv_console.h>
 #include <asm/setup.h>
 #include <xen/sections.h>
+#include <xen/consoled.h>
 
 #ifdef CONFIG_X86
-#include <xen/consoled.h>
 #include <asm/guest.h>
 #endif
 #ifdef CONFIG_SBSA_VUART_CONSOLE
@@ -507,11 +507,9 @@ static void switch_serial_input(void)
             break;
         }
 
-#ifdef CONFIG_PV_SHIM
-        if ( next_rx == 1 )
+        if ( consoled_is_enabled() && next_rx == 1 )
             domid = get_initial_domain_id();
         else
-#endif
             domid = next_rx - 1;
         d = rcu_lock_domain_by_id(domid);
         if ( d )
@@ -562,16 +560,15 @@ static void __serial_rx(char c)
         rc = vpl011_rx_char_xen(d, c);
 #endif
 
+    if ( consoled_is_enabled() )
+        /* Deliver input to the PV shim console. */
+        rc = consoled_guest_tx(c);
+
     if ( rc )
         guest_printk(d,
                      XENLOG_WARNING "failed to process console input: %d\n",
                      rc);
 
-#ifdef CONFIG_X86
-    if ( pv_shim && pv_console )
-        consoled_guest_tx(c);
-#endif
-
     console_put_domain(d);
 }
 
diff --git a/xen/drivers/char/consoled.c b/xen/drivers/char/consoled.c
index b415b632ce..8704ec251e 100644
--- a/xen/drivers/char/consoled.c
+++ b/xen/drivers/char/consoled.c
@@ -43,13 +43,13 @@ struct xencons_interface *consoled_get_ring_addr(void)
 static char buf[BUF_SZ + 1];
 
 /* Receives characters from a domain's PV console */
-void consoled_guest_rx(void)
+int consoled_guest_rx(void)
 {
     size_t idx = 0;
     XENCONS_RING_IDX cons, prod;
 
     if ( !cons_ring )
-        return;
+        return -ENODEV;
 
     spin_lock(&rx_lock);
 
@@ -91,15 +91,17 @@ void consoled_guest_rx(void)
 
  out:
     spin_unlock(&rx_lock);
+
+    return 0;
 }
 
 /* Sends a character into a domain's PV console */
-void consoled_guest_tx(char c)
+int consoled_guest_tx(char c)
 {
     XENCONS_RING_IDX cons, prod;
 
     if ( !cons_ring )
-        return;
+        return -ENODEV;
 
     cons = ACCESS_ONCE(cons_ring->in_cons);
     prod = cons_ring->in_prod;
@@ -125,6 +127,13 @@ void consoled_guest_tx(char c)
  notify:
     /* Always notify the guest: prevents receive path from getting stuck. */
     pv_shim_inject_evtchn(pv_console_evtchn());
+
+    return 0;
+}
+
+bool consoled_is_enabled(void)
+{
+    return pv_shim && pv_console;
 }
 
 /*
diff --git a/xen/include/xen/consoled.h b/xen/include/xen/consoled.h
index bd7ab6329e..7bebc6bf5c 100644
--- a/xen/include/xen/consoled.h
+++ b/xen/include/xen/consoled.h
@@ -1,12 +1,23 @@
 #ifndef __XEN_CONSOLED_H__
 #define __XEN_CONSOLED_H__
 
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <public/io/console.h>
 
 void consoled_set_ring_addr(struct xencons_interface *ring);
 struct xencons_interface *consoled_get_ring_addr(void);
-void consoled_guest_rx(void);
-void consoled_guest_tx(char c);
+int consoled_guest_rx(void);
+int consoled_guest_tx(char c);
+
+#ifdef CONFIG_PV_SHIM
+
+bool consoled_is_enabled(void);
+
+#else
+
+#define consoled_is_enabled()   (false)
+
+#endif /* CONFIG_PV_SHIM */
 
 #endif /* __XEN_CONSOLED_H__ */
 /*
diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
index 3de5635291..83069de501 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -35,6 +35,8 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info);
 void arch_get_domain_info(const struct domain *d,
                           struct xen_domctl_getdomaininfo *info);
 
+domid_t get_initial_domain_id(void);
+
 /* CDF_* constant. Internal flags for domain creation. */
 /* Is this a privileged domain? */
 #define CDF_privileged           (1U << 0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 10:33:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 10:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906393.1313847 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1traS7-0000k4-7r; Mon, 10 Mar 2025 10:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906393.1313847; Mon, 10 Mar 2025 10:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1traS7-0000jx-5D; Mon, 10 Mar 2025 10:33:43 +0000
Received: by outflank-mailman (input) for mailman id 906393;
 Mon, 10 Mar 2025 10:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1traS6-0000gX-Iy
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 10:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1traS6-00CcTL-2Y
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 10:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1traS6-001LDW-1h
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 10:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JNAccefGiHVCtIfQ88WxBQXefL6y/xMr4hKgWi4oI5Y=; b=UIqNPQuXArDdEj/TLFO1FJ7kHf
	s7XEu3ivtwAX5VUruy9LOVBVSJsrKqa2V6nnHJHVAOGgHMc+1OULhY0+GEBTIDAkvq07SsAFHHEQt
	qCrjcJFh+e89SzjjkaOyG3kUl079+WbXYfWcnR+nS+Kin0ylwHb0RErL94qTIuo/7/7U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Factor out construct_hwdom()
Message-Id: <E1traS6-001LDW-1h@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 10:33:42 +0000

commit 659da11304665eed38a5d02ee80ed0881cb3eb9b
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Mon Mar 10 09:53:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 10 09:53:51 2025 +0100

    xen/arm: Factor out construct_hwdom()
    
    Factor out construct_hwdom() from construct_dom0().  This will be
    re-used by the dom0less code when building a domain with the hardware
    capability.
    
    iommu_hwdom_init(d) is moved into construct_hwdom() which moves it after
    kernel_probe().  kernel_probe() doesn't seem to depend on its setting.
    
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/domain_build.c             | 28 ++++++++++++++++++----------
 xen/arch/arm/include/asm/domain_build.h |  1 +
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index d4570bc0b4..7cc141ef75 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2296,8 +2296,6 @@ static int __init construct_dom0(struct domain *d)
         dom0_mem = MB(512);
     }
 
-    iommu_hwdom_init(d);
-
     d->max_pages = dom0_mem >> PAGE_SHIFT;
 
     kinfo.unassigned_mem = dom0_mem;
@@ -2307,17 +2305,27 @@ static int __init construct_dom0(struct domain *d)
     if ( rc < 0 )
         return rc;
 
+    return construct_hwdom(&kinfo);
+}
+
+int __init construct_hwdom(struct kernel_info *kinfo)
+{
+    struct domain *d = kinfo->d;
+    int rc;
+
+    iommu_hwdom_init(d);
+
 #ifdef CONFIG_ARM_64
     /* type must be set before allocate_memory */
-    d->arch.type = kinfo.type;
+    d->arch.type = kinfo->type;
 #endif
-    find_gnttab_region(d, &kinfo);
+    find_gnttab_region(d, kinfo);
     if ( is_domain_direct_mapped(d) )
-        allocate_memory_11(d, &kinfo);
+        allocate_memory_11(d, kinfo);
     else
-        allocate_memory(d, &kinfo);
+        allocate_memory(d, kinfo);
 
-    rc = process_shm_chosen(d, &kinfo);
+    rc = process_shm_chosen(d, kinfo);
     if ( rc < 0 )
         return rc;
 
@@ -2332,7 +2340,7 @@ static int __init construct_dom0(struct domain *d)
 
     if ( acpi_disabled )
     {
-        rc = prepare_dtb_hwdom(d, &kinfo);
+        rc = prepare_dtb_hwdom(d, kinfo);
         if ( rc < 0 )
             return rc;
 #ifdef CONFIG_HAS_PCI
@@ -2340,12 +2348,12 @@ static int __init construct_dom0(struct domain *d)
 #endif
     }
     else
-        rc = prepare_acpi(d, &kinfo);
+        rc = prepare_acpi(d, kinfo);
 
     if ( rc < 0 )
         return rc;
 
-    return construct_domain(d, &kinfo);
+    return construct_domain(d, kinfo);
 }
 
 void __init create_dom0(void)
diff --git a/xen/arch/arm/include/asm/domain_build.h b/xen/arch/arm/include/asm/domain_build.h
index 5d77af2e8b..134290853c 100644
--- a/xen/arch/arm/include/asm/domain_build.h
+++ b/xen/arch/arm/include/asm/domain_build.h
@@ -13,6 +13,7 @@ bool allocate_bank_memory(struct kernel_info *kinfo, gfn_t sgfn,
                           paddr_t tot_size);
 void allocate_memory(struct domain *d, struct kernel_info *kinfo);
 int construct_domain(struct domain *d, struct kernel_info *kinfo);
+int construct_hwdom(struct kernel_info *kinfo);
 int domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit);
 int make_chosen_node(const struct kernel_info *kinfo);
 int make_cpus_node(const struct domain *d, void *fdt);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 14:00:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 14:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906482.1313901 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trdfn-0006Pj-Et; Mon, 10 Mar 2025 14:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906482.1313901; Mon, 10 Mar 2025 14:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trdfn-0006PA-Bh; Mon, 10 Mar 2025 14:00:03 +0000
Received: by outflank-mailman (input) for mailman id 906482;
 Mon, 10 Mar 2025 14:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trdfm-00069q-EW
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 14:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trdfm-00CgWQ-1O
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 14:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trdfm-001gOy-0R
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 14:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kjUiDbAYTQSu+Q/HXqE2VOK88S8AMLGlf5IK8x+y52k=; b=AxjVepiVciGW5/1Cem6qWMr/jE
	8sHESXzLqU5G9roX6VgxYlVNy5E7CUk90I4JOOM8MMKeJk5lQZJVJyHFzo3IIZhyrw0IHMyuSgIHn
	B87smYJNdriHQJ6BN9VteInXHnkJpqltb+DZ0YFEIPK2UEXZztIqq7WYDySZgRBBoWkU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] vpci: Add resizable bar support
Message-Id: <E1trdfm-001gOy-0R@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 14:00:02 +0000

commit 6ce1066599eca6542abc248976b225e9da5f11f3
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Feb 24 11:24:33 2025 +0800
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 10 10:38:29 2025 +0100

    vpci: Add resizable bar support
    
    Some devices, like AMDGPU, support resizable bar capability,
    but vpci of Xen doesn't support this feature, so they fail
    to resize bars and then cause probing failure.
    
    According to PCIe spec, each bar that supports resizing has
    two registers, PCI_REBAR_CAP and PCI_REBAR_CTRL. So, add
    handlers to support resizing the size of BARs.
    
    Note that Xen will only trap PCI_REBAR_CTRL, as PCI_REBAR_CAP
    is read-only register and the hardware domain already gets
    access to it without needing any setup.
    
    Link: https://gitlab.com/xen-project/xen/-/issues/87
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@cirtrix.com>
    Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md               |   1 +
 SUPPORT.md                 |   2 +-
 xen/drivers/vpci/Makefile  |   2 +-
 xen/drivers/vpci/rebar.c   | 131 +++++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/pci_regs.h |  14 +++++
 xen/include/xen/vpci.h     |   1 +
 6 files changed, 149 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e99c5a5515..7201c484f8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added
  - On x86:
    - Option to attempt to fixup p2m page-faults on PVH dom0.
+   - Resizable BARs is supported for PVH dom0.
 
 ### Removed
 
diff --git a/SUPPORT.md b/SUPPORT.md
index e1f4769bd8..91cb6f8ed2 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -170,7 +170,7 @@ unexpected behavior or issues on some hardware.
 
 At least the following features are missing on a PVH dom0:
 
-  * PCI SR-IOV and Resizable BARs.
+  * PCI SR-IOV.
 
   * Native NMI forwarding (nmi=dom0 command line option).
 
diff --git a/xen/drivers/vpci/Makefile b/xen/drivers/vpci/Makefile
index 1a1413b93e..a7c8a30a89 100644
--- a/xen/drivers/vpci/Makefile
+++ b/xen/drivers/vpci/Makefile
@@ -1,2 +1,2 @@
-obj-y += vpci.o header.o
+obj-y += vpci.o header.o rebar.o
 obj-$(CONFIG_HAS_PCI_MSI) += msi.o msix.o
diff --git a/xen/drivers/vpci/rebar.c b/xen/drivers/vpci/rebar.c
new file mode 100644
index 0000000000..793937449a
--- /dev/null
+++ b/xen/drivers/vpci/rebar.c
@@ -0,0 +1,131 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2025 Advanced Micro Devices, Inc. All Rights Reserved.
+ *
+ * Author: Jiqian Chen <Jiqian.Chen@amd.com>
+ */
+
+#include <xen/sched.h>
+#include <xen/vpci.h>
+
+static void cf_check rebar_ctrl_write(const struct pci_dev *pdev,
+                                      unsigned int reg,
+                                      uint32_t val,
+                                      void *data)
+{
+    struct vpci_bar *bar = data;
+    const unsigned int index = bar - pdev->vpci->header.bars;
+    const uint64_t size = PCI_REBAR_CTRL_SIZE(val);
+
+    if ( bar->enabled )
+    {
+        /*
+         * Refuse to resize a BAR while memory decoding is enabled, as
+         * otherwise the size of the mapped region in the p2m would become
+         * stale with the newly set BAR size, and the position of the BAR
+         * would be reset to undefined.  Note the PCIe specification also
+         * forbids resizing a BAR with memory decoding enabled.
+         */
+        if ( size != bar->size )
+            gprintk(XENLOG_ERR,
+                    "%pp: refuse to resize BAR#%u with memory decoding enabled\n",
+                    &pdev->sbdf, index);
+        return;
+    }
+
+    if ( !((size >> PCI_REBAR_CTRL_SIZE_BIAS) & bar->resizable_sizes) )
+        gprintk(XENLOG_WARNING,
+                "%pp: new BAR#%u size %#lx is not supported by hardware\n",
+                &pdev->sbdf, index, size);
+
+    pci_conf_write32(pdev->sbdf, reg, val);
+
+    pci_size_mem_bar(pdev->sbdf,
+                     PCI_BASE_ADDRESS_0 + index * 4,
+                     &bar->addr,
+                     &bar->size,
+                     (index == PCI_HEADER_NORMAL_NR_BARS - 1) ?
+                      PCI_BAR_LAST : 0);
+    bar->guest_addr = bar->addr;
+}
+
+static int cf_check init_rebar(struct pci_dev *pdev)
+{
+    uint32_t ctrl;
+    unsigned int nbars;
+    unsigned int rebar_offset = pci_find_ext_capability(pdev->sbdf,
+                                                        PCI_EXT_CAP_ID_REBAR);
+
+    if ( !rebar_offset )
+        return 0;
+
+    if ( !is_hardware_domain(pdev->domain) )
+    {
+        printk(XENLOG_ERR "%pp: resizable BARs unsupported for unpriv %pd\n",
+               &pdev->sbdf, pdev->domain);
+        return -EOPNOTSUPP;
+    }
+
+    ctrl = pci_conf_read32(pdev->sbdf, rebar_offset + PCI_REBAR_CTRL(0));
+    nbars = MASK_EXTR(ctrl, PCI_REBAR_CTRL_NBAR_MASK);
+    for ( unsigned int i = 0; i < nbars; i++ )
+    {
+        int rc;
+        struct vpci_bar *bar;
+        unsigned int index;
+
+        ctrl = pci_conf_read32(pdev->sbdf, rebar_offset + PCI_REBAR_CTRL(i));
+        index = ctrl & PCI_REBAR_CTRL_BAR_IDX;
+        if ( index >= PCI_HEADER_NORMAL_NR_BARS )
+        {
+            printk(XENLOG_ERR "%pd %pp: too big BAR number %u in REBAR_CTRL\n",
+                   pdev->domain, &pdev->sbdf, index);
+            continue;
+        }
+
+        bar = &pdev->vpci->header.bars[index];
+        if ( bar->type != VPCI_BAR_MEM64_LO && bar->type != VPCI_BAR_MEM32 )
+        {
+            printk(XENLOG_ERR "%pd %pp: BAR%u is not in memory space\n",
+                   pdev->domain, &pdev->sbdf, index);
+            continue;
+        }
+
+        rc = vpci_add_register(pdev->vpci, vpci_hw_read32, rebar_ctrl_write,
+                               rebar_offset + PCI_REBAR_CTRL(i), 4, bar);
+        if ( rc )
+        {
+            printk(XENLOG_ERR "%pd %pp: BAR%u fail to add reg of REBAR_CTRL rc=%d\n",
+                   pdev->domain, &pdev->sbdf, index, rc);
+            /*
+             * Ideally we would hide the ReBar capability on error, but code
+             * for doing so still needs to be written. Use continue instead
+             * to keep any already setup register hooks, as returning an
+             * error will cause the hardware domain to get unmediated access
+             * to all device registers.
+             */
+            continue;
+        }
+
+        bar->resizable_sizes =
+            MASK_EXTR(pci_conf_read32(pdev->sbdf,
+                                      rebar_offset + PCI_REBAR_CAP(i)),
+                      PCI_REBAR_CAP_SIZES_MASK);
+        bar->resizable_sizes |=
+            (((uint64_t)MASK_EXTR(ctrl, PCI_REBAR_CTRL_SIZES_MASK) << 32) /
+             ISOLATE_LSB(PCI_REBAR_CAP_SIZES_MASK));
+    }
+
+    return 0;
+}
+REGISTER_VPCI_INIT(init_rebar, VPCI_PRIORITY_LOW);
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/xen/pci_regs.h b/xen/include/xen/pci_regs.h
index 250ba106db..27b4f44eed 100644
--- a/xen/include/xen/pci_regs.h
+++ b/xen/include/xen/pci_regs.h
@@ -459,6 +459,7 @@
 #define PCI_EXT_CAP_ID_ARI	14
 #define PCI_EXT_CAP_ID_ATS	15
 #define PCI_EXT_CAP_ID_SRIOV	16
+#define PCI_EXT_CAP_ID_REBAR	21	/* Resizable BAR */
 
 /* Advanced Error Reporting */
 #define PCI_ERR_UNCOR_STATUS	4	/* Uncorrectable Error Status */
@@ -541,6 +542,19 @@
 #define  PCI_VNDR_HEADER_REV(x)	(((x) >> 16) & 0xf)
 #define  PCI_VNDR_HEADER_LEN(x)	(((x) >> 20) & 0xfff)
 
+/* Resizable BARs */
+#define PCI_REBAR_CAP(n)	(4 + 8 * (n))	/* capability register */
+#define  PCI_REBAR_CAP_SIZES_MASK	0xFFFFFFF0U	/* supported BAR sizes in CAP */
+#define PCI_REBAR_CTRL(n)	(8 + 8 * (n))	/* control register */
+#define  PCI_REBAR_CTRL_BAR_IDX		0x00000007	/* BAR index */
+#define  PCI_REBAR_CTRL_NBAR_MASK	0x000000E0	/* # of resizable BARs */
+#define  PCI_REBAR_CTRL_BAR_SIZE	0x00003F00	/* BAR size */
+#define  PCI_REBAR_CTRL_SIZES_MASK	0xFFFF0000U	/* supported BAR sizes in CTRL */
+
+#define PCI_REBAR_CTRL_SIZE_BIAS	20
+#define PCI_REBAR_CTRL_SIZE(v) \
+    (1ULL << (MASK_EXTR(v, PCI_REBAR_CTRL_BAR_SIZE) + PCI_REBAR_CTRL_SIZE_BIAS))
+
 /*
  * Hypertransport sub capability types
  *
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 41e7c3bc27..807401b2ea 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -100,6 +100,7 @@ struct vpci {
             /* Guest address. */
             uint64_t guest_addr;
             uint64_t size;
+            uint64_t resizable_sizes;
             struct rangeset *mem;
             enum {
                 VPCI_BAR_EMPTY,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 15:11:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 15:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906613.1314034 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tremV-0001Vs-K0; Mon, 10 Mar 2025 15:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906613.1314034; Mon, 10 Mar 2025 15:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tremV-0001Vk-HA; Mon, 10 Mar 2025 15:11:03 +0000
Received: by outflank-mailman (input) for mailman id 906613;
 Mon, 10 Mar 2025 15:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tremU-0001VX-DY
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 15:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tremU-00Chwh-1e
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 15:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tremU-001nbi-0m
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 15:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JMqClQAv8jwXwP7DNC7mX3UCFInPUBZJaqYGdMPQuBk=; b=G/XVG8Y90bEXEM6+kfKa2z5gev
	mz9yLDR3/NnwJ2fl20NRTr40uPupJQNEjC9yfOyfu39G+M/bKznN0wKGzRHMiEBWbMnnkbs7WdrvV
	ZxpspgJF7jHVReVxKsQLQkGKbCRsoE4eXeuclgfhPjus8jxYCetKPZ4zLjT8abBHOihE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] vpci: Add resizable bar support
Message-Id: <E1tremU-001nbi-0m@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 15:11:02 +0000

commit 6ce1066599eca6542abc248976b225e9da5f11f3
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Feb 24 11:24:33 2025 +0800
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 10 10:38:29 2025 +0100

    vpci: Add resizable bar support
    
    Some devices, like AMDGPU, support resizable bar capability,
    but vpci of Xen doesn't support this feature, so they fail
    to resize bars and then cause probing failure.
    
    According to PCIe spec, each bar that supports resizing has
    two registers, PCI_REBAR_CAP and PCI_REBAR_CTRL. So, add
    handlers to support resizing the size of BARs.
    
    Note that Xen will only trap PCI_REBAR_CTRL, as PCI_REBAR_CAP
    is read-only register and the hardware domain already gets
    access to it without needing any setup.
    
    Link: https://gitlab.com/xen-project/xen/-/issues/87
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@cirtrix.com>
    Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md               |   1 +
 SUPPORT.md                 |   2 +-
 xen/drivers/vpci/Makefile  |   2 +-
 xen/drivers/vpci/rebar.c   | 131 +++++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/pci_regs.h |  14 +++++
 xen/include/xen/vpci.h     |   1 +
 6 files changed, 149 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e99c5a5515..7201c484f8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added
  - On x86:
    - Option to attempt to fixup p2m page-faults on PVH dom0.
+   - Resizable BARs is supported for PVH dom0.
 
 ### Removed
 
diff --git a/SUPPORT.md b/SUPPORT.md
index e1f4769bd8..91cb6f8ed2 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -170,7 +170,7 @@ unexpected behavior or issues on some hardware.
 
 At least the following features are missing on a PVH dom0:
 
-  * PCI SR-IOV and Resizable BARs.
+  * PCI SR-IOV.
 
   * Native NMI forwarding (nmi=dom0 command line option).
 
diff --git a/xen/drivers/vpci/Makefile b/xen/drivers/vpci/Makefile
index 1a1413b93e..a7c8a30a89 100644
--- a/xen/drivers/vpci/Makefile
+++ b/xen/drivers/vpci/Makefile
@@ -1,2 +1,2 @@
-obj-y += vpci.o header.o
+obj-y += vpci.o header.o rebar.o
 obj-$(CONFIG_HAS_PCI_MSI) += msi.o msix.o
diff --git a/xen/drivers/vpci/rebar.c b/xen/drivers/vpci/rebar.c
new file mode 100644
index 0000000000..793937449a
--- /dev/null
+++ b/xen/drivers/vpci/rebar.c
@@ -0,0 +1,131 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2025 Advanced Micro Devices, Inc. All Rights Reserved.
+ *
+ * Author: Jiqian Chen <Jiqian.Chen@amd.com>
+ */
+
+#include <xen/sched.h>
+#include <xen/vpci.h>
+
+static void cf_check rebar_ctrl_write(const struct pci_dev *pdev,
+                                      unsigned int reg,
+                                      uint32_t val,
+                                      void *data)
+{
+    struct vpci_bar *bar = data;
+    const unsigned int index = bar - pdev->vpci->header.bars;
+    const uint64_t size = PCI_REBAR_CTRL_SIZE(val);
+
+    if ( bar->enabled )
+    {
+        /*
+         * Refuse to resize a BAR while memory decoding is enabled, as
+         * otherwise the size of the mapped region in the p2m would become
+         * stale with the newly set BAR size, and the position of the BAR
+         * would be reset to undefined.  Note the PCIe specification also
+         * forbids resizing a BAR with memory decoding enabled.
+         */
+        if ( size != bar->size )
+            gprintk(XENLOG_ERR,
+                    "%pp: refuse to resize BAR#%u with memory decoding enabled\n",
+                    &pdev->sbdf, index);
+        return;
+    }
+
+    if ( !((size >> PCI_REBAR_CTRL_SIZE_BIAS) & bar->resizable_sizes) )
+        gprintk(XENLOG_WARNING,
+                "%pp: new BAR#%u size %#lx is not supported by hardware\n",
+                &pdev->sbdf, index, size);
+
+    pci_conf_write32(pdev->sbdf, reg, val);
+
+    pci_size_mem_bar(pdev->sbdf,
+                     PCI_BASE_ADDRESS_0 + index * 4,
+                     &bar->addr,
+                     &bar->size,
+                     (index == PCI_HEADER_NORMAL_NR_BARS - 1) ?
+                      PCI_BAR_LAST : 0);
+    bar->guest_addr = bar->addr;
+}
+
+static int cf_check init_rebar(struct pci_dev *pdev)
+{
+    uint32_t ctrl;
+    unsigned int nbars;
+    unsigned int rebar_offset = pci_find_ext_capability(pdev->sbdf,
+                                                        PCI_EXT_CAP_ID_REBAR);
+
+    if ( !rebar_offset )
+        return 0;
+
+    if ( !is_hardware_domain(pdev->domain) )
+    {
+        printk(XENLOG_ERR "%pp: resizable BARs unsupported for unpriv %pd\n",
+               &pdev->sbdf, pdev->domain);
+        return -EOPNOTSUPP;
+    }
+
+    ctrl = pci_conf_read32(pdev->sbdf, rebar_offset + PCI_REBAR_CTRL(0));
+    nbars = MASK_EXTR(ctrl, PCI_REBAR_CTRL_NBAR_MASK);
+    for ( unsigned int i = 0; i < nbars; i++ )
+    {
+        int rc;
+        struct vpci_bar *bar;
+        unsigned int index;
+
+        ctrl = pci_conf_read32(pdev->sbdf, rebar_offset + PCI_REBAR_CTRL(i));
+        index = ctrl & PCI_REBAR_CTRL_BAR_IDX;
+        if ( index >= PCI_HEADER_NORMAL_NR_BARS )
+        {
+            printk(XENLOG_ERR "%pd %pp: too big BAR number %u in REBAR_CTRL\n",
+                   pdev->domain, &pdev->sbdf, index);
+            continue;
+        }
+
+        bar = &pdev->vpci->header.bars[index];
+        if ( bar->type != VPCI_BAR_MEM64_LO && bar->type != VPCI_BAR_MEM32 )
+        {
+            printk(XENLOG_ERR "%pd %pp: BAR%u is not in memory space\n",
+                   pdev->domain, &pdev->sbdf, index);
+            continue;
+        }
+
+        rc = vpci_add_register(pdev->vpci, vpci_hw_read32, rebar_ctrl_write,
+                               rebar_offset + PCI_REBAR_CTRL(i), 4, bar);
+        if ( rc )
+        {
+            printk(XENLOG_ERR "%pd %pp: BAR%u fail to add reg of REBAR_CTRL rc=%d\n",
+                   pdev->domain, &pdev->sbdf, index, rc);
+            /*
+             * Ideally we would hide the ReBar capability on error, but code
+             * for doing so still needs to be written. Use continue instead
+             * to keep any already setup register hooks, as returning an
+             * error will cause the hardware domain to get unmediated access
+             * to all device registers.
+             */
+            continue;
+        }
+
+        bar->resizable_sizes =
+            MASK_EXTR(pci_conf_read32(pdev->sbdf,
+                                      rebar_offset + PCI_REBAR_CAP(i)),
+                      PCI_REBAR_CAP_SIZES_MASK);
+        bar->resizable_sizes |=
+            (((uint64_t)MASK_EXTR(ctrl, PCI_REBAR_CTRL_SIZES_MASK) << 32) /
+             ISOLATE_LSB(PCI_REBAR_CAP_SIZES_MASK));
+    }
+
+    return 0;
+}
+REGISTER_VPCI_INIT(init_rebar, VPCI_PRIORITY_LOW);
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/xen/pci_regs.h b/xen/include/xen/pci_regs.h
index 250ba106db..27b4f44eed 100644
--- a/xen/include/xen/pci_regs.h
+++ b/xen/include/xen/pci_regs.h
@@ -459,6 +459,7 @@
 #define PCI_EXT_CAP_ID_ARI	14
 #define PCI_EXT_CAP_ID_ATS	15
 #define PCI_EXT_CAP_ID_SRIOV	16
+#define PCI_EXT_CAP_ID_REBAR	21	/* Resizable BAR */
 
 /* Advanced Error Reporting */
 #define PCI_ERR_UNCOR_STATUS	4	/* Uncorrectable Error Status */
@@ -541,6 +542,19 @@
 #define  PCI_VNDR_HEADER_REV(x)	(((x) >> 16) & 0xf)
 #define  PCI_VNDR_HEADER_LEN(x)	(((x) >> 20) & 0xfff)
 
+/* Resizable BARs */
+#define PCI_REBAR_CAP(n)	(4 + 8 * (n))	/* capability register */
+#define  PCI_REBAR_CAP_SIZES_MASK	0xFFFFFFF0U	/* supported BAR sizes in CAP */
+#define PCI_REBAR_CTRL(n)	(8 + 8 * (n))	/* control register */
+#define  PCI_REBAR_CTRL_BAR_IDX		0x00000007	/* BAR index */
+#define  PCI_REBAR_CTRL_NBAR_MASK	0x000000E0	/* # of resizable BARs */
+#define  PCI_REBAR_CTRL_BAR_SIZE	0x00003F00	/* BAR size */
+#define  PCI_REBAR_CTRL_SIZES_MASK	0xFFFF0000U	/* supported BAR sizes in CTRL */
+
+#define PCI_REBAR_CTRL_SIZE_BIAS	20
+#define PCI_REBAR_CTRL_SIZE(v) \
+    (1ULL << (MASK_EXTR(v, PCI_REBAR_CTRL_BAR_SIZE) + PCI_REBAR_CTRL_SIZE_BIAS))
+
 /*
  * Hypertransport sub capability types
  *
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 41e7c3bc27..807401b2ea 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -100,6 +100,7 @@ struct vpci {
             /* Guest address. */
             uint64_t guest_addr;
             uint64_t size;
+            uint64_t resizable_sizes;
             struct rangeset *mem;
             enum {
                 VPCI_BAR_EMPTY,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 17:22:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 17:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906741.1314109 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trgpH-00051p-0c; Mon, 10 Mar 2025 17:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906741.1314109; Mon, 10 Mar 2025 17:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trgpG-00051h-UD; Mon, 10 Mar 2025 17:22:02 +0000
Received: by outflank-mailman (input) for mailman id 906741;
 Mon, 10 Mar 2025 17:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trgpG-00051b-5G
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 17:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trgpG-00Cl8T-0T
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 17:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trgpF-0025BC-2k
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 17:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ghyHNFeEFgLG/9Jtajhl0Py8Ur/vp52gNUCTOuEG9as=; b=S5JWtE4zSkcnGtarj92VGs7eGF
	34nd8Bk/e3st/WTkV5T5nKe5n/8yymO0Ce0P7muCcgJa+tfzLZkoUiSQYM0FySeI/q2M0HVMRonYR
	is4HyGD1Z8N4YXoGk9KefD6ow0ibXeydJhibIr46aOLkksX81TatXautkLa7IMLKe63g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs: Make uselibs.mk more legible
Message-Id: <E1trgpF-0025BC-2k@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 17:22:01 +0000

commit 6ca6d8c8050f368d97279f342aac7ecc67e0dc05
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 8 23:31:11 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 10 15:05:09 2025 +0000

    tools/libs: Make uselibs.mk more legible
    
    A few blank lines go a very long way.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/uselibs.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/libs/uselibs.mk b/tools/libs/uselibs.mk
index c0a234cfec..3c88e78c10 100644
--- a/tools/libs/uselibs.mk
+++ b/tools/libs/uselibs.mk
@@ -2,34 +2,49 @@
 
 LIBS_LIBS += toolcore
 USELIBS_toolcore :=
+
 LIBS_LIBS += toollog
 USELIBS_toollog :=
+
 LIBS_LIBS += evtchn
 USELIBS_evtchn := toollog toolcore
+
 LIBS_LIBS += gnttab
 USELIBS_gnttab := toollog toolcore
+
 LIBS_LIBS += call
 USELIBS_call := toollog toolcore
+
 LIBS_LIBS += foreignmemory
 USELIBS_foreignmemory := toollog toolcore
+
 LIBS_LIBS += devicemodel
 USELIBS_devicemodel := toollog toolcore call
+
 LIBS_LIBS += hypfs
 USELIBS_hypfs := toollog toolcore call
+
 LIBS_LIBS += manage
 USELIBS_manage := toollog toolcore call
+
 LIBS_LIBS += ctrl
 USELIBS_ctrl := toollog call evtchn gnttab foreignmemory devicemodel
+
 LIBS_LIBS += guest
 USELIBS_guest := evtchn ctrl
+
 LIBS_LIBS += store
 USELIBS_store := toolcore
+
 LIBS_LIBS += vchan
 USELIBS_vchan := toollog store gnttab evtchn
+
 LIBS_LIBS += stat
 USELIBS_stat := ctrl store
+
 LIBS_LIBS += light
 USELIBS_light := toollog evtchn toolcore ctrl store hypfs guest
+
 LIBS_LIBS += util
 USELIBS_util := light
 FILENAME_util := xlutil
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 17:22:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 17:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906742.1314113 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trgpR-00053E-2G; Mon, 10 Mar 2025 17:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906742.1314113; Mon, 10 Mar 2025 17:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trgpQ-000536-Ve; Mon, 10 Mar 2025 17:22:12 +0000
Received: by outflank-mailman (input) for mailman id 906742;
 Mon, 10 Mar 2025 17:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trgpQ-00052y-1w
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 17:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trgpQ-00Cl8a-0q
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 17:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trgpP-0025Dm-38
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 17:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C+agGbDi3SZKz9in8l0rMZKXF9qeAFRHljuotZKfUeM=; b=LMVHZmO18I7aQ0mWLdBWeP/0r9
	YkDqAl/jnrEv8PMczCfCNxnAsNIfYcF//3HGBj7ZKhd7AevQ7/B1izChb5QLWbrxm+6Qd9kFdRltK
	kroejg6qEGG5MI3V6TUG3SOepka7xyhVcPPOC6PQ4QuBjRO3FnTsqJBcSyPQMQSp/Kog=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Drop the now-obsolete 11-riscv64.dockerfile
Message-Id: <E1trgpP-0025Dm-38@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 17:22:11 +0000

commit 12f1af2e8f75343067f40b3579ad3915f5dceb2b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 7 15:16:29 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 10 15:05:09 2025 +0000

    CI: Drop the now-obsolete 11-riscv64.dockerfile
    
    Fixes: bd9bda50553b ("automation: drop debian:11-riscv64 container")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/debian/11-riscv64.dockerfile | 33 ---------------------------
 1 file changed, 33 deletions(-)

diff --git a/automation/build/debian/11-riscv64.dockerfile b/automation/build/debian/11-riscv64.dockerfile
deleted file mode 100644
index a55047c501..0000000000
--- a/automation/build/debian/11-riscv64.dockerfile
+++ /dev/null
@@ -1,33 +0,0 @@
-# syntax=docker/dockerfile:1
-FROM --platform=linux/amd64 debian:bullseye-slim
-LABEL maintainer.name="The Xen Project"
-LABEL maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV CROSS_COMPILE=riscv64-linux-gnu-
-ENV XEN_TARGET_ARCH=riscv64
-
-RUN <<EOF
-#!/bin/bash
-    set -e
-
-    useradd --create-home user
-
-    apt-get update
-
-    DEPS=(
-        # Xen
-        bison
-        build-essential
-        checkpolicy
-        flex
-        gcc-riscv64-linux-gnu
-        python3-minimal
-    )
-
-    apt-get -y --no-install-recommends install "${DEPS[@]}"
-    rm -rf /var/lib/apt/lists/*
-EOF
-
-USER user
-WORKDIR /build
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 17:22:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 17:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906743.1314117 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trgpb-000568-3e; Mon, 10 Mar 2025 17:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906743.1314117; Mon, 10 Mar 2025 17:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trgpb-000560-0n; Mon, 10 Mar 2025 17:22:23 +0000
Received: by outflank-mailman (input) for mailman id 906743;
 Mon, 10 Mar 2025 17:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trgpa-00055j-4p
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 17:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trgpa-00Cl92-18
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 17:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trgpa-0025Es-0H
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 17:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bjMxcbsUA5F5G9y9MmchKticvw2Oajrnr9Gx0grR45I=; b=MGKI/Mev0p6Ue5e3huHV6iE288
	U//F2A8FUWLPXG32N2L8b1PuUlkP0ksg/cSBEztrkb7SBo0VuLoaM9vuv8BUoXUJ3b+f0rC38xsAL
	531TGl6A6VZRT4F/me4T2Qe47M+96FYmCkqbAXklHGLFVV03Px16LEvQCUGpzsmgkYYw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/domain: Initialise the domain handle before inserting into the domlist
Message-Id: <E1trgpa-0025Es-0H@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 17:22:22 +0000

commit 1ce968d96064d71099bed11992e9e2b40f0a5cb1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 7 16:38:26 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 10 15:05:09 2025 +0000

    xen/domain: Initialise the domain handle before inserting into the domlist
    
    As soon as the the domain is in the domlist, it can be queried via various
    means, ahead of being fully constructed.  Ensure it has the toolstack-given
    UUID prior to becoming visible.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/domain.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index fd98534c88..585fd726a9 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -901,6 +901,8 @@ struct domain *domain_create(domid_t domid,
      */
     ASSERT(config);
 
+    memcpy(d->handle, config->handle, sizeof(d->handle));
+
 #ifdef CONFIG_HAS_PIRQ
     if ( !is_hardware_domain(d) )
         d->nr_pirqs = nr_static_irqs + extra_domU_irqs;
@@ -962,7 +964,6 @@ struct domain *domain_create(domid_t domid,
     domlist_insert(d);
 
     domain_changed_state(d);
-    memcpy(d->handle, config->handle, sizeof(d->handle));
 
     return d;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 17:22:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 17:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906744.1314120 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trgpl-00059G-6K; Mon, 10 Mar 2025 17:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906744.1314120; Mon, 10 Mar 2025 17:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trgpl-000598-3e; Mon, 10 Mar 2025 17:22:33 +0000
Received: by outflank-mailman (input) for mailman id 906744;
 Mon, 10 Mar 2025 17:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trgpk-00058v-9T
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 17:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trgpk-00ClB1-1b
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 17:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trgpk-0025FP-0Z
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 17:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Su1R+mnovqrC+9xxNhWhP2AtgeGjBNcm0dD/xq7/5Mc=; b=HnG/rp+jPlxNmYmfO/3rcKUYFN
	SHgCBHVH1n6SatHMevt5u9lPGD5cxOBk4SSNczA3ms13wgzrhUlYiPnLKOArhc190pTrx5opESs3n
	UnPSeH+MP0ZX+MDXR6lE1JkC4jbLMYf791NShFm/5XIIkywp5bDEPolPWTBig6A4wEow=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/watchdog: Identify which domain watchdog fired
Message-Id: <E1trgpk-0025FP-0Z@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 17:22:32 +0000

commit 9a474fcceccf0add2ff7f6c7d4ebd24159edf544
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 7 14:24:42 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 10 15:05:09 2025 +0000

    xen/watchdog: Identify which domain watchdog fired
    
    When a watchdog fires, the domain is crashed and can't dump any state.
    
    Xen allows a domain to have two separate watchdogs.  Therefore, for a
    domain running multiple watchdogs (e.g. one based around network, one
    for disk), it is important for diagnostics to know which watchdog
    fired.
    
    As the printk() is in a timer callback, this is a bit awkward to
    arrange, but there are 12 spare bits in the bottom of the domain
    pointer owing to its alignment.
    
    Reuse these bits to encode the watchdog id too, so the one which fired
    is identified when the domain is crashed.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/core.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index d6296d99fd..9043414290 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -1534,12 +1534,19 @@ long vcpu_yield(void)
 
 static void cf_check domain_watchdog_timeout(void *data)
 {
-    struct domain *d = data;
+    /*
+     * The data parameter encodes the watchdog id in the low bits of
+     * the domain pointer.
+     */
+    struct domain *d = _p((unsigned long)data & PAGE_MASK);
+    unsigned int id = (unsigned long)data & ~PAGE_MASK;
+
+    BUILD_BUG_ON(alignof(*d) < PAGE_SIZE);
 
     if ( d->is_shutting_down || d->is_dying )
         return;
 
-    printk("Watchdog timer fired for domain %u\n", d->domain_id);
+    printk("Watchdog timer %u fired for %pd\n", id, d);
     domain_shutdown(d, SHUTDOWN_watchdog);
 }
 
@@ -1593,7 +1600,17 @@ void watchdog_domain_init(struct domain *d)
     d->watchdog_inuse_map = 0;
 
     for ( i = 0; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ )
-        init_timer(&d->watchdog_timer[i], domain_watchdog_timeout, d, 0);
+    {
+        void *data = d;
+
+        BUILD_BUG_ON(NR_DOMAIN_WATCHDOG_TIMERS > alignof(*d));
+
+        /*
+         * For the timer callback parameter, encode the watchdog id in
+         * the low bits of the domain pointer.
+         */
+        init_timer(&d->watchdog_timer[i], domain_watchdog_timeout, data + i, 0);
+    }
 }
 
 void watchdog_domain_destroy(struct domain *d)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 17:22:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 17:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906745.1314126 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trgpv-0005C3-8J; Mon, 10 Mar 2025 17:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906745.1314126; Mon, 10 Mar 2025 17:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trgpv-0005Bv-55; Mon, 10 Mar 2025 17:22:43 +0000
Received: by outflank-mailman (input) for mailman id 906745;
 Mon, 10 Mar 2025 17:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trgpu-0005Bo-CC
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 17:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trgpu-00ClBi-1s
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 17:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trgpu-0025If-11
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 17:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UWXt9Lha6yLQ7f2zT5QyJRUbdeT6t+1DlI8IzUL7GPI=; b=aZJDIhnZ+2M3KVCZApPDyyLtZG
	V31+j91K6yBRu/h/RwHp/8XNIA//2acu4ZSKfXJ/fIY5bHuIrNrfCJIxr+kJ/rPCfBMSc7aBxOVdD
	9R8k3ir3GFq6Ej/5vR5k8VYP9bYSG7GZWjA8Y9gKXRrK7ma2xuyi3VsIJm7S932xlduA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: fix INTRODUCE description in xenstore.txt
Message-Id: <E1trgpu-0025If-11@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 17:22:42 +0000

commit 56b237263b33451aae46115729f97d8a110c6b5d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 08:47:52 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 10 15:05:09 2025 +0000

    docs: fix INTRODUCE description in xenstore.txt
    
    The description of the Xenstore INTRODUCE command is still referencing
    xend. Fix that.
    
    The <evtchn> description is starting with a grammatically wrong
    sentence. Fix that.
    
    While at it, make clear that the Xenstore implementation is allowed
    to ignore the specified gfn and use the Xenstore reserved grant id
    GNTTAB_RESERVED_XENSTORE instead.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/misc/xenstore.txt | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/docs/misc/xenstore.txt b/docs/misc/xenstore.txt
index 38015835b1..7e1f031520 100644
--- a/docs/misc/xenstore.txt
+++ b/docs/misc/xenstore.txt
@@ -286,19 +286,32 @@ TRANSACTION_END		F|
 INTRODUCE		<domid>|<gfn>|<evtchn>|?
 	Notifies xenstored to communicate with this domain.
 
-	INTRODUCE is currently only used by xend (during domain
+	INTRODUCE is currently only used by xen tools (during domain
 	startup and various forms of restore and resume), and
 	xenstored prevents its use other than by dom0.
 
 	<domid> must be a real domain id (not 0 and not a special
 	DOMID_... value).  <gfn> must be a page in that domain
-	represented in signed decimal (!).  <evtchn> must be event
-	channel is an unbound event channel in <domid> (likewise in
-	decimal), on which xenstored will call bind_interdomain.
+	represented in signed decimal (!).  <evtchn> is an unbound
+	event channel in <domid> (likewise in decimal), on which
+	xenstored will call bind_interdomain.
+
 	Violations of these rules may result in undefined behaviour;
 	for example passing a high-bit-set 32-bit gfn as an unsigned
 	decimal will attempt to use 0x7fffffff instead (!).
 
+	The <gfn> field is used by xenstoreds which use foreign
+	mapping to access the ring page.
+
+	Alternatively, Grant 1 (GNTTAB_RESERVED_XENSTORE) is reserved
+	for the same purpose, and is populated by the domain builder
+	on behalf of the guest.  This mechanism is preferred because
+	it reduces the permissions that xenstored needs in order to
+	function.
+
+	Both <gfn> and Grant 1 need to agree, because implementations
+	of xenstored will use one and ignore the other.
+
 RELEASE			<domid>|
 	Manually requests that xenstored disconnect from the domain.
 	The event channel is unbound at the xenstored end and the page
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 19:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 19:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906814.1314178 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trjDL-0008Ml-JX; Mon, 10 Mar 2025 19:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906814.1314178; Mon, 10 Mar 2025 19:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trjDL-0008Md-Gp; Mon, 10 Mar 2025 19:55:03 +0000
Received: by outflank-mailman (input) for mailman id 906814;
 Mon, 10 Mar 2025 19:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trjDK-0008MX-9E
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 19:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trjDK-00CoHe-1E
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 19:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trjDK-002JSb-0J
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 19:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gXxZEaFx74GmKKmOB1nHUykxfH5/f2CwE4i/b927fjc=; b=dvTij2UjqNbDvbY/kZqZoa2/43
	IwUZ7pYNIMc7vvD/GjZXB992cClEDvzZpB6zUFzSyBNsKQRLdzaRb7/XYb6D/ExGx98teL+CzbnwZ
	HtrwWMjOwtKnlYcT1iFyzL87HGZS7y+pxShZof9dPpewlE3dWkzcqkgX2uQWcxbnkJEs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs: Make uselibs.mk more legible
Message-Id: <E1trjDK-002JSb-0J@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 19:55:02 +0000

commit 6ca6d8c8050f368d97279f342aac7ecc67e0dc05
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 8 23:31:11 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 10 15:05:09 2025 +0000

    tools/libs: Make uselibs.mk more legible
    
    A few blank lines go a very long way.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/uselibs.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/libs/uselibs.mk b/tools/libs/uselibs.mk
index c0a234cfec..3c88e78c10 100644
--- a/tools/libs/uselibs.mk
+++ b/tools/libs/uselibs.mk
@@ -2,34 +2,49 @@
 
 LIBS_LIBS += toolcore
 USELIBS_toolcore :=
+
 LIBS_LIBS += toollog
 USELIBS_toollog :=
+
 LIBS_LIBS += evtchn
 USELIBS_evtchn := toollog toolcore
+
 LIBS_LIBS += gnttab
 USELIBS_gnttab := toollog toolcore
+
 LIBS_LIBS += call
 USELIBS_call := toollog toolcore
+
 LIBS_LIBS += foreignmemory
 USELIBS_foreignmemory := toollog toolcore
+
 LIBS_LIBS += devicemodel
 USELIBS_devicemodel := toollog toolcore call
+
 LIBS_LIBS += hypfs
 USELIBS_hypfs := toollog toolcore call
+
 LIBS_LIBS += manage
 USELIBS_manage := toollog toolcore call
+
 LIBS_LIBS += ctrl
 USELIBS_ctrl := toollog call evtchn gnttab foreignmemory devicemodel
+
 LIBS_LIBS += guest
 USELIBS_guest := evtchn ctrl
+
 LIBS_LIBS += store
 USELIBS_store := toolcore
+
 LIBS_LIBS += vchan
 USELIBS_vchan := toollog store gnttab evtchn
+
 LIBS_LIBS += stat
 USELIBS_stat := ctrl store
+
 LIBS_LIBS += light
 USELIBS_light := toollog evtchn toolcore ctrl store hypfs guest
+
 LIBS_LIBS += util
 USELIBS_util := light
 FILENAME_util := xlutil
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 19:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 19:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906815.1314182 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trjDV-0008OS-Kq; Mon, 10 Mar 2025 19:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906815.1314182; Mon, 10 Mar 2025 19:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trjDV-0008OK-IF; Mon, 10 Mar 2025 19:55:13 +0000
Received: by outflank-mailman (input) for mailman id 906815;
 Mon, 10 Mar 2025 19:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trjDU-0008O8-9D
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 19:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trjDU-00CoHi-1Z
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 19:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trjDU-002JTT-0f
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 19:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q6tO2835HtHf90E2scuvhw5lWHqBvv6mPwqZ563ie1M=; b=Zm3g4O7ILEum4NAXkNJatMOeo7
	S00DAII5ON3/KxZrviUthia7MyVINtmojeLC//Q/YozWy3s32asqz2So7SkoFcHrAaHk8H4etBixW
	2ufb765w7iBIXDgMT18Xs00RqgfGhb/tyEGlVAiZoEs1rQK2fY2oIhSHWmG8bqJfK3hY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Drop the now-obsolete 11-riscv64.dockerfile
Message-Id: <E1trjDU-002JTT-0f@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 19:55:12 +0000

commit 12f1af2e8f75343067f40b3579ad3915f5dceb2b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 7 15:16:29 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 10 15:05:09 2025 +0000

    CI: Drop the now-obsolete 11-riscv64.dockerfile
    
    Fixes: bd9bda50553b ("automation: drop debian:11-riscv64 container")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/debian/11-riscv64.dockerfile | 33 ---------------------------
 1 file changed, 33 deletions(-)

diff --git a/automation/build/debian/11-riscv64.dockerfile b/automation/build/debian/11-riscv64.dockerfile
deleted file mode 100644
index a55047c501..0000000000
--- a/automation/build/debian/11-riscv64.dockerfile
+++ /dev/null
@@ -1,33 +0,0 @@
-# syntax=docker/dockerfile:1
-FROM --platform=linux/amd64 debian:bullseye-slim
-LABEL maintainer.name="The Xen Project"
-LABEL maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV CROSS_COMPILE=riscv64-linux-gnu-
-ENV XEN_TARGET_ARCH=riscv64
-
-RUN <<EOF
-#!/bin/bash
-    set -e
-
-    useradd --create-home user
-
-    apt-get update
-
-    DEPS=(
-        # Xen
-        bison
-        build-essential
-        checkpolicy
-        flex
-        gcc-riscv64-linux-gnu
-        python3-minimal
-    )
-
-    apt-get -y --no-install-recommends install "${DEPS[@]}"
-    rm -rf /var/lib/apt/lists/*
-EOF
-
-USER user
-WORKDIR /build
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 19:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 19:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906816.1314186 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trjDf-0008R5-ME; Mon, 10 Mar 2025 19:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906816.1314186; Mon, 10 Mar 2025 19:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trjDf-0008Qx-Je; Mon, 10 Mar 2025 19:55:23 +0000
Received: by outflank-mailman (input) for mailman id 906816;
 Mon, 10 Mar 2025 19:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trjDe-0008Qm-Cl
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 19:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trjDe-00CoHm-1s
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 19:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trjDe-002JUP-0z
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 19:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BJsGViowbxhQxzDB3MzYeqQBb6t3zLqtkkh4s8xlre4=; b=XXVMF2SbCo3KW8QnbaMfzxX6Kw
	zl7r7MwxGAu9+OMqC9IAOCwsI0F1EWTIpZ6Lz7e9yA4B2Py3aoyhYdWven/IyL7spmmOP9QNsdRDD
	v7DvNSFSJraAm8XKSfoqhxPUpyFI26JLd5A4oB8RJA3UP1WxwAEAbiEDfSd09nDHf1Hk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/domain: Initialise the domain handle before inserting into the domlist
Message-Id: <E1trjDe-002JUP-0z@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 19:55:22 +0000

commit 1ce968d96064d71099bed11992e9e2b40f0a5cb1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 7 16:38:26 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 10 15:05:09 2025 +0000

    xen/domain: Initialise the domain handle before inserting into the domlist
    
    As soon as the the domain is in the domlist, it can be queried via various
    means, ahead of being fully constructed.  Ensure it has the toolstack-given
    UUID prior to becoming visible.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/domain.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index fd98534c88..585fd726a9 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -901,6 +901,8 @@ struct domain *domain_create(domid_t domid,
      */
     ASSERT(config);
 
+    memcpy(d->handle, config->handle, sizeof(d->handle));
+
 #ifdef CONFIG_HAS_PIRQ
     if ( !is_hardware_domain(d) )
         d->nr_pirqs = nr_static_irqs + extra_domU_irqs;
@@ -962,7 +964,6 @@ struct domain *domain_create(domid_t domid,
     domlist_insert(d);
 
     domain_changed_state(d);
-    memcpy(d->handle, config->handle, sizeof(d->handle));
 
     return d;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 19:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 19:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906817.1314191 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trjDp-0008Tf-Nd; Mon, 10 Mar 2025 19:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906817.1314191; Mon, 10 Mar 2025 19:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trjDp-0008TX-L1; Mon, 10 Mar 2025 19:55:33 +0000
Received: by outflank-mailman (input) for mailman id 906817;
 Mon, 10 Mar 2025 19:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trjDo-0008TN-G0
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 19:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trjDo-00CoI6-2G
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 19:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trjDo-002JVT-1J
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 19:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/c0bwasBqBwWtD1YDM7GrwQt4snJCX54RALYR4c8EjM=; b=BvrkcnrGolxs+tWmo7dEg21ZVj
	TC4jBFTtaLros81ohTi4cJ1thCjn1TokYIqO/VXh7Nt3Fsod7TCY7xQHCIksHabYVSgb4G/pqPKun
	4Efb/C897bhIUwcax4XJr00U7HdbT3LfXzRnAm6no4tNz6miFSqhoiX+8B5Vf/GdGFR8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/watchdog: Identify which domain watchdog fired
Message-Id: <E1trjDo-002JVT-1J@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 19:55:32 +0000

commit 9a474fcceccf0add2ff7f6c7d4ebd24159edf544
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 7 14:24:42 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 10 15:05:09 2025 +0000

    xen/watchdog: Identify which domain watchdog fired
    
    When a watchdog fires, the domain is crashed and can't dump any state.
    
    Xen allows a domain to have two separate watchdogs.  Therefore, for a
    domain running multiple watchdogs (e.g. one based around network, one
    for disk), it is important for diagnostics to know which watchdog
    fired.
    
    As the printk() is in a timer callback, this is a bit awkward to
    arrange, but there are 12 spare bits in the bottom of the domain
    pointer owing to its alignment.
    
    Reuse these bits to encode the watchdog id too, so the one which fired
    is identified when the domain is crashed.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/core.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index d6296d99fd..9043414290 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -1534,12 +1534,19 @@ long vcpu_yield(void)
 
 static void cf_check domain_watchdog_timeout(void *data)
 {
-    struct domain *d = data;
+    /*
+     * The data parameter encodes the watchdog id in the low bits of
+     * the domain pointer.
+     */
+    struct domain *d = _p((unsigned long)data & PAGE_MASK);
+    unsigned int id = (unsigned long)data & ~PAGE_MASK;
+
+    BUILD_BUG_ON(alignof(*d) < PAGE_SIZE);
 
     if ( d->is_shutting_down || d->is_dying )
         return;
 
-    printk("Watchdog timer fired for domain %u\n", d->domain_id);
+    printk("Watchdog timer %u fired for %pd\n", id, d);
     domain_shutdown(d, SHUTDOWN_watchdog);
 }
 
@@ -1593,7 +1600,17 @@ void watchdog_domain_init(struct domain *d)
     d->watchdog_inuse_map = 0;
 
     for ( i = 0; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ )
-        init_timer(&d->watchdog_timer[i], domain_watchdog_timeout, d, 0);
+    {
+        void *data = d;
+
+        BUILD_BUG_ON(NR_DOMAIN_WATCHDOG_TIMERS > alignof(*d));
+
+        /*
+         * For the timer callback parameter, encode the watchdog id in
+         * the low bits of the domain pointer.
+         */
+        init_timer(&d->watchdog_timer[i], domain_watchdog_timeout, data + i, 0);
+    }
 }
 
 void watchdog_domain_destroy(struct domain *d)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 10 19:55:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 10 Mar 2025 19:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.906818.1314195 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trjDz-00005a-P5; Mon, 10 Mar 2025 19:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 906818.1314195; Mon, 10 Mar 2025 19:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trjDz-00005P-Ma; Mon, 10 Mar 2025 19:55:43 +0000
Received: by outflank-mailman (input) for mailman id 906818;
 Mon, 10 Mar 2025 19:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trjDy-00005H-J1
 for xen-changelog@lists.xenproject.org; Mon, 10 Mar 2025 19:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trjDy-00CoIC-2W
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 19:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trjDy-002JWq-1f
 for xen-changelog@lists.xenproject.org;
 Mon, 10 Mar 2025 19:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CZg42qDuFnX3s+H8ZA+uMR6InHPzwuXWSOm9UfawnP4=; b=w59laa03cIA7ve5cwCL4sr25Lm
	6Q+GPhkW8iwsNjOEpRnDa18Hg86jtum506GRaThPCUkH+KmcLwcwhl9nRaBPya1ruoGh0nudR9bQZ
	4K3i2quVyrEycpPffHFwjk95lQjCWbWa16CzU0VftyVqlNv3AeVHpIlLII9RHaVCWlYI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: fix INTRODUCE description in xenstore.txt
Message-Id: <E1trjDy-002JWq-1f@xenbits.xenproject.org>
Date: Mon, 10 Mar 2025 19:55:42 +0000

commit 56b237263b33451aae46115729f97d8a110c6b5d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 6 08:47:52 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 10 15:05:09 2025 +0000

    docs: fix INTRODUCE description in xenstore.txt
    
    The description of the Xenstore INTRODUCE command is still referencing
    xend. Fix that.
    
    The <evtchn> description is starting with a grammatically wrong
    sentence. Fix that.
    
    While at it, make clear that the Xenstore implementation is allowed
    to ignore the specified gfn and use the Xenstore reserved grant id
    GNTTAB_RESERVED_XENSTORE instead.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/misc/xenstore.txt | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/docs/misc/xenstore.txt b/docs/misc/xenstore.txt
index 38015835b1..7e1f031520 100644
--- a/docs/misc/xenstore.txt
+++ b/docs/misc/xenstore.txt
@@ -286,19 +286,32 @@ TRANSACTION_END		F|
 INTRODUCE		<domid>|<gfn>|<evtchn>|?
 	Notifies xenstored to communicate with this domain.
 
-	INTRODUCE is currently only used by xend (during domain
+	INTRODUCE is currently only used by xen tools (during domain
 	startup and various forms of restore and resume), and
 	xenstored prevents its use other than by dom0.
 
 	<domid> must be a real domain id (not 0 and not a special
 	DOMID_... value).  <gfn> must be a page in that domain
-	represented in signed decimal (!).  <evtchn> must be event
-	channel is an unbound event channel in <domid> (likewise in
-	decimal), on which xenstored will call bind_interdomain.
+	represented in signed decimal (!).  <evtchn> is an unbound
+	event channel in <domid> (likewise in decimal), on which
+	xenstored will call bind_interdomain.
+
 	Violations of these rules may result in undefined behaviour;
 	for example passing a high-bit-set 32-bit gfn as an unsigned
 	decimal will attempt to use 0x7fffffff instead (!).
 
+	The <gfn> field is used by xenstoreds which use foreign
+	mapping to access the ring page.
+
+	Alternatively, Grant 1 (GNTTAB_RESERVED_XENSTORE) is reserved
+	for the same purpose, and is populated by the domain builder
+	on behalf of the guest.  This mechanism is preferred because
+	it reduces the permissions that xenstored needs in order to
+	function.
+
+	Both <gfn> and Grant 1 need to agree, because implementations
+	of xenstored will use one and ignore the other.
+
 RELEASE			<domid>|
 	Manually requests that xenstored disconnect from the domain.
 	The event channel is unbound at the xenstored end and the page
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 08:55:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 08:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.907416.1314640 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trvOB-0006i7-0G; Tue, 11 Mar 2025 08:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 907416.1314640; Tue, 11 Mar 2025 08:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trvOA-0006hy-Sl; Tue, 11 Mar 2025 08:55:02 +0000
Received: by outflank-mailman (input) for mailman id 907416;
 Tue, 11 Mar 2025 08:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trvOA-0006hr-BI
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 08:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trvOA-00ETB2-0i
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 08:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trvO9-003ari-2p
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 08:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x8uAXB13Fy2msLqIzGrpH4swBMDHdmzsi3HkWRIwbwo=; b=asFc+7UoUkfD3XfggPBg2Ttv1Z
	Y9RR0tq82KdXXxt6egtZSLj0Ovi1Z4UMX51wO3IzNMJ/rFY/23uU1Zs8L44NO2tSP/MSUjHvX+Wjt
	MHHpDdzQgUx+QpTdS2xMh8rMRyuFdhp/yUxeAhwWY5e4BJX9KeeuFbou+o2YlMRTXs7A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/apic: remove delivery and destination mode fields from drivers
Message-Id: <E1trvO9-003ari-2p@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 08:55:01 +0000

commit 032d6733a458f4fb92616f50b0338eab3476fdb6
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 6 09:07:31 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Tue Mar 11 09:47:35 2025 +0100

    x86/apic: remove delivery and destination mode fields from drivers
    
    All local APIC drivers use physical destination and fixed delivery modes,
    remove the fields from the genapic struct and simplify the logic.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/genapic/bigsmp.c      |  2 --
 xen/arch/x86/genapic/default.c     |  2 --
 xen/arch/x86/genapic/x2apic.c      |  4 ----
 xen/arch/x86/include/asm/genapic.h |  5 -----
 xen/arch/x86/io_apic.c             | 16 ++++++++--------
 xen/arch/x86/msi.c                 | 11 +++--------
 6 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/xen/arch/x86/genapic/bigsmp.c b/xen/arch/x86/genapic/bigsmp.c
index b2e7218452..ddb3a0b5d7 100644
--- a/xen/arch/x86/genapic/bigsmp.c
+++ b/xen/arch/x86/genapic/bigsmp.c
@@ -46,8 +46,6 @@ static int __init cf_check probe_bigsmp(void)
 
 const struct genapic __initconst_cf_clobber apic_bigsmp = {
 	APIC_INIT("bigsmp", probe_bigsmp),
-	.int_delivery_mode = dest_Fixed,
-	.int_dest_mode = 0, /* physical delivery */
 	.init_apic_ldr = init_apic_ldr_phys,
 	.vector_allocation_cpumask = vector_allocation_cpumask_phys,
 	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
diff --git a/xen/arch/x86/genapic/default.c b/xen/arch/x86/genapic/default.c
index 59c79afdb8..16e1875f63 100644
--- a/xen/arch/x86/genapic/default.c
+++ b/xen/arch/x86/genapic/default.c
@@ -16,8 +16,6 @@
 /* should be called last. */
 const struct genapic __initconst_cf_clobber apic_default = {
 	APIC_INIT("default", NULL),
-	.int_delivery_mode = dest_Fixed,
-	.int_dest_mode = 0, /* physical delivery */
 	.init_apic_ldr = init_apic_ldr_flat,
 	.vector_allocation_cpumask = vector_allocation_cpumask_phys,
 	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index c277f4f79b..74a6d808ac 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -140,8 +140,6 @@ static void cf_check send_IPI_mask_x2apic_cluster(
 
 static const struct genapic __initconst_cf_clobber apic_x2apic_phys = {
     APIC_INIT("x2apic_phys", NULL),
-    .int_delivery_mode = dest_Fixed,
-    .int_dest_mode = 0 /* physical delivery */,
     .init_apic_ldr = init_apic_ldr_phys,
     .vector_allocation_cpumask = vector_allocation_cpumask_phys,
     .cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
@@ -163,8 +161,6 @@ static const struct genapic __initconst_cf_clobber apic_x2apic_mixed = {
      * The following fields are exclusively used by external interrupts and
      * hence are set to use Physical destination mode handlers.
      */
-    .int_delivery_mode = dest_Fixed,
-    .int_dest_mode = 0 /* physical delivery */,
     .vector_allocation_cpumask = vector_allocation_cpumask_phys,
     .cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
 
diff --git a/xen/arch/x86/include/asm/genapic.h b/xen/arch/x86/include/asm/genapic.h
index cf36d48f3b..04d3f1de7a 100644
--- a/xen/arch/x86/include/asm/genapic.h
+++ b/xen/arch/x86/include/asm/genapic.h
@@ -23,9 +23,6 @@ struct genapic {
 	const char *name;
 	int (*probe)(void);
 
-	/* Interrupt delivery parameters ('physical' vs. 'logical flat'). */
-	int int_delivery_mode;
-	int int_dest_mode;
 	void (*init_apic_ldr)(void);
 	const cpumask_t *(*vector_allocation_cpumask)(int cpu);
 	unsigned int (*cpu_mask_to_apicid)(const cpumask_t *cpumask);
@@ -37,8 +34,6 @@ struct genapic {
 	.name = aname, \
 	.probe = aprobe
 
-#define INT_DELIVERY_MODE (genapic.int_delivery_mode)
-#define INT_DEST_MODE (genapic.int_dest_mode)
 #define TARGET_CPUS ((const typeof(cpu_online_map) *)&cpu_online_map)
 #define init_apic_ldr() alternative_vcall(genapic.init_apic_ldr)
 #define cpu_mask_to_apicid(mask) ({ \
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 776dd57720..c6cf944811 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1080,8 +1080,8 @@ static void __init setup_IO_APIC_irqs(void)
              */
             memset(&entry,0,sizeof(entry));
 
-            entry.delivery_mode = INT_DELIVERY_MODE;
-            entry.dest_mode = INT_DEST_MODE;
+            entry.delivery_mode = dest_Fixed;
+            entry.dest_mode = 0; /* physical delivery */
             entry.mask = 0;                /* enable IRQ */
 
             idx = find_irq_entry(apic,pin,mp_INT);
@@ -1150,10 +1150,10 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, in
      * We use logical delivery to get the timer IRQ
      * to the first CPU.
      */
-    entry.dest_mode = INT_DEST_MODE;
+    entry.dest_mode = 0; /* physical delivery */
     entry.mask = 0;					/* unmask IRQ now */
     SET_DEST(entry, logical, cpu_mask_to_apicid(TARGET_CPUS));
-    entry.delivery_mode = INT_DELIVERY_MODE;
+    entry.delivery_mode = dest_Fixed;
     entry.polarity = 0;
     entry.trigger = 0;
     entry.vector = vector;
@@ -2338,8 +2338,8 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
 
     memset(&entry,0,sizeof(entry));
 
-    entry.delivery_mode = INT_DELIVERY_MODE;
-    entry.dest_mode = INT_DEST_MODE;
+    entry.delivery_mode = dest_Fixed;
+    entry.dest_mode = 0; /* physical delivery */
     entry.trigger = edge_level;
     entry.polarity = active_high_low;
     entry.mask  = 1;
@@ -2473,8 +2473,8 @@ int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
      * The guest does not know physical APIC arrangement (flat vs. cluster).
      * Apply genapic conventions for this platform.
      */
-    rte.delivery_mode = INT_DELIVERY_MODE;
-    rte.dest_mode     = INT_DEST_MODE;
+    rte.delivery_mode = dest_Fixed;
+    rte.dest_mode     = 0; /* physical delivery */
 
     irq = apic_pin_2_gsi_irq(apic, pin);
     if ( irq < 0 )
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index bf5b71822e..6c11d76015 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -174,18 +174,13 @@ void msi_compose_msg(unsigned vector, const cpumask_t *cpu_mask, struct msi_msg
 
     msg->address_hi = MSI_ADDR_BASE_HI;
     msg->address_lo = MSI_ADDR_BASE_LO |
-                      (INT_DEST_MODE ? MSI_ADDR_DESTMODE_LOGIC
-                                     : MSI_ADDR_DESTMODE_PHYS) |
-                      ((INT_DELIVERY_MODE != dest_LowestPrio)
-                       ? MSI_ADDR_REDIRECTION_CPU
-                       : MSI_ADDR_REDIRECTION_LOWPRI) |
+                      MSI_ADDR_DESTMODE_PHYS |
+                      MSI_ADDR_REDIRECTION_CPU |
                       MSI_ADDR_DEST_ID(msg->dest32);
 
     msg->data = MSI_DATA_TRIGGER_EDGE |
                 MSI_DATA_LEVEL_ASSERT |
-                ((INT_DELIVERY_MODE != dest_LowestPrio)
-                 ? MSI_DATA_DELIVERY_FIXED
-                 : MSI_DATA_DELIVERY_LOWPRI) |
+                MSI_DATA_DELIVERY_FIXED |
                 MSI_DATA_VECTOR(vector);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 08:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 08:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.907418.1314646 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trvOL-0006ld-3n; Tue, 11 Mar 2025 08:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 907418.1314646; Tue, 11 Mar 2025 08:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trvOL-0006lV-1D; Tue, 11 Mar 2025 08:55:13 +0000
Received: by outflank-mailman (input) for mailman id 907418;
 Tue, 11 Mar 2025 08:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trvOK-0006lL-4E
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 08:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trvOK-00ETB6-12
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 08:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trvOK-003asv-09
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 08:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=akreenb1bieNDVykI40bbjlGlwiJg8fL4cDU5KU69pk=; b=XViXyT+phDnD/BPdDZAF7Gs2vP
	eLjjzo2lCUro8ev8doAnVTI01P1+oMxg40BQ7EP2HXlvT4P2up6/wYfNXm2cMCp/nyIiDO5byD6nV
	nH0T7vtV9lymTd/P3/2yCjbD5721dGoQVKH8641p3KsHqsnJWazIbMBltE/kvCGKE2F8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/cirrus-ci: store xen/.config as an artifact
Message-Id: <E1trvOK-003asv-09@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 08:55:12 +0000

commit 318659c818546b6415c2311339a53384dc20c427
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 10 18:41:57 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Tue Mar 11 09:47:35 2025 +0100

    automation/cirrus-ci: store xen/.config as an artifact
    
    Always store xen/.config as an artifact, renamed to xen-config to match
    the naming used in the Gitlab CI tests.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index e2949d99d7..1a39f5026f 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -15,6 +15,14 @@ freebsd_template: &FREEBSD_ENV
     APPEND_INCLUDES: /usr/local/include
     CIRRUS_CLONE_DEPTH: 1
 
+freebsd_artifacts: &FREEBSD_ARTIFACTS
+  always:
+    rename_script:
+      - cp xen/.config xen-config
+    config_artifacts:
+      path: xen-config
+      type: text/plain
+
 freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
   << : *FREEBSD_ENV
 
@@ -28,6 +36,8 @@ freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
     - ./configure --with-system-seabios=/usr/local/share/seabios/bios.bin
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
+  << : *FREEBSD_ARTIFACTS
+
 freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
   << : *FREEBSD_ENV
 
@@ -39,6 +49,8 @@ freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
             KCONFIG_ALLCONFIG=tools/kconfig/allrandom.config randconfig
     - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
 
+  << : *FREEBSD_ARTIFACTS
+
 task:
   name: 'FreeBSD 13: full build'
   << : *FREEBSD_13
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 09:00:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 09:00:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.907420.1314650 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trvT1-0007kK-EF; Tue, 11 Mar 2025 09:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 907420.1314650; Tue, 11 Mar 2025 09:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trvT1-0007k0-BW; Tue, 11 Mar 2025 09:00:03 +0000
Received: by outflank-mailman (input) for mailman id 907420;
 Tue, 11 Mar 2025 09:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trvT0-0007ZG-GZ
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 09:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trvT0-00ETIw-2F
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 09:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trvT0-003bOG-1M
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 09:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ef8vY3jR7mEWh482nKBrz2S9AtvzDF++Vz2GsSiWTyg=; b=VpQO2qyWJqXD3wVOxvUWgVDgbO
	RaHDufzdV9AZIqXfuk7nfN7DnV2uFSkPbl0SMDdWmW2Q6L2XzpypHkDAp1f6CK2v2xPRoUYnfK2I/
	OnVy+32k3D4dHmPhrWQ6XjZ2sIcCQwv0x7/03ack3RimphhRZFJ7nK1myTvNe2UiI5Ls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] PCI: drop pci_segments_init()
Message-Id: <E1trvT0-003bOG-1M@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 09:00:02 +0000

commit 12e872ae3e7749098b0360af1c6a3118e03d8267
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 11 09:54:19 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 11 09:54:19 2025 +0100

    PCI: drop pci_segments_init()
    
    Have callers invoke pci_add_segment() directly instead: With radix tree
    initialization moved out of the function, its name isn't quite
    describing anymore what it actually does.
    
    On x86 move the logic into __start_xen() itself, to reduce the risk of
    re-introducing ordering issues like the one which was addressed by
    26fe09e34566 ("radix-tree: introduce RADIX_TREE{,_INIT}()").
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/pci/pci.c                | 3 ++-
 xen/arch/x86/setup.c                  | 7 +++++++
 xen/arch/x86/x86_64/mmconfig-shared.c | 2 --
 xen/drivers/passthrough/pci.c         | 6 ------
 xen/include/xen/pci.h                 | 1 -
 5 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/pci/pci.c b/xen/arch/arm/pci/pci.c
index 78b97beaef..8d9692c92e 100644
--- a/xen/arch/arm/pci/pci.c
+++ b/xen/arch/arm/pci/pci.c
@@ -88,7 +88,8 @@ static int __init pci_init(void)
     if ( !pci_passthrough_enabled )
         return 0;
 
-    pci_segments_init();
+    if ( pci_add_segment(0) )
+        panic("Could not initialize PCI segment 0\n");
 
     if ( acpi_disabled )
         return dt_pci_init();
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 143749e5da..4a32d84911 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1899,6 +1899,13 @@ void asmlinkage __init noreturn __start_xen(void)
      */
     setup_system_domains();
 
+    /*
+     * Ahead of any ACPI table parsing make sure we have control structures
+     * for PCI segment 0.
+     */
+    if ( pci_add_segment(0) )
+        panic("Could not initialize PCI segment 0\n");
+
     /*
      * IOMMU-related ACPI table parsing has to happen before APIC probing, for
      * check_x2apic_preenabled() to be able to observe respective findings, in
diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c b/xen/arch/x86/x86_64/mmconfig-shared.c
index 77ba1e28f1..f1a3d42c5b 100644
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -402,8 +402,6 @@ void __init acpi_mmcfg_init(void)
 {
     bool valid = true;
 
-    pci_segments_init();
-
     /* MMCONFIG disabled */
     if ((pci_probe & PCI_PROBE_MMCONF) == 0)
         return;
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index ab25840e20..3edcfa8a04 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -127,12 +127,6 @@ static int pci_segments_iterate(
     return rc;
 }
 
-void __init pci_segments_init(void)
-{
-    if ( !alloc_pseg(0) )
-        panic("Could not initialize PCI segment 0\n");
-}
-
 int __init pci_add_segment(u16 seg)
 {
     return alloc_pseg(seg) ? 0 : -ENOMEM;
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 4f12bcf089..ef60196653 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -219,7 +219,6 @@ void setup_hwdom_pci_devices(struct domain *d,
                              int (*handler)(uint8_t devfn,
                                             struct pci_dev *pdev));
 int pci_release_devices(struct domain *d);
-void pci_segments_init(void);
 int pci_add_segment(u16 seg);
 const unsigned long *pci_get_ro_map(u16 seg);
 int pci_add_device(u16 seg, u8 bus, u8 devfn,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 09:00:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 09:00:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.907421.1314654 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trvTB-0008F8-Fv; Tue, 11 Mar 2025 09:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 907421.1314654; Tue, 11 Mar 2025 09:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trvTB-0008F0-Cw; Tue, 11 Mar 2025 09:00:13 +0000
Received: by outflank-mailman (input) for mailman id 907421;
 Tue, 11 Mar 2025 09:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trvTA-0008Es-So
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 09:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trvTA-00ETJ2-2a
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 09:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trvTA-003bPs-1g
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 09:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xAPcT4nqjIUQEVk0zSHVivfqsxPgP5BVfhlFNtRh+wk=; b=QgNuAtboRb8ZHUVK+H7ioSiVDe
	cyxsFl5kS/PBzO1fcizo1T6oOZCoEwRLO+u97px0RMsawTXVjcnuqebbcMB2QBzRgJOI4W4Qz40mW
	nK7Nzso6QnFHPb1oogyXuxAcR7MJhYub1ZfYzS4vnxCBcD+Ft0GtNszOZqQxeLhK+vsM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/P2M: correct old entry checking in p2m_remove_entry()
Message-Id: <E1trvTA-003bPs-1g@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 09:00:12 +0000

commit b04114ae2da0cae0a3e13324ecad21e1327bf260
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 11 09:55:20 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 11 09:55:20 2025 +0100

    x86/P2M: correct old entry checking in p2m_remove_entry()
    
    Using p2m_is_valid() isn't quite right here. It expanding to RAM+MMIO,
    the subsequent p2m_mmio_direct check effectively reduces its use to
    RAM+MMIO_DM. Yet MMIO_DM entries, which are never marked present in the
    page tables, won't pass the mfn_valid() check. It is, however, quite
    plausible (and supported by the rest of the function) to permit
    "removing" hole entries, i.e. in particular to convert MMIO_DM to
    INVALID. Which leaves the original check to be against RAM (plus MFN
    validity), while HOLE then instead wants INVALID_MFN to be passed in.
    
    Further more grant and foreign entries (together with RAM becoming
    ANY_RAM) as well as BROKEN want the MFN checking, too.
    
    All other types (i.e. MMIO_DIRECT and POD) want rejecting here rather
    than skipping, for needing handling / accounting elsewhere.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 1739133fc2..4f8a781842 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -522,9 +522,9 @@ p2m_remove_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
         mfn_t mfn_return = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
                                           &cur_order, NULL);
 
-        if ( p2m_is_valid(t) &&
-             (!mfn_valid(mfn) || t == p2m_mmio_direct ||
-              !mfn_eq(mfn_add(mfn, i), mfn_return)) )
+        if ( p2m_is_any_ram(t) || p2m_is_broken(t)
+             ? !mfn_valid(mfn) || !mfn_eq(mfn_add(mfn, i), mfn_return)
+             : !p2m_is_hole(t) || !mfn_eq(mfn, INVALID_MFN) )
             return -EILSEQ;
 
         i += (1UL << cur_order) -
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 09:00:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 09:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.907422.1314658 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trvTL-0008HT-Gv; Tue, 11 Mar 2025 09:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 907422.1314658; Tue, 11 Mar 2025 09:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trvTL-0008HL-EP; Tue, 11 Mar 2025 09:00:23 +0000
Received: by outflank-mailman (input) for mailman id 907422;
 Tue, 11 Mar 2025 09:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trvTK-0008H8-ML
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 09:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trvTK-00ETJ6-2t
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 09:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trvTK-003bQi-20
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 09:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NTCZth4NdwkxD5f18QVxtWU0vPPm/wI5KMlwiC8I2nA=; b=f6x/EjhX/fXkwSNKAWDbTYhWwO
	pb33er3pT7AyOA3EVWEz8TIwtYoQvQ7ws015q8pLppTYjZsBWjw9+jT+fCLuedGhblPhf8mG6gLxI
	cRNbxigo7oQnhyyQRO5RQbol1nP6ykbObMEb6zjYmznX9GG9PAwUqRGtbC6cdW4Q75jc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/P2M: don't include MMIO_DM in p2m_is_valid()
Message-Id: <E1trvTK-003bQi-20@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 09:00:22 +0000

commit be59cceb2dbbea3815f35f6982aac6d2ab1b10b7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 11 09:55:47 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 11 09:55:47 2025 +0100

    x86/P2M: don't include MMIO_DM in p2m_is_valid()
    
    MMIO_DM specifically marks pages which aren't valid, much like INVALID
    does. Dropping the type from the predicate
    - (conceptually) corrects _sh_propagate(), where the comment says that
      "something valid" is needed (the only call path not passing in RAM_RW
      would pass in INVALID_GFN along with MMIO_DM),
    - is benign to the use in sh_page_fault(), where the subsequent
      mfn_valid() check would otherwise cause the same bail-out code path to
      be taken,
    - is benign to all three uses in p2m_pt_get_entry(), as MMIO_DM entries
      will only ever yield non-present entries, which are being checked for
      earlier,
    - is benign to sh_unshadow_for_p2m_change(), for the same reason,
    - is benign to gnttab_transfer() with EPT not in use, again because
      MMIO_DM entries will only ever yield non-present entries, and
      INVALID_MFN is returned for those anyway by p2m_pt_get_entry().
    - for gnttab_transfer() with EPT in use (conceptually) corrects the
      corner case of a page first being subject to XEN_DMOP_set_mem_type
      converting a RAM type to MMIO_DM (which retains the MFN in the entry),
      and then being subject to GNTTABOP_transfer, except that steal_page()
      would later make the operation fail unconditionally anyway.
    
    While there also drop the unused (and otherwise now redundant)
    p2m_has_emt().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/include/asm/p2m.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h
index aa1bf7c9d0..6816a1be91 100644
--- a/xen/arch/x86/include/asm/p2m.h
+++ b/xen/arch/x86/include/asm/p2m.h
@@ -168,8 +168,8 @@ typedef unsigned int p2m_query_t;
 /* Grant types are *not* considered valid, because they can be
    unmapped at any time and, unless you happen to be the shadow or p2m
    implementations, there's no way of synchronising against that. */
-#define p2m_is_valid(_t) (p2m_to_mask(_t) & (P2M_RAM_TYPES | P2M_MMIO_TYPES))
-#define p2m_has_emt(_t)  (p2m_to_mask(_t) & (P2M_RAM_TYPES | p2m_to_mask(p2m_mmio_direct)))
+#define p2m_is_valid(_t)    (p2m_to_mask(_t) & \
+                             (P2M_RAM_TYPES | p2m_to_mask(p2m_mmio_direct)))
 #define p2m_is_pageable(_t) (p2m_to_mask(_t) & P2M_PAGEABLE_TYPES)
 #define p2m_is_paging(_t)   (p2m_to_mask(_t) & P2M_PAGING_TYPES)
 #define p2m_is_paged(_t)    (p2m_to_mask(_t) & P2M_PAGED_TYPES)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 10:00:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 10:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.907630.1314832 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trwP6-0003bw-MW; Tue, 11 Mar 2025 10:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 907630.1314832; Tue, 11 Mar 2025 10:00:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trwP6-0003bd-Jf; Tue, 11 Mar 2025 10:00:04 +0000
Received: by outflank-mailman (input) for mailman id 907630;
 Tue, 11 Mar 2025 10:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trwP4-00038o-GW
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 10:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trwP4-00EUXn-1D
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 10:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trwP4-003hRF-0F
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 10:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l44y1pH43X78LjESsPhLJpCTTpDFnigOWIuDz5/0eeA=; b=WErH8OJ82PWCvk7gs8v8CYcJR9
	YdyUI/UvvP/tM0fHiVdDyRE05Wq2YBok9nxVgPV3hrp9TrlrwMwq+f/3Wv+fQWaFMgD+agyj8Ln5N
	gqAJrVGJO8SbsRTdNlU/ka/1YNBhpWEl6ZLCSc6GTltzrhsmXo+eqF7A6CCqipWSXdsc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/apic: remove delivery and destination mode fields from drivers
Message-Id: <E1trwP4-003hRF-0F@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 10:00:02 +0000

commit 032d6733a458f4fb92616f50b0338eab3476fdb6
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 6 09:07:31 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Tue Mar 11 09:47:35 2025 +0100

    x86/apic: remove delivery and destination mode fields from drivers
    
    All local APIC drivers use physical destination and fixed delivery modes,
    remove the fields from the genapic struct and simplify the logic.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/genapic/bigsmp.c      |  2 --
 xen/arch/x86/genapic/default.c     |  2 --
 xen/arch/x86/genapic/x2apic.c      |  4 ----
 xen/arch/x86/include/asm/genapic.h |  5 -----
 xen/arch/x86/io_apic.c             | 16 ++++++++--------
 xen/arch/x86/msi.c                 | 11 +++--------
 6 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/xen/arch/x86/genapic/bigsmp.c b/xen/arch/x86/genapic/bigsmp.c
index b2e7218452..ddb3a0b5d7 100644
--- a/xen/arch/x86/genapic/bigsmp.c
+++ b/xen/arch/x86/genapic/bigsmp.c
@@ -46,8 +46,6 @@ static int __init cf_check probe_bigsmp(void)
 
 const struct genapic __initconst_cf_clobber apic_bigsmp = {
 	APIC_INIT("bigsmp", probe_bigsmp),
-	.int_delivery_mode = dest_Fixed,
-	.int_dest_mode = 0, /* physical delivery */
 	.init_apic_ldr = init_apic_ldr_phys,
 	.vector_allocation_cpumask = vector_allocation_cpumask_phys,
 	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
diff --git a/xen/arch/x86/genapic/default.c b/xen/arch/x86/genapic/default.c
index 59c79afdb8..16e1875f63 100644
--- a/xen/arch/x86/genapic/default.c
+++ b/xen/arch/x86/genapic/default.c
@@ -16,8 +16,6 @@
 /* should be called last. */
 const struct genapic __initconst_cf_clobber apic_default = {
 	APIC_INIT("default", NULL),
-	.int_delivery_mode = dest_Fixed,
-	.int_dest_mode = 0, /* physical delivery */
 	.init_apic_ldr = init_apic_ldr_flat,
 	.vector_allocation_cpumask = vector_allocation_cpumask_phys,
 	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index c277f4f79b..74a6d808ac 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -140,8 +140,6 @@ static void cf_check send_IPI_mask_x2apic_cluster(
 
 static const struct genapic __initconst_cf_clobber apic_x2apic_phys = {
     APIC_INIT("x2apic_phys", NULL),
-    .int_delivery_mode = dest_Fixed,
-    .int_dest_mode = 0 /* physical delivery */,
     .init_apic_ldr = init_apic_ldr_phys,
     .vector_allocation_cpumask = vector_allocation_cpumask_phys,
     .cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
@@ -163,8 +161,6 @@ static const struct genapic __initconst_cf_clobber apic_x2apic_mixed = {
      * The following fields are exclusively used by external interrupts and
      * hence are set to use Physical destination mode handlers.
      */
-    .int_delivery_mode = dest_Fixed,
-    .int_dest_mode = 0 /* physical delivery */,
     .vector_allocation_cpumask = vector_allocation_cpumask_phys,
     .cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
 
diff --git a/xen/arch/x86/include/asm/genapic.h b/xen/arch/x86/include/asm/genapic.h
index cf36d48f3b..04d3f1de7a 100644
--- a/xen/arch/x86/include/asm/genapic.h
+++ b/xen/arch/x86/include/asm/genapic.h
@@ -23,9 +23,6 @@ struct genapic {
 	const char *name;
 	int (*probe)(void);
 
-	/* Interrupt delivery parameters ('physical' vs. 'logical flat'). */
-	int int_delivery_mode;
-	int int_dest_mode;
 	void (*init_apic_ldr)(void);
 	const cpumask_t *(*vector_allocation_cpumask)(int cpu);
 	unsigned int (*cpu_mask_to_apicid)(const cpumask_t *cpumask);
@@ -37,8 +34,6 @@ struct genapic {
 	.name = aname, \
 	.probe = aprobe
 
-#define INT_DELIVERY_MODE (genapic.int_delivery_mode)
-#define INT_DEST_MODE (genapic.int_dest_mode)
 #define TARGET_CPUS ((const typeof(cpu_online_map) *)&cpu_online_map)
 #define init_apic_ldr() alternative_vcall(genapic.init_apic_ldr)
 #define cpu_mask_to_apicid(mask) ({ \
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 776dd57720..c6cf944811 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1080,8 +1080,8 @@ static void __init setup_IO_APIC_irqs(void)
              */
             memset(&entry,0,sizeof(entry));
 
-            entry.delivery_mode = INT_DELIVERY_MODE;
-            entry.dest_mode = INT_DEST_MODE;
+            entry.delivery_mode = dest_Fixed;
+            entry.dest_mode = 0; /* physical delivery */
             entry.mask = 0;                /* enable IRQ */
 
             idx = find_irq_entry(apic,pin,mp_INT);
@@ -1150,10 +1150,10 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, in
      * We use logical delivery to get the timer IRQ
      * to the first CPU.
      */
-    entry.dest_mode = INT_DEST_MODE;
+    entry.dest_mode = 0; /* physical delivery */
     entry.mask = 0;					/* unmask IRQ now */
     SET_DEST(entry, logical, cpu_mask_to_apicid(TARGET_CPUS));
-    entry.delivery_mode = INT_DELIVERY_MODE;
+    entry.delivery_mode = dest_Fixed;
     entry.polarity = 0;
     entry.trigger = 0;
     entry.vector = vector;
@@ -2338,8 +2338,8 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
 
     memset(&entry,0,sizeof(entry));
 
-    entry.delivery_mode = INT_DELIVERY_MODE;
-    entry.dest_mode = INT_DEST_MODE;
+    entry.delivery_mode = dest_Fixed;
+    entry.dest_mode = 0; /* physical delivery */
     entry.trigger = edge_level;
     entry.polarity = active_high_low;
     entry.mask  = 1;
@@ -2473,8 +2473,8 @@ int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
      * The guest does not know physical APIC arrangement (flat vs. cluster).
      * Apply genapic conventions for this platform.
      */
-    rte.delivery_mode = INT_DELIVERY_MODE;
-    rte.dest_mode     = INT_DEST_MODE;
+    rte.delivery_mode = dest_Fixed;
+    rte.dest_mode     = 0; /* physical delivery */
 
     irq = apic_pin_2_gsi_irq(apic, pin);
     if ( irq < 0 )
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index bf5b71822e..6c11d76015 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -174,18 +174,13 @@ void msi_compose_msg(unsigned vector, const cpumask_t *cpu_mask, struct msi_msg
 
     msg->address_hi = MSI_ADDR_BASE_HI;
     msg->address_lo = MSI_ADDR_BASE_LO |
-                      (INT_DEST_MODE ? MSI_ADDR_DESTMODE_LOGIC
-                                     : MSI_ADDR_DESTMODE_PHYS) |
-                      ((INT_DELIVERY_MODE != dest_LowestPrio)
-                       ? MSI_ADDR_REDIRECTION_CPU
-                       : MSI_ADDR_REDIRECTION_LOWPRI) |
+                      MSI_ADDR_DESTMODE_PHYS |
+                      MSI_ADDR_REDIRECTION_CPU |
                       MSI_ADDR_DEST_ID(msg->dest32);
 
     msg->data = MSI_DATA_TRIGGER_EDGE |
                 MSI_DATA_LEVEL_ASSERT |
-                ((INT_DELIVERY_MODE != dest_LowestPrio)
-                 ? MSI_DATA_DELIVERY_FIXED
-                 : MSI_DATA_DELIVERY_LOWPRI) |
+                MSI_DATA_DELIVERY_FIXED |
                 MSI_DATA_VECTOR(vector);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 10:00:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 10:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.907632.1314841 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trwPF-000452-W8; Tue, 11 Mar 2025 10:00:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 907632.1314841; Tue, 11 Mar 2025 10:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trwPF-00044i-R8; Tue, 11 Mar 2025 10:00:13 +0000
Received: by outflank-mailman (input) for mailman id 907632;
 Tue, 11 Mar 2025 10:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trwPE-00042T-9H
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 10:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trwPE-00EUZQ-1a
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 10:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trwPE-003hTb-0f
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 10:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t+mET5c/9eSMYLtLq6v9i3rP5DAQVFpxaRIZG7HcaTg=; b=jL233S5skKl4723JtF7CzdtWvD
	Ja+N55h7dH5s+Ewb4MU+WVRbZHR0F04SxMY7NoIp0D1TOJlrlGwiVrxzf2nvUyHJaQXdIviaAPS+N
	gXjapVFJeMwOi3BbL7gsy9hyPSeTFdi4/INTfYB7BN7qTyUc1TwoVFeR4fAeCAB1kVbU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/cirrus-ci: store xen/.config as an artifact
Message-Id: <E1trwPE-003hTb-0f@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 10:00:12 +0000

commit 318659c818546b6415c2311339a53384dc20c427
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 10 18:41:57 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Tue Mar 11 09:47:35 2025 +0100

    automation/cirrus-ci: store xen/.config as an artifact
    
    Always store xen/.config as an artifact, renamed to xen-config to match
    the naming used in the Gitlab CI tests.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index e2949d99d7..1a39f5026f 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -15,6 +15,14 @@ freebsd_template: &FREEBSD_ENV
     APPEND_INCLUDES: /usr/local/include
     CIRRUS_CLONE_DEPTH: 1
 
+freebsd_artifacts: &FREEBSD_ARTIFACTS
+  always:
+    rename_script:
+      - cp xen/.config xen-config
+    config_artifacts:
+      path: xen-config
+      type: text/plain
+
 freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
   << : *FREEBSD_ENV
 
@@ -28,6 +36,8 @@ freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
     - ./configure --with-system-seabios=/usr/local/share/seabios/bios.bin
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
+  << : *FREEBSD_ARTIFACTS
+
 freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
   << : *FREEBSD_ENV
 
@@ -39,6 +49,8 @@ freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
             KCONFIG_ALLCONFIG=tools/kconfig/allrandom.config randconfig
     - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
 
+  << : *FREEBSD_ARTIFACTS
+
 task:
   name: 'FreeBSD 13: full build'
   << : *FREEBSD_13
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 10:55:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 10:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.907833.1315012 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trxGK-0000dR-0j; Tue, 11 Mar 2025 10:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 907833.1315012; Tue, 11 Mar 2025 10:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trxGJ-0000dJ-UR; Tue, 11 Mar 2025 10:55:03 +0000
Received: by outflank-mailman (input) for mailman id 907833;
 Tue, 11 Mar 2025 10:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trxGI-0000dD-72
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 10:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trxGI-00EVeU-0c
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 10:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trxGH-003moS-2u
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 10:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5wDZH94E3R45Jb7PCTOEB5VkxPukzk022u4ApZ2jG0k=; b=g2mU9H+2QV1oPx+OyihxOld1Cc
	nccn98JXvWlQfPVPM6dyO7/eyJ9pPVP5++bpUXiD6OrSuWfLE6CQn21ydy2tZ4bXSwKb7DpB62Zya
	ekK4cKhtCrj372YwZw4mf2z0A6TztzBvEnlWM9vMqoej5A54GKwYBavOg5u5kmlS7/n0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] PCI: drop pci_segments_init()
Message-Id: <E1trxGH-003moS-2u@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 10:55:01 +0000

commit 12e872ae3e7749098b0360af1c6a3118e03d8267
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 11 09:54:19 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 11 09:54:19 2025 +0100

    PCI: drop pci_segments_init()
    
    Have callers invoke pci_add_segment() directly instead: With radix tree
    initialization moved out of the function, its name isn't quite
    describing anymore what it actually does.
    
    On x86 move the logic into __start_xen() itself, to reduce the risk of
    re-introducing ordering issues like the one which was addressed by
    26fe09e34566 ("radix-tree: introduce RADIX_TREE{,_INIT}()").
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/pci/pci.c                | 3 ++-
 xen/arch/x86/setup.c                  | 7 +++++++
 xen/arch/x86/x86_64/mmconfig-shared.c | 2 --
 xen/drivers/passthrough/pci.c         | 6 ------
 xen/include/xen/pci.h                 | 1 -
 5 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/pci/pci.c b/xen/arch/arm/pci/pci.c
index 78b97beaef..8d9692c92e 100644
--- a/xen/arch/arm/pci/pci.c
+++ b/xen/arch/arm/pci/pci.c
@@ -88,7 +88,8 @@ static int __init pci_init(void)
     if ( !pci_passthrough_enabled )
         return 0;
 
-    pci_segments_init();
+    if ( pci_add_segment(0) )
+        panic("Could not initialize PCI segment 0\n");
 
     if ( acpi_disabled )
         return dt_pci_init();
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 143749e5da..4a32d84911 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1899,6 +1899,13 @@ void asmlinkage __init noreturn __start_xen(void)
      */
     setup_system_domains();
 
+    /*
+     * Ahead of any ACPI table parsing make sure we have control structures
+     * for PCI segment 0.
+     */
+    if ( pci_add_segment(0) )
+        panic("Could not initialize PCI segment 0\n");
+
     /*
      * IOMMU-related ACPI table parsing has to happen before APIC probing, for
      * check_x2apic_preenabled() to be able to observe respective findings, in
diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c b/xen/arch/x86/x86_64/mmconfig-shared.c
index 77ba1e28f1..f1a3d42c5b 100644
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -402,8 +402,6 @@ void __init acpi_mmcfg_init(void)
 {
     bool valid = true;
 
-    pci_segments_init();
-
     /* MMCONFIG disabled */
     if ((pci_probe & PCI_PROBE_MMCONF) == 0)
         return;
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index ab25840e20..3edcfa8a04 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -127,12 +127,6 @@ static int pci_segments_iterate(
     return rc;
 }
 
-void __init pci_segments_init(void)
-{
-    if ( !alloc_pseg(0) )
-        panic("Could not initialize PCI segment 0\n");
-}
-
 int __init pci_add_segment(u16 seg)
 {
     return alloc_pseg(seg) ? 0 : -ENOMEM;
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 4f12bcf089..ef60196653 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -219,7 +219,6 @@ void setup_hwdom_pci_devices(struct domain *d,
                              int (*handler)(uint8_t devfn,
                                             struct pci_dev *pdev));
 int pci_release_devices(struct domain *d);
-void pci_segments_init(void);
 int pci_add_segment(u16 seg);
 const unsigned long *pci_get_ro_map(u16 seg);
 int pci_add_device(u16 seg, u8 bus, u8 devfn,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 10:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 10:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.907834.1315017 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trxGT-0000fA-2F; Tue, 11 Mar 2025 10:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 907834.1315017; Tue, 11 Mar 2025 10:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trxGS-0000f2-Vt; Tue, 11 Mar 2025 10:55:12 +0000
Received: by outflank-mailman (input) for mailman id 907834;
 Tue, 11 Mar 2025 10:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trxGS-0000eq-2q
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 10:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trxGS-00EVef-0u
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 10:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trxGS-003mpE-02
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 10:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MjOme6NjIpFtOjY65wdMrpUL6c5kKJDD9vgqk47ofK0=; b=HUOC97Fxjex1pY008cWmaeZBvb
	+HD71HrQ+ScU0Ua5c3QXp+ddpngh0LH47ar+roylNv6VwfINTFF3HVn6XJCDGAOT9OCK+Dc8RClqk
	+Fb0vU6NuiCkEI1P2Gt42N7nz4rxb6K5eJvWbbJQbmL5ytE+9hK/3/Fczr5Q+JjGASZI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/P2M: correct old entry checking in p2m_remove_entry()
Message-Id: <E1trxGS-003mpE-02@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 10:55:12 +0000

commit b04114ae2da0cae0a3e13324ecad21e1327bf260
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 11 09:55:20 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 11 09:55:20 2025 +0100

    x86/P2M: correct old entry checking in p2m_remove_entry()
    
    Using p2m_is_valid() isn't quite right here. It expanding to RAM+MMIO,
    the subsequent p2m_mmio_direct check effectively reduces its use to
    RAM+MMIO_DM. Yet MMIO_DM entries, which are never marked present in the
    page tables, won't pass the mfn_valid() check. It is, however, quite
    plausible (and supported by the rest of the function) to permit
    "removing" hole entries, i.e. in particular to convert MMIO_DM to
    INVALID. Which leaves the original check to be against RAM (plus MFN
    validity), while HOLE then instead wants INVALID_MFN to be passed in.
    
    Further more grant and foreign entries (together with RAM becoming
    ANY_RAM) as well as BROKEN want the MFN checking, too.
    
    All other types (i.e. MMIO_DIRECT and POD) want rejecting here rather
    than skipping, for needing handling / accounting elsewhere.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 1739133fc2..4f8a781842 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -522,9 +522,9 @@ p2m_remove_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
         mfn_t mfn_return = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
                                           &cur_order, NULL);
 
-        if ( p2m_is_valid(t) &&
-             (!mfn_valid(mfn) || t == p2m_mmio_direct ||
-              !mfn_eq(mfn_add(mfn, i), mfn_return)) )
+        if ( p2m_is_any_ram(t) || p2m_is_broken(t)
+             ? !mfn_valid(mfn) || !mfn_eq(mfn_add(mfn, i), mfn_return)
+             : !p2m_is_hole(t) || !mfn_eq(mfn, INVALID_MFN) )
             return -EILSEQ;
 
         i += (1UL << cur_order) -
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 10:55:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 10:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.907835.1315022 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trxGe-0000hv-3u; Tue, 11 Mar 2025 10:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 907835.1315022; Tue, 11 Mar 2025 10:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1trxGe-0000hn-11; Tue, 11 Mar 2025 10:55:24 +0000
Received: by outflank-mailman (input) for mailman id 907835;
 Tue, 11 Mar 2025 10:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1trxGc-0000ha-5m
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 10:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trxGc-00EVen-1E
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 10:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1trxGc-003mq8-0K
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 10:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UgRCvn8Uu+pS5QadVSZvsdv+Ipk/KM2AQ4oHjPqFFL0=; b=fqYqO4LKBR3Z4OQDnH9bkYx5jD
	jhMOyHtIwLPhwDxzZNhdGIk8h6AhugRLvX0ms8MTquTDmArZWcKF8gmzD2JGNWJobGiHa7ror1aK4
	tV0nJfWkLYeebxpvW++rub/eeswrgec5mjlbDmnJloLJLw90D/pPxVt//MHbN8+juj90=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/P2M: don't include MMIO_DM in p2m_is_valid()
Message-Id: <E1trxGc-003mq8-0K@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 10:55:22 +0000

commit be59cceb2dbbea3815f35f6982aac6d2ab1b10b7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 11 09:55:47 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 11 09:55:47 2025 +0100

    x86/P2M: don't include MMIO_DM in p2m_is_valid()
    
    MMIO_DM specifically marks pages which aren't valid, much like INVALID
    does. Dropping the type from the predicate
    - (conceptually) corrects _sh_propagate(), where the comment says that
      "something valid" is needed (the only call path not passing in RAM_RW
      would pass in INVALID_GFN along with MMIO_DM),
    - is benign to the use in sh_page_fault(), where the subsequent
      mfn_valid() check would otherwise cause the same bail-out code path to
      be taken,
    - is benign to all three uses in p2m_pt_get_entry(), as MMIO_DM entries
      will only ever yield non-present entries, which are being checked for
      earlier,
    - is benign to sh_unshadow_for_p2m_change(), for the same reason,
    - is benign to gnttab_transfer() with EPT not in use, again because
      MMIO_DM entries will only ever yield non-present entries, and
      INVALID_MFN is returned for those anyway by p2m_pt_get_entry().
    - for gnttab_transfer() with EPT in use (conceptually) corrects the
      corner case of a page first being subject to XEN_DMOP_set_mem_type
      converting a RAM type to MMIO_DM (which retains the MFN in the entry),
      and then being subject to GNTTABOP_transfer, except that steal_page()
      would later make the operation fail unconditionally anyway.
    
    While there also drop the unused (and otherwise now redundant)
    p2m_has_emt().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/include/asm/p2m.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h
index aa1bf7c9d0..6816a1be91 100644
--- a/xen/arch/x86/include/asm/p2m.h
+++ b/xen/arch/x86/include/asm/p2m.h
@@ -168,8 +168,8 @@ typedef unsigned int p2m_query_t;
 /* Grant types are *not* considered valid, because they can be
    unmapped at any time and, unless you happen to be the shadow or p2m
    implementations, there's no way of synchronising against that. */
-#define p2m_is_valid(_t) (p2m_to_mask(_t) & (P2M_RAM_TYPES | P2M_MMIO_TYPES))
-#define p2m_has_emt(_t)  (p2m_to_mask(_t) & (P2M_RAM_TYPES | p2m_to_mask(p2m_mmio_direct)))
+#define p2m_is_valid(_t)    (p2m_to_mask(_t) & \
+                             (P2M_RAM_TYPES | p2m_to_mask(p2m_mmio_direct)))
 #define p2m_is_pageable(_t) (p2m_to_mask(_t) & P2M_PAGEABLE_TYPES)
 #define p2m_is_paging(_t)   (p2m_to_mask(_t) & P2M_PAGING_TYPES)
 #define p2m_is_paged(_t)    (p2m_to_mask(_t) & P2M_PAGED_TYPES)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 22:33:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 22:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.909504.1316433 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ts89m-0007A3-Cj; Tue, 11 Mar 2025 22:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 909504.1316433; Tue, 11 Mar 2025 22:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ts89m-00079v-AB; Tue, 11 Mar 2025 22:33:02 +0000
Received: by outflank-mailman (input) for mailman id 909504;
 Tue, 11 Mar 2025 22:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ts89l-00079p-RS
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 22:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ts89m-00Ekme-08
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 22:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ts89l-005YhV-2R
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 22:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EoD9XJSM9d4XWYzIxlmGB/DzT8xHJQm8qaM3DiXqiIY=; b=ZfN5i1Nume7ptO9ja4JVx0kUVK
	ZOnMuIAnJ5u+jr/Dt0WJTAPnhF8uWXJ/jSHzhe2ip3p+20WqQxif8ke2yrPiZR5tw8kPCyD/I6H3b
	SjiQeiVESUekBahshECk+0eQFTWGibh7qU3Tr4hFAOYNnGdKXwtmb3iFzf0reetqs3HY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MISRA: Rephrase the deviation for Directive 4.10
Message-Id: <E1ts89l-005YhV-2R@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 22:33:01 +0000

commit 87f8874fef4ac93998a15b5a63c183b898ffeb2a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 4 23:48:54 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 11 22:30:10 2025 +0000

    MISRA: Rephrase the deviation for Directive 4.10
    
    The use of "legitimately" mixes the concepts of "it was designed to do this"
    and "it was correct to do this".
    
    The latter in particular can go stale.  "intended" is a better way of phrasing
    this.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 2 +-
 xen/arch/arm/include/asm/perfc_defn.h            | 2 +-
 xen/arch/x86/include/asm/perfc_defn.h            | 2 +-
 xen/include/asm-generic/perfc_defn.h             | 2 +-
 xen/include/xen/perfc_defn.h                     | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index dfa5f34b39..2c8fb92713 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -74,7 +74,7 @@ they are not instances of commented-out code."
 
 -doc_begin="Files that are intended to be included more than once do not need to
 conform to the directive."
--config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"}
+-config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* This file is intended to be included multiple times\\. \\*/$, begin-4))"}
 -config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
 -config=MC3A2.D4.10,reports+={safe, "all_area(all_loc(file(^xen/include/generated/autoconf.h$)))"}
 -doc_end
diff --git a/xen/arch/arm/include/asm/perfc_defn.h b/xen/arch/arm/include/asm/perfc_defn.h
index 3ab0391175..effd25b69e 100644
--- a/xen/arch/arm/include/asm/perfc_defn.h
+++ b/xen/arch/arm/include/asm/perfc_defn.h
@@ -1,4 +1,4 @@
-/* This file is legitimately included multiple times. */
+/* This file is intended to be included multiple times. */
 /*#ifndef __XEN_PERFC_DEFN_H__*/
 /*#define __XEN_PERFC_DEFN_H__*/
 
diff --git a/xen/arch/x86/include/asm/perfc_defn.h b/xen/arch/x86/include/asm/perfc_defn.h
index 487e20dc97..d6127cb91e 100644
--- a/xen/arch/x86/include/asm/perfc_defn.h
+++ b/xen/arch/x86/include/asm/perfc_defn.h
@@ -1,4 +1,4 @@
-/* This file is legitimately included multiple times. */
+/* This file is intended to be included multiple times. */
 /*#ifndef __XEN_PERFC_DEFN_H__*/
 /*#define __XEN_PERFC_DEFN_H__*/
 
diff --git a/xen/include/asm-generic/perfc_defn.h b/xen/include/asm-generic/perfc_defn.h
index 8237636d83..726cddc1b3 100644
--- a/xen/include/asm-generic/perfc_defn.h
+++ b/xen/include/asm-generic/perfc_defn.h
@@ -1,4 +1,4 @@
-/* This file is legitimately included multiple times. */
+/* This file is intended to be included multiple times. */
 /* #ifndef ASM_GENERIC_PERFC_DEFN_H */
 /* #define ASM_GENERIC_PERFC_DEFN_H */
 
diff --git a/xen/include/xen/perfc_defn.h b/xen/include/xen/perfc_defn.h
index a987d80dd6..afbabad0b3 100644
--- a/xen/include/xen/perfc_defn.h
+++ b/xen/include/xen/perfc_defn.h
@@ -1,4 +1,4 @@
-/* This file is legitimately included multiple times. */
+/* This file is intended to be included multiple times. */
 /*#ifndef __XEN_PERFC_DEFN_H__*/
 /*#define __XEN_PERFC_DEFN_H__*/
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 22:33:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 22:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.909505.1316438 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ts89x-0007Bj-El; Tue, 11 Mar 2025 22:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 909505.1316438; Tue, 11 Mar 2025 22:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ts89x-0007Bc-Bh; Tue, 11 Mar 2025 22:33:13 +0000
Received: by outflank-mailman (input) for mailman id 909505;
 Tue, 11 Mar 2025 22:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ts89v-0007BR-To
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 22:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ts89w-00Ekmt-0P
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 22:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ts89v-005YiT-2m
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 22:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZlWIssnVqn/6ElYoCDH+jl3iPOxZ1iggDwFMpCHFh94=; b=3kvHLXRnJInsd6iHudmeNG0icU
	Qqci1pYE11aQkWogtNc1yVWGM3023SqcXm5Dv4WlZRXJh8qG31Any6SfeRZqmquSsyxOvf/Bu7xpA
	cF9ZPZ2+7a7LbdYdWM13iC+pGdYbyQQjIrBwwU+Z1Xtbs3XydYapoPUVbV5DCpILlaL0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: add explanation for 'Resolves:'
Message-Id: <E1ts89v-005YiT-2m@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 22:33:11 +0000

commit ec7a279a23462270bfda949bcd1bbaee1f81555d
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Tue Mar 11 07:28:26 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 11 22:30:10 2025 +0000

    docs: add explanation for 'Resolves:'
    
    'Resolves:' tag may be used if the patch addresses one of the tickets
    logged via Gitlab to auto-close such ticket when the patch got merged.
    
    Add documentation for the tag.
    
    Resolves: https://gitlab.com/xen-project/xen/-/issues/199
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/process/sending-patches.pandoc | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/docs/process/sending-patches.pandoc b/docs/process/sending-patches.pandoc
index 2e74c3b57e..1991932b68 100644
--- a/docs/process/sending-patches.pandoc
+++ b/docs/process/sending-patches.pandoc
@@ -106,6 +106,18 @@ If git was configured as explained earlier, this can be retrieved using
 ``git log --pretty=fixes`` otherwise ``git log --abbrev=12 --oneline`` will
 give the proper tag and commit-id.
 
+### Resolves:
+
+If your patch addresses an issue logged in a GitLab ticket, use the `Resolves:`
+tag followed by the issue link to automatically close the ticket when the patch
+is merged.
+
+    Resolves: <URL>
+
+E.g.:
+
+    Resolves: https://gitlab.com/xen-project/xen/-/issues/199
+
 ### Backport:
 
 A backport tag is an optional tag in the commit message to request a
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 23:44:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 23:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.909552.1316472 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ts9GW-0006c5-1B; Tue, 11 Mar 2025 23:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 909552.1316472; Tue, 11 Mar 2025 23:44:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ts9GV-0006by-UU; Tue, 11 Mar 2025 23:44:03 +0000
Received: by outflank-mailman (input) for mailman id 909552;
 Tue, 11 Mar 2025 23:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ts9GU-0006bs-Lq
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 23:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ts9GU-00EmF1-2G
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 23:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ts9GU-005eCH-1L
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 23:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ccEUkOUlzCh3Eu8AMVFDzUliCEMS01Ph+hFHQx29wcA=; b=0HgpO09uqMzhnErlIsnVHbK+Ic
	Y1BC3Uwp/NsvFK6UHe1gFTNLFX4jyE7RZGAUx0JFZ6ulsaxq/K+HREXDBnugKNF6ehPx9SN9RiD4O
	6tT53cq1dETuPKCmPI1H2q9EifizDDVEyAYr5iKTed9O1d4VCfF5C9AvMG+ogwRnKHAM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MISRA: Rephrase the deviation for Directive 4.10
Message-Id: <E1ts9GU-005eCH-1L@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 23:44:02 +0000

commit 87f8874fef4ac93998a15b5a63c183b898ffeb2a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 4 23:48:54 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 11 22:30:10 2025 +0000

    MISRA: Rephrase the deviation for Directive 4.10
    
    The use of "legitimately" mixes the concepts of "it was designed to do this"
    and "it was correct to do this".
    
    The latter in particular can go stale.  "intended" is a better way of phrasing
    this.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 2 +-
 xen/arch/arm/include/asm/perfc_defn.h            | 2 +-
 xen/arch/x86/include/asm/perfc_defn.h            | 2 +-
 xen/include/asm-generic/perfc_defn.h             | 2 +-
 xen/include/xen/perfc_defn.h                     | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index dfa5f34b39..2c8fb92713 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -74,7 +74,7 @@ they are not instances of commented-out code."
 
 -doc_begin="Files that are intended to be included more than once do not need to
 conform to the directive."
--config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"}
+-config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* This file is intended to be included multiple times\\. \\*/$, begin-4))"}
 -config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
 -config=MC3A2.D4.10,reports+={safe, "all_area(all_loc(file(^xen/include/generated/autoconf.h$)))"}
 -doc_end
diff --git a/xen/arch/arm/include/asm/perfc_defn.h b/xen/arch/arm/include/asm/perfc_defn.h
index 3ab0391175..effd25b69e 100644
--- a/xen/arch/arm/include/asm/perfc_defn.h
+++ b/xen/arch/arm/include/asm/perfc_defn.h
@@ -1,4 +1,4 @@
-/* This file is legitimately included multiple times. */
+/* This file is intended to be included multiple times. */
 /*#ifndef __XEN_PERFC_DEFN_H__*/
 /*#define __XEN_PERFC_DEFN_H__*/
 
diff --git a/xen/arch/x86/include/asm/perfc_defn.h b/xen/arch/x86/include/asm/perfc_defn.h
index 487e20dc97..d6127cb91e 100644
--- a/xen/arch/x86/include/asm/perfc_defn.h
+++ b/xen/arch/x86/include/asm/perfc_defn.h
@@ -1,4 +1,4 @@
-/* This file is legitimately included multiple times. */
+/* This file is intended to be included multiple times. */
 /*#ifndef __XEN_PERFC_DEFN_H__*/
 /*#define __XEN_PERFC_DEFN_H__*/
 
diff --git a/xen/include/asm-generic/perfc_defn.h b/xen/include/asm-generic/perfc_defn.h
index 8237636d83..726cddc1b3 100644
--- a/xen/include/asm-generic/perfc_defn.h
+++ b/xen/include/asm-generic/perfc_defn.h
@@ -1,4 +1,4 @@
-/* This file is legitimately included multiple times. */
+/* This file is intended to be included multiple times. */
 /* #ifndef ASM_GENERIC_PERFC_DEFN_H */
 /* #define ASM_GENERIC_PERFC_DEFN_H */
 
diff --git a/xen/include/xen/perfc_defn.h b/xen/include/xen/perfc_defn.h
index a987d80dd6..afbabad0b3 100644
--- a/xen/include/xen/perfc_defn.h
+++ b/xen/include/xen/perfc_defn.h
@@ -1,4 +1,4 @@
-/* This file is legitimately included multiple times. */
+/* This file is intended to be included multiple times. */
 /*#ifndef __XEN_PERFC_DEFN_H__*/
 /*#define __XEN_PERFC_DEFN_H__*/
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 11 23:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Mar 2025 23:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.909553.1316476 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ts9Gf-0006do-2f; Tue, 11 Mar 2025 23:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 909553.1316476; Tue, 11 Mar 2025 23:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ts9Gf-0006dg-01; Tue, 11 Mar 2025 23:44:13 +0000
Received: by outflank-mailman (input) for mailman id 909553;
 Tue, 11 Mar 2025 23:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ts9Ge-0006da-Ju
 for xen-changelog@lists.xenproject.org; Tue, 11 Mar 2025 23:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ts9Ge-00EmF5-2Z
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 23:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ts9Ge-005eDs-1f
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Mar 2025 23:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uITSBflyX/OoZiKLTsOjQMdusPGVfL4vG68nGhyfSoE=; b=oWQGOPf/EGL554J7xPQTWQkZJU
	VEvAp754RzzOrfcDRtyWRXcqGKqEGRBHr9N2yVkc98DpQ0ljo8x2CYvOrbT984yrHUha5B9wyNZEl
	laIudcicxJwQyk1IKdksOcwUXL8RA8kCjMJVvBWjA2fpAxl3iv9sxTk2cLZKieqttOBY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: add explanation for 'Resolves:'
Message-Id: <E1ts9Ge-005eDs-1f@xenbits.xenproject.org>
Date: Tue, 11 Mar 2025 23:44:12 +0000

commit ec7a279a23462270bfda949bcd1bbaee1f81555d
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Tue Mar 11 07:28:26 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Mar 11 22:30:10 2025 +0000

    docs: add explanation for 'Resolves:'
    
    'Resolves:' tag may be used if the patch addresses one of the tickets
    logged via Gitlab to auto-close such ticket when the patch got merged.
    
    Add documentation for the tag.
    
    Resolves: https://gitlab.com/xen-project/xen/-/issues/199
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/process/sending-patches.pandoc | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/docs/process/sending-patches.pandoc b/docs/process/sending-patches.pandoc
index 2e74c3b57e..1991932b68 100644
--- a/docs/process/sending-patches.pandoc
+++ b/docs/process/sending-patches.pandoc
@@ -106,6 +106,18 @@ If git was configured as explained earlier, this can be retrieved using
 ``git log --pretty=fixes`` otherwise ``git log --abbrev=12 --oneline`` will
 give the proper tag and commit-id.
 
+### Resolves:
+
+If your patch addresses an issue logged in a GitLab ticket, use the `Resolves:`
+tag followed by the issue link to automatically close the ticket when the patch
+is merged.
+
+    Resolves: <URL>
+
+E.g.:
+
+    Resolves: https://gitlab.com/xen-project/xen/-/issues/199
+
 ### Backport:
 
 A backport tag is an optional tag in the commit message to request a
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 09:33:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 09:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910129.1316895 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsISU-00072u-Li; Wed, 12 Mar 2025 09:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910129.1316895; Wed, 12 Mar 2025 09:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsISU-00072l-HT; Wed, 12 Mar 2025 09:33:02 +0000
Received: by outflank-mailman (input) for mailman id 910129;
 Wed, 12 Mar 2025 09:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsIST-00072f-Me
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 09:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsIST-00GNgO-2H
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 09:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsIST-006P6G-1J
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 09:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cqxQrA36T6LFnyQqT0KVOywZD+XQchx8mEqQhI7vgZA=; b=3zSAgS/MuBY0O+idWIjYAbu3lN
	PcKORBDxUe36C7MyeZHgHkdZB6AnoFhi2D2ZRtnt4ATl+Hne6qAchABl7xO5+RBxkFeU7UWxH44zd
	nf0A51mnesw2qeSiNZKPV3AWcMggs10675p10stllZkb1UI9TNCmFZywweamnlctyn5E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/IDT: Fix IDT generation for INT $0x80
Message-Id: <E1tsIST-006P6G-1J@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 09:33:01 +0000

commit 7323c93b2af24b3373f4934989988f8e47bb8ea4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 11 21:13:33 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 12 09:25:04 2025 +0000

    x86/IDT: Fix IDT generation for INT $0x80
    
    When PV is enabled, entry_int80 needs to be DPL3, not DPL0.
    
    This, combined with a QEMU bug which incorrectly calculates the error
    code (fix submitted separately), causes the XSA-259 PoC to fail with:
    
      --- Xen Test Framework ---
      Environment: PV 64bit (Long mode 4 levels)
      XSA-259 PoC
      Error: Unexpected fault 0x800d0802, #GP[IDT[256]]
      Test result: ERROR
    
    Fixes: 3da2149cf4dc ("x86/IDT: Generate bsp_idt[] at build time")
    Reported-by: Luca Fancellu <luca.fancellu@arm.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/gen-idt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/gen-idt.h b/xen/arch/x86/include/asm/gen-idt.h
index 9c8810edf9..d1da73248c 100644
--- a/xen/arch/x86/include/asm/gen-idt.h
+++ b/xen/arch/x86/include/asm/gen-idt.h
@@ -77,7 +77,7 @@ GEN16(6);
 GEN16(7);
 
 #ifdef CONFIG_PV
-GEN(0x80, entry_int80,      DPL0, manual);
+GEN(0x80, entry_int80,      DPL3, manual);
 #else
 GEN(0x80, entry_0x80,       DPL0, autogen);
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 10:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 10:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910241.1316977 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsJjr-0004NJ-4b; Wed, 12 Mar 2025 10:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910241.1316977; Wed, 12 Mar 2025 10:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsJjr-0004NB-20; Wed, 12 Mar 2025 10:55:03 +0000
Received: by outflank-mailman (input) for mailman id 910241;
 Wed, 12 Mar 2025 10:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsJjq-0004N5-Gx
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 10:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsJjq-00GPIB-1P
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 10:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsJjq-006Wp2-0H
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 10:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OUgU0UVtA0SpQYzcjCpgY3IrkgZOepJs37NbYbfIBwc=; b=VHd7JYYdL+wfF5RwX19QWgG7UX
	T84QzcGjrWWRiXPbBayZ98JhVEzSNN0ZfKR2CsaJ9ByyhJYquD+xwxX7QtqO9LZ+vPP8095s2wbB8
	qIC2wOmnA7LDJpGkHiZNrkcDczAT8qp3PY2cHXFY9SW4DK+Cv4uA4lo+93Ae9zUdV1Dw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/IDT: Fix IDT generation for INT $0x80
Message-Id: <E1tsJjq-006Wp2-0H@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 10:55:02 +0000

commit 7323c93b2af24b3373f4934989988f8e47bb8ea4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 11 21:13:33 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 12 09:25:04 2025 +0000

    x86/IDT: Fix IDT generation for INT $0x80
    
    When PV is enabled, entry_int80 needs to be DPL3, not DPL0.
    
    This, combined with a QEMU bug which incorrectly calculates the error
    code (fix submitted separately), causes the XSA-259 PoC to fail with:
    
      --- Xen Test Framework ---
      Environment: PV 64bit (Long mode 4 levels)
      XSA-259 PoC
      Error: Unexpected fault 0x800d0802, #GP[IDT[256]]
      Test result: ERROR
    
    Fixes: 3da2149cf4dc ("x86/IDT: Generate bsp_idt[] at build time")
    Reported-by: Luca Fancellu <luca.fancellu@arm.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/gen-idt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/gen-idt.h b/xen/arch/x86/include/asm/gen-idt.h
index 9c8810edf9..d1da73248c 100644
--- a/xen/arch/x86/include/asm/gen-idt.h
+++ b/xen/arch/x86/include/asm/gen-idt.h
@@ -77,7 +77,7 @@ GEN16(6);
 GEN16(7);
 
 #ifdef CONFIG_PV
-GEN(0x80, entry_int80,      DPL0, manual);
+GEN(0x80, entry_int80,      DPL3, manual);
 #else
 GEN(0x80, entry_0x80,       DPL0, autogen);
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 12:44:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 12:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910306.1317021 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsLRK-0001Ba-HZ; Wed, 12 Mar 2025 12:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910306.1317021; Wed, 12 Mar 2025 12:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsLRK-0001BS-F0; Wed, 12 Mar 2025 12:44:02 +0000
Received: by outflank-mailman (input) for mailman id 910306;
 Wed, 12 Mar 2025 12:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsLRJ-0001BM-QP
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 12:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsLRJ-00GRLx-2k
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 12:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsLRJ-006gsf-1l
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 12:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4dXKoiqIORTsqdxReiJ/N5fz/dAPRUuhAjLeoVkTE7E=; b=F4jBGo1g5r3vkjTyHr8KeF4Tai
	e5NKUfXw66lalf+zA0eNBiW+MWs26xBY9CTy3yavm6q2TV9/faUitJ0c4/j1wOZINpSgCGD5pM74C
	S/M3GXYIFI8g5E95AopUVI3X3DX+fdfGA6Zmt5+QnAL4h/t6LEzZu64zSKwxJei0YtDA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
Message-Id: <E1tsLRJ-006gsf-1l@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 12:44:01 +0000

commit b4071d28c5bd9ca4fed76031cbf0e782b74209b9
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Feb 21 12:34:49 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 12 13:32:30 2025 +0100

    x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
    
    The MMIO_CONF_BASE reports the base of the MCFG range on AMD systems.
    Linux pre-6.14 is unconditionally attempting to read the MSR without a
    safe MSR accessor, and since Xen doesn't allow access to it Linux reports
    the following error:
    
    unchecked MSR access error: RDMSR from 0xc0010058 at rIP: 0xffffffff8101d19f (xen_do_read_msr+0x7f/0xa0)
    Call Trace:
     xen_read_msr+0x1e/0x30
     amd_get_mmconfig_range+0x2b/0x80
     quirk_amd_mmconfig_area+0x28/0x100
     pnp_fixup_device+0x39/0x50
     __pnp_add_device+0xf/0x150
     pnp_add_device+0x3d/0x100
     pnpacpi_add_device_handler+0x1f9/0x280
     acpi_ns_get_device_callback+0x104/0x1c0
     acpi_ns_walk_namespace+0x1d0/0x260
     acpi_get_devices+0x8a/0xb0
     pnpacpi_init+0x50/0x80
     do_one_initcall+0x46/0x2e0
     kernel_init_freeable+0x1da/0x2f0
     kernel_init+0x16/0x1b0
     ret_from_fork+0x30/0x50
     ret_from_fork_asm+0x1b/0x30
    
    Such access is conditional to the presence of a device with PnP ID
    "PNP0c01", which triggers the execution of the quirk_amd_mmconfig_area()
    function.  Note that prior to commit 3fac3734c43a MSR accesses when running
    as a PV guest would always use the safe variant, and thus silently handle
    the #GP.
    
    Fix by allowing access to the MSR on AMD systems for the hardware domain.
    
    Write attempts to the MSR will still result in #GP for all domain types.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 1550fd9ec9..2cd46b6c8a 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -318,6 +318,14 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = 0;
         break;
 
+    case MSR_FAM10H_MMIO_CONF_BASE:
+        if ( !is_hardware_domain(d) ||
+             !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ||
+             rdmsr_safe(msr, *val) )
+            goto gp_fault;
+
+        break;
+
     case MSR_VIRT_SPEC_CTRL:
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 12:44:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 12:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910307.1317024 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsLRU-0001Df-J0; Wed, 12 Mar 2025 12:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910307.1317024; Wed, 12 Mar 2025 12:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsLRU-0001DX-GO; Wed, 12 Mar 2025 12:44:12 +0000
Received: by outflank-mailman (input) for mailman id 910307;
 Wed, 12 Mar 2025 12:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsLRT-0001DN-O9
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 12:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsLRT-00GRM4-33
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 12:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsLRT-006gtn-2B
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 12:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hRdHRZsITb541Zj0169BR6FNeKBq3iVpXSR1Q3AalG8=; b=x5vxHCHYNMVIIsP8TMSiX53ovz
	7+KKMAW3Wcqcu49sSnUNwfJRJao6OeKmizNDuMLVoKpkjhLqlMPfFbp08Gf/GIHh7550Xuz+4zPos
	ZM0STV2qD/G2m9fiaAoHm3pYxGptwc2Vw1uZQx30SQbm2aA67j2sxfy5MaxyOHYskdZQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/page_alloc: Simplify domain_adjust_tot_pages
Message-Id: <E1tsLRT-006gtn-2B@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 12:44:11 +0000

commit 3472783c266e52f630f29f0277b86c4dc24d9054
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Tue Mar 4 11:10:00 2025 +0000
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 12 13:32:30 2025 +0100

    xen/page_alloc: Simplify domain_adjust_tot_pages
    
    The logic has too many levels of indirection and it's very hard to
    understand it its current form. Split it between the corner case where
    the adjustment is bigger than the current claim and the rest to avoid 5
    auxiliary variables.
    
    Add a functional change to prevent negative adjustments from
    re-increasing the claim. This has the nice side effect of avoiding
    taking the heap lock here on every free.
    
    While at it, fix incorrect field name in nearby comment.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/page_alloc.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1bf070c8c5..5f9c9305ef 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -490,31 +490,30 @@ static long outstanding_claims; /* total outstanding claims by all domains */
 
 unsigned long domain_adjust_tot_pages(struct domain *d, long pages)
 {
-    long dom_before, dom_after, dom_claimed, sys_before, sys_after;
-
     ASSERT(rspin_is_locked(&d->page_alloc_lock));
     d->tot_pages += pages;
 
     /*
-     * can test d->claimed_pages race-free because it can only change
+     * can test d->outstanding_pages race-free because it can only change
      * if d->page_alloc_lock and heap_lock are both held, see also
      * domain_set_outstanding_pages below
      */
-    if ( !d->outstanding_pages )
+    if ( !d->outstanding_pages || pages <= 0 )
         goto out;
 
     spin_lock(&heap_lock);
-    /* adjust domain outstanding pages; may not go negative */
-    dom_before = d->outstanding_pages;
-    dom_after = dom_before - pages;
-    BUG_ON(dom_before < 0);
-    dom_claimed = dom_after < 0 ? 0 : dom_after;
-    d->outstanding_pages = dom_claimed;
-    /* flag accounting bug if system outstanding_claims would go negative */
-    sys_before = outstanding_claims;
-    sys_after = sys_before - (dom_before - dom_claimed);
-    BUG_ON(sys_after < 0);
-    outstanding_claims = sys_after;
+    BUG_ON(outstanding_claims < d->outstanding_pages);
+    if ( d->outstanding_pages < pages )
+    {
+        /* `pages` exceeds the domain's outstanding count. Zero it out. */
+        outstanding_claims -= d->outstanding_pages;
+        d->outstanding_pages = 0;
+    }
+    else
+    {
+        outstanding_claims -= pages;
+        d->outstanding_pages -= pages;
+    }
     spin_unlock(&heap_lock);
 
 out:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 12:44:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 12:44:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910308.1317029 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsLRe-0001GK-Kb; Wed, 12 Mar 2025 12:44:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910308.1317029; Wed, 12 Mar 2025 12:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsLRe-0001GB-Ho; Wed, 12 Mar 2025 12:44:22 +0000
Received: by outflank-mailman (input) for mailman id 910308;
 Wed, 12 Mar 2025 12:44:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsLRd-0001G0-Ra
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 12:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsLRe-00GRM8-0B
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 12:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsLRd-006guW-2V
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 12:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Y4JQqRcpg6vSXcKtXWguuhtwz7R8dvbKSopQjC+O6rA=; b=ffV9GqU5j4WlT90Kg3oGGx6gHi
	8jh8HWpTk/McVvbsI88NLZzgxYWVwmo7s/OzB2vUm+7eQUEtrJvqHzl1SjTbMizJrDre/V9VJ97Am
	4u9ZrZ4FhFEvXtYlwrcKo9yYDkYTfNd8CljkdyhfygwDfUyBMWFx/AGvHJZjlSUdxo38=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vmx: fix posted interrupts usage of msi_desc->msg field
Message-Id: <E1tsLRd-006guW-2V@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 12:44:21 +0000

commit 30f0e55a79206702b4e82e86dad6b35033157858
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 10 16:49:29 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 12 13:32:30 2025 +0100

    x86/vmx: fix posted interrupts usage of msi_desc->msg field
    
    The current usage of msi_desc->msg in vmx_pi_update_irte() will make the
    field contain a translated MSI message, instead of the expected
    untranslated one.  This breaks dump_msi(), that use the data in
    msi_desc->msg to print the interrupt details.
    
    Fix this by introducing a dummy local msi_msg, and use it with
    iommu_update_ire_from_msi().  vmx_pi_update_irte() relies on the MSI
    message not changing, so there's no need to propagate the resulting msi_msg
    to the hardware, and the contents can be ignored.
    
    Additionally add a comment to clarify that msi_desc->msg must always
    contain the untranslated MSI message.
    
    Fixes: a5e25908d18d ('VT-d: introduce new fields in msi_desc to track binding with guest interrupt')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vmx/vmx.c     | 4 +++-
 xen/arch/x86/include/asm/msi.h | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 0241303b4b..23b7ecd77f 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -396,6 +396,7 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     const struct pi_desc *pi_desc = v ? &v->arch.hvm.vmx.pi_desc : NULL;
     struct irq_desc *desc;
     struct msi_desc *msi_desc;
+    struct msi_msg msg;
     int rc;
 
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -410,12 +411,13 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     }
     msi_desc->pi_desc = pi_desc;
     msi_desc->gvec = gvec;
+    msg = msi_desc->msg;
 
     spin_unlock_irq(&desc->lock);
 
     ASSERT_PDEV_LIST_IS_READ_LOCKED(msi_desc->dev->domain);
 
-    return iommu_update_ire_from_msi(msi_desc, &msi_desc->msg);
+    return iommu_update_ire_from_msi(msi_desc, &msg);
 
  unlock_out:
     spin_unlock_irq(&desc->lock);
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 378b85ee94..975d0f26b3 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -124,7 +124,7 @@ struct msi_desc {
     int irq;
     int remap_index;         /* index in interrupt remapping table */
 
-    struct msi_msg msg;      /* Last set MSI message */
+    struct msi_msg msg;      /* Last set MSI message (untranslated) */
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 12:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 12:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910309.1317033 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsLRp-0001Iq-Lp; Wed, 12 Mar 2025 12:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910309.1317033; Wed, 12 Mar 2025 12:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsLRp-0001Ii-JF; Wed, 12 Mar 2025 12:44:33 +0000
Received: by outflank-mailman (input) for mailman id 910309;
 Wed, 12 Mar 2025 12:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsLRn-0001IT-Vb
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 12:44:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsLRo-00GRMD-0V
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 12:44:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsLRn-006gxE-2p
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 12:44:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0+f9YGpCBS6Ns9blniN6VaN4aO/hUK9ZhWtCBd75jlU=; b=oMXfBKmVdeqQkOpAf73Zs1eCB3
	6FtrHGg+HJr3Mm8KPcm12EdqICaQK9iSSf5TQq2xgHTrV3K+RzLhR9cY7J9tb7IgS3sm0fL3/LTnd
	lwMXp2XlTUAxmFUxmNShMV1b5WJxVcFsv6CaaK/ZD6YBtqPGT6Glm2RpFMxtdWcLcqsY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: check return code of hvm_pi_update_irte when binding
Message-Id: <E1tsLRn-006gxE-2p@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 12:44:31 +0000

commit cb587f620ab56cc683347d8120ba63989fad2693
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 10 18:13:52 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 12 13:32:31 2025 +0100

    x86/hvm: check return code of hvm_pi_update_irte when binding
    
    Consume the return code from hvm_pi_update_irte(), and propagate the error
    back to the caller if hvm_pi_update_irte() fails.
    
    Fixes: 35a1caf8b6b5 ('pass-through: update IRTE according to guest interrupt config changes')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/x86/hvm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index f5faff7a49..47de6953fd 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -381,7 +381,15 @@ int pt_irq_create_bind(
 
         /* Use interrupt posting if it is supported. */
         if ( iommu_intpost )
-            hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+        {
+            rc = hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+
+            if ( rc )
+            {
+                pt_irq_destroy_bind(d, pt_irq_bind);
+                return rc;
+            }
+        }
 
         if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 12:44:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 12:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910310.1317038 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsLRz-0001LA-O1; Wed, 12 Mar 2025 12:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910310.1317038; Wed, 12 Mar 2025 12:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsLRz-0001L2-Kc; Wed, 12 Mar 2025 12:44:43 +0000
Received: by outflank-mailman (input) for mailman id 910310;
 Wed, 12 Mar 2025 12:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsLRy-0001Km-2V
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 12:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsLRy-00GRMJ-0t
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 12:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsLRx-006gyD-3D
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 12:44:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VtXIpieRWGXfEpXsEC5/NQt/xF3WczK1wzlvwx9WPR8=; b=ydFE8tAHooBXZGyATK1f3bzqy3
	b6DEswavMlBJ///liFFXMK5cwBGkupaKfpdNm+HTm5LyUKwqh9+mAhOgsj6B5FOpTWakEa+Ai6FPa
	BPwHLwj4iY4VEtfRcXPMY3kEvOcgfVQa3r4if8cYFqNxlvvNLbZvnmSbvdoVwtgW/LGo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/iommu: avoid MSI address and data writes if IRT index hasn't changed
Message-Id: <E1tsLRx-006gyD-3D@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 12:44:41 +0000

commit 8e60d47cf0112c145b6b0e454d102b04c857db8c
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 7 10:16:01 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 12 13:32:31 2025 +0100

    x86/iommu: avoid MSI address and data writes if IRT index hasn't changed
    
    Attempt to reduce the MSI entry writes, and the associated checking whether
    memory decoding and MSI-X is enabled for the PCI device, when the MSI data
    hasn't changed.
    
    When using Interrupt Remapping the MSI entry will contain an index into
    the remapping table, and it's in such remapping table where the MSI vector
    and destination CPU is stored.  As such, when using interrupt remapping,
    changes to the interrupt affinity shouldn't result in changes to the MSI
    entry, and the MSI entry update can be avoided.
    
    Signal from the IOMMU update_ire_from_msi hook whether the MSI data or
    address fields have changed, and thus need writing to the device registers.
    Such signaling is done by returning 1 from the function.  Otherwise
    returning 0 means no update of the MSI fields, and thus no write
    required.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hpet.c                      |  6 +++++-
 xen/arch/x86/hvm/vmx/vmx.c               | 13 ++++++++++++-
 xen/arch/x86/msi.c                       | 11 ++++++-----
 xen/drivers/passthrough/amd/iommu_intr.c |  4 ++--
 xen/drivers/passthrough/vtd/intremap.c   |  4 +++-
 xen/include/xen/iommu.h                  |  6 ++++++
 6 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 51ff7f12f5..1bca8c8b67 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -283,8 +283,12 @@ static int hpet_msi_write(struct hpet_event_channel *ch, struct msi_msg *msg)
     {
         int rc = iommu_update_ire_from_msi(&ch->msi, msg);
 
-        if ( rc )
+        if ( rc < 0 )
             return rc;
+        /*
+         * Always propagate writes, to avoid having to pass a flag for handling
+         * a forceful write in the resume from suspension case.
+         */
     }
 
     hpet_write32(msg->data, HPET_Tn_ROUTE(ch->idx));
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 23b7ecd77f..4883bd823d 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -417,7 +417,18 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
 
     ASSERT_PDEV_LIST_IS_READ_LOCKED(msi_desc->dev->domain);
 
-    return iommu_update_ire_from_msi(msi_desc, &msg);
+    rc = iommu_update_ire_from_msi(msi_desc, &msg);
+    if ( rc > 0 )
+    {
+        /*
+         * Callers of vmx_pi_update_irte() won't propagate the updated MSI
+         * fields to the hardware, must assert there are no changes.
+         */
+        ASSERT_UNREACHABLE();
+        rc = -EILSEQ;
+    }
+
+    return rc;
 
  unlock_out:
     spin_unlock_irq(&desc->lock);
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 6c11d76015..163ccf8747 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -184,7 +184,8 @@ void msi_compose_msg(unsigned vector, const cpumask_t *cpu_mask, struct msi_msg
                 MSI_DATA_VECTOR(vector);
 }
 
-static int write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
+static int write_msi_msg(struct msi_desc *entry, struct msi_msg *msg,
+                         bool force)
 {
     entry->msg = *msg;
 
@@ -194,7 +195,7 @@ static int write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
 
         ASSERT(msg != &entry->msg);
         rc = iommu_update_ire_from_msi(entry, msg);
-        if ( rc )
+        if ( rc < 0 || (rc == 0 && !force) )
             return rc;
     }
 
@@ -259,7 +260,7 @@ void cf_check set_msi_affinity(struct irq_desc *desc, const cpumask_t *mask)
     msg.address_lo |= MSI_ADDR_DEST_ID(dest);
     msg.dest32 = dest;
 
-    write_msi_msg(msi_desc, &msg);
+    write_msi_msg(msi_desc, &msg, false);
 }
 
 void __msi_set_enable(pci_sbdf_t sbdf, int pos, int enable)
@@ -522,7 +523,7 @@ int __setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc,
     desc->msi_desc = msidesc;
     desc->handler = handler;
     msi_compose_msg(desc->arch.vector, desc->arch.cpu_mask, &msg);
-    ret = write_msi_msg(msidesc, &msg);
+    ret = write_msi_msg(msidesc, &msg, false);
     if ( unlikely(ret) )
     {
         desc->handler = &no_irq_type;
@@ -1403,7 +1404,7 @@ int pci_restore_msi_state(struct pci_dev *pdev)
         type = entry->msi_attrib.type;
 
         msg = entry->msg;
-        write_msi_msg(entry, &msg);
+        write_msi_msg(entry, &msg, true);
 
         for ( i = 0; ; )
         {
diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index c0273059cb..9abdc38053 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -492,7 +492,7 @@ static int update_intremap_entry_from_msi_msg(
                get_ivrs_mappings(iommu->seg)[alias_id].intremap_table);
     }
 
-    return 0;
+    return fresh;
 }
 
 static struct amd_iommu *_find_iommu_for_device(int seg, int bdf)
@@ -546,7 +546,7 @@ int cf_check amd_iommu_msi_msg_update_ire(
     rc = update_intremap_entry_from_msi_msg(iommu, bdf, nr,
                                             &msi_desc->remap_index,
                                             msg, &data);
-    if ( !rc )
+    if ( rc > 0 )
     {
         for ( i = 1; i < nr; ++i )
             msi_desc[i].remap_index = msi_desc->remap_index + i;
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 1aeaeb5ec5..b3b53518e2 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -506,6 +506,7 @@ static int msi_msg_to_remap_entry(
     unsigned int index, i, nr = 1;
     unsigned long flags;
     const struct pi_desc *pi_desc = msi_desc->pi_desc;
+    bool alloc = false;
 
     if ( msi_desc->msi_attrib.type == PCI_CAP_ID_MSI )
         nr = msi_desc->msi.nvec;
@@ -529,6 +530,7 @@ static int msi_msg_to_remap_entry(
         index = alloc_remap_entry(iommu, nr);
         for ( i = 0; i < nr; ++i )
             msi_desc[i].remap_index = index + i;
+        alloc = true;
     }
     else
         index = msi_desc->remap_index;
@@ -601,7 +603,7 @@ static int msi_msg_to_remap_entry(
     unmap_vtd_domain_page(iremap_entries);
     spin_unlock_irqrestore(&iommu->intremap.lock, flags);
 
-    return 0;
+    return alloc;
 }
 
 int cf_check msi_msg_write_remap_rte(
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 77a514019c..984f0735d4 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -435,6 +435,12 @@ extern struct page_list_head iommu_pt_cleanup_list;
 bool arch_iommu_use_permitted(const struct domain *d);
 
 #ifdef CONFIG_X86
+/*
+ * Return values:
+ *  - < 0 on error.
+ *  - 0 on success and no need to write msi_msg to the hardware.
+ *  - 1 on success and msi_msg must be propagated to the hardware.
+ */
 static inline int iommu_update_ire_from_msi(
     struct msi_desc *msi_desc, struct msi_msg *msg)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 13:44:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 13:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910330.1317054 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsMNP-0005cU-Ub; Wed, 12 Mar 2025 13:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910330.1317054; Wed, 12 Mar 2025 13:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsMNP-0005cM-Rr; Wed, 12 Mar 2025 13:44:03 +0000
Received: by outflank-mailman (input) for mailman id 910330;
 Wed, 12 Mar 2025 13:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsMNO-0005bx-I3
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 13:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsMNO-00GSYu-20
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 13:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsMNO-006mVU-15
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 13:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zvUJtTiZcGx/JYRhbfUJc9EIdeRPUF6GWRHD63uNrK0=; b=GB+tSBNh/qy0pmsABeiR2DYjyA
	ukVDsxLWqZwfFOAMeSvJZQopCGy2fBGuZjNssPiPHdI1hv5AQ3eaBJ2gpseL1nTutEwta7ezJzsSB
	vyN+UFx0ssm4Z3LcWv/SxoFDqM/E7CRrrAH07T7SnpnGIRRNYs+96bls6FEzzydH+wgk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
Message-Id: <E1tsMNO-006mVU-15@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 13:44:02 +0000

commit b4071d28c5bd9ca4fed76031cbf0e782b74209b9
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Feb 21 12:34:49 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 12 13:32:30 2025 +0100

    x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
    
    The MMIO_CONF_BASE reports the base of the MCFG range on AMD systems.
    Linux pre-6.14 is unconditionally attempting to read the MSR without a
    safe MSR accessor, and since Xen doesn't allow access to it Linux reports
    the following error:
    
    unchecked MSR access error: RDMSR from 0xc0010058 at rIP: 0xffffffff8101d19f (xen_do_read_msr+0x7f/0xa0)
    Call Trace:
     xen_read_msr+0x1e/0x30
     amd_get_mmconfig_range+0x2b/0x80
     quirk_amd_mmconfig_area+0x28/0x100
     pnp_fixup_device+0x39/0x50
     __pnp_add_device+0xf/0x150
     pnp_add_device+0x3d/0x100
     pnpacpi_add_device_handler+0x1f9/0x280
     acpi_ns_get_device_callback+0x104/0x1c0
     acpi_ns_walk_namespace+0x1d0/0x260
     acpi_get_devices+0x8a/0xb0
     pnpacpi_init+0x50/0x80
     do_one_initcall+0x46/0x2e0
     kernel_init_freeable+0x1da/0x2f0
     kernel_init+0x16/0x1b0
     ret_from_fork+0x30/0x50
     ret_from_fork_asm+0x1b/0x30
    
    Such access is conditional to the presence of a device with PnP ID
    "PNP0c01", which triggers the execution of the quirk_amd_mmconfig_area()
    function.  Note that prior to commit 3fac3734c43a MSR accesses when running
    as a PV guest would always use the safe variant, and thus silently handle
    the #GP.
    
    Fix by allowing access to the MSR on AMD systems for the hardware domain.
    
    Write attempts to the MSR will still result in #GP for all domain types.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 1550fd9ec9..2cd46b6c8a 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -318,6 +318,14 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = 0;
         break;
 
+    case MSR_FAM10H_MMIO_CONF_BASE:
+        if ( !is_hardware_domain(d) ||
+             !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ||
+             rdmsr_safe(msr, *val) )
+            goto gp_fault;
+
+        break;
+
     case MSR_VIRT_SPEC_CTRL:
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 13:44:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 13:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910331.1317058 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsMNa-0005ep-0s; Wed, 12 Mar 2025 13:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910331.1317058; Wed, 12 Mar 2025 13:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsMNZ-0005eh-UZ; Wed, 12 Mar 2025 13:44:13 +0000
Received: by outflank-mailman (input) for mailman id 910331;
 Wed, 12 Mar 2025 13:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsMNY-0005eV-Gg
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 13:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsMNY-00GSYy-2K
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 13:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsMNY-006mWD-1R
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 13:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4MZapLcx3FMc5NdbJ4PVD+ISpRrdJKDLq7jYsTx3Nt4=; b=DIaJbOp/RoDdAxTF6jjm92+/g5
	ciDttVAV9lQNdVga/1xwJPHdgLJx0pGJPUttNOsRylvTw964HjO6q5R8cfRYYRPH3oUtPwHOp/Yzd
	hjkr6XKrE89ZCsjezF+c5Pyhxf1vSwSvs1VLvqwVoQEtjIvVSJ7FRljdfHTrB+7EbX3c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/page_alloc: Simplify domain_adjust_tot_pages
Message-Id: <E1tsMNY-006mWD-1R@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 13:44:12 +0000

commit 3472783c266e52f630f29f0277b86c4dc24d9054
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Tue Mar 4 11:10:00 2025 +0000
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 12 13:32:30 2025 +0100

    xen/page_alloc: Simplify domain_adjust_tot_pages
    
    The logic has too many levels of indirection and it's very hard to
    understand it its current form. Split it between the corner case where
    the adjustment is bigger than the current claim and the rest to avoid 5
    auxiliary variables.
    
    Add a functional change to prevent negative adjustments from
    re-increasing the claim. This has the nice side effect of avoiding
    taking the heap lock here on every free.
    
    While at it, fix incorrect field name in nearby comment.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/page_alloc.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1bf070c8c5..5f9c9305ef 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -490,31 +490,30 @@ static long outstanding_claims; /* total outstanding claims by all domains */
 
 unsigned long domain_adjust_tot_pages(struct domain *d, long pages)
 {
-    long dom_before, dom_after, dom_claimed, sys_before, sys_after;
-
     ASSERT(rspin_is_locked(&d->page_alloc_lock));
     d->tot_pages += pages;
 
     /*
-     * can test d->claimed_pages race-free because it can only change
+     * can test d->outstanding_pages race-free because it can only change
      * if d->page_alloc_lock and heap_lock are both held, see also
      * domain_set_outstanding_pages below
      */
-    if ( !d->outstanding_pages )
+    if ( !d->outstanding_pages || pages <= 0 )
         goto out;
 
     spin_lock(&heap_lock);
-    /* adjust domain outstanding pages; may not go negative */
-    dom_before = d->outstanding_pages;
-    dom_after = dom_before - pages;
-    BUG_ON(dom_before < 0);
-    dom_claimed = dom_after < 0 ? 0 : dom_after;
-    d->outstanding_pages = dom_claimed;
-    /* flag accounting bug if system outstanding_claims would go negative */
-    sys_before = outstanding_claims;
-    sys_after = sys_before - (dom_before - dom_claimed);
-    BUG_ON(sys_after < 0);
-    outstanding_claims = sys_after;
+    BUG_ON(outstanding_claims < d->outstanding_pages);
+    if ( d->outstanding_pages < pages )
+    {
+        /* `pages` exceeds the domain's outstanding count. Zero it out. */
+        outstanding_claims -= d->outstanding_pages;
+        d->outstanding_pages = 0;
+    }
+    else
+    {
+        outstanding_claims -= pages;
+        d->outstanding_pages -= pages;
+    }
     spin_unlock(&heap_lock);
 
 out:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 13:44:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 13:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910332.1317062 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsMNk-0005hu-2J; Wed, 12 Mar 2025 13:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910332.1317062; Wed, 12 Mar 2025 13:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsMNj-0005hm-W2; Wed, 12 Mar 2025 13:44:23 +0000
Received: by outflank-mailman (input) for mailman id 910332;
 Wed, 12 Mar 2025 13:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsMNi-0005hW-LB
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 13:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsMNi-00GSZ4-2k
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 13:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsMNi-006mWs-1l
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 13:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ss+aKSK0lwReUVvds7ARPTweL2s+pmHmIsSw3pwqX5w=; b=t/l0GiWfW+SZ5cbw1VNjhbarKh
	Cp91AsOH5oe9U5JjhkG7fEo6BjYP7P2vZHVNZShWlP/pZMlb8uxpa3w53PBj0UvAwtiGABJtWwiG6
	sBC75OuDlSHtjHqtIk0d+gLiYPjDvk6VSF7nUJA2duPKprjg07TOj6LxLipsz7ksYnK8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: fix posted interrupts usage of msi_desc->msg field
Message-Id: <E1tsMNi-006mWs-1l@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 13:44:22 +0000

commit 30f0e55a79206702b4e82e86dad6b35033157858
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 10 16:49:29 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 12 13:32:30 2025 +0100

    x86/vmx: fix posted interrupts usage of msi_desc->msg field
    
    The current usage of msi_desc->msg in vmx_pi_update_irte() will make the
    field contain a translated MSI message, instead of the expected
    untranslated one.  This breaks dump_msi(), that use the data in
    msi_desc->msg to print the interrupt details.
    
    Fix this by introducing a dummy local msi_msg, and use it with
    iommu_update_ire_from_msi().  vmx_pi_update_irte() relies on the MSI
    message not changing, so there's no need to propagate the resulting msi_msg
    to the hardware, and the contents can be ignored.
    
    Additionally add a comment to clarify that msi_desc->msg must always
    contain the untranslated MSI message.
    
    Fixes: a5e25908d18d ('VT-d: introduce new fields in msi_desc to track binding with guest interrupt')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vmx/vmx.c     | 4 +++-
 xen/arch/x86/include/asm/msi.h | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 0241303b4b..23b7ecd77f 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -396,6 +396,7 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     const struct pi_desc *pi_desc = v ? &v->arch.hvm.vmx.pi_desc : NULL;
     struct irq_desc *desc;
     struct msi_desc *msi_desc;
+    struct msi_msg msg;
     int rc;
 
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -410,12 +411,13 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     }
     msi_desc->pi_desc = pi_desc;
     msi_desc->gvec = gvec;
+    msg = msi_desc->msg;
 
     spin_unlock_irq(&desc->lock);
 
     ASSERT_PDEV_LIST_IS_READ_LOCKED(msi_desc->dev->domain);
 
-    return iommu_update_ire_from_msi(msi_desc, &msi_desc->msg);
+    return iommu_update_ire_from_msi(msi_desc, &msg);
 
  unlock_out:
     spin_unlock_irq(&desc->lock);
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 378b85ee94..975d0f26b3 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -124,7 +124,7 @@ struct msi_desc {
     int irq;
     int remap_index;         /* index in interrupt remapping table */
 
-    struct msi_msg msg;      /* Last set MSI message */
+    struct msi_msg msg;      /* Last set MSI message (untranslated) */
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 13:44:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 13:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910333.1317066 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsMNu-0005ko-3l; Wed, 12 Mar 2025 13:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910333.1317066; Wed, 12 Mar 2025 13:44:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsMNu-0005kg-19; Wed, 12 Mar 2025 13:44:34 +0000
Received: by outflank-mailman (input) for mailman id 910333;
 Wed, 12 Mar 2025 13:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsMNs-0005kP-O0
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 13:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsMNs-00GSZC-33
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 13:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsMNs-006mXV-2A
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 13:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=11N8/PwR96LojcSq5At/zBWqDnj5kDzFUMqsBx5xxgM=; b=LKVoril04fTtVMucoIOKWVbCCV
	4ISbXluvzukUWJoJa/sN6qak0YJfS3YU15dQOYTu24sBORdCj9UcqKV7dm3GZzBdsQdHeMCRnwNqG
	JeMVn9J+DKhgk8DLjZoG2x5ehszgHxb22JnT2JsEgWfbmTODx6/PnojSNn8Eo3cWU8U8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: check return code of hvm_pi_update_irte when binding
Message-Id: <E1tsMNs-006mXV-2A@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 13:44:32 +0000

commit cb587f620ab56cc683347d8120ba63989fad2693
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 10 18:13:52 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 12 13:32:31 2025 +0100

    x86/hvm: check return code of hvm_pi_update_irte when binding
    
    Consume the return code from hvm_pi_update_irte(), and propagate the error
    back to the caller if hvm_pi_update_irte() fails.
    
    Fixes: 35a1caf8b6b5 ('pass-through: update IRTE according to guest interrupt config changes')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/x86/hvm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index f5faff7a49..47de6953fd 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -381,7 +381,15 @@ int pt_irq_create_bind(
 
         /* Use interrupt posting if it is supported. */
         if ( iommu_intpost )
-            hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+        {
+            rc = hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+
+            if ( rc )
+            {
+                pt_irq_destroy_bind(d, pt_irq_bind);
+                return rc;
+            }
+        }
 
         if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 13:44:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 13:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910334.1317070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsMO4-0005nF-5X; Wed, 12 Mar 2025 13:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910334.1317070; Wed, 12 Mar 2025 13:44:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsMO4-0005n6-2l; Wed, 12 Mar 2025 13:44:44 +0000
Received: by outflank-mailman (input) for mailman id 910334;
 Wed, 12 Mar 2025 13:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsMO2-0005mv-RB
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 13:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsMO3-00GSZI-0A
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 13:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsMO2-006mXy-2W
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 13:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7zSAcLBxVPgfgyFFl+tTbaDzzFoywdNu4QIdDFXZnTs=; b=w6wV10fgtzv0z/pC0iS62QKW+C
	6Pr8SuR00JiUF54i/E/cIlVG8D1eEFy+b+PthQw3xflemy0f06kbP1kYdMNxjG+Y7fdZjxBWc4UUh
	nkgPA9MU6p4MVsj+41+hyfsaHh3/eNXFOFf85XtpHGyq7dnS5PheSGnVVYw60UaxOu3g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/iommu: avoid MSI address and data writes if IRT index hasn't changed
Message-Id: <E1tsMO2-006mXy-2W@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 13:44:42 +0000

commit 8e60d47cf0112c145b6b0e454d102b04c857db8c
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 7 10:16:01 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 12 13:32:31 2025 +0100

    x86/iommu: avoid MSI address and data writes if IRT index hasn't changed
    
    Attempt to reduce the MSI entry writes, and the associated checking whether
    memory decoding and MSI-X is enabled for the PCI device, when the MSI data
    hasn't changed.
    
    When using Interrupt Remapping the MSI entry will contain an index into
    the remapping table, and it's in such remapping table where the MSI vector
    and destination CPU is stored.  As such, when using interrupt remapping,
    changes to the interrupt affinity shouldn't result in changes to the MSI
    entry, and the MSI entry update can be avoided.
    
    Signal from the IOMMU update_ire_from_msi hook whether the MSI data or
    address fields have changed, and thus need writing to the device registers.
    Such signaling is done by returning 1 from the function.  Otherwise
    returning 0 means no update of the MSI fields, and thus no write
    required.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hpet.c                      |  6 +++++-
 xen/arch/x86/hvm/vmx/vmx.c               | 13 ++++++++++++-
 xen/arch/x86/msi.c                       | 11 ++++++-----
 xen/drivers/passthrough/amd/iommu_intr.c |  4 ++--
 xen/drivers/passthrough/vtd/intremap.c   |  4 +++-
 xen/include/xen/iommu.h                  |  6 ++++++
 6 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 51ff7f12f5..1bca8c8b67 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -283,8 +283,12 @@ static int hpet_msi_write(struct hpet_event_channel *ch, struct msi_msg *msg)
     {
         int rc = iommu_update_ire_from_msi(&ch->msi, msg);
 
-        if ( rc )
+        if ( rc < 0 )
             return rc;
+        /*
+         * Always propagate writes, to avoid having to pass a flag for handling
+         * a forceful write in the resume from suspension case.
+         */
     }
 
     hpet_write32(msg->data, HPET_Tn_ROUTE(ch->idx));
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 23b7ecd77f..4883bd823d 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -417,7 +417,18 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
 
     ASSERT_PDEV_LIST_IS_READ_LOCKED(msi_desc->dev->domain);
 
-    return iommu_update_ire_from_msi(msi_desc, &msg);
+    rc = iommu_update_ire_from_msi(msi_desc, &msg);
+    if ( rc > 0 )
+    {
+        /*
+         * Callers of vmx_pi_update_irte() won't propagate the updated MSI
+         * fields to the hardware, must assert there are no changes.
+         */
+        ASSERT_UNREACHABLE();
+        rc = -EILSEQ;
+    }
+
+    return rc;
 
  unlock_out:
     spin_unlock_irq(&desc->lock);
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 6c11d76015..163ccf8747 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -184,7 +184,8 @@ void msi_compose_msg(unsigned vector, const cpumask_t *cpu_mask, struct msi_msg
                 MSI_DATA_VECTOR(vector);
 }
 
-static int write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
+static int write_msi_msg(struct msi_desc *entry, struct msi_msg *msg,
+                         bool force)
 {
     entry->msg = *msg;
 
@@ -194,7 +195,7 @@ static int write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
 
         ASSERT(msg != &entry->msg);
         rc = iommu_update_ire_from_msi(entry, msg);
-        if ( rc )
+        if ( rc < 0 || (rc == 0 && !force) )
             return rc;
     }
 
@@ -259,7 +260,7 @@ void cf_check set_msi_affinity(struct irq_desc *desc, const cpumask_t *mask)
     msg.address_lo |= MSI_ADDR_DEST_ID(dest);
     msg.dest32 = dest;
 
-    write_msi_msg(msi_desc, &msg);
+    write_msi_msg(msi_desc, &msg, false);
 }
 
 void __msi_set_enable(pci_sbdf_t sbdf, int pos, int enable)
@@ -522,7 +523,7 @@ int __setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc,
     desc->msi_desc = msidesc;
     desc->handler = handler;
     msi_compose_msg(desc->arch.vector, desc->arch.cpu_mask, &msg);
-    ret = write_msi_msg(msidesc, &msg);
+    ret = write_msi_msg(msidesc, &msg, false);
     if ( unlikely(ret) )
     {
         desc->handler = &no_irq_type;
@@ -1403,7 +1404,7 @@ int pci_restore_msi_state(struct pci_dev *pdev)
         type = entry->msi_attrib.type;
 
         msg = entry->msg;
-        write_msi_msg(entry, &msg);
+        write_msi_msg(entry, &msg, true);
 
         for ( i = 0; ; )
         {
diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index c0273059cb..9abdc38053 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -492,7 +492,7 @@ static int update_intremap_entry_from_msi_msg(
                get_ivrs_mappings(iommu->seg)[alias_id].intremap_table);
     }
 
-    return 0;
+    return fresh;
 }
 
 static struct amd_iommu *_find_iommu_for_device(int seg, int bdf)
@@ -546,7 +546,7 @@ int cf_check amd_iommu_msi_msg_update_ire(
     rc = update_intremap_entry_from_msi_msg(iommu, bdf, nr,
                                             &msi_desc->remap_index,
                                             msg, &data);
-    if ( !rc )
+    if ( rc > 0 )
     {
         for ( i = 1; i < nr; ++i )
             msi_desc[i].remap_index = msi_desc->remap_index + i;
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 1aeaeb5ec5..b3b53518e2 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -506,6 +506,7 @@ static int msi_msg_to_remap_entry(
     unsigned int index, i, nr = 1;
     unsigned long flags;
     const struct pi_desc *pi_desc = msi_desc->pi_desc;
+    bool alloc = false;
 
     if ( msi_desc->msi_attrib.type == PCI_CAP_ID_MSI )
         nr = msi_desc->msi.nvec;
@@ -529,6 +530,7 @@ static int msi_msg_to_remap_entry(
         index = alloc_remap_entry(iommu, nr);
         for ( i = 0; i < nr; ++i )
             msi_desc[i].remap_index = index + i;
+        alloc = true;
     }
     else
         index = msi_desc->remap_index;
@@ -601,7 +603,7 @@ static int msi_msg_to_remap_entry(
     unmap_vtd_domain_page(iremap_entries);
     spin_unlock_irqrestore(&iommu->intremap.lock, flags);
 
-    return 0;
+    return alloc;
 }
 
 int cf_check msi_msg_write_remap_rte(
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 77a514019c..984f0735d4 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -435,6 +435,12 @@ extern struct page_list_head iommu_pt_cleanup_list;
 bool arch_iommu_use_permitted(const struct domain *d);
 
 #ifdef CONFIG_X86
+/*
+ * Return values:
+ *  - < 0 on error.
+ *  - 0 on success and no need to write msi_msg to the hardware.
+ *  - 1 on success and msi_msg must be propagated to the hardware.
+ */
 static inline int iommu_update_ire_from_msi(
     struct msi_desc *msi_desc, struct msi_msg *msg)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 19:55:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 19:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910789.1317413 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsSAR-0006X2-VO; Wed, 12 Mar 2025 19:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910789.1317413; Wed, 12 Mar 2025 19:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsSAR-0006Wu-Sm; Wed, 12 Mar 2025 19:55:03 +0000
Received: by outflank-mailman (input) for mailman id 910789;
 Wed, 12 Mar 2025 19:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsSAP-0006Wm-Uf
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 19:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsSAQ-00GaQN-0I
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 19:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsSAP-007Oc1-2a
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 19:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EA3NfzaZwwP+EIM5G+78n/r7S1Xs1p1pD0VZVZ7sALs=; b=UI/iz5OmA+KYXeJnGfFGW4TQwf
	3Un1CMC/Yyf95bY/jIzzYCsVs/aw4JDDeiRN7k6UnOaLSpkVu3v1CopSS3gPZNY6k6TFJnPlBmiuO
	TvP87yLJ6WLAtPVmfHggs3m05t+sRTcdHAARINIcpRRZq3fA+utVOsZnHu6OxJ1MP2fM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: fix iomem permissions cfg in map_range_to_domain()
Message-Id: <E1tsSAP-007Oc1-2a@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 19:55:01 +0000

commit 9568ceb2877dae593dbac29a1154f63bdea65c20
Author:     Grygorii Strashko <gragst.linux@gmail.com>
AuthorDate: Tue Feb 18 13:22:52 2025 +0200
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Mar 12 19:47:04 2025 +0000

    xen/arm: fix iomem permissions cfg in map_range_to_domain()
    
    Now the following code in map_range_to_domain()
    
        res = iomem_permit_access(d, paddr_to_pfn(addr),
                        paddr_to_pfn(PAGE_ALIGN(addr + len - 1)));
    
    calculates the iomem range end address by rounding it up to the next Xen
    page with incorrect assumption that iomem range end address passed to
    iomem_permit_access() is exclusive, while it is expected to be inclusive.
    It gives Control domain (Dom0) access to manage incorrect MMIO range with
    one additional page.
    
    For example, if requested range is [00e6140000:00e6141004] then it expected
    to add [e6140:e6141] range (num_pages=2) to the domain iomem_caps rangeset,
    but will add [e6140:e6142] (num_pages=3) instead.
    
    To fix it, drop PAGE_ALIGN() from the iomem range end address calculation
    formula.
    
    Fixes: 33233c2758345 ("arch/arm: domain build: let dom0 access I/O memory of mapped devices")
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 5610cddcba..97e613e06a 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -71,7 +71,7 @@ int map_range_to_domain(const struct dt_device_node *dev,
                      strlen("/reserved-memory/")) != 0 )
     {
         res = iomem_permit_access(d, paddr_to_pfn(addr),
-                paddr_to_pfn(PAGE_ALIGN(addr + len - 1)));
+                                  paddr_to_pfn(addr + len - 1));
         if ( res )
         {
             printk(XENLOG_ERR "Unable to permit to dom%d access to"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 19:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 19:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910790.1317418 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsSAc-0006ZG-1W; Wed, 12 Mar 2025 19:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910790.1317418; Wed, 12 Mar 2025 19:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsSAb-0006Z8-UB; Wed, 12 Mar 2025 19:55:13 +0000
Received: by outflank-mailman (input) for mailman id 910790;
 Wed, 12 Mar 2025 19:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsSAa-0006Ym-1p
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 19:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsSAa-00GaQk-0f
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 19:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsSAZ-007Ocb-2w
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 19:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hvY4q9m/5Ut7+bKB8Gw1J2AXGPwMxEQkJ4aGLbhur4Y=; b=hvyJ6knzG25H0lCUsBCwlY3aP2
	tzl8bGoT2A4rPuEWc7DKGhfspwr8YKfl66BV9ySg46/pdnwW+S1RFz4xekSO8cZsGdHsSubyeglbe
	Sp41MkyOiPJzlkngF4gced8cQLK4BZ9RgMcSkf0jT9aa1HX6BJ2wZV68ajmv80zM3n7w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: fix iomem_ranges cfg in map_range_to_domain()
Message-Id: <E1tsSAZ-007Ocb-2w@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 19:55:11 +0000

commit e0daeac7b1d7a4cbdb7365b4eccf6ad398caea83
Author:     Grygorii Strashko <gragst.linux@gmail.com>
AuthorDate: Tue Feb 18 13:22:53 2025 +0200
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Mar 12 19:47:04 2025 +0000

    xen/arm: fix iomem_ranges cfg in map_range_to_domain()
    
    Now the following code in map_range_to_domain()
    
     res = rangeset_add_range(mr_data->iomem_ranges,
                              paddr_to_pfn(addr),
                              paddr_to_pfn_aligned(addr + len - 1));
     where
      paddr_to_pfn_aligned(paddr) defined as paddr_to_pfn(PAGE_ALIGN(paddr))
    
    calculates the iomem range end address by rounding it up to the next Xen
    page with incorrect assumption that iomem range end address passed to
    rangeset_add_range() is exclusive, while it is expected to be inclusive.
    
    For example, if requested range is [00e6140000:00e6141004] then it expected
    to add [e6140:e6141] range (num_pages=2) to the mr_data->iomem_ranges
    rangeset, but will add [e6140:e6142] (num_pages=3) instead.
    
    To fix it, drop PAGE_ALIGN() from the iomem range end address calculation
    formula and just use paddr_to_pfn(addr + len - 1).
    
    Fixes: 57d4d7d4e8f3b (arm/asm/setup.h: Update struct map_range_data to add rangeset.")
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 97e613e06a..5e1c1cc326 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -107,7 +107,7 @@ int map_range_to_domain(const struct dt_device_node *dev,
     {
         res = rangeset_add_range(mr_data->iomem_ranges,
                                  paddr_to_pfn(addr),
-                                 paddr_to_pfn_aligned(addr + len - 1));
+                                 paddr_to_pfn(addr + len - 1));
         if ( res )
             return res;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 20:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 20:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910832.1317445 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsT6V-0004HC-OY; Wed, 12 Mar 2025 20:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910832.1317445; Wed, 12 Mar 2025 20:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsT6V-0004H4-Lj; Wed, 12 Mar 2025 20:55:03 +0000
Received: by outflank-mailman (input) for mailman id 910832;
 Wed, 12 Mar 2025 20:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsT6U-0004Gy-GL
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 20:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsT6U-00GbdI-18
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 20:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsT6U-007TK6-0A
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 20:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=se82qcnwmBp1NjIiuZzoPtuSDDAdhovxu9sIebdDi8I=; b=dg42uXZsoIl5RkjlYp8ETpN9Bc
	M67b25Zfdkx2ddiWJD2qi7Ofc+pjKcHXSph1vef5GJxf7jCmxz5lerQuCu/wI/RKup/MgP+z/AbSv
	LbLusZg0lu/4Hss0RNDk06ontVU9WeyLAtgB0aaz8lYzWY9zX/0s9ZsXy707PmquAC5o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: fix iomem permissions cfg in map_range_to_domain()
Message-Id: <E1tsT6U-007TK6-0A@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 20:55:02 +0000

commit 9568ceb2877dae593dbac29a1154f63bdea65c20
Author:     Grygorii Strashko <gragst.linux@gmail.com>
AuthorDate: Tue Feb 18 13:22:52 2025 +0200
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Mar 12 19:47:04 2025 +0000

    xen/arm: fix iomem permissions cfg in map_range_to_domain()
    
    Now the following code in map_range_to_domain()
    
        res = iomem_permit_access(d, paddr_to_pfn(addr),
                        paddr_to_pfn(PAGE_ALIGN(addr + len - 1)));
    
    calculates the iomem range end address by rounding it up to the next Xen
    page with incorrect assumption that iomem range end address passed to
    iomem_permit_access() is exclusive, while it is expected to be inclusive.
    It gives Control domain (Dom0) access to manage incorrect MMIO range with
    one additional page.
    
    For example, if requested range is [00e6140000:00e6141004] then it expected
    to add [e6140:e6141] range (num_pages=2) to the domain iomem_caps rangeset,
    but will add [e6140:e6142] (num_pages=3) instead.
    
    To fix it, drop PAGE_ALIGN() from the iomem range end address calculation
    formula.
    
    Fixes: 33233c2758345 ("arch/arm: domain build: let dom0 access I/O memory of mapped devices")
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 5610cddcba..97e613e06a 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -71,7 +71,7 @@ int map_range_to_domain(const struct dt_device_node *dev,
                      strlen("/reserved-memory/")) != 0 )
     {
         res = iomem_permit_access(d, paddr_to_pfn(addr),
-                paddr_to_pfn(PAGE_ALIGN(addr + len - 1)));
+                                  paddr_to_pfn(addr + len - 1));
         if ( res )
         {
             printk(XENLOG_ERR "Unable to permit to dom%d access to"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 12 20:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Mar 2025 20:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.910833.1317451 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsT6f-0004J1-QQ; Wed, 12 Mar 2025 20:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 910833.1317451; Wed, 12 Mar 2025 20:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsT6f-0004It-NC; Wed, 12 Mar 2025 20:55:13 +0000
Received: by outflank-mailman (input) for mailman id 910833;
 Wed, 12 Mar 2025 20:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsT6e-0004Ig-8O
 for xen-changelog@lists.xenproject.org; Wed, 12 Mar 2025 20:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsT6e-00Gbdf-1S
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 20:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsT6e-007TN2-0Y
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Mar 2025 20:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kJZlDSOA4lyzNdYse8wQbao3RY+6KfPywvs9MZVbiz4=; b=se45PUbt8XY1hgkvOjE7Cq8a4d
	zFo+wHMJ3KMDpL9dqpdZRBxP9lVW2IUU3xiqh7rQiClv5YYg4HB8xlS2HlODPWi/KcjKC4LhLgCT+
	DcM13ti5n34H/cn8A/oVfrVtm/p4cuBdmf7ik68sw8/l2MM6C2jE/bSleHkIARc4XuJI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: fix iomem_ranges cfg in map_range_to_domain()
Message-Id: <E1tsT6e-007TN2-0Y@xenbits.xenproject.org>
Date: Wed, 12 Mar 2025 20:55:12 +0000

commit e0daeac7b1d7a4cbdb7365b4eccf6ad398caea83
Author:     Grygorii Strashko <gragst.linux@gmail.com>
AuthorDate: Tue Feb 18 13:22:53 2025 +0200
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Mar 12 19:47:04 2025 +0000

    xen/arm: fix iomem_ranges cfg in map_range_to_domain()
    
    Now the following code in map_range_to_domain()
    
     res = rangeset_add_range(mr_data->iomem_ranges,
                              paddr_to_pfn(addr),
                              paddr_to_pfn_aligned(addr + len - 1));
     where
      paddr_to_pfn_aligned(paddr) defined as paddr_to_pfn(PAGE_ALIGN(paddr))
    
    calculates the iomem range end address by rounding it up to the next Xen
    page with incorrect assumption that iomem range end address passed to
    rangeset_add_range() is exclusive, while it is expected to be inclusive.
    
    For example, if requested range is [00e6140000:00e6141004] then it expected
    to add [e6140:e6141] range (num_pages=2) to the mr_data->iomem_ranges
    rangeset, but will add [e6140:e6142] (num_pages=3) instead.
    
    To fix it, drop PAGE_ALIGN() from the iomem range end address calculation
    formula and just use paddr_to_pfn(addr + len - 1).
    
    Fixes: 57d4d7d4e8f3b (arm/asm/setup.h: Update struct map_range_data to add rangeset.")
    Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 97e613e06a..5e1c1cc326 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -107,7 +107,7 @@ int map_range_to_domain(const struct dt_device_node *dev,
     {
         res = rangeset_add_range(mr_data->iomem_ranges,
                                  paddr_to_pfn(addr),
-                                 paddr_to_pfn_aligned(addr + len - 1));
+                                 paddr_to_pfn(addr + len - 1));
         if ( res )
             return res;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 07:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 07:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911313.1317755 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsdPE-0008KM-T6; Thu, 13 Mar 2025 07:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911313.1317755; Thu, 13 Mar 2025 07:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsdPE-0008KE-QY; Thu, 13 Mar 2025 07:55:04 +0000
Received: by outflank-mailman (input) for mailman id 911313;
 Thu, 13 Mar 2025 07:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsdPC-0008K8-OX
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 07:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsdPC-000cdj-2E
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 07:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsdPC-008MBa-1K
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 07:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1iU0qVg0RCGRKecQ9Ksf/gh7sqlIdkf8KhlU1JwNIls=; b=0bdxM8Zm9WJgpkSfK67Qadvjdb
	YzYM5PAjW/fnGpWv3+s4HgBTQMHt8wZC/roaRhgCTWYQUyWaCI6vScrVwL2i21Pz8MRswRI0k3KtN
	j1broR6EspnFY9NeDaXtRX2RmTgMejT70Wlw5/r3KCAYKYp+YjCKRwplfDehlyY3FyiQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Improve handling of nr_spis
Message-Id: <E1tsdPC-008MBa-1K@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 07:55:02 +0000

commit 6044c988c17f85fb874cc3372f0e3ab2ea1f925e
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Mar 12 11:16:18 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 13 08:10:48 2025 +0100

    xen/arm: Improve handling of nr_spis
    
    At the moment, we print a warning about max number of IRQs supported by
    GIC bigger than vGIC only for hardware domain. This check is not hwdom
    special, and should be made common. Also, in case of user not specifying
    nr_spis for dom0less domUs, we should take into account max number of
    IRQs supported by vGIC if it's smaller than for GIC.
    
    Introduce VGIC_MAX_IRQS macro and use it instead of hardcoded 992 value.
    Introduce VGIC_DEF_NR_SPIS macro to store the default number of vGIC SPIs.
    Fix calculation of nr_spis for dom0less domUs and make the GIC/vGIC max
    IRQs comparison common.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/dom0less-build.c   | 2 +-
 xen/arch/arm/domain_build.c     | 8 +-------
 xen/arch/arm/gic.c              | 3 +++
 xen/arch/arm/include/asm/vgic.h | 6 ++++++
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 31f31c38da..573b0d25ae 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -1018,7 +1018,7 @@ void __init create_domUs(void)
         {
             int vpl011_virq = GUEST_VPL011_SPI;
 
-            d_cfg.arch.nr_spis = gic_number_lines() - 32;
+            d_cfg.arch.nr_spis = VGIC_DEF_NR_SPIS;
 
             /*
              * The VPL011 virq is GUEST_VPL011_SPI, unless direct-map is
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 7cc141ef75..2b5b433183 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2371,13 +2371,7 @@ void __init create_dom0(void)
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
     dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
-    /*
-     * Xen vGIC supports a maximum of 992 interrupt lines.
-     * 32 are substracted to cover local IRQs.
-     */
-    dom0_cfg.arch.nr_spis = min(gic_number_lines(), (unsigned int) 992) - 32;
-    if ( gic_number_lines() > 992 )
-        printk(XENLOG_WARNING "Maximum number of vGIC IRQs exceeded.\n");
+    dom0_cfg.arch.nr_spis = VGIC_DEF_NR_SPIS;
     dom0_cfg.arch.tee_type = tee_get_type();
     dom0_cfg.max_vcpus = dom0_max_vcpus();
 
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index acf61a4de3..e80fe0ca24 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -251,6 +251,9 @@ void __init gic_init(void)
         panic("Failed to initialize the GIC drivers\n");
     /* Clear LR mask for cpu0 */
     clear_cpu_lr_mask();
+
+    if ( gic_number_lines() > VGIC_MAX_IRQS )
+        printk(XENLOG_WARNING "Maximum number of vGIC IRQs exceeded\n");
 }
 
 void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi)
diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index e309dca1ad..35c0c6a8b0 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -329,6 +329,12 @@ extern void vgic_check_inflight_irqs_pending(struct vcpu *v,
  */
 #define vgic_num_irqs(d)        ((d)->arch.vgic.nr_spis + 32)
 
+/* Maximum number of IRQs supported by vGIC */
+#define VGIC_MAX_IRQS 992U
+
+/* Default number of vGIC SPIs. 32 are substracted to cover local IRQs. */
+#define VGIC_DEF_NR_SPIS (min(gic_number_lines(), VGIC_MAX_IRQS) - 32)
+
 /*
  * Allocate a guest VIRQ
  *  - spi == 0 => allocate a PPI. It will be the same on every vCPU
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 07:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 07:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911314.1317761 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsdPN-0008M0-Uc; Thu, 13 Mar 2025 07:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911314.1317761; Thu, 13 Mar 2025 07:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsdPN-0008Ls-Rs; Thu, 13 Mar 2025 07:55:13 +0000
Received: by outflank-mailman (input) for mailman id 911314;
 Thu, 13 Mar 2025 07:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsdPM-0008LZ-LH
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 07:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsdPM-000cdp-2j
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 07:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsdPM-008MCy-1g
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 07:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Z54e2j7mU5TKr56bu+UtJoQ8okKw0vo8cmBhqBs/i8M=; b=NQKYdwAJ6hLb6kTp0R0zhp3v0T
	K4wVsVAfL5cS+QJRzzw/wn9JFwobYOz3dvUdl82PQ2C+juSFvJ+S3ttbGM3GPGtZEyJ1uFdEjMu79
	1ahWmxDs2gqk6vZRSr5zxbf8n6ABshclVws40oaEqNSk1v6BKCvq+F30go9yhRGIAqJE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/arm: Reject configuration with incorrect nr_spis value
Message-Id: <E1tsdPM-008MCy-1g@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 07:55:12 +0000

commit 55d62b8d4636e22290e1d93704ab0b85a8c1a860
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Mar 12 11:16:19 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 13 08:10:48 2025 +0100

    tools/arm: Reject configuration with incorrect nr_spis value
    
    If the calculated value for nr_spis by the toolstack is bigger than the
    value provided by the user, we silently ignore the latter. This is not
    consistent with the approach we have in Xen on Arm when we try to reject
    incorrect configuration. Also, the documentation for nr_spis is
    incorrect as it mentions 991 as the number of max SPIs, where it should
    be 960 i.e. (1020 - 32) rounded down to the nearest multiple of 32.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/man/xl.cfg.5.pod.in     | 13 +++++--------
 tools/libs/light/libxl_arm.c |  6 ++++++
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 8e1422104e..7339c44efd 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -3083,14 +3083,11 @@ interval of colors (such as "0-4").
 =item B<nr_spis="NR_SPIS">
 
 An optional integer parameter specifying the number of SPIs (Shared
-Peripheral Interrupts) to allocate for the domain. Max is 991 SPIs. If
-the value specified by the `nr_spis` parameter is smaller than the
-number of SPIs calculated by the toolstack based on the devices
-allocated for the domain, or the `nr_spis` parameter is not specified,
-the value calculated by the toolstack will be used for the domain.
-Otherwise, the value specified by the `nr_spis` parameter will be used.
-The number of SPIs should match the highest interrupt ID that will be
-assigned to the domain.
+Peripheral Interrupts) to allocate for the domain. Max is 960 SPIs. If
+the `nr_spis` parameter is not specified, the value calculated by the toolstack
+will be used for the domain. Otherwise, the value specified by the `nr_spis`
+parameter will be used. The number of SPIs should match the highest interrupt
+ID that will be assigned to the domain.
 
 =back
 
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 5a9db5e85f..2d895408ca 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -181,6 +181,12 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
 
     LOG(DEBUG, "Configure the domain");
 
+    if (nr_spis > d_config->b_info.arch_arm.nr_spis) {
+        LOG(ERROR, "Provided nr_spis value is too small (minimum required %u)\n",
+            nr_spis);
+        return ERROR_FAIL;
+    }
+
     config->arch.nr_spis = max(nr_spis, d_config->b_info.arch_arm.nr_spis);
     LOG(DEBUG, " - Allocate %u SPIs", config->arch.nr_spis);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 07:55:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 07:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911315.1317764 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsdPX-0008Oi-Vx; Thu, 13 Mar 2025 07:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911315.1317764; Thu, 13 Mar 2025 07:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsdPX-0008Oa-TG; Thu, 13 Mar 2025 07:55:23 +0000
Received: by outflank-mailman (input) for mailman id 911315;
 Thu, 13 Mar 2025 07:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsdPW-0008OU-Nj
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 07:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsdPW-000ceC-32
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 07:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsdPW-008MDc-29
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 07:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=idx7ZiVwLo9Mq1eN/x58+o/0N4gT03wqvPS3MffGCd8=; b=PUvPvZu4B5JrCTUdZlkU+/ekml
	RXDJv0wJpPKiuBNzUnjLRRXAO4jNzDYZcOQUmLB+Wk0x+SAy6mDFCmeWGU7BX1cB2H4MRZvpwdps5
	5eartnlLOh5r8+QBpShq5aDWPM9CFRhmbIIw1Vfsv9uqutOFfUWTzlxabulK8fbWvwAc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH
Message-Id: <E1tsdPW-008MDc-29@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 07:55:22 +0000

commit 778839162205a7bbc70615e38495518e0ddea508
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Mar 12 13:52:49 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 13 08:29:10 2025 +0100

    xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH
    
    When Xen is built without HAS_PASSTHROUGH, there are some parts
    in arm where iommu_* functions are called in the codebase, but
    their implementation is under xen/drivers/passthrough that is
    not built.
    
    So provide some stub for these functions in order to build Xen
    when !HAS_PASSTHROUGH, which is the case for example on systems
    with MPU support.
    
    For gnttab_need_iommu_mapping() in the Arm part, modify the macro
    to use IS_ENABLED for the HAS_PASSTHROUGH Kconfig.
    
    Fixes: 0388a5979b21 ("xen/arm: mpu: Introduce choice between MMU and MPU")
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/arm/include/asm/grant_table.h |  5 ++--
 xen/include/xen/iommu.h                | 54 +++++++++++++++++++++++++++++++++-
 2 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/include/asm/grant_table.h b/xen/arch/arm/include/asm/grant_table.h
index d3c518a926..c5d87b60c4 100644
--- a/xen/arch/arm/include/asm/grant_table.h
+++ b/xen/arch/arm/include/asm/grant_table.h
@@ -73,8 +73,9 @@ int replace_grant_host_mapping(uint64_t gpaddr, mfn_t frame,
 #define gnttab_status_gfn(d, t, i)                                       \
     page_get_xenheap_gfn(gnttab_status_page(t, i))
 
-#define gnttab_need_iommu_mapping(d)                    \
-    (is_domain_direct_mapped(d) && is_iommu_enabled(d))
+#define gnttab_need_iommu_mapping(d)                                     \
+    (IS_ENABLED(CONFIG_HAS_PASSTHROUGH) && is_domain_direct_mapped(d) && \
+     is_iommu_enabled(d))
 
 #endif /* __ASM_GRANT_TABLE_H__ */
 /*
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 984f0735d4..832775754b 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -110,6 +110,8 @@ extern int8_t iommu_hwdom_reserved;
 
 extern unsigned int iommu_dev_iotlb_timeout;
 
+#ifdef CONFIG_HAS_PASSTHROUGH
+
 int iommu_setup(void);
 int iommu_hardware_setup(void);
 
@@ -122,6 +124,28 @@ int arch_iommu_domain_init(struct domain *d);
 void arch_iommu_check_autotranslated_hwdom(struct domain *d);
 void arch_iommu_hwdom_init(struct domain *d);
 
+#else
+
+static inline int iommu_setup(void)
+{
+    return -ENODEV;
+}
+
+static inline int iommu_domain_init(struct domain *d, unsigned int opts)
+{
+    /*
+     * Return as the real iommu_domain_init() would: Success when
+     * !is_iommu_enabled(), following from !iommu_enabled when !HAS_PASSTHROUGH
+     */
+    return 0;
+}
+
+static inline void iommu_hwdom_init(struct domain *d) {}
+
+static inline void iommu_domain_destroy(struct domain *d) {}
+
+#endif /* HAS_PASSTHROUGH */
+
 /*
  * The following flags are passed to map (applicable ones also to unmap)
  * operations, while some are passed back by lookup operations.
@@ -209,6 +233,8 @@ struct msi_msg;
 #ifdef CONFIG_HAS_DEVICE_TREE
 #include <xen/device_tree.h>
 
+#ifdef CONFIG_HAS_PASSTHROUGH
+
 int iommu_assign_dt_device(struct domain *d, struct dt_device_node *dev);
 int iommu_deassign_dt_device(struct domain *d, struct dt_device_node *dev);
 int iommu_dt_domain_init(struct domain *d);
@@ -238,6 +264,30 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,
  */
 int iommu_remove_dt_device(struct dt_device_node *np);
 
+#else
+
+static inline int iommu_assign_dt_device(struct domain *d,
+                                         struct dt_device_node *dev)
+{
+    return -EINVAL;
+}
+
+static inline int iommu_add_dt_device(struct dt_device_node *np)
+{
+    /*
+     * !HAS_PASSTHROUGH => !iommu_enabled (see the non-stub
+     * iommu_add_dt_device())
+     */
+    return 1;
+}
+
+static inline int iommu_release_dt_devices(struct domain *d)
+{
+    return 0;
+}
+
+#endif /* HAS_PASSTHROUGH */
+
 #endif /* HAS_DEVICE_TREE */
 
 struct page_info;
@@ -383,17 +433,19 @@ struct domain_iommu {
 #define iommu_set_feature(d, f)   set_bit(f, dom_iommu(d)->features)
 #define iommu_clear_feature(d, f) clear_bit(f, dom_iommu(d)->features)
 
+#ifdef CONFIG_HAS_PASSTHROUGH
 /* Are we using the domain P2M table as its IOMMU pagetable? */
 #define iommu_use_hap_pt(d)       (IS_ENABLED(CONFIG_HVM) && \
                                    dom_iommu(d)->hap_pt_share)
 
 /* Does the IOMMU pagetable need to be kept synchronized with the P2M */
-#ifdef CONFIG_HAS_PASSTHROUGH
 #define need_iommu_pt_sync(d)     (dom_iommu(d)->need_sync)
 
 int iommu_do_domctl(struct xen_domctl *domctl, struct domain *d,
                     XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl);
 #else
+#define iommu_use_hap_pt(d)       ({ (void)(d); false; })
+
 #define need_iommu_pt_sync(d)     ({ (void)(d); false; })
 
 static inline int iommu_do_domctl(struct xen_domctl *domctl, struct domain *d,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 07:55:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 07:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911316.1317768 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsdPi-0008Qm-0y; Thu, 13 Mar 2025 07:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911316.1317768; Thu, 13 Mar 2025 07:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsdPh-0008Qe-Uc; Thu, 13 Mar 2025 07:55:33 +0000
Received: by outflank-mailman (input) for mailman id 911316;
 Thu, 13 Mar 2025 07:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsdPg-0008QY-Qi
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 07:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsdPh-000ceG-07
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 07:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsdPg-008MEV-2R
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 07:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Tiz82Q5m32ob0kQh89qhDavpVYMfXhNl42Q0nIb0KIU=; b=nFEDw3M4eJZLs5DXEqenLMTKIh
	qYuR7RfBYmMm6emu6QsrYpah6p7F/xt0/jQ3aXSm+BgDqpsVqCuC6IAcrxPFLuky8IMCJK5ew3Xz2
	+iWtGcB0Z/1B0T1/6+QNJCL74da5wKoQ+KzJcFiJ8VFFKL/QhvFEJDoy7Mdl/Z0Y+IB0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Restrict Kconfig configuration for LLC coloring
Message-Id: <E1tsdPg-008MEV-2R@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 07:55:32 +0000

commit 0967580cd1a9b14bed65301304502e4020276874
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Mar 12 13:52:50 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 13 08:29:12 2025 +0100

    xen/arm: Restrict Kconfig configuration for LLC coloring
    
    Xen LLC coloring feature can be used only on the MMU subsystem,
    move the code that selects it from ARM_64 to MMU and add the
    ARM_64 dependency.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index a26d3e1182..ffdff1f0a3 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -8,7 +8,6 @@ config ARM_64
 	depends on !ARM_32
 	select 64BIT
 	select HAS_FAST_MULTIPLY
-	select HAS_LLC_COLORING if !NUMA
 
 config ARM
 	def_bool y
@@ -76,6 +75,7 @@ choice
 
 config MMU
 	bool "MMU"
+	select HAS_LLC_COLORING if !NUMA && ARM_64
 	select HAS_PMAP
 	select HAS_VMAP
 	select HAS_PASSTHROUGH
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 08:55:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 08:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911542.1317942 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tseLI-0008W8-B2; Thu, 13 Mar 2025 08:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911542.1317942; Thu, 13 Mar 2025 08:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tseLI-0008W0-8N; Thu, 13 Mar 2025 08:55:04 +0000
Received: by outflank-mailman (input) for mailman id 911542;
 Thu, 13 Mar 2025 08:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tseLG-0008Vu-FC
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 08:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tseLG-000eST-1n
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 08:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tseLG-008QII-0v
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 08:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=i4Bhv/C5Fw+ispqxtnuCmRfAOTpjITnVjI5k5dwdC0w=; b=gRjjH1j3oBm4OdnTx543R+cGtg
	fR5HQTK5sWGit048mz4f0InbkhBg/3XbDWSaa9VIvSZZGYFhSVPYnsqINyjQZrbZmZXE6ySgN6hP+
	wEPP40nwa5EYh3ofoUNdtcYODboKJt5d/wtJAeopn1o/TtcV/XjOLEhQIz7OD3CSi/sc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Improve handling of nr_spis
Message-Id: <E1tseLG-008QII-0v@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 08:55:02 +0000

commit 6044c988c17f85fb874cc3372f0e3ab2ea1f925e
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Mar 12 11:16:18 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 13 08:10:48 2025 +0100

    xen/arm: Improve handling of nr_spis
    
    At the moment, we print a warning about max number of IRQs supported by
    GIC bigger than vGIC only for hardware domain. This check is not hwdom
    special, and should be made common. Also, in case of user not specifying
    nr_spis for dom0less domUs, we should take into account max number of
    IRQs supported by vGIC if it's smaller than for GIC.
    
    Introduce VGIC_MAX_IRQS macro and use it instead of hardcoded 992 value.
    Introduce VGIC_DEF_NR_SPIS macro to store the default number of vGIC SPIs.
    Fix calculation of nr_spis for dom0less domUs and make the GIC/vGIC max
    IRQs comparison common.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/dom0less-build.c   | 2 +-
 xen/arch/arm/domain_build.c     | 8 +-------
 xen/arch/arm/gic.c              | 3 +++
 xen/arch/arm/include/asm/vgic.h | 6 ++++++
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 31f31c38da..573b0d25ae 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -1018,7 +1018,7 @@ void __init create_domUs(void)
         {
             int vpl011_virq = GUEST_VPL011_SPI;
 
-            d_cfg.arch.nr_spis = gic_number_lines() - 32;
+            d_cfg.arch.nr_spis = VGIC_DEF_NR_SPIS;
 
             /*
              * The VPL011 virq is GUEST_VPL011_SPI, unless direct-map is
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 7cc141ef75..2b5b433183 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2371,13 +2371,7 @@ void __init create_dom0(void)
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
     dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
-    /*
-     * Xen vGIC supports a maximum of 992 interrupt lines.
-     * 32 are substracted to cover local IRQs.
-     */
-    dom0_cfg.arch.nr_spis = min(gic_number_lines(), (unsigned int) 992) - 32;
-    if ( gic_number_lines() > 992 )
-        printk(XENLOG_WARNING "Maximum number of vGIC IRQs exceeded.\n");
+    dom0_cfg.arch.nr_spis = VGIC_DEF_NR_SPIS;
     dom0_cfg.arch.tee_type = tee_get_type();
     dom0_cfg.max_vcpus = dom0_max_vcpus();
 
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index acf61a4de3..e80fe0ca24 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -251,6 +251,9 @@ void __init gic_init(void)
         panic("Failed to initialize the GIC drivers\n");
     /* Clear LR mask for cpu0 */
     clear_cpu_lr_mask();
+
+    if ( gic_number_lines() > VGIC_MAX_IRQS )
+        printk(XENLOG_WARNING "Maximum number of vGIC IRQs exceeded\n");
 }
 
 void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi)
diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index e309dca1ad..35c0c6a8b0 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -329,6 +329,12 @@ extern void vgic_check_inflight_irqs_pending(struct vcpu *v,
  */
 #define vgic_num_irqs(d)        ((d)->arch.vgic.nr_spis + 32)
 
+/* Maximum number of IRQs supported by vGIC */
+#define VGIC_MAX_IRQS 992U
+
+/* Default number of vGIC SPIs. 32 are substracted to cover local IRQs. */
+#define VGIC_DEF_NR_SPIS (min(gic_number_lines(), VGIC_MAX_IRQS) - 32)
+
 /*
  * Allocate a guest VIRQ
  *  - spi == 0 => allocate a PPI. It will be the same on every vCPU
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 08:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 08:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911543.1317946 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tseLS-0000CM-EM; Thu, 13 Mar 2025 08:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911543.1317946; Thu, 13 Mar 2025 08:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tseLS-0000CE-BD; Thu, 13 Mar 2025 08:55:14 +0000
Received: by outflank-mailman (input) for mailman id 911543;
 Thu, 13 Mar 2025 08:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tseLQ-0000By-GC
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 08:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tseLQ-000eSX-2H
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 08:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tseLQ-008QIo-1D
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 08:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=REEc8rgWCcY3Mm88m+aWreqv3dfTxQOwXxQjyIB/CGs=; b=ltsOFya6VdG1K7iaUDl8yv9hlF
	NaaaOAS5t39WKb9FKOm5l8iTxtN+6RD27Wuf05NfDDaYZSVDqEAAEoGUe3X24du5rT3jO16xHNv7u
	85AFZPY0JowtzajFLMYI5WbbclfPo+6DbZUmSc/bPutmRocsofGTtJm18vZJAeNtSh8Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/arm: Reject configuration with incorrect nr_spis value
Message-Id: <E1tseLQ-008QIo-1D@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 08:55:12 +0000

commit 55d62b8d4636e22290e1d93704ab0b85a8c1a860
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Mar 12 11:16:19 2025 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 13 08:10:48 2025 +0100

    tools/arm: Reject configuration with incorrect nr_spis value
    
    If the calculated value for nr_spis by the toolstack is bigger than the
    value provided by the user, we silently ignore the latter. This is not
    consistent with the approach we have in Xen on Arm when we try to reject
    incorrect configuration. Also, the documentation for nr_spis is
    incorrect as it mentions 991 as the number of max SPIs, where it should
    be 960 i.e. (1020 - 32) rounded down to the nearest multiple of 32.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/man/xl.cfg.5.pod.in     | 13 +++++--------
 tools/libs/light/libxl_arm.c |  6 ++++++
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 8e1422104e..7339c44efd 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -3083,14 +3083,11 @@ interval of colors (such as "0-4").
 =item B<nr_spis="NR_SPIS">
 
 An optional integer parameter specifying the number of SPIs (Shared
-Peripheral Interrupts) to allocate for the domain. Max is 991 SPIs. If
-the value specified by the `nr_spis` parameter is smaller than the
-number of SPIs calculated by the toolstack based on the devices
-allocated for the domain, or the `nr_spis` parameter is not specified,
-the value calculated by the toolstack will be used for the domain.
-Otherwise, the value specified by the `nr_spis` parameter will be used.
-The number of SPIs should match the highest interrupt ID that will be
-assigned to the domain.
+Peripheral Interrupts) to allocate for the domain. Max is 960 SPIs. If
+the `nr_spis` parameter is not specified, the value calculated by the toolstack
+will be used for the domain. Otherwise, the value specified by the `nr_spis`
+parameter will be used. The number of SPIs should match the highest interrupt
+ID that will be assigned to the domain.
 
 =back
 
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 5a9db5e85f..2d895408ca 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -181,6 +181,12 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
 
     LOG(DEBUG, "Configure the domain");
 
+    if (nr_spis > d_config->b_info.arch_arm.nr_spis) {
+        LOG(ERROR, "Provided nr_spis value is too small (minimum required %u)\n",
+            nr_spis);
+        return ERROR_FAIL;
+    }
+
     config->arch.nr_spis = max(nr_spis, d_config->b_info.arch_arm.nr_spis);
     LOG(DEBUG, " - Allocate %u SPIs", config->arch.nr_spis);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 08:55:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 08:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911544.1317949 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tseLc-0000JT-FW; Thu, 13 Mar 2025 08:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911544.1317949; Thu, 13 Mar 2025 08:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tseLc-0000JL-Co; Thu, 13 Mar 2025 08:55:24 +0000
Received: by outflank-mailman (input) for mailman id 911544;
 Thu, 13 Mar 2025 08:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tseLa-0000J7-J5
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 08:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tseLa-000eSw-2Z
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 08:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tseLa-008QJt-1h
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 08:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fkNS7VDg74YJxrynCFVoXRQpyTRwKhPf2lAAHbjtdXA=; b=4L/Gt4HI+0ZicyIXlNIN+hxkbO
	vwNnWN9QsARyAFDlHKWx6GjU4QX0PXroBFIIrfNqYEYip5ZulZgznAYj0tlqg0uiCJPWqbsg2QPoN
	UeD191nCn0Km9MaZro2rFZF0kFfw09XJrqlfQXKS7Usk3X7jhJsgslcCWxCgAF5vL4qQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH
Message-Id: <E1tseLa-008QJt-1h@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 08:55:22 +0000

commit 778839162205a7bbc70615e38495518e0ddea508
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Mar 12 13:52:49 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 13 08:29:10 2025 +0100

    xen/passthrough: Provide stub functions when !HAS_PASSTHROUGH
    
    When Xen is built without HAS_PASSTHROUGH, there are some parts
    in arm where iommu_* functions are called in the codebase, but
    their implementation is under xen/drivers/passthrough that is
    not built.
    
    So provide some stub for these functions in order to build Xen
    when !HAS_PASSTHROUGH, which is the case for example on systems
    with MPU support.
    
    For gnttab_need_iommu_mapping() in the Arm part, modify the macro
    to use IS_ENABLED for the HAS_PASSTHROUGH Kconfig.
    
    Fixes: 0388a5979b21 ("xen/arm: mpu: Introduce choice between MMU and MPU")
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/arm/include/asm/grant_table.h |  5 ++--
 xen/include/xen/iommu.h                | 54 +++++++++++++++++++++++++++++++++-
 2 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/include/asm/grant_table.h b/xen/arch/arm/include/asm/grant_table.h
index d3c518a926..c5d87b60c4 100644
--- a/xen/arch/arm/include/asm/grant_table.h
+++ b/xen/arch/arm/include/asm/grant_table.h
@@ -73,8 +73,9 @@ int replace_grant_host_mapping(uint64_t gpaddr, mfn_t frame,
 #define gnttab_status_gfn(d, t, i)                                       \
     page_get_xenheap_gfn(gnttab_status_page(t, i))
 
-#define gnttab_need_iommu_mapping(d)                    \
-    (is_domain_direct_mapped(d) && is_iommu_enabled(d))
+#define gnttab_need_iommu_mapping(d)                                     \
+    (IS_ENABLED(CONFIG_HAS_PASSTHROUGH) && is_domain_direct_mapped(d) && \
+     is_iommu_enabled(d))
 
 #endif /* __ASM_GRANT_TABLE_H__ */
 /*
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 984f0735d4..832775754b 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -110,6 +110,8 @@ extern int8_t iommu_hwdom_reserved;
 
 extern unsigned int iommu_dev_iotlb_timeout;
 
+#ifdef CONFIG_HAS_PASSTHROUGH
+
 int iommu_setup(void);
 int iommu_hardware_setup(void);
 
@@ -122,6 +124,28 @@ int arch_iommu_domain_init(struct domain *d);
 void arch_iommu_check_autotranslated_hwdom(struct domain *d);
 void arch_iommu_hwdom_init(struct domain *d);
 
+#else
+
+static inline int iommu_setup(void)
+{
+    return -ENODEV;
+}
+
+static inline int iommu_domain_init(struct domain *d, unsigned int opts)
+{
+    /*
+     * Return as the real iommu_domain_init() would: Success when
+     * !is_iommu_enabled(), following from !iommu_enabled when !HAS_PASSTHROUGH
+     */
+    return 0;
+}
+
+static inline void iommu_hwdom_init(struct domain *d) {}
+
+static inline void iommu_domain_destroy(struct domain *d) {}
+
+#endif /* HAS_PASSTHROUGH */
+
 /*
  * The following flags are passed to map (applicable ones also to unmap)
  * operations, while some are passed back by lookup operations.
@@ -209,6 +233,8 @@ struct msi_msg;
 #ifdef CONFIG_HAS_DEVICE_TREE
 #include <xen/device_tree.h>
 
+#ifdef CONFIG_HAS_PASSTHROUGH
+
 int iommu_assign_dt_device(struct domain *d, struct dt_device_node *dev);
 int iommu_deassign_dt_device(struct domain *d, struct dt_device_node *dev);
 int iommu_dt_domain_init(struct domain *d);
@@ -238,6 +264,30 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,
  */
 int iommu_remove_dt_device(struct dt_device_node *np);
 
+#else
+
+static inline int iommu_assign_dt_device(struct domain *d,
+                                         struct dt_device_node *dev)
+{
+    return -EINVAL;
+}
+
+static inline int iommu_add_dt_device(struct dt_device_node *np)
+{
+    /*
+     * !HAS_PASSTHROUGH => !iommu_enabled (see the non-stub
+     * iommu_add_dt_device())
+     */
+    return 1;
+}
+
+static inline int iommu_release_dt_devices(struct domain *d)
+{
+    return 0;
+}
+
+#endif /* HAS_PASSTHROUGH */
+
 #endif /* HAS_DEVICE_TREE */
 
 struct page_info;
@@ -383,17 +433,19 @@ struct domain_iommu {
 #define iommu_set_feature(d, f)   set_bit(f, dom_iommu(d)->features)
 #define iommu_clear_feature(d, f) clear_bit(f, dom_iommu(d)->features)
 
+#ifdef CONFIG_HAS_PASSTHROUGH
 /* Are we using the domain P2M table as its IOMMU pagetable? */
 #define iommu_use_hap_pt(d)       (IS_ENABLED(CONFIG_HVM) && \
                                    dom_iommu(d)->hap_pt_share)
 
 /* Does the IOMMU pagetable need to be kept synchronized with the P2M */
-#ifdef CONFIG_HAS_PASSTHROUGH
 #define need_iommu_pt_sync(d)     (dom_iommu(d)->need_sync)
 
 int iommu_do_domctl(struct xen_domctl *domctl, struct domain *d,
                     XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl);
 #else
+#define iommu_use_hap_pt(d)       ({ (void)(d); false; })
+
 #define need_iommu_pt_sync(d)     ({ (void)(d); false; })
 
 static inline int iommu_do_domctl(struct xen_domctl *domctl, struct domain *d,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 08:55:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 08:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911545.1317954 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tseLm-0000Lu-Gm; Thu, 13 Mar 2025 08:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911545.1317954; Thu, 13 Mar 2025 08:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tseLm-0000Lm-EG; Thu, 13 Mar 2025 08:55:34 +0000
Received: by outflank-mailman (input) for mailman id 911545;
 Thu, 13 Mar 2025 08:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tseLk-0000Le-Nh
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 08:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tseLk-000eT4-31
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 08:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tseLk-008QKu-1y
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 08:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ygwml/0CRCZmvtq3BXiGE8JUJSFdLW0uVBhOKrZFokM=; b=Tqoy36U/GQsSOa3vQdsj2w35Ic
	+2xxTcEsfVAdwCI2/5btjEoGHmARBYgFvADMKbktgwb7BOf51ma9nZiLkTvtL/w3Ks0HaKV60PH/Z
	rbkIoDX3Z9D+vGKCMl82apNraUrfXE4UdS8N80Za/Js7hsnncEKcnQodC6M85baMabbg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Restrict Kconfig configuration for LLC coloring
Message-Id: <E1tseLk-008QKu-1y@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 08:55:32 +0000

commit 0967580cd1a9b14bed65301304502e4020276874
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Mar 12 13:52:50 2025 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Mar 13 08:29:12 2025 +0100

    xen/arm: Restrict Kconfig configuration for LLC coloring
    
    Xen LLC coloring feature can be used only on the MMU subsystem,
    move the code that selects it from ARM_64 to MMU and add the
    ARM_64 dependency.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index a26d3e1182..ffdff1f0a3 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -8,7 +8,6 @@ config ARM_64
 	depends on !ARM_32
 	select 64BIT
 	select HAS_FAST_MULTIPLY
-	select HAS_LLC_COLORING if !NUMA
 
 config ARM
 	def_bool y
@@ -76,6 +75,7 @@ choice
 
 config MMU
 	bool "MMU"
+	select HAS_LLC_COLORING if !NUMA && ARM_64
 	select HAS_PMAP
 	select HAS_VMAP
 	select HAS_PASSTHROUGH
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 09:33:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 09:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911713.1318108 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsew3-0001Mo-Ee; Thu, 13 Mar 2025 09:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911713.1318108; Thu, 13 Mar 2025 09:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsew3-0001Mh-Bw; Thu, 13 Mar 2025 09:33:03 +0000
Received: by outflank-mailman (input) for mailman id 911713;
 Thu, 13 Mar 2025 09:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsew2-0001Ix-82
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 09:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsew2-000fHY-0o
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 09:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsew1-008T6t-3A
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 09:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9STeSFZMzpUVoeTd2DsWzCXXIHqKDbOL9Zy76Ux2Ycw=; b=c7SgG5ryX01ocd52iBdLP1L6zm
	nCGAQSlSwAnsJsDNaLukMiarEs9fQwMcUlPC+rwi3TU3ilufl000yqlz9a7lwMwHuqhPM4Ik09TE1
	LMS9dVcDItznfDEg2pgxENTyw3bk+ZRnPLB+JNbOwElj63MSh2ffBZLnFdqk4CubdV6w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: avoid infinite loop in libxl__remove_directory()
Message-Id: <E1tsew1-008T6t-3A@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 09:33:01 +0000

commit 68baeb5c4852e652b9599e049f40477edac4060e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 13 10:23:10 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 13 10:23:10 2025 +0100

    libxl: avoid infinite loop in libxl__remove_directory()
    
    Infinitely retrying the rmdir() invocation makes little sense. While the
    original observation was the log filling the disk (due to repeated
    "Directory not empty" errors, in turn occurring for unclear reasons),
    the loop wants breaking even if there was no error message being logged
    (much like is done in the similar loops in libxl__remove_file() and
    libxl__remove_file_or_directory()).
    
    Fixes: c4dcbee67e6d ("libxl: provide libxl__remove_file et al")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_utils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_utils.c b/tools/libs/light/libxl_utils.c
index 506c5b5631..5ae8935344 100644
--- a/tools/libs/light/libxl_utils.c
+++ b/tools/libs/light/libxl_utils.c
@@ -577,6 +577,7 @@ int libxl__remove_directory(libxl__gc *gc, const char *dirpath)
         if (errno == EINTR) continue;
         LOGE(ERROR, "failed to remove emptied directory %s", dirpath);
         rc = ERROR_FAIL;
+        break;
     }
 
  out:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 09:33:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 09:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911714.1318112 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsewD-0001SF-GA; Thu, 13 Mar 2025 09:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911714.1318112; Thu, 13 Mar 2025 09:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsewD-0001S7-DS; Thu, 13 Mar 2025 09:33:13 +0000
Received: by outflank-mailman (input) for mailman id 911714;
 Thu, 13 Mar 2025 09:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsewC-0001Rz-4K
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 09:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsewC-000fHd-16
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 09:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsewC-008T7O-0E
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 09:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qcjR0GYZ3YSkFgxQoqgn5HiyFVoz3bCMdR+2ItZjpFE=; b=ZPop3ki/+UWu0ChQXfPqDY1RYU
	5H0ZJvMWtkP+MW7J6Jwv8KhW529ktX7RCnjkR9VreDoknOPe5u1nRMmmHrfTgFN3qgCSD1BtYt81A
	heaWxNEUZ9hZIkJ9IC5S47xqyWn8aha543rpewohxi9cVgXAnEOB5RLzqueAahtrM31U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
Message-Id: <E1tsewC-008T7O-0E@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 09:33:12 +0000

commit 8808f45305d146d05469ed4551bb5ccf931b1800
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Thu Mar 13 10:23:42 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 13 10:23:42 2025 +0100

    tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
    
    It is valid for a PCI device to not have a legacy IRQ.  In that case, do
    not print an error to keep the logs clean.
    
    This relies on pciback being updated to return -ENOENT for a missing
    GSI.
    
    Fixes: b93e5981d258 ("tools: Add new function to get gsi from dev")
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/ctrl/xc_linux.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/libs/ctrl/xc_linux.c b/tools/libs/ctrl/xc_linux.c
index 92591e49a1..2b2d7b3196 100644
--- a/tools/libs/ctrl/xc_linux.c
+++ b/tools/libs/ctrl/xc_linux.c
@@ -77,9 +77,14 @@ int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
     ret = ioctl(xencall_fd(xch->xcall),
                 IOCTL_PRIVCMD_PCIDEV_GET_GSI, &dev_gsi);
 
-    if (ret < 0) {
-        PERROR("Failed to get gsi from dev");
-    } else {
+    if ( ret < 0 )
+    {
+        if ( errno != ENOENT )
+            PERROR("Failed to get gsi for dev %04x:%02x:%02x.%u",
+                sbdf >> 16, (sbdf >> 8) & 0xff, sbdf >> 3 & 0x1f, sbdf & 0x7);
+    }
+    else
+    {
         ret = dev_gsi.gsi;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 09:33:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 09:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911715.1318116 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsewN-0001ce-HK; Thu, 13 Mar 2025 09:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911715.1318116; Thu, 13 Mar 2025 09:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsewN-0001cW-Er; Thu, 13 Mar 2025 09:33:23 +0000
Received: by outflank-mailman (input) for mailman id 911715;
 Thu, 13 Mar 2025 09:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsewM-0001c9-7T
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 09:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsewM-000fI3-1N
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 09:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsewM-008T8U-0W
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 09:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JhKnlGQmdDs6a3PIuiLuZr3f1vpH11wGbcL+dGvpvjE=; b=Sm2UFIKO9jkYqFAcmYPpCrF5e/
	7BmEEb4/smy9m5FCnhj/IZr6lGh4MiipAosBFfvZ24KFtwfd2I0vUrDCoWhD7cbyz8mb3tA+CTogc
	kAS1LWNTWU84/warSsLdsomwwo5Qy5BrDVwUFkbO/ah1IWsDO890v1yPn4fUsAUwbT1Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxl: Skip missing PCI GSIs
Message-Id: <E1tsewM-008T8U-0W@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 09:33:22 +0000

commit d3ac8fdce26476d148fb2a8f18c7e5b0c153be0a
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Thu Mar 13 10:23:52 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 13 10:23:52 2025 +0100

    tools/libxl: Skip missing PCI GSIs
    
    A PCI device may not have a legacy IRQ.  In that case, we don't need to
    do anything, so don't fail in libxl__arch_hvm_map_gsi() and
    libxl__arch_hvm_unmap_gsi().
    
    Requires an updated pciback to return -ENOENT.
    
    Fixes: f97f885c7198 ("tools: Add new function to do PIRQ (un)map on PVH dom0")
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_x86.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index a3164a3077..0a7f64ad46 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -901,7 +901,10 @@ int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
     int pirq = -1, gsi, r;
 
     gsi = xc_pcidev_get_gsi(CTX->xch, sbdf);
-    if (gsi < 0) {
+    if (gsi < 0 && errno == ENOENT) {
+        LOGD(DEBUG, domid, "xc_pcidev_get_gsi no gsi");
+        return 0;
+    } else if (gsi < 0) {
         return ERROR_FAIL;
     }
 
@@ -925,7 +928,10 @@ int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
     int pirq = -1, gsi, r;
 
     gsi = xc_pcidev_get_gsi(CTX->xch, sbdf);
-    if (gsi < 0) {
+    if (gsi < 0 && errno == ENOENT) {
+        LOGD(DEBUG, domid, "xc_pcidev_get_gsi no gsi");
+        return 0;
+    } else if (gsi < 0) {
         return ERROR_FAIL;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 09:33:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 09:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911717.1318119 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsewX-0001jy-J8; Thu, 13 Mar 2025 09:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911717.1318119; Thu, 13 Mar 2025 09:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsewX-0001jq-GG; Thu, 13 Mar 2025 09:33:33 +0000
Received: by outflank-mailman (input) for mailman id 911717;
 Thu, 13 Mar 2025 09:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsewW-0001ji-AG
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 09:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsewW-000fI8-1h
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 09:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsewW-008T9B-0n
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 09:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MFlQbWGdq/KmWdoE9IRBbVTbDnu1fkLbE9md3Zod82g=; b=BHgSTNmuX3msN4M9mz8dXvXe3T
	DCqkl5Dy31o7X71dv9ONN1AAHyYUQNn0m7y0KUU7NXJBAZOmj0MjGnSMwitid0xdpW2OFgXrL1EBM
	brGn9gzRIzMWOtKjzHFn2o0qB/NN2F7IzNBsQupB/dAeZt2dBpWAj2XabQZlHpowyR1c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: replace p2m_is_valid() uses
Message-Id: <E1tsewW-008T9B-0n@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 09:33:32 +0000

commit 91772f8420dfa2fcfe4db68480c216db5b79c512
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 13 10:24:15 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 13 10:24:15 2025 +0100

    x86/shadow: replace p2m_is_valid() uses
    
    The justification for dropping p2m_mmio_dm from p2m_is_valid() was wrong
    for two of the shadow mode uses.
    
    In _sh_propagate() we want to create special L1 entries for p2m_mmio_dm
    pages. Hence we need to make sure we don't bail early for that type.
    
    In _sh_page_fault() we want to handle p2m_mmio_dm by forwarding to
    (internal or external) emulation. Pull the !p2m_is_mmio() check out of
    the || expression (as otherwise it would need adding to the lhs as
    well).
    
    In both cases, p2m_is_valid() in combination with p2m_is_grant() still
    doesn't cover foreign mappings. Hence use p2m_is_any_ram() plus (as
    necessary) p2m_mmio_* instead.
    
    Fixes: be59cceb2dbb ("x86/P2M: don't include MMIO_DM in p2m_is_valid()")
    Reported-by: Luca Fancellu <Luca.Fancellu@arm.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/arch/x86/mm/shadow/multi.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 10ddc408ff..7be9c180ec 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -471,9 +471,7 @@ _sh_propagate(struct vcpu *v,
     /* We don't shadow PAE l3s */
     ASSERT(GUEST_PAGING_LEVELS > 3 || level != 3);
 
-    /* Check there's something for the shadows to map to */
-    if ( (!p2m_is_valid(p2mt) && !p2m_is_grant(p2mt))
-         || !gfn_valid(d, target_gfn) )
+    if ( !gfn_valid(d, target_gfn) )
     {
         *sp = shadow_l1e_empty();
         goto done;
@@ -503,6 +501,13 @@ _sh_propagate(struct vcpu *v,
         goto done;
     }
 
+    /* Check there's something for the shadows to map to */
+    if ( !p2m_is_any_ram(p2mt) && p2mt != p2m_mmio_direct )
+    {
+        *sp = shadow_l1e_empty();
+        goto done;
+    }
+
     // Must have a valid target_mfn unless this is a prefetch or an l1
     // pointing at MMIO space.  In the case of a prefetch, an invalid
     // mfn means that we can not usefully shadow anything, and so we
@@ -2365,9 +2370,17 @@ static int cf_check sh_page_fault(
     gfn = guest_walk_to_gfn(&gw);
     gmfn = get_gfn(d, gfn, &p2mt);
 
+    /*
+     * p2m_mmio_dm in particular is handled further down, and hence can't be
+     * short-circuited here. Furthermore, while not fitting with architectural
+     * behavior, propagating #PF to the guest when a sensible shadow entry
+     * can't be written is necessary. Without doing so (by installing a non-
+     * present entry) we'd get back right here immediately afterwards, thus
+     * preventing the guest from making further forward progress.
+     */
     if ( shadow_mode_refcounts(d) &&
-         ((!p2m_is_valid(p2mt) && !p2m_is_grant(p2mt)) ||
-          (!p2m_is_mmio(p2mt) && !mfn_valid(gmfn))) )
+         !p2m_is_mmio(p2mt) &&
+         (!p2m_is_any_ram(p2mt) || !mfn_valid(gmfn)) )
     {
         perfc_incr(shadow_fault_bail_bad_gfn);
         SHADOW_PRINTK("BAD gfn=%"SH_PRI_gfn" gmfn=%"PRI_mfn"\n",
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 10:44:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 10:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911891.1318257 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsg2l-0004SS-NS; Thu, 13 Mar 2025 10:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911891.1318257; Thu, 13 Mar 2025 10:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsg2l-0004SK-Kd; Thu, 13 Mar 2025 10:44:03 +0000
Received: by outflank-mailman (input) for mailman id 911891;
 Thu, 13 Mar 2025 10:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsg2j-0004SE-Mp
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 10:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsg2j-000guO-2Z
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 10:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsg2j-008Xtk-1g
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 10:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=w5MW5F7iH+weMGM15FjDX2tjfvNJ5UV7AblFL6ew/Hg=; b=O8pLT7GEM9MFE33kS+zTWvp3jm
	3LWH6GpMM33cb6Sy4HbOJcIq8UwK5nHQV3obf+JDb952t+ZgcT5tDp/6f+2F1mTikwzybDYYhIIaG
	Eax4n85HZ7VWhyS5QWSnBpjjbUzFa62A43uh3zupmniMqF35JJIeekfdod+CKpBKb15w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: avoid infinite loop in libxl__remove_directory()
Message-Id: <E1tsg2j-008Xtk-1g@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 10:44:01 +0000

commit 68baeb5c4852e652b9599e049f40477edac4060e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 13 10:23:10 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 13 10:23:10 2025 +0100

    libxl: avoid infinite loop in libxl__remove_directory()
    
    Infinitely retrying the rmdir() invocation makes little sense. While the
    original observation was the log filling the disk (due to repeated
    "Directory not empty" errors, in turn occurring for unclear reasons),
    the loop wants breaking even if there was no error message being logged
    (much like is done in the similar loops in libxl__remove_file() and
    libxl__remove_file_or_directory()).
    
    Fixes: c4dcbee67e6d ("libxl: provide libxl__remove_file et al")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_utils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_utils.c b/tools/libs/light/libxl_utils.c
index 506c5b5631..5ae8935344 100644
--- a/tools/libs/light/libxl_utils.c
+++ b/tools/libs/light/libxl_utils.c
@@ -577,6 +577,7 @@ int libxl__remove_directory(libxl__gc *gc, const char *dirpath)
         if (errno == EINTR) continue;
         LOGE(ERROR, "failed to remove emptied directory %s", dirpath);
         rc = ERROR_FAIL;
+        break;
     }
 
  out:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 10:44:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 10:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911892.1318260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsg2u-0004U3-OX; Thu, 13 Mar 2025 10:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911892.1318260; Thu, 13 Mar 2025 10:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsg2u-0004Tv-M0; Thu, 13 Mar 2025 10:44:12 +0000
Received: by outflank-mailman (input) for mailman id 911892;
 Thu, 13 Mar 2025 10:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsg2t-0004Tj-M3
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 10:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsg2t-000gxB-2r
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 10:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsg2t-008XuO-1y
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 10:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/z0vlOI99JIgV1MOH4W2UBWP41urzilta3Z/2OFLSCM=; b=xN4gjcX2uh8/X7doxOkErJ2wpJ
	eTVZ7iD5eicGsvYTUV62r2t1A8KutawSsWvsfx/2Fq/oPez85uFVbOuytpNudPBFh0Hd7Gxxu5fZ+
	RO+l/G/b3N+jRx7x6w1WeFRBYrSjNA7DCzUN2qe9vCjmR1Pbjaw19CRaYDaquKrOp3Y0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
Message-Id: <E1tsg2t-008XuO-1y@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 10:44:11 +0000

commit 8808f45305d146d05469ed4551bb5ccf931b1800
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Thu Mar 13 10:23:42 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 13 10:23:42 2025 +0100

    tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
    
    It is valid for a PCI device to not have a legacy IRQ.  In that case, do
    not print an error to keep the logs clean.
    
    This relies on pciback being updated to return -ENOENT for a missing
    GSI.
    
    Fixes: b93e5981d258 ("tools: Add new function to get gsi from dev")
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/ctrl/xc_linux.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/libs/ctrl/xc_linux.c b/tools/libs/ctrl/xc_linux.c
index 92591e49a1..2b2d7b3196 100644
--- a/tools/libs/ctrl/xc_linux.c
+++ b/tools/libs/ctrl/xc_linux.c
@@ -77,9 +77,14 @@ int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
     ret = ioctl(xencall_fd(xch->xcall),
                 IOCTL_PRIVCMD_PCIDEV_GET_GSI, &dev_gsi);
 
-    if (ret < 0) {
-        PERROR("Failed to get gsi from dev");
-    } else {
+    if ( ret < 0 )
+    {
+        if ( errno != ENOENT )
+            PERROR("Failed to get gsi for dev %04x:%02x:%02x.%u",
+                sbdf >> 16, (sbdf >> 8) & 0xff, sbdf >> 3 & 0x1f, sbdf & 0x7);
+    }
+    else
+    {
         ret = dev_gsi.gsi;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 10:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 10:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911893.1318264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsg35-0004X4-Q2; Thu, 13 Mar 2025 10:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911893.1318264; Thu, 13 Mar 2025 10:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsg35-0004Wu-NN; Thu, 13 Mar 2025 10:44:23 +0000
Received: by outflank-mailman (input) for mailman id 911893;
 Thu, 13 Mar 2025 10:44:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsg33-0004Wj-Oy
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 10:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsg33-000gxg-39
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 10:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsg33-008Xv7-2G
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 10:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OMTAuogQ4ezpgnnwrgr81YCy7Q0692TO+m3sZkXyPlo=; b=tM55vvlZGS3bQ9ZJUhrvfpoJaQ
	ErFTDTZGZ/ETG17ZmZdIpa8Q+O3EE7WXsHSaFXPNA0due5/lmEGSaNBdc5vLCvzr+C0ZuXWpiUF0o
	v/uq0z4G4851a7NqE2CAhu2VhE+5FvyYLjUsVUDKJyCUo7l4zQd26QTQFhq53m+otsA4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxl: Skip missing PCI GSIs
Message-Id: <E1tsg33-008Xv7-2G@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 10:44:21 +0000

commit d3ac8fdce26476d148fb2a8f18c7e5b0c153be0a
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Thu Mar 13 10:23:52 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 13 10:23:52 2025 +0100

    tools/libxl: Skip missing PCI GSIs
    
    A PCI device may not have a legacy IRQ.  In that case, we don't need to
    do anything, so don't fail in libxl__arch_hvm_map_gsi() and
    libxl__arch_hvm_unmap_gsi().
    
    Requires an updated pciback to return -ENOENT.
    
    Fixes: f97f885c7198 ("tools: Add new function to do PIRQ (un)map on PVH dom0")
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_x86.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index a3164a3077..0a7f64ad46 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -901,7 +901,10 @@ int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
     int pirq = -1, gsi, r;
 
     gsi = xc_pcidev_get_gsi(CTX->xch, sbdf);
-    if (gsi < 0) {
+    if (gsi < 0 && errno == ENOENT) {
+        LOGD(DEBUG, domid, "xc_pcidev_get_gsi no gsi");
+        return 0;
+    } else if (gsi < 0) {
         return ERROR_FAIL;
     }
 
@@ -925,7 +928,10 @@ int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
     int pirq = -1, gsi, r;
 
     gsi = xc_pcidev_get_gsi(CTX->xch, sbdf);
-    if (gsi < 0) {
+    if (gsi < 0 && errno == ENOENT) {
+        LOGD(DEBUG, domid, "xc_pcidev_get_gsi no gsi");
+        return 0;
+    } else if (gsi < 0) {
         return ERROR_FAIL;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 13 10:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Mar 2025 10:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.911894.1318269 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsg3F-0004Za-Ri; Thu, 13 Mar 2025 10:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 911894.1318269; Thu, 13 Mar 2025 10:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tsg3F-0004ZT-Oi; Thu, 13 Mar 2025 10:44:33 +0000
Received: by outflank-mailman (input) for mailman id 911894;
 Thu, 13 Mar 2025 10:44:31 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tsg3D-0004ZD-SE
 for xen-changelog@lists.xenproject.org; Thu, 13 Mar 2025 10:44:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsg3E-000gxv-0F
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 10:44:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tsg3D-008Xvn-2a
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Mar 2025 10:44:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eFET2SjUkoKWCJ5qA7Z/LrywiS587Vc6n1rVvGlmMRY=; b=G33K8xafDGPpFcIxqJknlMoFGG
	7Kj9olEJ+bYPPlPjksW/tJ8NAqU8iSDsrZp0UnyHVmefoEzZ6HgdgNAmjf6w02Sb1HU6a5z6LckT0
	nCPhQoWWZhP9j46KNWjY5gU6XixIOXX7FcrPUvHM3T9RmUSiXpID8UadA3aqHBH+P66Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: replace p2m_is_valid() uses
Message-Id: <E1tsg3D-008Xvn-2a@xenbits.xenproject.org>
Date: Thu, 13 Mar 2025 10:44:31 +0000

commit 91772f8420dfa2fcfe4db68480c216db5b79c512
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 13 10:24:15 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 13 10:24:15 2025 +0100

    x86/shadow: replace p2m_is_valid() uses
    
    The justification for dropping p2m_mmio_dm from p2m_is_valid() was wrong
    for two of the shadow mode uses.
    
    In _sh_propagate() we want to create special L1 entries for p2m_mmio_dm
    pages. Hence we need to make sure we don't bail early for that type.
    
    In _sh_page_fault() we want to handle p2m_mmio_dm by forwarding to
    (internal or external) emulation. Pull the !p2m_is_mmio() check out of
    the || expression (as otherwise it would need adding to the lhs as
    well).
    
    In both cases, p2m_is_valid() in combination with p2m_is_grant() still
    doesn't cover foreign mappings. Hence use p2m_is_any_ram() plus (as
    necessary) p2m_mmio_* instead.
    
    Fixes: be59cceb2dbb ("x86/P2M: don't include MMIO_DM in p2m_is_valid()")
    Reported-by: Luca Fancellu <Luca.Fancellu@arm.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/arch/x86/mm/shadow/multi.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 10ddc408ff..7be9c180ec 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -471,9 +471,7 @@ _sh_propagate(struct vcpu *v,
     /* We don't shadow PAE l3s */
     ASSERT(GUEST_PAGING_LEVELS > 3 || level != 3);
 
-    /* Check there's something for the shadows to map to */
-    if ( (!p2m_is_valid(p2mt) && !p2m_is_grant(p2mt))
-         || !gfn_valid(d, target_gfn) )
+    if ( !gfn_valid(d, target_gfn) )
     {
         *sp = shadow_l1e_empty();
         goto done;
@@ -503,6 +501,13 @@ _sh_propagate(struct vcpu *v,
         goto done;
     }
 
+    /* Check there's something for the shadows to map to */
+    if ( !p2m_is_any_ram(p2mt) && p2mt != p2m_mmio_direct )
+    {
+        *sp = shadow_l1e_empty();
+        goto done;
+    }
+
     // Must have a valid target_mfn unless this is a prefetch or an l1
     // pointing at MMIO space.  In the case of a prefetch, an invalid
     // mfn means that we can not usefully shadow anything, and so we
@@ -2365,9 +2370,17 @@ static int cf_check sh_page_fault(
     gfn = guest_walk_to_gfn(&gw);
     gmfn = get_gfn(d, gfn, &p2mt);
 
+    /*
+     * p2m_mmio_dm in particular is handled further down, and hence can't be
+     * short-circuited here. Furthermore, while not fitting with architectural
+     * behavior, propagating #PF to the guest when a sensible shadow entry
+     * can't be written is necessary. Without doing so (by installing a non-
+     * present entry) we'd get back right here immediately afterwards, thus
+     * preventing the guest from making further forward progress.
+     */
     if ( shadow_mode_refcounts(d) &&
-         ((!p2m_is_valid(p2mt) && !p2m_is_grant(p2mt)) ||
-          (!p2m_is_mmio(p2mt) && !mfn_valid(gmfn))) )
+         !p2m_is_mmio(p2mt) &&
+         (!p2m_is_any_ram(p2mt) || !mfn_valid(gmfn)) )
     {
         perfc_incr(shadow_fault_bail_bad_gfn);
         SHADOW_PRINTK("BAD gfn=%"SH_PRI_gfn" gmfn=%"PRI_mfn"\n",
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 09:33:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 09:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.914253.1320030 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt1Pc-0004XW-AF; Fri, 14 Mar 2025 09:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 914253.1320030; Fri, 14 Mar 2025 09:33:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt1Pc-0004XK-6z; Fri, 14 Mar 2025 09:33:04 +0000
Received: by outflank-mailman (input) for mailman id 914253;
 Fri, 14 Mar 2025 09:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tt1Pa-0004XE-JZ
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 09:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt1Pa-002ZnE-2O
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 09:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt1Pa-00AR0O-1T
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 09:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OEQRePbka//N5mDt2+B6xoMbjXy3v64vrpw8va9h6/8=; b=IkWaL8f9e7QN2G3EmpiYbOZRZq
	ULmRk/nw6XKjAF2/sWYENRYcevK739E9LQgBnreQxxgAG2BYOdWwjSHFsZUVYhE6RNT8Bra3EMFVX
	3KuftF8UhRR8N5pOfrkPmvTneMUDPUgzhfEcHzWn4WZgnlzcAc6hPKXsMCtsqZzRNw2s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/page: fix return type of online_page()
Message-Id: <E1tt1Pa-00AR0O-1T@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 09:33:02 +0000

commit df56af1d7af91b2383bc71bc8b292c4a2521424d
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Fri Mar 14 10:16:28 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 14 10:16:28 2025 +0100

    xen/page: fix return type of online_page()
    
    This commit fixes return type of online_page(), which shall be int
    to include correct error value.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/page_alloc.c | 2 +-
 xen/include/xen/mm.h    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 5f9c9305ef..bd4538c28d 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1763,7 +1763,7 @@ int offline_page(mfn_t mfn, int broken, uint32_t *status)
  *   The caller should make sure end_pfn <= max_page,
  *   if not, expand_pages() should be called prior to online_page().
  */
-unsigned int online_page(mfn_t mfn, uint32_t *status)
+int online_page(mfn_t mfn, uint32_t *status)
 {
     unsigned long x, nx, y;
     struct page_info *pg;
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 16f733281a..ae1c48a615 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -144,7 +144,7 @@ unsigned long avail_domheap_pages(void);
 unsigned long avail_node_heap_pages(unsigned int nodeid);
 #define alloc_domheap_page(d,f) (alloc_domheap_pages(d,0,f))
 #define free_domheap_page(p)  (free_domheap_pages(p,0))
-unsigned int online_page(mfn_t mfn, uint32_t *status);
+int online_page(mfn_t mfn, uint32_t *status);
 int offline_page(mfn_t mfn, int broken, uint32_t *status);
 int query_page_offline(mfn_t mfn, uint32_t *status);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 09:33:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 09:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.914254.1320034 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt1Pm-0004ZK-BJ; Fri, 14 Mar 2025 09:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 914254.1320034; Fri, 14 Mar 2025 09:33:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt1Pm-0004ZC-8L; Fri, 14 Mar 2025 09:33:14 +0000
Received: by outflank-mailman (input) for mailman id 914254;
 Fri, 14 Mar 2025 09:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tt1Pk-0004Ys-KT
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 09:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt1Pk-002ZnI-2h
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 09:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt1Pk-00AR1x-1p
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 09:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Bw6M8LF6CQ5UyfshbJ2/ln0tI0m9ZnM5rttrQkFoABM=; b=1TLuy75cdfwJahkEX6MBkoKIQ2
	Ze7CKP+Dk2MSXfRkDVZgk10UvmBlKOBS2yVmSKEXq4DkEYx7oOJ8ooqaDaaFRcm9PuwR9eFGBHZFV
	kgFtrvpNS/cr1nVcNh+WuHn3rv1KpYCRjkrMf+pgLHBmvU0zrtw+ELVc6jKaYJjMZhGg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/sched: fix arinc653 to not use variables across cpupools
Message-Id: <E1tt1Pk-00AR1x-1p@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 09:33:12 +0000

commit d0561ac8ab0e780b1e8ab41d0d15e9f9b076dee3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 14 10:17:11 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 14 10:17:11 2025 +0100

    xen/sched: fix arinc653 to not use variables across cpupools
    
    a653sched_do_schedule() is using two function local static variables,
    which is resulting in bad behavior when using more than one cpupool
    with the arinc653 scheduler.
    
    Fix that by moving those variables to the scheduler private data.
    
    Fixes: 22787f2e107c ("ARINC 653 scheduler")
    Reported-by: Choi Anderson <Anderson.Choi@boeing.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
---
 xen/common/sched/arinc653.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index a82c0d7314..9ebae6d7ae 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -143,6 +143,12 @@ typedef struct a653sched_priv_s
      * pointers to all Xen UNIT structures for iterating through
      */
     struct list_head unit_list;
+
+    /**
+     * scheduling house keeping variables
+     */
+    unsigned int sched_index;
+    s_time_t next_switch_time;
 } a653sched_priv_t;
 
 /**************************************************************************
@@ -513,8 +519,6 @@ a653sched_do_schedule(
     bool tasklet_work_scheduled)
 {
     struct sched_unit *new_task = NULL;
-    static unsigned int sched_index = 0;
-    static s_time_t next_switch_time;
     a653sched_priv_t *sched_priv = SCHED_PRIV(ops);
     const unsigned int cpu = sched_get_resource_cpu(smp_processor_id());
     unsigned long flags;
@@ -528,18 +532,19 @@ a653sched_do_schedule(
         /* time to enter a new major frame
          * the first time this function is called, this will be true */
         /* start with the first domain in the schedule */
-        sched_index = 0;
+        sched_priv->sched_index = 0;
         sched_priv->next_major_frame = now + sched_priv->major_frame;
-        next_switch_time = now + sched_priv->schedule[0].runtime;
+        sched_priv->next_switch_time = now + sched_priv->schedule[0].runtime;
     }
     else
     {
-        while ( (now >= next_switch_time)
-                && (sched_index < sched_priv->num_schedule_entries) )
+        while ( (now >= sched_priv->next_switch_time) &&
+                (sched_priv->sched_index < sched_priv->num_schedule_entries) )
         {
             /* time to switch to the next domain in this major frame */
-            sched_index++;
-            next_switch_time += sched_priv->schedule[sched_index].runtime;
+            sched_priv->sched_index++;
+            sched_priv->next_switch_time +=
+                sched_priv->schedule[sched_priv->sched_index].runtime;
         }
     }
 
@@ -547,8 +552,8 @@ a653sched_do_schedule(
      * If we exhausted the domains in the schedule and still have time left
      * in the major frame then switch next at the next major frame.
      */
-    if ( sched_index >= sched_priv->num_schedule_entries )
-        next_switch_time = sched_priv->next_major_frame;
+    if ( sched_priv->sched_index >= sched_priv->num_schedule_entries )
+        sched_priv->next_switch_time = sched_priv->next_major_frame;
 
     /*
      * If there are more domains to run in the current major frame, set
@@ -556,8 +561,8 @@ a653sched_do_schedule(
      * Otherwise, set new_task equal to the address of the idle task's
      * sched_unit structure.
      */
-    new_task = (sched_index < sched_priv->num_schedule_entries)
-        ? sched_priv->schedule[sched_index].unit
+    new_task = (sched_priv->sched_index < sched_priv->num_schedule_entries)
+        ? sched_priv->schedule[sched_priv->sched_index].unit
         : IDLETASK(cpu);
 
     /* Check to see if the new task can be run (awake & runnable). */
@@ -589,7 +594,7 @@ a653sched_do_schedule(
      * Return the amount of time the next domain has to run and the address
      * of the selected task's UNIT structure.
      */
-    prev->next_time = next_switch_time - now;
+    prev->next_time = sched_priv->next_switch_time - now;
     prev->next_task = new_task;
     new_task->migrated = false;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 09:33:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 09:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.914255.1320037 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt1Pw-0004c4-CQ; Fri, 14 Mar 2025 09:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 914255.1320037; Fri, 14 Mar 2025 09:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt1Pw-0004bw-9h; Fri, 14 Mar 2025 09:33:24 +0000
Received: by outflank-mailman (input) for mailman id 914255;
 Fri, 14 Mar 2025 09:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tt1Pu-0004bl-Nb
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 09:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt1Pu-002ZnN-2z
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 09:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt1Pu-00AR38-26
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 09:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Nl7QAbAvB405+BUpWo6Lrw9E46oUOeF0E57bK+OG5OE=; b=Z3rc+HipPaEfbTGhKr7cVg7zqJ
	AKSMQKWJ1hQTCkJngkF3GEqgfijMNzhlKr9P/Ik2ro8ILz3LweuP85c2YcstOrP/sijBHHZYeQe/T
	VPQgch6ismCJO5ZGp2qWin3khu0SBkmxjvbAtLW2tB20O+ZyzwCEtsKzuHVOM9o1qrq0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: specify numerical values of Xenstore commands
Message-Id: <E1tt1Pu-00AR38-26@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 09:33:22 +0000

commit 58c96d53f1e1c510424ceae9aa0639f95e1b37a4
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 14 10:17:47 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 14 10:17:47 2025 +0100

    docs: specify numerical values of Xenstore commands
    
    In docs/misc/xenstore.txt all Xenstore commands are specified, but
    the specifications lack the numerical values of the commands.
    
    Add a table with all commands, their values, and a potential remark
    (e.g. whether the command is optional).
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 docs/misc/xenstore.txt | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/docs/misc/xenstore.txt b/docs/misc/xenstore.txt
index 7e1f031520..4eccbc2f7f 100644
--- a/docs/misc/xenstore.txt
+++ b/docs/misc/xenstore.txt
@@ -86,6 +86,67 @@ parts of xenstore inaccessible to some clients.  In any case passing
 bulk data through xenstore is not recommended as the performance
 properties are poor.
 
+---------- Defined Xenstore message types ----------
+
+Below is a table with all defined Xenstore message types (type name
+and its associated numerical value).
+
+Some types are optional to be supported by a specific Xenstore
+implementation.  If an optional type is not supported by a Xenstore
+implementation, Xen tools will continue to work, maybe with slightly
+reduced functionality.  A mandatory type not being supported will
+result in severely reduced functionality, like inability to create
+domains.  In case a type is optional, this is stated in the table with
+the lost functionality in case Xenstore doesn't support that type.
+Any not supported type sent to Xenstore will result in an error response
+with the "ENOSYS" error.
+
+CONTROL               0    optional
+    If not supported, xenstore-control command will not work.
+    DEBUG is a deprecated alias of CONTROL.
+DIRECTORY             1
+READ                  2
+GET_PERMS             3
+WATCH                 4
+UNWATCH               5
+TRANSACTION_START     6
+TRANSACTION_END       7
+INTRODUCE             8
+RELEASE               9
+GET_DOMAIN_PATH      10
+WRITE                11
+MKDIR                12
+RM                   13
+SET_PERMS            14
+WATCH_EVENT          15
+    Not valid in client sent messages.
+    Only valid in Xenstore replies.
+ERROR                16
+    Not valid in client sent messages.
+    Only valid in Xenstore replies.
+IS_DOMAIN_INTRODUCED 17
+RESUME               18
+SET_TARGET           19
+RESTRICT             20    no longer supported
+    RESTRICT has been removed, the type value 20 is invalid.
+RESET_WATCHES        21
+DIRECTORY_PART       22    optional
+    If not supported, the output of xenstore-ls might be incomplete
+    with a node's sub-node list exceeding the maximum payload size
+    (e.g. the "/local/domain" node with more than ca. 1000 domains
+    active).
+GET_FEATURE          23    optional
+SET_FEATURE          24    optional
+    SET_FEATURE requires GET_FEATURE to be supported.
+    If unsupported, setting availability of Xenstore features per
+    domain is not possible.
+GET_QUOTA            25    optional
+SET_QUOTA            26    optional
+    SET_QUOTA requires GET_QUOTA to be supported.
+    If unsupported, setting of Xenstore quota per domain is not
+    possible.
+INVALID           65535
+    Guaranteed invalid type (never supported).
 
 ---------- Xenstore protocol details - introduction ----------
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 09:33:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 09:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.914256.1320041 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt1Q6-0004eo-De; Fri, 14 Mar 2025 09:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 914256.1320041; Fri, 14 Mar 2025 09:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt1Q6-0004eg-B4; Fri, 14 Mar 2025 09:33:34 +0000
Received: by outflank-mailman (input) for mailman id 914256;
 Fri, 14 Mar 2025 09:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tt1Q4-0004eR-Qa
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 09:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt1Q5-002Zpp-06
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 09:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt1Q4-00AR4c-2O
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 09:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ALIFWqww1lVd30jQcJLqWbE+glLvXoFiC/DIQZfgBvE=; b=iBzXaewyLtFClRs3NrDFTndSFm
	qV+HUTqkicXL6MlAEQY95qjwC9dp5T59+YQlba7ODtXSTzv1A8LQQO8Nj1VKTTuU+9VrR3QfYXl7g
	iWDpAGwGDe5Ciptl/S6RSYaSNzXkbfFTiK2oWbPQmzVyv3wdHJ3zWFUheY3spSnopqOY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: move obtaining of MSI/HPET source ID
Message-Id: <E1tt1Q4-00AR4c-2O@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 09:33:32 +0000

commit a22223ae448514a809cc73e8e75514b857c255a7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 14 10:18:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 14 10:18:12 2025 +0100

    VT-d: move obtaining of MSI/HPET source ID
    
    This was the original attempt to address XSA-467, until it was found
    that IRQs can be off already from higher up the call stack. Nevertheless
    moving code out of locked regions is generally desirable anyway; some of
    the callers, after all, don't disable interrupts or acquire other locks.
    
    Hence, despite this not addressing the original report:
    
    Data collection solely depends on the passed in PCI device. Furthermore,
    since the function only writes to a local variable, we can pull the
    invocation of set_msi_source_id() (and also set_hpet_source_id()) ahead
    of the acquiring of the (IRQ-safe) lock.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/passthrough/vtd/intremap.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index b3b53518e2..b2f5b4a65a 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -508,6 +508,11 @@ static int msi_msg_to_remap_entry(
     const struct pi_desc *pi_desc = msi_desc->pi_desc;
     bool alloc = false;
 
+    if ( pdev )
+        set_msi_source_id(pdev, &new_ire);
+    else
+        set_hpet_source_id(msi_desc->hpet_id, &new_ire);
+
     if ( msi_desc->msi_attrib.type == PCI_CAP_ID_MSI )
         nr = msi_desc->msi.nvec;
 
@@ -575,11 +580,6 @@ static int msi_msg_to_remap_entry(
         new_ire.post.p = 1;
     }
 
-    if ( pdev )
-        set_msi_source_id(pdev, &new_ire);
-    else
-        set_hpet_source_id(msi_desc->hpet_id, &new_ire);
-
     /* now construct new MSI/MSI-X rte entry */
     remap_rte = (struct msi_msg_remap_entry *)msg;
     remap_rte->address_lo.dontcare = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 09:33:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 09:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.914257.1320045 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt1QG-0004tm-Es; Fri, 14 Mar 2025 09:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 914257.1320045; Fri, 14 Mar 2025 09:33:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt1QG-0004tf-CQ; Fri, 14 Mar 2025 09:33:44 +0000
Received: by outflank-mailman (input) for mailman id 914257;
 Fri, 14 Mar 2025 09:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tt1QE-0004s7-TB
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 09:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt1QF-002ZqE-0M
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 09:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt1QE-00AR7x-2j
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 09:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Fkul8re/yt/GZLMIbNdmwErRTG7jCzbHwRXwGL9Yl0Q=; b=NNPcp5D3ds49gAGpLGr2xdqEhW
	RY2hluf8gyriBiAETml3I8lCdAdWjXfEN7Lq7PJePaW0cO8uLjPyWwluX+v3cdKL/ulLMYaBNg645
	iI9W0AwQ0aiV8iY7o6Tn+B4pqcu3+JkvxrP2ndcx/XLggR6ZlgjWsLQQ7Pk6LytJjCiY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: have set_msi_source_id() return a success indicator
Message-Id: <E1tt1QE-00AR7x-2j@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 09:33:42 +0000

commit 07d2320427a8ccfe51fe7a95556c80148a5803f7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 14 10:18:34 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 14 10:18:34 2025 +0100

    VT-d: have set_msi_source_id() return a success indicator
    
    Handling possible internal errors by just emitting a (debug-build-only)
    log message can't be quite enough. Return error codes in those cases,
    and have the caller propagate those up.
    
    Drop a pointless return path, rather than "inventing" an error code for
    it.
    
    While touching the function declarator anyway also constify its first
    parameter.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/passthrough/vtd/intremap.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index b2f5b4a65a..81394ef452 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -436,15 +436,13 @@ void cf_check io_apic_write_remap_rte(
     __ioapic_write_entry(apic, pin, true, old_rte);
 }
 
-static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *ire)
+static int set_msi_source_id(const struct pci_dev *pdev,
+                             struct iremap_entry *ire)
 {
     u16 seg;
     u8 bus, devfn, secbus;
     int ret;
 
-    if ( !pdev || !ire )
-        return;
-
     seg = pdev->seg;
     bus = pdev->bus;
     devfn = pdev->devfn;
@@ -485,16 +483,21 @@ static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *ire)
                             PCI_BDF(bus, devfn));
         }
         else
+        {
             dprintk(XENLOG_WARNING VTDPREFIX,
                     "d%d: no upstream bridge for %pp\n",
                     pdev->domain->domain_id, &pdev->sbdf);
+            return -ENXIO;
+        }
         break;
 
     default:
         dprintk(XENLOG_WARNING VTDPREFIX, "d%d: unknown(%u): %pp\n",
                 pdev->domain->domain_id, pdev->type, &pdev->sbdf);
-        break;
-   }
+        return -EOPNOTSUPP;
+    }
+
+    return 0;
 }
 
 static int msi_msg_to_remap_entry(
@@ -509,7 +512,12 @@ static int msi_msg_to_remap_entry(
     bool alloc = false;
 
     if ( pdev )
-        set_msi_source_id(pdev, &new_ire);
+    {
+        int rc = set_msi_source_id(pdev, &new_ire);
+
+        if ( rc )
+            return rc;
+    }
     else
         set_hpet_source_id(msi_desc->hpet_id, &new_ire);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 10:33:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 10:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.914325.1320089 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt2Lf-0007R1-Cf; Fri, 14 Mar 2025 10:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 914325.1320089; Fri, 14 Mar 2025 10:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt2Lf-0007Qt-A0; Fri, 14 Mar 2025 10:33:03 +0000
Received: by outflank-mailman (input) for mailman id 914325;
 Fri, 14 Mar 2025 10:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tt2Le-0007Ql-6r
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 10:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt2Le-002b0Q-16
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 10:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt2Le-00AWb4-0B
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 10:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CCm8hmIhanlW9Ad5qdn60kB2mtoV60igSRjU2JVAyn0=; b=VAWuuqKckBDVviaoaN36K7ZwAA
	SeqM3dTNGW9y+JyNacrfPEHTgiTcfuTl5wg+qwXcBb3qCo3SR/02SMXR6WCd1IBuUqceZ2+N7XFyE
	Pd5RT629oCNswdED1vTnRSnSkdkJ2cKYdX1gD9LvgOTu/9cc3rz/gdEQ8U5IxUathSIk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/page: fix return type of online_page()
Message-Id: <E1tt2Le-00AWb4-0B@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 10:33:02 +0000

commit df56af1d7af91b2383bc71bc8b292c4a2521424d
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Fri Mar 14 10:16:28 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 14 10:16:28 2025 +0100

    xen/page: fix return type of online_page()
    
    This commit fixes return type of online_page(), which shall be int
    to include correct error value.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/page_alloc.c | 2 +-
 xen/include/xen/mm.h    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 5f9c9305ef..bd4538c28d 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1763,7 +1763,7 @@ int offline_page(mfn_t mfn, int broken, uint32_t *status)
  *   The caller should make sure end_pfn <= max_page,
  *   if not, expand_pages() should be called prior to online_page().
  */
-unsigned int online_page(mfn_t mfn, uint32_t *status)
+int online_page(mfn_t mfn, uint32_t *status)
 {
     unsigned long x, nx, y;
     struct page_info *pg;
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 16f733281a..ae1c48a615 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -144,7 +144,7 @@ unsigned long avail_domheap_pages(void);
 unsigned long avail_node_heap_pages(unsigned int nodeid);
 #define alloc_domheap_page(d,f) (alloc_domheap_pages(d,0,f))
 #define free_domheap_page(p)  (free_domheap_pages(p,0))
-unsigned int online_page(mfn_t mfn, uint32_t *status);
+int online_page(mfn_t mfn, uint32_t *status);
 int offline_page(mfn_t mfn, int broken, uint32_t *status);
 int query_page_offline(mfn_t mfn, uint32_t *status);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 10:33:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 10:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.914326.1320092 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt2Lp-0007Sq-EO; Fri, 14 Mar 2025 10:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 914326.1320092; Fri, 14 Mar 2025 10:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt2Lp-0007Si-BW; Fri, 14 Mar 2025 10:33:13 +0000
Received: by outflank-mailman (input) for mailman id 914326;
 Fri, 14 Mar 2025 10:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tt2Lo-0007SV-8B
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 10:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt2Lo-002b0U-1R
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 10:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt2Lo-00AWdO-0W
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 10:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xnMYNKQJZczZ3ioKnFjR9b21l3kgn0MY3zEy4NSQd/k=; b=O1vDauZejReh+KZAOGbTQ62n9C
	a48Yo6dxKUB5zpD9P4lo29vrPK6W10CaoiBIhI0nbKk15lCAYPziR9+jN+ZyzKTSKpmHOl/lOZ0Qp
	A59Mg+3lV/8tAGFC8dTPk7cD99VFlUiVEvsE/ibt0V2Z6G0bUTX10Xu2jWhLveEBQ4dE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/sched: fix arinc653 to not use variables across cpupools
Message-Id: <E1tt2Lo-00AWdO-0W@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 10:33:12 +0000

commit d0561ac8ab0e780b1e8ab41d0d15e9f9b076dee3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 14 10:17:11 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 14 10:17:11 2025 +0100

    xen/sched: fix arinc653 to not use variables across cpupools
    
    a653sched_do_schedule() is using two function local static variables,
    which is resulting in bad behavior when using more than one cpupool
    with the arinc653 scheduler.
    
    Fix that by moving those variables to the scheduler private data.
    
    Fixes: 22787f2e107c ("ARINC 653 scheduler")
    Reported-by: Choi Anderson <Anderson.Choi@boeing.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
---
 xen/common/sched/arinc653.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index a82c0d7314..9ebae6d7ae 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -143,6 +143,12 @@ typedef struct a653sched_priv_s
      * pointers to all Xen UNIT structures for iterating through
      */
     struct list_head unit_list;
+
+    /**
+     * scheduling house keeping variables
+     */
+    unsigned int sched_index;
+    s_time_t next_switch_time;
 } a653sched_priv_t;
 
 /**************************************************************************
@@ -513,8 +519,6 @@ a653sched_do_schedule(
     bool tasklet_work_scheduled)
 {
     struct sched_unit *new_task = NULL;
-    static unsigned int sched_index = 0;
-    static s_time_t next_switch_time;
     a653sched_priv_t *sched_priv = SCHED_PRIV(ops);
     const unsigned int cpu = sched_get_resource_cpu(smp_processor_id());
     unsigned long flags;
@@ -528,18 +532,19 @@ a653sched_do_schedule(
         /* time to enter a new major frame
          * the first time this function is called, this will be true */
         /* start with the first domain in the schedule */
-        sched_index = 0;
+        sched_priv->sched_index = 0;
         sched_priv->next_major_frame = now + sched_priv->major_frame;
-        next_switch_time = now + sched_priv->schedule[0].runtime;
+        sched_priv->next_switch_time = now + sched_priv->schedule[0].runtime;
     }
     else
     {
-        while ( (now >= next_switch_time)
-                && (sched_index < sched_priv->num_schedule_entries) )
+        while ( (now >= sched_priv->next_switch_time) &&
+                (sched_priv->sched_index < sched_priv->num_schedule_entries) )
         {
             /* time to switch to the next domain in this major frame */
-            sched_index++;
-            next_switch_time += sched_priv->schedule[sched_index].runtime;
+            sched_priv->sched_index++;
+            sched_priv->next_switch_time +=
+                sched_priv->schedule[sched_priv->sched_index].runtime;
         }
     }
 
@@ -547,8 +552,8 @@ a653sched_do_schedule(
      * If we exhausted the domains in the schedule and still have time left
      * in the major frame then switch next at the next major frame.
      */
-    if ( sched_index >= sched_priv->num_schedule_entries )
-        next_switch_time = sched_priv->next_major_frame;
+    if ( sched_priv->sched_index >= sched_priv->num_schedule_entries )
+        sched_priv->next_switch_time = sched_priv->next_major_frame;
 
     /*
      * If there are more domains to run in the current major frame, set
@@ -556,8 +561,8 @@ a653sched_do_schedule(
      * Otherwise, set new_task equal to the address of the idle task's
      * sched_unit structure.
      */
-    new_task = (sched_index < sched_priv->num_schedule_entries)
-        ? sched_priv->schedule[sched_index].unit
+    new_task = (sched_priv->sched_index < sched_priv->num_schedule_entries)
+        ? sched_priv->schedule[sched_priv->sched_index].unit
         : IDLETASK(cpu);
 
     /* Check to see if the new task can be run (awake & runnable). */
@@ -589,7 +594,7 @@ a653sched_do_schedule(
      * Return the amount of time the next domain has to run and the address
      * of the selected task's UNIT structure.
      */
-    prev->next_time = next_switch_time - now;
+    prev->next_time = sched_priv->next_switch_time - now;
     prev->next_task = new_task;
     new_task->migrated = false;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 10:33:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 10:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.914327.1320097 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt2Lz-0007W4-Ha; Fri, 14 Mar 2025 10:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 914327.1320097; Fri, 14 Mar 2025 10:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt2Lz-0007Vw-F1; Fri, 14 Mar 2025 10:33:23 +0000
Received: by outflank-mailman (input) for mailman id 914327;
 Fri, 14 Mar 2025 10:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tt2Ly-0007Vk-AW
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 10:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt2Ly-002b0Y-1i
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 10:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt2Ly-00AWe0-0q
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 10:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9ojyE1goNkxPUt93gc2qrY2y9A18NHkZiyy+ujNoPvw=; b=0Nm/ecgdIxOvLdeRRGmqeU2GFj
	5oXb1V9kGPA5prwHohyCHKpt4jJC6p0z1Bu8/jvfSP0LGdmxaf6ImKWCISFdmIVU90yJ7lRd+b7Y6
	laMVIecOuu85H/5naVRIa0VFqmjyS/hjTY4NACwtyRMGahGJDRQvaXbjBWwxH4X9/l24=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: specify numerical values of Xenstore commands
Message-Id: <E1tt2Ly-00AWe0-0q@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 10:33:22 +0000

commit 58c96d53f1e1c510424ceae9aa0639f95e1b37a4
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Mar 14 10:17:47 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 14 10:17:47 2025 +0100

    docs: specify numerical values of Xenstore commands
    
    In docs/misc/xenstore.txt all Xenstore commands are specified, but
    the specifications lack the numerical values of the commands.
    
    Add a table with all commands, their values, and a potential remark
    (e.g. whether the command is optional).
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 docs/misc/xenstore.txt | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/docs/misc/xenstore.txt b/docs/misc/xenstore.txt
index 7e1f031520..4eccbc2f7f 100644
--- a/docs/misc/xenstore.txt
+++ b/docs/misc/xenstore.txt
@@ -86,6 +86,67 @@ parts of xenstore inaccessible to some clients.  In any case passing
 bulk data through xenstore is not recommended as the performance
 properties are poor.
 
+---------- Defined Xenstore message types ----------
+
+Below is a table with all defined Xenstore message types (type name
+and its associated numerical value).
+
+Some types are optional to be supported by a specific Xenstore
+implementation.  If an optional type is not supported by a Xenstore
+implementation, Xen tools will continue to work, maybe with slightly
+reduced functionality.  A mandatory type not being supported will
+result in severely reduced functionality, like inability to create
+domains.  In case a type is optional, this is stated in the table with
+the lost functionality in case Xenstore doesn't support that type.
+Any not supported type sent to Xenstore will result in an error response
+with the "ENOSYS" error.
+
+CONTROL               0    optional
+    If not supported, xenstore-control command will not work.
+    DEBUG is a deprecated alias of CONTROL.
+DIRECTORY             1
+READ                  2
+GET_PERMS             3
+WATCH                 4
+UNWATCH               5
+TRANSACTION_START     6
+TRANSACTION_END       7
+INTRODUCE             8
+RELEASE               9
+GET_DOMAIN_PATH      10
+WRITE                11
+MKDIR                12
+RM                   13
+SET_PERMS            14
+WATCH_EVENT          15
+    Not valid in client sent messages.
+    Only valid in Xenstore replies.
+ERROR                16
+    Not valid in client sent messages.
+    Only valid in Xenstore replies.
+IS_DOMAIN_INTRODUCED 17
+RESUME               18
+SET_TARGET           19
+RESTRICT             20    no longer supported
+    RESTRICT has been removed, the type value 20 is invalid.
+RESET_WATCHES        21
+DIRECTORY_PART       22    optional
+    If not supported, the output of xenstore-ls might be incomplete
+    with a node's sub-node list exceeding the maximum payload size
+    (e.g. the "/local/domain" node with more than ca. 1000 domains
+    active).
+GET_FEATURE          23    optional
+SET_FEATURE          24    optional
+    SET_FEATURE requires GET_FEATURE to be supported.
+    If unsupported, setting availability of Xenstore features per
+    domain is not possible.
+GET_QUOTA            25    optional
+SET_QUOTA            26    optional
+    SET_QUOTA requires GET_QUOTA to be supported.
+    If unsupported, setting of Xenstore quota per domain is not
+    possible.
+INVALID           65535
+    Guaranteed invalid type (never supported).
 
 ---------- Xenstore protocol details - introduction ----------
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 10:33:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 10:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.914328.1320101 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt2M9-0007Yt-JE; Fri, 14 Mar 2025 10:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 914328.1320101; Fri, 14 Mar 2025 10:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt2M9-0007Yj-GO; Fri, 14 Mar 2025 10:33:33 +0000
Received: by outflank-mailman (input) for mailman id 914328;
 Fri, 14 Mar 2025 10:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tt2M8-0007YK-Et
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 10:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt2M8-002b0d-2A
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 10:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt2M8-00AWez-17
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 10:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VdDrdFeAeUYQlLeUgGwijqKPvXRKWCTSXkq6BkH4pz4=; b=W7xh/iiiLRad8wFw/nGhDLt+qh
	ZOXqk5S/I51+W9zQ66gnG/clPPUNQ3RdWV7JbZrXlK/zwRTOiRJ4r2zgMvbTW8PhBZ7MEly06akXM
	QxKiMY/GQIsc5c0qCNftFkEfkuzmKREr8wyALS78LneHmUd3l71Q5sBwclWKHUJDi75s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: move obtaining of MSI/HPET source ID
Message-Id: <E1tt2M8-00AWez-17@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 10:33:32 +0000

commit a22223ae448514a809cc73e8e75514b857c255a7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 14 10:18:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 14 10:18:12 2025 +0100

    VT-d: move obtaining of MSI/HPET source ID
    
    This was the original attempt to address XSA-467, until it was found
    that IRQs can be off already from higher up the call stack. Nevertheless
    moving code out of locked regions is generally desirable anyway; some of
    the callers, after all, don't disable interrupts or acquire other locks.
    
    Hence, despite this not addressing the original report:
    
    Data collection solely depends on the passed in PCI device. Furthermore,
    since the function only writes to a local variable, we can pull the
    invocation of set_msi_source_id() (and also set_hpet_source_id()) ahead
    of the acquiring of the (IRQ-safe) lock.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/passthrough/vtd/intremap.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index b3b53518e2..b2f5b4a65a 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -508,6 +508,11 @@ static int msi_msg_to_remap_entry(
     const struct pi_desc *pi_desc = msi_desc->pi_desc;
     bool alloc = false;
 
+    if ( pdev )
+        set_msi_source_id(pdev, &new_ire);
+    else
+        set_hpet_source_id(msi_desc->hpet_id, &new_ire);
+
     if ( msi_desc->msi_attrib.type == PCI_CAP_ID_MSI )
         nr = msi_desc->msi.nvec;
 
@@ -575,11 +580,6 @@ static int msi_msg_to_remap_entry(
         new_ire.post.p = 1;
     }
 
-    if ( pdev )
-        set_msi_source_id(pdev, &new_ire);
-    else
-        set_hpet_source_id(msi_desc->hpet_id, &new_ire);
-
     /* now construct new MSI/MSI-X rte entry */
     remap_rte = (struct msi_msg_remap_entry *)msg;
     remap_rte->address_lo.dontcare = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 10:33:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 10:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.914329.1320105 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt2MJ-0007bD-KY; Fri, 14 Mar 2025 10:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 914329.1320105; Fri, 14 Mar 2025 10:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tt2MJ-0007b6-Hl; Fri, 14 Mar 2025 10:33:43 +0000
Received: by outflank-mailman (input) for mailman id 914329;
 Fri, 14 Mar 2025 10:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tt2MI-0007ay-He
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 10:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt2MI-002b16-2Q
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 10:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tt2MI-00AWfi-1Z
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 10:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YkcCDy9G0LLGB6KgL/StPWBuU/daySF5LIsXqwbjqXQ=; b=btKKNrByKuiENTO5JDojzHa6zp
	SxscAIKh1/tp6nTsCzk2W9wa9JlN64lRSYr35ZecU2vayQEuRS1UTh4XAXfZG3VA0aZ5Yiya1/wRx
	aFN8BJE7BDVnPryhseADW9oU10iibK/70w8qWq3LTTuw0O0qGhI/lYGiA2HnD7LU86xs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: have set_msi_source_id() return a success indicator
Message-Id: <E1tt2MI-00AWfi-1Z@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 10:33:42 +0000

commit 07d2320427a8ccfe51fe7a95556c80148a5803f7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Mar 14 10:18:34 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Mar 14 10:18:34 2025 +0100

    VT-d: have set_msi_source_id() return a success indicator
    
    Handling possible internal errors by just emitting a (debug-build-only)
    log message can't be quite enough. Return error codes in those cases,
    and have the caller propagate those up.
    
    Drop a pointless return path, rather than "inventing" an error code for
    it.
    
    While touching the function declarator anyway also constify its first
    parameter.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/passthrough/vtd/intremap.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index b2f5b4a65a..81394ef452 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -436,15 +436,13 @@ void cf_check io_apic_write_remap_rte(
     __ioapic_write_entry(apic, pin, true, old_rte);
 }
 
-static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *ire)
+static int set_msi_source_id(const struct pci_dev *pdev,
+                             struct iremap_entry *ire)
 {
     u16 seg;
     u8 bus, devfn, secbus;
     int ret;
 
-    if ( !pdev || !ire )
-        return;
-
     seg = pdev->seg;
     bus = pdev->bus;
     devfn = pdev->devfn;
@@ -485,16 +483,21 @@ static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *ire)
                             PCI_BDF(bus, devfn));
         }
         else
+        {
             dprintk(XENLOG_WARNING VTDPREFIX,
                     "d%d: no upstream bridge for %pp\n",
                     pdev->domain->domain_id, &pdev->sbdf);
+            return -ENXIO;
+        }
         break;
 
     default:
         dprintk(XENLOG_WARNING VTDPREFIX, "d%d: unknown(%u): %pp\n",
                 pdev->domain->domain_id, pdev->type, &pdev->sbdf);
-        break;
-   }
+        return -EOPNOTSUPP;
+    }
+
+    return 0;
 }
 
 static int msi_msg_to_remap_entry(
@@ -509,7 +512,12 @@ static int msi_msg_to_remap_entry(
     bool alloc = false;
 
     if ( pdev )
-        set_msi_source_id(pdev, &new_ire);
+    {
+        int rc = set_msi_source_id(pdev, &new_ire);
+
+        if ( rc )
+            return rc;
+    }
     else
         set_hpet_source_id(msi_desc->hpet_id, &new_ire);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 19:11:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 19:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.915347.1320870 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttAQx-0004wl-Tu; Fri, 14 Mar 2025 19:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 915347.1320870; Fri, 14 Mar 2025 19:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttAQx-0004wd-Qw; Fri, 14 Mar 2025 19:11:03 +0000
Received: by outflank-mailman (input) for mailman id 915347;
 Fri, 14 Mar 2025 19:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ttAQw-0004wQ-7i
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 19:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttAQw-002rWy-0f
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 19:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttAQv-00BPzZ-2w
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 19:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sPsLKCesoYmdY3Lyd4wYYU4U15pXEev06bfw+gglNME=; b=R7uH3CU1Kn19+gyZHGC0hprKVc
	FY1hKwN1j7os5orgSx/qVcSlcbWoN2uEwWIhttoealAvVnypINHYELd3HtUtStjFAXGZcArUPcjl5
	GjdvouJsfCZYDV82E1dq92jebLQd7tE9s4ZNBW6wFQ0Q/t+rT5/nYqbH24FLkU2tsdXM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: Adjust diagnostics in set_msi_source_id()
Message-Id: <E1ttAQv-00BPzZ-2w@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 19:11:01 +0000

commit 2f3a1491ab21fa9defb677097d2e6dbc81a1ea12
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 14 09:52:02 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 14 17:24:35 2025 +0000

    VT-d: Adjust diagnostics in set_msi_source_id()
    
    Use %pd, and state what the unknown is.  As it's an enum, it's a signed type.
    
    Also drop one piece of trailing whitespace.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/passthrough/vtd/intremap.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 81394ef452..9272a25113 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -485,15 +485,15 @@ static int set_msi_source_id(const struct pci_dev *pdev,
         else
         {
             dprintk(XENLOG_WARNING VTDPREFIX,
-                    "d%d: no upstream bridge for %pp\n",
-                    pdev->domain->domain_id, &pdev->sbdf);
+                    "%pd: no upstream bridge for %pp\n",
+                    pdev->domain, &pdev->sbdf);
             return -ENXIO;
         }
         break;
 
     default:
-        dprintk(XENLOG_WARNING VTDPREFIX, "d%d: unknown(%u): %pp\n",
-                pdev->domain->domain_id, pdev->type, &pdev->sbdf);
+        dprintk(XENLOG_WARNING VTDPREFIX, "%pd: %pp unknown device type %d\n",
+                pdev->domain, &pdev->sbdf, pdev->type);
         return -EOPNOTSUPP;
     }
 
@@ -751,7 +751,7 @@ void disable_intremap(struct vtd_iommu *iommu)
                   !(sts & DMA_GSTS_IRES), sts);
 
     /* If we are disabling Interrupt Remapping, make sure we dont stay in
-     * Extended Interrupt Mode, as this is unaffected by the Interrupt 
+     * Extended Interrupt Mode, as this is unaffected by the Interrupt
      * Remapping flag in each DMAR Global Control Register.
      * Specifically, local apics in xapic mode do not like interrupts delivered
      * in x2apic mode.  Any code turning interrupt remapping back on will set
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 19:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 19:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.915348.1320872 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttAR7-00052U-Uy; Fri, 14 Mar 2025 19:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 915348.1320872; Fri, 14 Mar 2025 19:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttAR7-00052M-SJ; Fri, 14 Mar 2025 19:11:13 +0000
Received: by outflank-mailman (input) for mailman id 915348;
 Fri, 14 Mar 2025 19:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ttAR6-00052A-8g
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 19:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttAR6-002rX2-1L
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 19:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttAR6-00BQ0f-07
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 19:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xRhnNOAaVcaFfxdjhkLMkD6z/6P+o23kAbzNnGUHN7w=; b=dtQ3UYIC+eaKDK4oTn9cHEixK2
	ktzC+wMarAr7YceuDzMid2JfZA9rjtYnkqF9OvS2eX39/XCMm0NcGQaytvtgp78DjEtd3XUDusGCJ
	Q/GNUCcNiJY17CZAyvQ+o/m38OcgoBerSGNNDUFRU+IiG6ror4NttFLSieizuMottvy4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/elf: Improve code generation in elf_core_save_regs()
Message-Id: <E1ttAR6-00BQ0f-07@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 19:11:12 +0000

commit 0754534b8a381444e209bb91a6b4c6fc325ac04e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sun Dec 29 14:06:18 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 14 17:24:35 2025 +0000

    x86/elf: Improve code generation in elf_core_save_regs()
    
    A CALL with 0 displacement is handled specially, and is why this logic
    functions even with CET Shadow Stacks active.  Nevertheless a RIP-relative LEA
    is the more normal way of doing this in 64bit code.
    
    The retrieval of flags modifies the stack pointer so needs to state a
    dependency on the stack pointer.  Despite it's name, ASM_CALL_CONSTRAINT is
    the way to do this.
    
    read_sreg() forces the answer through a register, causing code generation of
    the form:
    
        mov    %gs, %eax
        mov    %eax, %eax
        mov    %rax, 0x140(%rsi)
    
    Encode the reads directly with a memory operand.  This results in a 16bit
    store instead of an 64bit store, but the backing memory is zeroed.
    
    While cleaning this up, drop one piece of trailing whitespace.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/x86_64/elf.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/include/asm/x86_64/elf.h b/xen/arch/x86/include/asm/x86_64/elf.h
index 00227e0e12..f33be46dde 100644
--- a/xen/arch/x86/include/asm/x86_64/elf.h
+++ b/xen/arch/x86/include/asm/x86_64/elf.h
@@ -34,7 +34,7 @@ typedef struct {
     unsigned long gs;
 } ELF_Gregset;
 
-static inline void elf_core_save_regs(ELF_Gregset *core_regs, 
+static inline void elf_core_save_regs(ELF_Gregset *core_regs,
                                       crash_xen_core_t *xen_core_regs)
 {
     asm ( "movq %%r15, %0" : "=m" (core_regs->r15) );
@@ -54,17 +54,17 @@ static inline void elf_core_save_regs(ELF_Gregset *core_regs,
     asm ( "movq %%rdi, %0" : "=m" (core_regs->rdi) );
 
     /* orig_rax not filled in for now */
-    asm ( "call 0f; 0: popq %0" : "=m" (core_regs->rip) );
-    core_regs->cs = read_sreg(cs);
-    asm ( "pushfq; popq %0" : "=m" (core_regs->rflags) );
+    asm ( "lea (%%rip), %0" : "=r" (core_regs->rip) );
+    asm ( "mov %%cs, %0" : "=m" (core_regs->cs) );
+    asm ( "pushfq; popq %0" : "=m" (core_regs->rflags) ASM_CALL_CONSTRAINT );
     asm ( "movq %%rsp, %0" : "=m" (core_regs->rsp) );
-    core_regs->ss = read_sreg(ss);
+    asm ( "mov %%ss, %0" : "=m" (core_regs->ss) );
     rdmsrl(MSR_FS_BASE, core_regs->thread_fs);
     rdmsrl(MSR_GS_BASE, core_regs->thread_gs);
-    core_regs->ds = read_sreg(ds);
-    core_regs->es = read_sreg(es);
-    core_regs->fs = read_sreg(fs);
-    core_regs->gs = read_sreg(gs);
+    asm ( "mov %%ds, %0" : "=m" (core_regs->ds) );
+    asm ( "mov %%es, %0" : "=m" (core_regs->es) );
+    asm ( "mov %%fs, %0" : "=m" (core_regs->fs) );
+    asm ( "mov %%gs, %0" : "=m" (core_regs->gs) );
 
     asm ( "mov %%cr0, %0" : "=r" (xen_core_regs->cr0) );
     asm ( "mov %%cr2, %0" : "=r" (xen_core_regs->cr2) );
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 19:11:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 19:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.915349.1320876 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttARI-0005FM-05; Fri, 14 Mar 2025 19:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 915349.1320876; Fri, 14 Mar 2025 19:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttARH-0005FE-To; Fri, 14 Mar 2025 19:11:23 +0000
Received: by outflank-mailman (input) for mailman id 915349;
 Fri, 14 Mar 2025 19:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ttARG-0005Al-AN
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 19:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttARG-002rX6-1g
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 19:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttARG-00BQ1d-0p
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 19:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YyDQWEV0lwm5Xzg7IoKC6kPTpE2+c3DjOuuBblNsYdY=; b=lnB8oMjU0yKusG+zmYP5wy3sNR
	fFtg3KJeLZp1xv6AidsZlhtiVrycv0WEYxduksDeNaFhhpRuDmrd3vij88+47R0IK14x4voTvcv1i
	6jNjxwMpdZ+3mlo6wVbDgE5QRfILG/JEgitB4K3yuetS9lv5bgYOZmOpVML3Jrl8u69k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: kconfig: rename MEM_ACCESS -> VM_EVENT
Message-Id: <E1ttARG-00BQ1d-0p@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 19:11:22 +0000

commit 769123c2757cb754069eba3be7fc8619185e3dca
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Fri Mar 14 07:21:09 2025 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 14 17:24:35 2025 +0000

    xen: kconfig: rename MEM_ACCESS -> VM_EVENT
    
    Use more generic CONFIG_VM_EVENT name throughout Xen code instead of
    CONFIG_MEM_ACCESS. This reflects the fact that vm_event is a higher level
    feature, with mem_access & monitor depending on it.
    
    Suggested-by: Tamas K Lengyel <tamas@tklengyel.com>
    Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
---
 automation/gitlab-ci/build.yaml         | 2 +-
 xen/arch/arm/Makefile                   | 2 +-
 xen/arch/arm/configs/tiny64_defconfig   | 2 +-
 xen/arch/arm/include/asm/mem_access.h   | 4 ++--
 xen/arch/ppc/configs/ppc64_defconfig    | 2 +-
 xen/arch/riscv/configs/tiny64_defconfig | 2 +-
 xen/arch/x86/mm/Makefile                | 2 +-
 xen/common/Kconfig                      | 2 +-
 xen/common/Makefile                     | 2 +-
 xen/common/domctl.c                     | 2 +-
 xen/include/xen/mem_access.h            | 6 +++---
 xen/include/xsm/dummy.h                 | 2 +-
 xen/include/xsm/xsm.h                   | 4 ++--
 xen/xsm/dummy.c                         | 2 +-
 xen/xsm/flask/hooks.c                   | 4 ++--
 15 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 034d6d9c3a..f633068c31 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -744,8 +744,8 @@ debian-12-riscv64-gcc:
       CONFIG_EXPERT=y
       CONFIG_GRANT_TABLE=n
       CONFIG_LIVEPATCH=n
-      CONFIG_MEM_ACCESS=n
       CONFIG_QEMU_PLATFORM=y
+      CONFIG_VM_EVENT=n
       CONFIG_XSM=n
 
 debian-12-riscv64-gcc-randconfig:
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index fb0948f067..3bd5125e64 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -38,7 +38,7 @@ obj-y += irq.o
 obj-y += kernel.init.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o
 obj-$(CONFIG_LLC_COLORING) += llc-coloring.o
-obj-$(CONFIG_MEM_ACCESS) += mem_access.o
+obj-$(CONFIG_VM_EVENT) += mem_access.o
 obj-y += mm.o
 obj-y += monitor.o
 obj-y += p2m.o
diff --git a/xen/arch/arm/configs/tiny64_defconfig b/xen/arch/arm/configs/tiny64_defconfig
index cc6d93f2f8..469a1eb9f9 100644
--- a/xen/arch/arm/configs/tiny64_defconfig
+++ b/xen/arch/arm/configs/tiny64_defconfig
@@ -5,7 +5,7 @@ CONFIG_ARM=y
 # Architecture Features
 #
 # CONFIG_GICV3 is not set
-# CONFIG_MEM_ACCESS is not set
+# CONFIG_VM_EVENT is not set
 # CONFIG_SBSA_VUART_CONSOLE is not set
 
 #
diff --git a/xen/arch/arm/include/asm/mem_access.h b/xen/arch/arm/include/asm/mem_access.h
index abac8032fc..d42f28e8b7 100644
--- a/xen/arch/arm/include/asm/mem_access.h
+++ b/xen/arch/arm/include/asm/mem_access.h
@@ -37,7 +37,7 @@ static inline bool p2m_mem_access_sanity_check(struct domain *d)
  * Send mem event based on the access. Boolean return value indicates if trap
  * needs to be injected into guest.
  */
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
 bool p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec);
 
 struct page_info*
@@ -58,7 +58,7 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag,
     return NULL;
 }
 
-#endif /*CONFIG_MEM_ACCESS*/
+#endif /* CONFIG_VM_EVENT */
 #endif /* _ASM_ARM_MEM_ACCESS_H */
 
 /*
diff --git a/xen/arch/ppc/configs/ppc64_defconfig b/xen/arch/ppc/configs/ppc64_defconfig
index 4924d881a2..d6aaf772e7 100644
--- a/xen/arch/ppc/configs/ppc64_defconfig
+++ b/xen/arch/ppc/configs/ppc64_defconfig
@@ -1,6 +1,6 @@
 # CONFIG_GRANT_TABLE is not set
 # CONFIG_SPECULATIVE_HARDEN_ARRAY is not set
-# CONFIG_MEM_ACCESS is not set
+# CONFIG_VM_EVENT is not set
 
 CONFIG_PPC64=y
 CONFIG_DEBUG=y
diff --git a/xen/arch/riscv/configs/tiny64_defconfig b/xen/arch/riscv/configs/tiny64_defconfig
index bb3ae26a44..2399f7b918 100644
--- a/xen/arch/riscv/configs/tiny64_defconfig
+++ b/xen/arch/riscv/configs/tiny64_defconfig
@@ -1,6 +1,6 @@
 # CONFIG_BOOT_TIME_CPUPOOLS is not set
 # CONFIG_GRANT_TABLE is not set
-# CONFIG_MEM_ACCESS is not set
+# CONFIG_VM_EVENT is not set
 # CONFIG_COVERAGE is not set
 # CONFIG_LIVEPATCH is not set
 # CONFIG_XSM is not set
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 0345388359..960f6e8409 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -4,7 +4,7 @@ obj-$(CONFIG_HVM) += hap/
 obj-$(CONFIG_ALTP2M) += altp2m.o
 obj-$(CONFIG_HVM) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
 obj-$(CONFIG_SHADOW_PAGING) += guest_walk_4.o
-obj-$(CONFIG_MEM_ACCESS) += mem_access.o
+obj-$(CONFIG_VM_EVENT) += mem_access.o
 obj-$(CONFIG_MEM_PAGING) += mem_paging.o
 obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
 obj-$(CONFIG_HVM) += nested.o
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 6166327f4d..a6aa2c5c14 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -92,7 +92,7 @@ config HAS_VMAP
 config MEM_ACCESS_ALWAYS_ON
 	bool
 
-config MEM_ACCESS
+config VM_EVENT
 	def_bool MEM_ACCESS_ALWAYS_ON
 	prompt "Memory Access and VM events" if !MEM_ACCESS_ALWAYS_ON
 	depends on HVM
diff --git a/xen/common/Makefile b/xen/common/Makefile
index cba3b32733..b71d4b3efa 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -26,7 +26,7 @@ obj-$(CONFIG_KEXEC) += kexec.o
 obj-$(CONFIG_KEXEC) += kimage.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o livepatch_elf.o
 obj-$(CONFIG_LLC_COLORING) += llc-coloring.o
-obj-$(CONFIG_MEM_ACCESS) += mem_access.o
+obj-$(CONFIG_VM_EVENT) += mem_access.o
 obj-y += memory.o
 obj-y += multicall.o
 obj-y += notifier.o
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index b897ca8723..bfe2e1f9f0 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -809,7 +809,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             copyback = true;
         break;
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
     case XEN_DOMCTL_set_access_required:
         if ( unlikely(current->domain == d) ) /* no domain_pause() */
             ret = -EPERM;
diff --git a/xen/include/xen/mem_access.h b/xen/include/xen/mem_access.h
index 2231341b5d..4de651038d 100644
--- a/xen/include/xen/mem_access.h
+++ b/xen/include/xen/mem_access.h
@@ -33,7 +33,7 @@
  */
 struct vm_event_st;
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
 #include <asm/mem_access.h>
 #endif
 
@@ -99,7 +99,7 @@ long p2m_set_mem_access_multi(struct domain *d,
 int p2m_get_mem_access(struct domain *d, gfn_t gfn, xenmem_access_t *access,
                        unsigned int altp2m_idx);
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
 int mem_access_memop(unsigned long cmd,
                      XEN_GUEST_HANDLE_PARAM(xen_mem_access_op_t) arg);
 #else
@@ -109,7 +109,7 @@ int mem_access_memop(unsigned long cmd,
 {
     return -ENOSYS;
 }
-#endif /* CONFIG_MEM_ACCESS */
+#endif /* CONFIG_VM_EVENT */
 
 #endif /* _XEN_MEM_ACCESS_H */
 
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index a8d06de6b0..9227205fcd 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -647,7 +647,7 @@ static XSM_INLINE int cf_check xsm_vm_event_control(
     return xsm_default_action(action, current->domain, d);
 }
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
 static XSM_INLINE int cf_check xsm_mem_access(XSM_DEFAULT_ARG struct domain *d)
 {
     XSM_ASSERT_ACTION(XSM_DM_PRIV);
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 8c33b055fc..24acc16125 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -153,7 +153,7 @@ struct xsm_ops {
 
     int (*vm_event_control)(struct domain *d, int mode, int op);
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
     int (*mem_access)(struct domain *d);
 #endif
 
@@ -637,7 +637,7 @@ static inline int xsm_vm_event_control(
     return alternative_call(xsm_ops.vm_event_control, d, mode, op);
 }
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
 static inline int xsm_mem_access(xsm_default_t def, struct domain *d)
 {
     return alternative_call(xsm_ops.mem_access, d);
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index ce6fbdc6c5..93fbfc43cc 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -111,7 +111,7 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
 
     .vm_event_control              = xsm_vm_event_control,
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
     .mem_access                    = xsm_mem_access,
 #endif
 
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 389707a164..6a53487ea4 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1362,7 +1362,7 @@ static int cf_check flask_vm_event_control(struct domain *d, int mode, int op)
     return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__VM_EVENT);
 }
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
 static int cf_check flask_mem_access(struct domain *d)
 {
     return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__MEM_ACCESS);
@@ -1955,7 +1955,7 @@ static const struct xsm_ops __initconst_cf_clobber flask_ops = {
 
     .vm_event_control = flask_vm_event_control,
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
     .mem_access = flask_mem_access,
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 19:11:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 19:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.915350.1320882 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttARS-0005NC-27; Fri, 14 Mar 2025 19:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 915350.1320882; Fri, 14 Mar 2025 19:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttARR-0005N4-VP; Fri, 14 Mar 2025 19:11:33 +0000
Received: by outflank-mailman (input) for mailman id 915350;
 Fri, 14 Mar 2025 19:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ttARQ-0005J8-D8
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 19:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttARQ-002rXD-1y
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 19:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttARQ-00BQ2R-17
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 19:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NW3+ecdbNwAxjSPaXYyGUuSQ9JGnXFhRXjAr7AJ3Cy0=; b=vtPQhG6nY5gW0ZztAnu4HXlpE0
	DkoO5/0pk7lR0M0Tn6bkFWzixW7gbCDDQPJyynPrCbEkwXzI3+oICAKDTbSJt/Y2ad0G/ZWIknxia
	uly48/1wNXl4PXN5dga5ECIbQuJ8oaDWPNpzg0oA+VKMxWCbw4Uc6cPkHvIXfKbsvlCQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86:monitor: control monitor.c build with CONFIG_VM_EVENT option
Message-Id: <E1ttARQ-00BQ2R-17@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 19:11:32 +0000

commit eda90ecfea2a8746afb8123e023db16a3f6c2875
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Fri Mar 14 07:23:14 2025 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 14 17:24:35 2025 +0000

    x86:monitor: control monitor.c build with CONFIG_VM_EVENT option
    
    Replace more general CONFIG_HVM option with CONFIG_VM_EVENT which is more
    relevant and specific to monitoring. This is only to clarify at build level
    to which subsystem this file belongs.
    
    No functional change here, as VM_EVENT depends on HVM.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index c763f80b0b..f59c9665fd 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -49,7 +49,7 @@ obj-$(CONFIG_PV) += ioport_emulate.o
 obj-y += irq.o
 obj-$(CONFIG_KEXEC) += machine_kexec.o
 obj-y += mm.o x86_64/mm.o
-obj-$(CONFIG_HVM) += monitor.o
+obj-$(CONFIG_VM_EVENT) += monitor.o
 obj-y += mpparse.o
 obj-y += nmi.o
 obj-y += numa.o
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 19:11:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 19:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.915351.1320885 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttARc-0005SM-3G; Fri, 14 Mar 2025 19:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 915351.1320885; Fri, 14 Mar 2025 19:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttARc-0005SE-0a; Fri, 14 Mar 2025 19:11:44 +0000
Received: by outflank-mailman (input) for mailman id 915351;
 Fri, 14 Mar 2025 19:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ttARa-0005Ry-GE
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 19:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttARa-002rXH-2I
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 19:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttARa-00BQ4s-1P
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 19:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5UYWcNOz7L6IaNU0lSQFtViA/c01nyzbb6ob9YZ8HMo=; b=gHPhkegvv1zXY438dppCGbbLVC
	wsNOmDVUR6gCBQdTTrPvFxPEcJX3NQczfhEcw77QuEk2l8yVl81OBzVf1fdf73F0j/UiFObL2CwVH
	bdpiOjdBID1IXucpuhn+/FVSv+1LgbrsQGWXTsq3s4TLHZKCTVV1y8TYoFwhfqAi+sNw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: mem_access: conditionally compile vm_event.c & monitor.c
Message-Id: <E1ttARa-00BQ4s-1P@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 19:11:42 +0000

commit 17e5060023685f3ca4d91b69675c5ba77685845a
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Mar 14 07:25:17 2025 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 14 17:24:35 2025 +0000

    xen: mem_access: conditionally compile vm_event.c & monitor.c
    
    Extend coverage of CONFIG_VM_EVENT option and make the build of VM events
    and monitoring support optional. Also make MEM_PAGING option depend on VM_EVENT
    to document that mem_paging is relying on vm_event.
    This is to reduce code size on Arm when this option isn't enabled.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/arm/Makefile      |  4 ++--
 xen/arch/arm/vsmc.c        |  3 ++-
 xen/arch/x86/Kconfig       |  2 +-
 xen/common/Makefile        |  4 ++--
 xen/include/xen/monitor.h  |  9 +++++++++
 xen/include/xen/vm_event.h | 14 +++++++++++---
 6 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 3bd5125e64..4837ad467a 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -40,7 +40,7 @@ obj-$(CONFIG_LIVEPATCH) += livepatch.o
 obj-$(CONFIG_LLC_COLORING) += llc-coloring.o
 obj-$(CONFIG_VM_EVENT) += mem_access.o
 obj-y += mm.o
-obj-y += monitor.o
+obj-$(CONFIG_VM_EVENT) += monitor.o
 obj-y += p2m.o
 obj-y += platform.o
 obj-y += platform_hypercall.o
@@ -66,7 +66,7 @@ obj-$(CONFIG_VGICV2) += vgic-v2.o
 obj-$(CONFIG_GICV3) += vgic-v3.o
 obj-$(CONFIG_HAS_ITS) += vgic-v3-its.o
 endif
-obj-y += vm_event.o
+obj-$(CONFIG_VM_EVENT) += vm_event.o
 obj-y += vtimer.o
 obj-$(CONFIG_SBSA_VUART_CONSOLE) += vpl011.o
 obj-y += vsmc.o
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index e253865b6c..6081f14ed0 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -330,7 +330,8 @@ void do_trap_smc(struct cpu_user_regs *regs, const union hsr hsr)
     }
 
     /* If monitor is enabled, let it handle the call. */
-    if ( current->domain->arch.monitor.privileged_call_enabled )
+    if ( IS_ENABLED(CONFIG_VM_EVENT) &&
+         current->domain->arch.monitor.privileged_call_enabled )
         rc = monitor_smc();
 
     if ( rc == 1 )
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 6e41bc0fb4..f086799594 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -350,7 +350,7 @@ endif
 
 config MEM_PAGING
 	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
-	depends on HVM
+	depends on HVM && VM_EVENT
 
 config MEM_SHARING
 	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
diff --git a/xen/common/Makefile b/xen/common/Makefile
index b71d4b3efa..ac23120d7d 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -54,7 +54,7 @@ obj-y += timer.o
 obj-$(CONFIG_TRACEBUFFER) += trace.o
 obj-y += version.o
 obj-y += virtual_region.o
-obj-y += vm_event.o
+obj-$(CONFIG_VM_EVENT) += vm_event.o
 obj-$(CONFIG_HAS_VMAP) += vmap.o
 obj-y += vsprintf.o
 obj-y += wait.o
@@ -68,7 +68,7 @@ obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o memory.o multicall.o xlat.o
 
 ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
 obj-y += domctl.o
-obj-y += monitor.o
+obj-$(CONFIG_VM_EVENT) += monitor.o
 obj-y += sysctl.o
 endif
 
diff --git a/xen/include/xen/monitor.h b/xen/include/xen/monitor.h
index 713d54f7c1..c086c4390c 100644
--- a/xen/include/xen/monitor.h
+++ b/xen/include/xen/monitor.h
@@ -27,8 +27,17 @@
 struct domain;
 struct xen_domctl_monitor_op;
 
+#ifdef CONFIG_VM_EVENT
 int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop);
 void monitor_guest_request(void);
+#else /* !CONFIG_VM_EVENT */
+static inline int monitor_domctl(struct domain *d,
+                                 struct xen_domctl_monitor_op *mop)
+{
+    return -EOPNOTSUPP;
+}
+static inline void monitor_guest_request(void) {}
+#endif /* !CONFIG_VM_EVENT */
 
 int monitor_traps(struct vcpu *v, bool sync, vm_event_request_t *req);
 
diff --git a/xen/include/xen/vm_event.h b/xen/include/xen/vm_event.h
index 9a86358b42..27d0c74216 100644
--- a/xen/include/xen/vm_event.h
+++ b/xen/include/xen/vm_event.h
@@ -50,9 +50,6 @@ struct vm_event_domain
     unsigned int last_vcpu_wake_up;
 };
 
-/* Clean up on domain destruction */
-void vm_event_cleanup(struct domain *d);
-
 /* Returns whether a ring has been set up */
 bool vm_event_check_ring(struct vm_event_domain *ved);
 
@@ -88,7 +85,18 @@ void vm_event_cancel_slot(struct domain *d, struct vm_event_domain *ved);
 void vm_event_put_request(struct domain *d, struct vm_event_domain *ved,
                           vm_event_request_t *req);
 
+#ifdef CONFIG_VM_EVENT
+/* Clean up on domain destruction */
+void vm_event_cleanup(struct domain *d);
 int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec);
+#else /* !CONFIG_VM_EVENT */
+static inline void vm_event_cleanup(struct domain *d) {}
+static inline int vm_event_domctl(struct domain *d,
+                                  struct xen_domctl_vm_event_op *vec)
+{
+    return -EOPNOTSUPP;
+}
+#endif /* !CONFIG_VM_EVENT */
 
 void vm_event_vcpu_pause(struct vcpu *v);
 void vm_event_vcpu_unpause(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 20:22:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 20:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.915388.1320908 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttBXf-0003FQ-D9; Fri, 14 Mar 2025 20:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 915388.1320908; Fri, 14 Mar 2025 20:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttBXf-0003FJ-Af; Fri, 14 Mar 2025 20:22:03 +0000
Received: by outflank-mailman (input) for mailman id 915388;
 Fri, 14 Mar 2025 20:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ttBXe-0003FD-G2
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 20:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttBXe-002tJ9-1T
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 20:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttBXe-00CHoc-0Z
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 20:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xhJ8p6wMpPrl2ZmOl/FB4V9gO2kXWNkJcZYYcoh+6a0=; b=k32NbbHAC5yuNg+BzarENowkHs
	3A4xbAYhzmeA+On3/3VI2yIawpjrGNGYYQTdXYn81QeJ1OTjTAaBOdI8WcFrV5K+nQ5WqifQ0ZPxV
	PpY4Sb3yF+XWC1PwTFz0DNRMJJPb762YVO6Q0FGp4HNyRai8VS1qxM4T5rcwAdSahLmE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: Adjust diagnostics in set_msi_source_id()
Message-Id: <E1ttBXe-00CHoc-0Z@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 20:22:02 +0000

commit 2f3a1491ab21fa9defb677097d2e6dbc81a1ea12
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 14 09:52:02 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 14 17:24:35 2025 +0000

    VT-d: Adjust diagnostics in set_msi_source_id()
    
    Use %pd, and state what the unknown is.  As it's an enum, it's a signed type.
    
    Also drop one piece of trailing whitespace.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/passthrough/vtd/intremap.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 81394ef452..9272a25113 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -485,15 +485,15 @@ static int set_msi_source_id(const struct pci_dev *pdev,
         else
         {
             dprintk(XENLOG_WARNING VTDPREFIX,
-                    "d%d: no upstream bridge for %pp\n",
-                    pdev->domain->domain_id, &pdev->sbdf);
+                    "%pd: no upstream bridge for %pp\n",
+                    pdev->domain, &pdev->sbdf);
             return -ENXIO;
         }
         break;
 
     default:
-        dprintk(XENLOG_WARNING VTDPREFIX, "d%d: unknown(%u): %pp\n",
-                pdev->domain->domain_id, pdev->type, &pdev->sbdf);
+        dprintk(XENLOG_WARNING VTDPREFIX, "%pd: %pp unknown device type %d\n",
+                pdev->domain, &pdev->sbdf, pdev->type);
         return -EOPNOTSUPP;
     }
 
@@ -751,7 +751,7 @@ void disable_intremap(struct vtd_iommu *iommu)
                   !(sts & DMA_GSTS_IRES), sts);
 
     /* If we are disabling Interrupt Remapping, make sure we dont stay in
-     * Extended Interrupt Mode, as this is unaffected by the Interrupt 
+     * Extended Interrupt Mode, as this is unaffected by the Interrupt
      * Remapping flag in each DMAR Global Control Register.
      * Specifically, local apics in xapic mode do not like interrupts delivered
      * in x2apic mode.  Any code turning interrupt remapping back on will set
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 20:22:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 20:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.915390.1320913 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttBXp-0003HU-Eu; Fri, 14 Mar 2025 20:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 915390.1320913; Fri, 14 Mar 2025 20:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttBXp-0003HM-C8; Fri, 14 Mar 2025 20:22:13 +0000
Received: by outflank-mailman (input) for mailman id 915390;
 Fri, 14 Mar 2025 20:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ttBXo-0003HA-BQ
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 20:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttBXo-002tJD-1n
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 20:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttBXo-00CHrK-0u
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 20:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0Ek+4Y39vXAKlNaReSCSsEEliIgR+z4K4JOoMFuxPxY=; b=vFcSFylRxvVHX7EMg5PF+c/WwI
	ps1CD6HNdZEHpPr+pEmFzagRo53rChTPjjTHONhqvuTUlWx6no0TQ13YFRsFxlM0V0FMe68+ACgwu
	rgbBKph1nslWbhN5/xB9kSWD8VetIYs3zHUeLztnL5ufsW7mjP+jQFV4RaZkPvZ6KgVQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/elf: Improve code generation in elf_core_save_regs()
Message-Id: <E1ttBXo-00CHrK-0u@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 20:22:12 +0000

commit 0754534b8a381444e209bb91a6b4c6fc325ac04e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sun Dec 29 14:06:18 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 14 17:24:35 2025 +0000

    x86/elf: Improve code generation in elf_core_save_regs()
    
    A CALL with 0 displacement is handled specially, and is why this logic
    functions even with CET Shadow Stacks active.  Nevertheless a RIP-relative LEA
    is the more normal way of doing this in 64bit code.
    
    The retrieval of flags modifies the stack pointer so needs to state a
    dependency on the stack pointer.  Despite it's name, ASM_CALL_CONSTRAINT is
    the way to do this.
    
    read_sreg() forces the answer through a register, causing code generation of
    the form:
    
        mov    %gs, %eax
        mov    %eax, %eax
        mov    %rax, 0x140(%rsi)
    
    Encode the reads directly with a memory operand.  This results in a 16bit
    store instead of an 64bit store, but the backing memory is zeroed.
    
    While cleaning this up, drop one piece of trailing whitespace.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/x86_64/elf.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/include/asm/x86_64/elf.h b/xen/arch/x86/include/asm/x86_64/elf.h
index 00227e0e12..f33be46dde 100644
--- a/xen/arch/x86/include/asm/x86_64/elf.h
+++ b/xen/arch/x86/include/asm/x86_64/elf.h
@@ -34,7 +34,7 @@ typedef struct {
     unsigned long gs;
 } ELF_Gregset;
 
-static inline void elf_core_save_regs(ELF_Gregset *core_regs, 
+static inline void elf_core_save_regs(ELF_Gregset *core_regs,
                                       crash_xen_core_t *xen_core_regs)
 {
     asm ( "movq %%r15, %0" : "=m" (core_regs->r15) );
@@ -54,17 +54,17 @@ static inline void elf_core_save_regs(ELF_Gregset *core_regs,
     asm ( "movq %%rdi, %0" : "=m" (core_regs->rdi) );
 
     /* orig_rax not filled in for now */
-    asm ( "call 0f; 0: popq %0" : "=m" (core_regs->rip) );
-    core_regs->cs = read_sreg(cs);
-    asm ( "pushfq; popq %0" : "=m" (core_regs->rflags) );
+    asm ( "lea (%%rip), %0" : "=r" (core_regs->rip) );
+    asm ( "mov %%cs, %0" : "=m" (core_regs->cs) );
+    asm ( "pushfq; popq %0" : "=m" (core_regs->rflags) ASM_CALL_CONSTRAINT );
     asm ( "movq %%rsp, %0" : "=m" (core_regs->rsp) );
-    core_regs->ss = read_sreg(ss);
+    asm ( "mov %%ss, %0" : "=m" (core_regs->ss) );
     rdmsrl(MSR_FS_BASE, core_regs->thread_fs);
     rdmsrl(MSR_GS_BASE, core_regs->thread_gs);
-    core_regs->ds = read_sreg(ds);
-    core_regs->es = read_sreg(es);
-    core_regs->fs = read_sreg(fs);
-    core_regs->gs = read_sreg(gs);
+    asm ( "mov %%ds, %0" : "=m" (core_regs->ds) );
+    asm ( "mov %%es, %0" : "=m" (core_regs->es) );
+    asm ( "mov %%fs, %0" : "=m" (core_regs->fs) );
+    asm ( "mov %%gs, %0" : "=m" (core_regs->gs) );
 
     asm ( "mov %%cr0, %0" : "=r" (xen_core_regs->cr0) );
     asm ( "mov %%cr2, %0" : "=r" (xen_core_regs->cr2) );
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 20:22:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 20:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.915391.1320917 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttBXz-0003KB-GN; Fri, 14 Mar 2025 20:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 915391.1320917; Fri, 14 Mar 2025 20:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttBXz-0003K3-DW; Fri, 14 Mar 2025 20:22:23 +0000
Received: by outflank-mailman (input) for mailman id 915391;
 Fri, 14 Mar 2025 20:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ttBXy-0003Jt-F9
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 20:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttBXy-002tJN-2A
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 20:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttBXy-00CHs1-1G
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 20:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sY5fJ8xCG2yFMFEdYyaaspLuAQo+OWFqx9uXIFcqsWU=; b=HPJuZnMUtyr3QTWFkOSMztrEA/
	mWwdejXTElXo0VjS8x0rsavcjfSsF5jd7ntxVdOTEPt/Eo/BxbpnLFcnpUui5YhPH5X0BSaUKg8I3
	xmE2hQcKkCitXUWU8yLkcPNeI8IsnkRSQh8Ex6scA7wOGnZwiv12naWwTE7RP/qliHWM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: kconfig: rename MEM_ACCESS -> VM_EVENT
Message-Id: <E1ttBXy-00CHs1-1G@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 20:22:22 +0000

commit 769123c2757cb754069eba3be7fc8619185e3dca
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Fri Mar 14 07:21:09 2025 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 14 17:24:35 2025 +0000

    xen: kconfig: rename MEM_ACCESS -> VM_EVENT
    
    Use more generic CONFIG_VM_EVENT name throughout Xen code instead of
    CONFIG_MEM_ACCESS. This reflects the fact that vm_event is a higher level
    feature, with mem_access & monitor depending on it.
    
    Suggested-by: Tamas K Lengyel <tamas@tklengyel.com>
    Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
---
 automation/gitlab-ci/build.yaml         | 2 +-
 xen/arch/arm/Makefile                   | 2 +-
 xen/arch/arm/configs/tiny64_defconfig   | 2 +-
 xen/arch/arm/include/asm/mem_access.h   | 4 ++--
 xen/arch/ppc/configs/ppc64_defconfig    | 2 +-
 xen/arch/riscv/configs/tiny64_defconfig | 2 +-
 xen/arch/x86/mm/Makefile                | 2 +-
 xen/common/Kconfig                      | 2 +-
 xen/common/Makefile                     | 2 +-
 xen/common/domctl.c                     | 2 +-
 xen/include/xen/mem_access.h            | 6 +++---
 xen/include/xsm/dummy.h                 | 2 +-
 xen/include/xsm/xsm.h                   | 4 ++--
 xen/xsm/dummy.c                         | 2 +-
 xen/xsm/flask/hooks.c                   | 4 ++--
 15 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 034d6d9c3a..f633068c31 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -744,8 +744,8 @@ debian-12-riscv64-gcc:
       CONFIG_EXPERT=y
       CONFIG_GRANT_TABLE=n
       CONFIG_LIVEPATCH=n
-      CONFIG_MEM_ACCESS=n
       CONFIG_QEMU_PLATFORM=y
+      CONFIG_VM_EVENT=n
       CONFIG_XSM=n
 
 debian-12-riscv64-gcc-randconfig:
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index fb0948f067..3bd5125e64 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -38,7 +38,7 @@ obj-y += irq.o
 obj-y += kernel.init.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o
 obj-$(CONFIG_LLC_COLORING) += llc-coloring.o
-obj-$(CONFIG_MEM_ACCESS) += mem_access.o
+obj-$(CONFIG_VM_EVENT) += mem_access.o
 obj-y += mm.o
 obj-y += monitor.o
 obj-y += p2m.o
diff --git a/xen/arch/arm/configs/tiny64_defconfig b/xen/arch/arm/configs/tiny64_defconfig
index cc6d93f2f8..469a1eb9f9 100644
--- a/xen/arch/arm/configs/tiny64_defconfig
+++ b/xen/arch/arm/configs/tiny64_defconfig
@@ -5,7 +5,7 @@ CONFIG_ARM=y
 # Architecture Features
 #
 # CONFIG_GICV3 is not set
-# CONFIG_MEM_ACCESS is not set
+# CONFIG_VM_EVENT is not set
 # CONFIG_SBSA_VUART_CONSOLE is not set
 
 #
diff --git a/xen/arch/arm/include/asm/mem_access.h b/xen/arch/arm/include/asm/mem_access.h
index abac8032fc..d42f28e8b7 100644
--- a/xen/arch/arm/include/asm/mem_access.h
+++ b/xen/arch/arm/include/asm/mem_access.h
@@ -37,7 +37,7 @@ static inline bool p2m_mem_access_sanity_check(struct domain *d)
  * Send mem event based on the access. Boolean return value indicates if trap
  * needs to be injected into guest.
  */
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
 bool p2m_mem_access_check(paddr_t gpa, vaddr_t gla, const struct npfec npfec);
 
 struct page_info*
@@ -58,7 +58,7 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag,
     return NULL;
 }
 
-#endif /*CONFIG_MEM_ACCESS*/
+#endif /* CONFIG_VM_EVENT */
 #endif /* _ASM_ARM_MEM_ACCESS_H */
 
 /*
diff --git a/xen/arch/ppc/configs/ppc64_defconfig b/xen/arch/ppc/configs/ppc64_defconfig
index 4924d881a2..d6aaf772e7 100644
--- a/xen/arch/ppc/configs/ppc64_defconfig
+++ b/xen/arch/ppc/configs/ppc64_defconfig
@@ -1,6 +1,6 @@
 # CONFIG_GRANT_TABLE is not set
 # CONFIG_SPECULATIVE_HARDEN_ARRAY is not set
-# CONFIG_MEM_ACCESS is not set
+# CONFIG_VM_EVENT is not set
 
 CONFIG_PPC64=y
 CONFIG_DEBUG=y
diff --git a/xen/arch/riscv/configs/tiny64_defconfig b/xen/arch/riscv/configs/tiny64_defconfig
index bb3ae26a44..2399f7b918 100644
--- a/xen/arch/riscv/configs/tiny64_defconfig
+++ b/xen/arch/riscv/configs/tiny64_defconfig
@@ -1,6 +1,6 @@
 # CONFIG_BOOT_TIME_CPUPOOLS is not set
 # CONFIG_GRANT_TABLE is not set
-# CONFIG_MEM_ACCESS is not set
+# CONFIG_VM_EVENT is not set
 # CONFIG_COVERAGE is not set
 # CONFIG_LIVEPATCH is not set
 # CONFIG_XSM is not set
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 0345388359..960f6e8409 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -4,7 +4,7 @@ obj-$(CONFIG_HVM) += hap/
 obj-$(CONFIG_ALTP2M) += altp2m.o
 obj-$(CONFIG_HVM) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
 obj-$(CONFIG_SHADOW_PAGING) += guest_walk_4.o
-obj-$(CONFIG_MEM_ACCESS) += mem_access.o
+obj-$(CONFIG_VM_EVENT) += mem_access.o
 obj-$(CONFIG_MEM_PAGING) += mem_paging.o
 obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
 obj-$(CONFIG_HVM) += nested.o
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 6166327f4d..a6aa2c5c14 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -92,7 +92,7 @@ config HAS_VMAP
 config MEM_ACCESS_ALWAYS_ON
 	bool
 
-config MEM_ACCESS
+config VM_EVENT
 	def_bool MEM_ACCESS_ALWAYS_ON
 	prompt "Memory Access and VM events" if !MEM_ACCESS_ALWAYS_ON
 	depends on HVM
diff --git a/xen/common/Makefile b/xen/common/Makefile
index cba3b32733..b71d4b3efa 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -26,7 +26,7 @@ obj-$(CONFIG_KEXEC) += kexec.o
 obj-$(CONFIG_KEXEC) += kimage.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o livepatch_elf.o
 obj-$(CONFIG_LLC_COLORING) += llc-coloring.o
-obj-$(CONFIG_MEM_ACCESS) += mem_access.o
+obj-$(CONFIG_VM_EVENT) += mem_access.o
 obj-y += memory.o
 obj-y += multicall.o
 obj-y += notifier.o
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index b897ca8723..bfe2e1f9f0 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -809,7 +809,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             copyback = true;
         break;
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
     case XEN_DOMCTL_set_access_required:
         if ( unlikely(current->domain == d) ) /* no domain_pause() */
             ret = -EPERM;
diff --git a/xen/include/xen/mem_access.h b/xen/include/xen/mem_access.h
index 2231341b5d..4de651038d 100644
--- a/xen/include/xen/mem_access.h
+++ b/xen/include/xen/mem_access.h
@@ -33,7 +33,7 @@
  */
 struct vm_event_st;
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
 #include <asm/mem_access.h>
 #endif
 
@@ -99,7 +99,7 @@ long p2m_set_mem_access_multi(struct domain *d,
 int p2m_get_mem_access(struct domain *d, gfn_t gfn, xenmem_access_t *access,
                        unsigned int altp2m_idx);
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
 int mem_access_memop(unsigned long cmd,
                      XEN_GUEST_HANDLE_PARAM(xen_mem_access_op_t) arg);
 #else
@@ -109,7 +109,7 @@ int mem_access_memop(unsigned long cmd,
 {
     return -ENOSYS;
 }
-#endif /* CONFIG_MEM_ACCESS */
+#endif /* CONFIG_VM_EVENT */
 
 #endif /* _XEN_MEM_ACCESS_H */
 
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index a8d06de6b0..9227205fcd 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -647,7 +647,7 @@ static XSM_INLINE int cf_check xsm_vm_event_control(
     return xsm_default_action(action, current->domain, d);
 }
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
 static XSM_INLINE int cf_check xsm_mem_access(XSM_DEFAULT_ARG struct domain *d)
 {
     XSM_ASSERT_ACTION(XSM_DM_PRIV);
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 8c33b055fc..24acc16125 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -153,7 +153,7 @@ struct xsm_ops {
 
     int (*vm_event_control)(struct domain *d, int mode, int op);
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
     int (*mem_access)(struct domain *d);
 #endif
 
@@ -637,7 +637,7 @@ static inline int xsm_vm_event_control(
     return alternative_call(xsm_ops.vm_event_control, d, mode, op);
 }
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
 static inline int xsm_mem_access(xsm_default_t def, struct domain *d)
 {
     return alternative_call(xsm_ops.mem_access, d);
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index ce6fbdc6c5..93fbfc43cc 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -111,7 +111,7 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
 
     .vm_event_control              = xsm_vm_event_control,
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
     .mem_access                    = xsm_mem_access,
 #endif
 
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 389707a164..6a53487ea4 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1362,7 +1362,7 @@ static int cf_check flask_vm_event_control(struct domain *d, int mode, int op)
     return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__VM_EVENT);
 }
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
 static int cf_check flask_mem_access(struct domain *d)
 {
     return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__MEM_ACCESS);
@@ -1955,7 +1955,7 @@ static const struct xsm_ops __initconst_cf_clobber flask_ops = {
 
     .vm_event_control = flask_vm_event_control,
 
-#ifdef CONFIG_MEM_ACCESS
+#ifdef CONFIG_VM_EVENT
     .mem_access = flask_mem_access,
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 20:22:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 20:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.915393.1320927 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttBY9-0003Pz-RM; Fri, 14 Mar 2025 20:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 915393.1320927; Fri, 14 Mar 2025 20:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttBY9-0003Pm-Lz; Fri, 14 Mar 2025 20:22:33 +0000
Received: by outflank-mailman (input) for mailman id 915393;
 Fri, 14 Mar 2025 20:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ttBY8-0003MU-I0
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 20:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttBY8-002tJU-2S
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 20:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttBY8-00CHtX-1a
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 20:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/7fjmnIxsYQpwjOlSGpRw7PO1dXi5lmgjYRkzGxzn4M=; b=qoux8fTBFCivt51bAMqc1viM1/
	Ym5brSN+YThgL+7PIGRxG3hzgoEJTSYXYeLG5+1vM99miufUtqgXLMsgfSP9QPQqv8vP0nEkOIYzY
	5RM5oATm8vj90gLoFFwe+gucWgaQa00h1Y+WdJLdppTbblx9dREPzQ11BLethQCUVxVU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86:monitor: control monitor.c build with CONFIG_VM_EVENT option
Message-Id: <E1ttBY8-00CHtX-1a@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 20:22:32 +0000

commit eda90ecfea2a8746afb8123e023db16a3f6c2875
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Fri Mar 14 07:23:14 2025 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 14 17:24:35 2025 +0000

    x86:monitor: control monitor.c build with CONFIG_VM_EVENT option
    
    Replace more general CONFIG_HVM option with CONFIG_VM_EVENT which is more
    relevant and specific to monitoring. This is only to clarify at build level
    to which subsystem this file belongs.
    
    No functional change here, as VM_EVENT depends on HVM.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index c763f80b0b..f59c9665fd 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -49,7 +49,7 @@ obj-$(CONFIG_PV) += ioport_emulate.o
 obj-y += irq.o
 obj-$(CONFIG_KEXEC) += machine_kexec.o
 obj-y += mm.o x86_64/mm.o
-obj-$(CONFIG_HVM) += monitor.o
+obj-$(CONFIG_VM_EVENT) += monitor.o
 obj-y += mpparse.o
 obj-y += nmi.o
 obj-y += numa.o
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 14 20:22:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Mar 2025 20:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.915397.1320947 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttBYK-0003xm-22; Fri, 14 Mar 2025 20:22:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 915397.1320947; Fri, 14 Mar 2025 20:22:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ttBYJ-0003xT-TV; Fri, 14 Mar 2025 20:22:43 +0000
Received: by outflank-mailman (input) for mailman id 915397;
 Fri, 14 Mar 2025 20:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ttBYI-0003wD-LC
 for xen-changelog@lists.xenproject.org; Fri, 14 Mar 2025 20:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttBYI-002tJr-2m
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 20:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ttBYI-00CHuZ-1t
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Mar 2025 20:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mL4bjxLHV/nNoVZQ+q+SAf9xBa0HZd6Oib4OxKRcfBM=; b=mUyquqCMudKVhOiVzTk9X2Rt8Q
	tVlB60qJhNPJ2Z+XT412zBMThiCRRRz77vuQ3rDK9OyD3LmYPCjXJrE28WCiXJKw4Nmb1gzrDTyfW
	EroowNdmgvv5sGGCFWeFjcLZmNCwtCfBBLhQ8Y/7aVG7w/BvHGqIxS3dCbaDhPyk041s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: mem_access: conditionally compile vm_event.c & monitor.c
Message-Id: <E1ttBYI-00CHuZ-1t@xenbits.xenproject.org>
Date: Fri, 14 Mar 2025 20:22:42 +0000

commit 17e5060023685f3ca4d91b69675c5ba77685845a
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Mar 14 07:25:17 2025 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 14 17:24:35 2025 +0000

    xen: mem_access: conditionally compile vm_event.c & monitor.c
    
    Extend coverage of CONFIG_VM_EVENT option and make the build of VM events
    and monitoring support optional. Also make MEM_PAGING option depend on VM_EVENT
    to document that mem_paging is relying on vm_event.
    This is to reduce code size on Arm when this option isn't enabled.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/arm/Makefile      |  4 ++--
 xen/arch/arm/vsmc.c        |  3 ++-
 xen/arch/x86/Kconfig       |  2 +-
 xen/common/Makefile        |  4 ++--
 xen/include/xen/monitor.h  |  9 +++++++++
 xen/include/xen/vm_event.h | 14 +++++++++++---
 6 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 3bd5125e64..4837ad467a 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -40,7 +40,7 @@ obj-$(CONFIG_LIVEPATCH) += livepatch.o
 obj-$(CONFIG_LLC_COLORING) += llc-coloring.o
 obj-$(CONFIG_VM_EVENT) += mem_access.o
 obj-y += mm.o
-obj-y += monitor.o
+obj-$(CONFIG_VM_EVENT) += monitor.o
 obj-y += p2m.o
 obj-y += platform.o
 obj-y += platform_hypercall.o
@@ -66,7 +66,7 @@ obj-$(CONFIG_VGICV2) += vgic-v2.o
 obj-$(CONFIG_GICV3) += vgic-v3.o
 obj-$(CONFIG_HAS_ITS) += vgic-v3-its.o
 endif
-obj-y += vm_event.o
+obj-$(CONFIG_VM_EVENT) += vm_event.o
 obj-y += vtimer.o
 obj-$(CONFIG_SBSA_VUART_CONSOLE) += vpl011.o
 obj-y += vsmc.o
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index e253865b6c..6081f14ed0 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -330,7 +330,8 @@ void do_trap_smc(struct cpu_user_regs *regs, const union hsr hsr)
     }
 
     /* If monitor is enabled, let it handle the call. */
-    if ( current->domain->arch.monitor.privileged_call_enabled )
+    if ( IS_ENABLED(CONFIG_VM_EVENT) &&
+         current->domain->arch.monitor.privileged_call_enabled )
         rc = monitor_smc();
 
     if ( rc == 1 )
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 6e41bc0fb4..f086799594 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -350,7 +350,7 @@ endif
 
 config MEM_PAGING
 	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
-	depends on HVM
+	depends on HVM && VM_EVENT
 
 config MEM_SHARING
 	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
diff --git a/xen/common/Makefile b/xen/common/Makefile
index b71d4b3efa..ac23120d7d 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -54,7 +54,7 @@ obj-y += timer.o
 obj-$(CONFIG_TRACEBUFFER) += trace.o
 obj-y += version.o
 obj-y += virtual_region.o
-obj-y += vm_event.o
+obj-$(CONFIG_VM_EVENT) += vm_event.o
 obj-$(CONFIG_HAS_VMAP) += vmap.o
 obj-y += vsprintf.o
 obj-y += wait.o
@@ -68,7 +68,7 @@ obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o memory.o multicall.o xlat.o
 
 ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
 obj-y += domctl.o
-obj-y += monitor.o
+obj-$(CONFIG_VM_EVENT) += monitor.o
 obj-y += sysctl.o
 endif
 
diff --git a/xen/include/xen/monitor.h b/xen/include/xen/monitor.h
index 713d54f7c1..c086c4390c 100644
--- a/xen/include/xen/monitor.h
+++ b/xen/include/xen/monitor.h
@@ -27,8 +27,17 @@
 struct domain;
 struct xen_domctl_monitor_op;
 
+#ifdef CONFIG_VM_EVENT
 int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop);
 void monitor_guest_request(void);
+#else /* !CONFIG_VM_EVENT */
+static inline int monitor_domctl(struct domain *d,
+                                 struct xen_domctl_monitor_op *mop)
+{
+    return -EOPNOTSUPP;
+}
+static inline void monitor_guest_request(void) {}
+#endif /* !CONFIG_VM_EVENT */
 
 int monitor_traps(struct vcpu *v, bool sync, vm_event_request_t *req);
 
diff --git a/xen/include/xen/vm_event.h b/xen/include/xen/vm_event.h
index 9a86358b42..27d0c74216 100644
--- a/xen/include/xen/vm_event.h
+++ b/xen/include/xen/vm_event.h
@@ -50,9 +50,6 @@ struct vm_event_domain
     unsigned int last_vcpu_wake_up;
 };
 
-/* Clean up on domain destruction */
-void vm_event_cleanup(struct domain *d);
-
 /* Returns whether a ring has been set up */
 bool vm_event_check_ring(struct vm_event_domain *ved);
 
@@ -88,7 +85,18 @@ void vm_event_cancel_slot(struct domain *d, struct vm_event_domain *ved);
 void vm_event_put_request(struct domain *d, struct vm_event_domain *ved,
                           vm_event_request_t *req);
 
+#ifdef CONFIG_VM_EVENT
+/* Clean up on domain destruction */
+void vm_event_cleanup(struct domain *d);
 int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec);
+#else /* !CONFIG_VM_EVENT */
+static inline void vm_event_cleanup(struct domain *d) {}
+static inline int vm_event_domctl(struct domain *d,
+                                  struct xen_domctl_vm_event_op *vec)
+{
+    return -EOPNOTSUPP;
+}
+#endif /* !CONFIG_VM_EVENT */
 
 void vm_event_vcpu_pause(struct vcpu *v);
 void vm_event_vcpu_unpause(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 14:44:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 14:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917074.1322062 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuBhD-0002Ym-NT; Mon, 17 Mar 2025 14:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917074.1322062; Mon, 17 Mar 2025 14:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuBhD-0002Ye-KY; Mon, 17 Mar 2025 14:44:03 +0000
Received: by outflank-mailman (input) for mailman id 917074;
 Mon, 17 Mar 2025 14:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuBhC-0002YY-MB
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 14:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuBhC-008vYR-2D
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 14:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuBhC-002IjF-17
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 14:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5QtWdIzoczngSwKc/154x/dlLeNOwDuDRuyaBcWT0M8=; b=3edZaS52z0ND5d9+61vBF06a3P
	COYKhe5dLST4ClIwsaPHsj+R5bwiPGulPjV9ykuXvOQnOazeZJWP1iL5KkmoT1xA/ej7T4bpLKYkJ
	6G4ZgeRgjASKmSNjr1hYdPCBVWDPNQ8oVoCVxNjswSOWPzp61ihCzNb330ALU2jrjb/w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/ubsan: provide helper for clang's -fsanitize=function
Message-Id: <E1tuBhC-002IjF-17@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 14:44:02 +0000

commit f38148ab093d0e5967f92062b3196d7801850548
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 12 13:35:53 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 17 13:33:28 2025 +0100

    xen/ubsan: provide helper for clang's -fsanitize=function
    
    clang's -fsanitize=function relies on the presence of
    __ubsan_handle_function_type_mismatch() to print the detection of indirect
    calls of a function through a function pointer of the wrong type.
    
    Implement the helper, inspired on the llvm ubsan lib implementation.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/ubsan/ubsan.c | 16 ++++++++++++++++
 xen/common/ubsan/ubsan.h |  5 +++++
 2 files changed, 21 insertions(+)

diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index e99370322b..7ebe4bfc14 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -546,3 +546,19 @@ void __ubsan_handle_invalid_builtin(struct invalid_builtin_data *data)
 
 	ubsan_epilogue(&flags);
 }
+
+void __ubsan_handle_function_type_mismatch(
+	struct function_type_mismatch_data *data, unsigned long val)
+{
+	unsigned long flags;
+
+	if (suppress_report(&data->location))
+		return;
+
+	ubsan_prologue(&data->location, &flags);
+
+	pr_err("call to function %ps through pointer to incorrect function type %s\n",
+		(void *)val, data->type->type_name);
+
+	ubsan_epilogue(&flags);
+}
diff --git a/xen/common/ubsan/ubsan.h b/xen/common/ubsan/ubsan.h
index 9c7f3b9b6c..8987f9d453 100644
--- a/xen/common/ubsan/ubsan.h
+++ b/xen/common/ubsan/ubsan.h
@@ -95,6 +95,11 @@ enum {
 	kind_clz,
 };
 
+struct function_type_mismatch_data {
+	struct source_location location;
+	struct type_descriptor *type;
+};
+
 #if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__)
 typedef __int128 s_max;
 typedef unsigned __int128 u_max;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 14:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 14:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917075.1322066 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuBhN-0002az-Ou; Mon, 17 Mar 2025 14:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917075.1322066; Mon, 17 Mar 2025 14:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuBhN-0002ar-M3; Mon, 17 Mar 2025 14:44:13 +0000
Received: by outflank-mailman (input) for mailman id 917075;
 Mon, 17 Mar 2025 14:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuBhM-0002aZ-KT
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 14:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuBhM-008vYV-2g
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 14:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuBhM-002Ikw-1d
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 14:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=52+q7U0M/NOYI22EuEvK8E8OKqXRC9iaU2yvO+4x2T4=; b=gmULPGVb70nAu8hHPH4jIIOyLn
	A+NYILh70N7o4fqVHCCEBBoZnwq7N/kRa0WLAtPSCb+Xmk37L8BUh8YCialRw1goIGIzxb4Gx9PUY
	0che3bHBji2GpZWszHqL6ADiOdOelKF5m1BRGk37KXSaPc6nstHUyJEz/s7vJSsFDJOI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/dom0: placate GCC 12 compile-time errors with UBSAN and PVH_GUEST
Message-Id: <E1tuBhM-002Ikw-1d@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 14:44:12 +0000

commit 932898d4492609f99e3016d423a9323235392864
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 13 11:08:05 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 17 13:33:28 2025 +0100

    x86/dom0: placate GCC 12 compile-time errors with UBSAN and PVH_GUEST
    
    When building Xen with GCC 12 with UBSAN and PVH_GUEST both enabled the
    compiler emits the following errors:
    
    arch/x86/setup.c: In function '__start_xen':
    arch/x86/setup.c:1504:19: error: 'consider_modules' reading 40 bytes from a region of size 4 [-Werror=stringop-overread]
     1504 |             end = consider_modules(s, e, reloc_size + mask,
          |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1505 |                                    bi->mods, bi->nr_modules, -1);
          |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/setup.c:1504:19: note: referencing argument 4 of type 'const struct boot_module[0]'
    arch/x86/setup.c:686:24: note: in a call to function 'consider_modules'
      686 | static uint64_t __init consider_modules(
          |                        ^~~~~~~~~~~~~~~~
    arch/x86/setup.c:1535:19: error: 'consider_modules' reading 40 bytes from a region of size 4 [-Werror=stringop-overread]
     1535 |             end = consider_modules(s, e, size, bi->mods,
          |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1536 |                                    bi->nr_modules + relocated, j);
          |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/setup.c:1535:19: note: referencing argument 4 of type 'const struct boot_module[0]'
    arch/x86/setup.c:686:24: note: in a call to function 'consider_modules'
      686 | static uint64_t __init consider_modules(
          |                        ^~~~~~~~~~~~~~~~
    
    This seems to be the result of some function manipulation done by UBSAN
    triggering GCC stringops related errors.  Placate the errors by declaring
    the function parameter as `const struct *boot_module` instead of `const
    struct boot_module[]`.
    
    Note that GCC 13 seems to be fixed, and doesn't trigger the error when
    using `[]`.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 4a32d84911..bde5d75ea6 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -684,7 +684,7 @@ static void __init noinline move_xen(void)
 #undef BOOTSTRAP_MAP_LIMIT
 
 static uint64_t __init consider_modules(
-    uint64_t s, uint64_t e, uint32_t size, const struct boot_module mods[],
+    uint64_t s, uint64_t e, uint32_t size, const struct boot_module *mods,
     unsigned int nr_mods, unsigned int this_mod)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 14:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 14:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917076.1322069 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuBhX-0002ds-Q6; Mon, 17 Mar 2025 14:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917076.1322069; Mon, 17 Mar 2025 14:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuBhX-0002dk-Na; Mon, 17 Mar 2025 14:44:23 +0000
Received: by outflank-mailman (input) for mailman id 917076;
 Mon, 17 Mar 2025 14:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuBhW-0002dZ-N8
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 14:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuBhW-008vYZ-2y
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 14:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuBhW-002ImE-27
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 14:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FQQsgQ8p8zgNlbO7kVH4NU65tiHf1pl5LvqhCD0YsfQ=; b=e047TRJ4Nrt9hWFLdhrwzXvlnQ
	xIDkSxiPI4VpUY/zC1/Wlwt3aF23/hQ8rY2grzX9nRTLDN+VhWzYah446xszJ6Sz/JHoBjjUTopNa
	IrkNllA2cPC2JIHHIGVEquM7T0NjugLV3659VU6Wy+CGFbOsOOZKUKg6svj66XHQoO9o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/ubsan: expand pointer overflow message printing
Message-Id: <E1tuBhW-002ImE-27@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 14:44:22 +0000

commit 53ec18fa8f590ea6ad4792a0b126013dd39a25ee
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 13 12:02:50 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 17 13:33:29 2025 +0100

    xen/ubsan: expand pointer overflow message printing
    
    Add messages about operations against the NULL pointer, or that result in
    a NULL pointer.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/ubsan/ubsan.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index 7ebe4bfc14..20aa0cb598 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -517,9 +517,18 @@ void __ubsan_handle_pointer_overflow(struct pointer_overflow_data *data,
 
 	ubsan_prologue(&data->location, &flags);
 
-	pr_err("pointer operation %s %p to %p\n",
-	       base > result ? "overflowed" : "underflowed",
-	       _p(base), _p(result));
+	if (!base && !result)
+		pr_err("applying zero offset to null pointer\n");
+	else if (!base && result)
+		pr_err("applying non-zero offset %p to null pointer\n",
+			_p(result));
+	else if (base && !result)
+		pr_err("applying non-zero offset to non-null pointer %p produced null pointer\n",
+			_p(base));
+	else
+		pr_err("pointer operation %s %p to %p\n",
+			base > result ? "overflowed" : "underflowed",
+			_p(base), _p(result));
 
 	ubsan_epilogue(&flags);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 14:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 14:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917077.1322073 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuBhh-0002gS-RY; Mon, 17 Mar 2025 14:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917077.1322073; Mon, 17 Mar 2025 14:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuBhh-0002gL-P6; Mon, 17 Mar 2025 14:44:33 +0000
Received: by outflank-mailman (input) for mailman id 917077;
 Mon, 17 Mar 2025 14:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuBhg-0002gF-QN
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 14:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuBhh-008vYd-04
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 14:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuBhg-002InI-2Q
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 14:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LBuqnDnikXl9+a2ymLGpHlJAukbPeebdK3N7FNtA/OY=; b=3tdCFaniAZxsu7Q/WPtUtjCrP2
	SrheSsVhxZmSRbZ9XQuzhL6/gzzpR9nc3lB+pJJmpB1FZYGWmj4YS4oq8wHNE5aG+xUf1P2DcXCKI
	7NYvUouczBfwRN63bbfuuzHRsqQFnYN4LOF55DdOAar7NtRRPXeIhAnCa3SFXaHfc5YI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ioremap: prevent additions against the NULL pointer
Message-Id: <E1tuBhg-002InI-2Q@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 14:44:32 +0000

commit 9a6f2c52f75781acda39fab5cc96d1bcc54bf534
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 13 12:19:48 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 17 13:33:29 2025 +0100

    x86/ioremap: prevent additions against the NULL pointer
    
    This was reported by clang UBSAN as:
    
    UBSAN: Undefined behaviour in arch/x86/mm.c:6297:40
    applying zero offset to null pointer
    [...]
    Xen call trace:
        [<ffff82d040303662>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304aa3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0406ebbc0>] F ioremap_wc+0xc8/0xe0
        [<ffff82d0406c3728>] F video_init+0xd0/0x180
        [<ffff82d0406ab6f5>] F console_init_preirq+0x3d/0x220
        [<ffff82d0406f1876>] F __start_xen+0x68e/0x5530
        [<ffff82d04020482e>] F __high_start+0x8e/0x90
    
    Fix bt_ioremap() and ioremap{,_wc}() to not add the offset if the returned
    pointer from __vmap() is NULL.
    
    Fixes: d0d4635d034f ('implement vmap()')
    Fixes: f390941a92f1 ('x86/DMI: fix table mapping when one lives above 1Mb')
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/dmi_scan.c | 7 +++++--
 xen/arch/x86/mm.c       | 6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 2fcc485295..eb65bc86bb 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -112,6 +112,7 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
 {
     mfn_t mfn = _mfn(PFN_DOWN(addr));
     unsigned int offs = PAGE_OFFSET(addr);
+    void *va;
 
     if ( addr + len <= MB(1) )
         return __va(addr);
@@ -119,8 +120,10 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
     if ( system_state < SYS_STATE_boot )
         return __acpi_map_table(addr, len);
 
-    return __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
-                  VMAP_DEFAULT) + offs;
+    va = __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
+                VMAP_DEFAULT);
+
+    return va ? va + offs : NULL;
 }
 
 static void __init bt_iounmap(const void *ptr, unsigned int len)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index bfdc8fb019..03b8319f7a 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -6277,7 +6277,9 @@ void __iomem *ioremap(paddr_t pa, size_t len)
         unsigned int offs = pa & (PAGE_SIZE - 1);
         unsigned int nr = PFN_UP(offs + len);
 
-        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT) + offs;
+        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT);
+        if ( va )
+            va += offs;
     }
 
     return (void __force __iomem *)va;
@@ -6294,7 +6296,7 @@ void __iomem *__init ioremap_wc(paddr_t pa, size_t len)
 
     va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_WC, VMAP_DEFAULT);
 
-    return (void __force __iomem *)(va + offs);
+    return (void __force __iomem *)(va ? va + offs : NULL);
 }
 
 int create_perdomain_mapping(struct domain *d, unsigned long va,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 15:55:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 15:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917269.1322223 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuCnv-0001Ul-0f; Mon, 17 Mar 2025 15:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917269.1322223; Mon, 17 Mar 2025 15:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuCnu-0001Uc-Tl; Mon, 17 Mar 2025 15:55:02 +0000
Received: by outflank-mailman (input) for mailman id 917269;
 Mon, 17 Mar 2025 15:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuCnt-0001UW-RC
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 15:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuCnt-008xCL-3C
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 15:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuCnt-002Tce-2H
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 15:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2J24PQGAVeruh1A/itRF4yT9Jc/p02JeygXJ9+n5FiE=; b=oC1dn8WRZfpDX/r8QwLcdyehYC
	xhT3zq+CuQR6MLdhD2Ly12VA5Xd25fwUx+eEYZUhi6GEFIcyIEyerJhr6lUiqTekUy7FwlniXXoE6
	863IibARVflpbedHrJJ0rH1fSNOdh4nlcY1TNGYpZGbHQkSzSR+fa3L54j4UqYkkV6XU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/ubsan: provide helper for clang's -fsanitize=function
Message-Id: <E1tuCnt-002Tce-2H@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 15:55:01 +0000

commit f38148ab093d0e5967f92062b3196d7801850548
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 12 13:35:53 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 17 13:33:28 2025 +0100

    xen/ubsan: provide helper for clang's -fsanitize=function
    
    clang's -fsanitize=function relies on the presence of
    __ubsan_handle_function_type_mismatch() to print the detection of indirect
    calls of a function through a function pointer of the wrong type.
    
    Implement the helper, inspired on the llvm ubsan lib implementation.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/ubsan/ubsan.c | 16 ++++++++++++++++
 xen/common/ubsan/ubsan.h |  5 +++++
 2 files changed, 21 insertions(+)

diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index e99370322b..7ebe4bfc14 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -546,3 +546,19 @@ void __ubsan_handle_invalid_builtin(struct invalid_builtin_data *data)
 
 	ubsan_epilogue(&flags);
 }
+
+void __ubsan_handle_function_type_mismatch(
+	struct function_type_mismatch_data *data, unsigned long val)
+{
+	unsigned long flags;
+
+	if (suppress_report(&data->location))
+		return;
+
+	ubsan_prologue(&data->location, &flags);
+
+	pr_err("call to function %ps through pointer to incorrect function type %s\n",
+		(void *)val, data->type->type_name);
+
+	ubsan_epilogue(&flags);
+}
diff --git a/xen/common/ubsan/ubsan.h b/xen/common/ubsan/ubsan.h
index 9c7f3b9b6c..8987f9d453 100644
--- a/xen/common/ubsan/ubsan.h
+++ b/xen/common/ubsan/ubsan.h
@@ -95,6 +95,11 @@ enum {
 	kind_clz,
 };
 
+struct function_type_mismatch_data {
+	struct source_location location;
+	struct type_descriptor *type;
+};
+
 #if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__)
 typedef __int128 s_max;
 typedef unsigned __int128 u_max;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 15:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 15:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917270.1322229 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuCo5-0001Wp-2a; Mon, 17 Mar 2025 15:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917270.1322229; Mon, 17 Mar 2025 15:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuCo4-0001Wg-VH; Mon, 17 Mar 2025 15:55:12 +0000
Received: by outflank-mailman (input) for mailman id 917270;
 Mon, 17 Mar 2025 15:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuCo3-0001WS-St
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 15:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuCo4-008xCR-0J
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 15:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuCo3-002Tdp-2d
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 15:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Dn6e8iL9NYYDKcpXJsuY5aQ9uNU4/o4Vk9ifvP0SE5o=; b=mKqj3YOp4EvvNLnL9NmrOew1NL
	0o4ydPDrOSa6oXInwwTkrs3llHKw4Lyc474iECSboIQj7ZiNH55EJZyUeW728AhKyAUXGDMPbT8Ty
	4Upp2CL36I/ZHjurpgOYEnv/wMmvxqVrI630Uc9FU1t/41pADMqAmB7qE6JoIcd0N6FQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/dom0: placate GCC 12 compile-time errors with UBSAN and PVH_GUEST
Message-Id: <E1tuCo3-002Tdp-2d@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 15:55:11 +0000

commit 932898d4492609f99e3016d423a9323235392864
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 13 11:08:05 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 17 13:33:28 2025 +0100

    x86/dom0: placate GCC 12 compile-time errors with UBSAN and PVH_GUEST
    
    When building Xen with GCC 12 with UBSAN and PVH_GUEST both enabled the
    compiler emits the following errors:
    
    arch/x86/setup.c: In function '__start_xen':
    arch/x86/setup.c:1504:19: error: 'consider_modules' reading 40 bytes from a region of size 4 [-Werror=stringop-overread]
     1504 |             end = consider_modules(s, e, reloc_size + mask,
          |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1505 |                                    bi->mods, bi->nr_modules, -1);
          |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/setup.c:1504:19: note: referencing argument 4 of type 'const struct boot_module[0]'
    arch/x86/setup.c:686:24: note: in a call to function 'consider_modules'
      686 | static uint64_t __init consider_modules(
          |                        ^~~~~~~~~~~~~~~~
    arch/x86/setup.c:1535:19: error: 'consider_modules' reading 40 bytes from a region of size 4 [-Werror=stringop-overread]
     1535 |             end = consider_modules(s, e, size, bi->mods,
          |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1536 |                                    bi->nr_modules + relocated, j);
          |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/setup.c:1535:19: note: referencing argument 4 of type 'const struct boot_module[0]'
    arch/x86/setup.c:686:24: note: in a call to function 'consider_modules'
      686 | static uint64_t __init consider_modules(
          |                        ^~~~~~~~~~~~~~~~
    
    This seems to be the result of some function manipulation done by UBSAN
    triggering GCC stringops related errors.  Placate the errors by declaring
    the function parameter as `const struct *boot_module` instead of `const
    struct boot_module[]`.
    
    Note that GCC 13 seems to be fixed, and doesn't trigger the error when
    using `[]`.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 4a32d84911..bde5d75ea6 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -684,7 +684,7 @@ static void __init noinline move_xen(void)
 #undef BOOTSTRAP_MAP_LIMIT
 
 static uint64_t __init consider_modules(
-    uint64_t s, uint64_t e, uint32_t size, const struct boot_module mods[],
+    uint64_t s, uint64_t e, uint32_t size, const struct boot_module *mods,
     unsigned int nr_mods, unsigned int this_mod)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 15:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 15:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917271.1322232 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuCoF-0001ZG-33; Mon, 17 Mar 2025 15:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917271.1322232; Mon, 17 Mar 2025 15:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuCoF-0001Z8-0T; Mon, 17 Mar 2025 15:55:23 +0000
Received: by outflank-mailman (input) for mailman id 917271;
 Mon, 17 Mar 2025 15:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuCoD-0001Z2-Vo
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 15:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuCoE-008xCV-0b
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 15:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuCoD-002TeP-2x
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 15:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hH1jjn0xK1m7CWliEAXi5jPey6HIKmu5nlI+c07+QNc=; b=t2nm+h800p87hb/CAaEG0bYjHz
	bCdBHh5bDwVhgnj2Iz1pdyrqL1K+TuYXszQBR+0d3N7B2v20LerMKxsq3cPbce4XOpuuAAUMH6eqT
	BabX9D+ucQ9drv8REIHorsAxMMA1LQeVq6ID4I4vXKcJA5N8jxuH9DVN5hUdGEwIOXxY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/ubsan: expand pointer overflow message printing
Message-Id: <E1tuCoD-002TeP-2x@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 15:55:21 +0000

commit 53ec18fa8f590ea6ad4792a0b126013dd39a25ee
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 13 12:02:50 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 17 13:33:29 2025 +0100

    xen/ubsan: expand pointer overflow message printing
    
    Add messages about operations against the NULL pointer, or that result in
    a NULL pointer.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/ubsan/ubsan.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index 7ebe4bfc14..20aa0cb598 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -517,9 +517,18 @@ void __ubsan_handle_pointer_overflow(struct pointer_overflow_data *data,
 
 	ubsan_prologue(&data->location, &flags);
 
-	pr_err("pointer operation %s %p to %p\n",
-	       base > result ? "overflowed" : "underflowed",
-	       _p(base), _p(result));
+	if (!base && !result)
+		pr_err("applying zero offset to null pointer\n");
+	else if (!base && result)
+		pr_err("applying non-zero offset %p to null pointer\n",
+			_p(result));
+	else if (base && !result)
+		pr_err("applying non-zero offset to non-null pointer %p produced null pointer\n",
+			_p(base));
+	else
+		pr_err("pointer operation %s %p to %p\n",
+			base > result ? "overflowed" : "underflowed",
+			_p(base), _p(result));
 
 	ubsan_epilogue(&flags);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 15:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 15:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917272.1322235 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuCoP-0001cS-5j; Mon, 17 Mar 2025 15:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917272.1322235; Mon, 17 Mar 2025 15:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuCoP-0001cK-34; Mon, 17 Mar 2025 15:55:33 +0000
Received: by outflank-mailman (input) for mailman id 917272;
 Mon, 17 Mar 2025 15:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuCoO-0001c7-2z
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 15:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuCoO-008xCb-0x
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 15:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuCoO-002Tf8-03
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 15:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=efg7dgX7HJ5QLxAHP7zg9QwGh6uOfRDVzXJxh/kAdK0=; b=eAqHVulIGuJ7xbUaJ90VDOq6Pv
	eCyZPgA3eu1Odvcy54FaHA8De1DO9bV1IYS+2dSnOSQMD7FliHV9kvVnFMdQrWqr4Cj9ajNhwBjDq
	JVkPBILZEwK4/DvH/P4BrFwpV7cjZ846XbM2kROuIyan5nOcys9vVyml3eN2OkvRutuQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ioremap: prevent additions against the NULL pointer
Message-Id: <E1tuCoO-002Tf8-03@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 15:55:32 +0000

commit 9a6f2c52f75781acda39fab5cc96d1bcc54bf534
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Mar 13 12:19:48 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Mon Mar 17 13:33:29 2025 +0100

    x86/ioremap: prevent additions against the NULL pointer
    
    This was reported by clang UBSAN as:
    
    UBSAN: Undefined behaviour in arch/x86/mm.c:6297:40
    applying zero offset to null pointer
    [...]
    Xen call trace:
        [<ffff82d040303662>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304aa3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0406ebbc0>] F ioremap_wc+0xc8/0xe0
        [<ffff82d0406c3728>] F video_init+0xd0/0x180
        [<ffff82d0406ab6f5>] F console_init_preirq+0x3d/0x220
        [<ffff82d0406f1876>] F __start_xen+0x68e/0x5530
        [<ffff82d04020482e>] F __high_start+0x8e/0x90
    
    Fix bt_ioremap() and ioremap{,_wc}() to not add the offset if the returned
    pointer from __vmap() is NULL.
    
    Fixes: d0d4635d034f ('implement vmap()')
    Fixes: f390941a92f1 ('x86/DMI: fix table mapping when one lives above 1Mb')
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/dmi_scan.c | 7 +++++--
 xen/arch/x86/mm.c       | 6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 2fcc485295..eb65bc86bb 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -112,6 +112,7 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
 {
     mfn_t mfn = _mfn(PFN_DOWN(addr));
     unsigned int offs = PAGE_OFFSET(addr);
+    void *va;
 
     if ( addr + len <= MB(1) )
         return __va(addr);
@@ -119,8 +120,10 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
     if ( system_state < SYS_STATE_boot )
         return __acpi_map_table(addr, len);
 
-    return __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
-                  VMAP_DEFAULT) + offs;
+    va = __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
+                VMAP_DEFAULT);
+
+    return va ? va + offs : NULL;
 }
 
 static void __init bt_iounmap(const void *ptr, unsigned int len)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index bfdc8fb019..03b8319f7a 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -6277,7 +6277,9 @@ void __iomem *ioremap(paddr_t pa, size_t len)
         unsigned int offs = pa & (PAGE_SIZE - 1);
         unsigned int nr = PFN_UP(offs + len);
 
-        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT) + offs;
+        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT);
+        if ( va )
+            va += offs;
     }
 
     return (void __force __iomem *)va;
@@ -6294,7 +6296,7 @@ void __iomem *__init ioremap_wc(paddr_t pa, size_t len)
 
     va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_WC, VMAP_DEFAULT);
 
-    return (void __force __iomem *)(va + offs);
+    return (void __force __iomem *)(va ? va + offs : NULL);
 }
 
 int create_perdomain_mapping(struct domain *d, unsigned long va,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 17:44:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 17:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917594.1322466 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuEVP-0000PJ-K7; Mon, 17 Mar 2025 17:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917594.1322466; Mon, 17 Mar 2025 17:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuEVP-0000PB-HX; Mon, 17 Mar 2025 17:44:03 +0000
Received: by outflank-mailman (input) for mailman id 917594;
 Mon, 17 Mar 2025 17:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuEVO-0000P5-Cg
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 17:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuEVO-0090TH-1M
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 17:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuEVO-002nVX-0O
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 17:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=idx942obIqboJmhMPmTu8qwb3I+1PmxsFzWYBNccMh4=; b=JJud05x+E3AzU5iQIKQl2pu5nr
	qYqlvCm69lkq/erz2O+Ieh6uiVTReymEHfkl+IASH58U6c7vtTJblN/Ezbz01ZVBgoroAGxCw3tJo
	WtwtKkgBjueo9kcVwwv5nZMmdWQblwHH6afygPtlzWoELGUD3gAs9zqV+++EuFwsttfw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: add HVM-specific Kconfig
Message-Id: <E1tuEVO-002nVX-0O@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 17:44:02 +0000

commit e3ed540f2e9fa2261b8293ee85fd22aae93cbfca
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Sat Mar 15 01:19:49 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 17 15:01:25 2025 +0000

    x86/hvm: add HVM-specific Kconfig
    
    Add a separate menu for configuring HVM build-time settings to better
    organize HVM-specific options.
    
    HVM options will now appear in a dedicated sub-menu in the menuconfig
    tool.
    
    Also, make AMD_SVM config dependent on AMD config and INTEL_VMX on INTEL
    respectively.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/Kconfig     | 75 +-----------------------------------------------
 xen/arch/x86/hvm/Kconfig | 73 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+), 74 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index f086799594..18efdb2e31 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -107,42 +107,7 @@ config PV_LINEAR_PT
 
          If unsure, say Y.
 
-config HVM
-	bool "HVM support"
-	depends on !PV_SHIM_EXCLUSIVE
-	default !PV_SHIM
-	select COMPAT
-	select IOREQ_SERVER
-	select MEM_ACCESS_ALWAYS_ON
-	help
-	  Interfaces to support HVM domains.  HVM domains require hardware
-	  virtualisation extensions (e.g. Intel VT-x, AMD SVM), but can boot
-	  guests which have no specific Xen knowledge.
-
-	  This option is needed if you want to run HVM or PVH domains.
-
-	  If unsure, say Y.
-
-config AMD_SVM
-	bool "AMD-V" if EXPERT
-	depends on HVM
-	default y
-	help
-	  Enables virtual machine extensions on platforms that implement the
-	  AMD Virtualization Technology (AMD-V).
-	  If your system includes a processor with AMD-V support, say Y.
-	  If in doubt, say Y.
-
-config INTEL_VMX
-	bool "Intel VT-x" if EXPERT
-	depends on HVM
-	default y
-	select ARCH_VCPU_IOREQ_COMPLETION
-	help
-	  Enables virtual machine extensions on platforms that implement the
-	  Intel Virtualization Technology (Intel VT-x).
-	  If your system includes a processor with Intel VT-x support, say Y.
-	  If in doubt, say Y.
+source "arch/x86/hvm/Kconfig"
 
 config XEN_SHSTK
 	bool "Supervisor Shadow Stacks"
@@ -201,25 +166,6 @@ config BIGMEM
 
 	  If unsure, say N.
 
-config HVM_FEP
-	bool "HVM Forced Emulation Prefix support (UNSUPPORTED)" if UNSUPPORTED
-	default DEBUG
-	depends on HVM
-	help
-
-	  Compiles in a feature that allows HVM guest to arbitrarily
-	  exercise the instruction emulator.
-
-	  This feature can only be enabled during boot time with
-	  appropriate hypervisor command line option. Please read
-	  hypervisor command line documentation before trying to use
-	  this feature.
-
-	  This is strictly for testing purposes, and not appropriate
-	  for use in production.
-
-	  If unsure, say N.
-
 config TBOOT
 	bool "Xen tboot support (UNSUPPORTED)"
 	depends on INTEL && UNSUPPORTED
@@ -348,14 +294,6 @@ config HYPERV_GUEST
 
 endif
 
-config MEM_PAGING
-	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
-	depends on HVM && VM_EVENT
-
-config MEM_SHARING
-	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
-	depends on HVM
-
 config REQUIRE_NX
 	bool "Require NX (No eXecute) support"
 	help
@@ -372,17 +310,6 @@ config REQUIRE_NX
 	  was unavailable. However, if enabled, Xen will no longer boot on
 	  any CPU which is lacking NX support.
 
-config ALTP2M
-	bool "Alternate P2M support" if EXPERT
-	depends on INTEL_VMX
-	default y
-	help
-	  Alternate-p2m allows a guest to manage multiple p2m guest physical
-	  "memory views" (as opposed to a single p2m).
-	  Useful for memory introspection.
-
-	  If unsure, stay with defaults.
-
 config UCODE_SCAN_DEFAULT
 	bool "Scan for microcode by default"
 	help
diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
new file mode 100644
index 0000000000..2def0f98e2
--- /dev/null
+++ b/xen/arch/x86/hvm/Kconfig
@@ -0,0 +1,73 @@
+menuconfig HVM
+	bool "HVM support"
+	depends on !PV_SHIM_EXCLUSIVE
+	default !PV_SHIM
+	select COMPAT
+	select IOREQ_SERVER
+	select MEM_ACCESS_ALWAYS_ON
+	help
+	  Interfaces to support HVM domains.  HVM domains require hardware
+	  virtualisation extensions (e.g. Intel VT-x, AMD SVM), but can boot
+	  guests which have no specific Xen knowledge.
+
+	  This option is needed if you want to run HVM or PVH domains.
+
+	  If unsure, say Y.
+
+if HVM
+
+config AMD_SVM
+	bool "AMD-V" if AMD && EXPERT
+	default y
+	help
+	  Enables virtual machine extensions on platforms that implement the
+	  AMD Virtualization Technology (AMD-V).
+	  If your system includes a processor with AMD-V support, say Y.
+	  If in doubt, say Y.
+
+config INTEL_VMX
+	bool "Intel VT-x" if INTEL && EXPERT
+	default y
+	select ARCH_VCPU_IOREQ_COMPLETION
+	help
+	  Enables virtual machine extensions on platforms that implement the
+	  Intel Virtualization Technology (Intel VT-x).
+	  If your system includes a processor with Intel VT-x support, say Y.
+	  If in doubt, say Y.
+
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support (UNSUPPORTED)" if UNSUPPORTED
+	default DEBUG
+	help
+	  Compiles in a feature that allows HVM guest to arbitrarily
+	  exercise the instruction emulator.
+
+	  This feature can only be enabled during boot time with
+	  appropriate hypervisor command line option. Please read
+	  hypervisor command line documentation before trying to use
+	  this feature.
+
+	  This is strictly for testing purposes, and not appropriate
+	  for use in production.
+
+	  If unsure, say N.
+
+config ALTP2M
+	bool "Alternate P2M support" if EXPERT
+	depends on INTEL_VMX
+	default y
+	help
+	  Alternate-p2m allows a guest to manage multiple p2m guest physical
+	  "memory views" (as opposed to a single p2m).
+	  Useful for memory introspection.
+
+	  If unsure, stay with defaults.
+
+config MEM_PAGING
+	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
+	depends on VM_EVENT
+
+config MEM_SHARING
+	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
+
+endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 17:44:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 17:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917595.1322469 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuEVZ-0000Qk-LZ; Mon, 17 Mar 2025 17:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917595.1322469; Mon, 17 Mar 2025 17:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuEVZ-0000Qd-Iw; Mon, 17 Mar 2025 17:44:13 +0000
Received: by outflank-mailman (input) for mailman id 917595;
 Mon, 17 Mar 2025 17:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuEVY-0000QV-CX
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 17:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuEVY-0090TM-1j
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 17:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuEVY-002nWu-0p
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 17:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EeiTsULvqVYR1wg5lxRLBed82s7Jme9goWfWudmbX9w=; b=w5a2cymmYMnmWwajeScO+iPG1s
	VNl5YahZY0n/MiRMKDMCwafdXPF1+CfguVFw8hexpXWolU1Mn10tMf3NR+x5miy7LH5AndcSFaFw4
	5eOLCxu2nAClJ3KaTnkXljuLWlJ5ZHutwPv+qkdcwOufE/DA208XOKaD9LWSUE/6fp14=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/irq: rename NR_ISAIRQS to NR_ISA_IRQS
Message-Id: <E1tuEVY-002nWu-0p@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 17:44:12 +0000

commit 29975e126d471e7dd9aba47c7d2e1a2bd23ee5a4
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Sat Mar 15 01:00:47 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 17 16:08:25 2025 +0000

    x86/irq: rename NR_ISAIRQS to NR_ISA_IRQS
    
    Rename NR_ISAIRQS to NR_ISA_IRQS to enhance readability.
    
    No functional changes.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c             | 4 ++--
 xen/arch/x86/hvm/vpt.c             | 2 +-
 xen/arch/x86/include/asm/hvm/irq.h | 4 ++--
 xen/arch/x86/physdev.c             | 2 +-
 xen/drivers/passthrough/x86/hvm.c  | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 2f31180b6f..5950f3160f 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -633,8 +633,8 @@ int hvm_domain_initialise(struct domain *d,
     /* Set the number of GSIs */
     hvm_domain_irq(d)->nr_gsis = nr_gsis;
 
-    BUILD_BUG_ON(NR_HVM_DOMU_IRQS < NR_ISAIRQS);
-    ASSERT(hvm_domain_irq(d)->nr_gsis >= NR_ISAIRQS);
+    BUILD_BUG_ON(NR_HVM_DOMU_IRQS < NR_ISA_IRQS);
+    ASSERT(hvm_domain_irq(d)->nr_gsis >= NR_ISA_IRQS);
 
     /* need link to containing domain */
     d->arch.hvm.pl_time->domain = d;
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 5e7b9a9f66..4d86830644 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -491,7 +491,7 @@ void create_periodic_time(
     uint64_t period, uint8_t irq, time_cb *cb, void *data, bool level)
 {
     if ( !pt->source ||
-         (irq >= NR_ISAIRQS && pt->source == PTSRC_isa) ||
+         (irq >= NR_ISA_IRQS && pt->source == PTSRC_isa) ||
          (level && period) ||
          (pt->source == PTSRC_ioapic ? irq >= hvm_domain_irq(v->domain)->nr_gsis
                                      : level) )
diff --git a/xen/arch/x86/include/asm/hvm/irq.h b/xen/arch/x86/include/asm/hvm/irq.h
index 87e89993a4..77595fb3f4 100644
--- a/xen/arch/x86/include/asm/hvm/irq.h
+++ b/xen/arch/x86/include/asm/hvm/irq.h
@@ -134,7 +134,7 @@ struct hvm_girq_dpci_mapping {
     uint8_t machine_gsi;
 };
 
-#define NR_ISAIRQS  16
+#define NR_ISA_IRQS 16
 #define NR_LINK     4
 #define NR_HVM_DOMU_IRQS ARRAY_SIZE(((struct hvm_hw_vioapic *)NULL)->redirtbl)
 
@@ -143,7 +143,7 @@ struct hvm_irq_dpci {
     /* Guest IRQ to guest device/intx mapping. */
     struct list_head girq[NR_HVM_DOMU_IRQS];
     /* Record of mapped ISA IRQs */
-    DECLARE_BITMAP(isairq_map, NR_ISAIRQS);
+    DECLARE_BITMAP(isairq_map, NR_ISA_IRQS);
     /* Record of mapped Links */
     uint8_t link_cnt[NR_LINK];
 };
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 69fd42667c..4dfa1c0191 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -198,7 +198,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
             /* if this is a level irq and count > 0, send another
              * notification */ 
-            if ( gsi >= NR_ISAIRQS /* ISA irqs are edge triggered */
+            if ( gsi >= NR_ISA_IRQS /* ISA irqs are edge triggered */
                     && hvm_irq->gsi_assert_count[gsi] )
                 send_guest_pirq(currd, pirq);
         }
diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index 47de6953fd..a2ca7e0e57 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -958,7 +958,7 @@ static void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq)
 {
     const struct hvm_irq_dpci *dpci = NULL;
 
-    ASSERT(isairq < NR_ISAIRQS);
+    ASSERT(isairq < NR_ISA_IRQS);
 
     if ( !is_iommu_enabled(d) )
         return;
@@ -991,7 +991,7 @@ void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi)
         goto unlock;
     }
 
-    if ( guest_gsi < NR_ISAIRQS )
+    if ( guest_gsi < NR_ISA_IRQS )
     {
         hvm_dpci_isairq_eoi(d, guest_gsi);
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 17:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 17:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917596.1322474 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuEVj-0000T4-Nb; Mon, 17 Mar 2025 17:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917596.1322474; Mon, 17 Mar 2025 17:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuEVj-0000Sv-KU; Mon, 17 Mar 2025 17:44:23 +0000
Received: by outflank-mailman (input) for mailman id 917596;
 Mon, 17 Mar 2025 17:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuEVi-0000Sl-FE
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 17:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuEVi-0090TQ-28
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 17:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuEVi-002nYh-1C
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 17:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XSocuzOIpxcxcRXG2O4uN3eRD/WLTnqnwpbEcLZBVS8=; b=jT4kuyy/gxDWvsye6MlL915Ro+
	4U6XnrQ0F2L2royvug3Ozamdoyg6jN1ypzOacQ7lPwglaSqneGD0z8WMr1htJgtdokXMEzKdJgCr4
	yzH/kodslnsZL2Yk6ks+WWdNYOKzH5esPeRbM9ocXojOW95KXxsKhPPKx9owfpBmGrZQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/irq: use NR_ISA_IRQS instead of open-coded value
Message-Id: <E1tuEVi-002nYh-1C@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 17:44:22 +0000

commit 3c0745196c84de21525b5889a680716884da7459
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Sat Mar 15 01:00:51 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 17 16:08:26 2025 +0000

    x86/irq: use NR_ISA_IRQS instead of open-coded value
    
    Replace the open-coded value 16 with the NR_ISA_IRQS symbol to enhance
    readability.
    
    No functional changes.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/dm.c          |  2 +-
 xen/arch/x86/hvm/irq.c         | 17 +++++++++--------
 xen/arch/x86/hvm/vpic.c        |  4 ++--
 xen/arch/x86/include/asm/irq.h |  2 +-
 xen/arch/x86/io_apic.c         | 12 ++++++------
 xen/arch/x86/irq.c             |  6 +++---
 6 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index a1f7a4d30a..3b53471af0 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -90,7 +90,7 @@ static int set_pci_intx_level(struct domain *d, uint16_t domain,
 static int set_isa_irq_level(struct domain *d, uint8_t isa_irq,
                              uint8_t level)
 {
-    if ( isa_irq > 15 )
+    if ( isa_irq >= NR_ISA_IRQS )
         return -EINVAL;
 
     switch ( level )
diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 1eab44defc..5f64361113 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -209,7 +209,7 @@ int hvm_isa_irq_assert(struct domain *d, unsigned int isa_irq,
     unsigned int gsi = hvm_isa_irq_to_gsi(isa_irq);
     int vector = -1;
 
-    ASSERT(isa_irq <= 15);
+    ASSERT(isa_irq < NR_ISA_IRQS);
 
     spin_lock(&d->arch.hvm.irq_lock);
 
@@ -231,7 +231,7 @@ void hvm_isa_irq_deassert(
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
     unsigned int gsi = hvm_isa_irq_to_gsi(isa_irq);
 
-    ASSERT(isa_irq <= 15);
+    ASSERT(isa_irq < NR_ISA_IRQS);
 
     spin_lock(&d->arch.hvm.irq_lock);
 
@@ -266,12 +266,12 @@ static void hvm_set_callback_irq_level(struct vcpu *v)
         if ( asserted && (hvm_irq->gsi_assert_count[gsi]++ == 0) )
         {
             vioapic_irq_positive_edge(d, gsi);
-            if ( gsi <= 15 )
+            if ( gsi < NR_ISA_IRQS )
                 vpic_irq_positive_edge(d, gsi);
         }
         else if ( !asserted && (--hvm_irq->gsi_assert_count[gsi] == 0) )
         {
-            if ( gsi <= 15 )
+            if ( gsi < NR_ISA_IRQS )
                 vpic_irq_negative_edge(d, gsi);
         }
         break;
@@ -328,7 +328,7 @@ int hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq)
     u8 old_isa_irq;
     int i;
 
-    if ( (link > 3) || (isa_irq > 15) )
+    if ( (link > 3) || (isa_irq >= NR_ISA_IRQS) )
         return -EINVAL;
 
     spin_lock(&d->arch.hvm.irq_lock);
@@ -440,7 +440,8 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)
         {
         case HVMIRQ_callback_gsi:
             gsi = hvm_irq->callback_via.gsi;
-            if ( (--hvm_irq->gsi_assert_count[gsi] == 0) && (gsi <= 15) )
+            if ( (--hvm_irq->gsi_assert_count[gsi] == 0) &&
+                 (gsi < NR_ISA_IRQS) )
                 vpic_irq_negative_edge(d, gsi);
             break;
         case HVMIRQ_callback_pci_intx:
@@ -464,7 +465,7 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)
                   (hvm_irq->gsi_assert_count[gsi]++ == 0) )
         {
             vioapic_irq_positive_edge(d, gsi);
-            if ( gsi <= 15 )
+            if ( gsi < NR_ISA_IRQS )
                 vpic_irq_positive_edge(d, gsi);
         }
         break;
@@ -764,7 +765,7 @@ static int cf_check irq_check_link(const struct domain *d,
             return -EINVAL;
 
     for ( link = 0; link < ARRAY_SIZE(pci_link->route); link++ )
-        if ( pci_link->route[link] > 15 )
+        if ( pci_link->route[link] >= NR_ISA_IRQS )
         {
             printk(XENLOG_G_ERR
                    "HVM restore: PCI-ISA link %u out of range (%u)\n",
diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index 6427b08086..22020322fb 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -523,7 +523,7 @@ void vpic_irq_positive_edge(struct domain *d, int irq)
     uint8_t mask = 1 << (irq & 7);
 
     ASSERT(has_vpic(d));
-    ASSERT(irq <= 15);
+    ASSERT(irq < NR_ISA_IRQS);
     ASSERT(vpic_is_locked(vpic));
 
     TRACE_TIME(TRC_HVM_EMUL_PIC_POSEDGE, irq);
@@ -541,7 +541,7 @@ void vpic_irq_negative_edge(struct domain *d, int irq)
     uint8_t mask = 1 << (irq & 7);
 
     ASSERT(has_vpic(d));
-    ASSERT(irq <= 15);
+    ASSERT(irq < NR_ISA_IRQS);
     ASSERT(vpic_is_locked(vpic));
 
     TRACE_TIME(TRC_HVM_EMUL_PIC_NEGEDGE, irq);
diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index f9ed5dc86c..3c73073b71 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -108,7 +108,7 @@ extern bool opt_noirqbalance;
 
 extern int opt_irq_vector_map;
 
-#define platform_legacy_irq(irq)	((irq) < 16)
+#define platform_legacy_irq(irq)	((irq) < NR_ISA_IRQS)
 
 void cf_check event_check_interrupt(void);
 void cf_check invalidate_interrupt(void);
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index c6cf944811..84bd87a5e4 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2715,15 +2715,15 @@ void __init ioapic_init(void)
                               " than \"nr_irqs=\"\n");
         max_gsi_irqs = nr_irqs;
     }
-    if ( max_gsi_irqs < 16 )
-        max_gsi_irqs = 16;
+    if ( max_gsi_irqs < NR_ISA_IRQS )
+        max_gsi_irqs = NR_ISA_IRQS;
 
     /* for PHYSDEVOP_pirq_eoi_gmfn guest assumptions */
     if ( max_gsi_irqs > PAGE_SIZE * 8 )
         max_gsi_irqs = PAGE_SIZE * 8;
 
-    if ( !smp_found_config || skip_ioapic_setup || nr_irqs_gsi < 16 )
-        nr_irqs_gsi = 16;
+    if ( !smp_found_config || skip_ioapic_setup || nr_irqs_gsi < NR_ISA_IRQS )
+        nr_irqs_gsi = NR_ISA_IRQS;
     else if ( nr_irqs_gsi > max_gsi_irqs )
     {
         printk(XENLOG_WARNING "Limiting to %u GSI IRQs (found %u)\n",
@@ -2736,8 +2736,8 @@ void __init ioapic_init(void)
                   max(0U + num_present_cpus() * NR_DYNAMIC_VECTORS,
                       8 * nr_irqs_gsi) :
                   nr_irqs_gsi;
-    else if ( nr_irqs < 16 )
-        nr_irqs = 16;
+    else if ( nr_irqs < NR_ISA_IRQS )
+        nr_irqs = NR_ISA_IRQS;
     printk(XENLOG_INFO "IRQ limits: %u GSI, %u MSI/MSI-X\n",
            nr_irqs_gsi, nr_irqs - nr_irqs_gsi);
 }
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index f35894577b..dd8d921f18 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -36,7 +36,7 @@
 bool __read_mostly opt_noirqbalance;
 boolean_param("noirqbalance", opt_noirqbalance);
 
-unsigned int __read_mostly nr_irqs_gsi = 16;
+unsigned int __read_mostly nr_irqs_gsi = NR_ISA_IRQS;
 unsigned int __read_mostly nr_irqs;
 integer_param("nr_irqs", nr_irqs);
 
@@ -1525,7 +1525,7 @@ void desc_guest_eoi(struct irq_desc *desc, struct pirq *pirq)
 int pirq_guest_unmask(struct domain *d)
 {
     unsigned int pirq = 0, n, i;
-    struct pirq *pirqs[16];
+    struct pirq *pirqs[NR_ISA_IRQS];
 
     do {
         n = radix_tree_gang_lookup(&d->pirq_tree, (void **)pirqs, pirq,
@@ -2113,7 +2113,7 @@ int get_free_pirq(struct domain *d, int type)
 
     if ( type == MAP_PIRQ_TYPE_GSI )
     {
-        for ( i = 16; i < nr_irqs_gsi; i++ )
+        for ( i = NR_ISA_IRQS; i < nr_irqs_gsi; i++ )
             if ( is_free_pirq(d, pirq_info(d, i)) )
             {
                 pirq_get_info(d, i);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 17:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 17:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917597.1322477 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuEVt-0000Vg-Oq; Mon, 17 Mar 2025 17:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917597.1322477; Mon, 17 Mar 2025 17:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuEVt-0000VY-Lu; Mon, 17 Mar 2025 17:44:33 +0000
Received: by outflank-mailman (input) for mailman id 917597;
 Mon, 17 Mar 2025 17:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuEVs-0000VQ-Iv
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 17:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuEVs-0090TW-2T
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 17:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuEVs-002nbc-1Y
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 17:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UrR49WOqWESLIz578rW73CAf6wAvvBVjaNSHWZ8OIEk=; b=w9Q6C86t+gsLVLNO9Ns1WG29PT
	abLB7cn0uE3tXPLSpAiqFhgczPZMsh2vLZi9Gfb7PZrhouM4bJ2o/lpVn8d0+/BDNozAroSi2J3Xy
	o50G5ZkqQoHZGZ8YKy3a/x5MxWpQOSEeGhRl6ua9nVkIhPPJ861hDdTcslYaa+Roo77Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/debug: Move activate_debugregs() into debug.c
Message-Id: <E1tuEVs-002nbc-1Y@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 17:44:32 +0000

commit 90ebf9905b2c3d3acb6d3539da09fb4a77dfdfb0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 3 15:19:49 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 17 16:08:34 2025 +0000

    x86/debug: Move activate_debugregs() into debug.c
    
    We have since gained a better location for it to live.
    
    Fix up the includes while doing so.  I don't recall why we had kernel.h but
    it's definitely stale now.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/debug.c | 35 ++++++++++++++++++++++++++++++++++-
 xen/arch/x86/traps.c | 32 --------------------------------
 2 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c
index e99e663ba5..71755dea6f 100644
--- a/xen/arch/x86/debug.c
+++ b/xen/arch/x86/debug.c
@@ -3,10 +3,11 @@
  * Copyright (C) 2023 XenServer.
  */
 #include <xen/bug.h>
-#include <xen/kernel.h>
+#include <xen/sched.h>
 
 #include <xen/lib/x86/cpu-policy.h>
 
+#include <asm/current.h>
 #include <asm/debugreg.h>
 
 /*
@@ -84,3 +85,35 @@ unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7)
 
     return dr7;
 }
+
+void activate_debugregs(const struct vcpu *curr)
+{
+    ASSERT(curr == current);
+
+    write_debugreg(0, curr->arch.dr[0]);
+    write_debugreg(1, curr->arch.dr[1]);
+    write_debugreg(2, curr->arch.dr[2]);
+    write_debugreg(3, curr->arch.dr[3]);
+    write_debugreg(6, curr->arch.dr6);
+
+    /*
+     * Avoid writing the subsequently getting replaced value when getting
+     * called from set_debugreg() below. Eventual future callers will need
+     * to take this into account.
+     */
+    if ( curr->arch.dr7 & DR7_ACTIVE_MASK )
+        write_debugreg(7, curr->arch.dr7);
+
+    /*
+     * Both the PV and HVM paths leave stale DR_MASK values in hardware on
+     * context-switch-out.  If we're activating %dr7 for the guest, we must
+     * sync the DR_MASKs too, whether or not the guest can see them.
+     */
+    if ( boot_cpu_has(X86_FEATURE_DBEXT) )
+    {
+        wrmsrl(MSR_AMD64_DR0_ADDRESS_MASK, curr->arch.msrs->dr_mask[0]);
+        wrmsrl(MSR_AMD64_DR1_ADDRESS_MASK, curr->arch.msrs->dr_mask[1]);
+        wrmsrl(MSR_AMD64_DR2_ADDRESS_MASK, curr->arch.msrs->dr_mask[2]);
+        wrmsrl(MSR_AMD64_DR3_ADDRESS_MASK, curr->arch.msrs->dr_mask[3]);
+    }
+}
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 5addb1f903..df1155bfb6 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1942,38 +1942,6 @@ void __init trap_init(void)
     cpu_init();
 }
 
-void activate_debugregs(const struct vcpu *curr)
-{
-    ASSERT(curr == current);
-
-    write_debugreg(0, curr->arch.dr[0]);
-    write_debugreg(1, curr->arch.dr[1]);
-    write_debugreg(2, curr->arch.dr[2]);
-    write_debugreg(3, curr->arch.dr[3]);
-    write_debugreg(6, curr->arch.dr6);
-
-    /*
-     * Avoid writing the subsequently getting replaced value when getting
-     * called from set_debugreg() below. Eventual future callers will need
-     * to take this into account.
-     */
-    if ( curr->arch.dr7 & DR7_ACTIVE_MASK )
-        write_debugreg(7, curr->arch.dr7);
-
-    /*
-     * Both the PV and HVM paths leave stale DR_MASK values in hardware on
-     * context-switch-out.  If we're activating %dr7 for the guest, we must
-     * sync the DR_MASKs too, whether or not the guest can see them.
-     */
-    if ( boot_cpu_has(X86_FEATURE_DBEXT) )
-    {
-        wrmsrl(MSR_AMD64_DR0_ADDRESS_MASK, curr->arch.msrs->dr_mask[0]);
-        wrmsrl(MSR_AMD64_DR1_ADDRESS_MASK, curr->arch.msrs->dr_mask[1]);
-        wrmsrl(MSR_AMD64_DR2_ADDRESS_MASK, curr->arch.msrs->dr_mask[2]);
-        wrmsrl(MSR_AMD64_DR3_ADDRESS_MASK, curr->arch.msrs->dr_mask[3]);
-    }
-}
-
 void asm_domain_crash_synchronous(unsigned long addr)
 {
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 17:44:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 17:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917598.1322482 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuEW3-0000ZJ-R6; Mon, 17 Mar 2025 17:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917598.1322482; Mon, 17 Mar 2025 17:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuEW3-0000ZC-Ob; Mon, 17 Mar 2025 17:44:43 +0000
Received: by outflank-mailman (input) for mailman id 917598;
 Mon, 17 Mar 2025 17:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuEW2-0000Z3-LI
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 17:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuEW2-0090Te-2l
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 17:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuEW2-002ncc-1t
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 17:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZApuc2gmafzfz1COrmMBlg0LhY7X950PLbcfnlNJ8Nc=; b=3SxoPio4byaMhPAZZudP36EocK
	lWOIuZOgMADHzhNIl4tFc5BP+TxXaQdWtVACtbZHnmdPLWGqFMkTrGAkjdU4O02eQ61QXhL+9bo+U
	H6geH/nexmHapCj8BvYVImGNci2r9pEffK8de/jZjN2WwFkwQ4ZaHiMcjq4OTlcpIzmY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Fix zap_low_mappings() to map less of the trampoline
Message-Id: <E1tuEW2-002ncc-1t@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 17:44:42 +0000

commit 516e89a43bc67d86b83f539c97b7ffc6d6aa19d6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 31 16:52:39 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 17 16:08:34 2025 +0000

    x86/boot: Fix zap_low_mappings() to map less of the trampoline
    
    Regular data access into the trampoline is via the directmap.
    
    As now discussed quite extensively in asm/trampoline.h, the trampoline is
    arranged so that only the AP and S3 paths need an identity mapping, and that
    they fit within a single page.
    
    Right now, PFN_UP(trampoline_end - trampoline_start) is 2, causing more than
    expected of the trampoline to be mapped.  Cut it down just the single page it
    ought to be.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/mm.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 389d813ebe..d4e6a9c0a2 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -718,14 +718,16 @@ void __init zap_low_mappings(void)
 {
     BUG_ON(num_online_cpus() != 1);
 
-    /* Remove aliased mapping of first 1:1 PML4 entry. */
+    /* Stop using l?_bootmap[] mappings. */
     l4e_write(&idle_pg_table[0], l4e_empty());
     flush_local(FLUSH_TLB_GLOBAL);
 
-    /* Replace with mapping of the boot trampoline only. */
+    /*
+     * Insert an identity mapping of the AP/S3 part of the trampoline, which
+     * is arranged to fit in a single page.
+     */
     map_pages_to_xen(trampoline_phys, maddr_to_mfn(trampoline_phys),
-                     PFN_UP(trampoline_end - trampoline_start),
-                     __PAGE_HYPERVISOR_RX);
+                     1, __PAGE_HYPERVISOR_RX);
 }
 
 int setup_compat_arg_xlat(struct vcpu *v)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 17 17:44:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Mar 2025 17:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.917599.1322487 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuEWD-0000bZ-Sx; Mon, 17 Mar 2025 17:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 917599.1322487; Mon, 17 Mar 2025 17:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuEWD-0000bR-Q0; Mon, 17 Mar 2025 17:44:53 +0000
Received: by outflank-mailman (input) for mailman id 917599;
 Mon, 17 Mar 2025 17:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuEWC-0000bJ-OO
 for xen-changelog@lists.xenproject.org; Mon, 17 Mar 2025 17:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuEWC-0090U5-36
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 17:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuEWC-002nfC-2C
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Mar 2025 17:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=735c31mNCH0R4HuaN/8BqbS+ISQ1vcsCOyVX1ONHcNE=; b=ECLtQtfkodGzlXlgyyc5s/ia+C
	AidHsBwFA35F1zlSeML9AxzV6J5CGr7XLvY4x4WMIH8CeqYDoo2f+YLrhyBVSYdermoB79nvWFB7D
	DFb+gNxihtTT7rkvqr+tOurh1yEPk+cbYLgzWLxIltknCG9JQ0Mtke7g89G7lhJFy9AY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Use for_each_set_bit() in hvm_emulate_writeback()
Message-Id: <E1tuEWC-002nfC-2C@xenbits.xenproject.org>
Date: Mon, 17 Mar 2025 17:44:52 +0000

commit e7e0d485e993e97b1c816adcfc610e7c7258ce96
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jun 11 20:03:32 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 17 16:08:34 2025 +0000

    x86/hvm: Use for_each_set_bit() in hvm_emulate_writeback()
    
    ... which is more consise than the opencoded form, and more efficient when
    compiled.
    
    Furthermore, now that find_{first,next}_bit() are no longer in use, the
    seg_reg_{accessed,dirty} fields aren't forced to be unsigned long, although
    they do need to remain unsigned int because of __set_bit() elsewhere.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c             | 15 ++++-----------
 xen/arch/x86/include/asm/hvm/emulate.h |  4 ++--
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 1db14642b3..dbf6b5543a 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -3022,18 +3022,11 @@ void hvm_emulate_init_per_insn(
 void hvm_emulate_writeback(
     struct hvm_emulate_ctxt *hvmemul_ctxt)
 {
-    enum x86_segment seg;
-
-    seg = find_first_bit(&hvmemul_ctxt->seg_reg_dirty,
-                         ARRAY_SIZE(hvmemul_ctxt->seg_reg));
+    struct vcpu *curr = current;
+    unsigned int dirty = hvmemul_ctxt->seg_reg_dirty;
 
-    while ( seg < ARRAY_SIZE(hvmemul_ctxt->seg_reg) )
-    {
-        hvm_set_segment_register(current, seg, &hvmemul_ctxt->seg_reg[seg]);
-        seg = find_next_bit(&hvmemul_ctxt->seg_reg_dirty,
-                            ARRAY_SIZE(hvmemul_ctxt->seg_reg),
-                            seg+1);
-    }
+    for_each_set_bit ( seg, dirty )
+        hvm_set_segment_register(curr, seg, &hvmemul_ctxt->seg_reg[seg]);
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index d61eacfaa7..c7a2d2a5be 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -37,8 +37,8 @@ struct hvm_emulate_ctxt {
     unsigned int insn_buf_bytes;
 
     struct segment_register seg_reg[10];
-    unsigned long seg_reg_accessed;
-    unsigned long seg_reg_dirty;
+    unsigned int seg_reg_accessed;
+    unsigned int seg_reg_dirty;
 
     /*
      * MFNs behind temporary mappings in the write callback.  The length is
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 18 08:11:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Mar 2025 08:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.918581.1323213 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuS2R-0007d3-HP; Tue, 18 Mar 2025 08:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 918581.1323213; Tue, 18 Mar 2025 08:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuS2R-0007cv-Ei; Tue, 18 Mar 2025 08:11:03 +0000
Received: by outflank-mailman (input) for mailman id 918581;
 Tue, 18 Mar 2025 08:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuS2Q-0007cj-7Y
 for xen-changelog@lists.xenproject.org; Tue, 18 Mar 2025 08:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuS2Q-00AoGj-0J
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuS2P-004PPR-2d
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=D26Nc3uP47Po9LBKWCpkgCIy9695vLdutXbT2Ne7Nyw=; b=o5ou6NQ9pADBZXlhjsAX6Z+E0D
	AX8v1aFIrw9zu0vJ+Q6c1C5L3vjwP/xu1Lkivs3k+PnPPYrhM/+E2mk074QF4dd2zB9hyg/y71B8k
	smHs1ofbwmJJjY4bJWNwQZS4u7umKxGTRpTaE9xohFtcx1pEYaACC5B02gZFJeXNNmQw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: add HVM-specific Kconfig
Message-Id: <E1tuS2P-004PPR-2d@xenbits.xenproject.org>
Date: Tue, 18 Mar 2025 08:11:01 +0000

commit e3ed540f2e9fa2261b8293ee85fd22aae93cbfca
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Sat Mar 15 01:19:49 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 17 15:01:25 2025 +0000

    x86/hvm: add HVM-specific Kconfig
    
    Add a separate menu for configuring HVM build-time settings to better
    organize HVM-specific options.
    
    HVM options will now appear in a dedicated sub-menu in the menuconfig
    tool.
    
    Also, make AMD_SVM config dependent on AMD config and INTEL_VMX on INTEL
    respectively.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/Kconfig     | 75 +-----------------------------------------------
 xen/arch/x86/hvm/Kconfig | 73 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+), 74 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index f086799594..18efdb2e31 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -107,42 +107,7 @@ config PV_LINEAR_PT
 
          If unsure, say Y.
 
-config HVM
-	bool "HVM support"
-	depends on !PV_SHIM_EXCLUSIVE
-	default !PV_SHIM
-	select COMPAT
-	select IOREQ_SERVER
-	select MEM_ACCESS_ALWAYS_ON
-	help
-	  Interfaces to support HVM domains.  HVM domains require hardware
-	  virtualisation extensions (e.g. Intel VT-x, AMD SVM), but can boot
-	  guests which have no specific Xen knowledge.
-
-	  This option is needed if you want to run HVM or PVH domains.
-
-	  If unsure, say Y.
-
-config AMD_SVM
-	bool "AMD-V" if EXPERT
-	depends on HVM
-	default y
-	help
-	  Enables virtual machine extensions on platforms that implement the
-	  AMD Virtualization Technology (AMD-V).
-	  If your system includes a processor with AMD-V support, say Y.
-	  If in doubt, say Y.
-
-config INTEL_VMX
-	bool "Intel VT-x" if EXPERT
-	depends on HVM
-	default y
-	select ARCH_VCPU_IOREQ_COMPLETION
-	help
-	  Enables virtual machine extensions on platforms that implement the
-	  Intel Virtualization Technology (Intel VT-x).
-	  If your system includes a processor with Intel VT-x support, say Y.
-	  If in doubt, say Y.
+source "arch/x86/hvm/Kconfig"
 
 config XEN_SHSTK
 	bool "Supervisor Shadow Stacks"
@@ -201,25 +166,6 @@ config BIGMEM
 
 	  If unsure, say N.
 
-config HVM_FEP
-	bool "HVM Forced Emulation Prefix support (UNSUPPORTED)" if UNSUPPORTED
-	default DEBUG
-	depends on HVM
-	help
-
-	  Compiles in a feature that allows HVM guest to arbitrarily
-	  exercise the instruction emulator.
-
-	  This feature can only be enabled during boot time with
-	  appropriate hypervisor command line option. Please read
-	  hypervisor command line documentation before trying to use
-	  this feature.
-
-	  This is strictly for testing purposes, and not appropriate
-	  for use in production.
-
-	  If unsure, say N.
-
 config TBOOT
 	bool "Xen tboot support (UNSUPPORTED)"
 	depends on INTEL && UNSUPPORTED
@@ -348,14 +294,6 @@ config HYPERV_GUEST
 
 endif
 
-config MEM_PAGING
-	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
-	depends on HVM && VM_EVENT
-
-config MEM_SHARING
-	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
-	depends on HVM
-
 config REQUIRE_NX
 	bool "Require NX (No eXecute) support"
 	help
@@ -372,17 +310,6 @@ config REQUIRE_NX
 	  was unavailable. However, if enabled, Xen will no longer boot on
 	  any CPU which is lacking NX support.
 
-config ALTP2M
-	bool "Alternate P2M support" if EXPERT
-	depends on INTEL_VMX
-	default y
-	help
-	  Alternate-p2m allows a guest to manage multiple p2m guest physical
-	  "memory views" (as opposed to a single p2m).
-	  Useful for memory introspection.
-
-	  If unsure, stay with defaults.
-
 config UCODE_SCAN_DEFAULT
 	bool "Scan for microcode by default"
 	help
diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
new file mode 100644
index 0000000000..2def0f98e2
--- /dev/null
+++ b/xen/arch/x86/hvm/Kconfig
@@ -0,0 +1,73 @@
+menuconfig HVM
+	bool "HVM support"
+	depends on !PV_SHIM_EXCLUSIVE
+	default !PV_SHIM
+	select COMPAT
+	select IOREQ_SERVER
+	select MEM_ACCESS_ALWAYS_ON
+	help
+	  Interfaces to support HVM domains.  HVM domains require hardware
+	  virtualisation extensions (e.g. Intel VT-x, AMD SVM), but can boot
+	  guests which have no specific Xen knowledge.
+
+	  This option is needed if you want to run HVM or PVH domains.
+
+	  If unsure, say Y.
+
+if HVM
+
+config AMD_SVM
+	bool "AMD-V" if AMD && EXPERT
+	default y
+	help
+	  Enables virtual machine extensions on platforms that implement the
+	  AMD Virtualization Technology (AMD-V).
+	  If your system includes a processor with AMD-V support, say Y.
+	  If in doubt, say Y.
+
+config INTEL_VMX
+	bool "Intel VT-x" if INTEL && EXPERT
+	default y
+	select ARCH_VCPU_IOREQ_COMPLETION
+	help
+	  Enables virtual machine extensions on platforms that implement the
+	  Intel Virtualization Technology (Intel VT-x).
+	  If your system includes a processor with Intel VT-x support, say Y.
+	  If in doubt, say Y.
+
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support (UNSUPPORTED)" if UNSUPPORTED
+	default DEBUG
+	help
+	  Compiles in a feature that allows HVM guest to arbitrarily
+	  exercise the instruction emulator.
+
+	  This feature can only be enabled during boot time with
+	  appropriate hypervisor command line option. Please read
+	  hypervisor command line documentation before trying to use
+	  this feature.
+
+	  This is strictly for testing purposes, and not appropriate
+	  for use in production.
+
+	  If unsure, say N.
+
+config ALTP2M
+	bool "Alternate P2M support" if EXPERT
+	depends on INTEL_VMX
+	default y
+	help
+	  Alternate-p2m allows a guest to manage multiple p2m guest physical
+	  "memory views" (as opposed to a single p2m).
+	  Useful for memory introspection.
+
+	  If unsure, stay with defaults.
+
+config MEM_PAGING
+	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
+	depends on VM_EVENT
+
+config MEM_SHARING
+	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
+
+endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 18 08:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Mar 2025 08:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.918582.1323218 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuS2b-0007r9-Ik; Tue, 18 Mar 2025 08:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 918582.1323218; Tue, 18 Mar 2025 08:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuS2b-0007r1-G9; Tue, 18 Mar 2025 08:11:13 +0000
Received: by outflank-mailman (input) for mailman id 918582;
 Tue, 18 Mar 2025 08:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuS2a-0007qr-0T
 for xen-changelog@lists.xenproject.org; Tue, 18 Mar 2025 08:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuS2a-00AoGx-0h
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuS2Z-004PPp-30
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ssZISOffw0APgB/K6ltXGk63BUpfGKdWwL/0cGItdHY=; b=zufDGUAo0q15ozojJJpxcbysQs
	WZ2Je4T11hrNU3Wd9xMtErVA611Z6YfwGjJ56nEAOVLXbP5sMAqGG9huITtJJIfL22rEuE/cyZ0kE
	QiNWIkRvuIbPKCEaf1LVi7cpTP7lL/TuLY41Y3WSW61wVl/iVD4Bl7KDl2XBO/kP7/eg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/irq: rename NR_ISAIRQS to NR_ISA_IRQS
Message-Id: <E1tuS2Z-004PPp-30@xenbits.xenproject.org>
Date: Tue, 18 Mar 2025 08:11:11 +0000

commit 29975e126d471e7dd9aba47c7d2e1a2bd23ee5a4
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Sat Mar 15 01:00:47 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 17 16:08:25 2025 +0000

    x86/irq: rename NR_ISAIRQS to NR_ISA_IRQS
    
    Rename NR_ISAIRQS to NR_ISA_IRQS to enhance readability.
    
    No functional changes.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c             | 4 ++--
 xen/arch/x86/hvm/vpt.c             | 2 +-
 xen/arch/x86/include/asm/hvm/irq.h | 4 ++--
 xen/arch/x86/physdev.c             | 2 +-
 xen/drivers/passthrough/x86/hvm.c  | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 2f31180b6f..5950f3160f 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -633,8 +633,8 @@ int hvm_domain_initialise(struct domain *d,
     /* Set the number of GSIs */
     hvm_domain_irq(d)->nr_gsis = nr_gsis;
 
-    BUILD_BUG_ON(NR_HVM_DOMU_IRQS < NR_ISAIRQS);
-    ASSERT(hvm_domain_irq(d)->nr_gsis >= NR_ISAIRQS);
+    BUILD_BUG_ON(NR_HVM_DOMU_IRQS < NR_ISA_IRQS);
+    ASSERT(hvm_domain_irq(d)->nr_gsis >= NR_ISA_IRQS);
 
     /* need link to containing domain */
     d->arch.hvm.pl_time->domain = d;
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 5e7b9a9f66..4d86830644 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -491,7 +491,7 @@ void create_periodic_time(
     uint64_t period, uint8_t irq, time_cb *cb, void *data, bool level)
 {
     if ( !pt->source ||
-         (irq >= NR_ISAIRQS && pt->source == PTSRC_isa) ||
+         (irq >= NR_ISA_IRQS && pt->source == PTSRC_isa) ||
          (level && period) ||
          (pt->source == PTSRC_ioapic ? irq >= hvm_domain_irq(v->domain)->nr_gsis
                                      : level) )
diff --git a/xen/arch/x86/include/asm/hvm/irq.h b/xen/arch/x86/include/asm/hvm/irq.h
index 87e89993a4..77595fb3f4 100644
--- a/xen/arch/x86/include/asm/hvm/irq.h
+++ b/xen/arch/x86/include/asm/hvm/irq.h
@@ -134,7 +134,7 @@ struct hvm_girq_dpci_mapping {
     uint8_t machine_gsi;
 };
 
-#define NR_ISAIRQS  16
+#define NR_ISA_IRQS 16
 #define NR_LINK     4
 #define NR_HVM_DOMU_IRQS ARRAY_SIZE(((struct hvm_hw_vioapic *)NULL)->redirtbl)
 
@@ -143,7 +143,7 @@ struct hvm_irq_dpci {
     /* Guest IRQ to guest device/intx mapping. */
     struct list_head girq[NR_HVM_DOMU_IRQS];
     /* Record of mapped ISA IRQs */
-    DECLARE_BITMAP(isairq_map, NR_ISAIRQS);
+    DECLARE_BITMAP(isairq_map, NR_ISA_IRQS);
     /* Record of mapped Links */
     uint8_t link_cnt[NR_LINK];
 };
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 69fd42667c..4dfa1c0191 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -198,7 +198,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
             /* if this is a level irq and count > 0, send another
              * notification */ 
-            if ( gsi >= NR_ISAIRQS /* ISA irqs are edge triggered */
+            if ( gsi >= NR_ISA_IRQS /* ISA irqs are edge triggered */
                     && hvm_irq->gsi_assert_count[gsi] )
                 send_guest_pirq(currd, pirq);
         }
diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index 47de6953fd..a2ca7e0e57 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -958,7 +958,7 @@ static void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq)
 {
     const struct hvm_irq_dpci *dpci = NULL;
 
-    ASSERT(isairq < NR_ISAIRQS);
+    ASSERT(isairq < NR_ISA_IRQS);
 
     if ( !is_iommu_enabled(d) )
         return;
@@ -991,7 +991,7 @@ void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi)
         goto unlock;
     }
 
-    if ( guest_gsi < NR_ISAIRQS )
+    if ( guest_gsi < NR_ISA_IRQS )
     {
         hvm_dpci_isairq_eoi(d, guest_gsi);
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 18 08:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Mar 2025 08:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.918583.1323223 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuS2l-0007tn-Kn; Tue, 18 Mar 2025 08:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 918583.1323223; Tue, 18 Mar 2025 08:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuS2l-0007tf-HY; Tue, 18 Mar 2025 08:11:23 +0000
Received: by outflank-mailman (input) for mailman id 918583;
 Tue, 18 Mar 2025 08:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuS2k-0007tL-3g
 for xen-changelog@lists.xenproject.org; Tue, 18 Mar 2025 08:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuS2k-00AoH1-12
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuS2k-004PQB-0A
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=i6Zonzmlt5H0c3ewsegbEj7AVFukCzwyk0zAJYf2AnE=; b=Qd4cUsUpCS6fI/f80Gc/LJeapi
	JxTe6hm8wkCsTZtVuqYPtTpe1nwfVKm2WI8Ahecv+jNjSG9zy+6cVFqiuEH3269Lk3VpROGFXMnvN
	kVaq1S1wjhb3PiCsMdaI8B10nLNI73CsQ7narrvZvQqDGZi+LtInPDJcanAe4+QiHlmY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/irq: use NR_ISA_IRQS instead of open-coded value
Message-Id: <E1tuS2k-004PQB-0A@xenbits.xenproject.org>
Date: Tue, 18 Mar 2025 08:11:22 +0000

commit 3c0745196c84de21525b5889a680716884da7459
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Sat Mar 15 01:00:51 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 17 16:08:26 2025 +0000

    x86/irq: use NR_ISA_IRQS instead of open-coded value
    
    Replace the open-coded value 16 with the NR_ISA_IRQS symbol to enhance
    readability.
    
    No functional changes.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/dm.c          |  2 +-
 xen/arch/x86/hvm/irq.c         | 17 +++++++++--------
 xen/arch/x86/hvm/vpic.c        |  4 ++--
 xen/arch/x86/include/asm/irq.h |  2 +-
 xen/arch/x86/io_apic.c         | 12 ++++++------
 xen/arch/x86/irq.c             |  6 +++---
 6 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index a1f7a4d30a..3b53471af0 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -90,7 +90,7 @@ static int set_pci_intx_level(struct domain *d, uint16_t domain,
 static int set_isa_irq_level(struct domain *d, uint8_t isa_irq,
                              uint8_t level)
 {
-    if ( isa_irq > 15 )
+    if ( isa_irq >= NR_ISA_IRQS )
         return -EINVAL;
 
     switch ( level )
diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 1eab44defc..5f64361113 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -209,7 +209,7 @@ int hvm_isa_irq_assert(struct domain *d, unsigned int isa_irq,
     unsigned int gsi = hvm_isa_irq_to_gsi(isa_irq);
     int vector = -1;
 
-    ASSERT(isa_irq <= 15);
+    ASSERT(isa_irq < NR_ISA_IRQS);
 
     spin_lock(&d->arch.hvm.irq_lock);
 
@@ -231,7 +231,7 @@ void hvm_isa_irq_deassert(
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
     unsigned int gsi = hvm_isa_irq_to_gsi(isa_irq);
 
-    ASSERT(isa_irq <= 15);
+    ASSERT(isa_irq < NR_ISA_IRQS);
 
     spin_lock(&d->arch.hvm.irq_lock);
 
@@ -266,12 +266,12 @@ static void hvm_set_callback_irq_level(struct vcpu *v)
         if ( asserted && (hvm_irq->gsi_assert_count[gsi]++ == 0) )
         {
             vioapic_irq_positive_edge(d, gsi);
-            if ( gsi <= 15 )
+            if ( gsi < NR_ISA_IRQS )
                 vpic_irq_positive_edge(d, gsi);
         }
         else if ( !asserted && (--hvm_irq->gsi_assert_count[gsi] == 0) )
         {
-            if ( gsi <= 15 )
+            if ( gsi < NR_ISA_IRQS )
                 vpic_irq_negative_edge(d, gsi);
         }
         break;
@@ -328,7 +328,7 @@ int hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq)
     u8 old_isa_irq;
     int i;
 
-    if ( (link > 3) || (isa_irq > 15) )
+    if ( (link > 3) || (isa_irq >= NR_ISA_IRQS) )
         return -EINVAL;
 
     spin_lock(&d->arch.hvm.irq_lock);
@@ -440,7 +440,8 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)
         {
         case HVMIRQ_callback_gsi:
             gsi = hvm_irq->callback_via.gsi;
-            if ( (--hvm_irq->gsi_assert_count[gsi] == 0) && (gsi <= 15) )
+            if ( (--hvm_irq->gsi_assert_count[gsi] == 0) &&
+                 (gsi < NR_ISA_IRQS) )
                 vpic_irq_negative_edge(d, gsi);
             break;
         case HVMIRQ_callback_pci_intx:
@@ -464,7 +465,7 @@ void hvm_set_callback_via(struct domain *d, uint64_t via)
                   (hvm_irq->gsi_assert_count[gsi]++ == 0) )
         {
             vioapic_irq_positive_edge(d, gsi);
-            if ( gsi <= 15 )
+            if ( gsi < NR_ISA_IRQS )
                 vpic_irq_positive_edge(d, gsi);
         }
         break;
@@ -764,7 +765,7 @@ static int cf_check irq_check_link(const struct domain *d,
             return -EINVAL;
 
     for ( link = 0; link < ARRAY_SIZE(pci_link->route); link++ )
-        if ( pci_link->route[link] > 15 )
+        if ( pci_link->route[link] >= NR_ISA_IRQS )
         {
             printk(XENLOG_G_ERR
                    "HVM restore: PCI-ISA link %u out of range (%u)\n",
diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index 6427b08086..22020322fb 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -523,7 +523,7 @@ void vpic_irq_positive_edge(struct domain *d, int irq)
     uint8_t mask = 1 << (irq & 7);
 
     ASSERT(has_vpic(d));
-    ASSERT(irq <= 15);
+    ASSERT(irq < NR_ISA_IRQS);
     ASSERT(vpic_is_locked(vpic));
 
     TRACE_TIME(TRC_HVM_EMUL_PIC_POSEDGE, irq);
@@ -541,7 +541,7 @@ void vpic_irq_negative_edge(struct domain *d, int irq)
     uint8_t mask = 1 << (irq & 7);
 
     ASSERT(has_vpic(d));
-    ASSERT(irq <= 15);
+    ASSERT(irq < NR_ISA_IRQS);
     ASSERT(vpic_is_locked(vpic));
 
     TRACE_TIME(TRC_HVM_EMUL_PIC_NEGEDGE, irq);
diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index f9ed5dc86c..3c73073b71 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -108,7 +108,7 @@ extern bool opt_noirqbalance;
 
 extern int opt_irq_vector_map;
 
-#define platform_legacy_irq(irq)	((irq) < 16)
+#define platform_legacy_irq(irq)	((irq) < NR_ISA_IRQS)
 
 void cf_check event_check_interrupt(void);
 void cf_check invalidate_interrupt(void);
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index c6cf944811..84bd87a5e4 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2715,15 +2715,15 @@ void __init ioapic_init(void)
                               " than \"nr_irqs=\"\n");
         max_gsi_irqs = nr_irqs;
     }
-    if ( max_gsi_irqs < 16 )
-        max_gsi_irqs = 16;
+    if ( max_gsi_irqs < NR_ISA_IRQS )
+        max_gsi_irqs = NR_ISA_IRQS;
 
     /* for PHYSDEVOP_pirq_eoi_gmfn guest assumptions */
     if ( max_gsi_irqs > PAGE_SIZE * 8 )
         max_gsi_irqs = PAGE_SIZE * 8;
 
-    if ( !smp_found_config || skip_ioapic_setup || nr_irqs_gsi < 16 )
-        nr_irqs_gsi = 16;
+    if ( !smp_found_config || skip_ioapic_setup || nr_irqs_gsi < NR_ISA_IRQS )
+        nr_irqs_gsi = NR_ISA_IRQS;
     else if ( nr_irqs_gsi > max_gsi_irqs )
     {
         printk(XENLOG_WARNING "Limiting to %u GSI IRQs (found %u)\n",
@@ -2736,8 +2736,8 @@ void __init ioapic_init(void)
                   max(0U + num_present_cpus() * NR_DYNAMIC_VECTORS,
                       8 * nr_irqs_gsi) :
                   nr_irqs_gsi;
-    else if ( nr_irqs < 16 )
-        nr_irqs = 16;
+    else if ( nr_irqs < NR_ISA_IRQS )
+        nr_irqs = NR_ISA_IRQS;
     printk(XENLOG_INFO "IRQ limits: %u GSI, %u MSI/MSI-X\n",
            nr_irqs_gsi, nr_irqs - nr_irqs_gsi);
 }
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index f35894577b..dd8d921f18 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -36,7 +36,7 @@
 bool __read_mostly opt_noirqbalance;
 boolean_param("noirqbalance", opt_noirqbalance);
 
-unsigned int __read_mostly nr_irqs_gsi = 16;
+unsigned int __read_mostly nr_irqs_gsi = NR_ISA_IRQS;
 unsigned int __read_mostly nr_irqs;
 integer_param("nr_irqs", nr_irqs);
 
@@ -1525,7 +1525,7 @@ void desc_guest_eoi(struct irq_desc *desc, struct pirq *pirq)
 int pirq_guest_unmask(struct domain *d)
 {
     unsigned int pirq = 0, n, i;
-    struct pirq *pirqs[16];
+    struct pirq *pirqs[NR_ISA_IRQS];
 
     do {
         n = radix_tree_gang_lookup(&d->pirq_tree, (void **)pirqs, pirq,
@@ -2113,7 +2113,7 @@ int get_free_pirq(struct domain *d, int type)
 
     if ( type == MAP_PIRQ_TYPE_GSI )
     {
-        for ( i = 16; i < nr_irqs_gsi; i++ )
+        for ( i = NR_ISA_IRQS; i < nr_irqs_gsi; i++ )
             if ( is_free_pirq(d, pirq_info(d, i)) )
             {
                 pirq_get_info(d, i);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 18 08:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Mar 2025 08:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.918584.1323225 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuS2v-0007x5-NJ; Tue, 18 Mar 2025 08:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 918584.1323225; Tue, 18 Mar 2025 08:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuS2v-0007wx-Kp; Tue, 18 Mar 2025 08:11:33 +0000
Received: by outflank-mailman (input) for mailman id 918584;
 Tue, 18 Mar 2025 08:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuS2u-0007wf-6j
 for xen-changelog@lists.xenproject.org; Tue, 18 Mar 2025 08:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuS2u-00AoHA-1K
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuS2u-004PRJ-0R
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Vf3T30HzaLQU8WTe3nSCWQ1X/vvfIQjyh3hIJ6WMQxY=; b=fD99U7Vu8ACgiAhFdxavheE49y
	TBotr2s8eTuE29beuLJ3FFMWcj1hCh5ocXfNMbL6oHBAyGz2+54oMtCYQ3XyJBIxUcv29uFdspSm/
	PJMapi/Cm5zjvjkEQOGU+iiDz/7T6ztMeTuGxLzws+DwAXkT1/De24Ok9vqucPyE2i8k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/debug: Move activate_debugregs() into debug.c
Message-Id: <E1tuS2u-004PRJ-0R@xenbits.xenproject.org>
Date: Tue, 18 Mar 2025 08:11:32 +0000

commit 90ebf9905b2c3d3acb6d3539da09fb4a77dfdfb0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 3 15:19:49 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 17 16:08:34 2025 +0000

    x86/debug: Move activate_debugregs() into debug.c
    
    We have since gained a better location for it to live.
    
    Fix up the includes while doing so.  I don't recall why we had kernel.h but
    it's definitely stale now.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/debug.c | 35 ++++++++++++++++++++++++++++++++++-
 xen/arch/x86/traps.c | 32 --------------------------------
 2 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c
index e99e663ba5..71755dea6f 100644
--- a/xen/arch/x86/debug.c
+++ b/xen/arch/x86/debug.c
@@ -3,10 +3,11 @@
  * Copyright (C) 2023 XenServer.
  */
 #include <xen/bug.h>
-#include <xen/kernel.h>
+#include <xen/sched.h>
 
 #include <xen/lib/x86/cpu-policy.h>
 
+#include <asm/current.h>
 #include <asm/debugreg.h>
 
 /*
@@ -84,3 +85,35 @@ unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7)
 
     return dr7;
 }
+
+void activate_debugregs(const struct vcpu *curr)
+{
+    ASSERT(curr == current);
+
+    write_debugreg(0, curr->arch.dr[0]);
+    write_debugreg(1, curr->arch.dr[1]);
+    write_debugreg(2, curr->arch.dr[2]);
+    write_debugreg(3, curr->arch.dr[3]);
+    write_debugreg(6, curr->arch.dr6);
+
+    /*
+     * Avoid writing the subsequently getting replaced value when getting
+     * called from set_debugreg() below. Eventual future callers will need
+     * to take this into account.
+     */
+    if ( curr->arch.dr7 & DR7_ACTIVE_MASK )
+        write_debugreg(7, curr->arch.dr7);
+
+    /*
+     * Both the PV and HVM paths leave stale DR_MASK values in hardware on
+     * context-switch-out.  If we're activating %dr7 for the guest, we must
+     * sync the DR_MASKs too, whether or not the guest can see them.
+     */
+    if ( boot_cpu_has(X86_FEATURE_DBEXT) )
+    {
+        wrmsrl(MSR_AMD64_DR0_ADDRESS_MASK, curr->arch.msrs->dr_mask[0]);
+        wrmsrl(MSR_AMD64_DR1_ADDRESS_MASK, curr->arch.msrs->dr_mask[1]);
+        wrmsrl(MSR_AMD64_DR2_ADDRESS_MASK, curr->arch.msrs->dr_mask[2]);
+        wrmsrl(MSR_AMD64_DR3_ADDRESS_MASK, curr->arch.msrs->dr_mask[3]);
+    }
+}
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 5addb1f903..df1155bfb6 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1942,38 +1942,6 @@ void __init trap_init(void)
     cpu_init();
 }
 
-void activate_debugregs(const struct vcpu *curr)
-{
-    ASSERT(curr == current);
-
-    write_debugreg(0, curr->arch.dr[0]);
-    write_debugreg(1, curr->arch.dr[1]);
-    write_debugreg(2, curr->arch.dr[2]);
-    write_debugreg(3, curr->arch.dr[3]);
-    write_debugreg(6, curr->arch.dr6);
-
-    /*
-     * Avoid writing the subsequently getting replaced value when getting
-     * called from set_debugreg() below. Eventual future callers will need
-     * to take this into account.
-     */
-    if ( curr->arch.dr7 & DR7_ACTIVE_MASK )
-        write_debugreg(7, curr->arch.dr7);
-
-    /*
-     * Both the PV and HVM paths leave stale DR_MASK values in hardware on
-     * context-switch-out.  If we're activating %dr7 for the guest, we must
-     * sync the DR_MASKs too, whether or not the guest can see them.
-     */
-    if ( boot_cpu_has(X86_FEATURE_DBEXT) )
-    {
-        wrmsrl(MSR_AMD64_DR0_ADDRESS_MASK, curr->arch.msrs->dr_mask[0]);
-        wrmsrl(MSR_AMD64_DR1_ADDRESS_MASK, curr->arch.msrs->dr_mask[1]);
-        wrmsrl(MSR_AMD64_DR2_ADDRESS_MASK, curr->arch.msrs->dr_mask[2]);
-        wrmsrl(MSR_AMD64_DR3_ADDRESS_MASK, curr->arch.msrs->dr_mask[3]);
-    }
-}
-
 void asm_domain_crash_synchronous(unsigned long addr)
 {
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 18 08:11:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Mar 2025 08:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.918585.1323230 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuS35-0007zu-Oh; Tue, 18 Mar 2025 08:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 918585.1323230; Tue, 18 Mar 2025 08:11:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuS35-0007zm-MC; Tue, 18 Mar 2025 08:11:43 +0000
Received: by outflank-mailman (input) for mailman id 918585;
 Tue, 18 Mar 2025 08:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuS34-0007ze-9v
 for xen-changelog@lists.xenproject.org; Tue, 18 Mar 2025 08:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuS34-00AoHG-1e
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuS34-004PS7-0k
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AbvDevazLtUW5Zrg/PQyP7A6wC1Jg6TUvYCeKtUCbBw=; b=3mWDCCVVZaTC/A3nAC3APzCyjF
	fsOWsojYhFhKi2IW/Adzfru01LcjuwTSM11OhTv4kbUIMdDABSQsBykVde5+AIPnEh+/p+y9+4LLE
	l1Q98KU0p+7+f324iDumR0vxU+Tz9WL4ldxVCDi7oTrBkNNddN6n4PoAhNkZ1jOo+pGI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Fix zap_low_mappings() to map less of the trampoline
Message-Id: <E1tuS34-004PS7-0k@xenbits.xenproject.org>
Date: Tue, 18 Mar 2025 08:11:42 +0000

commit 516e89a43bc67d86b83f539c97b7ffc6d6aa19d6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 31 16:52:39 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 17 16:08:34 2025 +0000

    x86/boot: Fix zap_low_mappings() to map less of the trampoline
    
    Regular data access into the trampoline is via the directmap.
    
    As now discussed quite extensively in asm/trampoline.h, the trampoline is
    arranged so that only the AP and S3 paths need an identity mapping, and that
    they fit within a single page.
    
    Right now, PFN_UP(trampoline_end - trampoline_start) is 2, causing more than
    expected of the trampoline to be mapped.  Cut it down just the single page it
    ought to be.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/mm.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 389d813ebe..d4e6a9c0a2 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -718,14 +718,16 @@ void __init zap_low_mappings(void)
 {
     BUG_ON(num_online_cpus() != 1);
 
-    /* Remove aliased mapping of first 1:1 PML4 entry. */
+    /* Stop using l?_bootmap[] mappings. */
     l4e_write(&idle_pg_table[0], l4e_empty());
     flush_local(FLUSH_TLB_GLOBAL);
 
-    /* Replace with mapping of the boot trampoline only. */
+    /*
+     * Insert an identity mapping of the AP/S3 part of the trampoline, which
+     * is arranged to fit in a single page.
+     */
     map_pages_to_xen(trampoline_phys, maddr_to_mfn(trampoline_phys),
-                     PFN_UP(trampoline_end - trampoline_start),
-                     __PAGE_HYPERVISOR_RX);
+                     1, __PAGE_HYPERVISOR_RX);
 }
 
 int setup_compat_arg_xlat(struct vcpu *v)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 18 08:11:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Mar 2025 08:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.918586.1323233 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuS3F-00082E-QZ; Tue, 18 Mar 2025 08:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 918586.1323233; Tue, 18 Mar 2025 08:11:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuS3F-000824-Nf; Tue, 18 Mar 2025 08:11:53 +0000
Received: by outflank-mailman (input) for mailman id 918586;
 Tue, 18 Mar 2025 08:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuS3E-00081w-Ct
 for xen-changelog@lists.xenproject.org; Tue, 18 Mar 2025 08:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuS3E-00AoHK-1x
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuS3E-004PSd-15
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Aa00mi8RMpjVRbzcX6A5BuiSxiJXLrMxteBRwROTFwc=; b=U0+ucy2PavWOjBawLa9opBwPEh
	7O4ROImQDweh3u9r0IxBjDDd9KOE3o9HnniNCwKzw5BtdlAhQEaxBC/LoHGAzFcXgyMOBhFafvra+
	5yTiJ7YCsR4W5TkLoFsFDVZyJqhiEXqPp9FYjJmr7xEdYCdgq84k2CEt3YBHI/lvxheM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Use for_each_set_bit() in hvm_emulate_writeback()
Message-Id: <E1tuS3E-004PSd-15@xenbits.xenproject.org>
Date: Tue, 18 Mar 2025 08:11:52 +0000

commit e7e0d485e993e97b1c816adcfc610e7c7258ce96
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jun 11 20:03:32 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 17 16:08:34 2025 +0000

    x86/hvm: Use for_each_set_bit() in hvm_emulate_writeback()
    
    ... which is more consise than the opencoded form, and more efficient when
    compiled.
    
    Furthermore, now that find_{first,next}_bit() are no longer in use, the
    seg_reg_{accessed,dirty} fields aren't forced to be unsigned long, although
    they do need to remain unsigned int because of __set_bit() elsewhere.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c             | 15 ++++-----------
 xen/arch/x86/include/asm/hvm/emulate.h |  4 ++--
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 1db14642b3..dbf6b5543a 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -3022,18 +3022,11 @@ void hvm_emulate_init_per_insn(
 void hvm_emulate_writeback(
     struct hvm_emulate_ctxt *hvmemul_ctxt)
 {
-    enum x86_segment seg;
-
-    seg = find_first_bit(&hvmemul_ctxt->seg_reg_dirty,
-                         ARRAY_SIZE(hvmemul_ctxt->seg_reg));
+    struct vcpu *curr = current;
+    unsigned int dirty = hvmemul_ctxt->seg_reg_dirty;
 
-    while ( seg < ARRAY_SIZE(hvmemul_ctxt->seg_reg) )
-    {
-        hvm_set_segment_register(current, seg, &hvmemul_ctxt->seg_reg[seg]);
-        seg = find_next_bit(&hvmemul_ctxt->seg_reg_dirty,
-                            ARRAY_SIZE(hvmemul_ctxt->seg_reg),
-                            seg+1);
-    }
+    for_each_set_bit ( seg, dirty )
+        hvm_set_segment_register(curr, seg, &hvmemul_ctxt->seg_reg[seg]);
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index d61eacfaa7..c7a2d2a5be 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -37,8 +37,8 @@ struct hvm_emulate_ctxt {
     unsigned int insn_buf_bytes;
 
     struct segment_register seg_reg[10];
-    unsigned long seg_reg_accessed;
-    unsigned long seg_reg_dirty;
+    unsigned int seg_reg_accessed;
+    unsigned int seg_reg_dirty;
 
     /*
      * MFNs behind temporary mappings in the write callback.  The length is
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 18 08:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Mar 2025 08:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.918683.1323319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuSj1-0003bl-IK; Tue, 18 Mar 2025 08:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 918683.1323319; Tue, 18 Mar 2025 08:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuSj1-0003bc-F8; Tue, 18 Mar 2025 08:55:03 +0000
Received: by outflank-mailman (input) for mailman id 918683;
 Tue, 18 Mar 2025 08:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuSj0-0003bS-Hb
 for xen-changelog@lists.xenproject.org; Tue, 18 Mar 2025 08:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuSj0-00ApG8-2G
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuSj0-004UEP-1O
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ff1pK9tE9LKHj/LhQpAXbf/fGiR3Vi1QwVR1ATROtOU=; b=bENy1FZOZp/WCV+mrq2u17T2tG
	Zt3oTdYRIU6Fu0MZf7Im5lB8hDcMGmGx1HhQK7uDwqtqFy/uM2ILjsy2/GyZe9aNO9SVepEx0gG3Y
	K6V/uWA/WmxXDamwn1fSfymOYpHLvZiPNPONY8JA6Oe8wLD0Ghe3gRDAo1SG/+sMuKNk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Mark ACPI SDTs as NVS in the PVH build path
Message-Id: <E1tuSj0-004UEP-1O@xenbits.xenproject.org>
Date: Tue, 18 Mar 2025 08:55:02 +0000

commit d6dab805f1f8f233709b52d93fa879d6b91b5226
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Tue Mar 18 09:44:18 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 18 09:44:18 2025 +0100

    tools: Mark ACPI SDTs as NVS in the PVH build path
    
    Commit cefeffc7e583 marked ACPI tables as NVS in the hvmloader path
    because SeaBIOS may otherwise just mark it as RAM. There is, however,
    yet another reason to do it even in the PVH path. Xen's incarnation of
    AML relies on having access to some ACPI tables (e.g: _STA of Processor
    objects relies on reading the processor online bit in its MADT entry)
    
    This is problematic if the OS tries to reclaim ACPI memory for page
    tables as it's needed for runtime and can't be reclaimed after the OSPM
    is up and running.
    
    Fixes: de6d188a519f ("hvmloader: flip "ACPI data" to "ACPI NVS" type for ACPI table region)"
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/e820.c |  4 ++++
 tools/libs/light/libxl_x86.c    | 12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/tools/firmware/hvmloader/e820.c b/tools/firmware/hvmloader/e820.c
index c490a0bc79..86d39544e8 100644
--- a/tools/firmware/hvmloader/e820.c
+++ b/tools/firmware/hvmloader/e820.c
@@ -210,6 +210,10 @@ int build_e820_table(struct e820entry *e820,
      * space reuse by an ACPI unaware / buggy bootloader, option ROM, etc.
      * before an ACPI OS takes control. This is possible due to the fact that
      * ACPI NVS memory is explicitly described as non-reclaimable in ACPI spec.
+     *
+     * Furthermore, Xen relies on accessing ACPI tables from within the AML
+     * code exposed to guests. So Xen's ACPI tables are not, in general,
+     * reclaimable.
      */
 
     if ( acpi_enabled )
diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index 0a7f64ad46..0b1c2d3a96 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -737,12 +737,22 @@ static int domain_construct_memmap(libxl__gc *gc,
         nr++;
     }
 
+    /*
+     * Mark populated reserved memory that contains ACPI tables as ACPI NVS.
+     * That should help the guest to treat it correctly later: e.g. pass to
+     * the next kernel on kexec.
+     *
+     * Furthermore, Xen relies on accessing ACPI tables from within the AML
+     * code exposed to guests. So Xen's ACPI tables are not, in general,
+     * reclaimable.
+     */
+
     for (i = 0; i < MAX_ACPI_MODULES; i++) {
         if (dom->acpi_modules[i].length) {
             e820[nr].addr = dom->acpi_modules[i].guest_addr_out & ~(page_size - 1);
             e820[nr].size = dom->acpi_modules[i].length +
                 (dom->acpi_modules[i].guest_addr_out & (page_size - 1));
-            e820[nr].type = E820_ACPI;
+            e820[nr].type = E820_NVS;
             nr++;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 18 08:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Mar 2025 08:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.918684.1323322 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuSjB-0003e4-JM; Tue, 18 Mar 2025 08:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 918684.1323322; Tue, 18 Mar 2025 08:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuSjB-0003dw-GV; Tue, 18 Mar 2025 08:55:13 +0000
Received: by outflank-mailman (input) for mailman id 918684;
 Tue, 18 Mar 2025 08:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuSjA-0003dq-JV
 for xen-changelog@lists.xenproject.org; Tue, 18 Mar 2025 08:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuSjA-00ApGF-2c
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuSjA-004UGJ-1h
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/XCggRXq9+vZ26RjCzA5F/lfi0PQT+mCnLZWTIx4lFk=; b=N+QwJP/ePsjWB34idO2BWDp5PJ
	zb4PfWuLerf+R6v9vGfm2V5R6H4OkkTSlt3JMpEh+hjWcp/Q0Ih3nfZ/YA1yOsTo0eiuhyao/qB7/
	Wt7NlnG7iurKZ0rVlinWe1XsfXCZ/ruRacYy4n6p0m7DOVtEGd6PSUA+g02PM0lo9W9M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] symbols: don't over-align generated data
Message-Id: <E1tuSjA-004UGJ-1h@xenbits.xenproject.org>
Date: Tue, 18 Mar 2025 08:55:12 +0000

commit 559f1e20c278259f3a5101b18e06d3283195a44c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 18 09:44:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 18 09:44:57 2025 +0100

    symbols: don't over-align generated data
    
    x86 is one of the few architectures where .align has the same meaning as
    .balign; most other architectures (Arm, PPC, and RISC-V in particular)
    give it the same meaning as .p2align. Aligning every one of these item
    to 256 bytes (on all 64-bit architectures except x86-64) is clearly too
    much.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/tools/symbols.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index 67560605f2..dbf441c6ea 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -304,10 +304,10 @@ static void write_src(void)
 	printf("#include <xen/config.h>\n");
 	printf("#if BITS_PER_LONG == 64 && !defined(SYMBOLS_ORIGIN)\n");
 	printf("#define PTR .quad\n");
-	printf("#define ALGN .align 8\n");
+	printf("#define ALGN .balign 8\n");
 	printf("#else\n");
 	printf("#define PTR .long\n");
-	printf("#define ALGN .align 4\n");
+	printf("#define ALGN .balign 4\n");
 	printf("#endif\n");
 
 	printf("\t.section .rodata, \"a\"\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 18 08:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Mar 2025 08:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.918685.1323325 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuSjL-0003h8-Kk; Tue, 18 Mar 2025 08:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 918685.1323325; Tue, 18 Mar 2025 08:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuSjL-0003h0-Hy; Tue, 18 Mar 2025 08:55:23 +0000
Received: by outflank-mailman (input) for mailman id 918685;
 Tue, 18 Mar 2025 08:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuSjK-0003gr-MP
 for xen-changelog@lists.xenproject.org; Tue, 18 Mar 2025 08:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuSjK-00ApGV-2t
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuSjK-004UHN-21
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=17W0IbLETXfm9HWBDXXXnjrZp5qgUaW3sD6CRZRK9pI=; b=d1WVGTbiBLbqUMJ9wtfQ5+FuFh
	2kxe0OqS7sW3tgIGSCKZf+lYltBPFbPvmD9aSz+I1Q7SdiO6rD2DVE4v0i+e2nTV6iScTwG/gklM4
	BtGnTA6K741XuNgYzkbUObOzKk0wuBAkgK3RStG5l3Ek+j+r1KdS4uXe21Dhz4X/t9vA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] symbols: sanitize a few variable's types
Message-Id: <E1tuSjK-004UHN-21@xenbits.xenproject.org>
Date: Tue, 18 Mar 2025 08:55:22 +0000

commit 37a265b93ac20145b0ad0c47b0496f3561b26741
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 18 09:46:38 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 18 09:46:38 2025 +0100

    symbols: sanitize a few variable's types
    
    Parameter and return types of symbols_expand_symbol() make clear that
    xensyms_read()'s next_offset doesn't need to be 64-bit.
    
    xensyms_read()'s first parameter type makes clear that the function's
    next_symbols doesn't need to be 64-bit.
    
    symbols_num_syms'es type makes clear that iteration locals in
    symbols_lookup() don't need to be unsigned long (i.e. 64-bit on 64-bit
    architectures).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/symbols.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index 133b580768..f8a7bde37b 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -108,7 +108,7 @@ const char *symbols_lookup(unsigned long addr,
                            unsigned long *offset,
                            char *namebuf)
 {
-    unsigned long i, low, high, mid;
+    unsigned int i, low, high, mid;
     unsigned long symbol_end = 0;
     const struct virtual_region *region;
 
@@ -179,7 +179,7 @@ int xensyms_read(uint32_t *symnum, char *type,
      * from previous read. This can help us avoid the extra call to
      * get_symbol_offset().
      */
-    static uint64_t next_symbol, next_offset;
+    static unsigned int next_symbol, next_offset;
     static DEFINE_SPINLOCK(symbols_mutex);
 
     if ( *symnum > symbols_num_syms )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 18 08:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Mar 2025 08:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.918686.1323329 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuSjV-0003jd-M6; Tue, 18 Mar 2025 08:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 918686.1323329; Tue, 18 Mar 2025 08:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuSjV-0003jV-JQ; Tue, 18 Mar 2025 08:55:33 +0000
Received: by outflank-mailman (input) for mailman id 918686;
 Tue, 18 Mar 2025 08:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuSjU-0003jN-PS
 for xen-changelog@lists.xenproject.org; Tue, 18 Mar 2025 08:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuSjU-00ApGZ-3C
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuSjU-004UIf-2K
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lGjF85xdsgInWwHdat44Dj2flePUKnGceYuJcf7rOzY=; b=im9TzB1vpMnsH3Ti/uUrNFiZ84
	pxF3yu56HWjY+DjNyMZLElcdUxBnmWizfazUYORBhaFjkpduHtflqLg+izh/j00hQ7wyNaDICHNuU
	b7Cm7jsphw1Oh+gh5B1N3eP3xQDr4Gd1WGwPOYgsWjQaf9riKmVbU2rF2lve3iBU7VbI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: use unique_id to identify new domain with same domid
Message-Id: <E1tuSjU-004UIf-2K@xenbits.xenproject.org>
Date: Tue, 18 Mar 2025 08:55:32 +0000

commit c7b8d5e9df3743a08569725220dcde12afe80f3f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Mar 18 09:47:15 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 18 09:47:15 2025 +0100

    tools/xenstored: use unique_id to identify new domain with same domid
    
    Use the new unique_id of a domain in order to detect that a domain
    has been replaced with another one reusing the domain-id of the old
    domain.
    
    While changing the related code, switch from "dom_invalid" to
    "dom_valid" in order to avoid double negation and use "bool" as type
    for it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/xenstored/domain.c         | 65 ++++++++++++++++++++++++++++++++--------
 tools/xenstored/xenstore_state.h |  3 +-
 2 files changed, 55 insertions(+), 13 deletions(-)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index a6506a5bb2..fc0992d3a5 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -110,6 +110,7 @@ struct domain
 {
 	/* The id of this domain */
 	unsigned int domid;
+	uint64_t unique_id;
 
 	/* Event channel port */
 	evtchn_port_t port;
@@ -624,18 +625,26 @@ static int check_domain(const void *k, void *v, void *arg)
 {
 	unsigned int state;
 	struct connection *conn;
-	int dom_invalid;
+	bool dom_valid;
 	struct domain *domain = v;
 	bool *notify = arg;
+	uint64_t unique_id;
+
+	dom_valid = !xenmanage_get_domain_info(xm_handle, domain->domid,
+					       &state, &unique_id);
+	if (dom_valid) {
+		if (!domain->unique_id)
+			domain->unique_id = unique_id;
+		else if (domain->unique_id != unique_id)
+			dom_valid = false;
+	}
 
-	dom_invalid = xenmanage_get_domain_info(xm_handle, domain->domid,
-						&state, NULL);
 	if (!domain->introduced) {
-		if (dom_invalid)
+		if (!dom_valid)
 			talloc_free(domain);
 		return 0;
 	}
-	if (!dom_invalid) {
+	if (dom_valid) {
 		if ((state & XENMANAGE_GETDOMSTATE_STATE_SHUTDOWN)
 		    && !domain->shutdown) {
 			domain->shutdown = true;
@@ -747,7 +756,8 @@ int domain_max_global_acc(const void *ctx, struct connection *conn)
 	return 0;
 }
 
-static struct domain *alloc_domain(const void *context, unsigned int domid)
+static struct domain *alloc_domain(const void *context, unsigned int domid,
+				   uint64_t unique_id)
 {
 	struct domain *domain;
 
@@ -758,6 +768,7 @@ static struct domain *alloc_domain(const void *context, unsigned int domid)
 	}
 
 	domain->domid = domid;
+	domain->unique_id = unique_id;
 	domain->generation = generation;
 	domain->introduced = false;
 
@@ -777,16 +788,27 @@ static struct domain *find_or_alloc_domain(const void *ctx, unsigned int domid)
 	struct domain *domain;
 
 	domain = find_domain_struct(domid);
-	return domain ? : alloc_domain(ctx, domid);
+	/* If domain not already known, use unique_id = 0 meaning "unknown". */
+	return domain ? : alloc_domain(ctx, domid, 0);
 }
 
 static struct domain *find_or_alloc_existing_domain(unsigned int domid)
 {
 	struct domain *domain;
+	uint64_t unique_id = 0;
+	bool dom_valid = true;
 
 	domain = find_domain_struct(domid);
-	if (!domain && !xenmanage_get_domain_info(xm_handle, domid, NULL, NULL))
-		domain = alloc_domain(NULL, domid);
+	if (!domain || !domain->unique_id)
+		dom_valid = !xenmanage_get_domain_info(xm_handle, domid,
+						       NULL, &unique_id);
+
+	if (dom_valid) {
+		if (!domain)
+			domain = alloc_domain(NULL, domid, unique_id);
+		else if (unique_id)
+			domain->unique_id = unique_id;
+	}
 
 	return domain;
 }
@@ -1321,15 +1343,16 @@ int domain_alloc_permrefs(struct node_perms *perms)
 {
 	unsigned int i, domid;
 	struct domain *d;
+	uint64_t unique_id;
 
 	for (i = 0; i < perms->num; i++) {
 		domid = perms->p[i].id;
 		d = find_domain_struct(domid);
 		if (!d) {
 			if (xenmanage_get_domain_info(xm_handle, domid,
-						      NULL, NULL))
+						      NULL, &unique_id))
 				perms->p[i].perms |= XS_PERM_IGNORE;
-			else if (!alloc_domain(NULL, domid))
+			else if (!alloc_domain(NULL, domid, unique_id))
 				return ENOMEM;
 		}
 	}
@@ -1697,12 +1720,14 @@ const char *dump_state_connections(FILE *fp)
 	struct xs_state_record_header head;
 	struct connection *c;
 
+	BUILD_BUG_ON(sizeof(c->domain->unique_id) != sizeof(uint64_t));
+
 	list_for_each_entry(c, &connections, list) {
 		head.type = XS_STATE_TYPE_CONN;
 		head.length = sizeof(sc);
 
 		sc.conn_id = conn_id++;
-		sc.pad = 0;
+		sc.fields = 0;
 		memset(&sc.spec, 0, sizeof(sc.spec));
 		if (c->domain) {
 			sc.conn_type = XS_STATE_CONN_TYPE_RING;
@@ -1720,6 +1745,10 @@ const char *dump_state_connections(FILE *fp)
 			return ret;
 		head.length += sc.data_in_len + sc.data_out_len;
 		head.length = ROUNDUP(head.length, 3);
+		if (c->domain) {
+			sc.fields |= XS_STATE_CONN_FIELDS_UNIQ_ID;
+			head.length += sizeof(uint64_t);
+		}
 		if (fwrite(&head, sizeof(head), 1, fp) != 1)
 			return "Dump connection state error";
 		if (fwrite(&sc, offsetof(struct xs_state_connection, data),
@@ -1731,6 +1760,9 @@ const char *dump_state_connections(FILE *fp)
 		ret = dump_state_align(fp);
 		if (ret)
 			return ret;
+		if (c->domain &&
+		    fwrite(&c->domain->unique_id, sizeof(uint64_t), 1, fp) != 1)
+			return "Dump connection state error";
 
 		ret = dump_state_watches(fp, c, sc.conn_id);
 		if (ret)
@@ -1748,6 +1780,7 @@ void read_state_connection(const void *ctx, const void *state)
 
 	if (sc->conn_type == XS_STATE_CONN_TYPE_SOCKET) {
 		conn = add_socket_connection(sc->spec.socket_fd);
+		domain = NULL;
 	} else {
 		domain = introduce_domain(ctx, sc->spec.ring.domid,
 					  sc->spec.ring.evtchn, true);
@@ -1778,6 +1811,14 @@ void read_state_connection(const void *ctx, const void *state)
 	conn->conn_id = sc->conn_id;
 
 	read_state_buffered_data(ctx, conn, sc);
+
+	/* Validity of unique_id will be tested by check_domains() later. */
+	if ((sc->fields & XS_STATE_CONN_FIELDS_UNIQ_ID) && domain) {
+		unsigned long off;
+
+		off = sizeof(*sc) + sc->data_in_len + sc->data_out_len;
+		domain->unique_id = *(uint64_t *)(state + ROUNDUP(off, 3));
+	}
 }
 
 struct domain_acc {
diff --git a/tools/xenstored/xenstore_state.h b/tools/xenstored/xenstore_state.h
index ae0d053c8f..bad966caf4 100644
--- a/tools/xenstored/xenstore_state.h
+++ b/tools/xenstored/xenstore_state.h
@@ -74,7 +74,8 @@ struct xs_state_connection {
     uint16_t conn_type;
 #define XS_STATE_CONN_TYPE_RING   0
 #define XS_STATE_CONN_TYPE_SOCKET 1
-    uint16_t pad;
+    uint16_t fields;
+#define XS_STATE_CONN_FIELDS_UNIQ_ID 0x0001
     union {
         struct {
             uint16_t domid;  /* Domain-Id. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 18 08:55:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Mar 2025 08:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.918687.1323333 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuSjg-0003mz-Op; Tue, 18 Mar 2025 08:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 918687.1323333; Tue, 18 Mar 2025 08:55:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuSjg-0003mr-MF; Tue, 18 Mar 2025 08:55:44 +0000
Received: by outflank-mailman (input) for mailman id 918687;
 Tue, 18 Mar 2025 08:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuSje-0003md-SZ
 for xen-changelog@lists.xenproject.org; Tue, 18 Mar 2025 08:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuSjf-00ApGf-0I
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuSje-004UKN-2c
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Xe0BAO9KQsLZFFR1BZca+po85sKxdoLZcatoWr6FGKg=; b=H7Dho8DzQFHWhjgG8yCMVchQto
	6Q3SzShTtCywWRFhrGywqaVNo3mabHVefK/luIm5ljlNUZ72WqqnWc7f/O6EdX7Wmkc6wUXjimifI
	pNGh/eH13Hx8nnfLKnPoV3D32lkCLkLsqTwyZPH6giY7icm27NApSzM5vV07cqh+w/IE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: use xenmanage_poll_changed_domain()
Message-Id: <E1tuSje-004UKN-2c@xenbits.xenproject.org>
Date: Tue, 18 Mar 2025 08:55:42 +0000

commit 09d8a8236384be3f3bcb3ba62e31160c1aa014d5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Mar 18 09:47:45 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 18 09:47:45 2025 +0100

    tools/xenstored: use xenmanage_poll_changed_domain()
    
    Instead of checking each known domain after having received a
    VIRQ_DOM_EXC event, use the new xenmanage_poll_changed_domain()
    function for directly getting the domid of a domain having changed
    its state.
    
    A test doing "xl shutdown" of 1000 guests has shown to reduce the
    consumed cpu time of xenstored by 6% with this change applied.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/xenstored/domain.c | 64 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 46 insertions(+), 18 deletions(-)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index fc0992d3a5..e1d5e8d614 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -621,30 +621,24 @@ static int destroy_domain(void *_domain)
 	return 0;
 }
 
-static int check_domain(const void *k, void *v, void *arg)
+static int do_check_domain(struct domain *domain, bool *notify,
+			   unsigned int state, uint64_t unique_id)
 {
-	unsigned int state;
 	struct connection *conn;
-	bool dom_valid;
-	struct domain *domain = v;
-	bool *notify = arg;
-	uint64_t unique_id;
 
-	dom_valid = !xenmanage_get_domain_info(xm_handle, domain->domid,
-					       &state, &unique_id);
-	if (dom_valid) {
+	if (unique_id) {
 		if (!domain->unique_id)
 			domain->unique_id = unique_id;
 		else if (domain->unique_id != unique_id)
-			dom_valid = false;
+			unique_id = 0;
 	}
 
 	if (!domain->introduced) {
-		if (!dom_valid)
+		if (!unique_id)
 			talloc_free(domain);
 		return 0;
 	}
-	if (dom_valid) {
+	if (unique_id) {
 		if ((state & XENMANAGE_GETDOMSTATE_STATE_SHUTDOWN)
 		    && !domain->shutdown) {
 			domain->shutdown = true;
@@ -667,6 +661,21 @@ static int check_domain(const void *k, void *v, void *arg)
 	return 0;
 }
 
+static int check_domain(const void *k, void *v, void *arg)
+{
+	struct domain *domain = v;
+	unsigned int state;
+	uint64_t unique_id;
+
+	if (xenmanage_get_domain_info(xm_handle, domain->domid, &state,
+				      &unique_id)) {
+		unique_id = 0;
+		state = 0;
+	}
+
+	return do_check_domain(domain, arg, state, unique_id);
+}
+
 void check_domains(void)
 {
 	bool notify = false;
@@ -678,6 +687,30 @@ void check_domains(void)
 		fire_special_watches("@releaseDomain");
 }
 
+static struct domain *find_domain_struct(unsigned int domid)
+{
+	return hashtable_search(domhash, &domid);
+}
+
+static void do_check_domains(void)
+{
+	unsigned int domid;
+	unsigned int state;
+	uint64_t unique_id;
+	struct domain *domain;
+	bool notify = false;
+
+	while (!xenmanage_poll_changed_domain(xm_handle, &domid, &state,
+					      &unique_id)) {
+		domain = find_domain_struct(domid);
+		if (domain)
+			do_check_domain(domain, &notify, state, unique_id);
+	}
+
+	if (notify)
+		fire_special_watches("@releaseDomain");
+}
+
 /* We scan all domains rather than use the information given here. */
 void handle_event(void)
 {
@@ -687,7 +720,7 @@ void handle_event(void)
 		barf_perror("Failed to read from event fd");
 
 	if (port == virq_port)
-		check_domains();
+		do_check_domains();
 
 	if (xenevtchn_unmask(xce_handle, port) == -1)
 		barf_perror("Failed to write to event fd");
@@ -698,11 +731,6 @@ static char *talloc_domain_path(const void *context, unsigned int domid)
 	return talloc_asprintf(context, "/local/domain/%u", domid);
 }
 
-static struct domain *find_domain_struct(unsigned int domid)
-{
-	return hashtable_search(domhash, &domid);
-}
-
 int domain_get_quota(const void *ctx, struct connection *conn,
 		     unsigned int domid)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 18 08:55:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Mar 2025 08:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.918688.1323338 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuSjq-0003pY-QI; Tue, 18 Mar 2025 08:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 918688.1323338; Tue, 18 Mar 2025 08:55:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuSjq-0003pP-Ne; Tue, 18 Mar 2025 08:55:54 +0000
Received: by outflank-mailman (input) for mailman id 918688;
 Tue, 18 Mar 2025 08:55:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuSjo-0003p7-VM
 for xen-changelog@lists.xenproject.org; Tue, 18 Mar 2025 08:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuSjp-00ApGj-0Z
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuSjo-004UKl-2w
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Mar 2025 08:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IdLpNmgV80dfJ/VryZBSKdlIrABZpjYSAdB6Ga4R+yw=; b=Pe6ci/+nKy54zeh5GJC/7r5pLF
	kuhv6AwI2zxRQhqjtbz8GuKLJKGq1vkC7V3yYKEGuCa6EU8BFwgQdWuIGWChlBXua05pVEBhYTucZ
	vK1qgsfz139IKt8aUyQ4/xq0FUAU1fVnL07PDu6Grkz3AbXefQFAVnIWq3LIqtvTJcGs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Mention PCI passthrough for HVM domUs
Message-Id: <E1tuSjo-004UKl-2w@xenbits.xenproject.org>
Date: Tue, 18 Mar 2025 08:55:52 +0000

commit 77be740e8182fa6b31291a8ae983d253187e9b50
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Tue Mar 18 09:48:00 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 18 09:48:00 2025 +0100

    CHANGELOG.md: Mention PCI passthrough for HVM domUs
    
    PCI passthrough is already supported for HVM domUs when dom0 is PVH
    on x86. The last related patch on Qemu side was merged after Xen4.20
    release. So mention this feature in Xen4.21 entry.
    
    But SR-IOV is not yet supported on PVH dom0, add a note for it.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7201c484f8..9a5919585d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - On x86:
    - Option to attempt to fixup p2m page-faults on PVH dom0.
    - Resizable BARs is supported for PVH dom0.
+   - Support PCI passthrough for HVM domUs when dom0 is PVH (note SR-IOV
+     capability usage is not yet supported on PVH dom0).
 
 ### Removed
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 19 14:55:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Mar 2025 14:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.920853.1324896 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuuox-0002We-2a; Wed, 19 Mar 2025 14:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 920853.1324896; Wed, 19 Mar 2025 14:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuuox-0002WW-00; Wed, 19 Mar 2025 14:55:03 +0000
Received: by outflank-mailman (input) for mailman id 920853;
 Wed, 19 Mar 2025 14:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuuov-0002WQ-ON
 for xen-changelog@lists.xenproject.org; Wed, 19 Mar 2025 14:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuuov-00D0Hl-2Y
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 14:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuuov-007VSz-1Z
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 14:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/2YSRjDclouXvUreDEhlN6Wi3ratGvkVWzNQ2a5F4Sw=; b=tE+WyE83LAysAtRup85aBlm56F
	fQE97VOrQrwT85LuzYjPOM3JAMd8Ff4kf2EuY09FbuqltUhWsqwUfKmOWFdJBnyMt1dH3QkR3qccQ
	Np6N/QyTGXYTFlp9+myjHMBDpVnAzraseT5CVx2XHzjGgzxJrJBtdfZ2klhMIUyNls30=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
Message-Id: <E1tuuov-007VSz-1Z@xenbits.xenproject.org>
Date: Wed, 19 Mar 2025 14:55:01 +0000

commit b07c7d63f9b587e4df5d71f6da9eaa433512c974
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Mar 19 02:58:18 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 19 14:53:28 2025 +0000

    x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
    
    The current CI failures turn out to be a latent bug triggered by a narrow set
    of properties of the initrd and the host memory map, which CI encountered by
    chance.
    
    One step during boot involves constructing directmap mappings for modules.
    With some probing at the point of creation, it is observed that there's a 4k
    mapping missing towards the end of the initrd.
    
      (XEN) === Mapped Mod1 [0000000394001000, 00000003be1ff6dc] to Directmap
      (XEN) Probing paddr 394001000, va ffff830394001000
      (XEN) Probing paddr 3be1ff6db, va ffff8303be1ff6db
      (XEN) Probing paddr 3bdffffff, va ffff8303bdffffff
      (XEN) Probing paddr 3be001000, va ffff8303be001000
      (XEN) Probing paddr 3be000000, va ffff8303be000000
      (XEN) Early fatal page fault at e008:ffff82d04032014c (cr2=ffff8303be000000, ec=0000)
    
    The conditions for this bug appear to be map_pages_to_xen() call with a start
    address of exactly 4k beyond a 2M boundary, some number of full 2M pages, then
    a tail needing 4k pages.
    
    Anyway, the condition for spotting superpage boundaries in map_pages_to_xen()
    is wrong.  The IS_ALIGNED() macro expects a power of two for the alignment
    argument, and subtracts 1 itself.
    
    Fixing this causes the failing case to now boot.
    
    Fixes: 97fb6fcf26e8 ("x86/mm: introduce helpers to detect super page alignment")
    Debugged-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 03b8319f7a..b294497a14 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5505,7 +5505,7 @@ int map_pages_to_xen(
                                                                 \
     ASSERT(!mfn_eq(m_, INVALID_MFN));                           \
     IS_ALIGNED(PFN_DOWN(v) | mfn_x(m_),                         \
-               (1UL << (PAGETABLE_ORDER * ((n) - 1))) - 1);     \
+               1UL << (PAGETABLE_ORDER * ((n) - 1)));           \
 })
 #define IS_L2E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 2)
 #define IS_L3E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 3)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 19 16:22:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Mar 2025 16:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.920919.1324949 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwB8-0005GY-Oh; Wed, 19 Mar 2025 16:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 920919.1324949; Wed, 19 Mar 2025 16:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwB8-0005GN-LW; Wed, 19 Mar 2025 16:22:02 +0000
Received: by outflank-mailman (input) for mailman id 920919;
 Wed, 19 Mar 2025 16:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuwB8-0005GH-0Z
 for xen-changelog@lists.xenproject.org; Wed, 19 Mar 2025 16:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwB7-00D2n0-2w
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwB7-007czG-24
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pkgYEdatO1f/DWY8XBmMUnnP2lLWqFoelsbH05bMrPw=; b=O46KIAWL59kbxrsiB2RuoL0VJ0
	3WPJGay3GgVlxpGVMdipe3e0OnN271EeIIzsNxa21WXe8OJMiwnHWfNACjxsHK1rya0nW/oOALXqs
	TnZiFH+E3ZJA0TwfEsgbvKIXA3P1SMWN6dP8b+GXw6O93QWK64OiZw0wFVwEBOKY9Em0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Mark ACPI SDTs as NVS in the PVH build path
Message-Id: <E1tuwB7-007czG-24@xenbits.xenproject.org>
Date: Wed, 19 Mar 2025 16:22:01 +0000

commit d6dab805f1f8f233709b52d93fa879d6b91b5226
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Tue Mar 18 09:44:18 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 18 09:44:18 2025 +0100

    tools: Mark ACPI SDTs as NVS in the PVH build path
    
    Commit cefeffc7e583 marked ACPI tables as NVS in the hvmloader path
    because SeaBIOS may otherwise just mark it as RAM. There is, however,
    yet another reason to do it even in the PVH path. Xen's incarnation of
    AML relies on having access to some ACPI tables (e.g: _STA of Processor
    objects relies on reading the processor online bit in its MADT entry)
    
    This is problematic if the OS tries to reclaim ACPI memory for page
    tables as it's needed for runtime and can't be reclaimed after the OSPM
    is up and running.
    
    Fixes: de6d188a519f ("hvmloader: flip "ACPI data" to "ACPI NVS" type for ACPI table region)"
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/e820.c |  4 ++++
 tools/libs/light/libxl_x86.c    | 12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/tools/firmware/hvmloader/e820.c b/tools/firmware/hvmloader/e820.c
index c490a0bc79..86d39544e8 100644
--- a/tools/firmware/hvmloader/e820.c
+++ b/tools/firmware/hvmloader/e820.c
@@ -210,6 +210,10 @@ int build_e820_table(struct e820entry *e820,
      * space reuse by an ACPI unaware / buggy bootloader, option ROM, etc.
      * before an ACPI OS takes control. This is possible due to the fact that
      * ACPI NVS memory is explicitly described as non-reclaimable in ACPI spec.
+     *
+     * Furthermore, Xen relies on accessing ACPI tables from within the AML
+     * code exposed to guests. So Xen's ACPI tables are not, in general,
+     * reclaimable.
      */
 
     if ( acpi_enabled )
diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index 0a7f64ad46..0b1c2d3a96 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -737,12 +737,22 @@ static int domain_construct_memmap(libxl__gc *gc,
         nr++;
     }
 
+    /*
+     * Mark populated reserved memory that contains ACPI tables as ACPI NVS.
+     * That should help the guest to treat it correctly later: e.g. pass to
+     * the next kernel on kexec.
+     *
+     * Furthermore, Xen relies on accessing ACPI tables from within the AML
+     * code exposed to guests. So Xen's ACPI tables are not, in general,
+     * reclaimable.
+     */
+
     for (i = 0; i < MAX_ACPI_MODULES; i++) {
         if (dom->acpi_modules[i].length) {
             e820[nr].addr = dom->acpi_modules[i].guest_addr_out & ~(page_size - 1);
             e820[nr].size = dom->acpi_modules[i].length +
                 (dom->acpi_modules[i].guest_addr_out & (page_size - 1));
-            e820[nr].type = E820_ACPI;
+            e820[nr].type = E820_NVS;
             nr++;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 19 16:22:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Mar 2025 16:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.920920.1324952 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwBI-0005IO-PR; Wed, 19 Mar 2025 16:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 920920.1324952; Wed, 19 Mar 2025 16:22:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwBI-0005IG-Ms; Wed, 19 Mar 2025 16:22:12 +0000
Received: by outflank-mailman (input) for mailman id 920920;
 Wed, 19 Mar 2025 16:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuwBH-0005I4-QB
 for xen-changelog@lists.xenproject.org; Wed, 19 Mar 2025 16:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwBI-00D2n6-03
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwBH-007d16-2M
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4aCBrFpD1GjxEXkBatSyxheej9AeXmapzMJ678TKsx0=; b=nm/eCJLiwax8I4H2/zhTlcg88K
	lq2MzxIa2cquq+uZkbq4FO6ugSpZXY1mP8pHNJTQXcVGfT7X+qGeAL7VtOaL8Hy/dsgusnmLT02XN
	+rosTeqwO8GckE3buD0L4f5+PiHFnYAlJiIXNM4A+9iO2RWuroCAu4ltSmwA8iGV0XN8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] symbols: don't over-align generated data
Message-Id: <E1tuwBH-007d16-2M@xenbits.xenproject.org>
Date: Wed, 19 Mar 2025 16:22:11 +0000

commit 559f1e20c278259f3a5101b18e06d3283195a44c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 18 09:44:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 18 09:44:57 2025 +0100

    symbols: don't over-align generated data
    
    x86 is one of the few architectures where .align has the same meaning as
    .balign; most other architectures (Arm, PPC, and RISC-V in particular)
    give it the same meaning as .p2align. Aligning every one of these item
    to 256 bytes (on all 64-bit architectures except x86-64) is clearly too
    much.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/tools/symbols.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index 67560605f2..dbf441c6ea 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -304,10 +304,10 @@ static void write_src(void)
 	printf("#include <xen/config.h>\n");
 	printf("#if BITS_PER_LONG == 64 && !defined(SYMBOLS_ORIGIN)\n");
 	printf("#define PTR .quad\n");
-	printf("#define ALGN .align 8\n");
+	printf("#define ALGN .balign 8\n");
 	printf("#else\n");
 	printf("#define PTR .long\n");
-	printf("#define ALGN .align 4\n");
+	printf("#define ALGN .balign 4\n");
 	printf("#endif\n");
 
 	printf("\t.section .rodata, \"a\"\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 19 16:22:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Mar 2025 16:22:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.920921.1324956 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwBS-0005L2-R5; Wed, 19 Mar 2025 16:22:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 920921.1324956; Wed, 19 Mar 2025 16:22:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwBS-0005Kr-OH; Wed, 19 Mar 2025 16:22:22 +0000
Received: by outflank-mailman (input) for mailman id 920921;
 Wed, 19 Mar 2025 16:22:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuwBR-0005Kj-TX
 for xen-changelog@lists.xenproject.org; Wed, 19 Mar 2025 16:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwBS-00D2nE-0M
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwBR-007d3O-2g
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aRe1Iiy2Kqa4gQsCIcYZK8H0ySe0oU9C7hrqZAGKhCw=; b=L2ElW7QPICAjlpTaZsFPtvjZG9
	C1U+2GdRLPpkByYY4oUvv8JzYrmmACZSH38JPiGrb1QUAdusWnYJYcldxBLDw+6kvJ/nJ1vmzp6nF
	bsJ4uubEbeh5ryvBWMvzeYZGMSLN6O4lFGX/LcDCIFOPU/RLvsG2nzaqNfhpKOX/XVFE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] symbols: sanitize a few variable's types
Message-Id: <E1tuwBR-007d3O-2g@xenbits.xenproject.org>
Date: Wed, 19 Mar 2025 16:22:21 +0000

commit 37a265b93ac20145b0ad0c47b0496f3561b26741
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 18 09:46:38 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 18 09:46:38 2025 +0100

    symbols: sanitize a few variable's types
    
    Parameter and return types of symbols_expand_symbol() make clear that
    xensyms_read()'s next_offset doesn't need to be 64-bit.
    
    xensyms_read()'s first parameter type makes clear that the function's
    next_symbols doesn't need to be 64-bit.
    
    symbols_num_syms'es type makes clear that iteration locals in
    symbols_lookup() don't need to be unsigned long (i.e. 64-bit on 64-bit
    architectures).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/symbols.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index 133b580768..f8a7bde37b 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -108,7 +108,7 @@ const char *symbols_lookup(unsigned long addr,
                            unsigned long *offset,
                            char *namebuf)
 {
-    unsigned long i, low, high, mid;
+    unsigned int i, low, high, mid;
     unsigned long symbol_end = 0;
     const struct virtual_region *region;
 
@@ -179,7 +179,7 @@ int xensyms_read(uint32_t *symnum, char *type,
      * from previous read. This can help us avoid the extra call to
      * get_symbol_offset().
      */
-    static uint64_t next_symbol, next_offset;
+    static unsigned int next_symbol, next_offset;
     static DEFINE_SPINLOCK(symbols_mutex);
 
     if ( *symnum > symbols_num_syms )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 19 16:22:32 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Mar 2025 16:22:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.920922.1324959 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwBc-0005NX-Sa; Wed, 19 Mar 2025 16:22:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 920922.1324959; Wed, 19 Mar 2025 16:22:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwBc-0005NN-Ph; Wed, 19 Mar 2025 16:22:32 +0000
Received: by outflank-mailman (input) for mailman id 920922;
 Wed, 19 Mar 2025 16:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuwBc-0005NB-1f
 for xen-changelog@lists.xenproject.org; Wed, 19 Mar 2025 16:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwBc-00D2nd-0p
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwBb-007d4C-31
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:22:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=05KhQz3otwaDRYRgLwbuaufAXv3cu13UKs2S4PpAXww=; b=IC/0Q9rUT5etW9IcbEWOEwkimE
	+16cZutAyoZN18NQsxv62VaLg1plYkXhytZvR9wYkeZxtBHSsdkS9zJ1G/8d5/jtMpUyTxe9ooGYu
	4FJSCUAusEYZK2OjbuWCIxE+spnYeyOgd5w3EQngiG8dZlnoDbELoE69vlgKAWTVdCEE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: use unique_id to identify new domain with same domid
Message-Id: <E1tuwBb-007d4C-31@xenbits.xenproject.org>
Date: Wed, 19 Mar 2025 16:22:31 +0000

commit c7b8d5e9df3743a08569725220dcde12afe80f3f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Mar 18 09:47:15 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 18 09:47:15 2025 +0100

    tools/xenstored: use unique_id to identify new domain with same domid
    
    Use the new unique_id of a domain in order to detect that a domain
    has been replaced with another one reusing the domain-id of the old
    domain.
    
    While changing the related code, switch from "dom_invalid" to
    "dom_valid" in order to avoid double negation and use "bool" as type
    for it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/xenstored/domain.c         | 65 ++++++++++++++++++++++++++++++++--------
 tools/xenstored/xenstore_state.h |  3 +-
 2 files changed, 55 insertions(+), 13 deletions(-)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index a6506a5bb2..fc0992d3a5 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -110,6 +110,7 @@ struct domain
 {
 	/* The id of this domain */
 	unsigned int domid;
+	uint64_t unique_id;
 
 	/* Event channel port */
 	evtchn_port_t port;
@@ -624,18 +625,26 @@ static int check_domain(const void *k, void *v, void *arg)
 {
 	unsigned int state;
 	struct connection *conn;
-	int dom_invalid;
+	bool dom_valid;
 	struct domain *domain = v;
 	bool *notify = arg;
+	uint64_t unique_id;
+
+	dom_valid = !xenmanage_get_domain_info(xm_handle, domain->domid,
+					       &state, &unique_id);
+	if (dom_valid) {
+		if (!domain->unique_id)
+			domain->unique_id = unique_id;
+		else if (domain->unique_id != unique_id)
+			dom_valid = false;
+	}
 
-	dom_invalid = xenmanage_get_domain_info(xm_handle, domain->domid,
-						&state, NULL);
 	if (!domain->introduced) {
-		if (dom_invalid)
+		if (!dom_valid)
 			talloc_free(domain);
 		return 0;
 	}
-	if (!dom_invalid) {
+	if (dom_valid) {
 		if ((state & XENMANAGE_GETDOMSTATE_STATE_SHUTDOWN)
 		    && !domain->shutdown) {
 			domain->shutdown = true;
@@ -747,7 +756,8 @@ int domain_max_global_acc(const void *ctx, struct connection *conn)
 	return 0;
 }
 
-static struct domain *alloc_domain(const void *context, unsigned int domid)
+static struct domain *alloc_domain(const void *context, unsigned int domid,
+				   uint64_t unique_id)
 {
 	struct domain *domain;
 
@@ -758,6 +768,7 @@ static struct domain *alloc_domain(const void *context, unsigned int domid)
 	}
 
 	domain->domid = domid;
+	domain->unique_id = unique_id;
 	domain->generation = generation;
 	domain->introduced = false;
 
@@ -777,16 +788,27 @@ static struct domain *find_or_alloc_domain(const void *ctx, unsigned int domid)
 	struct domain *domain;
 
 	domain = find_domain_struct(domid);
-	return domain ? : alloc_domain(ctx, domid);
+	/* If domain not already known, use unique_id = 0 meaning "unknown". */
+	return domain ? : alloc_domain(ctx, domid, 0);
 }
 
 static struct domain *find_or_alloc_existing_domain(unsigned int domid)
 {
 	struct domain *domain;
+	uint64_t unique_id = 0;
+	bool dom_valid = true;
 
 	domain = find_domain_struct(domid);
-	if (!domain && !xenmanage_get_domain_info(xm_handle, domid, NULL, NULL))
-		domain = alloc_domain(NULL, domid);
+	if (!domain || !domain->unique_id)
+		dom_valid = !xenmanage_get_domain_info(xm_handle, domid,
+						       NULL, &unique_id);
+
+	if (dom_valid) {
+		if (!domain)
+			domain = alloc_domain(NULL, domid, unique_id);
+		else if (unique_id)
+			domain->unique_id = unique_id;
+	}
 
 	return domain;
 }
@@ -1321,15 +1343,16 @@ int domain_alloc_permrefs(struct node_perms *perms)
 {
 	unsigned int i, domid;
 	struct domain *d;
+	uint64_t unique_id;
 
 	for (i = 0; i < perms->num; i++) {
 		domid = perms->p[i].id;
 		d = find_domain_struct(domid);
 		if (!d) {
 			if (xenmanage_get_domain_info(xm_handle, domid,
-						      NULL, NULL))
+						      NULL, &unique_id))
 				perms->p[i].perms |= XS_PERM_IGNORE;
-			else if (!alloc_domain(NULL, domid))
+			else if (!alloc_domain(NULL, domid, unique_id))
 				return ENOMEM;
 		}
 	}
@@ -1697,12 +1720,14 @@ const char *dump_state_connections(FILE *fp)
 	struct xs_state_record_header head;
 	struct connection *c;
 
+	BUILD_BUG_ON(sizeof(c->domain->unique_id) != sizeof(uint64_t));
+
 	list_for_each_entry(c, &connections, list) {
 		head.type = XS_STATE_TYPE_CONN;
 		head.length = sizeof(sc);
 
 		sc.conn_id = conn_id++;
-		sc.pad = 0;
+		sc.fields = 0;
 		memset(&sc.spec, 0, sizeof(sc.spec));
 		if (c->domain) {
 			sc.conn_type = XS_STATE_CONN_TYPE_RING;
@@ -1720,6 +1745,10 @@ const char *dump_state_connections(FILE *fp)
 			return ret;
 		head.length += sc.data_in_len + sc.data_out_len;
 		head.length = ROUNDUP(head.length, 3);
+		if (c->domain) {
+			sc.fields |= XS_STATE_CONN_FIELDS_UNIQ_ID;
+			head.length += sizeof(uint64_t);
+		}
 		if (fwrite(&head, sizeof(head), 1, fp) != 1)
 			return "Dump connection state error";
 		if (fwrite(&sc, offsetof(struct xs_state_connection, data),
@@ -1731,6 +1760,9 @@ const char *dump_state_connections(FILE *fp)
 		ret = dump_state_align(fp);
 		if (ret)
 			return ret;
+		if (c->domain &&
+		    fwrite(&c->domain->unique_id, sizeof(uint64_t), 1, fp) != 1)
+			return "Dump connection state error";
 
 		ret = dump_state_watches(fp, c, sc.conn_id);
 		if (ret)
@@ -1748,6 +1780,7 @@ void read_state_connection(const void *ctx, const void *state)
 
 	if (sc->conn_type == XS_STATE_CONN_TYPE_SOCKET) {
 		conn = add_socket_connection(sc->spec.socket_fd);
+		domain = NULL;
 	} else {
 		domain = introduce_domain(ctx, sc->spec.ring.domid,
 					  sc->spec.ring.evtchn, true);
@@ -1778,6 +1811,14 @@ void read_state_connection(const void *ctx, const void *state)
 	conn->conn_id = sc->conn_id;
 
 	read_state_buffered_data(ctx, conn, sc);
+
+	/* Validity of unique_id will be tested by check_domains() later. */
+	if ((sc->fields & XS_STATE_CONN_FIELDS_UNIQ_ID) && domain) {
+		unsigned long off;
+
+		off = sizeof(*sc) + sc->data_in_len + sc->data_out_len;
+		domain->unique_id = *(uint64_t *)(state + ROUNDUP(off, 3));
+	}
 }
 
 struct domain_acc {
diff --git a/tools/xenstored/xenstore_state.h b/tools/xenstored/xenstore_state.h
index ae0d053c8f..bad966caf4 100644
--- a/tools/xenstored/xenstore_state.h
+++ b/tools/xenstored/xenstore_state.h
@@ -74,7 +74,8 @@ struct xs_state_connection {
     uint16_t conn_type;
 #define XS_STATE_CONN_TYPE_RING   0
 #define XS_STATE_CONN_TYPE_SOCKET 1
-    uint16_t pad;
+    uint16_t fields;
+#define XS_STATE_CONN_FIELDS_UNIQ_ID 0x0001
     union {
         struct {
             uint16_t domid;  /* Domain-Id. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 19 16:22:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Mar 2025 16:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.920923.1324964 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwBn-0005Pr-UH; Wed, 19 Mar 2025 16:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 920923.1324964; Wed, 19 Mar 2025 16:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwBn-0005Pj-R9; Wed, 19 Mar 2025 16:22:43 +0000
Received: by outflank-mailman (input) for mailman id 920923;
 Wed, 19 Mar 2025 16:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuwBm-0005Pa-7K
 for xen-changelog@lists.xenproject.org; Wed, 19 Mar 2025 16:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwBm-00D2nl-1N
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwBm-007d90-0F
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hctHA3j0UXqo4iMf9PMKBWGHiYMDnDP9S1dJ9R2kfNA=; b=3pyGKQDb9Wl0W1MOcqk9BxhG9a
	KK7A5+QNo6F+j/SsFgF4a4F1Tix67UaR8ilVKdKO6ilFywAYACEDuKMtl9WI7QXhNEFxM3Uow7i35
	HcIy3Oxlpup2I6v0+BdvuEWcT2H5tpWLR+q0Wtq/DgWgmwOaVSyysWuhwxABCF1nIHeU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: use xenmanage_poll_changed_domain()
Message-Id: <E1tuwBm-007d90-0F@xenbits.xenproject.org>
Date: Wed, 19 Mar 2025 16:22:42 +0000

commit 09d8a8236384be3f3bcb3ba62e31160c1aa014d5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Mar 18 09:47:45 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 18 09:47:45 2025 +0100

    tools/xenstored: use xenmanage_poll_changed_domain()
    
    Instead of checking each known domain after having received a
    VIRQ_DOM_EXC event, use the new xenmanage_poll_changed_domain()
    function for directly getting the domid of a domain having changed
    its state.
    
    A test doing "xl shutdown" of 1000 guests has shown to reduce the
    consumed cpu time of xenstored by 6% with this change applied.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/xenstored/domain.c | 64 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 46 insertions(+), 18 deletions(-)

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index fc0992d3a5..e1d5e8d614 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -621,30 +621,24 @@ static int destroy_domain(void *_domain)
 	return 0;
 }
 
-static int check_domain(const void *k, void *v, void *arg)
+static int do_check_domain(struct domain *domain, bool *notify,
+			   unsigned int state, uint64_t unique_id)
 {
-	unsigned int state;
 	struct connection *conn;
-	bool dom_valid;
-	struct domain *domain = v;
-	bool *notify = arg;
-	uint64_t unique_id;
 
-	dom_valid = !xenmanage_get_domain_info(xm_handle, domain->domid,
-					       &state, &unique_id);
-	if (dom_valid) {
+	if (unique_id) {
 		if (!domain->unique_id)
 			domain->unique_id = unique_id;
 		else if (domain->unique_id != unique_id)
-			dom_valid = false;
+			unique_id = 0;
 	}
 
 	if (!domain->introduced) {
-		if (!dom_valid)
+		if (!unique_id)
 			talloc_free(domain);
 		return 0;
 	}
-	if (dom_valid) {
+	if (unique_id) {
 		if ((state & XENMANAGE_GETDOMSTATE_STATE_SHUTDOWN)
 		    && !domain->shutdown) {
 			domain->shutdown = true;
@@ -667,6 +661,21 @@ static int check_domain(const void *k, void *v, void *arg)
 	return 0;
 }
 
+static int check_domain(const void *k, void *v, void *arg)
+{
+	struct domain *domain = v;
+	unsigned int state;
+	uint64_t unique_id;
+
+	if (xenmanage_get_domain_info(xm_handle, domain->domid, &state,
+				      &unique_id)) {
+		unique_id = 0;
+		state = 0;
+	}
+
+	return do_check_domain(domain, arg, state, unique_id);
+}
+
 void check_domains(void)
 {
 	bool notify = false;
@@ -678,6 +687,30 @@ void check_domains(void)
 		fire_special_watches("@releaseDomain");
 }
 
+static struct domain *find_domain_struct(unsigned int domid)
+{
+	return hashtable_search(domhash, &domid);
+}
+
+static void do_check_domains(void)
+{
+	unsigned int domid;
+	unsigned int state;
+	uint64_t unique_id;
+	struct domain *domain;
+	bool notify = false;
+
+	while (!xenmanage_poll_changed_domain(xm_handle, &domid, &state,
+					      &unique_id)) {
+		domain = find_domain_struct(domid);
+		if (domain)
+			do_check_domain(domain, &notify, state, unique_id);
+	}
+
+	if (notify)
+		fire_special_watches("@releaseDomain");
+}
+
 /* We scan all domains rather than use the information given here. */
 void handle_event(void)
 {
@@ -687,7 +720,7 @@ void handle_event(void)
 		barf_perror("Failed to read from event fd");
 
 	if (port == virq_port)
-		check_domains();
+		do_check_domains();
 
 	if (xenevtchn_unmask(xce_handle, port) == -1)
 		barf_perror("Failed to write to event fd");
@@ -698,11 +731,6 @@ static char *talloc_domain_path(const void *context, unsigned int domid)
 	return talloc_asprintf(context, "/local/domain/%u", domid);
 }
 
-static struct domain *find_domain_struct(unsigned int domid)
-{
-	return hashtable_search(domhash, &domid);
-}
-
 int domain_get_quota(const void *ctx, struct connection *conn,
 		     unsigned int domid)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 19 16:22:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Mar 2025 16:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.920924.1324967 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwBy-0005Sb-0K; Wed, 19 Mar 2025 16:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 920924.1324967; Wed, 19 Mar 2025 16:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwBx-0005ST-Ts; Wed, 19 Mar 2025 16:22:53 +0000
Received: by outflank-mailman (input) for mailman id 920924;
 Wed, 19 Mar 2025 16:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuwBw-0005SL-9o
 for xen-changelog@lists.xenproject.org; Wed, 19 Mar 2025 16:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwBw-00D2np-1d
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwBw-007d9w-0m
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=40OtdXUnTV4zgwULcyRVREw06EsRyDRZxYbzah6Q70o=; b=u8nsV299gPUfg/57G79gl8N7r8
	my54QiNs2cfcaV9BVXAs3HCvoNFNhuL6BkEx4zoY0LIMPsMe+Dzdxh8ePEIdECRP+9i3FHMbP5TqA
	au21hyjoTUp6wWkdhKF+GgwTNKGRXYmpHR/ITdxjuB5WDxlsZ0HJftmmTQB1rXLVMoCU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Mention PCI passthrough for HVM domUs
Message-Id: <E1tuwBw-007d9w-0m@xenbits.xenproject.org>
Date: Wed, 19 Mar 2025 16:22:52 +0000

commit 77be740e8182fa6b31291a8ae983d253187e9b50
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Tue Mar 18 09:48:00 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 18 09:48:00 2025 +0100

    CHANGELOG.md: Mention PCI passthrough for HVM domUs
    
    PCI passthrough is already supported for HVM domUs when dom0 is PVH
    on x86. The last related patch on Qemu side was merged after Xen4.20
    release. So mention this feature in Xen4.21 entry.
    
    But SR-IOV is not yet supported on PVH dom0, add a note for it.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7201c484f8..9a5919585d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - On x86:
    - Option to attempt to fixup p2m page-faults on PVH dom0.
    - Resizable BARs is supported for PVH dom0.
+   - Support PCI passthrough for HVM domUs when dom0 is PVH (note SR-IOV
+     capability usage is not yet supported on PVH dom0).
 
 ### Removed
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 19 16:23:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Mar 2025 16:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.920926.1324981 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwC8-0005kz-8l; Wed, 19 Mar 2025 16:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 920926.1324981; Wed, 19 Mar 2025 16:23:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwC8-0005kn-5o; Wed, 19 Mar 2025 16:23:04 +0000
Received: by outflank-mailman (input) for mailman id 920926;
 Wed, 19 Mar 2025 16:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuwC6-0005WV-Cz
 for xen-changelog@lists.xenproject.org; Wed, 19 Mar 2025 16:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwC6-00D2oE-1x
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwC6-007dBM-15
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=We3dhC3ntDd/7qMKV5TVdc94wGS6EQxgaYkkZEvvdGI=; b=ESV++BVCQ1x60wO2ZyzEavRI2O
	t2QCFJMNGKdSOC6voQ+QnkrmFUyW5EojhSruO0Od7TsCIIc64d3ZPgqoW2zpzdUpmanFWgORlXsuU
	jh4v+dOPDqG7kMEphjCla9QI+sdnIIIRCuBMG6FtlMvzJj7RPi+9eAXlSTmiCUzVWguo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
Message-Id: <E1tuwC6-007dBM-15@xenbits.xenproject.org>
Date: Wed, 19 Mar 2025 16:23:02 +0000

commit b07c7d63f9b587e4df5d71f6da9eaa433512c974
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Mar 19 02:58:18 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 19 14:53:28 2025 +0000

    x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
    
    The current CI failures turn out to be a latent bug triggered by a narrow set
    of properties of the initrd and the host memory map, which CI encountered by
    chance.
    
    One step during boot involves constructing directmap mappings for modules.
    With some probing at the point of creation, it is observed that there's a 4k
    mapping missing towards the end of the initrd.
    
      (XEN) === Mapped Mod1 [0000000394001000, 00000003be1ff6dc] to Directmap
      (XEN) Probing paddr 394001000, va ffff830394001000
      (XEN) Probing paddr 3be1ff6db, va ffff8303be1ff6db
      (XEN) Probing paddr 3bdffffff, va ffff8303bdffffff
      (XEN) Probing paddr 3be001000, va ffff8303be001000
      (XEN) Probing paddr 3be000000, va ffff8303be000000
      (XEN) Early fatal page fault at e008:ffff82d04032014c (cr2=ffff8303be000000, ec=0000)
    
    The conditions for this bug appear to be map_pages_to_xen() call with a start
    address of exactly 4k beyond a 2M boundary, some number of full 2M pages, then
    a tail needing 4k pages.
    
    Anyway, the condition for spotting superpage boundaries in map_pages_to_xen()
    is wrong.  The IS_ALIGNED() macro expects a power of two for the alignment
    argument, and subtracts 1 itself.
    
    Fixing this causes the failing case to now boot.
    
    Fixes: 97fb6fcf26e8 ("x86/mm: introduce helpers to detect super page alignment")
    Debugged-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 03b8319f7a..b294497a14 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5505,7 +5505,7 @@ int map_pages_to_xen(
                                                                 \
     ASSERT(!mfn_eq(m_, INVALID_MFN));                           \
     IS_ALIGNED(PFN_DOWN(v) | mfn_x(m_),                         \
-               (1UL << (PAGETABLE_ORDER * ((n) - 1))) - 1);     \
+               1UL << (PAGETABLE_ORDER * ((n) - 1)));           \
 })
 #define IS_L2E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 2)
 #define IS_L3E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 3)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 19 16:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Mar 2025 16:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.920974.1325006 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwh5-0004On-TW; Wed, 19 Mar 2025 16:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 920974.1325006; Wed, 19 Mar 2025 16:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwh5-0004Of-Qx; Wed, 19 Mar 2025 16:55:03 +0000
Received: by outflank-mailman (input) for mailman id 920974;
 Wed, 19 Mar 2025 16:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuwh4-0004OX-KW
 for xen-changelog@lists.xenproject.org; Wed, 19 Mar 2025 16:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwh4-00D3X8-1U
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwh4-007kwG-0Y
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ycoZAwXRj/9ThkASqUgTGQydAUMNr6b3oL8dXXg3sYY=; b=YFN9M2PRq7rQcUVap5vYYFLJHg
	Ag31yo7iu5p9ag0EHoLzS1D/v9pqbjTBoSb5k8AuTqF0dOXKhe1YNp7megIvb90vOwOz/oCx+wYad
	4ecsQCP0dm2PBu0WboXgIE4M3ZU8v9tmjGiXoJrjFDZFYTHu1kGWIUjPMdEGT1Brz1X8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arinc653: call xfree() with local IRQ enabled
Message-Id: <E1tuwh4-007kwG-0Y@xenbits.xenproject.org>
Date: Wed, 19 Mar 2025 16:55:02 +0000

commit 3ee55c9543fcf0b35593f030b53f56f3222046b7
Author:     Anderson Choi <anderson.choi@boeing.com>
AuthorDate: Tue Mar 18 16:34:15 2025 +0900
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 19 16:44:00 2025 +0000

    xen/arinc653: call xfree() with local IRQ enabled
    
    xen panic is observed with the following configuration.
    
    1. Debug xen build (CONFIG_DEBUG=y)
    2. dom1 of an ARINC653 domain
    3. shutdown dom1 with xl command
    
    $ xl shutdown <domain_name>
    
    (XEN) ****************************************
    (XEN) Panic on CPU 2:
    (XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/xmalloc_tlsf.c:714
    (XEN) ****************************************
    
    panic was triggered since xfree() was called with local IRQ disabled and
    therefore assertion failed.
    
    Fix this by calling xfree() after local IRQ is enabled.
    
    Fixes: 19049f8d796a sched: fix locking in a653sched_free_vdata()
    Signed-off-by: Anderson Choi <anderson.choi@boeing.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index 9ebae6d7ae..930361fa5c 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -463,10 +463,11 @@ a653sched_free_udata(const struct scheduler *ops, void *priv)
     if ( !is_idle_unit(av->unit) )
         list_del(&av->list);
 
-    xfree(av);
     update_schedule_units(ops);
 
     spin_unlock_irqrestore(&sched_priv->lock, flags);
+
+    xfree(av);
 }
 
 /**
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 19 16:55:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Mar 2025 16:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.920975.1325009 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwhE-0004Qn-Uy; Wed, 19 Mar 2025 16:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 920975.1325009; Wed, 19 Mar 2025 16:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuwhE-0004Qf-SN; Wed, 19 Mar 2025 16:55:12 +0000
Received: by outflank-mailman (input) for mailman id 920975;
 Wed, 19 Mar 2025 16:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuwhE-0004QW-BG
 for xen-changelog@lists.xenproject.org; Wed, 19 Mar 2025 16:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwhE-00D3XH-1m
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuwhE-007kxf-0u
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 16:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/2OLbm3hgVZUgckf3AWSLA6vDniG2h2LmBoximodldE=; b=KQKyA9L782JaHjEpLKdWCDhPRs
	3Tl6GPboh3rrkcZ3CIYPboEQpEMa/rIN7cUz39pIt4tyU8D+J8RMh/lR+DnebfvViqKZIKyJb11NU
	d+GGBdOuEcul0Je/kv6m8NUsjPDraZCUZ1rysPMMEkaIYHvf3qmpxL5E08bTg46LyiJ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: Update toolchain requirements to GCC 5.1/Binutils 2.25 or Clang/LLVM 11
Message-Id: <E1tuwhE-007kxf-0u@xenbits.xenproject.org>
Date: Wed, 19 Mar 2025 16:55:12 +0000

commit aa78a7d10c6c2ef877b34d119a6db934c201ddfd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 7 17:29:10 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 19 16:44:00 2025 +0000

    xen: Update toolchain requirements to GCC 5.1/Binutils 2.25 or Clang/LLVM 11
    
    GCC 4.1.2 is from 2007, and Binutils 2.16 is a similar vintage.  Clang 3.5 is
    from 2014.  Supporting toolchains this old is a massive development and
    testing burden.
    
    Set a minimum baseline of GCC 5.1 across the board, along with Binutils 2.25
    which is the same age.  These were chosen *3 years ago* as Linux's minimum
    requirements because even back then, they were ubiquitous in distros.  Choose
    Clang/LLVM 11 as a baseline for similar reasons; the Linux commit making this
    change two years ago cites a laudry list of code generation bugs.
    
    This will allow us to retire a lot of compatiblity logic, and start using new
    features previously unavailable because of no viable compatibility option.
    
    Merge the ARM 32bit and 64bit sections now they're the same.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 README | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/README b/README
index 9d9c6fc324..be90be3910 100644
--- a/README
+++ b/README
@@ -38,16 +38,13 @@ provided by your OS distributor:
     * GNU Make v3.80 or later
     * C compiler and linker:
       - For x86:
-        - GCC 4.1.2_20070115 or later
-        - GNU Binutils 2.16.91.0.5 or later
+        - GCC 5.1 or later
+        - GNU Binutils 2.25 or later
         or
-        - Clang/LLVM 3.5 or later
-      - For ARM 32-bit:
-        - GCC 4.9 or later
-        - GNU Binutils 2.24 or later
-      - For ARM 64-bit:
+        - Clang/LLVM 11 or later
+      - For ARM:
         - GCC 5.1 or later
-        - GNU Binutils 2.24 or later
+        - GNU Binutils 2.25 or later
       - For RISC-V 64-bit:
         - GCC 12.2 or later
         - GNU Binutils 2.39 or later
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 19 17:55:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Mar 2025 17:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921075.1325087 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuxdA-0003lF-NF; Wed, 19 Mar 2025 17:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921075.1325087; Wed, 19 Mar 2025 17:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuxdA-0003l7-KS; Wed, 19 Mar 2025 17:55:04 +0000
Received: by outflank-mailman (input) for mailman id 921075;
 Wed, 19 Mar 2025 17:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuxd9-0003l1-2W
 for xen-changelog@lists.xenproject.org; Wed, 19 Mar 2025 17:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuxd8-00D4yC-13
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 17:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuxd8-007tj8-09
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 17:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eao6xU55qcrje6G8rNXlNJqsXCw6AO5SQbGPJdEbHfo=; b=ZQRsf5kN5YQ12CHIVqr0oFRdUx
	htAW00Tz1Ao3Z/LxCafvcepy6gQ3Wf6VjQyYrNjHIIaz4cL7bFTVy24LIBURna46TBuXuxgZwFPz9
	Zjn/MrKzMmgOgDWShloDw2zNX0Jxkpt0CBUgzXBPopNaywfTZOSSp9JvaEurYHrXJwm0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arinc653: call xfree() with local IRQ enabled
Message-Id: <E1tuxd8-007tj8-09@xenbits.xenproject.org>
Date: Wed, 19 Mar 2025 17:55:02 +0000

commit 3ee55c9543fcf0b35593f030b53f56f3222046b7
Author:     Anderson Choi <anderson.choi@boeing.com>
AuthorDate: Tue Mar 18 16:34:15 2025 +0900
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 19 16:44:00 2025 +0000

    xen/arinc653: call xfree() with local IRQ enabled
    
    xen panic is observed with the following configuration.
    
    1. Debug xen build (CONFIG_DEBUG=y)
    2. dom1 of an ARINC653 domain
    3. shutdown dom1 with xl command
    
    $ xl shutdown <domain_name>
    
    (XEN) ****************************************
    (XEN) Panic on CPU 2:
    (XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/xmalloc_tlsf.c:714
    (XEN) ****************************************
    
    panic was triggered since xfree() was called with local IRQ disabled and
    therefore assertion failed.
    
    Fix this by calling xfree() after local IRQ is enabled.
    
    Fixes: 19049f8d796a sched: fix locking in a653sched_free_vdata()
    Signed-off-by: Anderson Choi <anderson.choi@boeing.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index 9ebae6d7ae..930361fa5c 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -463,10 +463,11 @@ a653sched_free_udata(const struct scheduler *ops, void *priv)
     if ( !is_idle_unit(av->unit) )
         list_del(&av->list);
 
-    xfree(av);
     update_schedule_units(ops);
 
     spin_unlock_irqrestore(&sched_priv->lock, flags);
+
+    xfree(av);
 }
 
 /**
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 19 17:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Mar 2025 17:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921076.1325091 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuxdJ-0003ml-OQ; Wed, 19 Mar 2025 17:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921076.1325091; Wed, 19 Mar 2025 17:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tuxdJ-0003md-Lo; Wed, 19 Mar 2025 17:55:13 +0000
Received: by outflank-mailman (input) for mailman id 921076;
 Wed, 19 Mar 2025 17:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tuxdI-0003mR-7H
 for xen-changelog@lists.xenproject.org; Wed, 19 Mar 2025 17:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuxdI-00D4yK-1N
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 17:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tuxdI-007tjx-0S
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Mar 2025 17:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BmjtMUNQDOIb34zFCAGvSbxqr6PFmSRWw12ihwLa0M8=; b=KxMOQSLgePxY3DTO4Km87OIoGX
	+MTdSKV+GKRxFnf7HhFYGi2Lps+mausKJAx6RZHrP+il0l3lqzA60CQf7yUtCESCeH4Q5wYOtrrW5
	6T+znkywyHQpItLQJuPq2nGmXPtJ1jc+EGk6qUdb43U6+rEAmWlUl+QDZLXUPwv1i7gw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Update toolchain requirements to GCC 5.1/Binutils 2.25 or Clang/LLVM 11
Message-Id: <E1tuxdI-007tjx-0S@xenbits.xenproject.org>
Date: Wed, 19 Mar 2025 17:55:12 +0000

commit aa78a7d10c6c2ef877b34d119a6db934c201ddfd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 7 17:29:10 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 19 16:44:00 2025 +0000

    xen: Update toolchain requirements to GCC 5.1/Binutils 2.25 or Clang/LLVM 11
    
    GCC 4.1.2 is from 2007, and Binutils 2.16 is a similar vintage.  Clang 3.5 is
    from 2014.  Supporting toolchains this old is a massive development and
    testing burden.
    
    Set a minimum baseline of GCC 5.1 across the board, along with Binutils 2.25
    which is the same age.  These were chosen *3 years ago* as Linux's minimum
    requirements because even back then, they were ubiquitous in distros.  Choose
    Clang/LLVM 11 as a baseline for similar reasons; the Linux commit making this
    change two years ago cites a laudry list of code generation bugs.
    
    This will allow us to retire a lot of compatiblity logic, and start using new
    features previously unavailable because of no viable compatibility option.
    
    Merge the ARM 32bit and 64bit sections now they're the same.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 README | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/README b/README
index 9d9c6fc324..be90be3910 100644
--- a/README
+++ b/README
@@ -38,16 +38,13 @@ provided by your OS distributor:
     * GNU Make v3.80 or later
     * C compiler and linker:
       - For x86:
-        - GCC 4.1.2_20070115 or later
-        - GNU Binutils 2.16.91.0.5 or later
+        - GCC 5.1 or later
+        - GNU Binutils 2.25 or later
         or
-        - Clang/LLVM 3.5 or later
-      - For ARM 32-bit:
-        - GCC 4.9 or later
-        - GNU Binutils 2.24 or later
-      - For ARM 64-bit:
+        - Clang/LLVM 11 or later
+      - For ARM:
         - GCC 5.1 or later
-        - GNU Binutils 2.24 or later
+        - GNU Binutils 2.25 or later
       - For RISC-V 64-bit:
         - GCC 12.2 or later
         - GNU Binutils 2.39 or later
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 07:55:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 07:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921426.1325267 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvAk2-0000j4-Dp; Thu, 20 Mar 2025 07:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921426.1325267; Thu, 20 Mar 2025 07:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvAk2-0000iw-BN; Thu, 20 Mar 2025 07:55:02 +0000
Received: by outflank-mailman (input) for mailman id 921426;
 Thu, 20 Mar 2025 07:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvAk1-0000iq-Ru
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 07:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvAk1-00Ero4-2u
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 07:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvAk1-009FxT-1y
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 07:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s1e8BNJAsZt0Irrka8Pj51NtuzUjilOeng22Xiel6u8=; b=pTW0T+1cBOeIWJ30+vuZDlHnF/
	9LFaBM22y4a6Ea0yNrUdMZJySMc+DQE0sEe3Ce04n8LTgR47RDG036vJsfVjGbwi4D7RItk9nlDna
	fAdPWTQpVf4D4JPnOtQ7l6G8VBP5sBDWRS276lwv94oXOSwXLGL3eO2Fr0f8Ob4PJBFA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/console: fix trailing whitespaces
Message-Id: <E1tvAk1-009FxT-1y@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 07:55:01 +0000

commit 6cc1862f549e2dc11fbee66d3120defcdc379403
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Thu Mar 20 08:51:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 08:51:14 2025 +0100

    xen/console: fix trailing whitespaces
    
    Remove trailing whitespaces in the console driver.
    
    No functional change.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/console.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index ba428199d2..c3150fbdb7 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1,8 +1,8 @@
 /******************************************************************************
  * console.c
- * 
+ *
  * Emergency console I/O for Xen and the domain-0 guest OS.
- * 
+ *
  * Copyright (c) 2002-2004, K A Fraser.
  *
  * Added printf_ratelimit
@@ -811,7 +811,7 @@ static int printk_prefix_check(char *p, char **pp)
     return ((atomic_read(&print_everything) != 0) ||
             (loglvl < lower_thresh) ||
             ((loglvl < upper_thresh) && printk_ratelimit()));
-} 
+}
 
 static int cf_check parse_console_timestamps(const char *s)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 07:55:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 07:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921427.1325270 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvAkC-0000l6-G0; Thu, 20 Mar 2025 07:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921427.1325270; Thu, 20 Mar 2025 07:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvAkC-0000ky-Co; Thu, 20 Mar 2025 07:55:12 +0000
Received: by outflank-mailman (input) for mailman id 921427;
 Thu, 20 Mar 2025 07:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvAkB-0000kp-PR
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 07:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvAkB-00EroA-3D
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 07:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvAkB-009Fy5-2K
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 07:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xWgsqpv/NTUBplnHpX6Kvj3UV8TNozUck5c6z0zcBMo=; b=F76ZcNgP3Wrej3hdWJhBDM4gtq
	4HBOc83XZVyMHyTh4P7kJIwIn+I7zaE+ELr7ewalQy62sJjrH13aXh+oNAH3So4BKc6tn5/h3v69/
	edP6g8RFbOOQxZCv+mWJMxSfbhGfb5KOKZ/Lsa1v4RWjQKTOf672SRLzrA8fRtC7Emqg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/setup: correct off-by-1 in module mapping
Message-Id: <E1tvAkB-009Fy5-2K@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 07:55:11 +0000

commit c3b54301fbe918c7e7e9c3b2dfe671c1ab79f882
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 20 08:51:55 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 08:51:55 2025 +0100

    x86/setup: correct off-by-1 in module mapping
    
    If a module's length is an exact multiple of PAGE_SIZE, the 2nd argument
    passed to set_pdx_range() would be one larger than intended. Use
    PFN_{UP,DOWN}() there instead.
    
    Fixes: cd7cc5320bb2 ("x86/boot: add start and size fields to struct boot_module")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index bde5d75ea6..715719213d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1730,7 +1730,7 @@ void asmlinkage __init noreturn __start_xen(void)
     {
         unsigned long s = bi->mods[i].start, l = bi->mods[i].size;
 
-        set_pdx_range(paddr_to_pfn(s), paddr_to_pfn(s + l) + 1);
+        set_pdx_range(PFN_DOWN(s), PFN_UP(s + l));
         map_pages_to_xen((unsigned long)maddr_to_virt(s), maddr_to_mfn(s),
                          PFN_UP(l), PAGE_HYPERVISOR);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 10:55:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 10:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921804.1325545 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvDYF-0003Fv-PR; Thu, 20 Mar 2025 10:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921804.1325545; Thu, 20 Mar 2025 10:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvDYF-0003Fn-Mf; Thu, 20 Mar 2025 10:55:03 +0000
Received: by outflank-mailman (input) for mailman id 921804;
 Thu, 20 Mar 2025 10:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvDYE-0003FY-K4
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 10:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvDYE-00EwSE-1a
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 10:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvDYE-009Xls-0d
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 10:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nI9eUaYGLWSVjDBWFbzry2eqkLmeAp9S8+3bVeNTcwo=; b=ot+EuSJD6BAqIc+Xn9NctOl2qI
	Kwtq2//TZ9iDVkg5MULSnfgm36esCzExCs8wSJqBXPXzDPsY6fVUJD+MvFVejZe4vz2WroEVYKVh/
	A/AL9oRgcj5QhOQU80Nekb3ep+OJtkuANCdCfx2NgrTI1kFb/Yt2FaJViA70YMU0wlBc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/console: fix trailing whitespaces
Message-Id: <E1tvDYE-009Xls-0d@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 10:55:02 +0000

commit 6cc1862f549e2dc11fbee66d3120defcdc379403
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Thu Mar 20 08:51:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 08:51:14 2025 +0100

    xen/console: fix trailing whitespaces
    
    Remove trailing whitespaces in the console driver.
    
    No functional change.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/console.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index ba428199d2..c3150fbdb7 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1,8 +1,8 @@
 /******************************************************************************
  * console.c
- * 
+ *
  * Emergency console I/O for Xen and the domain-0 guest OS.
- * 
+ *
  * Copyright (c) 2002-2004, K A Fraser.
  *
  * Added printf_ratelimit
@@ -811,7 +811,7 @@ static int printk_prefix_check(char *p, char **pp)
     return ((atomic_read(&print_everything) != 0) ||
             (loglvl < lower_thresh) ||
             ((loglvl < upper_thresh) && printk_ratelimit()));
-} 
+}
 
 static int cf_check parse_console_timestamps(const char *s)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 10:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 10:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921805.1325550 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvDYP-0003IM-RH; Thu, 20 Mar 2025 10:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921805.1325550; Thu, 20 Mar 2025 10:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvDYP-0003IC-O2; Thu, 20 Mar 2025 10:55:13 +0000
Received: by outflank-mailman (input) for mailman id 921805;
 Thu, 20 Mar 2025 10:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvDYO-0003Hp-CG
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 10:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvDYO-00EwSI-1t
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 10:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvDYO-009Xma-10
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 10:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ImPj4/96m5RgSQVeap8yDKBZ2Ye2S/yWnTTrkTZqnzQ=; b=a7+el9St2WEieJTr2H0OifksDr
	aHFt3S/BM43QKswe7RYI59sC/PbdX1nm1lgSAutP5JCW9z9Zj3KolgrhuDbzDnT/jRCuyw46KVy7e
	ZomQKtSio7bdf7il88qzLwvM8PVeODqoNnhhxyxPxgKo6kgOcbQYYCSJzG0DmTR2n1Yc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/setup: correct off-by-1 in module mapping
Message-Id: <E1tvDYO-009Xma-10@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 10:55:12 +0000

commit c3b54301fbe918c7e7e9c3b2dfe671c1ab79f882
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 20 08:51:55 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 08:51:55 2025 +0100

    x86/setup: correct off-by-1 in module mapping
    
    If a module's length is an exact multiple of PAGE_SIZE, the 2nd argument
    passed to set_pdx_range() would be one larger than intended. Use
    PFN_{UP,DOWN}() there instead.
    
    Fixes: cd7cc5320bb2 ("x86/boot: add start and size fields to struct boot_module")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index bde5d75ea6..715719213d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1730,7 +1730,7 @@ void asmlinkage __init noreturn __start_xen(void)
     {
         unsigned long s = bi->mods[i].start, l = bi->mods[i].size;
 
-        set_pdx_range(paddr_to_pfn(s), paddr_to_pfn(s + l) + 1);
+        set_pdx_range(PFN_DOWN(s), PFN_UP(s + l));
         map_pages_to_xen((unsigned long)maddr_to_virt(s), maddr_to_mfn(s),
                          PFN_UP(l), PAGE_HYPERVISOR);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 11:33:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 11:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921877.1325593 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvE92-0006SH-9F; Thu, 20 Mar 2025 11:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921877.1325593; Thu, 20 Mar 2025 11:33:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvE92-0006S9-6Z; Thu, 20 Mar 2025 11:33:04 +0000
Received: by outflank-mailman (input) for mailman id 921877;
 Thu, 20 Mar 2025 11:33:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvE90-0006S3-Uk
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 11:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE90-00ExIt-2h
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE90-009b27-1m
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hInOHMLodx3Ox0AYbEzhF+fuU4BWxQG4/B+MZx75vY4=; b=JL0BD6cffBSyWkomITGJjEYahp
	TrxwHJZZFR/3rZmCtjun4kDnPSi7khR1rJEkxlJiAWXq6gBp3SyMbMjLZISi+mC+GvXUu1MVJ1Yid
	M2M8flk8sC0rajvkqkz5jzRY/SlYvxiQIZHFRcmu/c2WOtnmxHWIfc3gtpTtP3XapozI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/msi: always propagate MSI writes when not in active system mode
Message-Id: <E1tvE90-009b27-1m@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 11:33:02 +0000

commit c9f62baee892c4356653dd56fe3c6bf25fb84350
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 17 15:40:11 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 09:27:25 2025 +0100

    x86/msi: always propagate MSI writes when not in active system mode
    
    Relax the limitation on MSI register writes, and only apply it when the
    system is in active state.  For example AMD IOMMU drivers rely on using
    set_msi_affinity() to force an MSI register write on resume from
    suspension.
    
    The original patch intention was to reduce the number of MSI register
    writes when the system is in active state.  Leave the other states to
    always perform the writes, as it's safer given the existing code, and it's
    expected to not make a difference performance wise.
    
    For such propagation to work even when the IRT index is not updated the MSI
    message must be adjusted in all success cases for AMD IOMMU, not just when
    the index has been newly allocated.
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Fixes: 8e60d47cf011 ('x86/iommu: avoid MSI address and data writes if IRT index hasn't changed')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/arch/x86/msi.c                       | 9 +++++++++
 xen/drivers/passthrough/amd/iommu_intr.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 163ccf8747..8bb3bb18af 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -189,6 +189,15 @@ static int write_msi_msg(struct msi_desc *entry, struct msi_msg *msg,
 {
     entry->msg = *msg;
 
+    if ( unlikely(system_state != SYS_STATE_active) )
+        /*
+         * Always propagate writes when not in the 'active' state.  The
+         * optimization to avoid the MSI address and data registers write is
+         * only relevant for runtime state, and drivers on resume (at least)
+         * rely on set_msi_affinity() to update the hardware state.
+         */
+        force = true;
+
     if ( iommu_intremap != iommu_intremap_off )
     {
         int rc;
diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index 9abdc38053..08766122b4 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -546,7 +546,7 @@ int cf_check amd_iommu_msi_msg_update_ire(
     rc = update_intremap_entry_from_msi_msg(iommu, bdf, nr,
                                             &msi_desc->remap_index,
                                             msg, &data);
-    if ( rc > 0 )
+    if ( rc >= 0 )
     {
         for ( i = 1; i < nr; ++i )
             msi_desc[i].remap_index = msi_desc->remap_index + i;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 11:33:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 11:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921878.1325597 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvE9C-0006UF-Ae; Thu, 20 Mar 2025 11:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921878.1325597; Thu, 20 Mar 2025 11:33:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvE9C-0006U7-81; Thu, 20 Mar 2025 11:33:14 +0000
Received: by outflank-mailman (input) for mailman id 921878;
 Thu, 20 Mar 2025 11:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvE9A-0006Tt-NW
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 11:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE9A-00ExIz-30
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE9A-009b2b-27
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZDWgjDJSf0KjdMsovG7/KCg5jlRw6p18fck6U0fcVSE=; b=g50QaxqPfNWayLoTvKdQfDJxvj
	iYoHnt6iLy/IVyz6negKMq16pHxODJprWJfwe7GJVKlyH6wGJh49E+NBsGeqspG4FPcA1QimWk0C8
	aQqvrICJ8qrgmR3CWY77BHNG8jFzilgNL8MC7K/6m7+hjX5MppWKsXT1ApdOrrj1dlTI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/msi: always propagate MSI register writes from __setup_msi_irq()
Message-Id: <E1tvE9A-009b2b-27@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 11:33:12 +0000

commit b3bf9646101e48d9c3a8a53e53c39a39b4aa877f
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 18 09:31:35 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 09:27:25 2025 +0100

    x86/msi: always propagate MSI register writes from __setup_msi_irq()
    
    After 8e60d47cf011 writes from __setup_msi_irq() will no longer be
    propagated to the MSI registers if the IOMMU IRTE was already allocated.
    Given the purpose of __setup_msi_irq() is MSI initialization, always
    propagate the write to the hardware, regardless of whether the IRTE was
    already allocated.
    
    No functional change expected, as the write should always be propagated in
    __setup_msi_irq(), but make it explicit on the write_msi_msg() call.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 8bb3bb18af..5389bc0867 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -532,7 +532,7 @@ int __setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc,
     desc->msi_desc = msidesc;
     desc->handler = handler;
     msi_compose_msg(desc->arch.vector, desc->arch.cpu_mask, &msg);
-    ret = write_msi_msg(msidesc, &msg, false);
+    ret = write_msi_msg(msidesc, &msg, true);
     if ( unlikely(ret) )
     {
         desc->handler = &no_irq_type;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 11:33:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 11:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921879.1325601 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvE9M-0006X4-CL; Thu, 20 Mar 2025 11:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921879.1325601; Thu, 20 Mar 2025 11:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvE9M-0006Wx-9Q; Thu, 20 Mar 2025 11:33:24 +0000
Received: by outflank-mailman (input) for mailman id 921879;
 Thu, 20 Mar 2025 11:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvE9K-0006Wn-QU
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 11:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE9L-00ExJ3-02
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE9K-009b3O-2P
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CM0oDEyVThIKQ8EpeTrbZz9Z0kOdrcKVg5Z9qskmIy0=; b=q0R/E200qVbZXj4w2bxrHkIW3o
	E8MHJTv9QNdtb748mModKqW9FzqpOhqGVHjnPLTK+F/bq4dQcdYsXFbZJtaDkoQtibDO5Iv/G5eyM
	js9F0kM1AYhpPt0Hhqd5kGPSIponr6gSm1D8XSq7GO9SQ++wAQ3Q0c9yrhmV1jtL2tU8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/wait: prevent duplicated assembly labels
Message-Id: <E1tvE9K-009b3O-2P@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 11:33:22 +0000

commit 162b97a4bb2a8b2e3ad18c3730f362862f1c9dcd
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 10:40:49 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:24 2025 +0100

    x86/wait: prevent duplicated assembly labels
    
    When enabling UBSAN with clang, the following error is triggered during the
    build:
    
    common/wait.c:154:9: error: symbol '.L_wq_resume' is already defined
      154 |         "push %%rbx; push %%rbp; push %%r12;"
          |         ^
    <inline asm>:1:121: note: instantiated into assembly here
        1 |         push %rbx; push %rbp; push %r12;push %r13; push %r14; push %r15;sub %esp,%ecx;cmp $4096, %ecx;ja .L_skip;mov %rsp,%rsi;.L_wq_resume: rep movsb;mov %rsp,%rsi;.L_skip:pop %r15; pop %r14; pop %r13;pop %r12; pop %rbp; pop %rbx
          |                                                                                                                                ^
    common/wait.c:154:9: error: symbol '.L_skip' is already defined
      154 |         "push %%rbx; push %%rbp; push %%r12;"
          |         ^
    <inline asm>:1:159: note: instantiated into assembly here
        1 |         push %rbx; push %rbp; push %r12;push %r13; push %r14; push %r15;sub %esp,%ecx;cmp $4096, %ecx;ja .L_skip;mov %rsp,%rsi;.L_wq_resume: rep movsb;mov %rsp,%rsi;.L_skip:pop %r15; pop %r14; pop %r13;pop %r12; pop %rbp; pop %rbx
          |                                                                                                                                                                      ^
    2 errors generated.
    
    The inline assembly block in __prepare_to_wait() is duplicated, thus
    leading to multiple definitions of the otherwise unique labels inside the
    assembly block.  GCC extended-asm documentation notes the possibility of
    duplicating asm blocks:
    
    > Under certain circumstances, GCC may duplicate (or remove duplicates of)
    > your assembly code when optimizing. This can lead to unexpected duplicate
    > symbol errors during compilation if your asm code defines symbols or
    > labels. Using ‘%=’ (see AssemblerTemplate) may help resolve this problem.
    
    Workaround the issue by latching esp to a local variable, this prevents
    clang duplicating the inline asm blocks.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/wait.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/common/wait.c b/xen/common/wait.c
index cb6f5ff3c2..9a11dccb5d 100644
--- a/xen/common/wait.c
+++ b/xen/common/wait.c
@@ -124,6 +124,11 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
     struct cpu_info *cpu_info = get_cpu_info();
     struct vcpu *curr = current;
     unsigned long dummy;
+    /*
+     * Latch esp to a local variable to prevent clang from duplicating the
+     * inline assembly block when UBSAN is enabled.
+     */
+    void *esp = NULL;
 
     ASSERT(wqv->esp == NULL);
 
@@ -166,12 +171,12 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
         ".L_skip:"
         "pop %%r15; pop %%r14; pop %%r13;"
         "pop %%r12; pop %%rbp; pop %%rbx"
-        : "=&S" (wqv->esp), "=&c" (dummy), "=&D" (dummy)
+        : "=&S" (esp), "=&c" (dummy), "=&D" (dummy)
         : "0" (0), "1" (cpu_info), "2" (wqv->stack),
           [sz] "i" (PAGE_SIZE)
         : "memory", "rax", "rdx", "r8", "r9", "r10", "r11" );
 
-    if ( unlikely(wqv->esp == NULL) )
+    if ( unlikely(esp == NULL) )
     {
         gdprintk(XENLOG_ERR, "Stack too large in %s\n", __func__);
         domain_crash(curr->domain);
@@ -179,6 +184,7 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
         for ( ; ; )
             do_softirq();
     }
+    wqv->esp = esp;
 }
 
 static void __finish_wait(struct waitqueue_vcpu *wqv)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 11:33:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 11:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921880.1325606 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvE9W-0006ZW-E2; Thu, 20 Mar 2025 11:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921880.1325606; Thu, 20 Mar 2025 11:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvE9W-0006ZO-Aw; Thu, 20 Mar 2025 11:33:34 +0000
Received: by outflank-mailman (input) for mailman id 921880;
 Thu, 20 Mar 2025 11:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvE9U-0006ZI-TZ
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 11:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE9V-00ExJB-0J
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE9U-009b4q-2f
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IPi6PQ/MbOEPck05duyv0Wc5g53caICjwoT4nNgwiUA=; b=F+jxeQr+dkoEENdf9Ju5HyADP2
	Yv8aJj/WcaMmbcVIbwu5JJ6ozyrbccSSP6OZl2oF5acVA8ytHIdJukOdqmDI+C0Tgf/Ook7+0nFEl
	LgRQ3qK6KwNTXBFRLY0ajGUQzgLNyMVpfvvxbyWSEXUHSC4hkZexJLRtHKwNQzfis4Nc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
Message-Id: <E1tvE9U-009b4q-2f@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 11:33:32 +0000

commit fc302866f42f552337ae7d8d78877aec36e6e2ff
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 18 09:20:41 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in common/compat/memory.c:90:9
    pointer operation overflowed ffff820080000000 to 0000020080000000
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0402a6259>] F compat_memory_op+0xf1/0x4d20
        [<ffff82d04041532d>] F hvm_memory_op+0x55/0xe0
        [<ffff82d040416150>] F hvm_hypercall+0xae8/0x21b0
        [<ffff82d0403b24ca>] F svm_vmexit_handler+0x1252/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Adjust the calculations in COMPAT_ARG_XLAT_VIRT_BASE to subtract from the
    per-domain area to obtain the mirrored linear address in the 4th slot,
    instead of overflowing the per-domain linear address.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/x86_64/uaccess.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/x86_64/uaccess.h b/xen/arch/x86/include/asm/x86_64/uaccess.h
index c6fa3fd381..9f515b2638 100644
--- a/xen/arch/x86/include/asm/x86_64/uaccess.h
+++ b/xen/arch/x86/include/asm/x86_64/uaccess.h
@@ -9,9 +9,9 @@
  * a secondary mapping installed, which needs to be used for such accesses in
  * the PV case, and will also be used for HVM to avoid extra conditionals.
  */
-#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) + \
-                                   (PERDOMAIN_ALT_VIRT_START - \
-                                    PERDOMAIN_VIRT_START))
+#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) - \
+                                   PERDOMAIN_VIRT_START + \
+                                   PERDOMAIN_ALT_VIRT_START)
 #define COMPAT_ARG_XLAT_SIZE      (2*PAGE_SIZE)
 struct vcpu;
 int setup_compat_arg_xlat(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 11:33:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 11:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921881.1325609 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvE9g-0006dT-Es; Thu, 20 Mar 2025 11:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921881.1325609; Thu, 20 Mar 2025 11:33:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvE9g-0006dL-CJ; Thu, 20 Mar 2025 11:33:44 +0000
Received: by outflank-mailman (input) for mailman id 921881;
 Thu, 20 Mar 2025 11:33:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvE9e-0006dD-Vx
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 11:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE9f-00ExJJ-0d
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE9e-009b5r-2w
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kvNfxcY3w74LRbSNTSyFua1vE8VCuBlEu9AAh5Bjb6I=; b=XV7evUd6D2BCt4IfSKI6ui/2QN
	UYLZy7zNAcfBtIypXwOw2zCCbfX7WSy7qkMpLya1oOeRq5fDGiFx0AhFgC+50bEhVnc14FxdAsWw7
	ZHIc6UhpxXpEqucaWxxL8rlaYIQlqtX92rjH7a8RzOWig/2esvGTKEavoKT/T8jAvBKU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
Message-Id: <E1tvE9e-009b5r-2w@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 11:33:42 +0000

commit 45ee73f1b24246f13cd9583cb2ee25fb9c782db8
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 18 09:20:59 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in arch/x86/mm/shadow/private.h:515:30
    pointer operation overflowed ffff82e000000000 to ffff82dfffffffe0
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d040471b2d>] F arch/x86/mm/shadow/guest_2.c#sh_page_fault__guest_2+0x1e350
        [<ffff82d0403b206b>] F svm_vmexit_handler+0xdf3/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Fix by moving the call to mfn_to_page() after the check of whether the
    passed gmfn is valid.  This avoid the call to mfn_to_page() with an
    INVALID_MFN parameter.
    
    While there make the page local variable const, it's not modified by the
    function.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/private.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index a5fc3a7676..cef9dbef2e 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -512,13 +512,14 @@ static inline unsigned long __backpointer(const struct page_info *sp)
 static inline int
 sh_mfn_is_a_page_table(mfn_t gmfn)
 {
-    struct page_info *page = mfn_to_page(gmfn);
+    const struct page_info *page;
     struct domain *owner;
     unsigned long type_info;
 
     if ( !mfn_valid(gmfn) )
         return 0;
 
+    page = mfn_to_page(gmfn);
     owner = page_get_owner(page);
     if ( owner && shadow_mode_refcounts(owner)
          && (page->count_info & PGC_shadowed_pt) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 11:33:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 11:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921882.1325612 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvE9q-0006fo-GW; Thu, 20 Mar 2025 11:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921882.1325612; Thu, 20 Mar 2025 11:33:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvE9q-0006fg-Di; Thu, 20 Mar 2025 11:33:54 +0000
Received: by outflank-mailman (input) for mailman id 921882;
 Thu, 20 Mar 2025 11:33:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvE9p-0006fU-2k
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 11:33:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE9p-00ExJh-0v
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE9p-009b7p-02
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:33:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C6eUmzr+jDUW4VPiUhRjo2gZD08wBiCn4QxNj2vmCqg=; b=vLJeOVZ6i+69yX/ZJxJjd/elL1
	0ikdHCi/7mzzP8XCMMUZtfOaSL8iXvIeHaes1NTjUiPv3OezpelXNaJbmcKbG+IgJ05V+hVVEm/Kn
	PY5eIXPfaCFXtqJ+zJ6z1cFoskSy4DT+LYuvsXvBThCQ8Mt3nDXLM81Va7XSSClindlI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/cirrus-ci: add timestamps
Message-Id: <E1tvE9p-009b7p-02@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 11:33:53 +0000

commit 1256159f3cfcfef475b94dda39f68a85702bba64
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 11:44:45 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    automation/cirrus-ci: add timestamps
    
    Such timestamps can still be disabled from the Web UI using a tick box.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index 1a39f5026f..aa195ba370 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -14,6 +14,7 @@ freebsd_template: &FREEBSD_ENV
     APPEND_LIB: /usr/local/lib
     APPEND_INCLUDES: /usr/local/include
     CIRRUS_CLONE_DEPTH: 1
+    CIRRUS_LOG_TIMESTAMP: true
 
 freebsd_artifacts: &FREEBSD_ARTIFACTS
   always:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 11:34:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 11:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921883.1325617 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEA0-0006in-Jb; Thu, 20 Mar 2025 11:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921883.1325617; Thu, 20 Mar 2025 11:34:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEA0-0006if-GU; Thu, 20 Mar 2025 11:34:04 +0000
Received: by outflank-mailman (input) for mailman id 921883;
 Thu, 20 Mar 2025 11:34:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvE9z-0006iS-5Y
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 11:34:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE9z-00ExJw-1C
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvE9z-009b9X-0L
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:34:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eiEhAJYxUFDWm1WcciQOt+smiv+mfDXxvyKNFI7yqnQ=; b=qBnVciYgcWAtNDltUDqg4YOYhW
	h5E+GqTiyTyYscQY+czlfixXRJMjbgZIwSN1XZb/GgisWrZQwMr6D2f/DvP4hGMH00e78+dv7tGMR
	qdjjlKMHVsU+5gFEUCwgo63CZSdZTngisWkF57KLGOhycUMckMTdOxAwggL/BrIjSo+c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/cirrus-ci: update FreeBSD to 13.5
Message-Id: <E1tvE9z-009b9X-0L@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 11:34:03 +0000

commit 5395cd7b892daf11cd80e4eec0cfa45c4b319d35
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 11:49:28 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    automation/cirrus-ci: update FreeBSD to 13.5
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index aa195ba370..ce7588b7b6 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1,7 +1,7 @@
 # https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
 freebsd_13: &FREEBSD_13
   freebsd_instance:
-    image_family: freebsd-13-4
+    image_family: freebsd-13-5
 freebsd_14: &FREEBSD_14
   freebsd_instance:
     image_family: freebsd-14-2
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 11:34:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 11:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921885.1325620 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEAA-0006lZ-KP; Thu, 20 Mar 2025 11:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921885.1325620; Thu, 20 Mar 2025 11:34:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEAA-0006lR-Ht; Thu, 20 Mar 2025 11:34:14 +0000
Received: by outflank-mailman (input) for mailman id 921885;
 Thu, 20 Mar 2025 11:34:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEA9-0006lH-7t
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 11:34:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEA9-00ExK2-1S
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEA9-009bAu-0c
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:34:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yOSho8armtdjZPuRlOO9adrXdL03QvGgPU4sDoUohiQ=; b=BiYazZbptelYOBI3qrWzU1tHPW
	OG9vePhHbZrwiyFqlxP4e4DHMiwmas54XxaQqnXJXtyf89OcIzLbZ5DATr58jjfgKcjafRod7yi+s
	j3DfqB68n5MEkdb5YjocyYnrDavFoIqRjuj4oYOUizzhWmtaSB9nvTKMXruSEtFW/ZQc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/cirrus-ci: store Xen Kconfig before doing a build
Message-Id: <E1tvEA9-009bAu-0c@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 11:34:13 +0000

commit 421c2bd58f35ede865fa81c82957ca5297e903a4
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 11:55:48 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    automation/cirrus-ci: store Xen Kconfig before doing a build
    
    In case the build fails or gets stuck, store the Kconfig file ahead of
    starting the build.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index ce7588b7b6..490f214f04 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -16,7 +16,7 @@ freebsd_template: &FREEBSD_ENV
     CIRRUS_CLONE_DEPTH: 1
     CIRRUS_LOG_TIMESTAMP: true
 
-freebsd_artifacts: &FREEBSD_ARTIFACTS
+freebsd_configure_artifacts: &FREEBSD_CONFIGURE_ARTIFACTS
   always:
     rename_script:
       - cp xen/.config xen-config
@@ -32,25 +32,30 @@ freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
                                  yajl lzo2 pixman argp-standalone
                                  libxml2 glib git python3
 
-  build_script:
+  configure_script:
     - cc --version
     - ./configure --with-system-seabios=/usr/local/share/seabios/bios.bin
-    - gmake -j`sysctl -n hw.ncpu` clang=y
+    - gmake -j`sysctl -n hw.ncpu` -C xen clang=y defconfig
+
+  << : *FREEBSD_CONFIGURE_ARTIFACTS
 
-  << : *FREEBSD_ARTIFACTS
+  build_script:
+    - gmake -j`sysctl -n hw.ncpu` clang=y
 
 freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
   << : *FREEBSD_ENV
 
   install_script: pkg install -y gmake python3 bison
 
-  build_script:
+  configure_script:
     - cc --version
     - gmake -j`sysctl -n hw.ncpu` -C xen clang=y \
             KCONFIG_ALLCONFIG=tools/kconfig/allrandom.config randconfig
-    - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
 
-  << : *FREEBSD_ARTIFACTS
+  << : *FREEBSD_CONFIGURE_ARTIFACTS
+
+  build_script:
+    - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
 
 task:
   name: 'FreeBSD 13: full build'
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 11:34:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 11:34:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921886.1325625 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEAK-0006nu-M0; Thu, 20 Mar 2025 11:34:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921886.1325625; Thu, 20 Mar 2025 11:34:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEAK-0006nm-JV; Thu, 20 Mar 2025 11:34:24 +0000
Received: by outflank-mailman (input) for mailman id 921886;
 Thu, 20 Mar 2025 11:34:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEAJ-0006nU-Ad
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 11:34:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEAJ-00ExK6-1j
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEAJ-009bBm-0s
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:34:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7b3YGtrhAM52VYCUbCdKQWkLTBHrKsKlhw8z+5pMt3g=; b=eFyHtnqT7Xzbd4PekUdHsBgFQA
	Lepoi+3M5qGD0zOPAvSraHCO0XAzYyNWS447/+8j0Ael/I/3aFeuluDh41DRg4LK8t4Rhiw8exdpC
	sTstsPRdpRAxriIfVKLBcyT6sNS72+DxtpwT1qXIlIAKc0RwmlDpECITwL2OwjBskZMg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/console.exp: do not assume expect is always at /usr/bin/
Message-Id: <E1tvEAJ-009bBm-0s@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 11:34:23 +0000

commit c6867d134eeb3aefcecf022f4ab20c325701ef30
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 17 10:31:07 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    automation/console.exp: do not assume expect is always at /usr/bin/
    
    Instead use env to find the location of expect.
    
    Additionally do not use the -f flag, as it's only meaningful when passing
    arguments on the command line, which we never do for console.exp.  From the
    expect 5.45.4 man page:
    
    > The -f flag prefaces a file from which to read commands from.  The flag
    > itself is optional as it is only useful when using the #! notation (see
    > above), so  that other arguments may be supplied on the command line.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/console.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/scripts/console.exp b/automation/scripts/console.exp
index 310543c33e..31ce97b91b 100755
--- a/automation/scripts/console.exp
+++ b/automation/scripts/console.exp
@@ -1,4 +1,4 @@
-#!/usr/bin/expect -f
+#!/usr/bin/env expect
 
 if {[info exists env(TEST_TIMEOUT_OVERRIDE)]} {
     set timeout $env(TEST_TIMEOUT_OVERRIDE)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 11:34:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 11:34:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921887.1325628 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEAU-0006qM-NK; Thu, 20 Mar 2025 11:34:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921887.1325628; Thu, 20 Mar 2025 11:34:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEAU-0006qE-Kk; Thu, 20 Mar 2025 11:34:34 +0000
Received: by outflank-mailman (input) for mailman id 921887;
 Thu, 20 Mar 2025 11:34:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEAT-0006q1-D9
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 11:34:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEAT-00ExKA-1z
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEAT-009bCo-18
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:34:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iJfJJdnXDUT9H8XovFDlrg1asdDnIRvKjJhNCxf+Yqw=; b=PgSQzWtxUFLNLtj/63KYKrdFwQ
	ciX2y+/8HGwo3D47iQG/x/5/JWya5LClQy1ThDw7u6Cf1kYU1Hbc/QPxYIJWIHhioZB1rwPkQFRhp
	BGt77uvpSXOd7luSQ5k27Z0TncMKocFLOphPhDo1qwDetRmN1ZeOQeQCHSyqAT0S7h+o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: clarify comment about trampoline_setup usage
Message-Id: <E1tvEAT-009bCo-18@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 11:34:33 +0000

commit ca6080f290d2e83715884b60d1233cd5b4e68ca0
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 4 15:28:11 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    x86/boot: clarify comment about trampoline_setup usage
    
    Clarify that trampoline_setup is only used for EFI when booted using the
    multiboot2 entry point.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/head.S | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 1b3bd16fe5..81473578fe 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -504,9 +504,7 @@ trampoline_bios_setup:
         mov     %ecx,sym_esi(trampoline_phys)
 
 trampoline_setup:
-        /*
-         * Called on legacy BIOS and EFI platforms.
-         */
+        /* Called for Mutiboot entry, including MB2+EFI. */
 
         /* Save Xen image load base address for later use. */
         mov     %esi, sym_esi(xen_phys_start)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 11:34:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 11:34:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921888.1325633 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEAe-0006si-Oh; Thu, 20 Mar 2025 11:34:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921888.1325633; Thu, 20 Mar 2025 11:34:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEAe-0006sZ-M8; Thu, 20 Mar 2025 11:34:44 +0000
Received: by outflank-mailman (input) for mailman id 921888;
 Thu, 20 Mar 2025 11:34:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEAd-0006sQ-Fm
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 11:34:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEAd-00ExKG-2F
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEAd-009bDH-1O
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 11:34:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vUJmH6S+aJRJYLYNZXu6w6o45epu++kyspghHGZ3CW8=; b=44Gx54K7JP9AZmW7J7qWu2br1F
	DU0EgKGpXI+efS5B81l7P1g8ukk5Oqjb7lgjjT/yz9ocbNKXgwgSJ9YwpT9aGvqElcEXiW8hruX6A
	pDTqBf0OwLg5La/hH4UlQZzxxsxOp64cxIkD0EYduKFNGQiC9VVyWb9guLslAyoya1W8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mkelf32: account for offset when detecting note segment placement
Message-Id: <E1tvEAd-009bDH-1O@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 11:34:43 +0000

commit 6e5fed7cb67c9f84653cdbd3924b8a119ef653be
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 5 18:08:13 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    x86/mkelf32: account for offset when detecting note segment placement
    
    mkelf32 attempt to check that the program header defined NOTE segment falls
    inside of the LOAD segment, as the build-id should be loaded for Xen at
    runtime to check.
    
    However the current code doesn't take into account the LOAD program header
    segment offset when calculating overlap with the NOTE segment.  This
    results in incorrect detection, and the following build error:
    
    arch/x86/boot/mkelf32 --notes xen-syms ./.xen.elf32 0x200000 \
                   `nm xen-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$/0x\1/p'`
    Expected .note section within .text section!
    Offset 4244776 not within 2910364!
    
    When xen-syms has the following program headers:
    
    Program Header:
        LOAD off    0x0000000000200000 vaddr 0xffff82d040200000 paddr 0x0000000000200000 align 2**21
             filesz 0x00000000002c689c memsz 0x00000000003f7e20 flags rwx
        NOTE off    0x000000000040c528 vaddr 0xffff82d04040c528 paddr 0x000000000040c528 align 2**2
             filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
    
    Account for the program header offset of the LOAD segment when checking
    whether the NOTE segments is contained within.  Also fix the logic to
    ensure the NOTE segments is fully contained between the LOAD segment.
    
    Fixes: a353cab905af ('build_id: Provide ld-embedded build-ids')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/mkelf32.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 5f9e7e440e..f0f406687c 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -358,11 +358,13 @@ int main(int argc, char **argv)
         note_sz = in64_phdr.p_memsz;
         note_base = in64_phdr.p_vaddr - note_base;
 
-        if ( in64_phdr.p_offset > dat_siz || offset > in64_phdr.p_offset )
+        if ( in64_phdr.p_offset < offset ||
+             in64_phdr.p_offset + in64_phdr.p_filesz > offset + dat_siz )
         {
             fprintf(stderr, "Expected .note section within .text section!\n" \
-                    "Offset %"PRId64" not within %d!\n",
-                    in64_phdr.p_offset, dat_siz);
+                    ".note: [%"PRIx64", %"PRIx64") .text: [%x, %x)\n",
+                    in64_phdr.p_offset, in64_phdr.p_offset + in64_phdr.p_filesz,
+                    offset, offset + dat_siz);
             return 1;
         }
         /* Gets us the absolute offset within the .text section. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:00:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921897.1325636 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEZA-0003OR-Ni; Thu, 20 Mar 2025 12:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921897.1325636; Thu, 20 Mar 2025 12:00:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEZA-0003O3-Ky; Thu, 20 Mar 2025 12:00:04 +0000
Received: by outflank-mailman (input) for mailman id 921897;
 Thu, 20 Mar 2025 12:00:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEZ9-00031f-1Z
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:00:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEZ8-00Exvn-2u
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEZ8-009dlb-22
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CF5GlOdKbqFiPRQM7U7mC+Ou6EkYL11UQg/Hqzr2xHo=; b=EyCH7eRZVbQyc0cdjVUvZEzRaB
	/lJdkivqHzbaFm3n8mX15g+L83PBkYCZPcxsJB9MQQIbZJG890IcuQ8c1Lh3MwfgS1dgRYppkkqOD
	6EXgGt+3/dpY+Nh3yU3EJ5VzaPp/wsI1VTtXbVSaf7aSgg5ud7skNm8WIVjBgj7Q7qIU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] update Xen version to 4.20.1-pre
Message-Id: <E1tvEZ8-009dlb-22@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:00:02 +0000

commit 9d465658b4052b4460995dca4ecb33ecb3d20ab5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 20 12:46:52 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:46:52 2025 +0100

    update Xen version to 4.20.1-pre
---
 Config.mk    |   2 --
 MAINTAINERS  | 106 +++++------------------------------------------------------
 xen/Makefile |   2 +-
 3 files changed, 10 insertions(+), 100 deletions(-)

diff --git a/Config.mk b/Config.mk
index 1a86c03d11..74e57aebda 100644
--- a/Config.mk
+++ b/Config.mk
@@ -242,8 +242,6 @@ ETHERBOOT_NICS ?= rtl8139 8086100e
 
 QEMU_TRADITIONAL_URL ?= https://xenbits.xen.org/git-http/qemu-xen-traditional.git
 QEMU_TRADITIONAL_REVISION ?= xen-4.20.0
-# Wed Jul 15 10:01:40 2020 +0100
-# qemu-trad: remove Xen path dependencies
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/MAINTAINERS b/MAINTAINERS
index c11b82eca9..87ff7ad190 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -54,6 +54,15 @@ list. Remember to copy the appropriate stable branch maintainer who
 will be listed in this section of the MAINTAINERS file in the
 appropriate branch.
 
+The maintainer for this branch is:
+
+	Jan Beulich <jbeulich@suse.com>
+
+Tools backport requests should also be copied to:
+
+       Anthony Perard <anthony.perard@vates.tech>
+
+
 	Unstable Subsystem Maintainers
 	==============================
 
@@ -104,103 +113,6 @@ Descriptions of section entries:
 	   xen-maintainers-<version format number of this file>
 
 
-	Check-in policy
-	===============
-
-In order for a patch to be checked in, in general, several conditions
-must be met:
-
-1. In order to get a change to a given file committed, it must have
-   the approval of at least one maintainer of that file.
-
-   A patch of course needs Acks from the maintainers of each file that
-   it changes; so a patch which changes xen/arch/x86/traps.c,
-   xen/arch/x86/mm/p2m.c, and xen/arch/x86/mm/shadow/multi.c would
-   require an Ack from each of the three sets of maintainers.
-
-   See below for rules on nested maintainership.
-
-2. Each change must have appropriate approval from someone other than
-   the person who wrote it.  This can be either:
-
-  a. An Acked-by from a maintainer of the code being touched (a
-     co-maintainer if available, or a more general level maintainer if
-     not available; see the secton on nested maintainership)
-
-  b. A Reviewed-by by anyone of suitable stature in the community
-
-3. Sufficient time must have been given for anyone to respond.  This
-   depends in large part upon the urgency and nature of the patch.
-   For a straightforward uncontroversial patch, a day or two may be
-   sufficient; for a controversial patch, a week or two may be better.
-
-4. There must be no "open" objections.
-
-In a case where one person submits a patch and a maintainer gives an
-Ack, the Ack stands in for both the approval requirement (#1) and the
-Acked-by-non-submitter requirement (#2).
-
-In a case where a maintainer themselves submits a patch, the
-Signed-off-by meets the approval requirement (#1); so a Review
-from anyone in the community suffices for requirement #2.
-
-Before a maintainer checks in their own patch with another community
-member's R-b but no co-maintainer Ack, it is especially important to
-give their co-maintainer opportunity to give feedback, perhaps
-declaring their intention to check it in without their co-maintainers
-ack a day before doing so.
-
-In the case where two people collaborate on a patch, at least one of
-whom is a maintainer -- typically where one maintainer will do an
-early version of the patch, and another maintainer will pick it up and
-revise it -- there should be two Signed-off-by's and one Acked-by or
-Reviewed-by; with the maintainer who did the most recent change
-sending the patch, and an Acked-by or Reviewed-by coming from the
-maintainer who did not most recently edit the patch.  This satisfies
-the requirement #2 because a) the Signed-off-by of the sender approves
-the final version of the patch; including all parts of the patch that
-the sender did not write b) the Reviewed-by approves the final version
-of the patch, including all patches that the reviewer did not write.
-Thus all code in the patch has been approved by someone who did not
-write it.
-
-Maintainers may choose to override non-maintainer objections in the
-case that consensus can't be reached.
-
-As always, no policy can cover all possible situations.  In
-exceptional circumstances, committers may commit a patch in absence of
-one or more of the above requirements, if they are reasonably
-confident that the other maintainers will approve of their decision in
-retrospect.
-
-       The meaning of nesting
-       ======================
-
-Many maintainership areas are "nested": for example, there are entries
-for xen/arch/x86 as well as xen/arch/x86/mm, and even
-xen/arch/x86/mm/shadow; and there is a section at the end called "THE
-REST" which lists all committers.  The meaning of nesting is that:
-
-1. Under normal circumstances, the Ack of the most specific maintainer
-is both necessary and sufficient to get a change to a given file
-committed.  So a change to xen/arch/x86/mm/shadow/multi.c requires the
-the Ack of the xen/arch/x86/mm/shadow maintainer for that part of the
-patch, but would not require the Ack of the xen/arch/x86 maintainer or
-the xen/arch/x86/mm maintainer.
-
-2. In unusual circumstances, a more general maintainer's Ack can stand
-in for or even overrule a specific maintainer's Ack.  Unusual
-circumstances might include:
- - The patch is fixing a high-priority issue causing immediate pain,
- and the more specific maintainer is not available.
- - The more specific maintainer has not responded either to the
- original patch, nor to "pings", within a reasonable amount of time.
- - The more general maintainer wants to overrule the more specific
- maintainer on some issue. (This should be exceptional.)
- - In the case of a disagreement between maintainers, THE REST can
- settle the matter by majority vote.  (This should be very exceptional
- indeed.)
-
 
 Maintainers List (try to look for most precise areas first)
 
diff --git a/xen/Makefile b/xen/Makefile
index 6bf0b0ea9e..7fa1b67487 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -6,7 +6,7 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 20
-export XEN_EXTRAVERSION ?= .0$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:00:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921900.1325641 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEZK-0003pS-PH; Thu, 20 Mar 2025 12:00:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921900.1325641; Thu, 20 Mar 2025 12:00:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEZK-0003pL-Mb; Thu, 20 Mar 2025 12:00:14 +0000
Received: by outflank-mailman (input) for mailman id 921900;
 Thu, 20 Mar 2025 12:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEZI-0003p0-PG
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEZI-00Exvw-3C
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEZI-009dmo-2L
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lfrUbFCbiNUAKs+KxuyA42kn1ZL47VEkuRhFL+Ano8k=; b=qb+mqR2ePo3mkkrhg3kOWKrXnW
	71CMcOEX8tbAbo1MSUN0DoN3GtuvXAQFgKM1cV/5sergYLM1G8QSnMJohpkhcu6GPQqZ46hye4hzt
	GwZnZ0ZSw6WBUuMe4h56f9IWSxZswdGDmQBOT47nrIcAleUQgqHxyFuKMsEWVSbsSpMs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/emul: dump unhandled memory accesses for PVH dom0
Message-Id: <E1tvEZI-009dmo-2L@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:00:12 +0000

commit 48f013199a768c6204125028f09255d20c8e99fa
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:48:32 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:48:32 2025 +0100

    x86/emul: dump unhandled memory accesses for PVH dom0
    
    A PV dom0 can map any host memory as long as it's allowed by the IO
    capability range in d->iomem_caps.  On the other hand, a PVH dom0 has no
    way to populate MMIO region onto it's p2m, so it's limited to what Xen
    initially populates on the p2m based on the host memory map and the enabled
    device BARs.
    
    Introduce a new debug build only printk that reports attempts by dom0 to
    access addresses not populated on the p2m, and not handled by any emulator.
    This is for information purposes only, but might allow getting an idea of
    what MMIO ranges might be missing on the p2m.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 43d8a80a0cccfe3715bb3178b5c15fb983979651
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/hvm/emulate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 0d90cc4598..08b9493e6d 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -337,6 +337,9 @@ static int hvmemul_do_io(
         /* If there is no suitable backing DM, just ignore accesses */
         if ( !s )
         {
+            if ( is_mmio && is_hardware_domain(currd) )
+                gdprintk(XENLOG_DEBUG, "unhandled memory %s %#lx size %u\n",
+                         dir ? "read from" : "write to", addr, size);
             rc = hvm_process_io_intercept(&null_handler, &p);
             vio->req.state = STATE_IOREQ_NONE;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:00:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921901.1325645 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEZU-0003sQ-Qk; Thu, 20 Mar 2025 12:00:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921901.1325645; Thu, 20 Mar 2025 12:00:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEZU-0003sI-O9; Thu, 20 Mar 2025 12:00:24 +0000
Received: by outflank-mailman (input) for mailman id 921901;
 Thu, 20 Mar 2025 12:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEZS-0003s9-Tc
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEZT-00Exw5-0K
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEZS-009do7-2d
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kQLg87sINkmzLC/0u6sJkw+VaLfna1UMQJ+EugtXBGY=; b=n1Gv1V1S82sGlF+u5WuWmqN1qV
	LirPQwiPtdYLcb+KAQhbNpDLMmuhvbUSYPyUYIxMOERXvuX2gzzq48AoFTpKMCpCjN85YPQfeeGkS
	Sq6tMRP5D116U/vIjWKnZnJZba1vObx7ku2M1NUCpRlNRfMou4fjA8c5tWGIgn7IBOws=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/dom0: attempt to fixup p2m page-faults for PVH dom0
Message-Id: <E1tvEZS-009do7-2d@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:00:22 +0000

commit b5ade8ef267d09677d489e4fea209a4090aa6239
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:48:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:48:51 2025 +0100

    x86/dom0: attempt to fixup p2m page-faults for PVH dom0
    
    When building a PVH dom0 Xen attempts to map all (relevant) MMIO regions
    into the p2m for dom0 access.  However the information Xen has about the
    host memory map is limited.  Xen doesn't have access to any resources
    described in ACPI dynamic tables, and hence the p2m mappings provided might
    not be complete.
    
    PV doesn't suffer from this issue because a PV dom0 is capable of mapping
    into it's page-tables any address not explicitly banned in d->iomem_caps.
    
    Introduce a new command line options that allows Xen to attempt to fixup
    the p2m page-faults, by creating p2m identity maps in response to p2m
    page-faults.
    
    This is aimed as a workaround to small ACPI regions Xen doesn't know about.
    Note that missing large MMIO regions mapped in this way will lead to
    slowness due to the VM exit processing, plus the mappings will always use
    small pages.
    
    The ultimate aim is to attempt to bring better parity with a classic PV
    dom0.
    
    Note such fixup rely on the CPU doing the access to the unpopulated
    address.  If the access is attempted from a device instead there's no
    possible way to fixup, as IOMMU page-fault are asynchronous.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    master commit: 104591f5dd675d7bfb04885dace0e4e5a097fc1e
    master date: 2025-03-05 10:26:46 +0100
---
 CHANGELOG.md                           |  6 +++
 docs/misc/xen-command-line.pandoc      | 16 +++++++-
 xen/arch/x86/dom0_build.c              |  5 +++
 xen/arch/x86/hvm/emulate.c             | 74 +++++++++++++++++++++++++++++++++-
 xen/arch/x86/include/asm/hvm/emulate.h |  3 ++
 5 files changed, 101 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2b9ba49225..d098e7c5ac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
+## [4.20.1](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.20.1)
+
+### Added
+ - On x86:
+   - Option to attempt to fixup p2m page-faults on PVH dom0.
+
 ## [4.20.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.20.0) - 2025-03-05
 
 ### Changed
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 9bbd00baef..83bb69cfb8 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -822,7 +822,8 @@ Specify the bit width of the DMA heap.
 
 ### dom0
     = List of [ pv | pvh, shadow=<bool>, verbose=<bool>,
-                cpuid-faulting=<bool>, msr-relaxed=<bool> ] (x86)
+                cpuid-faulting=<bool>, msr-relaxed=<bool>,
+                pf-fixup=<bool> ] (x86)
 
     = List of [ sve=<integer> ] (Arm64)
 
@@ -883,6 +884,19 @@ Controls for how dom0 is constructed on x86 systems.
 
     If using this option is necessary to fix an issue, please report a bug.
 
+*   The `pf-fixup` boolean is only applicable when using a PVH dom0 and
+    defaults to false.
+
+    When running dom0 in PVH mode the dom0 kernel has no way to map MMIO
+    regions into its physical memory map, such mode relies on Xen dom0 builder
+    populating the physical memory map with all MMIO regions that dom0 should
+    access.  However Xen doesn't have a complete picture of the host memory
+    map, due to not being able to process ACPI dynamic tables.
+
+    The `pf-fixup` option allows Xen to attempt to add missing MMIO regions
+    to the dom0 physical memory map in response to page-faults generated by
+    dom0 trying to access unpopulated entries in the memory map.
+
 Enables features on dom0 on Arm systems.
 
 *   The `sve` integer parameter enables Arm SVE usage for Dom0 and sets the
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index e8f5bf5447..3b9681dc91 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -16,6 +16,7 @@
 #include <asm/dom0_build.h>
 #include <asm/guest.h>
 #include <asm/hpet.h>
+#include <asm/hvm/emulate.h>
 #include <asm/io-ports.h>
 #include <asm/io_apic.h>
 #include <asm/p2m.h>
@@ -286,6 +287,10 @@ int __init parse_arch_dom0_param(const char *s, const char *e)
         opt_dom0_cpuid_faulting = val;
     else if ( (val = parse_boolean("msr-relaxed", s, e)) >= 0 )
         opt_dom0_msr_relaxed = val;
+#ifdef CONFIG_HVM
+    else if ( (val = parse_boolean("pf-fixup", s, e)) >= 0 )
+        opt_dom0_pf_fixup = val;
+#endif
     else
         return -EINVAL;
 
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 08b9493e6d..3cd7f2e22f 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -10,12 +10,15 @@
  */
 
 #include <xen/init.h>
+#include <xen/iocap.h>
 #include <xen/ioreq.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <xen/paging.h>
 #include <xen/trace.h>
 #include <xen/vm_event.h>
+
+#include <asm/altp2m.h>
 #include <asm/event.h>
 #include <asm/i387.h>
 #include <asm/xstate.h>
@@ -161,6 +164,36 @@ void hvmemul_cancel(struct vcpu *v)
     hvmemul_cache_disable(v);
 }
 
+bool __ro_after_init opt_dom0_pf_fixup;
+static int hwdom_fixup_p2m(paddr_t addr)
+{
+    unsigned long gfn = paddr_to_pfn(addr);
+    struct domain *currd = current->domain;
+    p2m_type_t type;
+    mfn_t mfn;
+    int rc;
+
+    ASSERT(is_hardware_domain(currd));
+    ASSERT(!altp2m_active(currd));
+
+    /*
+     * Fixups are only applied for MMIO holes, and rely on the hardware domain
+     * having identity mappings for non RAM regions (gfn == mfn).
+     */
+    if ( !iomem_access_permitted(currd, gfn, gfn) ||
+         !is_memory_hole(_mfn(gfn), _mfn(gfn)) )
+        return -EPERM;
+
+    mfn = get_gfn(currd, gfn, &type);
+    if ( !mfn_eq(mfn, INVALID_MFN) || !p2m_is_hole(type) )
+        rc = mfn_eq(mfn, _mfn(gfn)) ? -EEXIST : -ENOTEMPTY;
+    else
+        rc = set_mmio_p2m_entry(currd, _gfn(gfn), _mfn(gfn), 0);
+    put_gfn(currd, gfn);
+
+    return rc;
+}
+
 static int hvmemul_do_io(
     bool is_mmio, paddr_t addr, unsigned long *reps, unsigned int size,
     uint8_t dir, bool df, bool data_is_addr, uintptr_t data)
@@ -338,8 +371,45 @@ static int hvmemul_do_io(
         if ( !s )
         {
             if ( is_mmio && is_hardware_domain(currd) )
-                gdprintk(XENLOG_DEBUG, "unhandled memory %s %#lx size %u\n",
-                         dir ? "read from" : "write to", addr, size);
+            {
+                /*
+                 * PVH dom0 is likely missing MMIO mappings on the p2m, due to
+                 * the incomplete information Xen has about the memory layout.
+                 *
+                 * Either print a message to note dom0 attempted to access an
+                 * unpopulated GPA, or try to fixup the p2m by creating an
+                 * identity mapping for the faulting GPA.
+                 */
+                if ( opt_dom0_pf_fixup )
+                {
+                    int inner_rc = hwdom_fixup_p2m(addr);
+
+                    if ( !inner_rc || inner_rc == -EEXIST )
+                    {
+                        if ( !inner_rc )
+                            gdprintk(XENLOG_DEBUG,
+                                     "fixup p2m mapping for page %lx added\n",
+                                     paddr_to_pfn(addr));
+                        else
+                            gprintk(XENLOG_INFO,
+                                    "fixup p2m mapping for page %lx already present\n",
+                                    paddr_to_pfn(addr));
+
+                        rc = X86EMUL_RETRY;
+                        vio->req.state = STATE_IOREQ_NONE;
+                        break;
+                    }
+
+                    gprintk(XENLOG_WARNING,
+                            "unable to fixup memory %s %#lx size %u: %d\n",
+                            dir ? "read from" : "write to", addr, size,
+                            inner_rc);
+                }
+                else
+                    gdprintk(XENLOG_DEBUG,
+                             "unhandled memory %s %#lx size %u\n",
+                             dir ? "read from" : "write to", addr, size);
+            }
             rc = hvm_process_io_intercept(&null_handler, &p);
             vio->req.state = STATE_IOREQ_NONE;
         }
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index 45b03e4e37..d61eacfaa7 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -148,6 +148,9 @@ static inline void hvmemul_write_cache(const struct vcpu *v, paddr_t gpa,
 void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
                               struct hvm_emulate_ctxt *hvmemul_ctxt, int rc);
 
+/* For PVH dom0: signal whether to attempt fixup of p2m page-faults. */
+extern bool opt_dom0_pf_fixup;
+
 #endif /* __ASM_X86_HVM_EMULATE_H__ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:00:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:00:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921903.1325649 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEZe-00045e-SD; Thu, 20 Mar 2025 12:00:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921903.1325649; Thu, 20 Mar 2025 12:00:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEZe-00045W-Pc; Thu, 20 Mar 2025 12:00:34 +0000
Received: by outflank-mailman (input) for mailman id 921903;
 Thu, 20 Mar 2025 12:00:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEZd-0003zf-00
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:00:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEZd-00ExwA-0c
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEZc-009dok-2y
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=W+g/lNKoH5GLoDKs+9JEreBoeL/P175rjbnxXvoFM7s=; b=rE1vKfSDTAr8IfNa6hhj/bAszB
	bAfHaoqRnpzPMkLH8Nmga7pefd6Zojf+UKIwuM9fXwVvhwHN2DfSTMqC4x8U8H0RNWs4uZ7emlliH
	3hEBtiaJEU0sZxBswigSOMrJPTnGscwaV2LDAxgs0uXihvkQlBceBeVwOExqUGYGq7vU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
Message-Id: <E1tvEZc-009dok-2y@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:00:32 +0000

commit 1d8d5753b75c07a527abcfe3665f54582e6c2bd0
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:49:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:49:12 2025 +0100

    x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
    
    The logic in dom0_setup_permissions() sets the maximum bound in
    ->iomem_caps unconditionally using paddr_bits, which is not correct for HVM
    based domains.  Instead use domain_max_paddr_bits() to get the correct
    maximum paddr bits for each possible domain type.
    
    Switch to using PFN_DOWN() instead of PAGE_SHIFT, as that's shorter.
    
    Fixes: 53de839fb409 ('x86: constrain MFN range Dom0 may access')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a00e08799cc7657d2a1aca158f4ad43d4c9103e7
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 3b9681dc91..aec596997d 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -481,7 +481,8 @@ int __init dom0_setup_permissions(struct domain *d)
 
     /* The hardware domain is initially permitted full I/O capabilities. */
     rc = ioports_permit_access(d, 0, 0xFFFF);
-    rc |= iomem_permit_access(d, 0UL, (1UL << (paddr_bits - PAGE_SHIFT)) - 1);
+    rc |= iomem_permit_access(d, 0UL,
+                              PFN_DOWN(1UL << domain_max_paddr_bits(d)) - 1);
     rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
 
     /* Modify I/O port access permissions. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:00:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921905.1325653 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEZn-0004PX-TW; Thu, 20 Mar 2025 12:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921905.1325653; Thu, 20 Mar 2025 12:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEZn-0004PP-Qu; Thu, 20 Mar 2025 12:00:43 +0000
Received: by outflank-mailman (input) for mailman id 921905;
 Thu, 20 Mar 2025 12:00:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEZn-0004MH-2r
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:00:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEZn-00ExwJ-0w
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:00:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEZn-009dpv-03
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:00:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fWgj5mseHZRghYoQ0AzNIU4VMZCqrPsjGwCpI63GWGE=; b=yNWpMQOsrlELaoxFM51ziSYhov
	wjW+UdXP8MjKZqTN+4kDx5Kq9hse1wYXXQly1jQl49tx5Ig0gyChjryUrW9vbsQ0/s+7Uk8JlaoZX
	IQz6qbc/nzhZ2kf1i3oSAHeTnXq6KvmEIHLzXOHWWqYt1yYbYxJi9xf/4RK7DjoU1rF4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/iommu: account for IOMEM caps when populating dom0 IOMMU page-tables
Message-Id: <E1tvEZn-009dpv-03@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:00:43 +0000

commit a1a5bd40b5e1238fe51df79419471fb6b160cc5b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:49:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:49:30 2025 +0100

    x86/iommu: account for IOMEM caps when populating dom0 IOMMU page-tables
    
    The current code in arch_iommu_hwdom_init() kind of open-codes the same
    MMIO permission ranges that are added to the hardware domain ->iomem_caps.
    Avoid this duplication and use ->iomem_caps in arch_iommu_hwdom_init() to
    filter which memory regions should be added to the dom0 IOMMU page-tables.
    
    Note the IO-APIC and MCFG page(s) must be set as not accessible for a PVH
    dom0, otherwise the internal Xen emulation for those ranges won't work.
    This requires adjustments in dom0_setup_permissions().
    
    The call to pvh_setup_mmcfg() in dom0_construct_pvh() must now strictly be
    done ahead of setting up dom0 permissions, so take the opportunity to also
    put it inside the existing is_hardware_domain() region.
    
    Also the special casing of E820_UNUSABLE regions no longer needs to be done
    in arch_iommu_hwdom_init(), as those regions are already blocked in
    ->iomem_caps and thus would be removed from the rangeset as part of
    ->iomem_caps processing in arch_iommu_hwdom_init().  The E820_UNUSABLE
    regions below 1Mb are not removed from ->iomem_caps, that's a slight
    difference for the IOMMU created page-tables, but the aim is to allow
    access to the same memory either from the CPU or the IOMMU page-tables.
    
    Since ->iomem_caps already takes into account the domain max paddr, there's
    no need to remove any regions past the last address addressable by the
    domain, as applying ->iomem_caps would have already taken care of that.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62f3fc5296c452285e81adb50976bde2d68d3181
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c           | 11 +++++-
 xen/arch/x86/hvm/dom0_build.c       | 14 ++++----
 xen/arch/x86/hvm/io.c               |  6 ++--
 xen/arch/x86/include/asm/hvm/io.h   |  4 +--
 xen/drivers/passthrough/x86/iommu.c | 67 +++++++++++++++----------------------
 5 files changed, 49 insertions(+), 53 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index aec596997d..a735e3650c 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -558,7 +558,9 @@ int __init dom0_setup_permissions(struct domain *d)
     for ( i = 0; i < nr_ioapics; i++ )
     {
         mfn = paddr_to_pfn(mp_ioapics[i].mpc_apicaddr);
-        if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
+        /* If emulating IO-APIC(s) make sure the base address is unmapped. */
+        if ( has_vioapic(d) ||
+             !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
     /* MSI range. */
@@ -599,6 +601,13 @@ int __init dom0_setup_permissions(struct domain *d)
             rc |= rangeset_add_singleton(mmio_ro_ranges, mfn);
     }
 
+    if ( has_vpci(d) )
+        /*
+         * TODO: runtime added MMCFG regions are not checked to make sure they
+         * don't overlap with already mapped regions, thus preventing trapping.
+         */
+        rc |= vpci_mmcfg_deny_access(d);
+
     return rc;
 }
 
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index ce5b5c31b3..6a4453103a 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1323,6 +1323,13 @@ int __init dom0_construct_pvh(struct boot_info *bi, struct domain *d)
 
     if ( is_hardware_domain(d) )
     {
+        /*
+         * MMCFG initialization must be performed before setting domain
+         * permissions, as the MCFG areas must not be part of the domain IOMEM
+         * accessible regions.
+         */
+        pvh_setup_mmcfg(d);
+
         /*
          * Setup permissions early so that calls to add MMIO regions to the
          * p2m as part of vPCI setup don't fail due to permission checks.
@@ -1335,13 +1342,6 @@ int __init dom0_construct_pvh(struct boot_info *bi, struct domain *d)
         }
     }
 
-    /*
-     * NB: MMCFG initialization needs to be performed before iommu
-     * initialization so the iommu code can fetch the MMCFG regions used by the
-     * domain.
-     */
-    pvh_setup_mmcfg(d);
-
     /*
      * Craft dom0 physical memory map and set the paging allocation. This must
      * be done before the iommu initializion, since iommu initialization code
diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index db726b3817..de6ee6c4dd 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -363,14 +363,14 @@ static const struct hvm_mmcfg *vpci_mmcfg_find(const struct domain *d,
     return NULL;
 }
 
-int __hwdom_init vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r)
+int __hwdom_init vpci_mmcfg_deny_access(struct domain *d)
 {
     const struct hvm_mmcfg *mmcfg;
 
     list_for_each_entry ( mmcfg, &d->arch.hvm.mmcfg_regions, next )
     {
-        int rc = rangeset_remove_range(r, PFN_DOWN(mmcfg->addr),
-                                       PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
+        int rc = iomem_deny_access(d, PFN_DOWN(mmcfg->addr),
+                                   PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
 
         if ( rc )
             return rc;
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index f2b8431fac..565bad300d 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -132,8 +132,8 @@ int register_vpci_mmcfg_handler(struct domain *d, paddr_t addr,
 /* Destroy tracked MMCFG areas. */
 void destroy_vpci_mmcfg(struct domain *d);
 
-/* Remove MMCFG regions from a given rangeset. */
-int vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r);
+/* Remove MMCFG regions from a domain ->iomem_caps. */
+int vpci_mmcfg_deny_access(struct domain *d);
 
 #endif /* __ASM_X86_HVM_IO_H__ */
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 8b1e0596b8..67f025c1ec 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -320,6 +320,26 @@ static int __hwdom_init cf_check map_subtract(unsigned long s, unsigned long e,
     return rangeset_remove_range(map, s, e);
 }
 
+struct handle_iomemcap {
+    struct rangeset *r;
+    unsigned long last;
+};
+static int __hwdom_init cf_check map_subtract_iomemcap(unsigned long s,
+                                                       unsigned long e,
+                                                       void *data)
+{
+    struct handle_iomemcap *h = data;
+    int rc = 0;
+
+    if ( h->last != s )
+        rc = rangeset_remove_range(h->r, h->last, s - 1);
+
+    ASSERT(e < ~0UL);
+    h->last = e + 1;
+
+    return rc;
+}
+
 struct map_data {
     struct domain *d;
     unsigned int flush_flags;
@@ -400,6 +420,7 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
     unsigned int i;
     struct rangeset *map;
     struct map_data map_data = { .d = d };
+    struct handle_iomemcap iomem = {};
     int rc;
 
     BUG_ON(!is_hardware_domain(d));
@@ -442,14 +463,6 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
 
         switch ( entry.type )
         {
-        case E820_UNUSABLE:
-            /* Only relevant for inclusive mode, otherwise this is a no-op. */
-            rc = rangeset_remove_range(map, PFN_DOWN(entry.addr),
-                                       PFN_DOWN(entry.addr + entry.size - 1));
-            if ( rc )
-                panic("IOMMU failed to remove unusable memory: %d\n", rc);
-            continue;
-
         case E820_RESERVED:
             if ( !iommu_hwdom_inclusive && !iommu_hwdom_reserved )
                 continue;
@@ -475,22 +488,13 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
     if ( rc )
         panic("IOMMU failed to remove Xen ranges: %d\n", rc);
 
-    /* Remove any overlap with the Interrupt Address Range. */
-    rc = rangeset_remove_range(map, 0xfee00, 0xfeeff);
+    iomem.r = map;
+    rc = rangeset_report_ranges(d->iomem_caps, 0, ~0UL, map_subtract_iomemcap,
+                                &iomem);
+    if ( !rc && iomem.last < ~0UL )
+        rc = rangeset_remove_range(map, iomem.last, ~0UL);
     if ( rc )
-        panic("IOMMU failed to remove Interrupt Address Range: %d\n", rc);
-
-    /* If emulating IO-APIC(s) make sure the base address is unmapped. */
-    if ( has_vioapic(d) )
-    {
-        for ( i = 0; i < d->arch.hvm.nr_vioapics; i++ )
-        {
-            rc = rangeset_remove_singleton(map,
-                PFN_DOWN(domain_vioapic(d, i)->base_address));
-            if ( rc )
-                panic("IOMMU failed to remove IO-APIC: %d\n", rc);
-        }
-    }
+        panic("IOMMU failed to remove forbidden regions: %d\n", rc);
 
     if ( is_pv_domain(d) )
     {
@@ -506,23 +510,6 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
             panic("IOMMU failed to remove read-only regions: %d\n", rc);
     }
 
-    if ( has_vpci(d) )
-    {
-        /*
-         * TODO: runtime added MMCFG regions are not checked to make sure they
-         * don't overlap with already mapped regions, thus preventing trapping.
-         */
-        rc = vpci_subtract_mmcfg(d, map);
-        if ( rc )
-            panic("IOMMU unable to remove MMCFG areas: %d\n", rc);
-    }
-
-    /* Remove any regions past the last address addressable by the domain. */
-    rc = rangeset_remove_range(map, PFN_DOWN(1UL << domain_max_paddr_bits(d)),
-                               ~0UL);
-    if ( rc )
-        panic("IOMMU unable to remove unaddressable ranges: %d\n", rc);
-
     if ( iommu_verbose )
         printk(XENLOG_INFO "%pd: identity mappings for IOMMU:\n", d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:00:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921906.1325656 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEZy-0004ZK-09; Thu, 20 Mar 2025 12:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921906.1325656; Thu, 20 Mar 2025 12:00:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEZx-0004ZC-Tr; Thu, 20 Mar 2025 12:00:53 +0000
Received: by outflank-mailman (input) for mailman id 921906;
 Thu, 20 Mar 2025 12:00:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEZx-0004Z6-6E
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:00:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEZx-00Ey0B-1H
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:00:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEZx-009dqQ-0M
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:00:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4+3/YwZg3++3ETJxrlcfGnXEL2UDC8umxf/nVBsb2jI=; b=Et/6G/Xxdnzll6s+a4Pu3igdTr
	1ik+Euk6pn0my868URFb6GSF6H5G88L/y5vjpi0Dg/++Jvt4Gwu2KNdzCSX559/sHsxsYCFysAmLk
	pkk3kprgvamJKONSDWTY8b9GKG2LiWGYIqVcuIJXOPpYtIwxSc/OUpQzyVX4JHBJzEWs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/dom0: be less restrictive with the Interrupt Address Range
Message-Id: <E1tvEZx-009dqQ-0M@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:00:53 +0000

commit bc3006b9fe2cd5c266d9811af4cd74e4e8e27937
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:49:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:49:57 2025 +0100

    x86/dom0: be less restrictive with the Interrupt Address Range
    
    Xen currently prevents dom0 from creating CPU or IOMMU page-table mappings
    into the interrupt address range [0xfee00000, 0xfeefffff].  This range has
    two different purposes.  For accesses from the CPU is contains the default
    position of local APIC page at 0xfee00000.  For accesses from devices
    it's the MSI address range, so the address field in the MSI entries
    (usually) point to an address on that range to trigger an interrupt.
    
    There are reports of Lenovo Thinkpad devices placing what seems to be the
    UCSI shared mailbox at address 0xfeec2000 in the interrupt address range.
    Attempting to use that device with a Linux PV dom0 leads to an error when
    Linux kernel maps 0xfeec2000:
    
    RIP: e030:xen_mc_flush+0x1e8/0x2b0
     xen_leave_lazy_mmu+0x15/0x60
     vmap_range_noflush+0x408/0x6f0
     __ioremap_caller+0x20d/0x350
     acpi_os_map_iomem+0x1a3/0x1c0
     acpi_ex_system_memory_space_handler+0x229/0x3f0
     acpi_ev_address_space_dispatch+0x17e/0x4c0
     acpi_ex_access_region+0x28a/0x510
     acpi_ex_field_datum_io+0x95/0x5c0
     acpi_ex_extract_from_field+0x36b/0x4e0
     acpi_ex_read_data_from_field+0xcb/0x430
     acpi_ex_resolve_node_to_value+0x2e0/0x530
     acpi_ex_resolve_to_value+0x1e7/0x550
     acpi_ds_evaluate_name_path+0x107/0x170
     acpi_ds_exec_end_op+0x392/0x860
     acpi_ps_parse_loop+0x268/0xa30
     acpi_ps_parse_aml+0x221/0x5e0
     acpi_ps_execute_method+0x171/0x3e0
     acpi_ns_evaluate+0x174/0x5d0
     acpi_evaluate_object+0x167/0x440
     acpi_evaluate_dsm+0xb6/0x130
     ucsi_acpi_dsm+0x53/0x80
     ucsi_acpi_read+0x2e/0x60
     ucsi_register+0x24/0xa0
     ucsi_acpi_probe+0x162/0x1e3
     platform_probe+0x48/0x90
     really_probe+0xde/0x340
     __driver_probe_device+0x78/0x110
     driver_probe_device+0x1f/0x90
     __driver_attach+0xd2/0x1c0
     bus_for_each_dev+0x77/0xc0
     bus_add_driver+0x112/0x1f0
     driver_register+0x72/0xd0
     do_one_initcall+0x48/0x300
     do_init_module+0x60/0x220
     __do_sys_init_module+0x17f/0x1b0
     do_syscall_64+0x82/0x170
    
    Remove the restrictions to create mappings in the interrupt address range
    for dom0.  Note that the restriction to map the local APIC page is enforced
    separately, and that continues to be present.  Additionally make sure the
    emulated local APIC page is also not mapped, in case dom0 is using it.
    
    Note that even if the interrupt address range entries are populated in the
    IOMMU page-tables no device access will reach those pages.  Device accesses
    to the Interrupt Address Range will always be converted into Interrupt
    Messages and are not subject to DMA remapping.
    
    There's also the following restriction noted in Intel VT-d:
    
    > Software must not program paging-structure entries to remap any address to
    > the interrupt address range. Untranslated requests and translation requests
    > that result in an address in the interrupt range will be blocked with
    > condition code LGN.4 or SGN.8. Translated requests with an address in the
    > interrupt address range are treated as Unsupported Request (UR).
    
    Similarly for AMD-Vi:
    
    > Accesses to the interrupt address range (Table 3) are defined to go through
    > the interrupt remapping portion of the IOMMU and not through address
    > translation processing. Therefore, when a transaction is being processed as
    > an interrupt remapping operation, the transaction attribute of
    > pretranslated or untranslated is ignored.
    >
    > Software Note: The IOMMU should
    > not be configured such that an address translation results in a special
    > address such as the interrupt address range.
    
    However those restrictions don't apply to the identity mappings possibly
    created for dom0, since the interrupt address range is never subject to DMA
    remapping, and hence there's no output address after translation that
    belongs to the interrupt address range.
    
    Reported-by: Jürgen Groß <jgross@suse.com>
    Link: https://lore.kernel.org/xen-devel/baade0a7-e204-4743-bda1-282df74e5f89@suse.com/
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 381caa38850771ae218eb6f6d490dc02e40df964
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index a735e3650c..8191d90a22 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -554,6 +554,13 @@ int __init dom0_setup_permissions(struct domain *d)
         mfn = paddr_to_pfn(mp_lapic_addr);
         rc |= iomem_deny_access(d, mfn, mfn);
     }
+    /* If using an emulated local APIC make sure its MMIO is unpopulated. */
+    if ( has_vlapic(d) )
+    {
+        /* Xen doesn't allow changing the local APIC MMIO window position. */
+        mfn = paddr_to_pfn(APIC_DEFAULT_PHYS_BASE);
+        rc |= iomem_deny_access(d, mfn, mfn);
+    }
     /* I/O APICs. */
     for ( i = 0; i < nr_ioapics; i++ )
     {
@@ -563,10 +570,6 @@ int __init dom0_setup_permissions(struct domain *d)
              !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
-    /* MSI range. */
-    rc |= iomem_deny_access(d, paddr_to_pfn(MSI_ADDR_BASE_LO),
-                            paddr_to_pfn(MSI_ADDR_BASE_LO +
-                                         MSI_ADDR_DEST_ID_MASK));
     /* HyperTransport range. */
     if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:01:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:01:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921908.1325661 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEa8-0004fQ-1s; Thu, 20 Mar 2025 12:01:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921908.1325661; Thu, 20 Mar 2025 12:01:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEa7-0004fI-VL; Thu, 20 Mar 2025 12:01:03 +0000
Received: by outflank-mailman (input) for mailman id 921908;
 Thu, 20 Mar 2025 12:01:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEa7-0004fB-9g
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:01:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEa7-00Ey0W-1c
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:01:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEa7-009ds5-0i
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:01:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X5SgIiWrHyzWbHy5FO/aTS00SQD945/qRVvZUWQQKoA=; b=iaqZxBsl/qOoA6GKeaaXkzCcXH
	ReSvjvS4Q4sGT7JxxmmQC2XirEUtN6u4/T/OqWydx39OGHZW2pc0GCmBM44ZakTEctr1gE1u8wxzk
	bdYRfEUGraaEyUwvytPsJ2j6tEWO//ILFbkhufTanmdYuERg0XlV9RdNYsx0ZRwRQQT4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] tools/xl: fix channel configuration setting
Message-Id: <E1tvEa7-009ds5-0i@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:01:03 +0000

commit 70038e8c098ffa20b65e4e32faee9a138e176aa6
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 20 12:50:24 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:50:24 2025 +0100

    tools/xl: fix channel configuration setting
    
    Channels work differently than other device types: their devid should
    be -1 initially in order to distinguish them from the primary console
    which has the devid of 0.
    
    So when parsing the channel configuration, use
    ARRAY_EXTEND_INIT_NODEVID() in order to avoid overwriting the devid
    set by libxl_device_channel_init().
    
    Fixes: 3a6679634766 ("libxl: set channel devid when not provided by application")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: e1ccced4afe465d6541c5825a0f8d1b8f5fa4253
    master date: 2025-03-05 16:37:37 +0100
---
 tools/xl/xl_parse.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 3d85be7dd4..089a88935a 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2423,8 +2423,9 @@ void parse_config_data(const char *config_source,
             char *path = NULL;
             int len;
 
-            chn = ARRAY_EXTEND_INIT(d_config->channels, d_config->num_channels,
-                                   libxl_device_channel_init);
+            chn = ARRAY_EXTEND_INIT_NODEVID(d_config->channels,
+                                            d_config->num_channels,
+                                            libxl_device_channel_init);
 
             split_string_into_string_list(buf, ",", &pairs);
             len = libxl_string_list_length(&pairs);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:01:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:01:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921909.1325665 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEaI-0004vA-3E; Thu, 20 Mar 2025 12:01:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921909.1325665; Thu, 20 Mar 2025 12:01:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEaI-0004v2-0T; Thu, 20 Mar 2025 12:01:14 +0000
Received: by outflank-mailman (input) for mailman id 921909;
 Thu, 20 Mar 2025 12:01:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEaH-0004tF-CG
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:01:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEaH-00Ey0b-1u
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:01:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEaH-009dsq-13
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:01:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HxiwBvVwM5GPrzjh5UTYyFEoVKfJyhGkltfZ1dbeytY=; b=GXk03ewUDeb7TLLCl/ETeCo2rN
	ZJ9Kd355F70HkCiuMK76qZeKIJ1MUpSp96NKbM42cbtY58NYuvShb2CeuQl/BHLPF/dz1Mj69OOUy
	YYTy0fExQH13crLcsm5ED1AR05uVj1tgumwna3CbCikqiHWu5QTr3QKMQnLyaJhbE0DQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/vlapic: Fix handling of writes to APIC_ESR
Message-Id: <E1tvEaH-009dsq-13@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:01:13 +0000

commit 4a480e7a143b04b160f7b1b287d17aa69b07362f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 12:50:38 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:50:38 2025 +0100

    x86/vlapic: Fix handling of writes to APIC_ESR
    
    Xen currently presents APIC_ESR to guests as a simple read/write register.
    
    This is incorrect.  The SDM states:
    
      The ESR is a write/read register. Before attempt to read from the ESR,
      software should first write to it. (The value written does not affect the
      values read subsequently; only zero may be written in x2APIC mode.) This
      write clears any previously logged errors and updates the ESR with any
      errors detected since the last write to the ESR.
    
    Introduce a new pending_esr field in hvm_hw_lapic.
    
    Update vlapic_error() to accumulate errors here, and extend vlapic_reg_write()
    to discard the written value and transfer pending_esr into APIC_ESR.  Reads
    are still as before.
    
    Importantly, this means that guests no longer destroys the ESR value it's
    looking for in the LVTERR handler when following the SDM instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b28b590d4a23894672f1dd7fb98cdf9926ecb282
    master date: 2025-03-07 14:34:08 +0000
---
 xen/arch/x86/hvm/vlapic.c              | 17 +++++++++++++++--
 xen/include/public/arch-x86/hvm/save.h |  1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 3363926b48..98394ed26a 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -108,7 +108,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     uint32_t esr;
 
     spin_lock_irqsave(&vlapic->esr_lock, flags);
-    esr = vlapic_get_reg(vlapic, APIC_ESR);
+    esr = vlapic->hw.pending_esr;
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
@@ -127,7 +127,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
                  errmask |= APIC_ESR_RECVILL;
         }
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+        vlapic->hw.pending_esr |= errmask;
 
         if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
@@ -802,6 +802,19 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         vlapic_set_reg(vlapic, APIC_ID, val);
         break;
 
+    case APIC_ESR:
+    {
+        unsigned long flags;
+
+        spin_lock_irqsave(&vlapic->esr_lock, flags);
+        val = vlapic->hw.pending_esr;
+        vlapic->hw.pending_esr = 0;
+        spin_unlock_irqrestore(&vlapic->esr_lock, flags);
+
+        vlapic_set_reg(vlapic, APIC_ESR, val);
+        break;
+    }
+
     case APIC_TASKPRI:
         vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff);
         break;
diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h
index 7ecacadde1..9c4bfc7ebd 100644
--- a/xen/include/public/arch-x86/hvm/save.h
+++ b/xen/include/public/arch-x86/hvm/save.h
@@ -394,6 +394,7 @@ struct hvm_hw_lapic {
     uint32_t             disabled; /* VLAPIC_xx_DISABLED */
     uint32_t             timer_divisor;
     uint64_t             tdt_msr;
+    uint32_t             pending_esr;
 };
 
 DECLARE_HVM_SAVE_TYPE(LAPIC, 5, struct hvm_hw_lapic);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:01:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:01:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921910.1325668 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEaS-0004ze-4V; Thu, 20 Mar 2025 12:01:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921910.1325668; Thu, 20 Mar 2025 12:01:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEaS-0004zW-1w; Thu, 20 Mar 2025 12:01:24 +0000
Received: by outflank-mailman (input) for mailman id 921910;
 Thu, 20 Mar 2025 12:01:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEaR-0004zQ-FL
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:01:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEaR-00Ey0f-2C
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:01:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEaR-009dtc-1K
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:01:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=axzYbVNUPmbmxuSxiBg1SkD/GLsMDSUWyUZ3zX+8Q5M=; b=iOpChq54QS8gwlHADimINtET8U
	z1Z1P2tIWBWDoFzJS+tQ71n8GXTBAowI+QqO9+5uXZdSGcSE1fqHhGTbJ8JW6EbZJuEEi94d3lxJR
	QC+oJHI9xJG89+ieweLTtWvfPKgsGE5ZcNKkghpwnm9OupywC0q/vrr1jMzHWMevZmck=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
Message-Id: <E1tvEaR-009dtc-1K@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:01:23 +0000

commit f581b36608d067ca2571c6677820e666e5bd68a6
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:51:40 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:51:40 2025 +0100

    x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
    
    The MMIO_CONF_BASE reports the base of the MCFG range on AMD systems.
    Linux pre-6.14 is unconditionally attempting to read the MSR without a
    safe MSR accessor, and since Xen doesn't allow access to it Linux reports
    the following error:
    
    unchecked MSR access error: RDMSR from 0xc0010058 at rIP: 0xffffffff8101d19f (xen_do_read_msr+0x7f/0xa0)
    Call Trace:
     xen_read_msr+0x1e/0x30
     amd_get_mmconfig_range+0x2b/0x80
     quirk_amd_mmconfig_area+0x28/0x100
     pnp_fixup_device+0x39/0x50
     __pnp_add_device+0xf/0x150
     pnp_add_device+0x3d/0x100
     pnpacpi_add_device_handler+0x1f9/0x280
     acpi_ns_get_device_callback+0x104/0x1c0
     acpi_ns_walk_namespace+0x1d0/0x260
     acpi_get_devices+0x8a/0xb0
     pnpacpi_init+0x50/0x80
     do_one_initcall+0x46/0x2e0
     kernel_init_freeable+0x1da/0x2f0
     kernel_init+0x16/0x1b0
     ret_from_fork+0x30/0x50
     ret_from_fork_asm+0x1b/0x30
    
    Such access is conditional to the presence of a device with PnP ID
    "PNP0c01", which triggers the execution of the quirk_amd_mmconfig_area()
    function.  Note that prior to commit 3fac3734c43a MSR accesses when running
    as a PV guest would always use the safe variant, and thus silently handle
    the #GP.
    
    Fix by allowing access to the MSR on AMD systems for the hardware domain.
    
    Write attempts to the MSR will still result in #GP for all domain types.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b4071d28c5bd9ca4fed76031cbf0e782b74209b9
    master date: 2025-03-12 13:32:30 +0100
---
 xen/arch/x86/msr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 289cf10b78..3f612ad27c 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -245,6 +245,14 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = 0;
         break;
 
+    case MSR_FAM10H_MMIO_CONF_BASE:
+        if ( !is_hardware_domain(d) ||
+             !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ||
+             rdmsr_safe(msr, *val) )
+            goto gp_fault;
+
+        break;
+
     case MSR_VIRT_SPEC_CTRL:
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:01:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:01:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921911.1325672 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEac-00057I-61; Thu, 20 Mar 2025 12:01:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921911.1325672; Thu, 20 Mar 2025 12:01:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEac-00057A-3U; Thu, 20 Mar 2025 12:01:34 +0000
Received: by outflank-mailman (input) for mailman id 921911;
 Thu, 20 Mar 2025 12:01:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEab-000572-IE
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:01:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEab-00Ey0n-2U
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:01:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEab-009duJ-1e
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:01:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A1fFSjXSgt4Gc5lvqpDogDLewG9Xnxkg1gtFnUOPRcQ=; b=j3LzY+5M0uuqLAbH9qQXneku5v
	GMEfI/1ruSe6Iei6wD8teQopquCTsm8OcE4bOPDE2Zw7kuThpWRRDzErrLk/Nc2TgpS0KwoWhmyl/
	ap5NfVxydYoGMlBJYZzeeSMfISLm4+5aMZhjdvN2NVEOXOzwHAEItt/Kn918Rzt2xM4k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/vmx: fix posted interrupts usage of msi_desc->msg field
Message-Id: <E1tvEab-009duJ-1e@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:01:33 +0000

commit 74b40fe10582c0375afd3db97626a27094f4c0e5
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:52:00 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:52:00 2025 +0100

    x86/vmx: fix posted interrupts usage of msi_desc->msg field
    
    The current usage of msi_desc->msg in vmx_pi_update_irte() will make the
    field contain a translated MSI message, instead of the expected
    untranslated one.  This breaks dump_msi(), that use the data in
    msi_desc->msg to print the interrupt details.
    
    Fix this by introducing a dummy local msi_msg, and use it with
    iommu_update_ire_from_msi().  vmx_pi_update_irte() relies on the MSI
    message not changing, so there's no need to propagate the resulting msi_msg
    to the hardware, and the contents can be ignored.
    
    Additionally add a comment to clarify that msi_desc->msg must always
    contain the untranslated MSI message.
    
    Fixes: a5e25908d18d ('VT-d: introduce new fields in msi_desc to track binding with guest interrupt')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 30f0e55a79206702b4e82e86dad6b35033157858
    master date: 2025-03-12 13:32:30 +0100
---
 xen/arch/x86/hvm/vmx/vmx.c     | 4 +++-
 xen/arch/x86/include/asm/msi.h | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index eee1d4b47a..1373ef2787 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -396,6 +396,7 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     const struct pi_desc *pi_desc = v ? &v->arch.hvm.vmx.pi_desc : NULL;
     struct irq_desc *desc;
     struct msi_desc *msi_desc;
+    struct msi_msg msg;
     int rc;
 
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -410,12 +411,13 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     }
     msi_desc->pi_desc = pi_desc;
     msi_desc->gvec = gvec;
+    msg = msi_desc->msg;
 
     spin_unlock_irq(&desc->lock);
 
     ASSERT_PDEV_LIST_IS_READ_LOCKED(msi_desc->dev->domain);
 
-    return iommu_update_ire_from_msi(msi_desc, &msi_desc->msg);
+    return iommu_update_ire_from_msi(msi_desc, &msg);
 
  unlock_out:
     spin_unlock_irq(&desc->lock);
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 7f9e531f73..38367e2788 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -124,7 +124,7 @@ struct msi_desc {
     int irq;
     int remap_index;         /* index in interrupt remapping table */
 
-    struct msi_msg msg;      /* Last set MSI message */
+    struct msi_msg msg;      /* Last set MSI message (untranslated) */
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:01:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:01:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921912.1325677 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEam-00059j-7z; Thu, 20 Mar 2025 12:01:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921912.1325677; Thu, 20 Mar 2025 12:01:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEam-00059a-4u; Thu, 20 Mar 2025 12:01:44 +0000
Received: by outflank-mailman (input) for mailman id 921912;
 Thu, 20 Mar 2025 12:01:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEal-00059U-LF
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:01:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEal-00Ey0r-2n
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:01:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEal-009dvQ-1t
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:01:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+Pd/iLv3g90KALU+mf47A7R6wxFHyK0NXaXd+qIZChs=; b=xsbZ/jw9dnv3SJ60Azl8BMgb/f
	tNbqCbFmPMQAixZfWGUWMXmiH1b4+6GC+O5VIJPstTHj2117i52LTO/XNyRCbB4b5ljVaRVrNR+Fv
	qdmeI+Lmg9hNL6gIOd78iEA1aPRm/c+2ExjEQbqeyKnZBDmqr3gjXLxyjBIonl72VB1Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/hvm: check return code of hvm_pi_update_irte when binding
Message-Id: <E1tvEal-009dvQ-1t@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:01:43 +0000

commit 94928e415f2131bde75c1c4e5fd120a43e2836a3
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:52:32 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:52:32 2025 +0100

    x86/hvm: check return code of hvm_pi_update_irte when binding
    
    Consume the return code from hvm_pi_update_irte(), and propagate the error
    back to the caller if hvm_pi_update_irte() fails.
    
    Fixes: 35a1caf8b6b5 ('pass-through: update IRTE according to guest interrupt config changes')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: cb587f620ab56cc683347d8120ba63989fad2693
    master date: 2025-03-12 13:32:31 +0100
---
 xen/drivers/passthrough/x86/hvm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index f5faff7a49..47de6953fd 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -381,7 +381,15 @@ int pt_irq_create_bind(
 
         /* Use interrupt posting if it is supported. */
         if ( iommu_intpost )
-            hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+        {
+            rc = hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+
+            if ( rc )
+            {
+                pt_irq_destroy_bind(d, pt_irq_bind);
+                return rc;
+            }
+        }
 
         if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:01:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:01:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921913.1325680 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEaw-0005Cm-Ab; Thu, 20 Mar 2025 12:01:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921913.1325680; Thu, 20 Mar 2025 12:01:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEaw-0005Ce-83; Thu, 20 Mar 2025 12:01:54 +0000
Received: by outflank-mailman (input) for mailman id 921913;
 Thu, 20 Mar 2025 12:01:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEav-0005CX-Nq
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:01:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEav-00Ey1H-33
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:01:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEav-009dwU-2C
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:01:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Z1qjmTDlA/IuAh65RonqZKviX+8POWlHhU/NBp9Rgy4=; b=z4MfvPmW85lQ7h7NBW4SM5TdIJ
	pPjQ/h2k//HvtcAZutxdsW0LHxlTu6lpTCYrpW5dUgO8VpY97tKmaEEO2s9SS6NilRjI6KVr7dfDg
	l3AU32BafwyEHgOb9GEPK68Ha92zk3NCckW9ywIYNFf8ZEbBCRcOJJ1MMENK5xcz3A2w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
Message-Id: <E1tvEav-009dwU-2C@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:01:53 +0000

commit 1ddf72bbdfa892eb779a550594ab3a1681e50e52
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Thu Mar 20 12:52:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:52:57 2025 +0100

    tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
    
    It is valid for a PCI device to not have a legacy IRQ.  In that case, do
    not print an error to keep the logs clean.
    
    This relies on pciback being updated to return -ENOENT for a missing
    GSI.
    
    Fixes: b93e5981d258 ("tools: Add new function to get gsi from dev")
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 8808f45305d146d05469ed4551bb5ccf931b1800
    master date: 2025-03-13 10:23:42 +0100
---
 tools/libs/ctrl/xc_linux.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/libs/ctrl/xc_linux.c b/tools/libs/ctrl/xc_linux.c
index 92591e49a1..2b2d7b3196 100644
--- a/tools/libs/ctrl/xc_linux.c
+++ b/tools/libs/ctrl/xc_linux.c
@@ -77,9 +77,14 @@ int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
     ret = ioctl(xencall_fd(xch->xcall),
                 IOCTL_PRIVCMD_PCIDEV_GET_GSI, &dev_gsi);
 
-    if (ret < 0) {
-        PERROR("Failed to get gsi from dev");
-    } else {
+    if ( ret < 0 )
+    {
+        if ( errno != ENOENT )
+            PERROR("Failed to get gsi for dev %04x:%02x:%02x.%u",
+                sbdf >> 16, (sbdf >> 8) & 0xff, sbdf >> 3 & 0x1f, sbdf & 0x7);
+    }
+    else
+    {
         ret = dev_gsi.gsi;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:02:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:02:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921914.1325685 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEb6-0005F6-CC; Thu, 20 Mar 2025 12:02:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921914.1325685; Thu, 20 Mar 2025 12:02:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEb6-0005Ey-9R; Thu, 20 Mar 2025 12:02:04 +0000
Received: by outflank-mailman (input) for mailman id 921914;
 Thu, 20 Mar 2025 12:02:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEb5-0005Es-Qf
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:02:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEb6-00Ey1g-05
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:02:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEb5-009dxq-2T
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:02:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fuTtUpmRsRKUixRDBQ5gApaZweyL1xZCJ2k/3lCg7T4=; b=HxHj7OxNBislra+64iBDnCRsoM
	GmzQpOnOuKIEwVXJjtAX4FJVF8+wgvfxdRkeOLRml5Bf+IMwx+hAaLAS8GxfALsfhmtN5rwSA/5l8
	tnq0NHmJntj8V2JJxEJbC9o5o5CE+7btKe0TtX3KONdkskED0EbFUm5kDZeph+glGZZU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] tools/libxl: Skip missing PCI GSIs
Message-Id: <E1tvEb5-009dxq-2T@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:02:03 +0000

commit f2ddbeb9dd1de651e5065a0f0ec6ef8ca39e12e2
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Thu Mar 20 12:53:13 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:53:13 2025 +0100

    tools/libxl: Skip missing PCI GSIs
    
    A PCI device may not have a legacy IRQ.  In that case, we don't need to
    do anything, so don't fail in libxl__arch_hvm_map_gsi() and
    libxl__arch_hvm_unmap_gsi().
    
    Requires an updated pciback to return -ENOENT.
    
    Fixes: f97f885c7198 ("tools: Add new function to do PIRQ (un)map on PVH dom0")
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: d3ac8fdce26476d148fb2a8f18c7e5b0c153be0a
    master date: 2025-03-13 10:23:52 +0100
---
 tools/libs/light/libxl_x86.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index a3164a3077..0a7f64ad46 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -901,7 +901,10 @@ int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
     int pirq = -1, gsi, r;
 
     gsi = xc_pcidev_get_gsi(CTX->xch, sbdf);
-    if (gsi < 0) {
+    if (gsi < 0 && errno == ENOENT) {
+        LOGD(DEBUG, domid, "xc_pcidev_get_gsi no gsi");
+        return 0;
+    } else if (gsi < 0) {
         return ERROR_FAIL;
     }
 
@@ -925,7 +928,10 @@ int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
     int pirq = -1, gsi, r;
 
     gsi = xc_pcidev_get_gsi(CTX->xch, sbdf);
-    if (gsi < 0) {
+    if (gsi < 0 && errno == ENOENT) {
+        LOGD(DEBUG, domid, "xc_pcidev_get_gsi no gsi");
+        return 0;
+    } else if (gsi < 0) {
         return ERROR_FAIL;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:02:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:02:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921915.1325689 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEbH-0005Hu-Dh; Thu, 20 Mar 2025 12:02:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921915.1325689; Thu, 20 Mar 2025 12:02:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEbH-0005Hm-Aq; Thu, 20 Mar 2025 12:02:15 +0000
Received: by outflank-mailman (input) for mailman id 921915;
 Thu, 20 Mar 2025 12:02:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEbF-0005Hc-TC
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:02:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEbG-00Ey1n-0M
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:02:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEbF-009dyq-2j
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:02:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cXJmHbuLqSjfDxVNg5L25Q3xV/oaYMltldEnYwKJShM=; b=zRRt0Uxn2H1vUB6kCl6RTZGztK
	9aQw5BlP7TJvinQyOLHoYkOKLp3v/m6g6/+UlrqldejsTNAoHCc0jC7R59y8x8X0Hl4lmRTzzH+Vq
	WszPYqaG7TRRQzk+QJM2eSxoqb53FU3Oa57MThztKrpJWaSwbyjUrcwFiA/XO/taAhUU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] xen/sched: fix arinc653 to not use variables across cpupools
Message-Id: <E1tvEbF-009dyq-2j@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:02:13 +0000

commit 80cbb296127b6c1729f4625498b27cdb41bb614b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 20 12:53:29 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:53:29 2025 +0100

    xen/sched: fix arinc653 to not use variables across cpupools
    
    a653sched_do_schedule() is using two function local static variables,
    which is resulting in bad behavior when using more than one cpupool
    with the arinc653 scheduler.
    
    Fix that by moving those variables to the scheduler private data.
    
    Fixes: 22787f2e107c ("ARINC 653 scheduler")
    Reported-by: Choi Anderson <Anderson.Choi@boeing.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
    master commit: d0561ac8ab0e780b1e8ab41d0d15e9f9b076dee3
    master date: 2025-03-14 10:17:11 +0100
---
 xen/common/sched/arinc653.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index a82c0d7314..9ebae6d7ae 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -143,6 +143,12 @@ typedef struct a653sched_priv_s
      * pointers to all Xen UNIT structures for iterating through
      */
     struct list_head unit_list;
+
+    /**
+     * scheduling house keeping variables
+     */
+    unsigned int sched_index;
+    s_time_t next_switch_time;
 } a653sched_priv_t;
 
 /**************************************************************************
@@ -513,8 +519,6 @@ a653sched_do_schedule(
     bool tasklet_work_scheduled)
 {
     struct sched_unit *new_task = NULL;
-    static unsigned int sched_index = 0;
-    static s_time_t next_switch_time;
     a653sched_priv_t *sched_priv = SCHED_PRIV(ops);
     const unsigned int cpu = sched_get_resource_cpu(smp_processor_id());
     unsigned long flags;
@@ -528,18 +532,19 @@ a653sched_do_schedule(
         /* time to enter a new major frame
          * the first time this function is called, this will be true */
         /* start with the first domain in the schedule */
-        sched_index = 0;
+        sched_priv->sched_index = 0;
         sched_priv->next_major_frame = now + sched_priv->major_frame;
-        next_switch_time = now + sched_priv->schedule[0].runtime;
+        sched_priv->next_switch_time = now + sched_priv->schedule[0].runtime;
     }
     else
     {
-        while ( (now >= next_switch_time)
-                && (sched_index < sched_priv->num_schedule_entries) )
+        while ( (now >= sched_priv->next_switch_time) &&
+                (sched_priv->sched_index < sched_priv->num_schedule_entries) )
         {
             /* time to switch to the next domain in this major frame */
-            sched_index++;
-            next_switch_time += sched_priv->schedule[sched_index].runtime;
+            sched_priv->sched_index++;
+            sched_priv->next_switch_time +=
+                sched_priv->schedule[sched_priv->sched_index].runtime;
         }
     }
 
@@ -547,8 +552,8 @@ a653sched_do_schedule(
      * If we exhausted the domains in the schedule and still have time left
      * in the major frame then switch next at the next major frame.
      */
-    if ( sched_index >= sched_priv->num_schedule_entries )
-        next_switch_time = sched_priv->next_major_frame;
+    if ( sched_priv->sched_index >= sched_priv->num_schedule_entries )
+        sched_priv->next_switch_time = sched_priv->next_major_frame;
 
     /*
      * If there are more domains to run in the current major frame, set
@@ -556,8 +561,8 @@ a653sched_do_schedule(
      * Otherwise, set new_task equal to the address of the idle task's
      * sched_unit structure.
      */
-    new_task = (sched_index < sched_priv->num_schedule_entries)
-        ? sched_priv->schedule[sched_index].unit
+    new_task = (sched_priv->sched_index < sched_priv->num_schedule_entries)
+        ? sched_priv->schedule[sched_priv->sched_index].unit
         : IDLETASK(cpu);
 
     /* Check to see if the new task can be run (awake & runnable). */
@@ -589,7 +594,7 @@ a653sched_do_schedule(
      * Return the amount of time the next domain has to run and the address
      * of the selected task's UNIT structure.
      */
-    prev->next_time = next_switch_time - now;
+    prev->next_time = sched_priv->next_switch_time - now;
     prev->next_task = new_task;
     new_task->migrated = false;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:02:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:02:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921916.1325693 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEbR-0005KB-FV; Thu, 20 Mar 2025 12:02:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921916.1325693; Thu, 20 Mar 2025 12:02:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEbR-0005K0-CM; Thu, 20 Mar 2025 12:02:25 +0000
Received: by outflank-mailman (input) for mailman id 921916;
 Thu, 20 Mar 2025 12:02:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEbP-0005Jl-Vb
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:02:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEbQ-00Ey20-0b
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:02:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEbP-009dzK-2z
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:02:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vHSn9OrpyKySqFc+qHHMTellxQstfvwtU0M4KokCyVE=; b=W8BU+LjeXelEaMXvdt34uEbvU1
	IYo7kff6lBUBz+2QzodRrqt65CnomdYChooPju6mcq+us0K256EC5k5fI/G8KzzH5uwyjn7HHkuEz
	bnfvwWsxWlnTg8hNBcbaNRV6/fuZoKWmnplBQKBZA+J6fdKRQp7d9WFWjg1Lov6UjErI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] libxl: avoid infinite loop in libxl__remove_directory()
Message-Id: <E1tvEbP-009dzK-2z@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:02:23 +0000

commit b29984df38c8d8a2df51eeea23927c8b9281c8c8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 20 12:53:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:53:51 2025 +0100

    libxl: avoid infinite loop in libxl__remove_directory()
    
    Infinitely retrying the rmdir() invocation makes little sense. While the
    original observation was the log filling the disk (due to repeated
    "Directory not empty" errors, in turn occurring for unclear reasons),
    the loop wants breaking even if there was no error message being logged
    (much like is done in the similar loops in libxl__remove_file() and
    libxl__remove_file_or_directory()).
    
    Fixes: c4dcbee67e6d ("libxl: provide libxl__remove_file et al")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 68baeb5c4852e652b9599e049f40477edac4060e
    master date: 2025-03-13 10:23:10 +0100
---
 tools/libs/light/libxl_utils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_utils.c b/tools/libs/light/libxl_utils.c
index 506c5b5631..5ae8935344 100644
--- a/tools/libs/light/libxl_utils.c
+++ b/tools/libs/light/libxl_utils.c
@@ -577,6 +577,7 @@ int libxl__remove_directory(libxl__gc *gc, const char *dirpath)
         if (errno == EINTR) continue;
         LOGE(ERROR, "failed to remove emptied directory %s", dirpath);
         rc = ERROR_FAIL;
+        break;
     }
 
  out:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:02:35 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:02:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921917.1325696 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEbb-0005Mf-GQ; Thu, 20 Mar 2025 12:02:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921917.1325696; Thu, 20 Mar 2025 12:02:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEbb-0005MX-Dq; Thu, 20 Mar 2025 12:02:35 +0000
Received: by outflank-mailman (input) for mailman id 921917;
 Thu, 20 Mar 2025 12:02:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEba-0005MI-2L
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:02:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEba-00Ey27-0u
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:02:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEba-009e0V-03
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:02:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PG/JYx8ZmIefGJbhq+HXYGmBhQmV51qVy0KakbQ1+ho=; b=CIVbFVsNFbJ+6GQMPZFNTJUb09
	97o9Ecc/d7okUw26t9Qov3Pmw6zbX0bDbYl8hggMgZN0Eu6faepPysd4Q6GuTG9z4ejgDowQCY4RF
	jhBlHGshB5RtXQf3T4w+TzCur1go074sl/rmyT+GRIDximaezm4LQpK/XHScChRcOonI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/ioremap: prevent additions against the NULL pointer
Message-Id: <E1tvEba-009e0V-03@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:02:34 +0000

commit 408935872ae7a5348e954b2e6b713b32e652ca08
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:54:16 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:54:16 2025 +0100

    x86/ioremap: prevent additions against the NULL pointer
    
    This was reported by clang UBSAN as:
    
    UBSAN: Undefined behaviour in arch/x86/mm.c:6297:40
    applying zero offset to null pointer
    [...]
    Xen call trace:
        [<ffff82d040303662>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304aa3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0406ebbc0>] F ioremap_wc+0xc8/0xe0
        [<ffff82d0406c3728>] F video_init+0xd0/0x180
        [<ffff82d0406ab6f5>] F console_init_preirq+0x3d/0x220
        [<ffff82d0406f1876>] F __start_xen+0x68e/0x5530
        [<ffff82d04020482e>] F __high_start+0x8e/0x90
    
    Fix bt_ioremap() and ioremap{,_wc}() to not add the offset if the returned
    pointer from __vmap() is NULL.
    
    Fixes: d0d4635d034f ('implement vmap()')
    Fixes: f390941a92f1 ('x86/DMI: fix table mapping when one lives above 1Mb')
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9a6f2c52f75781acda39fab5cc96d1bcc54bf534
    master date: 2025-03-17 13:33:29 +0100
---
 xen/arch/x86/dmi_scan.c | 7 +++++--
 xen/arch/x86/mm.c       | 6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 2fcc485295..eb65bc86bb 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -112,6 +112,7 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
 {
     mfn_t mfn = _mfn(PFN_DOWN(addr));
     unsigned int offs = PAGE_OFFSET(addr);
+    void *va;
 
     if ( addr + len <= MB(1) )
         return __va(addr);
@@ -119,8 +120,10 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
     if ( system_state < SYS_STATE_boot )
         return __acpi_map_table(addr, len);
 
-    return __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
-                  VMAP_DEFAULT) + offs;
+    va = __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
+                VMAP_DEFAULT);
+
+    return va ? va + offs : NULL;
 }
 
 static void __init bt_iounmap(const void *ptr, unsigned int len)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index fa21903eb2..83bca4e7c1 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -6274,7 +6274,9 @@ void __iomem *ioremap(paddr_t pa, size_t len)
         unsigned int offs = pa & (PAGE_SIZE - 1);
         unsigned int nr = PFN_UP(offs + len);
 
-        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT) + offs;
+        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT);
+        if ( va )
+            va += offs;
     }
 
     return (void __force __iomem *)va;
@@ -6291,7 +6293,7 @@ void __iomem *__init ioremap_wc(paddr_t pa, size_t len)
 
     va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_WC, VMAP_DEFAULT);
 
-    return (void __force __iomem *)(va + offs);
+    return (void __force __iomem *)(va ? va + offs : NULL);
 }
 
 int create_perdomain_mapping(struct domain *d, unsigned long va,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:02:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:02:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921918.1325701 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEbl-0005P6-Hh; Thu, 20 Mar 2025 12:02:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921918.1325701; Thu, 20 Mar 2025 12:02:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEbl-0005Oy-FG; Thu, 20 Mar 2025 12:02:45 +0000
Received: by outflank-mailman (input) for mailman id 921918;
 Thu, 20 Mar 2025 12:02:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEbk-0005Oq-5b
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:02:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEbk-00Ey2J-1E
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:02:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEbk-009e3c-0N
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:02:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PyvYXk3kPPM4cnpFMxDnWIow7jLwStCAW2ij9t0JTsA=; b=7J7IHv99Lxu6ux4MQttDoan1e6
	SB6xKSlPYL+5aziQtkfxAK4/FXt4kHDVLiOPKeGcFogC6ba4hXBzUMhowqG+t1QosV+kCAMFmcQv2
	W3Ie58JQzmu6Yl4IXSsyLpsvKVD3l9Zyp2PVjcYX6vLkZ7YNrLi5iieVbrwgm8IMdYVU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
Message-Id: <E1tvEbk-009e3c-0N@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:02:44 +0000

commit 97f064d9ab7d45ab0184736298f8e89386314261
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 12:54:53 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:54:53 2025 +0100

    x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
    
    The current CI failures turn out to be a latent bug triggered by a narrow set
    of properties of the initrd and the host memory map, which CI encountered by
    chance.
    
    One step during boot involves constructing directmap mappings for modules.
    With some probing at the point of creation, it is observed that there's a 4k
    mapping missing towards the end of the initrd.
    
      (XEN) === Mapped Mod1 [0000000394001000, 00000003be1ff6dc] to Directmap
      (XEN) Probing paddr 394001000, va ffff830394001000
      (XEN) Probing paddr 3be1ff6db, va ffff8303be1ff6db
      (XEN) Probing paddr 3bdffffff, va ffff8303bdffffff
      (XEN) Probing paddr 3be001000, va ffff8303be001000
      (XEN) Probing paddr 3be000000, va ffff8303be000000
      (XEN) Early fatal page fault at e008:ffff82d04032014c (cr2=ffff8303be000000, ec=0000)
    
    The conditions for this bug appear to be map_pages_to_xen() call with a start
    address of exactly 4k beyond a 2M boundary, some number of full 2M pages, then
    a tail needing 4k pages.
    
    Anyway, the condition for spotting superpage boundaries in map_pages_to_xen()
    is wrong.  The IS_ALIGNED() macro expects a power of two for the alignment
    argument, and subtracts 1 itself.
    
    Fixing this causes the failing case to now boot.
    
    Fixes: 97fb6fcf26e8 ("x86/mm: introduce helpers to detect super page alignment")
    Debugged-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b07c7d63f9b587e4df5d71f6da9eaa433512c974
    master date: 2025-03-19 14:53:28 +0000
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 83bca4e7c1..e6a61520d5 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5502,7 +5502,7 @@ int map_pages_to_xen(
                                                                 \
     ASSERT(!mfn_eq(m_, INVALID_MFN));                           \
     IS_ALIGNED(PFN_DOWN(v) | mfn_x(m_),                         \
-               (1UL << (PAGETABLE_ORDER * ((n) - 1))) - 1);     \
+               1UL << (PAGETABLE_ORDER * ((n) - 1)));           \
 })
 #define IS_L2E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 2)
 #define IS_L3E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 3)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:02:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:02:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921919.1325705 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEbv-0005RP-JZ; Thu, 20 Mar 2025 12:02:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921919.1325705; Thu, 20 Mar 2025 12:02:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEbv-0005RH-Gk; Thu, 20 Mar 2025 12:02:55 +0000
Received: by outflank-mailman (input) for mailman id 921919;
 Thu, 20 Mar 2025 12:02:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEbu-0005R9-8c
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:02:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEbu-00Ey2f-1W
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:02:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEbu-009e4i-0e
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:02:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RLNGAsLq4t2g1VbIYGsiJaAR5uXAbTiA8Wb9AeXu4CM=; b=GDXp9lxVEtW3QMff6YFc5ciP4z
	QXWUTEkc7fXObYFjKpSQ98q5Q+y4aqkMNr1WIr2fbudIGUZ7J2KOAeTNWd62OHHv5MIenSTS7n97/
	aZw6OmGbeklnZ4gS/1KlTvtTxo5clQLMDq8VLp9qxweXFTRWBRNG39INQs57zfEH6KU0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] xen/arinc653: call xfree() with local IRQ enabled
Message-Id: <E1tvEbu-009e4i-0e@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:02:54 +0000

commit c1badde6011ca8b626d64ccc61ce33f062468cb3
Author:     Anderson Choi <anderson.choi@boeing.com>
AuthorDate: Thu Mar 20 12:55:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:55:12 2025 +0100

    xen/arinc653: call xfree() with local IRQ enabled
    
    xen panic is observed with the following configuration.
    
    1. Debug xen build (CONFIG_DEBUG=y)
    2. dom1 of an ARINC653 domain
    3. shutdown dom1 with xl command
    
    $ xl shutdown <domain_name>
    
    (XEN) ****************************************
    (XEN) Panic on CPU 2:
    (XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/xmalloc_tlsf.c:714
    (XEN) ****************************************
    
    panic was triggered since xfree() was called with local IRQ disabled and
    therefore assertion failed.
    
    Fix this by calling xfree() after local IRQ is enabled.
    
    Fixes: 19049f8d796a sched: fix locking in a653sched_free_vdata()
    Signed-off-by: Anderson Choi <anderson.choi@boeing.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
    master commit: 3ee55c9543fcf0b35593f030b53f56f3222046b7
    master date: 2025-03-19 16:44:00 +0000
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index 9ebae6d7ae..930361fa5c 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -463,10 +463,11 @@ a653sched_free_udata(const struct scheduler *ops, void *priv)
     if ( !is_idle_unit(av->unit) )
         list_del(&av->list);
 
-    xfree(av);
     update_schedule_units(ops);
 
     spin_unlock_irqrestore(&sched_priv->lock, flags);
+
+    xfree(av);
 }
 
 /**
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:03:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:03:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921920.1325710 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEc5-0005UZ-NK; Thu, 20 Mar 2025 12:03:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921920.1325710; Thu, 20 Mar 2025 12:03:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvEc5-0005UR-K9; Thu, 20 Mar 2025 12:03:05 +0000
Received: by outflank-mailman (input) for mailman id 921920;
 Thu, 20 Mar 2025 12:03:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvEc4-0005UI-BH
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:03:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEc4-00Ey2y-1n
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:03:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvEc4-009e6t-0x
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:03:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gke8KropQAB5Dv9VjTm1ED6Gdax0/imQvMnU/Za+JvE=; b=ViPDYDVi/wCqmwz00mzaQYQZZh
	Uvo53BgkExzQzk+/0dmnisVAQCUSgU7tdmQv8ejNMnnrR4zEfE6P9SlLrnHRHTFjsaAcZI/F6bVeu
	CL7gdiZCepsV6KmY+hrFC3gpkYk+wJSk/wMSzDZo+IQciT2RDKB7og0FnYXECFsA6GMA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/setup: correct off-by-1 in module mapping
Message-Id: <E1tvEc4-009e6t-0x@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:03:04 +0000

commit c607822b5ae946cfc26efd9dd6ffb45f041e2dac
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 20 12:55:32 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:55:32 2025 +0100

    x86/setup: correct off-by-1 in module mapping
    
    If a module's length is an exact multiple of PAGE_SIZE, the 2nd argument
    passed to set_pdx_range() would be one larger than intended. Use
    PFN_{UP,DOWN}() there instead.
    
    Fixes: cd7cc5320bb2 ("x86/boot: add start and size fields to struct boot_module")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: c3b54301fbe918c7e7e9c3b2dfe671c1ab79f882
    master date: 2025-03-20 08:51:55 +0100
---
 xen/arch/x86/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8ebe5a9443..6e49d2705b 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1728,7 +1728,7 @@ void asmlinkage __init noreturn __start_xen(void)
     {
         unsigned long s = bi->mods[i].start, l = bi->mods[i].size;
 
-        set_pdx_range(paddr_to_pfn(s), paddr_to_pfn(s + l) + 1);
+        set_pdx_range(PFN_DOWN(s), PFN_UP(s + l));
         map_pages_to_xen((unsigned long)maddr_to_virt(s), maddr_to_mfn(s),
                          PFN_UP(l), PAGE_HYPERVISOR);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:33:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921940.1325723 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF54-0003RL-QJ; Thu, 20 Mar 2025 12:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921940.1325723; Thu, 20 Mar 2025 12:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF54-0003RD-Nb; Thu, 20 Mar 2025 12:33:02 +0000
Received: by outflank-mailman (input) for mailman id 921940;
 Thu, 20 Mar 2025 12:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF53-0003R7-UL
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF54-00EykI-0D
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF53-009hvW-2Z
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AdwoMnm57/cz9A46Ry/HMZKffy2iQ7I97MOlyPE6jo4=; b=VY/Y6NKNdnmhiTMEsAvVIZeMV0
	SjO4O8nOV3ZgKwFUSPRyJhqJQJBnhDVr5Og4eVIT4Ac20uZbj4gXiSo+iL4amlyncmP5n9rwX14IG
	Wqg57AuF8OGoNSEVAE13ApXNNu8u1nwtth7KgFk4bAh5OxW3uq4hnWQy24OElCSvOwno=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/console: Fix truncation of panic() messages
Message-Id: <E1tvF53-009hvW-2Z@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:33:01 +0000

commit 330ecfc7c1bea7699d3783c8d733cab53e933d39
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:13:44 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:13:44 2025 +0100

    xen/console: Fix truncation of panic() messages
    
    The panic() function uses a static buffer to format its arguments into, simply
    to emit the result via printk("%s", buf).  This buffer is not large enough for
    some existing users in Xen.  e.g.:
    
      (XEN) ****************************************
      (XEN) Panic on CPU 0:
      (XEN) Invalid device tree blob at physical address 0x46a00000.
      (XEN) The DTB must be 8-byte aligned and must not exceed 2 MB in size.
      (XEN)
      (XEN) Plea****************************************
    
    The remainder of this particular message is 'e check your bootloader.', but
    has been inherited by RISC-V from ARM.
    
    It is also pointless double buffering.  Implement vprintk() beside printk(),
    and use it directly rather than rendering into a local buffer, removing it as
    one source of message limitation.
    
    This marginally simplifies panic(), and drops a global used-once buffer.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 81f8b1dd9407e4a3d9dc058b7fbbc591168649ad
    master date: 2025-02-18 14:15:58 +0000
---
 xen/drivers/char/console.c | 21 +++++++++++++--------
 xen/include/xen/lib.h      |  2 ++
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 3a3a97bcbe..a18cf7dfa0 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -961,11 +961,17 @@ static void vprintk_common(const char *prefix, const char *fmt, va_list args)
     local_irq_restore(flags);
 }
 
+void vprintk(const char *fmt, va_list args)
+{
+    vprintk_common("(XEN) ", fmt, args);
+}
+
 void printk(const char *fmt, ...)
 {
     va_list args;
+
     va_start(args, fmt);
-    vprintk_common("(XEN) ", fmt, args);
+    vprintk(fmt, args);
     va_end(args);
 }
 
@@ -1267,23 +1273,22 @@ void panic(const char *fmt, ...)
     va_list args;
     unsigned long flags;
     static DEFINE_SPINLOCK(lock);
-    static char buf[128];
 
     spin_debug_disable();
     spinlock_profile_printall('\0');
     debugtrace_dump();
 
-    /* Protects buf[] and ensure multi-line message prints atomically. */
+    /* Ensure multi-line message prints atomically. */
     spin_lock_irqsave(&lock, flags);
 
-    va_start(args, fmt);
-    (void)vsnprintf(buf, sizeof(buf), fmt, args);
-    va_end(args);
-
     console_start_sync();
     printk("\n****************************************\n");
     printk("Panic on CPU %d:\n", smp_processor_id());
-    printk("%s", buf);
+
+    va_start(args, fmt);
+    vprintk(fmt, args);
+    va_end(args);
+
     printk("****************************************\n\n");
     if ( opt_noreboot )
         printk("Manual reset required ('noreboot' specified)\n");
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 394319c818..544d45cb9d 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -61,6 +61,8 @@ debugtrace_printk(const char *fmt, ...) {}
 #define _p(_x) ((void *)(unsigned long)(_x))
 extern void printk(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2), cold));
+void vprintk(const char *fmt, va_list args)
+    __attribute__ ((format (printf, 1, 0), cold));
 
 #define printk_once(fmt, args...)               \
 ({                                              \
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:33:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921941.1325729 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF5E-0003TF-TQ; Thu, 20 Mar 2025 12:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921941.1325729; Thu, 20 Mar 2025 12:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF5E-0003T7-P0; Thu, 20 Mar 2025 12:33:12 +0000
Received: by outflank-mailman (input) for mailman id 921941;
 Thu, 20 Mar 2025 12:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF5D-0003Sx-VB
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF5E-00EykP-0X
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF5D-009hxR-2r
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fjQfwnkFoenm1JihD2MTt5lbEZKclGe5W9K7BLEzslk=; b=skvcvrMqdChgD+4d1m2484/m/Q
	yDfv1EB6GlFuamsuCCfNXnLS0wO4v8JIk8BIBNuxMbv+itioEPpJvEG0q0qUWOdH0DWeN4xrr3c6L
	6UoGNxGqTlxxlD8Enivzyfrvs2VXrdLnVBtCaFz6eh3XayVYJr07QBGe+QUTj8rzovsE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/memory: Make resource_max_frames() to return 0 on unknown type
Message-Id: <E1tvF5D-009hxR-2r@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:33:11 +0000

commit 93027a991a89795c312e20a1c404321ce15ce404
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Thu Mar 20 13:14:27 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:14:27 2025 +0100

    xen/memory: Make resource_max_frames() to return 0 on unknown type
    
    This is actually what the caller acquire_resource() expects on any kind
    of error (the comment on top of resource_max_frames() also suggests that).
    Otherwise, the caller will treat -errno as a valid value and propagate incorrect
    nr_frames to the VM. As a possible consequence, a VM trying to query a resource
    size of an unknown type will get the success result from the hypercall and obtain
    nr_frames 4294967201.
    
    Also, add an ASSERT_UNREACHABLE() in the default case of _acquire_resource(),
    normally we won't get to this point, as an unknown type will always be rejected
    earlier in resource_max_frames().
    
    Also, update test-resource app to verify that Xen can deal with invalid
    (unknown) resource type properly.
    
    Fixes: 9244528955de ("xen/memory: Fix acquire_resource size semantics")
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9b8708290002f0a4d0b363e0c66ce945f6b520bd
    master date: 2025-02-18 14:47:34 +0000
---
 tools/tests/resource/test-resource.c | 10 ++++++++++
 xen/common/memory.c                  |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
index 1b10be16a6..a7f2d04643 100644
--- a/tools/tests/resource/test-resource.c
+++ b/tools/tests/resource/test-resource.c
@@ -123,6 +123,16 @@ static void test_gnttab(uint32_t domid, unsigned int nr_frames,
         fail("    Fail: Managed to map gnttab v2 status frames in v1 mode\n");
         xenforeignmemory_unmap_resource(fh, res);
     }
+
+    /*
+     * If this check starts failing, you've found the right place to test your
+     * addition to the Acquire Resource infrastructure.
+     */
+    rc = xenforeignmemory_resource_size(fh, domid, 3, 0, &size);
+
+    /* Check that Xen rejected the resource type. */
+    if ( !rc )
+        fail("    Fail: Expected error on an invalid resource type, got success\n");
 }
 
 static void test_domain_configurations(void)
diff --git a/xen/common/memory.c b/xen/common/memory.c
index de2cc7ad92..1f0a9d7e5f 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1156,7 +1156,7 @@ static unsigned int resource_max_frames(const struct domain *d,
         return d->vmtrace_size >> PAGE_SHIFT;
 
     default:
-        return -EOPNOTSUPP;
+        return 0;
     }
 }
 
@@ -1239,6 +1239,7 @@ static int _acquire_resource(
         return acquire_vmtrace_buf(d, id, frame, nr_frames, mfn_list);
 
     default:
+        ASSERT_UNREACHABLE();
         return -EOPNOTSUPP;
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:33:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921942.1325730 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF5P-0003Vx-T5; Thu, 20 Mar 2025 12:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921942.1325730; Thu, 20 Mar 2025 12:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF5P-0003Vp-QQ; Thu, 20 Mar 2025 12:33:23 +0000
Received: by outflank-mailman (input) for mailman id 921942;
 Thu, 20 Mar 2025 12:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF5O-0003Vi-1i
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF5O-00EykV-0q
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF5N-009hyP-3B
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IuaTyh4eN84NQCzImpPqNujaDDMynCUoCZSMSxnwhQY=; b=wLOC2GngTXiLPbfhu9iGX8DAMY
	VzsIGgm9fWU8YfmTgfZjI9ygP2SuvZAqGBaLHbA3SqIxPfxCD90/B9OsTDdd7hPfQMmgqbbxeSjn4
	qD9SUBY1unYW54yfsjmCSWeQKTBMtxU8ZsbIgiWhekwlR6zydii5K3QFU3XBQkpCK4YU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/svm: Separate STI and VMRUN instructions in svm_asm_do_resume()
Message-Id: <E1tvF5N-009hyP-3B@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:33:21 +0000

commit b067751570d77e661e22c8b177d1fff4980c4b6a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:14:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:14:51 2025 +0100

    x86/svm: Separate STI and VMRUN instructions in svm_asm_do_resume()
    
    There is a corner case in the VMRUN instruction where its INTR_SHADOW state
    leaks into guest state if a VMExit occurs before the VMRUN is complete.  An
    example of this could be taking #NPF due to event injection.
    
    Xen can safely execute STI anywhere between CLGI and VMRUN, as CLGI blocks
    external interrupts too.  However, an exception (while fatal) will appear to
    be in an irqs-on region (as GIF isn't considered), so position the STI after
    the speculation actions but prior to the GPR pops.
    
    Link: https://lore.kernel.org/all/CADH9ctBs1YPmE4aCfGPNBwA10cA8RuAk2gO7542DjMZgs4uzJQ@mail.gmail.com/
    Fixes: 66b245d9eaeb ("SVM: limit GIF=0 region")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c989ff614f6bad48b3bd4b32694f711b31c7b2d6
    master date: 2025-02-19 12:45:48 +0000
---
 xen/arch/x86/hvm/svm/entry.S | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index 6fd9652c04..91edb33459 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -74,6 +74,14 @@ __UNLIKELY_END(nsvm_hap)
         ALTERNATIVE "", svm_vmentry_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         ALTERNATIVE "", DO_SPEC_CTRL_DIV, X86_FEATURE_SC_DIV
 
+        /*
+         * Set EFLAGS.IF after CLGI covers us from real interrupts, but not
+         * immediately prior to VMRUN.  The VMRUN instruction leaks it's
+         * INTR_SHADOW into guest state if a VMExit occurs before VMRUN
+         * completes (e.g. taking #NPF during event injecting.)
+         */
+        sti
+
         pop  %r15
         pop  %r14
         pop  %r13
@@ -91,7 +99,6 @@ __UNLIKELY_END(nsvm_hap)
         pop  %rsi
         pop  %rdi
 
-        sti
         vmrun
 
         SAVE_ALL
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:33:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921943.1325735 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF5Z-0003YN-UZ; Thu, 20 Mar 2025 12:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921943.1325735; Thu, 20 Mar 2025 12:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF5Z-0003YF-Rx; Thu, 20 Mar 2025 12:33:33 +0000
Received: by outflank-mailman (input) for mailman id 921943;
 Thu, 20 Mar 2025 12:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF5Y-0003Y3-8G
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF5Y-00Eykd-18
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF5Y-009hzP-0G
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ODGtf16hfbNB9LUgLB7MdpykFdvhjUN+XGpEDQOZVAk=; b=TuQ1tOB35pJROGVmsn2Odt3LsO
	WQw1y29QNyjGeS1ykXPiKitKlIKkQtsroyZecesLG08c4dHyTKRTsxcbs0e1OEzbJYpHwSy8CKY1A
	SERHanMBtr6XcQ76xB84dsljNIdl5qQt/ufFPiHDJEwWvXZ8+l7+OtbzbGq9gUGhEJa4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/emul: dump unhandled memory accesses for PVH dom0
Message-Id: <E1tvF5Y-009hzP-0G@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:33:32 +0000

commit c6366b64dd498727bfb0e3aacc37c6db6d7242f1
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:15:48 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:15:48 2025 +0100

    x86/emul: dump unhandled memory accesses for PVH dom0
    
    A PV dom0 can map any host memory as long as it's allowed by the IO
    capability range in d->iomem_caps.  On the other hand, a PVH dom0 has no
    way to populate MMIO region onto it's p2m, so it's limited to what Xen
    initially populates on the p2m based on the host memory map and the enabled
    device BARs.
    
    Introduce a new debug build only printk that reports attempts by dom0 to
    access addresses not populated on the p2m, and not handled by any emulator.
    This is for information purposes only, but might allow getting an idea of
    what MMIO ranges might be missing on the p2m.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 43d8a80a0cccfe3715bb3178b5c15fb983979651
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/hvm/emulate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index fb4de6ee0a..2664fe0c71 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -337,6 +337,9 @@ static int hvmemul_do_io(
         /* If there is no suitable backing DM, just ignore accesses */
         if ( !s )
         {
+            if ( is_mmio && is_hardware_domain(currd) )
+                gdprintk(XENLOG_DEBUG, "unhandled memory %s %#lx size %u\n",
+                         dir ? "read from" : "write to", addr, size);
             rc = hvm_process_io_intercept(&null_handler, &p);
             vio->req.state = STATE_IOREQ_NONE;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:33:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921944.1325739 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF5k-0003cH-0H; Thu, 20 Mar 2025 12:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921944.1325739; Thu, 20 Mar 2025 12:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF5j-0003cA-TR; Thu, 20 Mar 2025 12:33:43 +0000
Received: by outflank-mailman (input) for mailman id 921944;
 Thu, 20 Mar 2025 12:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF5i-0003bu-9U
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF5i-00Eykk-1b
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF5i-009i0U-0Y
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1Vag+Gu5oNeTywYwHi1RvkQrz8pj0GM75nMpefdGQXw=; b=Vhc4+ODmVApNK+lJz+YKh+RGu1
	D981kTW0aQ86m38XW6117B062t6FJl0pZPRgJMDx+0e836nt1q4SBbgif+7K8EY6SV9GOk4OLWlgw
	heGCKdiSgf9kkhgu3MrrPdey/JiO8xlXgK1BL5UhxK+gQRJPUct/IZaL/wRYg8tItQPA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/dom0: attempt to fixup p2m page-faults for PVH dom0
Message-Id: <E1tvF5i-009i0U-0Y@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:33:42 +0000

commit 2f47f9df89c8655d16bef125fb48c63170977582
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:16:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:16:14 2025 +0100

    x86/dom0: attempt to fixup p2m page-faults for PVH dom0
    
    When building a PVH dom0 Xen attempts to map all (relevant) MMIO regions
    into the p2m for dom0 access.  However the information Xen has about the
    host memory map is limited.  Xen doesn't have access to any resources
    described in ACPI dynamic tables, and hence the p2m mappings provided might
    not be complete.
    
    PV doesn't suffer from this issue because a PV dom0 is capable of mapping
    into it's page-tables any address not explicitly banned in d->iomem_caps.
    
    Introduce a new command line options that allows Xen to attempt to fixup
    the p2m page-faults, by creating p2m identity maps in response to p2m
    page-faults.
    
    This is aimed as a workaround to small ACPI regions Xen doesn't know about.
    Note that missing large MMIO regions mapped in this way will lead to
    slowness due to the VM exit processing, plus the mappings will always use
    small pages.
    
    The ultimate aim is to attempt to bring better parity with a classic PV
    dom0.
    
    Note such fixup rely on the CPU doing the access to the unpopulated
    address.  If the access is attempted from a device instead there's no
    possible way to fixup, as IOMMU page-fault are asynchronous.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    master commit: 104591f5dd675d7bfb04885dace0e4e5a097fc1e
    master date: 2025-03-05 10:26:46 +0100
---
 CHANGELOG.md                           |  6 +++
 docs/misc/xen-command-line.pandoc      | 16 +++++++-
 xen/arch/x86/dom0_build.c              |  5 +++
 xen/arch/x86/hvm/emulate.c             | 74 +++++++++++++++++++++++++++++++++-
 xen/arch/x86/include/asm/hvm/emulate.h |  3 ++
 5 files changed, 101 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1639886aa7..216e66b576 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
+## [4.19.2](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.19.2)
+
+### Added
+ - On x86:
+   - Option to attempt to fixup p2m page-faults on PVH dom0.
+
 ## [4.19.1](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.19.1)
 
 ### Changed
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index a398891bc0..ff10ff9f65 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -806,7 +806,8 @@ Specify the bit width of the DMA heap.
 
 ### dom0
     = List of [ pv | pvh, shadow=<bool>, verbose=<bool>,
-                cpuid-faulting=<bool>, msr-relaxed=<bool> ] (x86)
+                cpuid-faulting=<bool>, msr-relaxed=<bool>,
+                pf-fixup=<bool> ] (x86)
 
     = List of [ sve=<integer> ] (Arm64)
 
@@ -867,6 +868,19 @@ Controls for how dom0 is constructed on x86 systems.
 
     If using this option is necessary to fix an issue, please report a bug.
 
+*   The `pf-fixup` boolean is only applicable when using a PVH dom0 and
+    defaults to false.
+
+    When running dom0 in PVH mode the dom0 kernel has no way to map MMIO
+    regions into its physical memory map, such mode relies on Xen dom0 builder
+    populating the physical memory map with all MMIO regions that dom0 should
+    access.  However Xen doesn't have a complete picture of the host memory
+    map, due to not being able to process ACPI dynamic tables.
+
+    The `pf-fixup` option allows Xen to attempt to add missing MMIO regions
+    to the dom0 physical memory map in response to page-faults generated by
+    dom0 trying to access unpopulated entries in the memory map.
+
 Enables features on dom0 on Arm systems.
 
 *   The `sve` integer parameter enables Arm SVE usage for Dom0 and sets the
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 8d56705a08..6b22f59ab2 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -16,6 +16,7 @@
 #include <asm/dom0_build.h>
 #include <asm/guest.h>
 #include <asm/hpet.h>
+#include <asm/hvm/emulate.h>
 #include <asm/io_apic.h>
 #include <asm/p2m.h>
 #include <asm/setup.h>
@@ -286,6 +287,10 @@ int __init parse_arch_dom0_param(const char *s, const char *e)
         opt_dom0_cpuid_faulting = val;
     else if ( (val = parse_boolean("msr-relaxed", s, e)) >= 0 )
         opt_dom0_msr_relaxed = val;
+#ifdef CONFIG_HVM
+    else if ( (val = parse_boolean("pf-fixup", s, e)) >= 0 )
+        opt_dom0_pf_fixup = val;
+#endif
     else
         return -EINVAL;
 
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 2664fe0c71..abc4f5f261 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -10,12 +10,15 @@
  */
 
 #include <xen/init.h>
+#include <xen/iocap.h>
 #include <xen/ioreq.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <xen/paging.h>
 #include <xen/trace.h>
 #include <xen/vm_event.h>
+
+#include <asm/altp2m.h>
 #include <asm/event.h>
 #include <asm/i387.h>
 #include <asm/xstate.h>
@@ -161,6 +164,36 @@ void hvmemul_cancel(struct vcpu *v)
     hvmemul_cache_disable(v);
 }
 
+bool __ro_after_init opt_dom0_pf_fixup;
+static int hwdom_fixup_p2m(paddr_t addr)
+{
+    unsigned long gfn = paddr_to_pfn(addr);
+    struct domain *currd = current->domain;
+    p2m_type_t type;
+    mfn_t mfn;
+    int rc;
+
+    ASSERT(is_hardware_domain(currd));
+    ASSERT(!altp2m_active(currd));
+
+    /*
+     * Fixups are only applied for MMIO holes, and rely on the hardware domain
+     * having identity mappings for non RAM regions (gfn == mfn).
+     */
+    if ( !iomem_access_permitted(currd, gfn, gfn) ||
+         !is_memory_hole(_mfn(gfn), _mfn(gfn)) )
+        return -EPERM;
+
+    mfn = get_gfn(currd, gfn, &type);
+    if ( !mfn_eq(mfn, INVALID_MFN) || !p2m_is_hole(type) )
+        rc = mfn_eq(mfn, _mfn(gfn)) ? -EEXIST : -ENOTEMPTY;
+    else
+        rc = set_mmio_p2m_entry(currd, _gfn(gfn), _mfn(gfn), 0);
+    put_gfn(currd, gfn);
+
+    return rc;
+}
+
 static int hvmemul_do_io(
     bool is_mmio, paddr_t addr, unsigned long *reps, unsigned int size,
     uint8_t dir, bool df, bool data_is_addr, uintptr_t data)
@@ -338,8 +371,45 @@ static int hvmemul_do_io(
         if ( !s )
         {
             if ( is_mmio && is_hardware_domain(currd) )
-                gdprintk(XENLOG_DEBUG, "unhandled memory %s %#lx size %u\n",
-                         dir ? "read from" : "write to", addr, size);
+            {
+                /*
+                 * PVH dom0 is likely missing MMIO mappings on the p2m, due to
+                 * the incomplete information Xen has about the memory layout.
+                 *
+                 * Either print a message to note dom0 attempted to access an
+                 * unpopulated GPA, or try to fixup the p2m by creating an
+                 * identity mapping for the faulting GPA.
+                 */
+                if ( opt_dom0_pf_fixup )
+                {
+                    int inner_rc = hwdom_fixup_p2m(addr);
+
+                    if ( !inner_rc || inner_rc == -EEXIST )
+                    {
+                        if ( !inner_rc )
+                            gdprintk(XENLOG_DEBUG,
+                                     "fixup p2m mapping for page %lx added\n",
+                                     paddr_to_pfn(addr));
+                        else
+                            gprintk(XENLOG_INFO,
+                                    "fixup p2m mapping for page %lx already present\n",
+                                    paddr_to_pfn(addr));
+
+                        rc = X86EMUL_RETRY;
+                        vio->req.state = STATE_IOREQ_NONE;
+                        break;
+                    }
+
+                    gprintk(XENLOG_WARNING,
+                            "unable to fixup memory %s %#lx size %u: %d\n",
+                            dir ? "read from" : "write to", addr, size,
+                            inner_rc);
+                }
+                else
+                    gdprintk(XENLOG_DEBUG,
+                             "unhandled memory %s %#lx size %u\n",
+                             dir ? "read from" : "write to", addr, size);
+            }
             rc = hvm_process_io_intercept(&null_handler, &p);
             vio->req.state = STATE_IOREQ_NONE;
         }
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index 2e1eedefa7..108472f6f7 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -147,6 +147,9 @@ static inline void hvmemul_write_cache(const struct vcpu *v, paddr_t gpa,
 void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
                               struct hvm_emulate_ctxt *hvmemul_ctxt, int rc);
 
+/* For PVH dom0: signal whether to attempt fixup of p2m page-faults. */
+extern bool opt_dom0_pf_fixup;
+
 #endif /* __ASM_X86_HVM_EMULATE_H__ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:33:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921945.1325743 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF5u-0003f0-2m; Thu, 20 Mar 2025 12:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921945.1325743; Thu, 20 Mar 2025 12:33:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF5u-0003es-0I; Thu, 20 Mar 2025 12:33:54 +0000
Received: by outflank-mailman (input) for mailman id 921945;
 Thu, 20 Mar 2025 12:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF5s-0003ec-E0
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF5s-00Eyl8-23
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF5s-009i2S-11
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+Wni3kDpn390xbF3J+p5blvHTkyTWdEOjZXkasu8mZY=; b=Mfhh7TvZzY/qh1NEignrxhuUya
	yTgBxAVJ3BBSV8ACt07kHLnMTJGZ9x9TODNQ3HEEO/2WXHj+DJFR6jWuAVj4JddfbtgRjWUT95DAm
	4K1ryLfcDk9Aze1oPjNAqsv+GrXtyK79CAhWz115HSeoki1G9FKYERNWsYlFsmyX0YYs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
Message-Id: <E1tvF5s-009i2S-11@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:33:52 +0000

commit eaa79d83b640f36b4973b15193d7405969030640
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:16:37 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:16:37 2025 +0100

    x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
    
    The logic in dom0_setup_permissions() sets the maximum bound in
    ->iomem_caps unconditionally using paddr_bits, which is not correct for HVM
    based domains.  Instead use domain_max_paddr_bits() to get the correct
    maximum paddr bits for each possible domain type.
    
    Switch to using PFN_DOWN() instead of PAGE_SHIFT, as that's shorter.
    
    Fixes: 53de839fb409 ('x86: constrain MFN range Dom0 may access')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a00e08799cc7657d2a1aca158f4ad43d4c9103e7
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 6b22f59ab2..330af7cf76 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -481,7 +481,8 @@ int __init dom0_setup_permissions(struct domain *d)
 
     /* The hardware domain is initially permitted full I/O capabilities. */
     rc = ioports_permit_access(d, 0, 0xFFFF);
-    rc |= iomem_permit_access(d, 0UL, (1UL << (paddr_bits - PAGE_SHIFT)) - 1);
+    rc |= iomem_permit_access(d, 0UL,
+                              PFN_DOWN(1UL << domain_max_paddr_bits(d)) - 1);
     rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
 
     /* Modify I/O port access permissions. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:34:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921946.1325747 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF64-0003hJ-4Z; Thu, 20 Mar 2025 12:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921946.1325747; Thu, 20 Mar 2025 12:34:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF64-0003h9-1l; Thu, 20 Mar 2025 12:34:04 +0000
Received: by outflank-mailman (input) for mailman id 921946;
 Thu, 20 Mar 2025 12:34:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF62-0003gx-Ic
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:34:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF62-00EylP-2W
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF62-009i4U-1T
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:34:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZvhuG69qk4QMPgSRQMwbVvu6SeCB+9sIz6s6hki/SrE=; b=qejCR8h36USerC6351YizxFv6l
	aQBGxhthhi5QYi0rELhAUd0cgDquLOzjmGjgtv3qkZ9A4ZzZj2fy+Lk7Sbf5P3CHatGNNM48h/dqq
	HouL5C2TO/+gIs9Lm092T/vckLcjhgsvEe93nfSg/qhkNljO99NkJMy9alRsqe6NhSTQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/iommu: account for IOMEM caps when populating dom0 IOMMU page-tables
Message-Id: <E1tvF62-009i4U-1T@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:34:02 +0000

commit 74e860e45ec839393e4a3036f51b5af2c4aa7efe
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:16:56 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:16:56 2025 +0100

    x86/iommu: account for IOMEM caps when populating dom0 IOMMU page-tables
    
    The current code in arch_iommu_hwdom_init() kind of open-codes the same
    MMIO permission ranges that are added to the hardware domain ->iomem_caps.
    Avoid this duplication and use ->iomem_caps in arch_iommu_hwdom_init() to
    filter which memory regions should be added to the dom0 IOMMU page-tables.
    
    Note the IO-APIC and MCFG page(s) must be set as not accessible for a PVH
    dom0, otherwise the internal Xen emulation for those ranges won't work.
    This requires adjustments in dom0_setup_permissions().
    
    The call to pvh_setup_mmcfg() in dom0_construct_pvh() must now strictly be
    done ahead of setting up dom0 permissions, so take the opportunity to also
    put it inside the existing is_hardware_domain() region.
    
    Also the special casing of E820_UNUSABLE regions no longer needs to be done
    in arch_iommu_hwdom_init(), as those regions are already blocked in
    ->iomem_caps and thus would be removed from the rangeset as part of
    ->iomem_caps processing in arch_iommu_hwdom_init().  The E820_UNUSABLE
    regions below 1Mb are not removed from ->iomem_caps, that's a slight
    difference for the IOMMU created page-tables, but the aim is to allow
    access to the same memory either from the CPU or the IOMMU page-tables.
    
    Since ->iomem_caps already takes into account the domain max paddr, there's
    no need to remove any regions past the last address addressable by the
    domain, as applying ->iomem_caps would have already taken care of that.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62f3fc5296c452285e81adb50976bde2d68d3181
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c           | 11 +++++-
 xen/arch/x86/hvm/dom0_build.c       | 14 ++++----
 xen/arch/x86/hvm/io.c               |  6 ++--
 xen/arch/x86/include/asm/hvm/io.h   |  4 +--
 xen/drivers/passthrough/x86/iommu.c | 67 +++++++++++++++----------------------
 5 files changed, 49 insertions(+), 53 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 330af7cf76..c0b2ad34b5 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -558,7 +558,9 @@ int __init dom0_setup_permissions(struct domain *d)
     for ( i = 0; i < nr_ioapics; i++ )
     {
         mfn = paddr_to_pfn(mp_ioapics[i].mpc_apicaddr);
-        if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
+        /* If emulating IO-APIC(s) make sure the base address is unmapped. */
+        if ( has_vioapic(d) ||
+             !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
     /* MSI range. */
@@ -599,6 +601,13 @@ int __init dom0_setup_permissions(struct domain *d)
             rc |= rangeset_add_singleton(mmio_ro_ranges, mfn);
     }
 
+    if ( has_vpci(d) )
+        /*
+         * TODO: runtime added MMCFG regions are not checked to make sure they
+         * don't overlap with already mapped regions, thus preventing trapping.
+         */
+        rc |= vpci_mmcfg_deny_access(d);
+
     return rc;
 }
 
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 3dd913bdb0..81445d5b37 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1312,6 +1312,13 @@ int __init dom0_construct_pvh(struct domain *d, const module_t *image,
 
     if ( is_hardware_domain(d) )
     {
+        /*
+         * MMCFG initialization must be performed before setting domain
+         * permissions, as the MCFG areas must not be part of the domain IOMEM
+         * accessible regions.
+         */
+        pvh_setup_mmcfg(d);
+
         /*
          * Setup permissions early so that calls to add MMIO regions to the
          * p2m as part of vPCI setup don't fail due to permission checks.
@@ -1324,13 +1331,6 @@ int __init dom0_construct_pvh(struct domain *d, const module_t *image,
         }
     }
 
-    /*
-     * NB: MMCFG initialization needs to be performed before iommu
-     * initialization so the iommu code can fetch the MMCFG regions used by the
-     * domain.
-     */
-    pvh_setup_mmcfg(d);
-
     /*
      * Craft dom0 physical memory map and set the paging allocation. This must
      * be done before the iommu initializion, since iommu initialization code
diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index db726b3817..de6ee6c4dd 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -363,14 +363,14 @@ static const struct hvm_mmcfg *vpci_mmcfg_find(const struct domain *d,
     return NULL;
 }
 
-int __hwdom_init vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r)
+int __hwdom_init vpci_mmcfg_deny_access(struct domain *d)
 {
     const struct hvm_mmcfg *mmcfg;
 
     list_for_each_entry ( mmcfg, &d->arch.hvm.mmcfg_regions, next )
     {
-        int rc = rangeset_remove_range(r, PFN_DOWN(mmcfg->addr),
-                                       PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
+        int rc = iomem_deny_access(d, PFN_DOWN(mmcfg->addr),
+                                   PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
 
         if ( rc )
             return rc;
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index d72b29f73f..377c59a5c4 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -134,8 +134,8 @@ int register_vpci_mmcfg_handler(struct domain *d, paddr_t addr,
 /* Destroy tracked MMCFG areas. */
 void destroy_vpci_mmcfg(struct domain *d);
 
-/* Remove MMCFG regions from a given rangeset. */
-int vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r);
+/* Remove MMCFG regions from a domain ->iomem_caps. */
+int vpci_mmcfg_deny_access(struct domain *d);
 
 #endif /* __ASM_X86_HVM_IO_H__ */
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 8b1e0596b8..67f025c1ec 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -320,6 +320,26 @@ static int __hwdom_init cf_check map_subtract(unsigned long s, unsigned long e,
     return rangeset_remove_range(map, s, e);
 }
 
+struct handle_iomemcap {
+    struct rangeset *r;
+    unsigned long last;
+};
+static int __hwdom_init cf_check map_subtract_iomemcap(unsigned long s,
+                                                       unsigned long e,
+                                                       void *data)
+{
+    struct handle_iomemcap *h = data;
+    int rc = 0;
+
+    if ( h->last != s )
+        rc = rangeset_remove_range(h->r, h->last, s - 1);
+
+    ASSERT(e < ~0UL);
+    h->last = e + 1;
+
+    return rc;
+}
+
 struct map_data {
     struct domain *d;
     unsigned int flush_flags;
@@ -400,6 +420,7 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
     unsigned int i;
     struct rangeset *map;
     struct map_data map_data = { .d = d };
+    struct handle_iomemcap iomem = {};
     int rc;
 
     BUG_ON(!is_hardware_domain(d));
@@ -442,14 +463,6 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
 
         switch ( entry.type )
         {
-        case E820_UNUSABLE:
-            /* Only relevant for inclusive mode, otherwise this is a no-op. */
-            rc = rangeset_remove_range(map, PFN_DOWN(entry.addr),
-                                       PFN_DOWN(entry.addr + entry.size - 1));
-            if ( rc )
-                panic("IOMMU failed to remove unusable memory: %d\n", rc);
-            continue;
-
         case E820_RESERVED:
             if ( !iommu_hwdom_inclusive && !iommu_hwdom_reserved )
                 continue;
@@ -475,22 +488,13 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
     if ( rc )
         panic("IOMMU failed to remove Xen ranges: %d\n", rc);
 
-    /* Remove any overlap with the Interrupt Address Range. */
-    rc = rangeset_remove_range(map, 0xfee00, 0xfeeff);
+    iomem.r = map;
+    rc = rangeset_report_ranges(d->iomem_caps, 0, ~0UL, map_subtract_iomemcap,
+                                &iomem);
+    if ( !rc && iomem.last < ~0UL )
+        rc = rangeset_remove_range(map, iomem.last, ~0UL);
     if ( rc )
-        panic("IOMMU failed to remove Interrupt Address Range: %d\n", rc);
-
-    /* If emulating IO-APIC(s) make sure the base address is unmapped. */
-    if ( has_vioapic(d) )
-    {
-        for ( i = 0; i < d->arch.hvm.nr_vioapics; i++ )
-        {
-            rc = rangeset_remove_singleton(map,
-                PFN_DOWN(domain_vioapic(d, i)->base_address));
-            if ( rc )
-                panic("IOMMU failed to remove IO-APIC: %d\n", rc);
-        }
-    }
+        panic("IOMMU failed to remove forbidden regions: %d\n", rc);
 
     if ( is_pv_domain(d) )
     {
@@ -506,23 +510,6 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
             panic("IOMMU failed to remove read-only regions: %d\n", rc);
     }
 
-    if ( has_vpci(d) )
-    {
-        /*
-         * TODO: runtime added MMCFG regions are not checked to make sure they
-         * don't overlap with already mapped regions, thus preventing trapping.
-         */
-        rc = vpci_subtract_mmcfg(d, map);
-        if ( rc )
-            panic("IOMMU unable to remove MMCFG areas: %d\n", rc);
-    }
-
-    /* Remove any regions past the last address addressable by the domain. */
-    rc = rangeset_remove_range(map, PFN_DOWN(1UL << domain_max_paddr_bits(d)),
-                               ~0UL);
-    if ( rc )
-        panic("IOMMU unable to remove unaddressable ranges: %d\n", rc);
-
     if ( iommu_verbose )
         printk(XENLOG_INFO "%pd: identity mappings for IOMMU:\n", d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:34:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921947.1325751 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF6E-0003k8-62; Thu, 20 Mar 2025 12:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921947.1325751; Thu, 20 Mar 2025 12:34:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF6E-0003k0-3G; Thu, 20 Mar 2025 12:34:14 +0000
Received: by outflank-mailman (input) for mailman id 921947;
 Thu, 20 Mar 2025 12:34:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF6C-0003jn-LE
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:34:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF6C-00EylU-2m
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF6C-009i5N-1w
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:34:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x4ABFLubvnwZqj2QlSHvmw9LhhjnDwO/0Cwa9xbzAGI=; b=Bl9UDY/6ROw1G9QSM3Qqz4u5QE
	kdIl/ZJPmuFf4t6kY99MnVJ5iBqp48vhZDfn0gaREYeshOxeDCY6eFwK/vJKeEs50jV1SFsbncaWI
	tvsbAbMvhndGIS24ME22gohfyfm99ocymfa48L0cnxZ0QWqnoowwE/bZPgQIOWiRsfD4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/dom0: be less restrictive with the Interrupt Address Range
Message-Id: <E1tvF6C-009i5N-1w@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:34:12 +0000

commit e665204eb38343bb9ee9ca2a21461659abb01dc3
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:17:17 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:17:17 2025 +0100

    x86/dom0: be less restrictive with the Interrupt Address Range
    
    Xen currently prevents dom0 from creating CPU or IOMMU page-table mappings
    into the interrupt address range [0xfee00000, 0xfeefffff].  This range has
    two different purposes.  For accesses from the CPU is contains the default
    position of local APIC page at 0xfee00000.  For accesses from devices
    it's the MSI address range, so the address field in the MSI entries
    (usually) point to an address on that range to trigger an interrupt.
    
    There are reports of Lenovo Thinkpad devices placing what seems to be the
    UCSI shared mailbox at address 0xfeec2000 in the interrupt address range.
    Attempting to use that device with a Linux PV dom0 leads to an error when
    Linux kernel maps 0xfeec2000:
    
    RIP: e030:xen_mc_flush+0x1e8/0x2b0
     xen_leave_lazy_mmu+0x15/0x60
     vmap_range_noflush+0x408/0x6f0
     __ioremap_caller+0x20d/0x350
     acpi_os_map_iomem+0x1a3/0x1c0
     acpi_ex_system_memory_space_handler+0x229/0x3f0
     acpi_ev_address_space_dispatch+0x17e/0x4c0
     acpi_ex_access_region+0x28a/0x510
     acpi_ex_field_datum_io+0x95/0x5c0
     acpi_ex_extract_from_field+0x36b/0x4e0
     acpi_ex_read_data_from_field+0xcb/0x430
     acpi_ex_resolve_node_to_value+0x2e0/0x530
     acpi_ex_resolve_to_value+0x1e7/0x550
     acpi_ds_evaluate_name_path+0x107/0x170
     acpi_ds_exec_end_op+0x392/0x860
     acpi_ps_parse_loop+0x268/0xa30
     acpi_ps_parse_aml+0x221/0x5e0
     acpi_ps_execute_method+0x171/0x3e0
     acpi_ns_evaluate+0x174/0x5d0
     acpi_evaluate_object+0x167/0x440
     acpi_evaluate_dsm+0xb6/0x130
     ucsi_acpi_dsm+0x53/0x80
     ucsi_acpi_read+0x2e/0x60
     ucsi_register+0x24/0xa0
     ucsi_acpi_probe+0x162/0x1e3
     platform_probe+0x48/0x90
     really_probe+0xde/0x340
     __driver_probe_device+0x78/0x110
     driver_probe_device+0x1f/0x90
     __driver_attach+0xd2/0x1c0
     bus_for_each_dev+0x77/0xc0
     bus_add_driver+0x112/0x1f0
     driver_register+0x72/0xd0
     do_one_initcall+0x48/0x300
     do_init_module+0x60/0x220
     __do_sys_init_module+0x17f/0x1b0
     do_syscall_64+0x82/0x170
    
    Remove the restrictions to create mappings in the interrupt address range
    for dom0.  Note that the restriction to map the local APIC page is enforced
    separately, and that continues to be present.  Additionally make sure the
    emulated local APIC page is also not mapped, in case dom0 is using it.
    
    Note that even if the interrupt address range entries are populated in the
    IOMMU page-tables no device access will reach those pages.  Device accesses
    to the Interrupt Address Range will always be converted into Interrupt
    Messages and are not subject to DMA remapping.
    
    There's also the following restriction noted in Intel VT-d:
    
    > Software must not program paging-structure entries to remap any address to
    > the interrupt address range. Untranslated requests and translation requests
    > that result in an address in the interrupt range will be blocked with
    > condition code LGN.4 or SGN.8. Translated requests with an address in the
    > interrupt address range are treated as Unsupported Request (UR).
    
    Similarly for AMD-Vi:
    
    > Accesses to the interrupt address range (Table 3) are defined to go through
    > the interrupt remapping portion of the IOMMU and not through address
    > translation processing. Therefore, when a transaction is being processed as
    > an interrupt remapping operation, the transaction attribute of
    > pretranslated or untranslated is ignored.
    >
    > Software Note: The IOMMU should
    > not be configured such that an address translation results in a special
    > address such as the interrupt address range.
    
    However those restrictions don't apply to the identity mappings possibly
    created for dom0, since the interrupt address range is never subject to DMA
    remapping, and hence there's no output address after translation that
    belongs to the interrupt address range.
    
    Reported-by: Jürgen Groß <jgross@suse.com>
    Link: https://lore.kernel.org/xen-devel/baade0a7-e204-4743-bda1-282df74e5f89@suse.com/
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 381caa38850771ae218eb6f6d490dc02e40df964
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index c0b2ad34b5..6ee3dfb73f 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -554,6 +554,13 @@ int __init dom0_setup_permissions(struct domain *d)
         mfn = paddr_to_pfn(mp_lapic_addr);
         rc |= iomem_deny_access(d, mfn, mfn);
     }
+    /* If using an emulated local APIC make sure its MMIO is unpopulated. */
+    if ( has_vlapic(d) )
+    {
+        /* Xen doesn't allow changing the local APIC MMIO window position. */
+        mfn = paddr_to_pfn(APIC_DEFAULT_PHYS_BASE);
+        rc |= iomem_deny_access(d, mfn, mfn);
+    }
     /* I/O APICs. */
     for ( i = 0; i < nr_ioapics; i++ )
     {
@@ -563,10 +570,6 @@ int __init dom0_setup_permissions(struct domain *d)
              !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
-    /* MSI range. */
-    rc |= iomem_deny_access(d, paddr_to_pfn(MSI_ADDR_BASE_LO),
-                            paddr_to_pfn(MSI_ADDR_BASE_LO +
-                                         MSI_ADDR_DEST_ID_MASK));
     /* HyperTransport range. */
     if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:34:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:34:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921948.1325755 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF6O-0003nK-7M; Thu, 20 Mar 2025 12:34:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921948.1325755; Thu, 20 Mar 2025 12:34:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF6O-0003nC-4f; Thu, 20 Mar 2025 12:34:24 +0000
Received: by outflank-mailman (input) for mailman id 921948;
 Thu, 20 Mar 2025 12:34:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF6M-0003n3-OR
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:34:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF6M-00Eyla-33
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF6M-009i5y-2C
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:34:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S+8MIMpgtS76eB3tYTenUF9RKxGJhGGrlOd9DdSvPAA=; b=6T9HJ+grh/ft3TyWNhbCPXxOTZ
	wKJg7DRwQPYy1JyvNTVDyC7bz5ZtYjrNV5NkU5RIR49H34Zw/+wrcBAjQysF21APYxLKS1cyYNhZy
	sOJ7xJdCEC8bPKyHT7qcKAz4x7Ug5eZd0AFv1SI0SwBZBdNb7gGarb/3G5sBVxcM1Mt4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] tools/xl: fix channel configuration setting
Message-Id: <E1tvF6M-009i5y-2C@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:34:22 +0000

commit 7c767b7093ad4f6f53760f84eef51d9ca585a7a0
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 20 13:17:41 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:17:41 2025 +0100

    tools/xl: fix channel configuration setting
    
    Channels work differently than other device types: their devid should
    be -1 initially in order to distinguish them from the primary console
    which has the devid of 0.
    
    So when parsing the channel configuration, use
    ARRAY_EXTEND_INIT_NODEVID() in order to avoid overwriting the devid
    set by libxl_device_channel_init().
    
    Fixes: 3a6679634766 ("libxl: set channel devid when not provided by application")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: e1ccced4afe465d6541c5825a0f8d1b8f5fa4253
    master date: 2025-03-05 16:37:37 +0100
---
 tools/xl/xl_parse.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index e3a4800f6e..9018efa117 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2387,8 +2387,9 @@ void parse_config_data(const char *config_source,
             char *path = NULL;
             int len;
 
-            chn = ARRAY_EXTEND_INIT(d_config->channels, d_config->num_channels,
-                                   libxl_device_channel_init);
+            chn = ARRAY_EXTEND_INIT_NODEVID(d_config->channels,
+                                            d_config->num_channels,
+                                            libxl_device_channel_init);
 
             split_string_into_string_list(buf, ",", &pairs);
             len = libxl_string_list_length(&pairs);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:34:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:34:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921949.1325759 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF6Y-0003pk-8g; Thu, 20 Mar 2025 12:34:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921949.1325759; Thu, 20 Mar 2025 12:34:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF6Y-0003pc-64; Thu, 20 Mar 2025 12:34:34 +0000
Received: by outflank-mailman (input) for mailman id 921949;
 Thu, 20 Mar 2025 12:34:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF6W-0003pS-Qk
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:34:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF6X-00Eyli-07
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:34:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF6W-009i8g-2T
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:34:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x44H2Oh1WIn4gtYwA0ZvV8Xi6WCdNqhq1dW0n9kblws=; b=h4LJxdYlqBO/Wail965d9xu6UP
	yJZkUiyQQBvLChP2TGj4CKUuHmNvp0FW7s/x90HMWNnxZRVwCC4I3l5sPXpewtTrVLapvPnlL+JwF
	G5esms/6iTaX/tHeHvL1CxGNX+zHKnMqLneywwseK4b1oO8RC1LnrDpGd4GDaodr8Py0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/vlapic: Fix handling of writes to APIC_ESR
Message-Id: <E1tvF6W-009i8g-2T@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:34:32 +0000

commit da239140a48eb9b2b30784ee5dd420b6f879d189
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:18:23 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:18:23 2025 +0100

    x86/vlapic: Fix handling of writes to APIC_ESR
    
    Xen currently presents APIC_ESR to guests as a simple read/write register.
    
    This is incorrect.  The SDM states:
    
      The ESR is a write/read register. Before attempt to read from the ESR,
      software should first write to it. (The value written does not affect the
      values read subsequently; only zero may be written in x2APIC mode.) This
      write clears any previously logged errors and updates the ESR with any
      errors detected since the last write to the ESR.
    
    Introduce a new pending_esr field in hvm_hw_lapic.
    
    Update vlapic_error() to accumulate errors here, and extend vlapic_reg_write()
    to discard the written value and transfer pending_esr into APIC_ESR.  Reads
    are still as before.
    
    Importantly, this means that guests no longer destroys the ESR value it's
    looking for in the LVTERR handler when following the SDM instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b28b590d4a23894672f1dd7fb98cdf9926ecb282
    master date: 2025-03-07 14:34:08 +0000
---
 xen/arch/x86/hvm/vlapic.c              | 17 +++++++++++++++--
 xen/include/public/arch-x86/hvm/save.h |  1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 46ff758904..f34bbfb3cc 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -108,7 +108,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     uint32_t esr;
 
     spin_lock_irqsave(&vlapic->esr_lock, flags);
-    esr = vlapic_get_reg(vlapic, APIC_ESR);
+    esr = vlapic->hw.pending_esr;
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
@@ -127,7 +127,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
                  errmask |= APIC_ESR_RECVILL;
         }
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+        vlapic->hw.pending_esr |= errmask;
 
         if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
@@ -799,6 +799,19 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         vlapic_set_reg(vlapic, APIC_ID, val);
         break;
 
+    case APIC_ESR:
+    {
+        unsigned long flags;
+
+        spin_lock_irqsave(&vlapic->esr_lock, flags);
+        val = vlapic->hw.pending_esr;
+        vlapic->hw.pending_esr = 0;
+        spin_unlock_irqrestore(&vlapic->esr_lock, flags);
+
+        vlapic_set_reg(vlapic, APIC_ESR, val);
+        break;
+    }
+
     case APIC_TASKPRI:
         vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff);
         break;
diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h
index 7ecacadde1..9c4bfc7ebd 100644
--- a/xen/include/public/arch-x86/hvm/save.h
+++ b/xen/include/public/arch-x86/hvm/save.h
@@ -394,6 +394,7 @@ struct hvm_hw_lapic {
     uint32_t             disabled; /* VLAPIC_xx_DISABLED */
     uint32_t             timer_divisor;
     uint64_t             tdt_msr;
+    uint32_t             pending_esr;
 };
 
 DECLARE_HVM_SAVE_TYPE(LAPIC, 5, struct hvm_hw_lapic);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:34:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:34:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921950.1325764 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF6i-0003sn-Br; Thu, 20 Mar 2025 12:34:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921950.1325764; Thu, 20 Mar 2025 12:34:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF6i-0003sf-8i; Thu, 20 Mar 2025 12:34:44 +0000
Received: by outflank-mailman (input) for mailman id 921950;
 Thu, 20 Mar 2025 12:34:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF6g-0003sW-TV
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:34:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF6h-00Eylo-0N
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:34:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF6g-009i9b-2k
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:34:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3bBNbPPUrxQ6uzanUQYX9gcisMHSqI5wJzbtkHl0H9g=; b=qEFNcFBW3YsT59SKooGxKQHq8S
	cDrU0zB9c17J2/bOAmd7qvpEuB3bxfmqq+Og5ngfrXHf8K+rO1zMkgcm4A85cp1SbI8vF1lMfIbGZ
	bTWDHe0F4CQZ6Kffx+pF4qbdT2S7s0TgHz1gixQeKgySSyUj3/bsJxSo2DyFZYxCLhA4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
Message-Id: <E1tvF6g-009i9b-2k@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:34:42 +0000

commit 3c2b6175a1e49ea4e6fa0aec989ee49daf593558
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:18:46 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:18:46 2025 +0100

    x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
    
    The MMIO_CONF_BASE reports the base of the MCFG range on AMD systems.
    Linux pre-6.14 is unconditionally attempting to read the MSR without a
    safe MSR accessor, and since Xen doesn't allow access to it Linux reports
    the following error:
    
    unchecked MSR access error: RDMSR from 0xc0010058 at rIP: 0xffffffff8101d19f (xen_do_read_msr+0x7f/0xa0)
    Call Trace:
     xen_read_msr+0x1e/0x30
     amd_get_mmconfig_range+0x2b/0x80
     quirk_amd_mmconfig_area+0x28/0x100
     pnp_fixup_device+0x39/0x50
     __pnp_add_device+0xf/0x150
     pnp_add_device+0x3d/0x100
     pnpacpi_add_device_handler+0x1f9/0x280
     acpi_ns_get_device_callback+0x104/0x1c0
     acpi_ns_walk_namespace+0x1d0/0x260
     acpi_get_devices+0x8a/0xb0
     pnpacpi_init+0x50/0x80
     do_one_initcall+0x46/0x2e0
     kernel_init_freeable+0x1da/0x2f0
     kernel_init+0x16/0x1b0
     ret_from_fork+0x30/0x50
     ret_from_fork_asm+0x1b/0x30
    
    Such access is conditional to the presence of a device with PnP ID
    "PNP0c01", which triggers the execution of the quirk_amd_mmconfig_area()
    function.  Note that prior to commit 3fac3734c43a MSR accesses when running
    as a PV guest would always use the safe variant, and thus silently handle
    the #GP.
    
    Fix by allowing access to the MSR on AMD systems for the hardware domain.
    
    Write attempts to the MSR will still result in #GP for all domain types.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b4071d28c5bd9ca4fed76031cbf0e782b74209b9
    master date: 2025-03-12 13:32:30 +0100
---
 xen/arch/x86/msr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 289cf10b78..3f612ad27c 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -245,6 +245,14 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = 0;
         break;
 
+    case MSR_FAM10H_MMIO_CONF_BASE:
+        if ( !is_hardware_domain(d) ||
+             !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ||
+             rdmsr_safe(msr, *val) )
+            goto gp_fault;
+
+        break;
+
     case MSR_VIRT_SPEC_CTRL:
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:34:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:34:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921951.1325766 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF6s-0003v8-Cr; Thu, 20 Mar 2025 12:34:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921951.1325766; Thu, 20 Mar 2025 12:34:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF6s-0003v0-AB; Thu, 20 Mar 2025 12:34:54 +0000
Received: by outflank-mailman (input) for mailman id 921951;
 Thu, 20 Mar 2025 12:34:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF6q-0003uj-WF
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:34:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF6r-00Eym8-0f
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:34:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF6q-009iAF-32
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:34:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p/YR4yQrmL1PBhtQiT0mDYCzQYr6QFC0SWlO6qWMyBU=; b=UlA8LUZbd7RSU8hg+802LSGwdG
	8Djoi391jMF0aNLWk8blctTneMEb1992T1M73ex6vZnECGvnQEFnuFHbLuZt2Bodt6omdaxxRGz6m
	3GWJByygew+GytNbICtDzlVLOr7JcztCAKJGnm4UtMK39LrXcZAravrfD3xIaTAYcryM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/vmx: fix posted interrupts usage of msi_desc->msg field
Message-Id: <E1tvF6q-009iAF-32@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:34:52 +0000

commit 037d3e77d7a6d06d97bd993d275510b8706cd60d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:19:17 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:19:17 2025 +0100

    x86/vmx: fix posted interrupts usage of msi_desc->msg field
    
    The current usage of msi_desc->msg in vmx_pi_update_irte() will make the
    field contain a translated MSI message, instead of the expected
    untranslated one.  This breaks dump_msi(), that use the data in
    msi_desc->msg to print the interrupt details.
    
    Fix this by introducing a dummy local msi_msg, and use it with
    iommu_update_ire_from_msi().  vmx_pi_update_irte() relies on the MSI
    message not changing, so there's no need to propagate the resulting msi_msg
    to the hardware, and the contents can be ignored.
    
    Additionally add a comment to clarify that msi_desc->msg must always
    contain the untranslated MSI message.
    
    Fixes: a5e25908d18d ('VT-d: introduce new fields in msi_desc to track binding with guest interrupt')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 30f0e55a79206702b4e82e86dad6b35033157858
    master date: 2025-03-12 13:32:30 +0100
---
 xen/arch/x86/hvm/vmx/vmx.c     | 4 +++-
 xen/arch/x86/include/asm/msi.h | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index f16faa6a61..cb2cc8aa28 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -396,6 +396,7 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     const struct pi_desc *pi_desc = v ? &v->arch.hvm.vmx.pi_desc : NULL;
     struct irq_desc *desc;
     struct msi_desc *msi_desc;
+    struct msi_msg msg;
     int rc;
 
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -410,12 +411,13 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     }
     msi_desc->pi_desc = pi_desc;
     msi_desc->gvec = gvec;
+    msg = msi_desc->msg;
 
     spin_unlock_irq(&desc->lock);
 
     ASSERT_PDEV_LIST_IS_READ_LOCKED(msi_desc->dev->domain);
 
-    return iommu_update_ire_from_msi(msi_desc, &msi_desc->msg);
+    return iommu_update_ire_from_msi(msi_desc, &msg);
 
  unlock_out:
     spin_unlock_irq(&desc->lock);
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 503c9447f6..6e6fedee74 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -124,7 +124,7 @@ struct msi_desc {
     int irq;
     int remap_index;         /* index in interrupt remapping table */
 
-    struct msi_msg msg;      /* Last set MSI message */
+    struct msi_msg msg;      /* Last set MSI message (untranslated) */
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:35:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:35:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921952.1325770 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF72-0003xH-E2; Thu, 20 Mar 2025 12:35:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921952.1325770; Thu, 20 Mar 2025 12:35:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF72-0003xA-BZ; Thu, 20 Mar 2025 12:35:04 +0000
Received: by outflank-mailman (input) for mailman id 921952;
 Thu, 20 Mar 2025 12:35:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF71-0003x2-2a
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:35:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF71-00EymP-0v
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF71-009iBh-05
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:35:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aaNzd2ZMsoNNutJCv29JstUOlOui2PYRP1QFDS26RAA=; b=2pHxXhy3Dsj6hPuf5RcrlkHEN+
	MqNf3yshFO8alEijpMNpYi1ZghzSTXDqmSjPq7DA94xKHmMsyisnuVYZEnBzO15xecxzJsYy8ARGN
	yeJ7SzwHkQdd12CizwULVvjV5HKqqb5TGOYHYQggloshXF/m11fMJtjVUcDxNt1CUWRA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/hvm: check return code of hvm_pi_update_irte when binding
Message-Id: <E1tvF71-009iBh-05@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:35:03 +0000

commit 5e816eb950600a0f7c31f031a8f44c385f8c6b76
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:19:36 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:19:36 2025 +0100

    x86/hvm: check return code of hvm_pi_update_irte when binding
    
    Consume the return code from hvm_pi_update_irte(), and propagate the error
    back to the caller if hvm_pi_update_irte() fails.
    
    Fixes: 35a1caf8b6b5 ('pass-through: update IRTE according to guest interrupt config changes')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: cb587f620ab56cc683347d8120ba63989fad2693
    master date: 2025-03-12 13:32:31 +0100
---
 xen/drivers/passthrough/x86/hvm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index f5faff7a49..47de6953fd 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -381,7 +381,15 @@ int pt_irq_create_bind(
 
         /* Use interrupt posting if it is supported. */
         if ( iommu_intpost )
-            hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+        {
+            rc = hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+
+            if ( rc )
+            {
+                pt_irq_destroy_bind(d, pt_irq_bind);
+                return rc;
+            }
+        }
 
         if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:35:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:35:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921953.1325775 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF7C-0003zy-Ff; Thu, 20 Mar 2025 12:35:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921953.1325775; Thu, 20 Mar 2025 12:35:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF7C-0003zq-D6; Thu, 20 Mar 2025 12:35:14 +0000
Received: by outflank-mailman (input) for mailman id 921953;
 Thu, 20 Mar 2025 12:35:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF7B-0003zg-5A
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:35:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF7B-00EymT-1B
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:35:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF7B-009iCW-0K
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:35:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eTfcTH/LxR5pvokjX6DwWZ+CD3dcddrb9LF8/NDimco=; b=35Rhvdg4ceHxMrmQl63E7hRu/p
	XXCNzzdabKL5ivFJPBI4DCDojUnqAfg1/ILJGcIBHWabfmMCHhyjagdIqNH5vT9fNYmOZh20nSIED
	G1BQHA+/Euc9kysWYp/6TJB04kh7m4Ynv+B/kn1knX88Ps0NqoXneUV8uh6p9Xc0lHf4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] libxl: avoid infinite loop in libxl__remove_directory()
Message-Id: <E1tvF7B-009iCW-0K@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:35:13 +0000

commit 3f73662226e82c67d79de950bfb4cf4ea83447ef
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 20 13:20:06 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:20:06 2025 +0100

    libxl: avoid infinite loop in libxl__remove_directory()
    
    Infinitely retrying the rmdir() invocation makes little sense. While the
    original observation was the log filling the disk (due to repeated
    "Directory not empty" errors, in turn occurring for unclear reasons),
    the loop wants breaking even if there was no error message being logged
    (much like is done in the similar loops in libxl__remove_file() and
    libxl__remove_file_or_directory()).
    
    Fixes: c4dcbee67e6d ("libxl: provide libxl__remove_file et al")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 68baeb5c4852e652b9599e049f40477edac4060e
    master date: 2025-03-13 10:23:10 +0100
---
 tools/libs/light/libxl_utils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_utils.c b/tools/libs/light/libxl_utils.c
index 506c5b5631..5ae8935344 100644
--- a/tools/libs/light/libxl_utils.c
+++ b/tools/libs/light/libxl_utils.c
@@ -577,6 +577,7 @@ int libxl__remove_directory(libxl__gc *gc, const char *dirpath)
         if (errno == EINTR) continue;
         LOGE(ERROR, "failed to remove emptied directory %s", dirpath);
         rc = ERROR_FAIL;
+        break;
     }
 
  out:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:35:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:35:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921954.1325778 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF7M-00042U-HE; Thu, 20 Mar 2025 12:35:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921954.1325778; Thu, 20 Mar 2025 12:35:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF7M-00042M-EU; Thu, 20 Mar 2025 12:35:24 +0000
Received: by outflank-mailman (input) for mailman id 921954;
 Thu, 20 Mar 2025 12:35:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF7L-00042D-81
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:35:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF7L-00EymX-1S
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:35:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF7L-009iDW-0c
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:35:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uM3axClxoH0yiQhGEbGaKh4o06WudXFV7netTz+PFJY=; b=k9wcSBM7pshqRDoJvOmxnXr2t5
	yVdUe6QSatkroe2CGUVtyUv1eZcs6uh5aKo2KFmpehMfMR0dI2CaK1d61kvknZiAezxpxzbnFcPc+
	W6j4znNLkpkwfg6uRLnQpsWnSNbDKNvNeSue5qM6IAlMbBnDE97R6z9rw5LwLJE604pE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/sched: fix arinc653 to not use variables across cpupools
Message-Id: <E1tvF7L-009iDW-0c@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:35:23 +0000

commit b65a10814a3693c521b09bef62b5a8f0ce737654
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 20 13:20:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:20:14 2025 +0100

    xen/sched: fix arinc653 to not use variables across cpupools
    
    a653sched_do_schedule() is using two function local static variables,
    which is resulting in bad behavior when using more than one cpupool
    with the arinc653 scheduler.
    
    Fix that by moving those variables to the scheduler private data.
    
    Fixes: 22787f2e107c ("ARINC 653 scheduler")
    Reported-by: Choi Anderson <Anderson.Choi@boeing.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
    master commit: d0561ac8ab0e780b1e8ab41d0d15e9f9b076dee3
    master date: 2025-03-14 10:17:11 +0100
---
 xen/common/sched/arinc653.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index a82c0d7314..9ebae6d7ae 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -143,6 +143,12 @@ typedef struct a653sched_priv_s
      * pointers to all Xen UNIT structures for iterating through
      */
     struct list_head unit_list;
+
+    /**
+     * scheduling house keeping variables
+     */
+    unsigned int sched_index;
+    s_time_t next_switch_time;
 } a653sched_priv_t;
 
 /**************************************************************************
@@ -513,8 +519,6 @@ a653sched_do_schedule(
     bool tasklet_work_scheduled)
 {
     struct sched_unit *new_task = NULL;
-    static unsigned int sched_index = 0;
-    static s_time_t next_switch_time;
     a653sched_priv_t *sched_priv = SCHED_PRIV(ops);
     const unsigned int cpu = sched_get_resource_cpu(smp_processor_id());
     unsigned long flags;
@@ -528,18 +532,19 @@ a653sched_do_schedule(
         /* time to enter a new major frame
          * the first time this function is called, this will be true */
         /* start with the first domain in the schedule */
-        sched_index = 0;
+        sched_priv->sched_index = 0;
         sched_priv->next_major_frame = now + sched_priv->major_frame;
-        next_switch_time = now + sched_priv->schedule[0].runtime;
+        sched_priv->next_switch_time = now + sched_priv->schedule[0].runtime;
     }
     else
     {
-        while ( (now >= next_switch_time)
-                && (sched_index < sched_priv->num_schedule_entries) )
+        while ( (now >= sched_priv->next_switch_time) &&
+                (sched_priv->sched_index < sched_priv->num_schedule_entries) )
         {
             /* time to switch to the next domain in this major frame */
-            sched_index++;
-            next_switch_time += sched_priv->schedule[sched_index].runtime;
+            sched_priv->sched_index++;
+            sched_priv->next_switch_time +=
+                sched_priv->schedule[sched_priv->sched_index].runtime;
         }
     }
 
@@ -547,8 +552,8 @@ a653sched_do_schedule(
      * If we exhausted the domains in the schedule and still have time left
      * in the major frame then switch next at the next major frame.
      */
-    if ( sched_index >= sched_priv->num_schedule_entries )
-        next_switch_time = sched_priv->next_major_frame;
+    if ( sched_priv->sched_index >= sched_priv->num_schedule_entries )
+        sched_priv->next_switch_time = sched_priv->next_major_frame;
 
     /*
      * If there are more domains to run in the current major frame, set
@@ -556,8 +561,8 @@ a653sched_do_schedule(
      * Otherwise, set new_task equal to the address of the idle task's
      * sched_unit structure.
      */
-    new_task = (sched_index < sched_priv->num_schedule_entries)
-        ? sched_priv->schedule[sched_index].unit
+    new_task = (sched_priv->sched_index < sched_priv->num_schedule_entries)
+        ? sched_priv->schedule[sched_priv->sched_index].unit
         : IDLETASK(cpu);
 
     /* Check to see if the new task can be run (awake & runnable). */
@@ -589,7 +594,7 @@ a653sched_do_schedule(
      * Return the amount of time the next domain has to run and the address
      * of the selected task's UNIT structure.
      */
-    prev->next_time = next_switch_time - now;
+    prev->next_time = sched_priv->next_switch_time - now;
     prev->next_task = new_task;
     new_task->migrated = false;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:35:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:35:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921955.1325782 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF7W-00044r-IS; Thu, 20 Mar 2025 12:35:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921955.1325782; Thu, 20 Mar 2025 12:35:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF7W-00044j-Fv; Thu, 20 Mar 2025 12:35:34 +0000
Received: by outflank-mailman (input) for mailman id 921955;
 Thu, 20 Mar 2025 12:35:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF7V-00044b-Ak
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:35:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF7V-00Eymb-1k
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:35:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF7V-009iFf-0t
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:35:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n8acWr+AIm+wcsd7MVMeAQNMRkC8Cgpqz9yKJs2XL+I=; b=H/JD05ECN6MQC/WQecRUZ/8bCw
	W4Krnw6jSfuAqJsGYtpyj2NoTpeT3Mf/6EPohP/ZbmWhFQiQnNYrIjjUuq9F+Pyfx+8GQPERZAgoJ
	nqiqgcIFYR1D1vUcEfw3Z5wV8f+0SwqBVGks+4Ty2Z7tQ/C4/3OL0GaD3FTcheoI6yqQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/ioremap: prevent additions against the NULL pointer
Message-Id: <E1tvF7V-009iFf-0t@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:35:33 +0000

commit 69754ede24a44c3c3aafdb77d4a203810f00ba9e
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:20:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:20:51 2025 +0100

    x86/ioremap: prevent additions against the NULL pointer
    
    This was reported by clang UBSAN as:
    
    UBSAN: Undefined behaviour in arch/x86/mm.c:6297:40
    applying zero offset to null pointer
    [...]
    Xen call trace:
        [<ffff82d040303662>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304aa3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0406ebbc0>] F ioremap_wc+0xc8/0xe0
        [<ffff82d0406c3728>] F video_init+0xd0/0x180
        [<ffff82d0406ab6f5>] F console_init_preirq+0x3d/0x220
        [<ffff82d0406f1876>] F __start_xen+0x68e/0x5530
        [<ffff82d04020482e>] F __high_start+0x8e/0x90
    
    Fix bt_ioremap() and ioremap{,_wc}() to not add the offset if the returned
    pointer from __vmap() is NULL.
    
    Fixes: d0d4635d034f ('implement vmap()')
    Fixes: f390941a92f1 ('x86/DMI: fix table mapping when one lives above 1Mb')
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9a6f2c52f75781acda39fab5cc96d1bcc54bf534
    master date: 2025-03-17 13:33:29 +0100
---
 xen/arch/x86/dmi_scan.c | 7 +++++--
 xen/arch/x86/mm.c       | 6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 81f80c053a..b517c068b8 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -113,6 +113,7 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
 {
     mfn_t mfn = _mfn(PFN_DOWN(addr));
     unsigned int offs = PAGE_OFFSET(addr);
+    void *va;
 
     if ( addr + len <= MB(1) )
         return __va(addr);
@@ -120,8 +121,10 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
     if ( system_state < SYS_STATE_boot )
         return __acpi_map_table(addr, len);
 
-    return __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
-                  VMAP_DEFAULT) + offs;
+    va = __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
+                VMAP_DEFAULT);
+
+    return va ? va + offs : NULL;
 }
 
 static void __init bt_iounmap(const void *ptr, unsigned int len)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index d65cf9fa71..2d9c7a5316 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -6015,7 +6015,9 @@ void __iomem *ioremap(paddr_t pa, size_t len)
         unsigned int offs = pa & (PAGE_SIZE - 1);
         unsigned int nr = PFN_UP(offs + len);
 
-        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT) + offs;
+        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT);
+        if ( va )
+            va += offs;
     }
 
     return (void __force __iomem *)va;
@@ -6032,7 +6034,7 @@ void __iomem *__init ioremap_wc(paddr_t pa, size_t len)
 
     va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_WC, VMAP_DEFAULT);
 
-    return (void __force __iomem *)(va + offs);
+    return (void __force __iomem *)(va ? va + offs : NULL);
 }
 
 int create_perdomain_mapping(struct domain *d, unsigned long va,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:35:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:35:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921956.1325787 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF7g-00047H-Jy; Thu, 20 Mar 2025 12:35:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921956.1325787; Thu, 20 Mar 2025 12:35:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF7g-000479-HM; Thu, 20 Mar 2025 12:35:44 +0000
Received: by outflank-mailman (input) for mailman id 921956;
 Thu, 20 Mar 2025 12:35:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF7f-00046x-EK
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:35:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF7f-00Eymh-25
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:35:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF7f-009iGX-1B
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:35:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZwLNAbMBpqs/QcNTzCT4iEQa32jKf6scJ8P27ERfsEc=; b=NFMiajGnFu1zP8BLso6MqexfQu
	kTGMRgFXImbM33t+5f/GeNTMjxOm5EGICd+gV+EjoSf84eUO9gtT6wnb/Fvmva20JpHS2N/U6rGVL
	QdXBm5nWejImEpmL1kzviIM/8ssbllXQqsx7y4R7peUTK6R9Oi1F9RuW6gR9TJA4nvFc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
Message-Id: <E1tvF7f-009iGX-1B@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:35:43 +0000

commit 4d91aaf3494ed7ef25c12564b3b3a4f8a933bc26
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:21:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:21:12 2025 +0100

    x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
    
    The current CI failures turn out to be a latent bug triggered by a narrow set
    of properties of the initrd and the host memory map, which CI encountered by
    chance.
    
    One step during boot involves constructing directmap mappings for modules.
    With some probing at the point of creation, it is observed that there's a 4k
    mapping missing towards the end of the initrd.
    
      (XEN) === Mapped Mod1 [0000000394001000, 00000003be1ff6dc] to Directmap
      (XEN) Probing paddr 394001000, va ffff830394001000
      (XEN) Probing paddr 3be1ff6db, va ffff8303be1ff6db
      (XEN) Probing paddr 3bdffffff, va ffff8303bdffffff
      (XEN) Probing paddr 3be001000, va ffff8303be001000
      (XEN) Probing paddr 3be000000, va ffff8303be000000
      (XEN) Early fatal page fault at e008:ffff82d04032014c (cr2=ffff8303be000000, ec=0000)
    
    The conditions for this bug appear to be map_pages_to_xen() call with a start
    address of exactly 4k beyond a 2M boundary, some number of full 2M pages, then
    a tail needing 4k pages.
    
    Anyway, the condition for spotting superpage boundaries in map_pages_to_xen()
    is wrong.  The IS_ALIGNED() macro expects a power of two for the alignment
    argument, and subtracts 1 itself.
    
    Fixing this causes the failing case to now boot.
    
    Fixes: 97fb6fcf26e8 ("x86/mm: introduce helpers to detect super page alignment")
    Debugged-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b07c7d63f9b587e4df5d71f6da9eaa433512c974
    master date: 2025-03-19 14:53:28 +0000
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 2d9c7a5316..c3e15a029b 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5236,7 +5236,7 @@ int map_pages_to_xen(
                                                                 \
     ASSERT(!mfn_eq(m_, INVALID_MFN));                           \
     IS_ALIGNED(PFN_DOWN(v) | mfn_x(m_),                         \
-               (1UL << (PAGETABLE_ORDER * ((n) - 1))) - 1);     \
+               1UL << (PAGETABLE_ORDER * ((n) - 1)));           \
 })
 #define IS_L2E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 2)
 #define IS_L3E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 3)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:35:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:35:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921957.1325792 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF7q-0004AF-N4; Thu, 20 Mar 2025 12:35:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921957.1325792; Thu, 20 Mar 2025 12:35:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvF7q-0004A7-K5; Thu, 20 Mar 2025 12:35:54 +0000
Received: by outflank-mailman (input) for mailman id 921957;
 Thu, 20 Mar 2025 12:35:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvF7p-00049z-Gr
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:35:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF7p-00Eyn8-2L
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:35:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvF7p-009iIp-1V
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:35:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7hElqUSrsVDTL3gB5b75DtESf65Df9W+jOq9hU9vR2Y=; b=TBk1uuj5uhyvuZkjcy1cvy5Imc
	CgMYKO14CMcqU1tv9D2StWy0K48V0Zr0azORhp3G0nrSw/dHRSUTeSiTCylhuNtJxvVJLYkuTVBPL
	8iaqI80Nfisdee3es0aejdRX2s7AO2X4Vpdesx72efe9gxRklq0YnNGnhblJyuGnF5MI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/arinc653: call xfree() with local IRQ enabled
Message-Id: <E1tvF7p-009iIp-1V@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:35:53 +0000

commit ce591a92ca50d2b8851469006a7d7824445b5dbc
Author:     Anderson Choi <anderson.choi@boeing.com>
AuthorDate: Thu Mar 20 13:21:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:21:30 2025 +0100

    xen/arinc653: call xfree() with local IRQ enabled
    
    xen panic is observed with the following configuration.
    
    1. Debug xen build (CONFIG_DEBUG=y)
    2. dom1 of an ARINC653 domain
    3. shutdown dom1 with xl command
    
    $ xl shutdown <domain_name>
    
    (XEN) ****************************************
    (XEN) Panic on CPU 2:
    (XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/xmalloc_tlsf.c:714
    (XEN) ****************************************
    
    panic was triggered since xfree() was called with local IRQ disabled and
    therefore assertion failed.
    
    Fix this by calling xfree() after local IRQ is enabled.
    
    Fixes: 19049f8d796a sched: fix locking in a653sched_free_vdata()
    Signed-off-by: Anderson Choi <anderson.choi@boeing.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
    master commit: 3ee55c9543fcf0b35593f030b53f56f3222046b7
    master date: 2025-03-19 16:44:00 +0000
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index 9ebae6d7ae..930361fa5c 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -463,10 +463,11 @@ a653sched_free_udata(const struct scheduler *ops, void *priv)
     if ( !is_idle_unit(av->unit) )
         list_del(&av->list);
 
-    xfree(av);
     update_schedule_units(ops);
 
     spin_unlock_irqrestore(&sched_priv->lock, flags);
+
+    xfree(av);
 }
 
 /**
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:44:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:44:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921971.1325805 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFFj-0006cD-F4; Thu, 20 Mar 2025 12:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921971.1325805; Thu, 20 Mar 2025 12:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFFj-0006c5-CT; Thu, 20 Mar 2025 12:44:03 +0000
Received: by outflank-mailman (input) for mailman id 921971;
 Thu, 20 Mar 2025 12:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFFh-0006by-Vo
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFFi-00EyzS-09
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFFh-009j85-2W
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cH3EGh/2AbxlQJIc0TU5T2+Fojbhxftm1Nm/7GXgWtI=; b=ICDgegMzjPNpL2GdyooMeZVqTn
	IYWQ8UCFCsUDCzwVKuua/1s1TIyGXKqdjPiIq0bZeZTMFSqI/wSWa9yOrnQiJRQ8NNCdNVaQJbYGt
	WWsclSApktCpT3k6gZ+t8FTTdbtVOuXsoh7olAKBsCz2rJORjJzmIfMgxKPjl+DMjOFo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xen/console: Fix truncation of panic() messages
Message-Id: <E1tvFFh-009j85-2W@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:44:01 +0000

commit ede5afa3ce1e8b146e4912a806a44149823e0d6a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:28:42 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:28:42 2025 +0100

    xen/console: Fix truncation of panic() messages
    
    The panic() function uses a static buffer to format its arguments into, simply
    to emit the result via printk("%s", buf).  This buffer is not large enough for
    some existing users in Xen.  e.g.:
    
      (XEN) ****************************************
      (XEN) Panic on CPU 0:
      (XEN) Invalid device tree blob at physical address 0x46a00000.
      (XEN) The DTB must be 8-byte aligned and must not exceed 2 MB in size.
      (XEN)
      (XEN) Plea****************************************
    
    The remainder of this particular message is 'e check your bootloader.', but
    has been inherited by RISC-V from ARM.
    
    It is also pointless double buffering.  Implement vprintk() beside printk(),
    and use it directly rather than rendering into a local buffer, removing it as
    one source of message limitation.
    
    This marginally simplifies panic(), and drops a global used-once buffer.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 81f8b1dd9407e4a3d9dc058b7fbbc591168649ad
    master date: 2025-02-18 14:15:58 +0000
---
 xen/drivers/char/console.c | 21 +++++++++++++--------
 xen/include/xen/lib.h      |  2 ++
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 6b679c5eac..c08ac598fe 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -958,11 +958,17 @@ static void vprintk_common(const char *prefix, const char *fmt, va_list args)
     local_irq_restore(flags);
 }
 
+void vprintk(const char *fmt, va_list args)
+{
+    vprintk_common("(XEN) ", fmt, args);
+}
+
 void printk(const char *fmt, ...)
 {
     va_list args;
+
     va_start(args, fmt);
-    vprintk_common("(XEN) ", fmt, args);
+    vprintk(fmt, args);
     va_end(args);
 }
 
@@ -1266,23 +1272,22 @@ void panic(const char *fmt, ...)
     va_list args;
     unsigned long flags;
     static DEFINE_SPINLOCK(lock);
-    static char buf[128];
 
     spin_debug_disable();
     spinlock_profile_printall('\0');
     debugtrace_dump();
 
-    /* Protects buf[] and ensure multi-line message prints atomically. */
+    /* Ensure multi-line message prints atomically. */
     spin_lock_irqsave(&lock, flags);
 
-    va_start(args, fmt);
-    (void)vsnprintf(buf, sizeof(buf), fmt, args);
-    va_end(args);
-
     console_start_sync();
     printk("\n****************************************\n");
     printk("Panic on CPU %d:\n", smp_processor_id());
-    printk("%s", buf);
+
+    va_start(args, fmt);
+    vprintk(fmt, args);
+    va_end(args);
+
     printk("****************************************\n\n");
     if ( opt_noreboot )
         printk("Manual reset required ('noreboot' specified)\n");
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 8eef557dd5..612ad9323a 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -80,6 +80,8 @@ debugtrace_printk(const char *fmt, ...) {}
 #define _p(_x) ((void *)(unsigned long)(_x))
 extern void printk(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2)));
+void vprintk(const char *fmt, va_list args)
+    __attribute__ ((format (printf, 1, 0)));
 
 #define printk_once(fmt, args...)               \
 ({                                              \
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:44:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921972.1325809 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFFs-0006eZ-GV; Thu, 20 Mar 2025 12:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921972.1325809; Thu, 20 Mar 2025 12:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFFs-0006eR-Dn; Thu, 20 Mar 2025 12:44:12 +0000
Received: by outflank-mailman (input) for mailman id 921972;
 Thu, 20 Mar 2025 12:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFFr-0006eG-UD
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFFs-00Eyzh-0S
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFFr-009j8g-2n
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=k38RW5NZFCAPvRyxX7MmSXsekDlwQAfaBFtR1oFm16k=; b=u7vKlt07TOPo17/E2Lcdp212H6
	PuwCICjTjgP+zK9O5NrlRivEco83Derm7XD9ii405DCqUwBzmBggvJtBoQ3wImcJRfRDPGZOR2F2M
	nHba17H71A9TofhUrLmnPaAzUHSSPCiWpvBOV2Jqhzl0+tsL5Yk3f2bY+vcR/vzdbGOc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xen/memory: Make resource_max_frames() to return 0 on unknown type
Message-Id: <E1tvFFr-009j8g-2n@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:44:11 +0000

commit 7ef8e820c45129eabf7fd59556b67ec1f76ae9e3
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Thu Mar 20 13:29:06 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:29:06 2025 +0100

    xen/memory: Make resource_max_frames() to return 0 on unknown type
    
    This is actually what the caller acquire_resource() expects on any kind
    of error (the comment on top of resource_max_frames() also suggests that).
    Otherwise, the caller will treat -errno as a valid value and propagate incorrect
    nr_frames to the VM. As a possible consequence, a VM trying to query a resource
    size of an unknown type will get the success result from the hypercall and obtain
    nr_frames 4294967201.
    
    Also, add an ASSERT_UNREACHABLE() in the default case of _acquire_resource(),
    normally we won't get to this point, as an unknown type will always be rejected
    earlier in resource_max_frames().
    
    Also, update test-resource app to verify that Xen can deal with invalid
    (unknown) resource type properly.
    
    Fixes: 9244528955de ("xen/memory: Fix acquire_resource size semantics")
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9b8708290002f0a4d0b363e0c66ce945f6b520bd
    master date: 2025-02-18 14:47:34 +0000
---
 tools/tests/resource/test-resource.c | 10 ++++++++++
 xen/common/memory.c                  |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
index 1b10be16a6..a7f2d04643 100644
--- a/tools/tests/resource/test-resource.c
+++ b/tools/tests/resource/test-resource.c
@@ -123,6 +123,16 @@ static void test_gnttab(uint32_t domid, unsigned int nr_frames,
         fail("    Fail: Managed to map gnttab v2 status frames in v1 mode\n");
         xenforeignmemory_unmap_resource(fh, res);
     }
+
+    /*
+     * If this check starts failing, you've found the right place to test your
+     * addition to the Acquire Resource infrastructure.
+     */
+    rc = xenforeignmemory_resource_size(fh, domid, 3, 0, &size);
+
+    /* Check that Xen rejected the resource type. */
+    if ( !rc )
+        fail("    Fail: Expected error on an invalid resource type, got success\n");
 }
 
 static void test_domain_configurations(void)
diff --git a/xen/common/memory.c b/xen/common/memory.c
index fa165ebc14..ae801a66e6 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1156,7 +1156,7 @@ static unsigned int resource_max_frames(const struct domain *d,
         return d->vmtrace_size >> PAGE_SHIFT;
 
     default:
-        return -EOPNOTSUPP;
+        return 0;
     }
 }
 
@@ -1239,6 +1239,7 @@ static int _acquire_resource(
         return acquire_vmtrace_buf(d, id, frame, nr_frames, mfn_list);
 
     default:
+        ASSERT_UNREACHABLE();
         return -EOPNOTSUPP;
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921973.1325813 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFG3-0006h7-I2; Thu, 20 Mar 2025 12:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921973.1325813; Thu, 20 Mar 2025 12:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFG3-0006gz-FD; Thu, 20 Mar 2025 12:44:23 +0000
Received: by outflank-mailman (input) for mailman id 921973;
 Thu, 20 Mar 2025 12:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFG2-0006gs-0e
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFG2-00Eyzl-0i
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFG1-009j9v-35
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WsLAjD220vJafm10MUGLLS35az5wyvOmPlytNmiaHq0=; b=3v6XaqAr0vmrhIwr+KSqWWSefq
	g7lSkJQWXS9cnzYDO0GyI8ofvcQBdLZQ6Y32IXgtAPkNLdO56/XH/nM9hz7XQbRhOite6L9KjMEgF
	vahMrISPt4fETyFsmm7r2U8XypBo+OnsVkySEoX0jInaHIncnVQcKf9U0gqAMr2Mox24=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/svm: Separate STI and VMRUN instructions in svm_asm_do_resume()
Message-Id: <E1tvFG1-009j9v-35@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:44:21 +0000

commit 61923364d3417642554043c87b644a0d34537d70
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:29:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:29:57 2025 +0100

    x86/svm: Separate STI and VMRUN instructions in svm_asm_do_resume()
    
    There is a corner case in the VMRUN instruction where its INTR_SHADOW state
    leaks into guest state if a VMExit occurs before the VMRUN is complete.  An
    example of this could be taking #NPF due to event injection.
    
    Xen can safely execute STI anywhere between CLGI and VMRUN, as CLGI blocks
    external interrupts too.  However, an exception (while fatal) will appear to
    be in an irqs-on region (as GIF isn't considered), so position the STI after
    the speculation actions but prior to the GPR pops.
    
    Link: https://lore.kernel.org/all/CADH9ctBs1YPmE4aCfGPNBwA10cA8RuAk2gO7542DjMZgs4uzJQ@mail.gmail.com/
    Fixes: 66b245d9eaeb ("SVM: limit GIF=0 region")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c989ff614f6bad48b3bd4b32694f711b31c7b2d6
    master date: 2025-02-19 12:45:48 +0000
---
 xen/arch/x86/hvm/svm/entry.S | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index 5f318629b4..9fb457ad95 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -74,6 +74,14 @@ __UNLIKELY_END(nsvm_hap)
         ALTERNATIVE "", svm_vmentry_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         ALTERNATIVE "", DO_SPEC_CTRL_DIV, X86_FEATURE_SC_DIV
 
+        /*
+         * Set EFLAGS.IF after CLGI covers us from real interrupts, but not
+         * immediately prior to VMRUN.  The VMRUN instruction leaks it's
+         * INTR_SHADOW into guest state if a VMExit occurs before VMRUN
+         * completes (e.g. taking #NPF during event injecting.)
+         */
+        sti
+
         pop  %r15
         pop  %r14
         pop  %r13
@@ -91,7 +99,6 @@ __UNLIKELY_END(nsvm_hap)
         pop  %rsi
         pop  %rdi
 
-        sti
         vmrun
 
         SAVE_ALL
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921974.1325818 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFGD-0006jY-Jf; Thu, 20 Mar 2025 12:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921974.1325818; Thu, 20 Mar 2025 12:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFGD-0006jQ-Gf; Thu, 20 Mar 2025 12:44:33 +0000
Received: by outflank-mailman (input) for mailman id 921974;
 Thu, 20 Mar 2025 12:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFGC-0006jG-46
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFGC-00Eyzp-14
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFGC-009jAV-08
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ac0F2NNmO5HJZQ0EkcSj2tnpo5FOClQ6WvfriXxn6Fo=; b=rfyW1q4hAHteyGDWC5VznsFcq3
	2zJbo1z3ambSByCcCmjbLW8Ko0xY4s3o3rLo1Kl/0JQU5DOsjPVJROoeUr3y0cEVnzidvbNvdhLh0
	MemVgzGJ2pG8FGMac/cB1kbwTIcoeJLg6ATuqMfSGLg3TPERWXzVnbbG5395k+Ma7I6M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
Message-Id: <E1tvFGC-009jAV-08@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:44:32 +0000

commit 5f640b62133137e114ce4dcfd72bb3a8fdcafdc0
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:30:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:30:30 2025 +0100

    x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
    
    The logic in dom0_setup_permissions() sets the maximum bound in
    ->iomem_caps unconditionally using paddr_bits, which is not correct for HVM
    based domains.  Instead use domain_max_paddr_bits() to get the correct
    maximum paddr bits for each possible domain type.
    
    Switch to using PFN_DOWN() instead of PAGE_SHIFT, as that's shorter.
    
    Fixes: 53de839fb409 ('x86: constrain MFN range Dom0 may access')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a00e08799cc7657d2a1aca158f4ad43d4c9103e7
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 09fb8b063a..7a3e07c37b 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -475,7 +475,8 @@ int __init dom0_setup_permissions(struct domain *d)
 
     /* The hardware domain is initially permitted full I/O capabilities. */
     rc = ioports_permit_access(d, 0, 0xFFFF);
-    rc |= iomem_permit_access(d, 0UL, (1UL << (paddr_bits - PAGE_SHIFT)) - 1);
+    rc |= iomem_permit_access(d, 0UL,
+                              PFN_DOWN(1UL << paging_max_paddr_bits(d)) - 1);
     rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
 
     /* Modify I/O port access permissions. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:44:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921976.1325821 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFGN-0006m0-L2; Thu, 20 Mar 2025 12:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921976.1325821; Thu, 20 Mar 2025 12:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFGN-0006ls-I6; Thu, 20 Mar 2025 12:44:43 +0000
Received: by outflank-mailman (input) for mailman id 921976;
 Thu, 20 Mar 2025 12:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFGM-0006ll-6f
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFGM-00Eyzx-1L
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFGM-009jBC-0U
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jqXKSdFffctubEzHhju4JrKT1Bxevi38uHnY74Lqw6s=; b=XduIvGoMS/9CZ3E4lYtb8ayuwL
	nBxJ0NCLSPt263vdRcw+Wu3IPAV0zVoCGGoVlX0bFPzf1CAAPa7AZ3PAov8egdiqKLwSvcSj/FYcU
	KUZqm5FxUqgcWxdHi6DyGAAnKji/UqLrR7i9vEkY09Kz9YYDKrS6aMTCIwXaAVr9gdhM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/dom0: be less restrictive with the Interrupt Address Range
Message-Id: <E1tvFGM-009jBC-0U@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:44:42 +0000

commit 7ce2ec63b212440b5f6dd7c9673c38f31d9ee516
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:31:03 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:31:03 2025 +0100

    x86/dom0: be less restrictive with the Interrupt Address Range
    
    Xen currently prevents dom0 from creating CPU or IOMMU page-table mappings
    into the interrupt address range [0xfee00000, 0xfeefffff].  This range has
    two different purposes.  For accesses from the CPU is contains the default
    position of local APIC page at 0xfee00000.  For accesses from devices
    it's the MSI address range, so the address field in the MSI entries
    (usually) point to an address on that range to trigger an interrupt.
    
    There are reports of Lenovo Thinkpad devices placing what seems to be the
    UCSI shared mailbox at address 0xfeec2000 in the interrupt address range.
    Attempting to use that device with a Linux PV dom0 leads to an error when
    Linux kernel maps 0xfeec2000:
    
    RIP: e030:xen_mc_flush+0x1e8/0x2b0
     xen_leave_lazy_mmu+0x15/0x60
     vmap_range_noflush+0x408/0x6f0
     __ioremap_caller+0x20d/0x350
     acpi_os_map_iomem+0x1a3/0x1c0
     acpi_ex_system_memory_space_handler+0x229/0x3f0
     acpi_ev_address_space_dispatch+0x17e/0x4c0
     acpi_ex_access_region+0x28a/0x510
     acpi_ex_field_datum_io+0x95/0x5c0
     acpi_ex_extract_from_field+0x36b/0x4e0
     acpi_ex_read_data_from_field+0xcb/0x430
     acpi_ex_resolve_node_to_value+0x2e0/0x530
     acpi_ex_resolve_to_value+0x1e7/0x550
     acpi_ds_evaluate_name_path+0x107/0x170
     acpi_ds_exec_end_op+0x392/0x860
     acpi_ps_parse_loop+0x268/0xa30
     acpi_ps_parse_aml+0x221/0x5e0
     acpi_ps_execute_method+0x171/0x3e0
     acpi_ns_evaluate+0x174/0x5d0
     acpi_evaluate_object+0x167/0x440
     acpi_evaluate_dsm+0xb6/0x130
     ucsi_acpi_dsm+0x53/0x80
     ucsi_acpi_read+0x2e/0x60
     ucsi_register+0x24/0xa0
     ucsi_acpi_probe+0x162/0x1e3
     platform_probe+0x48/0x90
     really_probe+0xde/0x340
     __driver_probe_device+0x78/0x110
     driver_probe_device+0x1f/0x90
     __driver_attach+0xd2/0x1c0
     bus_for_each_dev+0x77/0xc0
     bus_add_driver+0x112/0x1f0
     driver_register+0x72/0xd0
     do_one_initcall+0x48/0x300
     do_init_module+0x60/0x220
     __do_sys_init_module+0x17f/0x1b0
     do_syscall_64+0x82/0x170
    
    Remove the restrictions to create mappings in the interrupt address range
    for dom0.  Note that the restriction to map the local APIC page is enforced
    separately, and that continues to be present.  Additionally make sure the
    emulated local APIC page is also not mapped, in case dom0 is using it.
    
    Note that even if the interrupt address range entries are populated in the
    IOMMU page-tables no device access will reach those pages.  Device accesses
    to the Interrupt Address Range will always be converted into Interrupt
    Messages and are not subject to DMA remapping.
    
    There's also the following restriction noted in Intel VT-d:
    
    > Software must not program paging-structure entries to remap any address to
    > the interrupt address range. Untranslated requests and translation requests
    > that result in an address in the interrupt range will be blocked with
    > condition code LGN.4 or SGN.8. Translated requests with an address in the
    > interrupt address range are treated as Unsupported Request (UR).
    
    Similarly for AMD-Vi:
    
    > Accesses to the interrupt address range (Table 3) are defined to go through
    > the interrupt remapping portion of the IOMMU and not through address
    > translation processing. Therefore, when a transaction is being processed as
    > an interrupt remapping operation, the transaction attribute of
    > pretranslated or untranslated is ignored.
    >
    > Software Note: The IOMMU should
    > not be configured such that an address translation results in a special
    > address such as the interrupt address range.
    
    However those restrictions don't apply to the identity mappings possibly
    created for dom0, since the interrupt address range is never subject to DMA
    remapping, and hence there's no output address after translation that
    belongs to the interrupt address range.
    
    Reported-by: Jürgen Groß <jgross@suse.com>
    Link: https://lore.kernel.org/xen-devel/baade0a7-e204-4743-bda1-282df74e5f89@suse.com/
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 381caa38850771ae218eb6f6d490dc02e40df964
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 7a3e07c37b..9e9d3cd07e 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -515,6 +515,13 @@ int __init dom0_setup_permissions(struct domain *d)
         mfn = paddr_to_pfn(mp_lapic_addr);
         rc |= iomem_deny_access(d, mfn, mfn);
     }
+    /* If using an emulated local APIC make sure its MMIO is unpopulated. */
+    if ( has_vlapic(d) )
+    {
+        /* Xen doesn't allow changing the local APIC MMIO window position. */
+        mfn = paddr_to_pfn(APIC_DEFAULT_PHYS_BASE);
+        rc |= iomem_deny_access(d, mfn, mfn);
+    }
     /* I/O APICs. */
     for ( i = 0; i < nr_ioapics; i++ )
     {
@@ -522,10 +529,6 @@ int __init dom0_setup_permissions(struct domain *d)
         if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
-    /* MSI range. */
-    rc |= iomem_deny_access(d, paddr_to_pfn(MSI_ADDR_BASE_LO),
-                            paddr_to_pfn(MSI_ADDR_BASE_LO +
-                                         MSI_ADDR_DEST_ID_MASK));
     /* HyperTransport range. */
     if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:44:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921977.1325824 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFGX-0006oz-NJ; Thu, 20 Mar 2025 12:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921977.1325824; Thu, 20 Mar 2025 12:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFGX-0006or-Kq; Thu, 20 Mar 2025 12:44:53 +0000
Received: by outflank-mailman (input) for mailman id 921977;
 Thu, 20 Mar 2025 12:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFGW-0006oZ-9U
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFGW-00Ez0H-1c
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFGW-009jCA-0l
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AOQHhhxzzKX98aZ/Xycgp/et95ET4B+iUwiOZyFV5y4=; b=MBt3qPKH3C347w998L5VNgqrHw
	AMFuIv/6XnK31v2G16tYsszGALxtdns5ieLfHoVYM2+NMwNpuglt9xaHVMaUjsYq4BP67l20TXVKl
	QP6OnEDSJW6sLNwuZSjHtsvUlxW2v/SChS/cGIjFACqufLt//DuU6D3BAwd0w3Qh6KK0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] tools/xl: fix channel configuration setting
Message-Id: <E1tvFGW-009jCA-0l@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:44:52 +0000

commit b26965b4e58494911362b88f82a898162aee0a17
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 20 13:32:19 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:32:19 2025 +0100

    tools/xl: fix channel configuration setting
    
    Channels work differently than other device types: their devid should
    be -1 initially in order to distinguish them from the primary console
    which has the devid of 0.
    
    So when parsing the channel configuration, use
    ARRAY_EXTEND_INIT_NODEVID() in order to avoid overwriting the devid
    set by libxl_device_channel_init().
    
    Fixes: 3a6679634766 ("libxl: set channel devid when not provided by application")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: e1ccced4afe465d6541c5825a0f8d1b8f5fa4253
    master date: 2025-03-05 16:37:37 +0100
---
 tools/xl/xl_parse.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index ed983200c3..fd140e7424 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2368,8 +2368,9 @@ void parse_config_data(const char *config_source,
             char *path = NULL;
             int len;
 
-            chn = ARRAY_EXTEND_INIT(d_config->channels, d_config->num_channels,
-                                   libxl_device_channel_init);
+            chn = ARRAY_EXTEND_INIT_NODEVID(d_config->channels,
+                                            d_config->num_channels,
+                                            libxl_device_channel_init);
 
             split_string_into_string_list(buf, ",", &pairs);
             len = libxl_string_list_length(&pairs);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:45:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921978.1325830 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFGh-0006rB-Pg; Thu, 20 Mar 2025 12:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921978.1325830; Thu, 20 Mar 2025 12:45:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFGh-0006r4-MD; Thu, 20 Mar 2025 12:45:03 +0000
Received: by outflank-mailman (input) for mailman id 921978;
 Thu, 20 Mar 2025 12:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFGg-0006qw-Ca
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFGg-00Ez0i-1v
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFGg-009jFU-12
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SdarlAKVJChltqSj25k2A0bfC5trdjUJHvRLO/HXHiA=; b=f9xBk3ZT1aU6tiUDyxDps2kAyY
	ufHuUfQc838U3P9oJKkb7Ps1NObX28rK2n32CYPjR9B2q7gQbXoLOIHOx3wmMB4NQ/F7OJP45wZ7F
	WYxOqlU3GnpKiGVH759KeExcxZMSm8jQV/zLtspkmMSpwizMczKsKY3YQ7CIKsaUTN2c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/vlapic: Fix handling of writes to APIC_ESR
Message-Id: <E1tvFGg-009jFU-12@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:45:02 +0000

commit 70b6b7cc100689c964b80b73511a61961c2e9a73
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:32:41 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:32:41 2025 +0100

    x86/vlapic: Fix handling of writes to APIC_ESR
    
    Xen currently presents APIC_ESR to guests as a simple read/write register.
    
    This is incorrect.  The SDM states:
    
      The ESR is a write/read register. Before attempt to read from the ESR,
      software should first write to it. (The value written does not affect the
      values read subsequently; only zero may be written in x2APIC mode.) This
      write clears any previously logged errors and updates the ESR with any
      errors detected since the last write to the ESR.
    
    Introduce a new pending_esr field in hvm_hw_lapic.
    
    Update vlapic_error() to accumulate errors here, and extend vlapic_reg_write()
    to discard the written value and transfer pending_esr into APIC_ESR.  Reads
    are still as before.
    
    Importantly, this means that guests no longer destroys the ESR value it's
    looking for in the LVTERR handler when following the SDM instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b28b590d4a23894672f1dd7fb98cdf9926ecb282
    master date: 2025-03-07 14:34:08 +0000
---
 xen/arch/x86/hvm/vlapic.c              | 17 +++++++++++++++--
 xen/include/public/arch-x86/hvm/save.h |  1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 70431ba438..9a7f1c911f 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -109,7 +109,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     uint32_t esr;
 
     spin_lock_irqsave(&vlapic->esr_lock, flags);
-    esr = vlapic_get_reg(vlapic, APIC_ESR);
+    esr = vlapic->hw.pending_esr;
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
@@ -128,7 +128,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
                  errmask |= APIC_ESR_RECVILL;
         }
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+        vlapic->hw.pending_esr |= errmask;
 
         if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
@@ -796,6 +796,19 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         vlapic_set_reg(vlapic, APIC_ID, val);
         break;
 
+    case APIC_ESR:
+    {
+        unsigned long flags;
+
+        spin_lock_irqsave(&vlapic->esr_lock, flags);
+        val = vlapic->hw.pending_esr;
+        vlapic->hw.pending_esr = 0;
+        spin_unlock_irqrestore(&vlapic->esr_lock, flags);
+
+        vlapic_set_reg(vlapic, APIC_ESR, val);
+        break;
+    }
+
     case APIC_TASKPRI:
         vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff);
         break;
diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h
index 7ecacadde1..9c4bfc7ebd 100644
--- a/xen/include/public/arch-x86/hvm/save.h
+++ b/xen/include/public/arch-x86/hvm/save.h
@@ -394,6 +394,7 @@ struct hvm_hw_lapic {
     uint32_t             disabled; /* VLAPIC_xx_DISABLED */
     uint32_t             timer_divisor;
     uint64_t             tdt_msr;
+    uint32_t             pending_esr;
 };
 
 DECLARE_HVM_SAVE_TYPE(LAPIC, 5, struct hvm_hw_lapic);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:45:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921979.1325832 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFGr-0006tq-QN; Thu, 20 Mar 2025 12:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921979.1325832; Thu, 20 Mar 2025 12:45:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFGr-0006ti-No; Thu, 20 Mar 2025 12:45:13 +0000
Received: by outflank-mailman (input) for mailman id 921979;
 Thu, 20 Mar 2025 12:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFGq-0006tZ-FQ
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFGq-00Ez0p-2D
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFGq-009jG4-1L
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CgBElhEO5arVTAB1oFiXBh6lllnV2sLEeiRfRShaLI8=; b=U3Az5339Iec27L1oHI+mDpw8z9
	yfJvp79dlvcgGqPFglmg3fSQ9GXFzbLDjw0X34w3BxKwRw6vtHD4A3pwIR6Uv73f+p/LUCgXeIQXq
	AatusewG6QCo87s1cHSIwcyq93PZpkEF4lN1sRuKNdbmoj76hCWFLJCGjW9qCc8z5jyk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
Message-Id: <E1tvFGq-009jG4-1L@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:45:12 +0000

commit e6219bc97e7df4b0a82f35f9b9bf0a3aed96e8d5
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:33:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:33:12 2025 +0100

    x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
    
    The MMIO_CONF_BASE reports the base of the MCFG range on AMD systems.
    Linux pre-6.14 is unconditionally attempting to read the MSR without a
    safe MSR accessor, and since Xen doesn't allow access to it Linux reports
    the following error:
    
    unchecked MSR access error: RDMSR from 0xc0010058 at rIP: 0xffffffff8101d19f (xen_do_read_msr+0x7f/0xa0)
    Call Trace:
     xen_read_msr+0x1e/0x30
     amd_get_mmconfig_range+0x2b/0x80
     quirk_amd_mmconfig_area+0x28/0x100
     pnp_fixup_device+0x39/0x50
     __pnp_add_device+0xf/0x150
     pnp_add_device+0x3d/0x100
     pnpacpi_add_device_handler+0x1f9/0x280
     acpi_ns_get_device_callback+0x104/0x1c0
     acpi_ns_walk_namespace+0x1d0/0x260
     acpi_get_devices+0x8a/0xb0
     pnpacpi_init+0x50/0x80
     do_one_initcall+0x46/0x2e0
     kernel_init_freeable+0x1da/0x2f0
     kernel_init+0x16/0x1b0
     ret_from_fork+0x30/0x50
     ret_from_fork_asm+0x1b/0x30
    
    Such access is conditional to the presence of a device with PnP ID
    "PNP0c01", which triggers the execution of the quirk_amd_mmconfig_area()
    function.  Note that prior to commit 3fac3734c43a MSR accesses when running
    as a PV guest would always use the safe variant, and thus silently handle
    the #GP.
    
    Fix by allowing access to the MSR on AMD systems for the hardware domain.
    
    Write attempts to the MSR will still result in #GP for all domain types.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b4071d28c5bd9ca4fed76031cbf0e782b74209b9
    master date: 2025-03-12 13:32:30 +0100
---
 xen/arch/x86/msr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 9babd441f9..16eac6ae60 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -243,6 +243,14 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = 0;
         break;
 
+    case MSR_FAM10H_MMIO_CONF_BASE:
+        if ( !is_hardware_domain(d) ||
+             !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ||
+             rdmsr_safe(msr, *val) )
+            goto gp_fault;
+
+        break;
+
     case MSR_VIRT_SPEC_CTRL:
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:45:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:45:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921980.1325836 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFH1-0006wN-Rp; Thu, 20 Mar 2025 12:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921980.1325836; Thu, 20 Mar 2025 12:45:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFH1-0006wF-PE; Thu, 20 Mar 2025 12:45:23 +0000
Received: by outflank-mailman (input) for mailman id 921980;
 Thu, 20 Mar 2025 12:45:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFH0-0006w5-Ia
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:45:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFH0-00Ez0t-2T
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFH0-009jJg-1e
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:45:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=D0GWBPUgPgrQjhDOKEsEWjqmc4219ZByIdE0RmorEIE=; b=rsCaWSVL47wPiJss/e5JspYrB9
	Uo09VxutlM0Yxw+wf/1Ye2sGbQoQJQskRSu2WZtVO06IgihBN1EfCzfPnJIlKGfndeZMoV8n/k/e4
	C3UxN/e3yjMukotx40xoMmVjQH6b+nB1vV7i8yYJo8oDvrISnqatea6CMQYecH9Gl+eE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/vmx: fix posted interrupts usage of msi_desc->msg field
Message-Id: <E1tvFH0-009jJg-1e@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:45:22 +0000

commit 0103cb6c1f1c5fe87c0feeea05d065c5eece6cd3
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:33:31 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:33:31 2025 +0100

    x86/vmx: fix posted interrupts usage of msi_desc->msg field
    
    The current usage of msi_desc->msg in vmx_pi_update_irte() will make the
    field contain a translated MSI message, instead of the expected
    untranslated one.  This breaks dump_msi(), that use the data in
    msi_desc->msg to print the interrupt details.
    
    Fix this by introducing a dummy local msi_msg, and use it with
    iommu_update_ire_from_msi().  vmx_pi_update_irte() relies on the MSI
    message not changing, so there's no need to propagate the resulting msi_msg
    to the hardware, and the contents can be ignored.
    
    Additionally add a comment to clarify that msi_desc->msg must always
    contain the untranslated MSI message.
    
    Fixes: a5e25908d18d ('VT-d: introduce new fields in msi_desc to track binding with guest interrupt')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 30f0e55a79206702b4e82e86dad6b35033157858
    master date: 2025-03-12 13:32:30 +0100
---
 xen/arch/x86/hvm/vmx/vmx.c     | 4 +++-
 xen/arch/x86/include/asm/msi.h | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index f410e509de..7c9659ece6 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -397,6 +397,7 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     const struct pi_desc *pi_desc = v ? &v->arch.hvm.vmx.pi_desc : NULL;
     struct irq_desc *desc;
     struct msi_desc *msi_desc;
+    struct msi_msg msg;
     int rc;
 
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -411,12 +412,13 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     }
     msi_desc->pi_desc = pi_desc;
     msi_desc->gvec = gvec;
+    msg = msi_desc->msg;
 
     spin_unlock_irq(&desc->lock);
 
     ASSERT(pcidevs_locked());
 
-    return iommu_update_ire_from_msi(msi_desc, &msi_desc->msg);
+    return iommu_update_ire_from_msi(msi_desc, &msg);
 
  unlock_out:
     spin_unlock_irq(&desc->lock);
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 5f5b499c82..9bf9d3e7c6 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -123,7 +123,7 @@ struct msi_desc {
     int irq;
     int remap_index;         /* index in interrupt remapping table */
 
-    struct msi_msg msg;      /* Last set MSI message */
+    struct msi_msg msg;      /* Last set MSI message (untranslated) */
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:45:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:45:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921981.1325841 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFHB-0006ym-TE; Thu, 20 Mar 2025 12:45:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921981.1325841; Thu, 20 Mar 2025 12:45:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFHB-0006ye-Qd; Thu, 20 Mar 2025 12:45:33 +0000
Received: by outflank-mailman (input) for mailman id 921981;
 Thu, 20 Mar 2025 12:45:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFHA-0006yW-Kk
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:45:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFHA-00Ez0z-2j
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:45:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFHA-009jK9-1t
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:45:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=J3R/vok6JZk5TJeOtVBxpwr2YeKCtuVdfzkDbu7gHZc=; b=G6LsmXuL0kxljg7LnP8SMX1e4z
	zaXsUAUBjPRt6Q2Cod2311QmhCPDGubDV0/qH7rTAyU4Ow71GDJQf1eAH4KShwW4Z1SRs43WdqofU
	TbiZIS6RFA3qR+/OubtWLv3jmC6NplumaKE/5cQb0E+cQgtOEAPXdLFKL7IalRiyDsF0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/hvm: check return code of hvm_pi_update_irte when binding
Message-Id: <E1tvFHA-009jK9-1t@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:45:32 +0000

commit e757f535066061b15cae2b7130a82b15852efa84
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:33:52 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:33:52 2025 +0100

    x86/hvm: check return code of hvm_pi_update_irte when binding
    
    Consume the return code from hvm_pi_update_irte(), and propagate the error
    back to the caller if hvm_pi_update_irte() fails.
    
    Fixes: 35a1caf8b6b5 ('pass-through: update IRTE according to guest interrupt config changes')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: cb587f620ab56cc683347d8120ba63989fad2693
    master date: 2025-03-12 13:32:31 +0100
---
 xen/drivers/passthrough/x86/hvm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index f73292fd6c..6813107648 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -381,7 +381,15 @@ int pt_irq_create_bind(
 
         /* Use interrupt posting if it is supported. */
         if ( iommu_intpost )
-            hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+        {
+            rc = hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+
+            if ( rc )
+            {
+                pt_irq_destroy_bind(d, pt_irq_bind);
+                return rc;
+            }
+        }
 
         if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:45:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:45:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921982.1325845 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFHL-00071A-UU; Thu, 20 Mar 2025 12:45:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921982.1325845; Thu, 20 Mar 2025 12:45:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFHL-000712-S0; Thu, 20 Mar 2025 12:45:43 +0000
Received: by outflank-mailman (input) for mailman id 921982;
 Thu, 20 Mar 2025 12:45:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFHK-00070t-NP
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:45:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFHK-00Ez15-30
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:45:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFHK-009jKi-2A
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:45:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l3cKfcVO5KWefptSW8jHVz3HSgBj5cV1gblku7lUwRY=; b=Dv6xwYlM1jO/2fylq9d2F0crf/
	EcbVywGm7P8WFfNUkZx6VhJWfQRAxa02sps0D4A2X9rI8sUE3D+jUTaSTTItrnI8TUxzqQ2eLrUc6
	sNUZjC5uZfByc42v3Z6LcYNu5hlMoS+jJ1OfEtvJ7SIoMUKjfpvDJEJKC0fmcyLlU9jg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] libxl: avoid infinite loop in libxl__remove_directory()
Message-Id: <E1tvFHK-009jKi-2A@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:45:42 +0000

commit 9adf83c9e52a06587b8bef7599c5b070b82f4466
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 20 13:34:15 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:34:15 2025 +0100

    libxl: avoid infinite loop in libxl__remove_directory()
    
    Infinitely retrying the rmdir() invocation makes little sense. While the
    original observation was the log filling the disk (due to repeated
    "Directory not empty" errors, in turn occurring for unclear reasons),
    the loop wants breaking even if there was no error message being logged
    (much like is done in the similar loops in libxl__remove_file() and
    libxl__remove_file_or_directory()).
    
    Fixes: c4dcbee67e6d ("libxl: provide libxl__remove_file et al")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 68baeb5c4852e652b9599e049f40477edac4060e
    master date: 2025-03-13 10:23:10 +0100
---
 tools/libs/light/libxl_utils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_utils.c b/tools/libs/light/libxl_utils.c
index e403bd9bcf..65ef196935 100644
--- a/tools/libs/light/libxl_utils.c
+++ b/tools/libs/light/libxl_utils.c
@@ -575,6 +575,7 @@ int libxl__remove_directory(libxl__gc *gc, const char *dirpath)
         if (errno == EINTR) continue;
         LOGE(ERROR, "failed to remove emptied directory %s", dirpath);
         rc = ERROR_FAIL;
+        break;
     }
 
  out:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:45:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:45:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921984.1325849 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFHV-00073N-WA; Thu, 20 Mar 2025 12:45:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921984.1325849; Thu, 20 Mar 2025 12:45:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFHV-00073F-TQ; Thu, 20 Mar 2025 12:45:53 +0000
Received: by outflank-mailman (input) for mailman id 921984;
 Thu, 20 Mar 2025 12:45:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFHU-000737-Q8
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:45:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFHV-00Ez1S-03
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:45:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFHU-009jLZ-2Q
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:45:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uqysetyXUryPKVkWvlqUIOs1UVx8sFuDsAMWSj3cYSc=; b=26ax+54N8WF29tY4YCC//SZPHY
	akZ4X772uuy3oxitCViBeyj4VHfeF9v2fy1btIsU1I3BffyhWo/zx3Pf0zeOoxWsM0+hDuNs/SDAZ
	GjZrjMhbrssxODTDd3NVnPQ42U50Zz8itethPs29+U41MOOS3w/4uAe0aEaEYgUJwZfI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xen/sched: fix arinc653 to not use variables across cpupools
Message-Id: <E1tvFHU-009jLZ-2Q@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:45:52 +0000

commit 8c1b4debf5fa09e630315c767890cfe715965e00
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 20 13:34:45 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:34:45 2025 +0100

    xen/sched: fix arinc653 to not use variables across cpupools
    
    a653sched_do_schedule() is using two function local static variables,
    which is resulting in bad behavior when using more than one cpupool
    with the arinc653 scheduler.
    
    Fix that by moving those variables to the scheduler private data.
    
    Fixes: 22787f2e107c ("ARINC 653 scheduler")
    Reported-by: Choi Anderson <Anderson.Choi@boeing.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
    master commit: d0561ac8ab0e780b1e8ab41d0d15e9f9b076dee3
    master date: 2025-03-14 10:17:11 +0100
---
 xen/common/sched/arinc653.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index a82c0d7314..9ebae6d7ae 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -143,6 +143,12 @@ typedef struct a653sched_priv_s
      * pointers to all Xen UNIT structures for iterating through
      */
     struct list_head unit_list;
+
+    /**
+     * scheduling house keeping variables
+     */
+    unsigned int sched_index;
+    s_time_t next_switch_time;
 } a653sched_priv_t;
 
 /**************************************************************************
@@ -513,8 +519,6 @@ a653sched_do_schedule(
     bool tasklet_work_scheduled)
 {
     struct sched_unit *new_task = NULL;
-    static unsigned int sched_index = 0;
-    static s_time_t next_switch_time;
     a653sched_priv_t *sched_priv = SCHED_PRIV(ops);
     const unsigned int cpu = sched_get_resource_cpu(smp_processor_id());
     unsigned long flags;
@@ -528,18 +532,19 @@ a653sched_do_schedule(
         /* time to enter a new major frame
          * the first time this function is called, this will be true */
         /* start with the first domain in the schedule */
-        sched_index = 0;
+        sched_priv->sched_index = 0;
         sched_priv->next_major_frame = now + sched_priv->major_frame;
-        next_switch_time = now + sched_priv->schedule[0].runtime;
+        sched_priv->next_switch_time = now + sched_priv->schedule[0].runtime;
     }
     else
     {
-        while ( (now >= next_switch_time)
-                && (sched_index < sched_priv->num_schedule_entries) )
+        while ( (now >= sched_priv->next_switch_time) &&
+                (sched_priv->sched_index < sched_priv->num_schedule_entries) )
         {
             /* time to switch to the next domain in this major frame */
-            sched_index++;
-            next_switch_time += sched_priv->schedule[sched_index].runtime;
+            sched_priv->sched_index++;
+            sched_priv->next_switch_time +=
+                sched_priv->schedule[sched_priv->sched_index].runtime;
         }
     }
 
@@ -547,8 +552,8 @@ a653sched_do_schedule(
      * If we exhausted the domains in the schedule and still have time left
      * in the major frame then switch next at the next major frame.
      */
-    if ( sched_index >= sched_priv->num_schedule_entries )
-        next_switch_time = sched_priv->next_major_frame;
+    if ( sched_priv->sched_index >= sched_priv->num_schedule_entries )
+        sched_priv->next_switch_time = sched_priv->next_major_frame;
 
     /*
      * If there are more domains to run in the current major frame, set
@@ -556,8 +561,8 @@ a653sched_do_schedule(
      * Otherwise, set new_task equal to the address of the idle task's
      * sched_unit structure.
      */
-    new_task = (sched_index < sched_priv->num_schedule_entries)
-        ? sched_priv->schedule[sched_index].unit
+    new_task = (sched_priv->sched_index < sched_priv->num_schedule_entries)
+        ? sched_priv->schedule[sched_priv->sched_index].unit
         : IDLETASK(cpu);
 
     /* Check to see if the new task can be run (awake & runnable). */
@@ -589,7 +594,7 @@ a653sched_do_schedule(
      * Return the amount of time the next domain has to run and the address
      * of the selected task's UNIT structure.
      */
-    prev->next_time = next_switch_time - now;
+    prev->next_time = sched_priv->next_switch_time - now;
     prev->next_task = new_task;
     new_task->migrated = false;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:46:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:46:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921985.1325853 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFHg-00076L-2y; Thu, 20 Mar 2025 12:46:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921985.1325853; Thu, 20 Mar 2025 12:46:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFHg-00076A-04; Thu, 20 Mar 2025 12:46:04 +0000
Received: by outflank-mailman (input) for mailman id 921985;
 Thu, 20 Mar 2025 12:46:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFHe-000762-Ss
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:46:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFHf-00Ez1m-0K
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:46:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFHe-009jMp-2i
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:46:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ob+GJGtXp4rzs6Jmqv9FBqqSs5Y3Ccmzhi3SQVnB2RU=; b=R+WR9O8/vvRBiBNJvJvaR1vFZ9
	FxiP5wnsU31c2ki2wtE+R4gJxtgfSDOh6mtQ4F7KSTyQBRT+EA3fut2wEEqJbheFj85HIpIEf21Og
	tv/qqZCKGdGbgxJtQJFf4PZLR9H+t5iHZP1s2d22iKLCAdYN4eL5Xk6TQT6UYsf6D07o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/ioremap: prevent additions against the NULL pointer
Message-Id: <E1tvFHe-009jMp-2i@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:46:02 +0000

commit ca799f1baafc059a9d8708e7e6ca9ea4f8e893ed
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:35:04 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:35:04 2025 +0100

    x86/ioremap: prevent additions against the NULL pointer
    
    This was reported by clang UBSAN as:
    
    UBSAN: Undefined behaviour in arch/x86/mm.c:6297:40
    applying zero offset to null pointer
    [...]
    Xen call trace:
        [<ffff82d040303662>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304aa3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0406ebbc0>] F ioremap_wc+0xc8/0xe0
        [<ffff82d0406c3728>] F video_init+0xd0/0x180
        [<ffff82d0406ab6f5>] F console_init_preirq+0x3d/0x220
        [<ffff82d0406f1876>] F __start_xen+0x68e/0x5530
        [<ffff82d04020482e>] F __high_start+0x8e/0x90
    
    Fix bt_ioremap() and ioremap{,_wc}() to not add the offset if the returned
    pointer from __vmap() is NULL.
    
    Fixes: d0d4635d034f ('implement vmap()')
    Fixes: f390941a92f1 ('x86/DMI: fix table mapping when one lives above 1Mb')
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9a6f2c52f75781acda39fab5cc96d1bcc54bf534
    master date: 2025-03-17 13:33:29 +0100
---
 xen/arch/x86/dmi_scan.c | 7 +++++--
 xen/arch/x86/mm.c       | 6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 81f80c053a..b517c068b8 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -113,6 +113,7 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
 {
     mfn_t mfn = _mfn(PFN_DOWN(addr));
     unsigned int offs = PAGE_OFFSET(addr);
+    void *va;
 
     if ( addr + len <= MB(1) )
         return __va(addr);
@@ -120,8 +121,10 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
     if ( system_state < SYS_STATE_boot )
         return __acpi_map_table(addr, len);
 
-    return __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
-                  VMAP_DEFAULT) + offs;
+    va = __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
+                VMAP_DEFAULT);
+
+    return va ? va + offs : NULL;
 }
 
 static void __init bt_iounmap(const void *ptr, unsigned int len)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 2f0e586463..1454a18fc2 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5994,7 +5994,9 @@ void __iomem *ioremap(paddr_t pa, size_t len)
         unsigned int offs = pa & (PAGE_SIZE - 1);
         unsigned int nr = PFN_UP(offs + len);
 
-        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT) + offs;
+        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT);
+        if ( va )
+            va += offs;
     }
 
     return (void __force __iomem *)va;
@@ -6011,7 +6013,7 @@ void __iomem *__init ioremap_wc(paddr_t pa, size_t len)
 
     va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_WC, VMAP_DEFAULT);
 
-    return (void __force __iomem *)(va + offs);
+    return (void __force __iomem *)(va ? va + offs : NULL);
 }
 
 int create_perdomain_mapping(struct domain *d, unsigned long va,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:46:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:46:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921986.1325857 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFHq-00079T-4U; Thu, 20 Mar 2025 12:46:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921986.1325857; Thu, 20 Mar 2025 12:46:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFHq-00079I-1Q; Thu, 20 Mar 2025 12:46:14 +0000
Received: by outflank-mailman (input) for mailman id 921986;
 Thu, 20 Mar 2025 12:46:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFHo-00079A-Vi
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:46:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFHp-00Ez1q-0c
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:46:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFHo-009jPL-2z
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:46:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lvYmQ5uKGFMQd/Lb7kGJJo9XcwGpcgaJYKeIYmnqsiQ=; b=TQzHU61UkFG3kuHlDDRVoJsmw5
	WPGqjzywHxPfbcUjhpouqNL6DlSHdnXxxC4GTVNa113WW9I61C8WfTQG0U8XHbofrWKMksplfAUe+
	wT/IUgawYZ1YQ1fL4diZYuoaErWgrhKx5sjuNdBGZDgzU9wP7VG0sjdR/RtfNsc9ls0U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
Message-Id: <E1tvFHo-009jPL-2z@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:46:12 +0000

commit 9523aaf3711d0ccb3756f0e655e30b470bd390d0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:35:23 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:35:23 2025 +0100

    x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
    
    The current CI failures turn out to be a latent bug triggered by a narrow set
    of properties of the initrd and the host memory map, which CI encountered by
    chance.
    
    One step during boot involves constructing directmap mappings for modules.
    With some probing at the point of creation, it is observed that there's a 4k
    mapping missing towards the end of the initrd.
    
      (XEN) === Mapped Mod1 [0000000394001000, 00000003be1ff6dc] to Directmap
      (XEN) Probing paddr 394001000, va ffff830394001000
      (XEN) Probing paddr 3be1ff6db, va ffff8303be1ff6db
      (XEN) Probing paddr 3bdffffff, va ffff8303bdffffff
      (XEN) Probing paddr 3be001000, va ffff8303be001000
      (XEN) Probing paddr 3be000000, va ffff8303be000000
      (XEN) Early fatal page fault at e008:ffff82d04032014c (cr2=ffff8303be000000, ec=0000)
    
    The conditions for this bug appear to be map_pages_to_xen() call with a start
    address of exactly 4k beyond a 2M boundary, some number of full 2M pages, then
    a tail needing 4k pages.
    
    Anyway, the condition for spotting superpage boundaries in map_pages_to_xen()
    is wrong.  The IS_ALIGNED() macro expects a power of two for the alignment
    argument, and subtracts 1 itself.
    
    Fixing this causes the failing case to now boot.
    
    Fixes: 97fb6fcf26e8 ("x86/mm: introduce helpers to detect super page alignment")
    Debugged-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b07c7d63f9b587e4df5d71f6da9eaa433512c974
    master date: 2025-03-19 14:53:28 +0000
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 1454a18fc2..a17d024f2a 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5219,7 +5219,7 @@ int map_pages_to_xen(
                                                                 \
     ASSERT(!mfn_eq(m_, INVALID_MFN));                           \
     IS_ALIGNED(PFN_DOWN(v) | mfn_x(m_),                         \
-               (1UL << (PAGETABLE_ORDER * ((n) - 1))) - 1);     \
+               1UL << (PAGETABLE_ORDER * ((n) - 1)));           \
 })
 #define IS_L2E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 2)
 #define IS_L3E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 3)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:46:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:46:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.921987.1325861 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFI0-0007Bt-5C; Thu, 20 Mar 2025 12:46:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 921987.1325861; Thu, 20 Mar 2025 12:46:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFI0-0007Bl-2i; Thu, 20 Mar 2025 12:46:24 +0000
Received: by outflank-mailman (input) for mailman id 921987;
 Thu, 20 Mar 2025 12:46:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFHz-0007Ba-20
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:46:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFHz-00Ez4m-0r
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:46:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFHz-009jQX-01
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:46:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CcVITtvX4L2FaRheQwr6zjd4f2MjTmeLMOa/hAzaSbI=; b=Ib1/6yzbSdb0w63ISKtMUKNf7L
	GSDIm6Xg2RXAVDTa/zADpmHF4n24eGUUK18YC7HbvvsdBotgi4uy5m1DzHio1/VMZ7YOuuN+zMPLL
	bNHFpCE9tEB+MQBkh8jiXc+YcPKFXAoNQMxYY5kMSXvAFmOqwqRb1auxtpitKIl7OV58=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xen/arinc653: call xfree() with local IRQ enabled
Message-Id: <E1tvFHz-009jQX-01@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:46:23 +0000

commit 7dc271d2e6efe7252562a96149d0857538a124f3
Author:     Anderson Choi <anderson.choi@boeing.com>
AuthorDate: Thu Mar 20 13:35:40 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:35:40 2025 +0100

    xen/arinc653: call xfree() with local IRQ enabled
    
    xen panic is observed with the following configuration.
    
    1. Debug xen build (CONFIG_DEBUG=y)
    2. dom1 of an ARINC653 domain
    3. shutdown dom1 with xl command
    
    $ xl shutdown <domain_name>
    
    (XEN) ****************************************
    (XEN) Panic on CPU 2:
    (XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/xmalloc_tlsf.c:714
    (XEN) ****************************************
    
    panic was triggered since xfree() was called with local IRQ disabled and
    therefore assertion failed.
    
    Fix this by calling xfree() after local IRQ is enabled.
    
    Fixes: 19049f8d796a sched: fix locking in a653sched_free_vdata()
    Signed-off-by: Anderson Choi <anderson.choi@boeing.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
    master commit: 3ee55c9543fcf0b35593f030b53f56f3222046b7
    master date: 2025-03-19 16:44:00 +0000
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index 9ebae6d7ae..930361fa5c 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -463,10 +463,11 @@ a653sched_free_udata(const struct scheduler *ops, void *priv)
     if ( !is_idle_unit(av->unit) )
         list_del(&av->list);
 
-    xfree(av);
     update_schedule_units(ops);
 
     spin_unlock_irqrestore(&sched_priv->lock, flags);
+
+    xfree(av);
 }
 
 /**
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:55:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922015.1325885 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFQN-0001v5-AP; Thu, 20 Mar 2025 12:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922015.1325885; Thu, 20 Mar 2025 12:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFQN-0001ux-7j; Thu, 20 Mar 2025 12:55:03 +0000
Received: by outflank-mailman (input) for mailman id 922015;
 Thu, 20 Mar 2025 12:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFQM-0001ur-MU
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFQM-00EzEx-1p
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFQM-009k6y-0u
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=a3bYTH/L6WS6nBu7fy5B5vjk4SLlRJNSOfAbB0Dg4Ak=; b=Sv36JeRhmDNN5JvesQJgE8Ud9m
	Gv3LDjkqEa7vBkWKJ/phMEkriXWguR6fgRdEV3WUUnYOhTih5fulgQ2XfkcNyFpWdjcZPqoEqrAbf
	k3M/7dP40rxggzL5bEX2f1Pug0zC15af758TnYwGMC9dtdHPNATgCeapp/NCx8HGnskY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/msi: always propagate MSI writes when not in active system mode
Message-Id: <E1tvFQM-009k6y-0u@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:55:02 +0000

commit c9f62baee892c4356653dd56fe3c6bf25fb84350
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 17 15:40:11 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 09:27:25 2025 +0100

    x86/msi: always propagate MSI writes when not in active system mode
    
    Relax the limitation on MSI register writes, and only apply it when the
    system is in active state.  For example AMD IOMMU drivers rely on using
    set_msi_affinity() to force an MSI register write on resume from
    suspension.
    
    The original patch intention was to reduce the number of MSI register
    writes when the system is in active state.  Leave the other states to
    always perform the writes, as it's safer given the existing code, and it's
    expected to not make a difference performance wise.
    
    For such propagation to work even when the IRT index is not updated the MSI
    message must be adjusted in all success cases for AMD IOMMU, not just when
    the index has been newly allocated.
    
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Fixes: 8e60d47cf011 ('x86/iommu: avoid MSI address and data writes if IRT index hasn't changed')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/arch/x86/msi.c                       | 9 +++++++++
 xen/drivers/passthrough/amd/iommu_intr.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 163ccf8747..8bb3bb18af 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -189,6 +189,15 @@ static int write_msi_msg(struct msi_desc *entry, struct msi_msg *msg,
 {
     entry->msg = *msg;
 
+    if ( unlikely(system_state != SYS_STATE_active) )
+        /*
+         * Always propagate writes when not in the 'active' state.  The
+         * optimization to avoid the MSI address and data registers write is
+         * only relevant for runtime state, and drivers on resume (at least)
+         * rely on set_msi_affinity() to update the hardware state.
+         */
+        force = true;
+
     if ( iommu_intremap != iommu_intremap_off )
     {
         int rc;
diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index 9abdc38053..08766122b4 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -546,7 +546,7 @@ int cf_check amd_iommu_msi_msg_update_ire(
     rc = update_intremap_entry_from_msi_msg(iommu, bdf, nr,
                                             &msi_desc->remap_index,
                                             msg, &data);
-    if ( rc > 0 )
+    if ( rc >= 0 )
     {
         for ( i = 1; i < nr; ++i )
             msi_desc[i].remap_index = msi_desc->remap_index + i;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922016.1325888 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFQX-0001xA-Bo; Thu, 20 Mar 2025 12:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922016.1325888; Thu, 20 Mar 2025 12:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFQX-0001x2-9E; Thu, 20 Mar 2025 12:55:13 +0000
Received: by outflank-mailman (input) for mailman id 922016;
 Thu, 20 Mar 2025 12:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFQW-0001ws-ET
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFQW-00EzF2-26
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFQW-009k7N-1E
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lBPFpcpFrDfhPUGS5Um2pEBQOn+HECrLtaPT9gsKCrA=; b=nlKZ8PtT2i5vWFmIfhyDA+kACT
	rERWAcph16KQHV8Opiyb/LBpQnDgKQjtbxZma82/SJ3FNbviT0cfRs9z5Ax0SPRhuxNfGdPZDiVVQ
	XCEZpK+W3sWlFR8L/CV4r+NnbqYlJUu4Qej7VpOwBpobiSxoL8EpK+973IB8kMgN+H2k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/msi: always propagate MSI register writes from __setup_msi_irq()
Message-Id: <E1tvFQW-009k7N-1E@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:55:12 +0000

commit b3bf9646101e48d9c3a8a53e53c39a39b4aa877f
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 18 09:31:35 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 09:27:25 2025 +0100

    x86/msi: always propagate MSI register writes from __setup_msi_irq()
    
    After 8e60d47cf011 writes from __setup_msi_irq() will no longer be
    propagated to the MSI registers if the IOMMU IRTE was already allocated.
    Given the purpose of __setup_msi_irq() is MSI initialization, always
    propagate the write to the hardware, regardless of whether the IRTE was
    already allocated.
    
    No functional change expected, as the write should always be propagated in
    __setup_msi_irq(), but make it explicit on the write_msi_msg() call.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 8bb3bb18af..5389bc0867 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -532,7 +532,7 @@ int __setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc,
     desc->msi_desc = msidesc;
     desc->handler = handler;
     msi_compose_msg(desc->arch.vector, desc->arch.cpu_mask, &msg);
-    ret = write_msi_msg(msidesc, &msg, false);
+    ret = write_msi_msg(msidesc, &msg, true);
     if ( unlikely(ret) )
     {
         desc->handler = &no_irq_type;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922017.1325893 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFQh-0001zi-DI; Thu, 20 Mar 2025 12:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922017.1325893; Thu, 20 Mar 2025 12:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFQh-0001za-Ae; Thu, 20 Mar 2025 12:55:23 +0000
Received: by outflank-mailman (input) for mailman id 922017;
 Thu, 20 Mar 2025 12:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFQg-0001zO-H8
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFQg-00EzFB-2N
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFQg-009k9M-1W
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=029idstZtxYUqKrSIqAhDuR81zG4+88JxeIJ83+GX5U=; b=uedWXnTYSuztdDSVVIu4hePe5G
	7yBUvGuNK4hIkav6H0tGlGgGSKXz5rOMxV6dFsDAE131XpyhmFMOC9BwKz0qaFN2bJp+afZkZ6C9s
	OSkI/paZBtmSZLxDJhu+bpw5uICFRT5GBB1detzQICSISKyavUEYXu63Vkt2OAC9w4aU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/wait: prevent duplicated assembly labels
Message-Id: <E1tvFQg-009k9M-1W@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:55:22 +0000

commit 162b97a4bb2a8b2e3ad18c3730f362862f1c9dcd
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 10:40:49 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:24 2025 +0100

    x86/wait: prevent duplicated assembly labels
    
    When enabling UBSAN with clang, the following error is triggered during the
    build:
    
    common/wait.c:154:9: error: symbol '.L_wq_resume' is already defined
      154 |         "push %%rbx; push %%rbp; push %%r12;"
          |         ^
    <inline asm>:1:121: note: instantiated into assembly here
        1 |         push %rbx; push %rbp; push %r12;push %r13; push %r14; push %r15;sub %esp,%ecx;cmp $4096, %ecx;ja .L_skip;mov %rsp,%rsi;.L_wq_resume: rep movsb;mov %rsp,%rsi;.L_skip:pop %r15; pop %r14; pop %r13;pop %r12; pop %rbp; pop %rbx
          |                                                                                                                                ^
    common/wait.c:154:9: error: symbol '.L_skip' is already defined
      154 |         "push %%rbx; push %%rbp; push %%r12;"
          |         ^
    <inline asm>:1:159: note: instantiated into assembly here
        1 |         push %rbx; push %rbp; push %r12;push %r13; push %r14; push %r15;sub %esp,%ecx;cmp $4096, %ecx;ja .L_skip;mov %rsp,%rsi;.L_wq_resume: rep movsb;mov %rsp,%rsi;.L_skip:pop %r15; pop %r14; pop %r13;pop %r12; pop %rbp; pop %rbx
          |                                                                                                                                                                      ^
    2 errors generated.
    
    The inline assembly block in __prepare_to_wait() is duplicated, thus
    leading to multiple definitions of the otherwise unique labels inside the
    assembly block.  GCC extended-asm documentation notes the possibility of
    duplicating asm blocks:
    
    > Under certain circumstances, GCC may duplicate (or remove duplicates of)
    > your assembly code when optimizing. This can lead to unexpected duplicate
    > symbol errors during compilation if your asm code defines symbols or
    > labels. Using ‘%=’ (see AssemblerTemplate) may help resolve this problem.
    
    Workaround the issue by latching esp to a local variable, this prevents
    clang duplicating the inline asm blocks.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/wait.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/common/wait.c b/xen/common/wait.c
index cb6f5ff3c2..9a11dccb5d 100644
--- a/xen/common/wait.c
+++ b/xen/common/wait.c
@@ -124,6 +124,11 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
     struct cpu_info *cpu_info = get_cpu_info();
     struct vcpu *curr = current;
     unsigned long dummy;
+    /*
+     * Latch esp to a local variable to prevent clang from duplicating the
+     * inline assembly block when UBSAN is enabled.
+     */
+    void *esp = NULL;
 
     ASSERT(wqv->esp == NULL);
 
@@ -166,12 +171,12 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
         ".L_skip:"
         "pop %%r15; pop %%r14; pop %%r13;"
         "pop %%r12; pop %%rbp; pop %%rbx"
-        : "=&S" (wqv->esp), "=&c" (dummy), "=&D" (dummy)
+        : "=&S" (esp), "=&c" (dummy), "=&D" (dummy)
         : "0" (0), "1" (cpu_info), "2" (wqv->stack),
           [sz] "i" (PAGE_SIZE)
         : "memory", "rax", "rdx", "r8", "r9", "r10", "r11" );
 
-    if ( unlikely(wqv->esp == NULL) )
+    if ( unlikely(esp == NULL) )
     {
         gdprintk(XENLOG_ERR, "Stack too large in %s\n", __func__);
         domain_crash(curr->domain);
@@ -179,6 +184,7 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
         for ( ; ; )
             do_softirq();
     }
+    wqv->esp = esp;
 }
 
 static void __finish_wait(struct waitqueue_vcpu *wqv)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922018.1325897 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFQr-00022K-Eu; Thu, 20 Mar 2025 12:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922018.1325897; Thu, 20 Mar 2025 12:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFQr-00022B-Bz; Thu, 20 Mar 2025 12:55:33 +0000
Received: by outflank-mailman (input) for mailman id 922018;
 Thu, 20 Mar 2025 12:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFQq-000223-Kb
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFQq-00EzFF-2h
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFQq-009k9r-1m
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4Fhv+dQMsxOMwl6aDAMijG85SXci1+fT69fqL0jtug8=; b=5672+l0DP+BYcB+7nV7cZvYfmB
	J7E92KBJsYE77kGJCBJLRFqq/FgVmx7/Yq7XmB8eG0wAM4xB4UfIWbQsLZYldNJbRrdgiTVeJLIrm
	BKLWLQyyi6MlotdKQKugCUHQkUg8dVmLHAx2ZAOBgqQ1vUCCd2z10Y1oAvDuQnvdFdck=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
Message-Id: <E1tvFQq-009k9r-1m@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:55:32 +0000

commit fc302866f42f552337ae7d8d78877aec36e6e2ff
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 18 09:20:41 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in common/compat/memory.c:90:9
    pointer operation overflowed ffff820080000000 to 0000020080000000
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0402a6259>] F compat_memory_op+0xf1/0x4d20
        [<ffff82d04041532d>] F hvm_memory_op+0x55/0xe0
        [<ffff82d040416150>] F hvm_hypercall+0xae8/0x21b0
        [<ffff82d0403b24ca>] F svm_vmexit_handler+0x1252/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Adjust the calculations in COMPAT_ARG_XLAT_VIRT_BASE to subtract from the
    per-domain area to obtain the mirrored linear address in the 4th slot,
    instead of overflowing the per-domain linear address.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/x86_64/uaccess.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/x86_64/uaccess.h b/xen/arch/x86/include/asm/x86_64/uaccess.h
index c6fa3fd381..9f515b2638 100644
--- a/xen/arch/x86/include/asm/x86_64/uaccess.h
+++ b/xen/arch/x86/include/asm/x86_64/uaccess.h
@@ -9,9 +9,9 @@
  * a secondary mapping installed, which needs to be used for such accesses in
  * the PV case, and will also be used for HVM to avoid extra conditionals.
  */
-#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) + \
-                                   (PERDOMAIN_ALT_VIRT_START - \
-                                    PERDOMAIN_VIRT_START))
+#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) - \
+                                   PERDOMAIN_VIRT_START + \
+                                   PERDOMAIN_ALT_VIRT_START)
 #define COMPAT_ARG_XLAT_SIZE      (2*PAGE_SIZE)
 struct vcpu;
 int setup_compat_arg_xlat(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:55:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922020.1325901 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFR1-00025S-Hi; Thu, 20 Mar 2025 12:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922020.1325901; Thu, 20 Mar 2025 12:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFR1-00025L-Ek; Thu, 20 Mar 2025 12:55:43 +0000
Received: by outflank-mailman (input) for mailman id 922020;
 Thu, 20 Mar 2025 12:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFR0-00025F-NE
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFR0-00EzFM-2y
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFR0-009kAN-27
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qxPXOa7SVrn4OHugabL1QsV2rl/mpA1RiKtoojM5zY0=; b=mMIYFBLPs3s1XKtnSU8KFGuNDn
	og2UhJ5pfZMZTyGwCRbVPUkuCG2Dq/p3vGxdbaKxXWEmK6M4QfT90EH0Z+Ypq3t5wdKugD8KQ1czr
	RKe5MBCLq3rBcb7UZn7ZB5KmRiHgpVFt+x8NXwo3zm8ZWlW1QlEAnvG6IS+cFexlwrpw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
Message-Id: <E1tvFR0-009kAN-27@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:55:42 +0000

commit 45ee73f1b24246f13cd9583cb2ee25fb9c782db8
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 18 09:20:59 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in arch/x86/mm/shadow/private.h:515:30
    pointer operation overflowed ffff82e000000000 to ffff82dfffffffe0
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d040471b2d>] F arch/x86/mm/shadow/guest_2.c#sh_page_fault__guest_2+0x1e350
        [<ffff82d0403b206b>] F svm_vmexit_handler+0xdf3/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Fix by moving the call to mfn_to_page() after the check of whether the
    passed gmfn is valid.  This avoid the call to mfn_to_page() with an
    INVALID_MFN parameter.
    
    While there make the page local variable const, it's not modified by the
    function.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/private.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index a5fc3a7676..cef9dbef2e 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -512,13 +512,14 @@ static inline unsigned long __backpointer(const struct page_info *sp)
 static inline int
 sh_mfn_is_a_page_table(mfn_t gmfn)
 {
-    struct page_info *page = mfn_to_page(gmfn);
+    const struct page_info *page;
     struct domain *owner;
     unsigned long type_info;
 
     if ( !mfn_valid(gmfn) )
         return 0;
 
+    page = mfn_to_page(gmfn);
     owner = page_get_owner(page);
     if ( owner && shadow_mode_refcounts(owner)
          && (page->count_info & PGC_shadowed_pt) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:55:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922021.1325906 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFRB-00027l-J8; Thu, 20 Mar 2025 12:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922021.1325906; Thu, 20 Mar 2025 12:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFRB-00027d-GM; Thu, 20 Mar 2025 12:55:53 +0000
Received: by outflank-mailman (input) for mailman id 922021;
 Thu, 20 Mar 2025 12:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFRA-00027V-Pz
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFRB-00EzFl-02
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFRA-009kBC-2P
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zt0fyjBcFS0bqvwIGByY9yV8Et1jegbspL6na8KzGFU=; b=sjP4T10Xm6kZ7PyofqWdkVweAo
	Viusb3TwHuJiwAmz88SX/RB49PHIPBjU6s3j4frHfTy5jXMGQ2aFzAvZqaberBTJjIyPZHquS8OzC
	urHQiSj7z5tOxkGxDtCHy59Dm+0y5vVnqiQMx5poo4qY2GyZJafsZ+uOX6kwRFPadITk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/cirrus-ci: add timestamps
Message-Id: <E1tvFRA-009kBC-2P@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:55:52 +0000

commit 1256159f3cfcfef475b94dda39f68a85702bba64
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 11:44:45 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    automation/cirrus-ci: add timestamps
    
    Such timestamps can still be disabled from the Web UI using a tick box.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index 1a39f5026f..aa195ba370 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -14,6 +14,7 @@ freebsd_template: &FREEBSD_ENV
     APPEND_LIB: /usr/local/lib
     APPEND_INCLUDES: /usr/local/include
     CIRRUS_CLONE_DEPTH: 1
+    CIRRUS_LOG_TIMESTAMP: true
 
 freebsd_artifacts: &FREEBSD_ARTIFACTS
   always:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:56:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922022.1325908 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFRL-0002AM-KH; Thu, 20 Mar 2025 12:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922022.1325908; Thu, 20 Mar 2025 12:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFRL-0002AD-Hi; Thu, 20 Mar 2025 12:56:03 +0000
Received: by outflank-mailman (input) for mailman id 922022;
 Thu, 20 Mar 2025 12:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFRK-0002A5-Sw
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFRL-00EzG3-0K
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFRK-009kCD-2f
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VwWhQ048Y7rnOOdlXhbSp53nZidQFtLcChjJ6KpTI98=; b=B83G9eNq6eVmLeeR4M8BQFnTw5
	773nF4n4td+KJFf301tOWlaUqGynxgmGaHS3OmV1hWJGxvkX3F/97FJy4pKLrh7Q4fHKZqnh7B8bW
	i0aFukMSfhK+JVDxiOC9L03kjgji3uRSgSpad/J2dZdZOqkwLwAtjuTboqgk7WeJqdm8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/cirrus-ci: update FreeBSD to 13.5
Message-Id: <E1tvFRK-009kCD-2f@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:56:02 +0000

commit 5395cd7b892daf11cd80e4eec0cfa45c4b319d35
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 11:49:28 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    automation/cirrus-ci: update FreeBSD to 13.5
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index aa195ba370..ce7588b7b6 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1,7 +1,7 @@
 # https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
 freebsd_13: &FREEBSD_13
   freebsd_instance:
-    image_family: freebsd-13-4
+    image_family: freebsd-13-5
 freebsd_14: &FREEBSD_14
   freebsd_instance:
     image_family: freebsd-14-2
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:56:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:56:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922023.1325912 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFRV-0002D1-Lz; Thu, 20 Mar 2025 12:56:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922023.1325912; Thu, 20 Mar 2025 12:56:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFRV-0002Ct-JD; Thu, 20 Mar 2025 12:56:13 +0000
Received: by outflank-mailman (input) for mailman id 922023;
 Thu, 20 Mar 2025 12:56:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFRU-0002Cn-Vc
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFRV-00EzG7-0b
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFRU-009kDL-2x
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KBqHPHmo8IiSW//Iy4TTZBfVsHnYCemS18JjyuOWDPg=; b=HZ91AVZym7p1a0OEWW7hOyVKjB
	I6qKMqr31Nx0w9Ir8DfUJZI3SK1aVyhQ7nRxmruJT2ycOPhdh4Ky9IGqtUPsJOHeUfGQ89P+MQS4v
	LUK18ObeKN140gnRXAqjFfGFujNZaYoYdisBPyIB87x5c4l228ZrMmaBcCZOtJfik74w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/cirrus-ci: store Xen Kconfig before doing a build
Message-Id: <E1tvFRU-009kDL-2x@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:56:12 +0000

commit 421c2bd58f35ede865fa81c82957ca5297e903a4
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 11:55:48 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    automation/cirrus-ci: store Xen Kconfig before doing a build
    
    In case the build fails or gets stuck, store the Kconfig file ahead of
    starting the build.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index ce7588b7b6..490f214f04 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -16,7 +16,7 @@ freebsd_template: &FREEBSD_ENV
     CIRRUS_CLONE_DEPTH: 1
     CIRRUS_LOG_TIMESTAMP: true
 
-freebsd_artifacts: &FREEBSD_ARTIFACTS
+freebsd_configure_artifacts: &FREEBSD_CONFIGURE_ARTIFACTS
   always:
     rename_script:
       - cp xen/.config xen-config
@@ -32,25 +32,30 @@ freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
                                  yajl lzo2 pixman argp-standalone
                                  libxml2 glib git python3
 
-  build_script:
+  configure_script:
     - cc --version
     - ./configure --with-system-seabios=/usr/local/share/seabios/bios.bin
-    - gmake -j`sysctl -n hw.ncpu` clang=y
+    - gmake -j`sysctl -n hw.ncpu` -C xen clang=y defconfig
+
+  << : *FREEBSD_CONFIGURE_ARTIFACTS
 
-  << : *FREEBSD_ARTIFACTS
+  build_script:
+    - gmake -j`sysctl -n hw.ncpu` clang=y
 
 freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
   << : *FREEBSD_ENV
 
   install_script: pkg install -y gmake python3 bison
 
-  build_script:
+  configure_script:
     - cc --version
     - gmake -j`sysctl -n hw.ncpu` -C xen clang=y \
             KCONFIG_ALLCONFIG=tools/kconfig/allrandom.config randconfig
-    - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
 
-  << : *FREEBSD_ARTIFACTS
+  << : *FREEBSD_CONFIGURE_ARTIFACTS
+
+  build_script:
+    - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
 
 task:
   name: 'FreeBSD 13: full build'
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:56:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:56:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922024.1325917 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFRf-0002FR-NF; Thu, 20 Mar 2025 12:56:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922024.1325917; Thu, 20 Mar 2025 12:56:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFRf-0002FJ-Kc; Thu, 20 Mar 2025 12:56:23 +0000
Received: by outflank-mailman (input) for mailman id 922024;
 Thu, 20 Mar 2025 12:56:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFRf-0002FC-1q
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:56:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFRf-00EzGD-0q
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFRf-009kEG-00
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:56:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9iEvBQ6znbEXqq4cFdkbLGsnG2XPxb2StMVwzFRB7fY=; b=xlqzuhCu7xBD5H8vH+xwgwzl4q
	eXO5Tbwyj6t4pGRBYTqPS3EoqPueiRlLslxnDSfRwShed0wa8dDxCVzjcLj2EajLdmiHjMawT2qo7
	P2tkR4rzaSL5+m5LDhL5eAMdMR3gnC4577IKI+hN5YueKd5ZTvm0KRUPZyI+JYAuE92E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/console.exp: do not assume expect is always at /usr/bin/
Message-Id: <E1tvFRf-009kEG-00@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:56:23 +0000

commit c6867d134eeb3aefcecf022f4ab20c325701ef30
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 17 10:31:07 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    automation/console.exp: do not assume expect is always at /usr/bin/
    
    Instead use env to find the location of expect.
    
    Additionally do not use the -f flag, as it's only meaningful when passing
    arguments on the command line, which we never do for console.exp.  From the
    expect 5.45.4 man page:
    
    > The -f flag prefaces a file from which to read commands from.  The flag
    > itself is optional as it is only useful when using the #! notation (see
    > above), so  that other arguments may be supplied on the command line.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/console.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/scripts/console.exp b/automation/scripts/console.exp
index 310543c33e..31ce97b91b 100755
--- a/automation/scripts/console.exp
+++ b/automation/scripts/console.exp
@@ -1,4 +1,4 @@
-#!/usr/bin/expect -f
+#!/usr/bin/env expect
 
 if {[info exists env(TEST_TIMEOUT_OVERRIDE)]} {
     set timeout $env(TEST_TIMEOUT_OVERRIDE)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:56:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922025.1325921 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFRq-0002Hn-Ob; Thu, 20 Mar 2025 12:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922025.1325921; Thu, 20 Mar 2025 12:56:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFRq-0002Hf-M2; Thu, 20 Mar 2025 12:56:34 +0000
Received: by outflank-mailman (input) for mailman id 922025;
 Thu, 20 Mar 2025 12:56:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFRp-0002HY-4L
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:56:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFRp-00EzJl-16
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:56:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFRp-009kEg-0G
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:56:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qQCEGswUG9Ir9ENImmgLPJsiRr3j+h28AIgQpnf+6QU=; b=U8KBRyZGEQFORj5KLWci/OuXF8
	QAvjtl5R84WdcLTHkZ+Q2R1uBcBOPYJ5lfyF8uAYu+HdRjlCh27UMKvJ0mNDMJ71nTVqL+z419nR9
	dCl1R3zuJz1zUIcZzO518BSe2hzuNc9rm5fbpg29xu7i8ExfCvOsBx7fCw0qw9+hWg4g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: clarify comment about trampoline_setup usage
Message-Id: <E1tvFRp-009kEg-0G@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:56:33 +0000

commit ca6080f290d2e83715884b60d1233cd5b4e68ca0
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 4 15:28:11 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    x86/boot: clarify comment about trampoline_setup usage
    
    Clarify that trampoline_setup is only used for EFI when booted using the
    multiboot2 entry point.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/head.S | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 1b3bd16fe5..81473578fe 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -504,9 +504,7 @@ trampoline_bios_setup:
         mov     %ecx,sym_esi(trampoline_phys)
 
 trampoline_setup:
-        /*
-         * Called on legacy BIOS and EFI platforms.
-         */
+        /* Called for Mutiboot entry, including MB2+EFI. */
 
         /* Save Xen image load base address for later use. */
         mov     %esi, sym_esi(xen_phys_start)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 12:56:45 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 12:56:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922026.1325924 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFS0-0002KB-QA; Thu, 20 Mar 2025 12:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922026.1325924; Thu, 20 Mar 2025 12:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvFS0-0002K3-NW; Thu, 20 Mar 2025 12:56:44 +0000
Received: by outflank-mailman (input) for mailman id 922026;
 Thu, 20 Mar 2025 12:56:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvFRz-0002Jt-6u
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 12:56:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFRz-00EzJr-1M
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:56:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvFRz-009kFH-0V
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 12:56:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7fBuvpn5BKohu3+wYxVRx/2DB9Q1/2WXWMVY/ON5uyU=; b=L1RjFjiplMsVN3836UgHUdDuWn
	MF0yz5hF/uumJKVBchMz5MBjHC6fWvE4TwvEV5JQSnDlYmcHdUtk8/SnRGOMDJ6ZnjZ2nwzMuGmAa
	f7uew0754j63kTRdM9gPRUsl87NviMo3Mwvc4yGNvo1U5A9u3OfCWFBFh56uzOA9HoKI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mkelf32: account for offset when detecting note segment placement
Message-Id: <E1tvFRz-009kFH-0V@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 12:56:43 +0000

commit 6e5fed7cb67c9f84653cdbd3924b8a119ef653be
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 5 18:08:13 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 12:28:30 2025 +0100

    x86/mkelf32: account for offset when detecting note segment placement
    
    mkelf32 attempt to check that the program header defined NOTE segment falls
    inside of the LOAD segment, as the build-id should be loaded for Xen at
    runtime to check.
    
    However the current code doesn't take into account the LOAD program header
    segment offset when calculating overlap with the NOTE segment.  This
    results in incorrect detection, and the following build error:
    
    arch/x86/boot/mkelf32 --notes xen-syms ./.xen.elf32 0x200000 \
                   `nm xen-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$/0x\1/p'`
    Expected .note section within .text section!
    Offset 4244776 not within 2910364!
    
    When xen-syms has the following program headers:
    
    Program Header:
        LOAD off    0x0000000000200000 vaddr 0xffff82d040200000 paddr 0x0000000000200000 align 2**21
             filesz 0x00000000002c689c memsz 0x00000000003f7e20 flags rwx
        NOTE off    0x000000000040c528 vaddr 0xffff82d04040c528 paddr 0x000000000040c528 align 2**2
             filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
    
    Account for the program header offset of the LOAD segment when checking
    whether the NOTE segments is contained within.  Also fix the logic to
    ensure the NOTE segments is fully contained between the LOAD segment.
    
    Fixes: a353cab905af ('build_id: Provide ld-embedded build-ids')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/mkelf32.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 5f9e7e440e..f0f406687c 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -358,11 +358,13 @@ int main(int argc, char **argv)
         note_sz = in64_phdr.p_memsz;
         note_base = in64_phdr.p_vaddr - note_base;
 
-        if ( in64_phdr.p_offset > dat_siz || offset > in64_phdr.p_offset )
+        if ( in64_phdr.p_offset < offset ||
+             in64_phdr.p_offset + in64_phdr.p_filesz > offset + dat_siz )
         {
             fprintf(stderr, "Expected .note section within .text section!\n" \
-                    "Offset %"PRId64" not within %d!\n",
-                    in64_phdr.p_offset, dat_siz);
+                    ".note: [%"PRIx64", %"PRIx64") .text: [%x, %x)\n",
+                    in64_phdr.p_offset, in64_phdr.p_offset + in64_phdr.p_filesz,
+                    offset, offset + dat_siz);
             return 1;
         }
         /* Gets us the absolute offset within the .text section. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:11:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922127.1325989 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGbw-0004An-0y; Thu, 20 Mar 2025 14:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922127.1325989; Thu, 20 Mar 2025 14:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGbv-0004Af-UG; Thu, 20 Mar 2025 14:11:03 +0000
Received: by outflank-mailman (input) for mailman id 922127;
 Thu, 20 Mar 2025 14:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGbu-0004AT-BH
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGbu-00F17s-19
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGbu-00A71g-0D
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MikLhQltsTy+MMww4zL5IkGgLgpu+X66ETKSNMeLjh0=; b=aCiXj9YI0FxELIzjVPcKXbXHqj
	RhPkEssYl2dpcQi9uNpvNzWOWbNYTSdWrLmQ6HPZ7RL1/lwwJdAz7Q2LvHmh0UQCR1m8IaGCkrDsD
	A02Am6cnsnaJNimIyT5Ok/UcyR1I5VAHRr5s9crmLD1L8jd5j+fBSVURbtlz9f0lawm8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] update Xen version to 4.20.1-pre
Message-Id: <E1tvGbu-00A71g-0D@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:11:02 +0000

commit 9d465658b4052b4460995dca4ecb33ecb3d20ab5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 20 12:46:52 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:46:52 2025 +0100

    update Xen version to 4.20.1-pre
---
 Config.mk    |   2 --
 MAINTAINERS  | 106 +++++------------------------------------------------------
 xen/Makefile |   2 +-
 3 files changed, 10 insertions(+), 100 deletions(-)

diff --git a/Config.mk b/Config.mk
index 1a86c03d11..74e57aebda 100644
--- a/Config.mk
+++ b/Config.mk
@@ -242,8 +242,6 @@ ETHERBOOT_NICS ?= rtl8139 8086100e
 
 QEMU_TRADITIONAL_URL ?= https://xenbits.xen.org/git-http/qemu-xen-traditional.git
 QEMU_TRADITIONAL_REVISION ?= xen-4.20.0
-# Wed Jul 15 10:01:40 2020 +0100
-# qemu-trad: remove Xen path dependencies
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/MAINTAINERS b/MAINTAINERS
index c11b82eca9..87ff7ad190 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -54,6 +54,15 @@ list. Remember to copy the appropriate stable branch maintainer who
 will be listed in this section of the MAINTAINERS file in the
 appropriate branch.
 
+The maintainer for this branch is:
+
+	Jan Beulich <jbeulich@suse.com>
+
+Tools backport requests should also be copied to:
+
+       Anthony Perard <anthony.perard@vates.tech>
+
+
 	Unstable Subsystem Maintainers
 	==============================
 
@@ -104,103 +113,6 @@ Descriptions of section entries:
 	   xen-maintainers-<version format number of this file>
 
 
-	Check-in policy
-	===============
-
-In order for a patch to be checked in, in general, several conditions
-must be met:
-
-1. In order to get a change to a given file committed, it must have
-   the approval of at least one maintainer of that file.
-
-   A patch of course needs Acks from the maintainers of each file that
-   it changes; so a patch which changes xen/arch/x86/traps.c,
-   xen/arch/x86/mm/p2m.c, and xen/arch/x86/mm/shadow/multi.c would
-   require an Ack from each of the three sets of maintainers.
-
-   See below for rules on nested maintainership.
-
-2. Each change must have appropriate approval from someone other than
-   the person who wrote it.  This can be either:
-
-  a. An Acked-by from a maintainer of the code being touched (a
-     co-maintainer if available, or a more general level maintainer if
-     not available; see the secton on nested maintainership)
-
-  b. A Reviewed-by by anyone of suitable stature in the community
-
-3. Sufficient time must have been given for anyone to respond.  This
-   depends in large part upon the urgency and nature of the patch.
-   For a straightforward uncontroversial patch, a day or two may be
-   sufficient; for a controversial patch, a week or two may be better.
-
-4. There must be no "open" objections.
-
-In a case where one person submits a patch and a maintainer gives an
-Ack, the Ack stands in for both the approval requirement (#1) and the
-Acked-by-non-submitter requirement (#2).
-
-In a case where a maintainer themselves submits a patch, the
-Signed-off-by meets the approval requirement (#1); so a Review
-from anyone in the community suffices for requirement #2.
-
-Before a maintainer checks in their own patch with another community
-member's R-b but no co-maintainer Ack, it is especially important to
-give their co-maintainer opportunity to give feedback, perhaps
-declaring their intention to check it in without their co-maintainers
-ack a day before doing so.
-
-In the case where two people collaborate on a patch, at least one of
-whom is a maintainer -- typically where one maintainer will do an
-early version of the patch, and another maintainer will pick it up and
-revise it -- there should be two Signed-off-by's and one Acked-by or
-Reviewed-by; with the maintainer who did the most recent change
-sending the patch, and an Acked-by or Reviewed-by coming from the
-maintainer who did not most recently edit the patch.  This satisfies
-the requirement #2 because a) the Signed-off-by of the sender approves
-the final version of the patch; including all parts of the patch that
-the sender did not write b) the Reviewed-by approves the final version
-of the patch, including all patches that the reviewer did not write.
-Thus all code in the patch has been approved by someone who did not
-write it.
-
-Maintainers may choose to override non-maintainer objections in the
-case that consensus can't be reached.
-
-As always, no policy can cover all possible situations.  In
-exceptional circumstances, committers may commit a patch in absence of
-one or more of the above requirements, if they are reasonably
-confident that the other maintainers will approve of their decision in
-retrospect.
-
-       The meaning of nesting
-       ======================
-
-Many maintainership areas are "nested": for example, there are entries
-for xen/arch/x86 as well as xen/arch/x86/mm, and even
-xen/arch/x86/mm/shadow; and there is a section at the end called "THE
-REST" which lists all committers.  The meaning of nesting is that:
-
-1. Under normal circumstances, the Ack of the most specific maintainer
-is both necessary and sufficient to get a change to a given file
-committed.  So a change to xen/arch/x86/mm/shadow/multi.c requires the
-the Ack of the xen/arch/x86/mm/shadow maintainer for that part of the
-patch, but would not require the Ack of the xen/arch/x86 maintainer or
-the xen/arch/x86/mm maintainer.
-
-2. In unusual circumstances, a more general maintainer's Ack can stand
-in for or even overrule a specific maintainer's Ack.  Unusual
-circumstances might include:
- - The patch is fixing a high-priority issue causing immediate pain,
- and the more specific maintainer is not available.
- - The more specific maintainer has not responded either to the
- original patch, nor to "pings", within a reasonable amount of time.
- - The more general maintainer wants to overrule the more specific
- maintainer on some issue. (This should be exceptional.)
- - In the case of a disagreement between maintainers, THE REST can
- settle the matter by majority vote.  (This should be very exceptional
- indeed.)
-
 
 Maintainers List (try to look for most precise areas first)
 
diff --git a/xen/Makefile b/xen/Makefile
index 6bf0b0ea9e..7fa1b67487 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -6,7 +6,7 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 20
-export XEN_EXTRAVERSION ?= .0$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922128.1325993 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGc5-0004QH-3w; Thu, 20 Mar 2025 14:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922128.1325993; Thu, 20 Mar 2025 14:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGc5-0004Q7-0w; Thu, 20 Mar 2025 14:11:13 +0000
Received: by outflank-mailman (input) for mailman id 922128;
 Thu, 20 Mar 2025 14:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGc4-0004Pz-8P
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGc4-00F17w-1V
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGc4-00A7Bh-0d
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=28nfIU6BgG/JFpPT5vxy1tClOt64g2zPHPxmZo+0yT8=; b=PaNunarhFKtaT4WaevmWtlkjeW
	fB/3oY+1Z7uSFTJ8uCS8gQJW2s0Ta7Q3Nq2U7yq5d4JLWKeobstbLKAIX1+JlyzADPqyWq7+48GK6
	EOWSTGgxBnfrchPtgEn2ZHcLjbUMBlOynkgKw3vKcjr6sAzniSFbbXWNBDp81IwZfNjk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/emul: dump unhandled memory accesses for PVH dom0
Message-Id: <E1tvGc4-00A7Bh-0d@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:11:12 +0000

commit 48f013199a768c6204125028f09255d20c8e99fa
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:48:32 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:48:32 2025 +0100

    x86/emul: dump unhandled memory accesses for PVH dom0
    
    A PV dom0 can map any host memory as long as it's allowed by the IO
    capability range in d->iomem_caps.  On the other hand, a PVH dom0 has no
    way to populate MMIO region onto it's p2m, so it's limited to what Xen
    initially populates on the p2m based on the host memory map and the enabled
    device BARs.
    
    Introduce a new debug build only printk that reports attempts by dom0 to
    access addresses not populated on the p2m, and not handled by any emulator.
    This is for information purposes only, but might allow getting an idea of
    what MMIO ranges might be missing on the p2m.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 43d8a80a0cccfe3715bb3178b5c15fb983979651
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/hvm/emulate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 0d90cc4598..08b9493e6d 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -337,6 +337,9 @@ static int hvmemul_do_io(
         /* If there is no suitable backing DM, just ignore accesses */
         if ( !s )
         {
+            if ( is_mmio && is_hardware_domain(currd) )
+                gdprintk(XENLOG_DEBUG, "unhandled memory %s %#lx size %u\n",
+                         dir ? "read from" : "write to", addr, size);
             rc = hvm_process_io_intercept(&null_handler, &p);
             vio->req.state = STATE_IOREQ_NONE;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:11:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922129.1325996 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGcG-0004Uu-58; Thu, 20 Mar 2025 14:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922129.1325996; Thu, 20 Mar 2025 14:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGcG-0004Um-2L; Thu, 20 Mar 2025 14:11:24 +0000
Received: by outflank-mailman (input) for mailman id 922129;
 Thu, 20 Mar 2025 14:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGcE-0004US-DC
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGcE-00F180-1n
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGcE-00A7R2-0w
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oXi1hW0cuE0zS8+An8nQ9SDnnLikCtKI340rLBTAq5g=; b=mBA1nVqC0pSxl050L/h4eK8qIH
	uHBgwUDPbeGw01lsD+pYj+JTPV6CrCpp7AuUZ0UU5wCcnU5sezb48YzBZ/iOKRTceKsuXGQUcMV9f
	qhCUxnS+tyzUaD0P7K2a5IwmuXILwgSTyj2bBvDkqlARdNAaGPJKZPeCL1/RZJgng1pw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/dom0: attempt to fixup p2m page-faults for PVH dom0
Message-Id: <E1tvGcE-00A7R2-0w@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:11:22 +0000

commit b5ade8ef267d09677d489e4fea209a4090aa6239
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:48:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:48:51 2025 +0100

    x86/dom0: attempt to fixup p2m page-faults for PVH dom0
    
    When building a PVH dom0 Xen attempts to map all (relevant) MMIO regions
    into the p2m for dom0 access.  However the information Xen has about the
    host memory map is limited.  Xen doesn't have access to any resources
    described in ACPI dynamic tables, and hence the p2m mappings provided might
    not be complete.
    
    PV doesn't suffer from this issue because a PV dom0 is capable of mapping
    into it's page-tables any address not explicitly banned in d->iomem_caps.
    
    Introduce a new command line options that allows Xen to attempt to fixup
    the p2m page-faults, by creating p2m identity maps in response to p2m
    page-faults.
    
    This is aimed as a workaround to small ACPI regions Xen doesn't know about.
    Note that missing large MMIO regions mapped in this way will lead to
    slowness due to the VM exit processing, plus the mappings will always use
    small pages.
    
    The ultimate aim is to attempt to bring better parity with a classic PV
    dom0.
    
    Note such fixup rely on the CPU doing the access to the unpopulated
    address.  If the access is attempted from a device instead there's no
    possible way to fixup, as IOMMU page-fault are asynchronous.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    master commit: 104591f5dd675d7bfb04885dace0e4e5a097fc1e
    master date: 2025-03-05 10:26:46 +0100
---
 CHANGELOG.md                           |  6 +++
 docs/misc/xen-command-line.pandoc      | 16 +++++++-
 xen/arch/x86/dom0_build.c              |  5 +++
 xen/arch/x86/hvm/emulate.c             | 74 +++++++++++++++++++++++++++++++++-
 xen/arch/x86/include/asm/hvm/emulate.h |  3 ++
 5 files changed, 101 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2b9ba49225..d098e7c5ac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
+## [4.20.1](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.20.1)
+
+### Added
+ - On x86:
+   - Option to attempt to fixup p2m page-faults on PVH dom0.
+
 ## [4.20.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.20.0) - 2025-03-05
 
 ### Changed
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 9bbd00baef..83bb69cfb8 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -822,7 +822,8 @@ Specify the bit width of the DMA heap.
 
 ### dom0
     = List of [ pv | pvh, shadow=<bool>, verbose=<bool>,
-                cpuid-faulting=<bool>, msr-relaxed=<bool> ] (x86)
+                cpuid-faulting=<bool>, msr-relaxed=<bool>,
+                pf-fixup=<bool> ] (x86)
 
     = List of [ sve=<integer> ] (Arm64)
 
@@ -883,6 +884,19 @@ Controls for how dom0 is constructed on x86 systems.
 
     If using this option is necessary to fix an issue, please report a bug.
 
+*   The `pf-fixup` boolean is only applicable when using a PVH dom0 and
+    defaults to false.
+
+    When running dom0 in PVH mode the dom0 kernel has no way to map MMIO
+    regions into its physical memory map, such mode relies on Xen dom0 builder
+    populating the physical memory map with all MMIO regions that dom0 should
+    access.  However Xen doesn't have a complete picture of the host memory
+    map, due to not being able to process ACPI dynamic tables.
+
+    The `pf-fixup` option allows Xen to attempt to add missing MMIO regions
+    to the dom0 physical memory map in response to page-faults generated by
+    dom0 trying to access unpopulated entries in the memory map.
+
 Enables features on dom0 on Arm systems.
 
 *   The `sve` integer parameter enables Arm SVE usage for Dom0 and sets the
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index e8f5bf5447..3b9681dc91 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -16,6 +16,7 @@
 #include <asm/dom0_build.h>
 #include <asm/guest.h>
 #include <asm/hpet.h>
+#include <asm/hvm/emulate.h>
 #include <asm/io-ports.h>
 #include <asm/io_apic.h>
 #include <asm/p2m.h>
@@ -286,6 +287,10 @@ int __init parse_arch_dom0_param(const char *s, const char *e)
         opt_dom0_cpuid_faulting = val;
     else if ( (val = parse_boolean("msr-relaxed", s, e)) >= 0 )
         opt_dom0_msr_relaxed = val;
+#ifdef CONFIG_HVM
+    else if ( (val = parse_boolean("pf-fixup", s, e)) >= 0 )
+        opt_dom0_pf_fixup = val;
+#endif
     else
         return -EINVAL;
 
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 08b9493e6d..3cd7f2e22f 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -10,12 +10,15 @@
  */
 
 #include <xen/init.h>
+#include <xen/iocap.h>
 #include <xen/ioreq.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <xen/paging.h>
 #include <xen/trace.h>
 #include <xen/vm_event.h>
+
+#include <asm/altp2m.h>
 #include <asm/event.h>
 #include <asm/i387.h>
 #include <asm/xstate.h>
@@ -161,6 +164,36 @@ void hvmemul_cancel(struct vcpu *v)
     hvmemul_cache_disable(v);
 }
 
+bool __ro_after_init opt_dom0_pf_fixup;
+static int hwdom_fixup_p2m(paddr_t addr)
+{
+    unsigned long gfn = paddr_to_pfn(addr);
+    struct domain *currd = current->domain;
+    p2m_type_t type;
+    mfn_t mfn;
+    int rc;
+
+    ASSERT(is_hardware_domain(currd));
+    ASSERT(!altp2m_active(currd));
+
+    /*
+     * Fixups are only applied for MMIO holes, and rely on the hardware domain
+     * having identity mappings for non RAM regions (gfn == mfn).
+     */
+    if ( !iomem_access_permitted(currd, gfn, gfn) ||
+         !is_memory_hole(_mfn(gfn), _mfn(gfn)) )
+        return -EPERM;
+
+    mfn = get_gfn(currd, gfn, &type);
+    if ( !mfn_eq(mfn, INVALID_MFN) || !p2m_is_hole(type) )
+        rc = mfn_eq(mfn, _mfn(gfn)) ? -EEXIST : -ENOTEMPTY;
+    else
+        rc = set_mmio_p2m_entry(currd, _gfn(gfn), _mfn(gfn), 0);
+    put_gfn(currd, gfn);
+
+    return rc;
+}
+
 static int hvmemul_do_io(
     bool is_mmio, paddr_t addr, unsigned long *reps, unsigned int size,
     uint8_t dir, bool df, bool data_is_addr, uintptr_t data)
@@ -338,8 +371,45 @@ static int hvmemul_do_io(
         if ( !s )
         {
             if ( is_mmio && is_hardware_domain(currd) )
-                gdprintk(XENLOG_DEBUG, "unhandled memory %s %#lx size %u\n",
-                         dir ? "read from" : "write to", addr, size);
+            {
+                /*
+                 * PVH dom0 is likely missing MMIO mappings on the p2m, due to
+                 * the incomplete information Xen has about the memory layout.
+                 *
+                 * Either print a message to note dom0 attempted to access an
+                 * unpopulated GPA, or try to fixup the p2m by creating an
+                 * identity mapping for the faulting GPA.
+                 */
+                if ( opt_dom0_pf_fixup )
+                {
+                    int inner_rc = hwdom_fixup_p2m(addr);
+
+                    if ( !inner_rc || inner_rc == -EEXIST )
+                    {
+                        if ( !inner_rc )
+                            gdprintk(XENLOG_DEBUG,
+                                     "fixup p2m mapping for page %lx added\n",
+                                     paddr_to_pfn(addr));
+                        else
+                            gprintk(XENLOG_INFO,
+                                    "fixup p2m mapping for page %lx already present\n",
+                                    paddr_to_pfn(addr));
+
+                        rc = X86EMUL_RETRY;
+                        vio->req.state = STATE_IOREQ_NONE;
+                        break;
+                    }
+
+                    gprintk(XENLOG_WARNING,
+                            "unable to fixup memory %s %#lx size %u: %d\n",
+                            dir ? "read from" : "write to", addr, size,
+                            inner_rc);
+                }
+                else
+                    gdprintk(XENLOG_DEBUG,
+                             "unhandled memory %s %#lx size %u\n",
+                             dir ? "read from" : "write to", addr, size);
+            }
             rc = hvm_process_io_intercept(&null_handler, &p);
             vio->req.state = STATE_IOREQ_NONE;
         }
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index 45b03e4e37..d61eacfaa7 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -148,6 +148,9 @@ static inline void hvmemul_write_cache(const struct vcpu *v, paddr_t gpa,
 void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
                               struct hvm_emulate_ctxt *hvmemul_ctxt, int rc);
 
+/* For PVH dom0: signal whether to attempt fixup of p2m page-faults. */
+extern bool opt_dom0_pf_fixup;
+
 #endif /* __ASM_X86_HVM_EMULATE_H__ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:11:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922130.1326000 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGcQ-0004XZ-6K; Thu, 20 Mar 2025 14:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922130.1326000; Thu, 20 Mar 2025 14:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGcQ-0004XR-3l; Thu, 20 Mar 2025 14:11:34 +0000
Received: by outflank-mailman (input) for mailman id 922130;
 Thu, 20 Mar 2025 14:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGcO-0004X6-Eo
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGcO-00F18A-27
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGcO-00A7ik-1E
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6G/yQzYgZsDNX84PiMEkiBABa3adv5drWRFUudLH9rM=; b=T98KwTHVYXiQeRahdiSyHiYfFa
	A6dwiP8Hlg6/odCum4AVjfkZ8PeRuVhnVGv/1q+6lKGU8o2Du98tpPbJLhRKWgL9QN9HlUL276gAx
	AsVJbvUFvYWn+DLqUCQdAoa4XPGuZwh7s+3ww+xssD7vQnoiMF60rzBAWLYsdiu5ehz4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
Message-Id: <E1tvGcO-00A7ik-1E@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:11:32 +0000

commit 1d8d5753b75c07a527abcfe3665f54582e6c2bd0
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:49:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:49:12 2025 +0100

    x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
    
    The logic in dom0_setup_permissions() sets the maximum bound in
    ->iomem_caps unconditionally using paddr_bits, which is not correct for HVM
    based domains.  Instead use domain_max_paddr_bits() to get the correct
    maximum paddr bits for each possible domain type.
    
    Switch to using PFN_DOWN() instead of PAGE_SHIFT, as that's shorter.
    
    Fixes: 53de839fb409 ('x86: constrain MFN range Dom0 may access')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a00e08799cc7657d2a1aca158f4ad43d4c9103e7
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 3b9681dc91..aec596997d 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -481,7 +481,8 @@ int __init dom0_setup_permissions(struct domain *d)
 
     /* The hardware domain is initially permitted full I/O capabilities. */
     rc = ioports_permit_access(d, 0, 0xFFFF);
-    rc |= iomem_permit_access(d, 0UL, (1UL << (paddr_bits - PAGE_SHIFT)) - 1);
+    rc |= iomem_permit_access(d, 0UL,
+                              PFN_DOWN(1UL << domain_max_paddr_bits(d)) - 1);
     rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
 
     /* Modify I/O port access permissions. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:11:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922131.1326005 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGca-0004i5-7z; Thu, 20 Mar 2025 14:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922131.1326005; Thu, 20 Mar 2025 14:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGca-0004hx-5F; Thu, 20 Mar 2025 14:11:44 +0000
Received: by outflank-mailman (input) for mailman id 922131;
 Thu, 20 Mar 2025 14:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGcY-0004hl-I0
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGcY-00F18G-2R
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGcY-00A80Y-1X
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CLUL5b1Qnvxdo+fL6HWnGF/s5wqq/2GP1dK1ImF6Rwc=; b=gMh0R3dLErBWD0d9HYFI56hOO3
	abguj8Ib8vdJ/SIP/ETdRKI0ttLps13S3RRibH+ABxG9t54V5zOxPNw5wsBL/fmznzB/dmvmsAip3
	tDog3rENS1vPTGci2L+v5R0Gr9T70v+b2KYIJ0fNLd6Hr5OIs/ayplNXO6O+41IDZeqM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/iommu: account for IOMEM caps when populating dom0 IOMMU page-tables
Message-Id: <E1tvGcY-00A80Y-1X@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:11:42 +0000

commit a1a5bd40b5e1238fe51df79419471fb6b160cc5b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:49:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:49:30 2025 +0100

    x86/iommu: account for IOMEM caps when populating dom0 IOMMU page-tables
    
    The current code in arch_iommu_hwdom_init() kind of open-codes the same
    MMIO permission ranges that are added to the hardware domain ->iomem_caps.
    Avoid this duplication and use ->iomem_caps in arch_iommu_hwdom_init() to
    filter which memory regions should be added to the dom0 IOMMU page-tables.
    
    Note the IO-APIC and MCFG page(s) must be set as not accessible for a PVH
    dom0, otherwise the internal Xen emulation for those ranges won't work.
    This requires adjustments in dom0_setup_permissions().
    
    The call to pvh_setup_mmcfg() in dom0_construct_pvh() must now strictly be
    done ahead of setting up dom0 permissions, so take the opportunity to also
    put it inside the existing is_hardware_domain() region.
    
    Also the special casing of E820_UNUSABLE regions no longer needs to be done
    in arch_iommu_hwdom_init(), as those regions are already blocked in
    ->iomem_caps and thus would be removed from the rangeset as part of
    ->iomem_caps processing in arch_iommu_hwdom_init().  The E820_UNUSABLE
    regions below 1Mb are not removed from ->iomem_caps, that's a slight
    difference for the IOMMU created page-tables, but the aim is to allow
    access to the same memory either from the CPU or the IOMMU page-tables.
    
    Since ->iomem_caps already takes into account the domain max paddr, there's
    no need to remove any regions past the last address addressable by the
    domain, as applying ->iomem_caps would have already taken care of that.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62f3fc5296c452285e81adb50976bde2d68d3181
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c           | 11 +++++-
 xen/arch/x86/hvm/dom0_build.c       | 14 ++++----
 xen/arch/x86/hvm/io.c               |  6 ++--
 xen/arch/x86/include/asm/hvm/io.h   |  4 +--
 xen/drivers/passthrough/x86/iommu.c | 67 +++++++++++++++----------------------
 5 files changed, 49 insertions(+), 53 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index aec596997d..a735e3650c 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -558,7 +558,9 @@ int __init dom0_setup_permissions(struct domain *d)
     for ( i = 0; i < nr_ioapics; i++ )
     {
         mfn = paddr_to_pfn(mp_ioapics[i].mpc_apicaddr);
-        if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
+        /* If emulating IO-APIC(s) make sure the base address is unmapped. */
+        if ( has_vioapic(d) ||
+             !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
     /* MSI range. */
@@ -599,6 +601,13 @@ int __init dom0_setup_permissions(struct domain *d)
             rc |= rangeset_add_singleton(mmio_ro_ranges, mfn);
     }
 
+    if ( has_vpci(d) )
+        /*
+         * TODO: runtime added MMCFG regions are not checked to make sure they
+         * don't overlap with already mapped regions, thus preventing trapping.
+         */
+        rc |= vpci_mmcfg_deny_access(d);
+
     return rc;
 }
 
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index ce5b5c31b3..6a4453103a 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1323,6 +1323,13 @@ int __init dom0_construct_pvh(struct boot_info *bi, struct domain *d)
 
     if ( is_hardware_domain(d) )
     {
+        /*
+         * MMCFG initialization must be performed before setting domain
+         * permissions, as the MCFG areas must not be part of the domain IOMEM
+         * accessible regions.
+         */
+        pvh_setup_mmcfg(d);
+
         /*
          * Setup permissions early so that calls to add MMIO regions to the
          * p2m as part of vPCI setup don't fail due to permission checks.
@@ -1335,13 +1342,6 @@ int __init dom0_construct_pvh(struct boot_info *bi, struct domain *d)
         }
     }
 
-    /*
-     * NB: MMCFG initialization needs to be performed before iommu
-     * initialization so the iommu code can fetch the MMCFG regions used by the
-     * domain.
-     */
-    pvh_setup_mmcfg(d);
-
     /*
      * Craft dom0 physical memory map and set the paging allocation. This must
      * be done before the iommu initializion, since iommu initialization code
diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index db726b3817..de6ee6c4dd 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -363,14 +363,14 @@ static const struct hvm_mmcfg *vpci_mmcfg_find(const struct domain *d,
     return NULL;
 }
 
-int __hwdom_init vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r)
+int __hwdom_init vpci_mmcfg_deny_access(struct domain *d)
 {
     const struct hvm_mmcfg *mmcfg;
 
     list_for_each_entry ( mmcfg, &d->arch.hvm.mmcfg_regions, next )
     {
-        int rc = rangeset_remove_range(r, PFN_DOWN(mmcfg->addr),
-                                       PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
+        int rc = iomem_deny_access(d, PFN_DOWN(mmcfg->addr),
+                                   PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
 
         if ( rc )
             return rc;
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index f2b8431fac..565bad300d 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -132,8 +132,8 @@ int register_vpci_mmcfg_handler(struct domain *d, paddr_t addr,
 /* Destroy tracked MMCFG areas. */
 void destroy_vpci_mmcfg(struct domain *d);
 
-/* Remove MMCFG regions from a given rangeset. */
-int vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r);
+/* Remove MMCFG regions from a domain ->iomem_caps. */
+int vpci_mmcfg_deny_access(struct domain *d);
 
 #endif /* __ASM_X86_HVM_IO_H__ */
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 8b1e0596b8..67f025c1ec 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -320,6 +320,26 @@ static int __hwdom_init cf_check map_subtract(unsigned long s, unsigned long e,
     return rangeset_remove_range(map, s, e);
 }
 
+struct handle_iomemcap {
+    struct rangeset *r;
+    unsigned long last;
+};
+static int __hwdom_init cf_check map_subtract_iomemcap(unsigned long s,
+                                                       unsigned long e,
+                                                       void *data)
+{
+    struct handle_iomemcap *h = data;
+    int rc = 0;
+
+    if ( h->last != s )
+        rc = rangeset_remove_range(h->r, h->last, s - 1);
+
+    ASSERT(e < ~0UL);
+    h->last = e + 1;
+
+    return rc;
+}
+
 struct map_data {
     struct domain *d;
     unsigned int flush_flags;
@@ -400,6 +420,7 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
     unsigned int i;
     struct rangeset *map;
     struct map_data map_data = { .d = d };
+    struct handle_iomemcap iomem = {};
     int rc;
 
     BUG_ON(!is_hardware_domain(d));
@@ -442,14 +463,6 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
 
         switch ( entry.type )
         {
-        case E820_UNUSABLE:
-            /* Only relevant for inclusive mode, otherwise this is a no-op. */
-            rc = rangeset_remove_range(map, PFN_DOWN(entry.addr),
-                                       PFN_DOWN(entry.addr + entry.size - 1));
-            if ( rc )
-                panic("IOMMU failed to remove unusable memory: %d\n", rc);
-            continue;
-
         case E820_RESERVED:
             if ( !iommu_hwdom_inclusive && !iommu_hwdom_reserved )
                 continue;
@@ -475,22 +488,13 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
     if ( rc )
         panic("IOMMU failed to remove Xen ranges: %d\n", rc);
 
-    /* Remove any overlap with the Interrupt Address Range. */
-    rc = rangeset_remove_range(map, 0xfee00, 0xfeeff);
+    iomem.r = map;
+    rc = rangeset_report_ranges(d->iomem_caps, 0, ~0UL, map_subtract_iomemcap,
+                                &iomem);
+    if ( !rc && iomem.last < ~0UL )
+        rc = rangeset_remove_range(map, iomem.last, ~0UL);
     if ( rc )
-        panic("IOMMU failed to remove Interrupt Address Range: %d\n", rc);
-
-    /* If emulating IO-APIC(s) make sure the base address is unmapped. */
-    if ( has_vioapic(d) )
-    {
-        for ( i = 0; i < d->arch.hvm.nr_vioapics; i++ )
-        {
-            rc = rangeset_remove_singleton(map,
-                PFN_DOWN(domain_vioapic(d, i)->base_address));
-            if ( rc )
-                panic("IOMMU failed to remove IO-APIC: %d\n", rc);
-        }
-    }
+        panic("IOMMU failed to remove forbidden regions: %d\n", rc);
 
     if ( is_pv_domain(d) )
     {
@@ -506,23 +510,6 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
             panic("IOMMU failed to remove read-only regions: %d\n", rc);
     }
 
-    if ( has_vpci(d) )
-    {
-        /*
-         * TODO: runtime added MMCFG regions are not checked to make sure they
-         * don't overlap with already mapped regions, thus preventing trapping.
-         */
-        rc = vpci_subtract_mmcfg(d, map);
-        if ( rc )
-            panic("IOMMU unable to remove MMCFG areas: %d\n", rc);
-    }
-
-    /* Remove any regions past the last address addressable by the domain. */
-    rc = rangeset_remove_range(map, PFN_DOWN(1UL << domain_max_paddr_bits(d)),
-                               ~0UL);
-    if ( rc )
-        panic("IOMMU unable to remove unaddressable ranges: %d\n", rc);
-
     if ( iommu_verbose )
         printk(XENLOG_INFO "%pd: identity mappings for IOMMU:\n", d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:11:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922132.1326009 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGck-0004kx-BF; Thu, 20 Mar 2025 14:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922132.1326009; Thu, 20 Mar 2025 14:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGck-0004kp-8j; Thu, 20 Mar 2025 14:11:54 +0000
Received: by outflank-mailman (input) for mailman id 922132;
 Thu, 20 Mar 2025 14:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGci-0004kc-KT
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGci-00F18d-2i
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGci-00A8DY-1r
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PmUrDGfhT/vuUHPSFzcZTVgeWUQHCyYw1wHLHGOK9eI=; b=Hvy+RZ9nAm67xrYDpEKZ0IiNzz
	cFYPtZOy+Bc1jc+cVgEcwFozIGiNURQhIsRCZKJA1jPp3Hx9qC1VMsMRxSetL1L5Y/Jl4NJCwyjrw
	F4fyy2apd2jF+9MFOfILToIU3P28k1DLxbDB0di01iFSLhCx8EPpqo6dvLMFRa0Qh1dw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/dom0: be less restrictive with the Interrupt Address Range
Message-Id: <E1tvGci-00A8DY-1r@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:11:52 +0000

commit bc3006b9fe2cd5c266d9811af4cd74e4e8e27937
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:49:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:49:57 2025 +0100

    x86/dom0: be less restrictive with the Interrupt Address Range
    
    Xen currently prevents dom0 from creating CPU or IOMMU page-table mappings
    into the interrupt address range [0xfee00000, 0xfeefffff].  This range has
    two different purposes.  For accesses from the CPU is contains the default
    position of local APIC page at 0xfee00000.  For accesses from devices
    it's the MSI address range, so the address field in the MSI entries
    (usually) point to an address on that range to trigger an interrupt.
    
    There are reports of Lenovo Thinkpad devices placing what seems to be the
    UCSI shared mailbox at address 0xfeec2000 in the interrupt address range.
    Attempting to use that device with a Linux PV dom0 leads to an error when
    Linux kernel maps 0xfeec2000:
    
    RIP: e030:xen_mc_flush+0x1e8/0x2b0
     xen_leave_lazy_mmu+0x15/0x60
     vmap_range_noflush+0x408/0x6f0
     __ioremap_caller+0x20d/0x350
     acpi_os_map_iomem+0x1a3/0x1c0
     acpi_ex_system_memory_space_handler+0x229/0x3f0
     acpi_ev_address_space_dispatch+0x17e/0x4c0
     acpi_ex_access_region+0x28a/0x510
     acpi_ex_field_datum_io+0x95/0x5c0
     acpi_ex_extract_from_field+0x36b/0x4e0
     acpi_ex_read_data_from_field+0xcb/0x430
     acpi_ex_resolve_node_to_value+0x2e0/0x530
     acpi_ex_resolve_to_value+0x1e7/0x550
     acpi_ds_evaluate_name_path+0x107/0x170
     acpi_ds_exec_end_op+0x392/0x860
     acpi_ps_parse_loop+0x268/0xa30
     acpi_ps_parse_aml+0x221/0x5e0
     acpi_ps_execute_method+0x171/0x3e0
     acpi_ns_evaluate+0x174/0x5d0
     acpi_evaluate_object+0x167/0x440
     acpi_evaluate_dsm+0xb6/0x130
     ucsi_acpi_dsm+0x53/0x80
     ucsi_acpi_read+0x2e/0x60
     ucsi_register+0x24/0xa0
     ucsi_acpi_probe+0x162/0x1e3
     platform_probe+0x48/0x90
     really_probe+0xde/0x340
     __driver_probe_device+0x78/0x110
     driver_probe_device+0x1f/0x90
     __driver_attach+0xd2/0x1c0
     bus_for_each_dev+0x77/0xc0
     bus_add_driver+0x112/0x1f0
     driver_register+0x72/0xd0
     do_one_initcall+0x48/0x300
     do_init_module+0x60/0x220
     __do_sys_init_module+0x17f/0x1b0
     do_syscall_64+0x82/0x170
    
    Remove the restrictions to create mappings in the interrupt address range
    for dom0.  Note that the restriction to map the local APIC page is enforced
    separately, and that continues to be present.  Additionally make sure the
    emulated local APIC page is also not mapped, in case dom0 is using it.
    
    Note that even if the interrupt address range entries are populated in the
    IOMMU page-tables no device access will reach those pages.  Device accesses
    to the Interrupt Address Range will always be converted into Interrupt
    Messages and are not subject to DMA remapping.
    
    There's also the following restriction noted in Intel VT-d:
    
    > Software must not program paging-structure entries to remap any address to
    > the interrupt address range. Untranslated requests and translation requests
    > that result in an address in the interrupt range will be blocked with
    > condition code LGN.4 or SGN.8. Translated requests with an address in the
    > interrupt address range are treated as Unsupported Request (UR).
    
    Similarly for AMD-Vi:
    
    > Accesses to the interrupt address range (Table 3) are defined to go through
    > the interrupt remapping portion of the IOMMU and not through address
    > translation processing. Therefore, when a transaction is being processed as
    > an interrupt remapping operation, the transaction attribute of
    > pretranslated or untranslated is ignored.
    >
    > Software Note: The IOMMU should
    > not be configured such that an address translation results in a special
    > address such as the interrupt address range.
    
    However those restrictions don't apply to the identity mappings possibly
    created for dom0, since the interrupt address range is never subject to DMA
    remapping, and hence there's no output address after translation that
    belongs to the interrupt address range.
    
    Reported-by: Jürgen Groß <jgross@suse.com>
    Link: https://lore.kernel.org/xen-devel/baade0a7-e204-4743-bda1-282df74e5f89@suse.com/
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 381caa38850771ae218eb6f6d490dc02e40df964
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index a735e3650c..8191d90a22 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -554,6 +554,13 @@ int __init dom0_setup_permissions(struct domain *d)
         mfn = paddr_to_pfn(mp_lapic_addr);
         rc |= iomem_deny_access(d, mfn, mfn);
     }
+    /* If using an emulated local APIC make sure its MMIO is unpopulated. */
+    if ( has_vlapic(d) )
+    {
+        /* Xen doesn't allow changing the local APIC MMIO window position. */
+        mfn = paddr_to_pfn(APIC_DEFAULT_PHYS_BASE);
+        rc |= iomem_deny_access(d, mfn, mfn);
+    }
     /* I/O APICs. */
     for ( i = 0; i < nr_ioapics; i++ )
     {
@@ -563,10 +570,6 @@ int __init dom0_setup_permissions(struct domain *d)
              !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
-    /* MSI range. */
-    rc |= iomem_deny_access(d, paddr_to_pfn(MSI_ADDR_BASE_LO),
-                            paddr_to_pfn(MSI_ADDR_BASE_LO +
-                                         MSI_ADDR_DEST_ID_MASK));
     /* HyperTransport range. */
     if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:12:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922133.1326013 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGcu-0004nO-D6; Thu, 20 Mar 2025 14:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922133.1326013; Thu, 20 Mar 2025 14:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGcu-0004nG-A6; Thu, 20 Mar 2025 14:12:04 +0000
Received: by outflank-mailman (input) for mailman id 922133;
 Thu, 20 Mar 2025 14:12:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGcs-0004my-PQ
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGcs-00F190-32
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGcs-00A8T5-28
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wKHcf0PIBnukksNaVT0nmhVLeGuQR58HUO1lOMxUzms=; b=vElmqSjykfCm9yoNc9M8+ND0J1
	6sx1YQKASyw8S8/7q/ZjnUYfDxwV9qbMkIyryqVxtcC+x4Oeuvku4HW0hXyO6mygt0LA+mV8C6LYz
	lSQxB+Oex7X1Bu2KZh521xEm/iM/JbS3umZayjdlD85TTnR7u0rB6w/e+WgXO6arLb9o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] tools/xl: fix channel configuration setting
Message-Id: <E1tvGcs-00A8T5-28@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:12:02 +0000

commit 70038e8c098ffa20b65e4e32faee9a138e176aa6
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 20 12:50:24 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:50:24 2025 +0100

    tools/xl: fix channel configuration setting
    
    Channels work differently than other device types: their devid should
    be -1 initially in order to distinguish them from the primary console
    which has the devid of 0.
    
    So when parsing the channel configuration, use
    ARRAY_EXTEND_INIT_NODEVID() in order to avoid overwriting the devid
    set by libxl_device_channel_init().
    
    Fixes: 3a6679634766 ("libxl: set channel devid when not provided by application")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: e1ccced4afe465d6541c5825a0f8d1b8f5fa4253
    master date: 2025-03-05 16:37:37 +0100
---
 tools/xl/xl_parse.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 3d85be7dd4..089a88935a 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2423,8 +2423,9 @@ void parse_config_data(const char *config_source,
             char *path = NULL;
             int len;
 
-            chn = ARRAY_EXTEND_INIT(d_config->channels, d_config->num_channels,
-                                   libxl_device_channel_init);
+            chn = ARRAY_EXTEND_INIT_NODEVID(d_config->channels,
+                                            d_config->num_channels,
+                                            libxl_device_channel_init);
 
             split_string_into_string_list(buf, ",", &pairs);
             len = libxl_string_list_length(&pairs);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:12:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922134.1326018 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGd4-0004q3-Ew; Thu, 20 Mar 2025 14:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922134.1326018; Thu, 20 Mar 2025 14:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGd4-0004pv-Bb; Thu, 20 Mar 2025 14:12:14 +0000
Received: by outflank-mailman (input) for mailman id 922134;
 Thu, 20 Mar 2025 14:12:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGd2-0004pn-Qa
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:12:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGd3-00F196-05
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGd2-00A8gL-2S
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Lf9CYTriPaTSozYA8ZixO5935XnoT64XlGFZgCQVL18=; b=jZ22odCcSb3YvJFzuA+TLCHa+G
	xq4saQ+Ya92nW2jy8kazMl/8oFgzMdP9M5TE4YiHDylg9Rc87zwowH/905wXjkqI3WIUNU7o4iJUG
	qLdjzzq6XsQujukbYwFP8Cjk6RTZbXGyS9LTdncw5LYTwBIVX5wCCtoGNkSj0bNmTfC4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/vlapic: Fix handling of writes to APIC_ESR
Message-Id: <E1tvGd2-00A8gL-2S@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:12:12 +0000

commit 4a480e7a143b04b160f7b1b287d17aa69b07362f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 12:50:38 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:50:38 2025 +0100

    x86/vlapic: Fix handling of writes to APIC_ESR
    
    Xen currently presents APIC_ESR to guests as a simple read/write register.
    
    This is incorrect.  The SDM states:
    
      The ESR is a write/read register. Before attempt to read from the ESR,
      software should first write to it. (The value written does not affect the
      values read subsequently; only zero may be written in x2APIC mode.) This
      write clears any previously logged errors and updates the ESR with any
      errors detected since the last write to the ESR.
    
    Introduce a new pending_esr field in hvm_hw_lapic.
    
    Update vlapic_error() to accumulate errors here, and extend vlapic_reg_write()
    to discard the written value and transfer pending_esr into APIC_ESR.  Reads
    are still as before.
    
    Importantly, this means that guests no longer destroys the ESR value it's
    looking for in the LVTERR handler when following the SDM instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b28b590d4a23894672f1dd7fb98cdf9926ecb282
    master date: 2025-03-07 14:34:08 +0000
---
 xen/arch/x86/hvm/vlapic.c              | 17 +++++++++++++++--
 xen/include/public/arch-x86/hvm/save.h |  1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 3363926b48..98394ed26a 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -108,7 +108,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     uint32_t esr;
 
     spin_lock_irqsave(&vlapic->esr_lock, flags);
-    esr = vlapic_get_reg(vlapic, APIC_ESR);
+    esr = vlapic->hw.pending_esr;
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
@@ -127,7 +127,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
                  errmask |= APIC_ESR_RECVILL;
         }
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+        vlapic->hw.pending_esr |= errmask;
 
         if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
@@ -802,6 +802,19 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         vlapic_set_reg(vlapic, APIC_ID, val);
         break;
 
+    case APIC_ESR:
+    {
+        unsigned long flags;
+
+        spin_lock_irqsave(&vlapic->esr_lock, flags);
+        val = vlapic->hw.pending_esr;
+        vlapic->hw.pending_esr = 0;
+        spin_unlock_irqrestore(&vlapic->esr_lock, flags);
+
+        vlapic_set_reg(vlapic, APIC_ESR, val);
+        break;
+    }
+
     case APIC_TASKPRI:
         vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff);
         break;
diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h
index 7ecacadde1..9c4bfc7ebd 100644
--- a/xen/include/public/arch-x86/hvm/save.h
+++ b/xen/include/public/arch-x86/hvm/save.h
@@ -394,6 +394,7 @@ struct hvm_hw_lapic {
     uint32_t             disabled; /* VLAPIC_xx_DISABLED */
     uint32_t             timer_divisor;
     uint64_t             tdt_msr;
+    uint32_t             pending_esr;
 };
 
 DECLARE_HVM_SAVE_TYPE(LAPIC, 5, struct hvm_hw_lapic);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:12:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922135.1326021 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGdE-0004sO-Fi; Thu, 20 Mar 2025 14:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922135.1326021; Thu, 20 Mar 2025 14:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGdE-0004sG-D8; Thu, 20 Mar 2025 14:12:24 +0000
Received: by outflank-mailman (input) for mailman id 922135;
 Thu, 20 Mar 2025 14:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGdC-0004s4-Uz
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:12:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGdD-00F1A2-0L
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGdC-00A8zG-2j
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:12:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GWxFySgyN8UwJRu38ZCwFLlICdM0cyaMf1mA1xzViMc=; b=dCy1CXUT68q+tEQmgbBzhM9L//
	B+FyLGuUyY/9/w+brjWdrSJR/ItXueDeAPYO/xFnuMwA+aWHxZb5ufvNPTFSuxfMjxnhCZV5KlVps
	if1sdpCD3smW40TQjug40xX+8vhP9qr9OfsX+Bz35IeSV/H2dG1D9qUevoOmOrDacE0k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
Message-Id: <E1tvGdC-00A8zG-2j@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:12:22 +0000

commit f581b36608d067ca2571c6677820e666e5bd68a6
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:51:40 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:51:40 2025 +0100

    x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
    
    The MMIO_CONF_BASE reports the base of the MCFG range on AMD systems.
    Linux pre-6.14 is unconditionally attempting to read the MSR without a
    safe MSR accessor, and since Xen doesn't allow access to it Linux reports
    the following error:
    
    unchecked MSR access error: RDMSR from 0xc0010058 at rIP: 0xffffffff8101d19f (xen_do_read_msr+0x7f/0xa0)
    Call Trace:
     xen_read_msr+0x1e/0x30
     amd_get_mmconfig_range+0x2b/0x80
     quirk_amd_mmconfig_area+0x28/0x100
     pnp_fixup_device+0x39/0x50
     __pnp_add_device+0xf/0x150
     pnp_add_device+0x3d/0x100
     pnpacpi_add_device_handler+0x1f9/0x280
     acpi_ns_get_device_callback+0x104/0x1c0
     acpi_ns_walk_namespace+0x1d0/0x260
     acpi_get_devices+0x8a/0xb0
     pnpacpi_init+0x50/0x80
     do_one_initcall+0x46/0x2e0
     kernel_init_freeable+0x1da/0x2f0
     kernel_init+0x16/0x1b0
     ret_from_fork+0x30/0x50
     ret_from_fork_asm+0x1b/0x30
    
    Such access is conditional to the presence of a device with PnP ID
    "PNP0c01", which triggers the execution of the quirk_amd_mmconfig_area()
    function.  Note that prior to commit 3fac3734c43a MSR accesses when running
    as a PV guest would always use the safe variant, and thus silently handle
    the #GP.
    
    Fix by allowing access to the MSR on AMD systems for the hardware domain.
    
    Write attempts to the MSR will still result in #GP for all domain types.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b4071d28c5bd9ca4fed76031cbf0e782b74209b9
    master date: 2025-03-12 13:32:30 +0100
---
 xen/arch/x86/msr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 289cf10b78..3f612ad27c 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -245,6 +245,14 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = 0;
         break;
 
+    case MSR_FAM10H_MMIO_CONF_BASE:
+        if ( !is_hardware_domain(d) ||
+             !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ||
+             rdmsr_safe(msr, *val) )
+            goto gp_fault;
+
+        break;
+
     case MSR_VIRT_SPEC_CTRL:
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:12:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922136.1326025 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGdO-0004un-HF; Thu, 20 Mar 2025 14:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922136.1326025; Thu, 20 Mar 2025 14:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGdO-0004ug-EX; Thu, 20 Mar 2025 14:12:34 +0000
Received: by outflank-mailman (input) for mailman id 922136;
 Thu, 20 Mar 2025 14:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGdM-0004uS-Vm
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:12:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGdN-00F1Cu-0c
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:12:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGdM-00A9Cm-30
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:12:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f/5oECqw6qkM6RgvGWUhL9DdNxn/wkFBkuHUj7a3f/s=; b=g9YGAZ4pAtHecnmMTtdJsUU07a
	1Bnl+2hnSzZ80Xly4yy1gxkg8yNi4cltsqj+D00Ne+4Yx/u9tSFOrvFDbekatd7Cp+iJeVNkaVmdM
	yNS7YN7Fccwzld7HCPAg+TaYE92Tob4Ma5uljuRnnaFBDif2TSZCHJ/wfwOY5ZFXSM0Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/vmx: fix posted interrupts usage of msi_desc->msg field
Message-Id: <E1tvGdM-00A9Cm-30@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:12:32 +0000

commit 74b40fe10582c0375afd3db97626a27094f4c0e5
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:52:00 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:52:00 2025 +0100

    x86/vmx: fix posted interrupts usage of msi_desc->msg field
    
    The current usage of msi_desc->msg in vmx_pi_update_irte() will make the
    field contain a translated MSI message, instead of the expected
    untranslated one.  This breaks dump_msi(), that use the data in
    msi_desc->msg to print the interrupt details.
    
    Fix this by introducing a dummy local msi_msg, and use it with
    iommu_update_ire_from_msi().  vmx_pi_update_irte() relies on the MSI
    message not changing, so there's no need to propagate the resulting msi_msg
    to the hardware, and the contents can be ignored.
    
    Additionally add a comment to clarify that msi_desc->msg must always
    contain the untranslated MSI message.
    
    Fixes: a5e25908d18d ('VT-d: introduce new fields in msi_desc to track binding with guest interrupt')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 30f0e55a79206702b4e82e86dad6b35033157858
    master date: 2025-03-12 13:32:30 +0100
---
 xen/arch/x86/hvm/vmx/vmx.c     | 4 +++-
 xen/arch/x86/include/asm/msi.h | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index eee1d4b47a..1373ef2787 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -396,6 +396,7 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     const struct pi_desc *pi_desc = v ? &v->arch.hvm.vmx.pi_desc : NULL;
     struct irq_desc *desc;
     struct msi_desc *msi_desc;
+    struct msi_msg msg;
     int rc;
 
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -410,12 +411,13 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     }
     msi_desc->pi_desc = pi_desc;
     msi_desc->gvec = gvec;
+    msg = msi_desc->msg;
 
     spin_unlock_irq(&desc->lock);
 
     ASSERT_PDEV_LIST_IS_READ_LOCKED(msi_desc->dev->domain);
 
-    return iommu_update_ire_from_msi(msi_desc, &msi_desc->msg);
+    return iommu_update_ire_from_msi(msi_desc, &msg);
 
  unlock_out:
     spin_unlock_irq(&desc->lock);
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 7f9e531f73..38367e2788 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -124,7 +124,7 @@ struct msi_desc {
     int irq;
     int remap_index;         /* index in interrupt remapping table */
 
-    struct msi_msg msg;      /* Last set MSI message */
+    struct msi_msg msg;      /* Last set MSI message (untranslated) */
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:12:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922137.1326029 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGdY-0004xG-J9; Thu, 20 Mar 2025 14:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922137.1326029; Thu, 20 Mar 2025 14:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGdY-0004x9-GJ; Thu, 20 Mar 2025 14:12:44 +0000
Received: by outflank-mailman (input) for mailman id 922137;
 Thu, 20 Mar 2025 14:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGdX-0004wz-2Y
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGdX-00F1D2-0u
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGdX-00A9UI-01
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yoEBkRpHFcJ5cm9oInLEf734G7KDfjQfNn0Qb5BKSV0=; b=oSi2wezqVXYYWlu0caXTdjVGIE
	19ET0Gdx2vcKsh46aicSPKQWL4J+1TbyFjhU4ftShUEsUaY4M1cGpAyY53cXMXMufrx1IgflTGGLP
	W0U5ePLQq0PUR6dmskqW08ATxE5RogAxaTpAU+8H1rmt5kUlESerxAy2dLdzTZm5LoVI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/hvm: check return code of hvm_pi_update_irte when binding
Message-Id: <E1tvGdX-00A9UI-01@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:12:43 +0000

commit 94928e415f2131bde75c1c4e5fd120a43e2836a3
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:52:32 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:52:32 2025 +0100

    x86/hvm: check return code of hvm_pi_update_irte when binding
    
    Consume the return code from hvm_pi_update_irte(), and propagate the error
    back to the caller if hvm_pi_update_irte() fails.
    
    Fixes: 35a1caf8b6b5 ('pass-through: update IRTE according to guest interrupt config changes')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: cb587f620ab56cc683347d8120ba63989fad2693
    master date: 2025-03-12 13:32:31 +0100
---
 xen/drivers/passthrough/x86/hvm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index f5faff7a49..47de6953fd 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -381,7 +381,15 @@ int pt_irq_create_bind(
 
         /* Use interrupt posting if it is supported. */
         if ( iommu_intpost )
-            hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+        {
+            rc = hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+
+            if ( rc )
+            {
+                pt_irq_destroy_bind(d, pt_irq_bind);
+                return rc;
+            }
+        }
 
         if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:12:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:12:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922139.1326033 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGdi-00050I-LW; Thu, 20 Mar 2025 14:12:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922139.1326033; Thu, 20 Mar 2025 14:12:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGdi-00050A-J2; Thu, 20 Mar 2025 14:12:54 +0000
Received: by outflank-mailman (input) for mailman id 922139;
 Thu, 20 Mar 2025 14:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGdh-0004zw-5D
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGdh-00F1DQ-1A
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGdh-00A9my-0K
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ASXR7p2/GDDudh993Vhq0xcRehGgUROTvWrZCmPreUM=; b=WRCNrzOiu+9zEPlS2K0zBaHdrA
	w+plviJt86wOvbRbUl+b+BPX1WIni5xX1Y4GiTH8kB1eKOv5IQeuHqyxC1zRpl8EgvGJjNaAUoiFz
	ci2hDLVQsIWaTvuJVHCvRGHWTESKzJV65X1l0bXINtN1oqixTjN5pUVwgPJUUsM/aoLo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
Message-Id: <E1tvGdh-00A9my-0K@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:12:53 +0000

commit 1ddf72bbdfa892eb779a550594ab3a1681e50e52
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Thu Mar 20 12:52:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:52:57 2025 +0100

    tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
    
    It is valid for a PCI device to not have a legacy IRQ.  In that case, do
    not print an error to keep the logs clean.
    
    This relies on pciback being updated to return -ENOENT for a missing
    GSI.
    
    Fixes: b93e5981d258 ("tools: Add new function to get gsi from dev")
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 8808f45305d146d05469ed4551bb5ccf931b1800
    master date: 2025-03-13 10:23:42 +0100
---
 tools/libs/ctrl/xc_linux.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/libs/ctrl/xc_linux.c b/tools/libs/ctrl/xc_linux.c
index 92591e49a1..2b2d7b3196 100644
--- a/tools/libs/ctrl/xc_linux.c
+++ b/tools/libs/ctrl/xc_linux.c
@@ -77,9 +77,14 @@ int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
     ret = ioctl(xencall_fd(xch->xcall),
                 IOCTL_PRIVCMD_PCIDEV_GET_GSI, &dev_gsi);
 
-    if (ret < 0) {
-        PERROR("Failed to get gsi from dev");
-    } else {
+    if ( ret < 0 )
+    {
+        if ( errno != ENOENT )
+            PERROR("Failed to get gsi for dev %04x:%02x:%02x.%u",
+                sbdf >> 16, (sbdf >> 8) & 0xff, sbdf >> 3 & 0x1f, sbdf & 0x7);
+    }
+    else
+    {
         ret = dev_gsi.gsi;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:13:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:13:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922140.1326037 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGds-00052n-NA; Thu, 20 Mar 2025 14:13:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922140.1326037; Thu, 20 Mar 2025 14:13:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGds-00052f-KP; Thu, 20 Mar 2025 14:13:04 +0000
Received: by outflank-mailman (input) for mailman id 922140;
 Thu, 20 Mar 2025 14:13:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGdr-00052M-7g
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:13:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGdr-00F1Di-1Q
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGdr-00AA14-0a
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JSe2kobgyRJSE/2aq6r5mafN3YEG2rVFD1NVHzYh1Eo=; b=f5Ik518BrH8ZEmpZYMFXecMJ22
	tsIobNYJSiK7ECfuFIEL7NL/Is1WjKeFe6yDAB/4cfKe0IWggJfgt5eV43y5JcSRmwD0EyOr2WOxJ
	9uU9Vmfwt4mUZXWiii+vRz7bLfr8XXRnYOBoJTpXaU4ijtUSU6BU+q8zTrVDWwMUo5x8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] tools/libxl: Skip missing PCI GSIs
Message-Id: <E1tvGdr-00AA14-0a@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:13:03 +0000

commit f2ddbeb9dd1de651e5065a0f0ec6ef8ca39e12e2
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Thu Mar 20 12:53:13 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:53:13 2025 +0100

    tools/libxl: Skip missing PCI GSIs
    
    A PCI device may not have a legacy IRQ.  In that case, we don't need to
    do anything, so don't fail in libxl__arch_hvm_map_gsi() and
    libxl__arch_hvm_unmap_gsi().
    
    Requires an updated pciback to return -ENOENT.
    
    Fixes: f97f885c7198 ("tools: Add new function to do PIRQ (un)map on PVH dom0")
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: d3ac8fdce26476d148fb2a8f18c7e5b0c153be0a
    master date: 2025-03-13 10:23:52 +0100
---
 tools/libs/light/libxl_x86.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index a3164a3077..0a7f64ad46 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -901,7 +901,10 @@ int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
     int pirq = -1, gsi, r;
 
     gsi = xc_pcidev_get_gsi(CTX->xch, sbdf);
-    if (gsi < 0) {
+    if (gsi < 0 && errno == ENOENT) {
+        LOGD(DEBUG, domid, "xc_pcidev_get_gsi no gsi");
+        return 0;
+    } else if (gsi < 0) {
         return ERROR_FAIL;
     }
 
@@ -925,7 +928,10 @@ int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
     int pirq = -1, gsi, r;
 
     gsi = xc_pcidev_get_gsi(CTX->xch, sbdf);
-    if (gsi < 0) {
+    if (gsi < 0 && errno == ENOENT) {
+        LOGD(DEBUG, domid, "xc_pcidev_get_gsi no gsi");
+        return 0;
+    } else if (gsi < 0) {
         return ERROR_FAIL;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:13:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:13:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922141.1326041 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGe2-00055M-OM; Thu, 20 Mar 2025 14:13:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922141.1326041; Thu, 20 Mar 2025 14:13:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGe2-00055E-Lr; Thu, 20 Mar 2025 14:13:14 +0000
Received: by outflank-mailman (input) for mailman id 922141;
 Thu, 20 Mar 2025 14:13:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGe1-00054y-AJ
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:13:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGe1-00F1Dn-1h
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGe1-00AAFf-0q
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:13:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8m1GcohPYh0vZBTBReUtS9YoVC28zMHxojuguYZSnGM=; b=HpIoaJ+XBwF3/7p11Ic52DW00w
	szcYBBHgPngXPoUxJKX0F2zXVjqzeH0lhh5uNQbPYZj0K/AkoAhhO/5sy7j3a16+qxxcg8hTQXMdN
	yqPEwVvNoUPje5w1TH/A7y4hHjlgc3nPymKYTscnSpLLcjSs3qc4GCIUCDIyuhDQKDJc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] xen/sched: fix arinc653 to not use variables across cpupools
Message-Id: <E1tvGe1-00AAFf-0q@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:13:13 +0000

commit 80cbb296127b6c1729f4625498b27cdb41bb614b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 20 12:53:29 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:53:29 2025 +0100

    xen/sched: fix arinc653 to not use variables across cpupools
    
    a653sched_do_schedule() is using two function local static variables,
    which is resulting in bad behavior when using more than one cpupool
    with the arinc653 scheduler.
    
    Fix that by moving those variables to the scheduler private data.
    
    Fixes: 22787f2e107c ("ARINC 653 scheduler")
    Reported-by: Choi Anderson <Anderson.Choi@boeing.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
    master commit: d0561ac8ab0e780b1e8ab41d0d15e9f9b076dee3
    master date: 2025-03-14 10:17:11 +0100
---
 xen/common/sched/arinc653.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index a82c0d7314..9ebae6d7ae 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -143,6 +143,12 @@ typedef struct a653sched_priv_s
      * pointers to all Xen UNIT structures for iterating through
      */
     struct list_head unit_list;
+
+    /**
+     * scheduling house keeping variables
+     */
+    unsigned int sched_index;
+    s_time_t next_switch_time;
 } a653sched_priv_t;
 
 /**************************************************************************
@@ -513,8 +519,6 @@ a653sched_do_schedule(
     bool tasklet_work_scheduled)
 {
     struct sched_unit *new_task = NULL;
-    static unsigned int sched_index = 0;
-    static s_time_t next_switch_time;
     a653sched_priv_t *sched_priv = SCHED_PRIV(ops);
     const unsigned int cpu = sched_get_resource_cpu(smp_processor_id());
     unsigned long flags;
@@ -528,18 +532,19 @@ a653sched_do_schedule(
         /* time to enter a new major frame
          * the first time this function is called, this will be true */
         /* start with the first domain in the schedule */
-        sched_index = 0;
+        sched_priv->sched_index = 0;
         sched_priv->next_major_frame = now + sched_priv->major_frame;
-        next_switch_time = now + sched_priv->schedule[0].runtime;
+        sched_priv->next_switch_time = now + sched_priv->schedule[0].runtime;
     }
     else
     {
-        while ( (now >= next_switch_time)
-                && (sched_index < sched_priv->num_schedule_entries) )
+        while ( (now >= sched_priv->next_switch_time) &&
+                (sched_priv->sched_index < sched_priv->num_schedule_entries) )
         {
             /* time to switch to the next domain in this major frame */
-            sched_index++;
-            next_switch_time += sched_priv->schedule[sched_index].runtime;
+            sched_priv->sched_index++;
+            sched_priv->next_switch_time +=
+                sched_priv->schedule[sched_priv->sched_index].runtime;
         }
     }
 
@@ -547,8 +552,8 @@ a653sched_do_schedule(
      * If we exhausted the domains in the schedule and still have time left
      * in the major frame then switch next at the next major frame.
      */
-    if ( sched_index >= sched_priv->num_schedule_entries )
-        next_switch_time = sched_priv->next_major_frame;
+    if ( sched_priv->sched_index >= sched_priv->num_schedule_entries )
+        sched_priv->next_switch_time = sched_priv->next_major_frame;
 
     /*
      * If there are more domains to run in the current major frame, set
@@ -556,8 +561,8 @@ a653sched_do_schedule(
      * Otherwise, set new_task equal to the address of the idle task's
      * sched_unit structure.
      */
-    new_task = (sched_index < sched_priv->num_schedule_entries)
-        ? sched_priv->schedule[sched_index].unit
+    new_task = (sched_priv->sched_index < sched_priv->num_schedule_entries)
+        ? sched_priv->schedule[sched_priv->sched_index].unit
         : IDLETASK(cpu);
 
     /* Check to see if the new task can be run (awake & runnable). */
@@ -589,7 +594,7 @@ a653sched_do_schedule(
      * Return the amount of time the next domain has to run and the address
      * of the selected task's UNIT structure.
      */
-    prev->next_time = next_switch_time - now;
+    prev->next_time = sched_priv->next_switch_time - now;
     prev->next_task = new_task;
     new_task->migrated = false;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:13:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:13:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922142.1326045 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGeC-00057p-Pl; Thu, 20 Mar 2025 14:13:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922142.1326045; Thu, 20 Mar 2025 14:13:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGeC-00057h-NH; Thu, 20 Mar 2025 14:13:24 +0000
Received: by outflank-mailman (input) for mailman id 922142;
 Thu, 20 Mar 2025 14:13:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGeB-00057Y-Ci
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:13:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGeB-00F1Dt-1w
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGeB-00AAUb-16
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:13:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5yrUnV1oTVbPBgzXnG+1CO0px7cM7oOd+P5jMQAenFo=; b=KHlnNqoLi/dhQcfJDxOuJOQ6hd
	Yr4/zTsXHpzHbxFDqOodzpbcMBlJU9LxtKKb55GX/0zo17LhnMlr/B9darGxUUs7zoG1eu/MzNgEA
	E7JyKqQejdOrl5fGq2bTsAAYxdflocR6PhOz4Krg3X7xgAWeSlRJgpmFB/VhT/EMQM90=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] libxl: avoid infinite loop in libxl__remove_directory()
Message-Id: <E1tvGeB-00AAUb-16@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:13:23 +0000

commit b29984df38c8d8a2df51eeea23927c8b9281c8c8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 20 12:53:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:53:51 2025 +0100

    libxl: avoid infinite loop in libxl__remove_directory()
    
    Infinitely retrying the rmdir() invocation makes little sense. While the
    original observation was the log filling the disk (due to repeated
    "Directory not empty" errors, in turn occurring for unclear reasons),
    the loop wants breaking even if there was no error message being logged
    (much like is done in the similar loops in libxl__remove_file() and
    libxl__remove_file_or_directory()).
    
    Fixes: c4dcbee67e6d ("libxl: provide libxl__remove_file et al")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 68baeb5c4852e652b9599e049f40477edac4060e
    master date: 2025-03-13 10:23:10 +0100
---
 tools/libs/light/libxl_utils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_utils.c b/tools/libs/light/libxl_utils.c
index 506c5b5631..5ae8935344 100644
--- a/tools/libs/light/libxl_utils.c
+++ b/tools/libs/light/libxl_utils.c
@@ -577,6 +577,7 @@ int libxl__remove_directory(libxl__gc *gc, const char *dirpath)
         if (errno == EINTR) continue;
         LOGE(ERROR, "failed to remove emptied directory %s", dirpath);
         rc = ERROR_FAIL;
+        break;
     }
 
  out:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:13:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:13:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922143.1326049 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGeM-0005AG-Rg; Thu, 20 Mar 2025 14:13:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922143.1326049; Thu, 20 Mar 2025 14:13:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGeM-0005A8-Od; Thu, 20 Mar 2025 14:13:34 +0000
Received: by outflank-mailman (input) for mailman id 922143;
 Thu, 20 Mar 2025 14:13:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGeL-00059s-Fa
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:13:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGeL-00F1Dy-2E
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:13:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGeL-00AAmO-1O
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:13:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VrNIpdDrhKZskfouujgwS6kdRqQgx5va2KeaEXrUkAg=; b=N9r0+xmO2/22p2g90tt0jsNWjK
	HD1t/cgxX13LDtpmKr5IA8nOIPbMGig6NkR7ypg1NGZwN7pT6ZkdwCAlYaUyl/fEH4TgSW1w7PLzD
	qnwc/NQBjj/zQLvX2QGOYqS+qnhrwi8Qn8oSPLD86Ky304YfsBflsg6sRSOgKBuIMBCQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/ioremap: prevent additions against the NULL pointer
Message-Id: <E1tvGeL-00AAmO-1O@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:13:33 +0000

commit 408935872ae7a5348e954b2e6b713b32e652ca08
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 12:54:16 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:54:16 2025 +0100

    x86/ioremap: prevent additions against the NULL pointer
    
    This was reported by clang UBSAN as:
    
    UBSAN: Undefined behaviour in arch/x86/mm.c:6297:40
    applying zero offset to null pointer
    [...]
    Xen call trace:
        [<ffff82d040303662>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304aa3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0406ebbc0>] F ioremap_wc+0xc8/0xe0
        [<ffff82d0406c3728>] F video_init+0xd0/0x180
        [<ffff82d0406ab6f5>] F console_init_preirq+0x3d/0x220
        [<ffff82d0406f1876>] F __start_xen+0x68e/0x5530
        [<ffff82d04020482e>] F __high_start+0x8e/0x90
    
    Fix bt_ioremap() and ioremap{,_wc}() to not add the offset if the returned
    pointer from __vmap() is NULL.
    
    Fixes: d0d4635d034f ('implement vmap()')
    Fixes: f390941a92f1 ('x86/DMI: fix table mapping when one lives above 1Mb')
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9a6f2c52f75781acda39fab5cc96d1bcc54bf534
    master date: 2025-03-17 13:33:29 +0100
---
 xen/arch/x86/dmi_scan.c | 7 +++++--
 xen/arch/x86/mm.c       | 6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 2fcc485295..eb65bc86bb 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -112,6 +112,7 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
 {
     mfn_t mfn = _mfn(PFN_DOWN(addr));
     unsigned int offs = PAGE_OFFSET(addr);
+    void *va;
 
     if ( addr + len <= MB(1) )
         return __va(addr);
@@ -119,8 +120,10 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
     if ( system_state < SYS_STATE_boot )
         return __acpi_map_table(addr, len);
 
-    return __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
-                  VMAP_DEFAULT) + offs;
+    va = __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
+                VMAP_DEFAULT);
+
+    return va ? va + offs : NULL;
 }
 
 static void __init bt_iounmap(const void *ptr, unsigned int len)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index fa21903eb2..83bca4e7c1 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -6274,7 +6274,9 @@ void __iomem *ioremap(paddr_t pa, size_t len)
         unsigned int offs = pa & (PAGE_SIZE - 1);
         unsigned int nr = PFN_UP(offs + len);
 
-        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT) + offs;
+        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT);
+        if ( va )
+            va += offs;
     }
 
     return (void __force __iomem *)va;
@@ -6291,7 +6293,7 @@ void __iomem *__init ioremap_wc(paddr_t pa, size_t len)
 
     va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_WC, VMAP_DEFAULT);
 
-    return (void __force __iomem *)(va + offs);
+    return (void __force __iomem *)(va ? va + offs : NULL);
 }
 
 int create_perdomain_mapping(struct domain *d, unsigned long va,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:13:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:13:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922144.1326053 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGeV-0005E7-Se; Thu, 20 Mar 2025 14:13:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922144.1326053; Thu, 20 Mar 2025 14:13:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGeV-0005Dz-Pv; Thu, 20 Mar 2025 14:13:43 +0000
Received: by outflank-mailman (input) for mailman id 922144;
 Thu, 20 Mar 2025 14:13:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGeV-0005Dt-JY
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:13:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGeV-00F1E4-2c
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:13:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGeV-00AB7t-1g
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:13:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Blj++HVLMFk4ggbzJRLsfjMm/REW6eHsjZ6id3SXBdw=; b=0KEVnDBPCqNFUnYhREKPs+qh/f
	WE8Qdpr0QS0+rAJ2lIDzr8Uq6DxXFcDrv/21hzpb0KoUpr+leDMM0HkKf+fXXr1CTCQCzk1o1bPx5
	zFwJhfarQuuO7egeDR9CVzPHC7vEtARSm52jHkIhDsrGynzPPj5xvz3N+D6BYIHD0ut0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
Message-Id: <E1tvGeV-00AB7t-1g@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:13:43 +0000

commit 97f064d9ab7d45ab0184736298f8e89386314261
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 12:54:53 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:54:53 2025 +0100

    x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
    
    The current CI failures turn out to be a latent bug triggered by a narrow set
    of properties of the initrd and the host memory map, which CI encountered by
    chance.
    
    One step during boot involves constructing directmap mappings for modules.
    With some probing at the point of creation, it is observed that there's a 4k
    mapping missing towards the end of the initrd.
    
      (XEN) === Mapped Mod1 [0000000394001000, 00000003be1ff6dc] to Directmap
      (XEN) Probing paddr 394001000, va ffff830394001000
      (XEN) Probing paddr 3be1ff6db, va ffff8303be1ff6db
      (XEN) Probing paddr 3bdffffff, va ffff8303bdffffff
      (XEN) Probing paddr 3be001000, va ffff8303be001000
      (XEN) Probing paddr 3be000000, va ffff8303be000000
      (XEN) Early fatal page fault at e008:ffff82d04032014c (cr2=ffff8303be000000, ec=0000)
    
    The conditions for this bug appear to be map_pages_to_xen() call with a start
    address of exactly 4k beyond a 2M boundary, some number of full 2M pages, then
    a tail needing 4k pages.
    
    Anyway, the condition for spotting superpage boundaries in map_pages_to_xen()
    is wrong.  The IS_ALIGNED() macro expects a power of two for the alignment
    argument, and subtracts 1 itself.
    
    Fixing this causes the failing case to now boot.
    
    Fixes: 97fb6fcf26e8 ("x86/mm: introduce helpers to detect super page alignment")
    Debugged-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b07c7d63f9b587e4df5d71f6da9eaa433512c974
    master date: 2025-03-19 14:53:28 +0000
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 83bca4e7c1..e6a61520d5 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5502,7 +5502,7 @@ int map_pages_to_xen(
                                                                 \
     ASSERT(!mfn_eq(m_, INVALID_MFN));                           \
     IS_ALIGNED(PFN_DOWN(v) | mfn_x(m_),                         \
-               (1UL << (PAGETABLE_ORDER * ((n) - 1))) - 1);     \
+               1UL << (PAGETABLE_ORDER * ((n) - 1)));           \
 })
 #define IS_L2E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 2)
 #define IS_L3E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 3)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:13:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:13:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922145.1326056 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGeg-0005Ga-Tt; Thu, 20 Mar 2025 14:13:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922145.1326056; Thu, 20 Mar 2025 14:13:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGeg-0005GS-RQ; Thu, 20 Mar 2025 14:13:54 +0000
Received: by outflank-mailman (input) for mailman id 922145;
 Thu, 20 Mar 2025 14:13:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGef-0005GE-Mp
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:13:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGef-00F1EU-2w
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:13:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGef-00ABQb-22
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:13:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wCEjKbhOMbzHPBSvOR9VlpBU8iFvVFICxFij6J0g5F4=; b=x8HvJMNMcBGVfH/zNpf+TcjaqJ
	6Cdn4C/eF9jb+QWGUV+gF1r5XtjgObmGbY5FXBp4ho13f2Z8PrtkT0lvrzRg64PFLEd6bcDxU0VMU
	umdRErfQrrjnkn/BQBorRbtBxE2n9zU9lthCdi5JOo0rzApvoME5mWtbZnE/izvBeVIE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] xen/arinc653: call xfree() with local IRQ enabled
Message-Id: <E1tvGef-00ABQb-22@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:13:53 +0000

commit c1badde6011ca8b626d64ccc61ce33f062468cb3
Author:     Anderson Choi <anderson.choi@boeing.com>
AuthorDate: Thu Mar 20 12:55:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:55:12 2025 +0100

    xen/arinc653: call xfree() with local IRQ enabled
    
    xen panic is observed with the following configuration.
    
    1. Debug xen build (CONFIG_DEBUG=y)
    2. dom1 of an ARINC653 domain
    3. shutdown dom1 with xl command
    
    $ xl shutdown <domain_name>
    
    (XEN) ****************************************
    (XEN) Panic on CPU 2:
    (XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/xmalloc_tlsf.c:714
    (XEN) ****************************************
    
    panic was triggered since xfree() was called with local IRQ disabled and
    therefore assertion failed.
    
    Fix this by calling xfree() after local IRQ is enabled.
    
    Fixes: 19049f8d796a sched: fix locking in a653sched_free_vdata()
    Signed-off-by: Anderson Choi <anderson.choi@boeing.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
    master commit: 3ee55c9543fcf0b35593f030b53f56f3222046b7
    master date: 2025-03-19 16:44:00 +0000
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index 9ebae6d7ae..930361fa5c 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -463,10 +463,11 @@ a653sched_free_udata(const struct scheduler *ops, void *priv)
     if ( !is_idle_unit(av->unit) )
         list_del(&av->list);
 
-    xfree(av);
     update_schedule_units(ops);
 
     spin_unlock_irqrestore(&sched_priv->lock, flags);
+
+    xfree(av);
 }
 
 /**
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:14:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:14:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922146.1326062 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGer-0005Ja-0s; Thu, 20 Mar 2025 14:14:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922146.1326062; Thu, 20 Mar 2025 14:14:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvGeq-0005JO-U7; Thu, 20 Mar 2025 14:14:04 +0000
Received: by outflank-mailman (input) for mailman id 922146;
 Thu, 20 Mar 2025 14:14:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvGep-0005JC-PF
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:14:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGep-00F1Er-3B
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:14:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvGep-00ABma-2M
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:14:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=trZ1BHJcFBRjZP8nasFl27/SjV5a3w1Upb1WTw/WV+Q=; b=wH8Adc6S976kw23EOhF6xO2vOl
	rdcD/RAMKQZHzbYSWHostZb9Vp/Kl0L619F7Iyu4R1pAn2oVeQAJ6dAl9m0aisQ0xHVQwiQZGPevQ
	WhTtJfp7q4OlFSv0jDfxQ2DA/Q4s4/W4lwheIX0Jkanoy1IvVUnKkVMD0kqRyoTtWudI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/setup: correct off-by-1 in module mapping
Message-Id: <E1tvGep-00ABma-2M@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:14:03 +0000

commit c607822b5ae946cfc26efd9dd6ffb45f041e2dac
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 20 12:55:32 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 12:55:32 2025 +0100

    x86/setup: correct off-by-1 in module mapping
    
    If a module's length is an exact multiple of PAGE_SIZE, the 2nd argument
    passed to set_pdx_range() would be one larger than intended. Use
    PFN_{UP,DOWN}() there instead.
    
    Fixes: cd7cc5320bb2 ("x86/boot: add start and size fields to struct boot_module")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: c3b54301fbe918c7e7e9c3b2dfe671c1ab79f882
    master date: 2025-03-20 08:51:55 +0100
---
 xen/arch/x86/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8ebe5a9443..6e49d2705b 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1728,7 +1728,7 @@ void asmlinkage __init noreturn __start_xen(void)
     {
         unsigned long s = bi->mods[i].start, l = bi->mods[i].size;
 
-        set_pdx_range(paddr_to_pfn(s), paddr_to_pfn(s + l) + 1);
+        set_pdx_range(PFN_DOWN(s), PFN_UP(s + l));
         map_pages_to_xen((unsigned long)maddr_to_virt(s), maddr_to_mfn(s),
                          PFN_UP(l), PAGE_HYPERVISOR);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:44:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:44:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922345.1326194 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH7r-00024O-3h; Thu, 20 Mar 2025 14:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922345.1326194; Thu, 20 Mar 2025 14:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH7r-00023o-0q; Thu, 20 Mar 2025 14:44:03 +0000
Received: by outflank-mailman (input) for mailman id 922345;
 Thu, 20 Mar 2025 14:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH7p-00023Z-R9
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH7q-00F21L-09
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH7p-00BKIv-2V
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vOBY5PO3Acr4ECspyJ7aGJwVU+ZBo/Gx/c49aITwPz4=; b=KlJJfL/T3bhq0qu7ulQiwqRUi1
	QlDrdrHus9+Ye6l9lJqSLt67ApEyB8+C6kwBaEfMKGr3e/FDfkyoMice2dmiTE6OzvdxAD6qjrR7c
	j2q08dLP9KHGSe8+5jUYzMuv8iYkuYJq5emwBlTSN0FDEqU+eomhb3nqTSsTT096I1DY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/console: Fix truncation of panic() messages
Message-Id: <E1tvH7p-00BKIv-2V@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:44:01 +0000

commit 330ecfc7c1bea7699d3783c8d733cab53e933d39
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:13:44 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:13:44 2025 +0100

    xen/console: Fix truncation of panic() messages
    
    The panic() function uses a static buffer to format its arguments into, simply
    to emit the result via printk("%s", buf).  This buffer is not large enough for
    some existing users in Xen.  e.g.:
    
      (XEN) ****************************************
      (XEN) Panic on CPU 0:
      (XEN) Invalid device tree blob at physical address 0x46a00000.
      (XEN) The DTB must be 8-byte aligned and must not exceed 2 MB in size.
      (XEN)
      (XEN) Plea****************************************
    
    The remainder of this particular message is 'e check your bootloader.', but
    has been inherited by RISC-V from ARM.
    
    It is also pointless double buffering.  Implement vprintk() beside printk(),
    and use it directly rather than rendering into a local buffer, removing it as
    one source of message limitation.
    
    This marginally simplifies panic(), and drops a global used-once buffer.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 81f8b1dd9407e4a3d9dc058b7fbbc591168649ad
    master date: 2025-02-18 14:15:58 +0000
---
 xen/drivers/char/console.c | 21 +++++++++++++--------
 xen/include/xen/lib.h      |  2 ++
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 3a3a97bcbe..a18cf7dfa0 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -961,11 +961,17 @@ static void vprintk_common(const char *prefix, const char *fmt, va_list args)
     local_irq_restore(flags);
 }
 
+void vprintk(const char *fmt, va_list args)
+{
+    vprintk_common("(XEN) ", fmt, args);
+}
+
 void printk(const char *fmt, ...)
 {
     va_list args;
+
     va_start(args, fmt);
-    vprintk_common("(XEN) ", fmt, args);
+    vprintk(fmt, args);
     va_end(args);
 }
 
@@ -1267,23 +1273,22 @@ void panic(const char *fmt, ...)
     va_list args;
     unsigned long flags;
     static DEFINE_SPINLOCK(lock);
-    static char buf[128];
 
     spin_debug_disable();
     spinlock_profile_printall('\0');
     debugtrace_dump();
 
-    /* Protects buf[] and ensure multi-line message prints atomically. */
+    /* Ensure multi-line message prints atomically. */
     spin_lock_irqsave(&lock, flags);
 
-    va_start(args, fmt);
-    (void)vsnprintf(buf, sizeof(buf), fmt, args);
-    va_end(args);
-
     console_start_sync();
     printk("\n****************************************\n");
     printk("Panic on CPU %d:\n", smp_processor_id());
-    printk("%s", buf);
+
+    va_start(args, fmt);
+    vprintk(fmt, args);
+    va_end(args);
+
     printk("****************************************\n\n");
     if ( opt_noreboot )
         printk("Manual reset required ('noreboot' specified)\n");
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 394319c818..544d45cb9d 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -61,6 +61,8 @@ debugtrace_printk(const char *fmt, ...) {}
 #define _p(_x) ((void *)(unsigned long)(_x))
 extern void printk(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2), cold));
+void vprintk(const char *fmt, va_list args)
+    __attribute__ ((format (printf, 1, 0), cold));
 
 #define printk_once(fmt, args...)               \
 ({                                              \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922348.1326199 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH81-00027n-4q; Thu, 20 Mar 2025 14:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922348.1326199; Thu, 20 Mar 2025 14:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH81-00027f-2B; Thu, 20 Mar 2025 14:44:13 +0000
Received: by outflank-mailman (input) for mailman id 922348;
 Thu, 20 Mar 2025 14:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH7z-00027T-Vt
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH80-00F21c-0R
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH7z-00BKK4-2n
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CFbhb6ohPOlF82WExvPBxr0y05uYdTzY81gYLWK9PrU=; b=Jkv5gVIKS3aaNVCEJwlO2ylMIN
	lPbpYphtIAXpwdFpuW4MNsCR2ukX/rdbmey3S79EEhDbkdCrW+kBIpGFGq4v1St7LrkDqCpXca+4I
	04trWNMiGVEtBhdLrApGCrfaa/5+Z1aLL/ILL9hD9TlMvtMfbbmOtsoa0BfCgg8fV70o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/memory: Make resource_max_frames() to return 0 on unknown type
Message-Id: <E1tvH7z-00BKK4-2n@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:44:11 +0000

commit 93027a991a89795c312e20a1c404321ce15ce404
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Thu Mar 20 13:14:27 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:14:27 2025 +0100

    xen/memory: Make resource_max_frames() to return 0 on unknown type
    
    This is actually what the caller acquire_resource() expects on any kind
    of error (the comment on top of resource_max_frames() also suggests that).
    Otherwise, the caller will treat -errno as a valid value and propagate incorrect
    nr_frames to the VM. As a possible consequence, a VM trying to query a resource
    size of an unknown type will get the success result from the hypercall and obtain
    nr_frames 4294967201.
    
    Also, add an ASSERT_UNREACHABLE() in the default case of _acquire_resource(),
    normally we won't get to this point, as an unknown type will always be rejected
    earlier in resource_max_frames().
    
    Also, update test-resource app to verify that Xen can deal with invalid
    (unknown) resource type properly.
    
    Fixes: 9244528955de ("xen/memory: Fix acquire_resource size semantics")
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9b8708290002f0a4d0b363e0c66ce945f6b520bd
    master date: 2025-02-18 14:47:34 +0000
---
 tools/tests/resource/test-resource.c | 10 ++++++++++
 xen/common/memory.c                  |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
index 1b10be16a6..a7f2d04643 100644
--- a/tools/tests/resource/test-resource.c
+++ b/tools/tests/resource/test-resource.c
@@ -123,6 +123,16 @@ static void test_gnttab(uint32_t domid, unsigned int nr_frames,
         fail("    Fail: Managed to map gnttab v2 status frames in v1 mode\n");
         xenforeignmemory_unmap_resource(fh, res);
     }
+
+    /*
+     * If this check starts failing, you've found the right place to test your
+     * addition to the Acquire Resource infrastructure.
+     */
+    rc = xenforeignmemory_resource_size(fh, domid, 3, 0, &size);
+
+    /* Check that Xen rejected the resource type. */
+    if ( !rc )
+        fail("    Fail: Expected error on an invalid resource type, got success\n");
 }
 
 static void test_domain_configurations(void)
diff --git a/xen/common/memory.c b/xen/common/memory.c
index de2cc7ad92..1f0a9d7e5f 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1156,7 +1156,7 @@ static unsigned int resource_max_frames(const struct domain *d,
         return d->vmtrace_size >> PAGE_SHIFT;
 
     default:
-        return -EOPNOTSUPP;
+        return 0;
     }
 }
 
@@ -1239,6 +1239,7 @@ static int _acquire_resource(
         return acquire_vmtrace_buf(d, id, frame, nr_frames, mfn_list);
 
     default:
+        ASSERT_UNREACHABLE();
         return -EOPNOTSUPP;
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922349.1326204 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH8B-0002Ad-7L; Thu, 20 Mar 2025 14:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922349.1326204; Thu, 20 Mar 2025 14:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH8B-0002AV-3Z; Thu, 20 Mar 2025 14:44:23 +0000
Received: by outflank-mailman (input) for mailman id 922349;
 Thu, 20 Mar 2025 14:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH8A-0002AF-0Y
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH8A-00F21k-0i
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH89-00BKL5-34
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u0R0lAwArbnKNNDmxjZ1q72oIUb4MoVN/m+66hakEvY=; b=QgBHK2TmQzpTxos2n3gtTvmr0s
	vwTLMmCEQziXNebKV+MrXlr7CG30a0XqTg4PmhitulXLrLzVT2uCWFcCm5wS/x/A2z7z5KxZjK1qm
	t9HHc1xqUiRrIt7z5VpO9Yv/JZWWKON8Jv/kGkR9HrlxTcCVo2hEWa95w94OwyymK++M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/svm: Separate STI and VMRUN instructions in svm_asm_do_resume()
Message-Id: <E1tvH89-00BKL5-34@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:44:21 +0000

commit b067751570d77e661e22c8b177d1fff4980c4b6a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:14:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:14:51 2025 +0100

    x86/svm: Separate STI and VMRUN instructions in svm_asm_do_resume()
    
    There is a corner case in the VMRUN instruction where its INTR_SHADOW state
    leaks into guest state if a VMExit occurs before the VMRUN is complete.  An
    example of this could be taking #NPF due to event injection.
    
    Xen can safely execute STI anywhere between CLGI and VMRUN, as CLGI blocks
    external interrupts too.  However, an exception (while fatal) will appear to
    be in an irqs-on region (as GIF isn't considered), so position the STI after
    the speculation actions but prior to the GPR pops.
    
    Link: https://lore.kernel.org/all/CADH9ctBs1YPmE4aCfGPNBwA10cA8RuAk2gO7542DjMZgs4uzJQ@mail.gmail.com/
    Fixes: 66b245d9eaeb ("SVM: limit GIF=0 region")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c989ff614f6bad48b3bd4b32694f711b31c7b2d6
    master date: 2025-02-19 12:45:48 +0000
---
 xen/arch/x86/hvm/svm/entry.S | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index 6fd9652c04..91edb33459 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -74,6 +74,14 @@ __UNLIKELY_END(nsvm_hap)
         ALTERNATIVE "", svm_vmentry_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         ALTERNATIVE "", DO_SPEC_CTRL_DIV, X86_FEATURE_SC_DIV
 
+        /*
+         * Set EFLAGS.IF after CLGI covers us from real interrupts, but not
+         * immediately prior to VMRUN.  The VMRUN instruction leaks it's
+         * INTR_SHADOW into guest state if a VMExit occurs before VMRUN
+         * completes (e.g. taking #NPF during event injecting.)
+         */
+        sti
+
         pop  %r15
         pop  %r14
         pop  %r13
@@ -91,7 +99,6 @@ __UNLIKELY_END(nsvm_hap)
         pop  %rsi
         pop  %rdi
 
-        sti
         vmrun
 
         SAVE_ALL
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922350.1326206 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH8L-0002Dr-7U; Thu, 20 Mar 2025 14:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922350.1326206; Thu, 20 Mar 2025 14:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH8L-0002Dj-4w; Thu, 20 Mar 2025 14:44:33 +0000
Received: by outflank-mailman (input) for mailman id 922350;
 Thu, 20 Mar 2025 14:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH8K-0002DL-3W
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH8K-00F21r-10
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH8K-00BKOE-08
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=drdrdwMW19McLGunl2zNOuhLS+4SFggqNyne9fcyr60=; b=qXm3pULBYIDcdRl06VpImzcfPX
	2VCoVcFI/cg0QoOJjHYfpHXCZa3ud1+LMME5eePK7TSm3QiMQbT9P6pcuyTHwy1wMCNggg6yTKaGr
	gixBZGBhj9kF/ixp9Dj+wdrweb0zlWqHy+eVi1TVT8OSeFsWiFi4LHxXUTFuHzTjr9EA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/emul: dump unhandled memory accesses for PVH dom0
Message-Id: <E1tvH8K-00BKOE-08@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:44:32 +0000

commit c6366b64dd498727bfb0e3aacc37c6db6d7242f1
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:15:48 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:15:48 2025 +0100

    x86/emul: dump unhandled memory accesses for PVH dom0
    
    A PV dom0 can map any host memory as long as it's allowed by the IO
    capability range in d->iomem_caps.  On the other hand, a PVH dom0 has no
    way to populate MMIO region onto it's p2m, so it's limited to what Xen
    initially populates on the p2m based on the host memory map and the enabled
    device BARs.
    
    Introduce a new debug build only printk that reports attempts by dom0 to
    access addresses not populated on the p2m, and not handled by any emulator.
    This is for information purposes only, but might allow getting an idea of
    what MMIO ranges might be missing on the p2m.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 43d8a80a0cccfe3715bb3178b5c15fb983979651
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/hvm/emulate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index fb4de6ee0a..2664fe0c71 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -337,6 +337,9 @@ static int hvmemul_do_io(
         /* If there is no suitable backing DM, just ignore accesses */
         if ( !s )
         {
+            if ( is_mmio && is_hardware_domain(currd) )
+                gdprintk(XENLOG_DEBUG, "unhandled memory %s %#lx size %u\n",
+                         dir ? "read from" : "write to", addr, size);
             rc = hvm_process_io_intercept(&null_handler, &p);
             vio->req.state = STATE_IOREQ_NONE;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:44:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922352.1326211 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH8V-0002Gi-9O; Thu, 20 Mar 2025 14:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922352.1326211; Thu, 20 Mar 2025 14:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH8V-0002Ga-6L; Thu, 20 Mar 2025 14:44:43 +0000
Received: by outflank-mailman (input) for mailman id 922352;
 Thu, 20 Mar 2025 14:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH8U-0002GO-6M
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH8U-00F22A-1I
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH8U-00BKP7-0R
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iicnEt7jI7nXCd08Y7yyd5Oihc7VA5OKRi+Yp49SOpU=; b=ZLipN3b9BJH4lj0Cku+IwcCZd6
	nZZL+2TfQWh9K7NHosXgMXbx559REEyz1kry80Hd/DQ2jkQkE0K1YE0bn9R5bWGibw+9kQte/J4hy
	QbIVGoMyqsZuJTnKMS2EDCuYXKyD8IGTwWJu/DYdj06i2um8Cs5tE1EKKdmU9/EAtX4k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/dom0: attempt to fixup p2m page-faults for PVH dom0
Message-Id: <E1tvH8U-00BKP7-0R@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:44:42 +0000

commit 2f47f9df89c8655d16bef125fb48c63170977582
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:16:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:16:14 2025 +0100

    x86/dom0: attempt to fixup p2m page-faults for PVH dom0
    
    When building a PVH dom0 Xen attempts to map all (relevant) MMIO regions
    into the p2m for dom0 access.  However the information Xen has about the
    host memory map is limited.  Xen doesn't have access to any resources
    described in ACPI dynamic tables, and hence the p2m mappings provided might
    not be complete.
    
    PV doesn't suffer from this issue because a PV dom0 is capable of mapping
    into it's page-tables any address not explicitly banned in d->iomem_caps.
    
    Introduce a new command line options that allows Xen to attempt to fixup
    the p2m page-faults, by creating p2m identity maps in response to p2m
    page-faults.
    
    This is aimed as a workaround to small ACPI regions Xen doesn't know about.
    Note that missing large MMIO regions mapped in this way will lead to
    slowness due to the VM exit processing, plus the mappings will always use
    small pages.
    
    The ultimate aim is to attempt to bring better parity with a classic PV
    dom0.
    
    Note such fixup rely on the CPU doing the access to the unpopulated
    address.  If the access is attempted from a device instead there's no
    possible way to fixup, as IOMMU page-fault are asynchronous.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    master commit: 104591f5dd675d7bfb04885dace0e4e5a097fc1e
    master date: 2025-03-05 10:26:46 +0100
---
 CHANGELOG.md                           |  6 +++
 docs/misc/xen-command-line.pandoc      | 16 +++++++-
 xen/arch/x86/dom0_build.c              |  5 +++
 xen/arch/x86/hvm/emulate.c             | 74 +++++++++++++++++++++++++++++++++-
 xen/arch/x86/include/asm/hvm/emulate.h |  3 ++
 5 files changed, 101 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1639886aa7..216e66b576 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
+## [4.19.2](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.19.2)
+
+### Added
+ - On x86:
+   - Option to attempt to fixup p2m page-faults on PVH dom0.
+
 ## [4.19.1](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.19.1)
 
 ### Changed
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index a398891bc0..ff10ff9f65 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -806,7 +806,8 @@ Specify the bit width of the DMA heap.
 
 ### dom0
     = List of [ pv | pvh, shadow=<bool>, verbose=<bool>,
-                cpuid-faulting=<bool>, msr-relaxed=<bool> ] (x86)
+                cpuid-faulting=<bool>, msr-relaxed=<bool>,
+                pf-fixup=<bool> ] (x86)
 
     = List of [ sve=<integer> ] (Arm64)
 
@@ -867,6 +868,19 @@ Controls for how dom0 is constructed on x86 systems.
 
     If using this option is necessary to fix an issue, please report a bug.
 
+*   The `pf-fixup` boolean is only applicable when using a PVH dom0 and
+    defaults to false.
+
+    When running dom0 in PVH mode the dom0 kernel has no way to map MMIO
+    regions into its physical memory map, such mode relies on Xen dom0 builder
+    populating the physical memory map with all MMIO regions that dom0 should
+    access.  However Xen doesn't have a complete picture of the host memory
+    map, due to not being able to process ACPI dynamic tables.
+
+    The `pf-fixup` option allows Xen to attempt to add missing MMIO regions
+    to the dom0 physical memory map in response to page-faults generated by
+    dom0 trying to access unpopulated entries in the memory map.
+
 Enables features on dom0 on Arm systems.
 
 *   The `sve` integer parameter enables Arm SVE usage for Dom0 and sets the
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 8d56705a08..6b22f59ab2 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -16,6 +16,7 @@
 #include <asm/dom0_build.h>
 #include <asm/guest.h>
 #include <asm/hpet.h>
+#include <asm/hvm/emulate.h>
 #include <asm/io_apic.h>
 #include <asm/p2m.h>
 #include <asm/setup.h>
@@ -286,6 +287,10 @@ int __init parse_arch_dom0_param(const char *s, const char *e)
         opt_dom0_cpuid_faulting = val;
     else if ( (val = parse_boolean("msr-relaxed", s, e)) >= 0 )
         opt_dom0_msr_relaxed = val;
+#ifdef CONFIG_HVM
+    else if ( (val = parse_boolean("pf-fixup", s, e)) >= 0 )
+        opt_dom0_pf_fixup = val;
+#endif
     else
         return -EINVAL;
 
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 2664fe0c71..abc4f5f261 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -10,12 +10,15 @@
  */
 
 #include <xen/init.h>
+#include <xen/iocap.h>
 #include <xen/ioreq.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <xen/paging.h>
 #include <xen/trace.h>
 #include <xen/vm_event.h>
+
+#include <asm/altp2m.h>
 #include <asm/event.h>
 #include <asm/i387.h>
 #include <asm/xstate.h>
@@ -161,6 +164,36 @@ void hvmemul_cancel(struct vcpu *v)
     hvmemul_cache_disable(v);
 }
 
+bool __ro_after_init opt_dom0_pf_fixup;
+static int hwdom_fixup_p2m(paddr_t addr)
+{
+    unsigned long gfn = paddr_to_pfn(addr);
+    struct domain *currd = current->domain;
+    p2m_type_t type;
+    mfn_t mfn;
+    int rc;
+
+    ASSERT(is_hardware_domain(currd));
+    ASSERT(!altp2m_active(currd));
+
+    /*
+     * Fixups are only applied for MMIO holes, and rely on the hardware domain
+     * having identity mappings for non RAM regions (gfn == mfn).
+     */
+    if ( !iomem_access_permitted(currd, gfn, gfn) ||
+         !is_memory_hole(_mfn(gfn), _mfn(gfn)) )
+        return -EPERM;
+
+    mfn = get_gfn(currd, gfn, &type);
+    if ( !mfn_eq(mfn, INVALID_MFN) || !p2m_is_hole(type) )
+        rc = mfn_eq(mfn, _mfn(gfn)) ? -EEXIST : -ENOTEMPTY;
+    else
+        rc = set_mmio_p2m_entry(currd, _gfn(gfn), _mfn(gfn), 0);
+    put_gfn(currd, gfn);
+
+    return rc;
+}
+
 static int hvmemul_do_io(
     bool is_mmio, paddr_t addr, unsigned long *reps, unsigned int size,
     uint8_t dir, bool df, bool data_is_addr, uintptr_t data)
@@ -338,8 +371,45 @@ static int hvmemul_do_io(
         if ( !s )
         {
             if ( is_mmio && is_hardware_domain(currd) )
-                gdprintk(XENLOG_DEBUG, "unhandled memory %s %#lx size %u\n",
-                         dir ? "read from" : "write to", addr, size);
+            {
+                /*
+                 * PVH dom0 is likely missing MMIO mappings on the p2m, due to
+                 * the incomplete information Xen has about the memory layout.
+                 *
+                 * Either print a message to note dom0 attempted to access an
+                 * unpopulated GPA, or try to fixup the p2m by creating an
+                 * identity mapping for the faulting GPA.
+                 */
+                if ( opt_dom0_pf_fixup )
+                {
+                    int inner_rc = hwdom_fixup_p2m(addr);
+
+                    if ( !inner_rc || inner_rc == -EEXIST )
+                    {
+                        if ( !inner_rc )
+                            gdprintk(XENLOG_DEBUG,
+                                     "fixup p2m mapping for page %lx added\n",
+                                     paddr_to_pfn(addr));
+                        else
+                            gprintk(XENLOG_INFO,
+                                    "fixup p2m mapping for page %lx already present\n",
+                                    paddr_to_pfn(addr));
+
+                        rc = X86EMUL_RETRY;
+                        vio->req.state = STATE_IOREQ_NONE;
+                        break;
+                    }
+
+                    gprintk(XENLOG_WARNING,
+                            "unable to fixup memory %s %#lx size %u: %d\n",
+                            dir ? "read from" : "write to", addr, size,
+                            inner_rc);
+                }
+                else
+                    gdprintk(XENLOG_DEBUG,
+                             "unhandled memory %s %#lx size %u\n",
+                             dir ? "read from" : "write to", addr, size);
+            }
             rc = hvm_process_io_intercept(&null_handler, &p);
             vio->req.state = STATE_IOREQ_NONE;
         }
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index 2e1eedefa7..108472f6f7 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -147,6 +147,9 @@ static inline void hvmemul_write_cache(const struct vcpu *v, paddr_t gpa,
 void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
                               struct hvm_emulate_ctxt *hvmemul_ctxt, int rc);
 
+/* For PVH dom0: signal whether to attempt fixup of p2m page-faults. */
+extern bool opt_dom0_pf_fixup;
+
 #endif /* __ASM_X86_HVM_EMULATE_H__ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:44:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922353.1326214 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH8f-0002Jx-CN; Thu, 20 Mar 2025 14:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922353.1326214; Thu, 20 Mar 2025 14:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH8f-0002Jp-9p; Thu, 20 Mar 2025 14:44:53 +0000
Received: by outflank-mailman (input) for mailman id 922353;
 Thu, 20 Mar 2025 14:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH8e-0002Jh-93
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH8e-00F22U-1Z
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH8e-00BKQJ-0i
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BfreRgXVJ/gZrXfUxyKoVu2KXiWLXEOs72+CiZTF5SM=; b=5HR3CyT2SfhEyJ9gPsmW4uiV2q
	2LBOzVOftvrU7DUnQN4tiy8zUV3J9x6+mvK9LhNOBm73f0+WGXN2mRoOJPg7t5s6sPRNzd2P1l3XR
	x229XgQcB5eVaD+v3nfG5170Tu6hKNUkCDZeQTvTSn9RC/TcfSxC8+ey9nqmF2r0WEcI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
Message-Id: <E1tvH8e-00BKQJ-0i@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:44:52 +0000

commit eaa79d83b640f36b4973b15193d7405969030640
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:16:37 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:16:37 2025 +0100

    x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
    
    The logic in dom0_setup_permissions() sets the maximum bound in
    ->iomem_caps unconditionally using paddr_bits, which is not correct for HVM
    based domains.  Instead use domain_max_paddr_bits() to get the correct
    maximum paddr bits for each possible domain type.
    
    Switch to using PFN_DOWN() instead of PAGE_SHIFT, as that's shorter.
    
    Fixes: 53de839fb409 ('x86: constrain MFN range Dom0 may access')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a00e08799cc7657d2a1aca158f4ad43d4c9103e7
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 6b22f59ab2..330af7cf76 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -481,7 +481,8 @@ int __init dom0_setup_permissions(struct domain *d)
 
     /* The hardware domain is initially permitted full I/O capabilities. */
     rc = ioports_permit_access(d, 0, 0xFFFF);
-    rc |= iomem_permit_access(d, 0UL, (1UL << (paddr_bits - PAGE_SHIFT)) - 1);
+    rc |= iomem_permit_access(d, 0UL,
+                              PFN_DOWN(1UL << domain_max_paddr_bits(d)) - 1);
     rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
 
     /* Modify I/O port access permissions. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:45:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922354.1326219 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH8p-0002MR-EG; Thu, 20 Mar 2025 14:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922354.1326219; Thu, 20 Mar 2025 14:45:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH8p-0002MJ-BK; Thu, 20 Mar 2025 14:45:03 +0000
Received: by outflank-mailman (input) for mailman id 922354;
 Thu, 20 Mar 2025 14:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH8o-0002M8-C8
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH8o-00F22w-1r
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH8o-00BKRZ-10
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IHcJte6MJIBjGArPXyDCc64QDSHCXFweW/ieeobyz5U=; b=RRmbGA+T9GXfj6lGNMWTNF2kf1
	jlsCkWyDaHpEdMWZn2ThSfkrR/Gkh8Svmfn4d+E5jaj5E6gHSoOqXURHlZVDlr6J5t+9O8O1yrZFC
	EGMVRLKxGpNPgGTswRe/QWqsbYAIrQyp0BFqyui0oKXim2QKTIvWkmLW1Olt4+LoFX5o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/iommu: account for IOMEM caps when populating dom0 IOMMU page-tables
Message-Id: <E1tvH8o-00BKRZ-10@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:45:02 +0000

commit 74e860e45ec839393e4a3036f51b5af2c4aa7efe
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:16:56 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:16:56 2025 +0100

    x86/iommu: account for IOMEM caps when populating dom0 IOMMU page-tables
    
    The current code in arch_iommu_hwdom_init() kind of open-codes the same
    MMIO permission ranges that are added to the hardware domain ->iomem_caps.
    Avoid this duplication and use ->iomem_caps in arch_iommu_hwdom_init() to
    filter which memory regions should be added to the dom0 IOMMU page-tables.
    
    Note the IO-APIC and MCFG page(s) must be set as not accessible for a PVH
    dom0, otherwise the internal Xen emulation for those ranges won't work.
    This requires adjustments in dom0_setup_permissions().
    
    The call to pvh_setup_mmcfg() in dom0_construct_pvh() must now strictly be
    done ahead of setting up dom0 permissions, so take the opportunity to also
    put it inside the existing is_hardware_domain() region.
    
    Also the special casing of E820_UNUSABLE regions no longer needs to be done
    in arch_iommu_hwdom_init(), as those regions are already blocked in
    ->iomem_caps and thus would be removed from the rangeset as part of
    ->iomem_caps processing in arch_iommu_hwdom_init().  The E820_UNUSABLE
    regions below 1Mb are not removed from ->iomem_caps, that's a slight
    difference for the IOMMU created page-tables, but the aim is to allow
    access to the same memory either from the CPU or the IOMMU page-tables.
    
    Since ->iomem_caps already takes into account the domain max paddr, there's
    no need to remove any regions past the last address addressable by the
    domain, as applying ->iomem_caps would have already taken care of that.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62f3fc5296c452285e81adb50976bde2d68d3181
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c           | 11 +++++-
 xen/arch/x86/hvm/dom0_build.c       | 14 ++++----
 xen/arch/x86/hvm/io.c               |  6 ++--
 xen/arch/x86/include/asm/hvm/io.h   |  4 +--
 xen/drivers/passthrough/x86/iommu.c | 67 +++++++++++++++----------------------
 5 files changed, 49 insertions(+), 53 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 330af7cf76..c0b2ad34b5 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -558,7 +558,9 @@ int __init dom0_setup_permissions(struct domain *d)
     for ( i = 0; i < nr_ioapics; i++ )
     {
         mfn = paddr_to_pfn(mp_ioapics[i].mpc_apicaddr);
-        if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
+        /* If emulating IO-APIC(s) make sure the base address is unmapped. */
+        if ( has_vioapic(d) ||
+             !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
     /* MSI range. */
@@ -599,6 +601,13 @@ int __init dom0_setup_permissions(struct domain *d)
             rc |= rangeset_add_singleton(mmio_ro_ranges, mfn);
     }
 
+    if ( has_vpci(d) )
+        /*
+         * TODO: runtime added MMCFG regions are not checked to make sure they
+         * don't overlap with already mapped regions, thus preventing trapping.
+         */
+        rc |= vpci_mmcfg_deny_access(d);
+
     return rc;
 }
 
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 3dd913bdb0..81445d5b37 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1312,6 +1312,13 @@ int __init dom0_construct_pvh(struct domain *d, const module_t *image,
 
     if ( is_hardware_domain(d) )
     {
+        /*
+         * MMCFG initialization must be performed before setting domain
+         * permissions, as the MCFG areas must not be part of the domain IOMEM
+         * accessible regions.
+         */
+        pvh_setup_mmcfg(d);
+
         /*
          * Setup permissions early so that calls to add MMIO regions to the
          * p2m as part of vPCI setup don't fail due to permission checks.
@@ -1324,13 +1331,6 @@ int __init dom0_construct_pvh(struct domain *d, const module_t *image,
         }
     }
 
-    /*
-     * NB: MMCFG initialization needs to be performed before iommu
-     * initialization so the iommu code can fetch the MMCFG regions used by the
-     * domain.
-     */
-    pvh_setup_mmcfg(d);
-
     /*
      * Craft dom0 physical memory map and set the paging allocation. This must
      * be done before the iommu initializion, since iommu initialization code
diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index db726b3817..de6ee6c4dd 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -363,14 +363,14 @@ static const struct hvm_mmcfg *vpci_mmcfg_find(const struct domain *d,
     return NULL;
 }
 
-int __hwdom_init vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r)
+int __hwdom_init vpci_mmcfg_deny_access(struct domain *d)
 {
     const struct hvm_mmcfg *mmcfg;
 
     list_for_each_entry ( mmcfg, &d->arch.hvm.mmcfg_regions, next )
     {
-        int rc = rangeset_remove_range(r, PFN_DOWN(mmcfg->addr),
-                                       PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
+        int rc = iomem_deny_access(d, PFN_DOWN(mmcfg->addr),
+                                   PFN_DOWN(mmcfg->addr + mmcfg->size - 1));
 
         if ( rc )
             return rc;
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index d72b29f73f..377c59a5c4 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -134,8 +134,8 @@ int register_vpci_mmcfg_handler(struct domain *d, paddr_t addr,
 /* Destroy tracked MMCFG areas. */
 void destroy_vpci_mmcfg(struct domain *d);
 
-/* Remove MMCFG regions from a given rangeset. */
-int vpci_subtract_mmcfg(const struct domain *d, struct rangeset *r);
+/* Remove MMCFG regions from a domain ->iomem_caps. */
+int vpci_mmcfg_deny_access(struct domain *d);
 
 #endif /* __ASM_X86_HVM_IO_H__ */
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 8b1e0596b8..67f025c1ec 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -320,6 +320,26 @@ static int __hwdom_init cf_check map_subtract(unsigned long s, unsigned long e,
     return rangeset_remove_range(map, s, e);
 }
 
+struct handle_iomemcap {
+    struct rangeset *r;
+    unsigned long last;
+};
+static int __hwdom_init cf_check map_subtract_iomemcap(unsigned long s,
+                                                       unsigned long e,
+                                                       void *data)
+{
+    struct handle_iomemcap *h = data;
+    int rc = 0;
+
+    if ( h->last != s )
+        rc = rangeset_remove_range(h->r, h->last, s - 1);
+
+    ASSERT(e < ~0UL);
+    h->last = e + 1;
+
+    return rc;
+}
+
 struct map_data {
     struct domain *d;
     unsigned int flush_flags;
@@ -400,6 +420,7 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
     unsigned int i;
     struct rangeset *map;
     struct map_data map_data = { .d = d };
+    struct handle_iomemcap iomem = {};
     int rc;
 
     BUG_ON(!is_hardware_domain(d));
@@ -442,14 +463,6 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
 
         switch ( entry.type )
         {
-        case E820_UNUSABLE:
-            /* Only relevant for inclusive mode, otherwise this is a no-op. */
-            rc = rangeset_remove_range(map, PFN_DOWN(entry.addr),
-                                       PFN_DOWN(entry.addr + entry.size - 1));
-            if ( rc )
-                panic("IOMMU failed to remove unusable memory: %d\n", rc);
-            continue;
-
         case E820_RESERVED:
             if ( !iommu_hwdom_inclusive && !iommu_hwdom_reserved )
                 continue;
@@ -475,22 +488,13 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
     if ( rc )
         panic("IOMMU failed to remove Xen ranges: %d\n", rc);
 
-    /* Remove any overlap with the Interrupt Address Range. */
-    rc = rangeset_remove_range(map, 0xfee00, 0xfeeff);
+    iomem.r = map;
+    rc = rangeset_report_ranges(d->iomem_caps, 0, ~0UL, map_subtract_iomemcap,
+                                &iomem);
+    if ( !rc && iomem.last < ~0UL )
+        rc = rangeset_remove_range(map, iomem.last, ~0UL);
     if ( rc )
-        panic("IOMMU failed to remove Interrupt Address Range: %d\n", rc);
-
-    /* If emulating IO-APIC(s) make sure the base address is unmapped. */
-    if ( has_vioapic(d) )
-    {
-        for ( i = 0; i < d->arch.hvm.nr_vioapics; i++ )
-        {
-            rc = rangeset_remove_singleton(map,
-                PFN_DOWN(domain_vioapic(d, i)->base_address));
-            if ( rc )
-                panic("IOMMU failed to remove IO-APIC: %d\n", rc);
-        }
-    }
+        panic("IOMMU failed to remove forbidden regions: %d\n", rc);
 
     if ( is_pv_domain(d) )
     {
@@ -506,23 +510,6 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
             panic("IOMMU failed to remove read-only regions: %d\n", rc);
     }
 
-    if ( has_vpci(d) )
-    {
-        /*
-         * TODO: runtime added MMCFG regions are not checked to make sure they
-         * don't overlap with already mapped regions, thus preventing trapping.
-         */
-        rc = vpci_subtract_mmcfg(d, map);
-        if ( rc )
-            panic("IOMMU unable to remove MMCFG areas: %d\n", rc);
-    }
-
-    /* Remove any regions past the last address addressable by the domain. */
-    rc = rangeset_remove_range(map, PFN_DOWN(1UL << domain_max_paddr_bits(d)),
-                               ~0UL);
-    if ( rc )
-        panic("IOMMU unable to remove unaddressable ranges: %d\n", rc);
-
     if ( iommu_verbose )
         printk(XENLOG_INFO "%pd: identity mappings for IOMMU:\n", d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:45:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922356.1326233 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH8z-0002fL-Lk; Thu, 20 Mar 2025 14:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922356.1326233; Thu, 20 Mar 2025 14:45:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH8z-0002fC-JD; Thu, 20 Mar 2025 14:45:13 +0000
Received: by outflank-mailman (input) for mailman id 922356;
 Thu, 20 Mar 2025 14:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH8y-0002eQ-FT
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH8y-00F23B-29
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH8y-00BKSQ-1I
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Tr6oKLNnkYFi8uQA9Y2jidgL0KUwOHqtMG3hgVQMb54=; b=k49Rr+JopZYm63vY8IyKMp8NOP
	HLHR7mRf6bhuBTkCpPe3GSWXO6khc/rchA5fEXpsuQ2AOBqsYgLrWKXWp0nYu+s898Ydrdwksq71L
	LseyGzWkuVmf2QScOxef8Hh4lcrD8E7Q88XZMYgDHymmV9hC3cUIzVN0p620uLvZqAPk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/dom0: be less restrictive with the Interrupt Address Range
Message-Id: <E1tvH8y-00BKSQ-1I@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:45:12 +0000

commit e665204eb38343bb9ee9ca2a21461659abb01dc3
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:17:17 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:17:17 2025 +0100

    x86/dom0: be less restrictive with the Interrupt Address Range
    
    Xen currently prevents dom0 from creating CPU or IOMMU page-table mappings
    into the interrupt address range [0xfee00000, 0xfeefffff].  This range has
    two different purposes.  For accesses from the CPU is contains the default
    position of local APIC page at 0xfee00000.  For accesses from devices
    it's the MSI address range, so the address field in the MSI entries
    (usually) point to an address on that range to trigger an interrupt.
    
    There are reports of Lenovo Thinkpad devices placing what seems to be the
    UCSI shared mailbox at address 0xfeec2000 in the interrupt address range.
    Attempting to use that device with a Linux PV dom0 leads to an error when
    Linux kernel maps 0xfeec2000:
    
    RIP: e030:xen_mc_flush+0x1e8/0x2b0
     xen_leave_lazy_mmu+0x15/0x60
     vmap_range_noflush+0x408/0x6f0
     __ioremap_caller+0x20d/0x350
     acpi_os_map_iomem+0x1a3/0x1c0
     acpi_ex_system_memory_space_handler+0x229/0x3f0
     acpi_ev_address_space_dispatch+0x17e/0x4c0
     acpi_ex_access_region+0x28a/0x510
     acpi_ex_field_datum_io+0x95/0x5c0
     acpi_ex_extract_from_field+0x36b/0x4e0
     acpi_ex_read_data_from_field+0xcb/0x430
     acpi_ex_resolve_node_to_value+0x2e0/0x530
     acpi_ex_resolve_to_value+0x1e7/0x550
     acpi_ds_evaluate_name_path+0x107/0x170
     acpi_ds_exec_end_op+0x392/0x860
     acpi_ps_parse_loop+0x268/0xa30
     acpi_ps_parse_aml+0x221/0x5e0
     acpi_ps_execute_method+0x171/0x3e0
     acpi_ns_evaluate+0x174/0x5d0
     acpi_evaluate_object+0x167/0x440
     acpi_evaluate_dsm+0xb6/0x130
     ucsi_acpi_dsm+0x53/0x80
     ucsi_acpi_read+0x2e/0x60
     ucsi_register+0x24/0xa0
     ucsi_acpi_probe+0x162/0x1e3
     platform_probe+0x48/0x90
     really_probe+0xde/0x340
     __driver_probe_device+0x78/0x110
     driver_probe_device+0x1f/0x90
     __driver_attach+0xd2/0x1c0
     bus_for_each_dev+0x77/0xc0
     bus_add_driver+0x112/0x1f0
     driver_register+0x72/0xd0
     do_one_initcall+0x48/0x300
     do_init_module+0x60/0x220
     __do_sys_init_module+0x17f/0x1b0
     do_syscall_64+0x82/0x170
    
    Remove the restrictions to create mappings in the interrupt address range
    for dom0.  Note that the restriction to map the local APIC page is enforced
    separately, and that continues to be present.  Additionally make sure the
    emulated local APIC page is also not mapped, in case dom0 is using it.
    
    Note that even if the interrupt address range entries are populated in the
    IOMMU page-tables no device access will reach those pages.  Device accesses
    to the Interrupt Address Range will always be converted into Interrupt
    Messages and are not subject to DMA remapping.
    
    There's also the following restriction noted in Intel VT-d:
    
    > Software must not program paging-structure entries to remap any address to
    > the interrupt address range. Untranslated requests and translation requests
    > that result in an address in the interrupt range will be blocked with
    > condition code LGN.4 or SGN.8. Translated requests with an address in the
    > interrupt address range are treated as Unsupported Request (UR).
    
    Similarly for AMD-Vi:
    
    > Accesses to the interrupt address range (Table 3) are defined to go through
    > the interrupt remapping portion of the IOMMU and not through address
    > translation processing. Therefore, when a transaction is being processed as
    > an interrupt remapping operation, the transaction attribute of
    > pretranslated or untranslated is ignored.
    >
    > Software Note: The IOMMU should
    > not be configured such that an address translation results in a special
    > address such as the interrupt address range.
    
    However those restrictions don't apply to the identity mappings possibly
    created for dom0, since the interrupt address range is never subject to DMA
    remapping, and hence there's no output address after translation that
    belongs to the interrupt address range.
    
    Reported-by: Jürgen Groß <jgross@suse.com>
    Link: https://lore.kernel.org/xen-devel/baade0a7-e204-4743-bda1-282df74e5f89@suse.com/
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 381caa38850771ae218eb6f6d490dc02e40df964
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index c0b2ad34b5..6ee3dfb73f 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -554,6 +554,13 @@ int __init dom0_setup_permissions(struct domain *d)
         mfn = paddr_to_pfn(mp_lapic_addr);
         rc |= iomem_deny_access(d, mfn, mfn);
     }
+    /* If using an emulated local APIC make sure its MMIO is unpopulated. */
+    if ( has_vlapic(d) )
+    {
+        /* Xen doesn't allow changing the local APIC MMIO window position. */
+        mfn = paddr_to_pfn(APIC_DEFAULT_PHYS_BASE);
+        rc |= iomem_deny_access(d, mfn, mfn);
+    }
     /* I/O APICs. */
     for ( i = 0; i < nr_ioapics; i++ )
     {
@@ -563,10 +570,6 @@ int __init dom0_setup_permissions(struct domain *d)
              !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
-    /* MSI range. */
-    rc |= iomem_deny_access(d, paddr_to_pfn(MSI_ADDR_BASE_LO),
-                            paddr_to_pfn(MSI_ADDR_BASE_LO +
-                                         MSI_ADDR_DEST_ID_MASK));
     /* HyperTransport range. */
     if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:45:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:45:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922361.1326237 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH99-0002pi-NM; Thu, 20 Mar 2025 14:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922361.1326237; Thu, 20 Mar 2025 14:45:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH99-0002pa-Kh; Thu, 20 Mar 2025 14:45:23 +0000
Received: by outflank-mailman (input) for mailman id 922361;
 Thu, 20 Mar 2025 14:45:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH98-0002mp-Hf
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:45:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH98-00F23F-2R
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH98-00BKTE-1a
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:45:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yvySBOMN6N8BefXIKYbi/mNqxjeyFQk2NDQwUNpbtQ0=; b=LXSFpEKeqAEY0bZrhcM4WUyxCO
	sIx1BKaaCijL3T3WVPE+0nf4uxDWLog4m5dzBnV5VpKBjMdfB5eZ5+Gw5IjfGxVYJ/mhKvwQF+JuF
	uDUxXTcWlqOhqd2TNGxA6dd4qBhwIcclQTwxwY31+Q3aXPNflugL8N/qs2Hsgx6MtTmY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] tools/xl: fix channel configuration setting
Message-Id: <E1tvH98-00BKTE-1a@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:45:22 +0000

commit 7c767b7093ad4f6f53760f84eef51d9ca585a7a0
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 20 13:17:41 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:17:41 2025 +0100

    tools/xl: fix channel configuration setting
    
    Channels work differently than other device types: their devid should
    be -1 initially in order to distinguish them from the primary console
    which has the devid of 0.
    
    So when parsing the channel configuration, use
    ARRAY_EXTEND_INIT_NODEVID() in order to avoid overwriting the devid
    set by libxl_device_channel_init().
    
    Fixes: 3a6679634766 ("libxl: set channel devid when not provided by application")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: e1ccced4afe465d6541c5825a0f8d1b8f5fa4253
    master date: 2025-03-05 16:37:37 +0100
---
 tools/xl/xl_parse.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index e3a4800f6e..9018efa117 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2387,8 +2387,9 @@ void parse_config_data(const char *config_source,
             char *path = NULL;
             int len;
 
-            chn = ARRAY_EXTEND_INIT(d_config->channels, d_config->num_channels,
-                                   libxl_device_channel_init);
+            chn = ARRAY_EXTEND_INIT_NODEVID(d_config->channels,
+                                            d_config->num_channels,
+                                            libxl_device_channel_init);
 
             split_string_into_string_list(buf, ",", &pairs);
             len = libxl_string_list_length(&pairs);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:45:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:45:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922367.1326241 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH9J-0002wJ-PF; Thu, 20 Mar 2025 14:45:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922367.1326241; Thu, 20 Mar 2025 14:45:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH9J-0002w9-MA; Thu, 20 Mar 2025 14:45:33 +0000
Received: by outflank-mailman (input) for mailman id 922367;
 Thu, 20 Mar 2025 14:45:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH9I-0002vw-KP
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:45:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH9I-00F23M-2i
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:45:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH9I-00BKUX-1r
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:45:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3BYunJNdhH2iHZALcx1JExLnt/+ihf1hVXXcgzxXWlw=; b=QysP6P8dq7pAJj+HEJcIkNnYMB
	YyVVYABszjGoee1xvV/KzC6HhOJRHOsUAC82cVCw6c0g/mlW8ks7+LNlCmalEBRCO7NsIib2Fk0Ct
	UYMQm0RGLYdvWOEImG4+s7qH8h+aX5oxpsxIIwKREjyuzQJC3G1b7h1/kBpu3Dj+i1Aw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/vlapic: Fix handling of writes to APIC_ESR
Message-Id: <E1tvH9I-00BKUX-1r@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:45:32 +0000

commit da239140a48eb9b2b30784ee5dd420b6f879d189
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:18:23 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:18:23 2025 +0100

    x86/vlapic: Fix handling of writes to APIC_ESR
    
    Xen currently presents APIC_ESR to guests as a simple read/write register.
    
    This is incorrect.  The SDM states:
    
      The ESR is a write/read register. Before attempt to read from the ESR,
      software should first write to it. (The value written does not affect the
      values read subsequently; only zero may be written in x2APIC mode.) This
      write clears any previously logged errors and updates the ESR with any
      errors detected since the last write to the ESR.
    
    Introduce a new pending_esr field in hvm_hw_lapic.
    
    Update vlapic_error() to accumulate errors here, and extend vlapic_reg_write()
    to discard the written value and transfer pending_esr into APIC_ESR.  Reads
    are still as before.
    
    Importantly, this means that guests no longer destroys the ESR value it's
    looking for in the LVTERR handler when following the SDM instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b28b590d4a23894672f1dd7fb98cdf9926ecb282
    master date: 2025-03-07 14:34:08 +0000
---
 xen/arch/x86/hvm/vlapic.c              | 17 +++++++++++++++--
 xen/include/public/arch-x86/hvm/save.h |  1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 46ff758904..f34bbfb3cc 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -108,7 +108,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     uint32_t esr;
 
     spin_lock_irqsave(&vlapic->esr_lock, flags);
-    esr = vlapic_get_reg(vlapic, APIC_ESR);
+    esr = vlapic->hw.pending_esr;
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
@@ -127,7 +127,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
                  errmask |= APIC_ESR_RECVILL;
         }
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+        vlapic->hw.pending_esr |= errmask;
 
         if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
@@ -799,6 +799,19 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         vlapic_set_reg(vlapic, APIC_ID, val);
         break;
 
+    case APIC_ESR:
+    {
+        unsigned long flags;
+
+        spin_lock_irqsave(&vlapic->esr_lock, flags);
+        val = vlapic->hw.pending_esr;
+        vlapic->hw.pending_esr = 0;
+        spin_unlock_irqrestore(&vlapic->esr_lock, flags);
+
+        vlapic_set_reg(vlapic, APIC_ESR, val);
+        break;
+    }
+
     case APIC_TASKPRI:
         vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff);
         break;
diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h
index 7ecacadde1..9c4bfc7ebd 100644
--- a/xen/include/public/arch-x86/hvm/save.h
+++ b/xen/include/public/arch-x86/hvm/save.h
@@ -394,6 +394,7 @@ struct hvm_hw_lapic {
     uint32_t             disabled; /* VLAPIC_xx_DISABLED */
     uint32_t             timer_divisor;
     uint64_t             tdt_msr;
+    uint32_t             pending_esr;
 };
 
 DECLARE_HVM_SAVE_TYPE(LAPIC, 5, struct hvm_hw_lapic);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:45:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:45:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922369.1326244 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH9U-000310-Rs; Thu, 20 Mar 2025 14:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922369.1326244; Thu, 20 Mar 2025 14:45:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH9U-00030s-P7; Thu, 20 Mar 2025 14:45:44 +0000
Received: by outflank-mailman (input) for mailman id 922369;
 Thu, 20 Mar 2025 14:45:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH9S-00030b-NU
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:45:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH9S-00F23U-2y
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:45:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH9S-00BKVt-27
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:45:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UrBB4eSzZe6zws036Db2pkQdTSg2UVZ/VsQH2pVcaxU=; b=052gXhVlQiBHXYtqTLezTgPWC4
	+n98+l7ieWvyKOZUfNdMPkeWnDEL55xlGARotrzN8QbqS0C2zSiMXDXkXufSzqwRXJDN7s2WoHlaR
	HIzaz8De/o8lfLlpT8dKulcliTF4LOZBY83F1ClhIaA4fxadlLdT4euWrxsJm780AmsI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
Message-Id: <E1tvH9S-00BKVt-27@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:45:42 +0000

commit 3c2b6175a1e49ea4e6fa0aec989ee49daf593558
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:18:46 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:18:46 2025 +0100

    x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
    
    The MMIO_CONF_BASE reports the base of the MCFG range on AMD systems.
    Linux pre-6.14 is unconditionally attempting to read the MSR without a
    safe MSR accessor, and since Xen doesn't allow access to it Linux reports
    the following error:
    
    unchecked MSR access error: RDMSR from 0xc0010058 at rIP: 0xffffffff8101d19f (xen_do_read_msr+0x7f/0xa0)
    Call Trace:
     xen_read_msr+0x1e/0x30
     amd_get_mmconfig_range+0x2b/0x80
     quirk_amd_mmconfig_area+0x28/0x100
     pnp_fixup_device+0x39/0x50
     __pnp_add_device+0xf/0x150
     pnp_add_device+0x3d/0x100
     pnpacpi_add_device_handler+0x1f9/0x280
     acpi_ns_get_device_callback+0x104/0x1c0
     acpi_ns_walk_namespace+0x1d0/0x260
     acpi_get_devices+0x8a/0xb0
     pnpacpi_init+0x50/0x80
     do_one_initcall+0x46/0x2e0
     kernel_init_freeable+0x1da/0x2f0
     kernel_init+0x16/0x1b0
     ret_from_fork+0x30/0x50
     ret_from_fork_asm+0x1b/0x30
    
    Such access is conditional to the presence of a device with PnP ID
    "PNP0c01", which triggers the execution of the quirk_amd_mmconfig_area()
    function.  Note that prior to commit 3fac3734c43a MSR accesses when running
    as a PV guest would always use the safe variant, and thus silently handle
    the #GP.
    
    Fix by allowing access to the MSR on AMD systems for the hardware domain.
    
    Write attempts to the MSR will still result in #GP for all domain types.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b4071d28c5bd9ca4fed76031cbf0e782b74209b9
    master date: 2025-03-12 13:32:30 +0100
---
 xen/arch/x86/msr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 289cf10b78..3f612ad27c 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -245,6 +245,14 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = 0;
         break;
 
+    case MSR_FAM10H_MMIO_CONF_BASE:
+        if ( !is_hardware_domain(d) ||
+             !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ||
+             rdmsr_safe(msr, *val) )
+            goto gp_fault;
+
+        break;
+
     case MSR_VIRT_SPEC_CTRL:
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:45:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:45:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922370.1326250 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH9e-00033m-TZ; Thu, 20 Mar 2025 14:45:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922370.1326250; Thu, 20 Mar 2025 14:45:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH9e-00033e-QT; Thu, 20 Mar 2025 14:45:54 +0000
Received: by outflank-mailman (input) for mailman id 922370;
 Thu, 20 Mar 2025 14:45:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH9c-00033O-Po
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:45:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH9d-00F23x-01
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:45:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH9c-00BKWZ-2P
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:45:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dxpgnvVDh7c8U+lGyD/OB8F0RZYg3nzKyD12qbtWwVY=; b=qjPCLm+FDRwATB8amyOvo8uCvO
	xDaSbLVWN1b95SGo7qCfpdzOunL4PvtfAUyWwVzsc3Knmn7V3MZasCUk81e/9MippFlzn4XUCaFgP
	IrNT9nXXoTPFNQo49AZyGDy6c06EV+oGAZdulRfAuh0tmU0VLgSYFoFPWgcPD8Rp3Tco=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/vmx: fix posted interrupts usage of msi_desc->msg field
Message-Id: <E1tvH9c-00BKWZ-2P@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:45:52 +0000

commit 037d3e77d7a6d06d97bd993d275510b8706cd60d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:19:17 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:19:17 2025 +0100

    x86/vmx: fix posted interrupts usage of msi_desc->msg field
    
    The current usage of msi_desc->msg in vmx_pi_update_irte() will make the
    field contain a translated MSI message, instead of the expected
    untranslated one.  This breaks dump_msi(), that use the data in
    msi_desc->msg to print the interrupt details.
    
    Fix this by introducing a dummy local msi_msg, and use it with
    iommu_update_ire_from_msi().  vmx_pi_update_irte() relies on the MSI
    message not changing, so there's no need to propagate the resulting msi_msg
    to the hardware, and the contents can be ignored.
    
    Additionally add a comment to clarify that msi_desc->msg must always
    contain the untranslated MSI message.
    
    Fixes: a5e25908d18d ('VT-d: introduce new fields in msi_desc to track binding with guest interrupt')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 30f0e55a79206702b4e82e86dad6b35033157858
    master date: 2025-03-12 13:32:30 +0100
---
 xen/arch/x86/hvm/vmx/vmx.c     | 4 +++-
 xen/arch/x86/include/asm/msi.h | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index f16faa6a61..cb2cc8aa28 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -396,6 +396,7 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     const struct pi_desc *pi_desc = v ? &v->arch.hvm.vmx.pi_desc : NULL;
     struct irq_desc *desc;
     struct msi_desc *msi_desc;
+    struct msi_msg msg;
     int rc;
 
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -410,12 +411,13 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     }
     msi_desc->pi_desc = pi_desc;
     msi_desc->gvec = gvec;
+    msg = msi_desc->msg;
 
     spin_unlock_irq(&desc->lock);
 
     ASSERT_PDEV_LIST_IS_READ_LOCKED(msi_desc->dev->domain);
 
-    return iommu_update_ire_from_msi(msi_desc, &msi_desc->msg);
+    return iommu_update_ire_from_msi(msi_desc, &msg);
 
  unlock_out:
     spin_unlock_irq(&desc->lock);
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 503c9447f6..6e6fedee74 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -124,7 +124,7 @@ struct msi_desc {
     int irq;
     int remap_index;         /* index in interrupt remapping table */
 
-    struct msi_msg msg;      /* Last set MSI message */
+    struct msi_msg msg;      /* Last set MSI message (untranslated) */
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:46:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:46:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922371.1326252 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH9o-00036v-UK; Thu, 20 Mar 2025 14:46:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922371.1326252; Thu, 20 Mar 2025 14:46:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH9o-00036n-Ro; Thu, 20 Mar 2025 14:46:04 +0000
Received: by outflank-mailman (input) for mailman id 922371;
 Thu, 20 Mar 2025 14:46:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH9m-00036b-SI
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:46:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH9n-00F24E-0H
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:46:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH9m-00BKYO-2f
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:46:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=no/BTgVExS5VvZYNiK2AmBtAlDP0jKMDsyOwiM2KJ5I=; b=xRhAG4ZQ0jAMWaag0dkUlSIqV8
	Xi/54DhJUJdBCqpoQU20bGJUupmDoQe1k7TYdTdDIm7sakdLL5w2xiu0IyYzSM9ErMz6kUMuw4x6c
	6fEPvLDPDEaVnvLQ9sQ0bh5VVCLJ+TNhYqMnmx5+axzCPN0qXPaWUXDb6JE7o0sXZjeA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/hvm: check return code of hvm_pi_update_irte when binding
Message-Id: <E1tvH9m-00BKYO-2f@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:46:02 +0000

commit 5e816eb950600a0f7c31f031a8f44c385f8c6b76
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:19:36 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:19:36 2025 +0100

    x86/hvm: check return code of hvm_pi_update_irte when binding
    
    Consume the return code from hvm_pi_update_irte(), and propagate the error
    back to the caller if hvm_pi_update_irte() fails.
    
    Fixes: 35a1caf8b6b5 ('pass-through: update IRTE according to guest interrupt config changes')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: cb587f620ab56cc683347d8120ba63989fad2693
    master date: 2025-03-12 13:32:31 +0100
---
 xen/drivers/passthrough/x86/hvm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index f5faff7a49..47de6953fd 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -381,7 +381,15 @@ int pt_irq_create_bind(
 
         /* Use interrupt posting if it is supported. */
         if ( iommu_intpost )
-            hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+        {
+            rc = hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+
+            if ( rc )
+            {
+                pt_irq_destroy_bind(d, pt_irq_bind);
+                return rc;
+            }
+        }
 
         if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:46:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:46:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922373.1326257 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH9y-00039v-Vk; Thu, 20 Mar 2025 14:46:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922373.1326257; Thu, 20 Mar 2025 14:46:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvH9y-00039n-TD; Thu, 20 Mar 2025 14:46:14 +0000
Received: by outflank-mailman (input) for mailman id 922373;
 Thu, 20 Mar 2025 14:46:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvH9w-00039d-Um
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:46:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH9x-00F24I-0W
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:46:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvH9w-00BKZJ-2u
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:46:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qJPRGVz2SCffApsdb1FFeHOISdqtYtGuMcaM0Ee9rAg=; b=1SE3dCFFjktyPU9OYTpAurmWRO
	Ax3vsIl4Amcu7syKFm5x1IBPECkQQSCZU+4Em+XSzzJ0hk68XllQRWageLqzTZukB9ozagNzrrHZe
	60U5JHMLQFn3Iy26LmCNL4Pv+UmS2zZj6FtzYlUDMswOyJw/eMwlxRxP1GPj02kse2FU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] libxl: avoid infinite loop in libxl__remove_directory()
Message-Id: <E1tvH9w-00BKZJ-2u@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:46:12 +0000

commit 3f73662226e82c67d79de950bfb4cf4ea83447ef
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 20 13:20:06 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:20:06 2025 +0100

    libxl: avoid infinite loop in libxl__remove_directory()
    
    Infinitely retrying the rmdir() invocation makes little sense. While the
    original observation was the log filling the disk (due to repeated
    "Directory not empty" errors, in turn occurring for unclear reasons),
    the loop wants breaking even if there was no error message being logged
    (much like is done in the similar loops in libxl__remove_file() and
    libxl__remove_file_or_directory()).
    
    Fixes: c4dcbee67e6d ("libxl: provide libxl__remove_file et al")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 68baeb5c4852e652b9599e049f40477edac4060e
    master date: 2025-03-13 10:23:10 +0100
---
 tools/libs/light/libxl_utils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_utils.c b/tools/libs/light/libxl_utils.c
index 506c5b5631..5ae8935344 100644
--- a/tools/libs/light/libxl_utils.c
+++ b/tools/libs/light/libxl_utils.c
@@ -577,6 +577,7 @@ int libxl__remove_directory(libxl__gc *gc, const char *dirpath)
         if (errno == EINTR) continue;
         LOGE(ERROR, "failed to remove emptied directory %s", dirpath);
         rc = ERROR_FAIL;
+        break;
     }
 
  out:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:46:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:46:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922374.1326261 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHA8-0003CZ-17; Thu, 20 Mar 2025 14:46:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922374.1326261; Thu, 20 Mar 2025 14:46:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHA7-0003CS-UX; Thu, 20 Mar 2025 14:46:23 +0000
Received: by outflank-mailman (input) for mailman id 922374;
 Thu, 20 Mar 2025 14:46:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHA7-0003CJ-1Z
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:46:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHA7-00F24a-0o
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:46:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHA6-00BKaE-3A
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:46:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NW0ehxTyy2pR+9Cy84p/So7JAdjfrvR7jBCbwhp9T6Y=; b=WZ2SDZn1Xx6j6Apq+F2UlCuW93
	yaQ3GaLWTz89B+5i3HptrWQYZ6iRBe2Q2vnIEHtJWv2v8a0ZWJkiDy7pStde9I4jG+tuBiNNNnbx6
	MRvbaXK7i/h3jo0Dtd4/2VsJtlsdr6pgqVZ27lA9EYIS+2yXyBiWWaoBozdndsXmtJvc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/sched: fix arinc653 to not use variables across cpupools
Message-Id: <E1tvHA6-00BKaE-3A@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:46:22 +0000

commit b65a10814a3693c521b09bef62b5a8f0ce737654
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 20 13:20:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:20:14 2025 +0100

    xen/sched: fix arinc653 to not use variables across cpupools
    
    a653sched_do_schedule() is using two function local static variables,
    which is resulting in bad behavior when using more than one cpupool
    with the arinc653 scheduler.
    
    Fix that by moving those variables to the scheduler private data.
    
    Fixes: 22787f2e107c ("ARINC 653 scheduler")
    Reported-by: Choi Anderson <Anderson.Choi@boeing.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
    master commit: d0561ac8ab0e780b1e8ab41d0d15e9f9b076dee3
    master date: 2025-03-14 10:17:11 +0100
---
 xen/common/sched/arinc653.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index a82c0d7314..9ebae6d7ae 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -143,6 +143,12 @@ typedef struct a653sched_priv_s
      * pointers to all Xen UNIT structures for iterating through
      */
     struct list_head unit_list;
+
+    /**
+     * scheduling house keeping variables
+     */
+    unsigned int sched_index;
+    s_time_t next_switch_time;
 } a653sched_priv_t;
 
 /**************************************************************************
@@ -513,8 +519,6 @@ a653sched_do_schedule(
     bool tasklet_work_scheduled)
 {
     struct sched_unit *new_task = NULL;
-    static unsigned int sched_index = 0;
-    static s_time_t next_switch_time;
     a653sched_priv_t *sched_priv = SCHED_PRIV(ops);
     const unsigned int cpu = sched_get_resource_cpu(smp_processor_id());
     unsigned long flags;
@@ -528,18 +532,19 @@ a653sched_do_schedule(
         /* time to enter a new major frame
          * the first time this function is called, this will be true */
         /* start with the first domain in the schedule */
-        sched_index = 0;
+        sched_priv->sched_index = 0;
         sched_priv->next_major_frame = now + sched_priv->major_frame;
-        next_switch_time = now + sched_priv->schedule[0].runtime;
+        sched_priv->next_switch_time = now + sched_priv->schedule[0].runtime;
     }
     else
     {
-        while ( (now >= next_switch_time)
-                && (sched_index < sched_priv->num_schedule_entries) )
+        while ( (now >= sched_priv->next_switch_time) &&
+                (sched_priv->sched_index < sched_priv->num_schedule_entries) )
         {
             /* time to switch to the next domain in this major frame */
-            sched_index++;
-            next_switch_time += sched_priv->schedule[sched_index].runtime;
+            sched_priv->sched_index++;
+            sched_priv->next_switch_time +=
+                sched_priv->schedule[sched_priv->sched_index].runtime;
         }
     }
 
@@ -547,8 +552,8 @@ a653sched_do_schedule(
      * If we exhausted the domains in the schedule and still have time left
      * in the major frame then switch next at the next major frame.
      */
-    if ( sched_index >= sched_priv->num_schedule_entries )
-        next_switch_time = sched_priv->next_major_frame;
+    if ( sched_priv->sched_index >= sched_priv->num_schedule_entries )
+        sched_priv->next_switch_time = sched_priv->next_major_frame;
 
     /*
      * If there are more domains to run in the current major frame, set
@@ -556,8 +561,8 @@ a653sched_do_schedule(
      * Otherwise, set new_task equal to the address of the idle task's
      * sched_unit structure.
      */
-    new_task = (sched_index < sched_priv->num_schedule_entries)
-        ? sched_priv->schedule[sched_index].unit
+    new_task = (sched_priv->sched_index < sched_priv->num_schedule_entries)
+        ? sched_priv->schedule[sched_priv->sched_index].unit
         : IDLETASK(cpu);
 
     /* Check to see if the new task can be run (awake & runnable). */
@@ -589,7 +594,7 @@ a653sched_do_schedule(
      * Return the amount of time the next domain has to run and the address
      * of the selected task's UNIT structure.
      */
-    prev->next_time = next_switch_time - now;
+    prev->next_time = sched_priv->next_switch_time - now;
     prev->next_task = new_task;
     new_task->migrated = false;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:46:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:46:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922375.1326264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHAI-0003FJ-2K; Thu, 20 Mar 2025 14:46:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922375.1326264; Thu, 20 Mar 2025 14:46:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHAH-0003FC-W7; Thu, 20 Mar 2025 14:46:33 +0000
Received: by outflank-mailman (input) for mailman id 922375;
 Thu, 20 Mar 2025 14:46:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHAH-0003F4-47
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:46:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHAH-00F24h-14
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:46:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHAH-00BKb0-0F
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:46:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4XrS4tQNf/b5GDFw45vhEvks5GoN8VkmXFNgz7rT7I8=; b=CRB87LEfu/9YDtaHNt2t4LNGM4
	WBNJ6Z54gzUDCqIGpSfMb1x9Bj+TZcs7cYHD+cf5KfyMlVDLos8Xvo3mDRMkS5BiXD3Er7ew7Md8S
	/SwPI/NXcdiOCr+vF4q+jULz7PlqzWZJ5FxDUzBlkMoc1mTvvt14rRNjFA46T6OuYr8U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/ioremap: prevent additions against the NULL pointer
Message-Id: <E1tvHAH-00BKb0-0F@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:46:33 +0000

commit 69754ede24a44c3c3aafdb77d4a203810f00ba9e
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:20:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:20:51 2025 +0100

    x86/ioremap: prevent additions against the NULL pointer
    
    This was reported by clang UBSAN as:
    
    UBSAN: Undefined behaviour in arch/x86/mm.c:6297:40
    applying zero offset to null pointer
    [...]
    Xen call trace:
        [<ffff82d040303662>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304aa3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0406ebbc0>] F ioremap_wc+0xc8/0xe0
        [<ffff82d0406c3728>] F video_init+0xd0/0x180
        [<ffff82d0406ab6f5>] F console_init_preirq+0x3d/0x220
        [<ffff82d0406f1876>] F __start_xen+0x68e/0x5530
        [<ffff82d04020482e>] F __high_start+0x8e/0x90
    
    Fix bt_ioremap() and ioremap{,_wc}() to not add the offset if the returned
    pointer from __vmap() is NULL.
    
    Fixes: d0d4635d034f ('implement vmap()')
    Fixes: f390941a92f1 ('x86/DMI: fix table mapping when one lives above 1Mb')
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9a6f2c52f75781acda39fab5cc96d1bcc54bf534
    master date: 2025-03-17 13:33:29 +0100
---
 xen/arch/x86/dmi_scan.c | 7 +++++--
 xen/arch/x86/mm.c       | 6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 81f80c053a..b517c068b8 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -113,6 +113,7 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
 {
     mfn_t mfn = _mfn(PFN_DOWN(addr));
     unsigned int offs = PAGE_OFFSET(addr);
+    void *va;
 
     if ( addr + len <= MB(1) )
         return __va(addr);
@@ -120,8 +121,10 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
     if ( system_state < SYS_STATE_boot )
         return __acpi_map_table(addr, len);
 
-    return __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
-                  VMAP_DEFAULT) + offs;
+    va = __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
+                VMAP_DEFAULT);
+
+    return va ? va + offs : NULL;
 }
 
 static void __init bt_iounmap(const void *ptr, unsigned int len)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index d65cf9fa71..2d9c7a5316 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -6015,7 +6015,9 @@ void __iomem *ioremap(paddr_t pa, size_t len)
         unsigned int offs = pa & (PAGE_SIZE - 1);
         unsigned int nr = PFN_UP(offs + len);
 
-        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT) + offs;
+        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT);
+        if ( va )
+            va += offs;
     }
 
     return (void __force __iomem *)va;
@@ -6032,7 +6034,7 @@ void __iomem *__init ioremap_wc(paddr_t pa, size_t len)
 
     va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_WC, VMAP_DEFAULT);
 
-    return (void __force __iomem *)(va + offs);
+    return (void __force __iomem *)(va ? va + offs : NULL);
 }
 
 int create_perdomain_mapping(struct domain *d, unsigned long va,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:46:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:46:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922376.1326269 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHAS-0003Hm-3v; Thu, 20 Mar 2025 14:46:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922376.1326269; Thu, 20 Mar 2025 14:46:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHAS-0003Hf-1I; Thu, 20 Mar 2025 14:46:44 +0000
Received: by outflank-mailman (input) for mailman id 922376;
 Thu, 20 Mar 2025 14:46:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHAR-0003HX-6y
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:46:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHAR-00F24l-1M
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:46:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHAR-00BKbp-0V
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:46:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AklpOvs8qkNjx5c9yzMMBdB6IALsY8QDyfq4FSpoEC0=; b=XmDfsVVolD+4rN13Df8dOecxXl
	MygX1Xcu2tzZsGOaHIDEpWzS2xlFNDeroHQcYUAwUFOmOj+yvZb1yjsMRfUqdRryw5CWFcFHU9j8E
	IDxgT996xwVtqMshrdjvHI4pJO68icjaAoW/K4rWtmLxrcfV90Yyuw13DWIsDn2CaEaA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
Message-Id: <E1tvHAR-00BKbp-0V@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:46:43 +0000

commit 4d91aaf3494ed7ef25c12564b3b3a4f8a933bc26
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:21:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:21:12 2025 +0100

    x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
    
    The current CI failures turn out to be a latent bug triggered by a narrow set
    of properties of the initrd and the host memory map, which CI encountered by
    chance.
    
    One step during boot involves constructing directmap mappings for modules.
    With some probing at the point of creation, it is observed that there's a 4k
    mapping missing towards the end of the initrd.
    
      (XEN) === Mapped Mod1 [0000000394001000, 00000003be1ff6dc] to Directmap
      (XEN) Probing paddr 394001000, va ffff830394001000
      (XEN) Probing paddr 3be1ff6db, va ffff8303be1ff6db
      (XEN) Probing paddr 3bdffffff, va ffff8303bdffffff
      (XEN) Probing paddr 3be001000, va ffff8303be001000
      (XEN) Probing paddr 3be000000, va ffff8303be000000
      (XEN) Early fatal page fault at e008:ffff82d04032014c (cr2=ffff8303be000000, ec=0000)
    
    The conditions for this bug appear to be map_pages_to_xen() call with a start
    address of exactly 4k beyond a 2M boundary, some number of full 2M pages, then
    a tail needing 4k pages.
    
    Anyway, the condition for spotting superpage boundaries in map_pages_to_xen()
    is wrong.  The IS_ALIGNED() macro expects a power of two for the alignment
    argument, and subtracts 1 itself.
    
    Fixing this causes the failing case to now boot.
    
    Fixes: 97fb6fcf26e8 ("x86/mm: introduce helpers to detect super page alignment")
    Debugged-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b07c7d63f9b587e4df5d71f6da9eaa433512c974
    master date: 2025-03-19 14:53:28 +0000
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 2d9c7a5316..c3e15a029b 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5236,7 +5236,7 @@ int map_pages_to_xen(
                                                                 \
     ASSERT(!mfn_eq(m_, INVALID_MFN));                           \
     IS_ALIGNED(PFN_DOWN(v) | mfn_x(m_),                         \
-               (1UL << (PAGETABLE_ORDER * ((n) - 1))) - 1);     \
+               1UL << (PAGETABLE_ORDER * ((n) - 1)));           \
 })
 #define IS_L2E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 2)
 #define IS_L3E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 3)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 14:46:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 14:46:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922377.1326272 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHAc-0003Kr-6r; Thu, 20 Mar 2025 14:46:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922377.1326272; Thu, 20 Mar 2025 14:46:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHAc-0003Kj-4K; Thu, 20 Mar 2025 14:46:54 +0000
Received: by outflank-mailman (input) for mailman id 922377;
 Thu, 20 Mar 2025 14:46:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHAb-0003Kb-9R
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 14:46:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHAb-00F25C-1b
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:46:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHAb-00BKck-0m
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 14:46:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sehBpQhyWDCO1y94QRZ5b05fHywRvXCO8s6CIWJ2+t8=; b=iLhmIy7UBYH9IjkFhtePNB/KeT
	RDbhZWTt5lBwYq4bnLd/vFz02cPsoNugm++mqizH35lV5lXAhFaaJeh2LAjjLXPNVwL3H8G7GH7lK
	xGveSsIjV2rubCzH15KoseNv80l+tZUWuDh6wX9ve/CHh07E+pEpG1dhV8llTfxxet6M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/arinc653: call xfree() with local IRQ enabled
Message-Id: <E1tvHAb-00BKck-0m@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 14:46:53 +0000

commit ce591a92ca50d2b8851469006a7d7824445b5dbc
Author:     Anderson Choi <anderson.choi@boeing.com>
AuthorDate: Thu Mar 20 13:21:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:21:30 2025 +0100

    xen/arinc653: call xfree() with local IRQ enabled
    
    xen panic is observed with the following configuration.
    
    1. Debug xen build (CONFIG_DEBUG=y)
    2. dom1 of an ARINC653 domain
    3. shutdown dom1 with xl command
    
    $ xl shutdown <domain_name>
    
    (XEN) ****************************************
    (XEN) Panic on CPU 2:
    (XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/xmalloc_tlsf.c:714
    (XEN) ****************************************
    
    panic was triggered since xfree() was called with local IRQ disabled and
    therefore assertion failed.
    
    Fix this by calling xfree() after local IRQ is enabled.
    
    Fixes: 19049f8d796a sched: fix locking in a653sched_free_vdata()
    Signed-off-by: Anderson Choi <anderson.choi@boeing.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
    master commit: 3ee55c9543fcf0b35593f030b53f56f3222046b7
    master date: 2025-03-19 16:44:00 +0000
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index 9ebae6d7ae..930361fa5c 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -463,10 +463,11 @@ a653sched_free_udata(const struct scheduler *ops, void *priv)
     if ( !is_idle_unit(av->unit) )
         list_del(&av->list);
 
-    xfree(av);
     update_schedule_units(ops);
 
     spin_unlock_irqrestore(&sched_priv->lock, flags);
+
+    xfree(av);
 }
 
 /**
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:00:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:00:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922431.1326306 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHNL-00086t-QW; Thu, 20 Mar 2025 15:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922431.1326306; Thu, 20 Mar 2025 15:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHNL-00086a-Nk; Thu, 20 Mar 2025 15:00:03 +0000
Received: by outflank-mailman (input) for mailman id 922431;
 Thu, 20 Mar 2025 15:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHNK-0007rT-K9
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHNK-00F2S4-1z
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHNK-00BMOm-18
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QIX77svLjJ7+AGq7a8CRpekji248NYx2fXdmYawWyys=; b=mQnu1xW0ZTQVGysDvCvIPqPXKy
	zqRarcT2k3j3OKqTOer5nEbJi3SVST+ih86Vb9FK4O91J2nphutfaNkgkEJ+Bkyuoxh97TRehLScr
	hIggAzK982PxtTuQTH81JglrxNDiXErpKpBSzKsPOPxrJ1XAvSSaFY+XT98nE9kZws4w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] xen/console: Fix truncation of panic() messages
Message-Id: <E1tvHNK-00BMOm-18@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:00:02 +0000

commit ede5afa3ce1e8b146e4912a806a44149823e0d6a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:28:42 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:28:42 2025 +0100

    xen/console: Fix truncation of panic() messages
    
    The panic() function uses a static buffer to format its arguments into, simply
    to emit the result via printk("%s", buf).  This buffer is not large enough for
    some existing users in Xen.  e.g.:
    
      (XEN) ****************************************
      (XEN) Panic on CPU 0:
      (XEN) Invalid device tree blob at physical address 0x46a00000.
      (XEN) The DTB must be 8-byte aligned and must not exceed 2 MB in size.
      (XEN)
      (XEN) Plea****************************************
    
    The remainder of this particular message is 'e check your bootloader.', but
    has been inherited by RISC-V from ARM.
    
    It is also pointless double buffering.  Implement vprintk() beside printk(),
    and use it directly rather than rendering into a local buffer, removing it as
    one source of message limitation.
    
    This marginally simplifies panic(), and drops a global used-once buffer.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 81f8b1dd9407e4a3d9dc058b7fbbc591168649ad
    master date: 2025-02-18 14:15:58 +0000
---
 xen/drivers/char/console.c | 21 +++++++++++++--------
 xen/include/xen/lib.h      |  2 ++
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 6b679c5eac..c08ac598fe 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -958,11 +958,17 @@ static void vprintk_common(const char *prefix, const char *fmt, va_list args)
     local_irq_restore(flags);
 }
 
+void vprintk(const char *fmt, va_list args)
+{
+    vprintk_common("(XEN) ", fmt, args);
+}
+
 void printk(const char *fmt, ...)
 {
     va_list args;
+
     va_start(args, fmt);
-    vprintk_common("(XEN) ", fmt, args);
+    vprintk(fmt, args);
     va_end(args);
 }
 
@@ -1266,23 +1272,22 @@ void panic(const char *fmt, ...)
     va_list args;
     unsigned long flags;
     static DEFINE_SPINLOCK(lock);
-    static char buf[128];
 
     spin_debug_disable();
     spinlock_profile_printall('\0');
     debugtrace_dump();
 
-    /* Protects buf[] and ensure multi-line message prints atomically. */
+    /* Ensure multi-line message prints atomically. */
     spin_lock_irqsave(&lock, flags);
 
-    va_start(args, fmt);
-    (void)vsnprintf(buf, sizeof(buf), fmt, args);
-    va_end(args);
-
     console_start_sync();
     printk("\n****************************************\n");
     printk("Panic on CPU %d:\n", smp_processor_id());
-    printk("%s", buf);
+
+    va_start(args, fmt);
+    vprintk(fmt, args);
+    va_end(args);
+
     printk("****************************************\n\n");
     if ( opt_noreboot )
         printk("Manual reset required ('noreboot' specified)\n");
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 8eef557dd5..612ad9323a 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -80,6 +80,8 @@ debugtrace_printk(const char *fmt, ...) {}
 #define _p(_x) ((void *)(unsigned long)(_x))
 extern void printk(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2)));
+void vprintk(const char *fmt, va_list args)
+    __attribute__ ((format (printf, 1, 0)));
 
 #define printk_once(fmt, args...)               \
 ({                                              \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:00:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922432.1326311 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHNV-0000EM-Rr; Thu, 20 Mar 2025 15:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922432.1326311; Thu, 20 Mar 2025 15:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHNV-0000EE-PD; Thu, 20 Mar 2025 15:00:13 +0000
Received: by outflank-mailman (input) for mailman id 922432;
 Thu, 20 Mar 2025 15:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHNU-0000E3-GZ
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHNU-00F2SA-2J
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHNU-00BMQQ-1Q
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sa8kWCaLHT+gnWvfy86EbRJbd2zhT7W75+UVcNK2GH0=; b=yr9vkuJQv9M57EvSeVV5pcL+Jh
	dwinuWwSItjyrASMrNrLGFLc65gxASNfZkqlgWzlr3cHU8N85SxNtmEpdyUVKR01fr++hOIwJaQMw
	qy5r1m5uruzkjEMnUin/EnK/aK/ApgVl/T10I25bahImvZfwv89AhyOtrbONHoMV9Dk4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] xen/memory: Make resource_max_frames() to return 0 on unknown type
Message-Id: <E1tvHNU-00BMQQ-1Q@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:00:12 +0000

commit 7ef8e820c45129eabf7fd59556b67ec1f76ae9e3
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Thu Mar 20 13:29:06 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:29:06 2025 +0100

    xen/memory: Make resource_max_frames() to return 0 on unknown type
    
    This is actually what the caller acquire_resource() expects on any kind
    of error (the comment on top of resource_max_frames() also suggests that).
    Otherwise, the caller will treat -errno as a valid value and propagate incorrect
    nr_frames to the VM. As a possible consequence, a VM trying to query a resource
    size of an unknown type will get the success result from the hypercall and obtain
    nr_frames 4294967201.
    
    Also, add an ASSERT_UNREACHABLE() in the default case of _acquire_resource(),
    normally we won't get to this point, as an unknown type will always be rejected
    earlier in resource_max_frames().
    
    Also, update test-resource app to verify that Xen can deal with invalid
    (unknown) resource type properly.
    
    Fixes: 9244528955de ("xen/memory: Fix acquire_resource size semantics")
    Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9b8708290002f0a4d0b363e0c66ce945f6b520bd
    master date: 2025-02-18 14:47:34 +0000
---
 tools/tests/resource/test-resource.c | 10 ++++++++++
 xen/common/memory.c                  |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
index 1b10be16a6..a7f2d04643 100644
--- a/tools/tests/resource/test-resource.c
+++ b/tools/tests/resource/test-resource.c
@@ -123,6 +123,16 @@ static void test_gnttab(uint32_t domid, unsigned int nr_frames,
         fail("    Fail: Managed to map gnttab v2 status frames in v1 mode\n");
         xenforeignmemory_unmap_resource(fh, res);
     }
+
+    /*
+     * If this check starts failing, you've found the right place to test your
+     * addition to the Acquire Resource infrastructure.
+     */
+    rc = xenforeignmemory_resource_size(fh, domid, 3, 0, &size);
+
+    /* Check that Xen rejected the resource type. */
+    if ( !rc )
+        fail("    Fail: Expected error on an invalid resource type, got success\n");
 }
 
 static void test_domain_configurations(void)
diff --git a/xen/common/memory.c b/xen/common/memory.c
index fa165ebc14..ae801a66e6 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1156,7 +1156,7 @@ static unsigned int resource_max_frames(const struct domain *d,
         return d->vmtrace_size >> PAGE_SHIFT;
 
     default:
-        return -EOPNOTSUPP;
+        return 0;
     }
 }
 
@@ -1239,6 +1239,7 @@ static int _acquire_resource(
         return acquire_vmtrace_buf(d, id, frame, nr_frames, mfn_list);
 
     default:
+        ASSERT_UNREACHABLE();
         return -EOPNOTSUPP;
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:00:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922433.1326315 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHNf-0000HC-TG; Thu, 20 Mar 2025 15:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922433.1326315; Thu, 20 Mar 2025 15:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHNf-0000Gz-Qe; Thu, 20 Mar 2025 15:00:23 +0000
Received: by outflank-mailman (input) for mailman id 922433;
 Thu, 20 Mar 2025 15:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHNe-0000Gd-JN
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHNe-00F2SE-2b
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHNe-00BMRN-1j
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Eyw0Ikz5wSvejI4R2ZVfRcUR4wZ1N+NwhUQrZk+7evU=; b=uum3zUxeODYGjd9CmMeXL1lp2N
	AiHAAIn5bssOag/MUA007ZxkxH/6MFZtzHdt+GlvtbGAk1iy6ezdMPH+Z/1PUXwtKDQ5Z6cZeyUIf
	vD2GPGmIKai1U0YxaDxW7+H8ZBdAescSu0ojzxQkuvLrsaNhHXjNj3GqF83z73BHxpBg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/svm: Separate STI and VMRUN instructions in svm_asm_do_resume()
Message-Id: <E1tvHNe-00BMRN-1j@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:00:22 +0000

commit 61923364d3417642554043c87b644a0d34537d70
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:29:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:29:57 2025 +0100

    x86/svm: Separate STI and VMRUN instructions in svm_asm_do_resume()
    
    There is a corner case in the VMRUN instruction where its INTR_SHADOW state
    leaks into guest state if a VMExit occurs before the VMRUN is complete.  An
    example of this could be taking #NPF due to event injection.
    
    Xen can safely execute STI anywhere between CLGI and VMRUN, as CLGI blocks
    external interrupts too.  However, an exception (while fatal) will appear to
    be in an irqs-on region (as GIF isn't considered), so position the STI after
    the speculation actions but prior to the GPR pops.
    
    Link: https://lore.kernel.org/all/CADH9ctBs1YPmE4aCfGPNBwA10cA8RuAk2gO7542DjMZgs4uzJQ@mail.gmail.com/
    Fixes: 66b245d9eaeb ("SVM: limit GIF=0 region")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c989ff614f6bad48b3bd4b32694f711b31c7b2d6
    master date: 2025-02-19 12:45:48 +0000
---
 xen/arch/x86/hvm/svm/entry.S | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index 5f318629b4..9fb457ad95 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -74,6 +74,14 @@ __UNLIKELY_END(nsvm_hap)
         ALTERNATIVE "", svm_vmentry_spec_ctrl, X86_FEATURE_SC_MSR_HVM
         ALTERNATIVE "", DO_SPEC_CTRL_DIV, X86_FEATURE_SC_DIV
 
+        /*
+         * Set EFLAGS.IF after CLGI covers us from real interrupts, but not
+         * immediately prior to VMRUN.  The VMRUN instruction leaks it's
+         * INTR_SHADOW into guest state if a VMExit occurs before VMRUN
+         * completes (e.g. taking #NPF during event injecting.)
+         */
+        sti
+
         pop  %r15
         pop  %r14
         pop  %r13
@@ -91,7 +99,6 @@ __UNLIKELY_END(nsvm_hap)
         pop  %rsi
         pop  %rdi
 
-        sti
         vmrun
 
         SAVE_ALL
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:00:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922434.1326319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHNp-0000K5-Uo; Thu, 20 Mar 2025 15:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922434.1326319; Thu, 20 Mar 2025 15:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHNp-0000Jx-S5; Thu, 20 Mar 2025 15:00:33 +0000
Received: by outflank-mailman (input) for mailman id 922434;
 Thu, 20 Mar 2025 15:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHNo-0000Jd-MO
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHNo-00F2SI-2s
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHNo-00BMSD-20
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hhLXfWnVWGxVg+HwNieP/SsK/00yqZoWi+JTNm7caG4=; b=pbAwARNrQ0z7uk/PFNTsMNSk9a
	cdO4g79kasHUW3ZjYArlxHOkPFLXthWuXP2vZmIQ+4NgutjJbHSfXoH+Rsj3ifxxY7lqOIUmBSZ5+
	4woHGh3Kpbs1PVzGr8vdO1BOrP4RUkkE7d3Tpa0WChWjFTJ9X9R/rx11R7Z/tjnE2Fwk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
Message-Id: <E1tvHNo-00BMSD-20@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:00:32 +0000

commit 5f640b62133137e114ce4dcfd72bb3a8fdcafdc0
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:30:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:30:30 2025 +0100

    x86/dom0: correctly set the maximum ->iomem_caps bound for PVH
    
    The logic in dom0_setup_permissions() sets the maximum bound in
    ->iomem_caps unconditionally using paddr_bits, which is not correct for HVM
    based domains.  Instead use domain_max_paddr_bits() to get the correct
    maximum paddr bits for each possible domain type.
    
    Switch to using PFN_DOWN() instead of PAGE_SHIFT, as that's shorter.
    
    Fixes: 53de839fb409 ('x86: constrain MFN range Dom0 may access')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a00e08799cc7657d2a1aca158f4ad43d4c9103e7
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 09fb8b063a..7a3e07c37b 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -475,7 +475,8 @@ int __init dom0_setup_permissions(struct domain *d)
 
     /* The hardware domain is initially permitted full I/O capabilities. */
     rc = ioports_permit_access(d, 0, 0xFFFF);
-    rc |= iomem_permit_access(d, 0UL, (1UL << (paddr_bits - PAGE_SHIFT)) - 1);
+    rc |= iomem_permit_access(d, 0UL,
+                              PFN_DOWN(1UL << paging_max_paddr_bits(d)) - 1);
     rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
 
     /* Modify I/O port access permissions. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:00:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922435.1326323 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHNz-0000QL-W7; Thu, 20 Mar 2025 15:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922435.1326323; Thu, 20 Mar 2025 15:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHNz-0000QD-TR; Thu, 20 Mar 2025 15:00:43 +0000
Received: by outflank-mailman (input) for mailman id 922435;
 Thu, 20 Mar 2025 15:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHNy-0000Om-PH
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHNy-00F2SM-3B
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHNy-00BMTd-2J
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AGC+hdoBAFZyx1CUSGI5hkGmevHZdoF7NL60h6eYBqw=; b=tOynDFWGnALxdclSdV3RBv4ks+
	mgwARzRcU9wyd//kA1znolsaauftyNDfPiXanQ04SEec9jQ6BEO5tVy5eRnTrjTXuiIogSkwGq80f
	E5xwx2+yDgghZ604GDuJWHLg4cC5CFnqvwBwjpIU9ThkU8gYFC8TE9YDQiU2W3PlLfYA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/dom0: be less restrictive with the Interrupt Address Range
Message-Id: <E1tvHNy-00BMTd-2J@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:00:42 +0000

commit 7ce2ec63b212440b5f6dd7c9673c38f31d9ee516
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:31:03 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:31:03 2025 +0100

    x86/dom0: be less restrictive with the Interrupt Address Range
    
    Xen currently prevents dom0 from creating CPU or IOMMU page-table mappings
    into the interrupt address range [0xfee00000, 0xfeefffff].  This range has
    two different purposes.  For accesses from the CPU is contains the default
    position of local APIC page at 0xfee00000.  For accesses from devices
    it's the MSI address range, so the address field in the MSI entries
    (usually) point to an address on that range to trigger an interrupt.
    
    There are reports of Lenovo Thinkpad devices placing what seems to be the
    UCSI shared mailbox at address 0xfeec2000 in the interrupt address range.
    Attempting to use that device with a Linux PV dom0 leads to an error when
    Linux kernel maps 0xfeec2000:
    
    RIP: e030:xen_mc_flush+0x1e8/0x2b0
     xen_leave_lazy_mmu+0x15/0x60
     vmap_range_noflush+0x408/0x6f0
     __ioremap_caller+0x20d/0x350
     acpi_os_map_iomem+0x1a3/0x1c0
     acpi_ex_system_memory_space_handler+0x229/0x3f0
     acpi_ev_address_space_dispatch+0x17e/0x4c0
     acpi_ex_access_region+0x28a/0x510
     acpi_ex_field_datum_io+0x95/0x5c0
     acpi_ex_extract_from_field+0x36b/0x4e0
     acpi_ex_read_data_from_field+0xcb/0x430
     acpi_ex_resolve_node_to_value+0x2e0/0x530
     acpi_ex_resolve_to_value+0x1e7/0x550
     acpi_ds_evaluate_name_path+0x107/0x170
     acpi_ds_exec_end_op+0x392/0x860
     acpi_ps_parse_loop+0x268/0xa30
     acpi_ps_parse_aml+0x221/0x5e0
     acpi_ps_execute_method+0x171/0x3e0
     acpi_ns_evaluate+0x174/0x5d0
     acpi_evaluate_object+0x167/0x440
     acpi_evaluate_dsm+0xb6/0x130
     ucsi_acpi_dsm+0x53/0x80
     ucsi_acpi_read+0x2e/0x60
     ucsi_register+0x24/0xa0
     ucsi_acpi_probe+0x162/0x1e3
     platform_probe+0x48/0x90
     really_probe+0xde/0x340
     __driver_probe_device+0x78/0x110
     driver_probe_device+0x1f/0x90
     __driver_attach+0xd2/0x1c0
     bus_for_each_dev+0x77/0xc0
     bus_add_driver+0x112/0x1f0
     driver_register+0x72/0xd0
     do_one_initcall+0x48/0x300
     do_init_module+0x60/0x220
     __do_sys_init_module+0x17f/0x1b0
     do_syscall_64+0x82/0x170
    
    Remove the restrictions to create mappings in the interrupt address range
    for dom0.  Note that the restriction to map the local APIC page is enforced
    separately, and that continues to be present.  Additionally make sure the
    emulated local APIC page is also not mapped, in case dom0 is using it.
    
    Note that even if the interrupt address range entries are populated in the
    IOMMU page-tables no device access will reach those pages.  Device accesses
    to the Interrupt Address Range will always be converted into Interrupt
    Messages and are not subject to DMA remapping.
    
    There's also the following restriction noted in Intel VT-d:
    
    > Software must not program paging-structure entries to remap any address to
    > the interrupt address range. Untranslated requests and translation requests
    > that result in an address in the interrupt range will be blocked with
    > condition code LGN.4 or SGN.8. Translated requests with an address in the
    > interrupt address range are treated as Unsupported Request (UR).
    
    Similarly for AMD-Vi:
    
    > Accesses to the interrupt address range (Table 3) are defined to go through
    > the interrupt remapping portion of the IOMMU and not through address
    > translation processing. Therefore, when a transaction is being processed as
    > an interrupt remapping operation, the transaction attribute of
    > pretranslated or untranslated is ignored.
    >
    > Software Note: The IOMMU should
    > not be configured such that an address translation results in a special
    > address such as the interrupt address range.
    
    However those restrictions don't apply to the identity mappings possibly
    created for dom0, since the interrupt address range is never subject to DMA
    remapping, and hence there's no output address after translation that
    belongs to the interrupt address range.
    
    Reported-by: Jürgen Groß <jgross@suse.com>
    Link: https://lore.kernel.org/xen-devel/baade0a7-e204-4743-bda1-282df74e5f89@suse.com/
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 381caa38850771ae218eb6f6d490dc02e40df964
    master date: 2025-03-05 10:26:46 +0100
---
 xen/arch/x86/dom0_build.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 7a3e07c37b..9e9d3cd07e 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -515,6 +515,13 @@ int __init dom0_setup_permissions(struct domain *d)
         mfn = paddr_to_pfn(mp_lapic_addr);
         rc |= iomem_deny_access(d, mfn, mfn);
     }
+    /* If using an emulated local APIC make sure its MMIO is unpopulated. */
+    if ( has_vlapic(d) )
+    {
+        /* Xen doesn't allow changing the local APIC MMIO window position. */
+        mfn = paddr_to_pfn(APIC_DEFAULT_PHYS_BASE);
+        rc |= iomem_deny_access(d, mfn, mfn);
+    }
     /* I/O APICs. */
     for ( i = 0; i < nr_ioapics; i++ )
     {
@@ -522,10 +529,6 @@ int __init dom0_setup_permissions(struct domain *d)
         if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
             rc |= iomem_deny_access(d, mfn, mfn);
     }
-    /* MSI range. */
-    rc |= iomem_deny_access(d, paddr_to_pfn(MSI_ADDR_BASE_LO),
-                            paddr_to_pfn(MSI_ADDR_BASE_LO +
-                                         MSI_ADDR_DEST_ID_MASK));
     /* HyperTransport range. */
     if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:00:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922436.1326327 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHOA-0000TF-3o; Thu, 20 Mar 2025 15:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922436.1326327; Thu, 20 Mar 2025 15:00:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHOA-0000T7-10; Thu, 20 Mar 2025 15:00:54 +0000
Received: by outflank-mailman (input) for mailman id 922436;
 Thu, 20 Mar 2025 15:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHO8-0000Sw-UL
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHO9-00F2Sg-0S
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHO8-00BMW0-2d
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jlJjziN7a643z4x1lzrdt1dEX5epMx5EElYi4xz0vXE=; b=v47NcMC7YyIRcp2GJPEDQSSij7
	ipwUhoWw6mXR68AIfM7NsXS901ycEdBfBa3HlLUCNeQqhwnidCtniPBEHNi4Xeohjbwx/yz5azRXK
	IJ5QyuhcGOp+rvrKvr+waffwcX2sHslOk5hkmFOLgW3BUlrezfv4UdT5BZ/87eEvGJsc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] tools/xl: fix channel configuration setting
Message-Id: <E1tvHO8-00BMW0-2d@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:00:52 +0000

commit b26965b4e58494911362b88f82a898162aee0a17
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 20 13:32:19 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:32:19 2025 +0100

    tools/xl: fix channel configuration setting
    
    Channels work differently than other device types: their devid should
    be -1 initially in order to distinguish them from the primary console
    which has the devid of 0.
    
    So when parsing the channel configuration, use
    ARRAY_EXTEND_INIT_NODEVID() in order to avoid overwriting the devid
    set by libxl_device_channel_init().
    
    Fixes: 3a6679634766 ("libxl: set channel devid when not provided by application")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: e1ccced4afe465d6541c5825a0f8d1b8f5fa4253
    master date: 2025-03-05 16:37:37 +0100
---
 tools/xl/xl_parse.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index ed983200c3..fd140e7424 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2368,8 +2368,9 @@ void parse_config_data(const char *config_source,
             char *path = NULL;
             int len;
 
-            chn = ARRAY_EXTEND_INIT(d_config->channels, d_config->num_channels,
-                                   libxl_device_channel_init);
+            chn = ARRAY_EXTEND_INIT_NODEVID(d_config->channels,
+                                            d_config->num_channels,
+                                            libxl_device_channel_init);
 
             split_string_into_string_list(buf, ",", &pairs);
             len = libxl_string_list_length(&pairs);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:01:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:01:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922437.1326331 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHOL-0000Zh-4x; Thu, 20 Mar 2025 15:01:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922437.1326331; Thu, 20 Mar 2025 15:01:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHOL-0000ZZ-2S; Thu, 20 Mar 2025 15:01:05 +0000
Received: by outflank-mailman (input) for mailman id 922437;
 Thu, 20 Mar 2025 15:01:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHOJ-0000Wk-0l
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:01:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHOJ-00F2Sy-0j
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHOI-00BMZI-37
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OSkWo7KO1TaUoBcqxuMaS0t87yMkh+BlSD6HleDkR/0=; b=2Qp2BqTz+Yhrd+1Tw8FnA79DQ0
	puNn/PcgGJKIDgzG6QuueSY/wLUCKBY2L/zSenbd8QmUaCJfprz777DcoxOY1ED6/cJNHUXN92YFQ
	+qrBMpjWTVuoQo/HtKNz1tmiMG2zJs0kXNJbpo6Z/XFcVnfDlcHrdBEqdHI8myX9noEo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/vlapic: Fix handling of writes to APIC_ESR
Message-Id: <E1tvHOI-00BMZI-37@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:01:02 +0000

commit 70b6b7cc100689c964b80b73511a61961c2e9a73
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:32:41 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:32:41 2025 +0100

    x86/vlapic: Fix handling of writes to APIC_ESR
    
    Xen currently presents APIC_ESR to guests as a simple read/write register.
    
    This is incorrect.  The SDM states:
    
      The ESR is a write/read register. Before attempt to read from the ESR,
      software should first write to it. (The value written does not affect the
      values read subsequently; only zero may be written in x2APIC mode.) This
      write clears any previously logged errors and updates the ESR with any
      errors detected since the last write to the ESR.
    
    Introduce a new pending_esr field in hvm_hw_lapic.
    
    Update vlapic_error() to accumulate errors here, and extend vlapic_reg_write()
    to discard the written value and transfer pending_esr into APIC_ESR.  Reads
    are still as before.
    
    Importantly, this means that guests no longer destroys the ESR value it's
    looking for in the LVTERR handler when following the SDM instructions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b28b590d4a23894672f1dd7fb98cdf9926ecb282
    master date: 2025-03-07 14:34:08 +0000
---
 xen/arch/x86/hvm/vlapic.c              | 17 +++++++++++++++--
 xen/include/public/arch-x86/hvm/save.h |  1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 70431ba438..9a7f1c911f 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -109,7 +109,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     uint32_t esr;
 
     spin_lock_irqsave(&vlapic->esr_lock, flags);
-    esr = vlapic_get_reg(vlapic, APIC_ESR);
+    esr = vlapic->hw.pending_esr;
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
@@ -128,7 +128,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
                  errmask |= APIC_ESR_RECVILL;
         }
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+        vlapic->hw.pending_esr |= errmask;
 
         if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
@@ -796,6 +796,19 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         vlapic_set_reg(vlapic, APIC_ID, val);
         break;
 
+    case APIC_ESR:
+    {
+        unsigned long flags;
+
+        spin_lock_irqsave(&vlapic->esr_lock, flags);
+        val = vlapic->hw.pending_esr;
+        vlapic->hw.pending_esr = 0;
+        spin_unlock_irqrestore(&vlapic->esr_lock, flags);
+
+        vlapic_set_reg(vlapic, APIC_ESR, val);
+        break;
+    }
+
     case APIC_TASKPRI:
         vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff);
         break;
diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h
index 7ecacadde1..9c4bfc7ebd 100644
--- a/xen/include/public/arch-x86/hvm/save.h
+++ b/xen/include/public/arch-x86/hvm/save.h
@@ -394,6 +394,7 @@ struct hvm_hw_lapic {
     uint32_t             disabled; /* VLAPIC_xx_DISABLED */
     uint32_t             timer_divisor;
     uint64_t             tdt_msr;
+    uint32_t             pending_esr;
 };
 
 DECLARE_HVM_SAVE_TYPE(LAPIC, 5, struct hvm_hw_lapic);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:01:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:01:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922438.1326335 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHOV-0000e2-6X; Thu, 20 Mar 2025 15:01:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922438.1326335; Thu, 20 Mar 2025 15:01:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHOV-0000du-3o; Thu, 20 Mar 2025 15:01:15 +0000
Received: by outflank-mailman (input) for mailman id 922438;
 Thu, 20 Mar 2025 15:01:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHOT-0000df-5H
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:01:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHOT-00F2T3-1B
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:01:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHOT-00BMa6-09
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:01:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HEEkPoZmf3P+VJOUZFae4R6U8BGTC6Ln7e931URZkjU=; b=BhwCKMR9rVlVfE5RjMRnEsfDmG
	mXZzqHi+/n8lw4bqLyxZ/k+I5LX1NUiDZUOJxo68NdB5Z6khm7kjPiUyDbzSMhujKVxO6r1MfSypQ
	gVMR9k1uFJjqJ7phyxNZ9ms5V3AUY0SkuPR/Om8de/LRW4rAF2BmEqZRlD7Vfcy0S/rI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
Message-Id: <E1tvHOT-00BMa6-09@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:01:13 +0000

commit e6219bc97e7df4b0a82f35f9b9bf0a3aed96e8d5
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:33:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:33:12 2025 +0100

    x86/msr: expose MSR_FAM10H_MMIO_CONF_BASE on AMD
    
    The MMIO_CONF_BASE reports the base of the MCFG range on AMD systems.
    Linux pre-6.14 is unconditionally attempting to read the MSR without a
    safe MSR accessor, and since Xen doesn't allow access to it Linux reports
    the following error:
    
    unchecked MSR access error: RDMSR from 0xc0010058 at rIP: 0xffffffff8101d19f (xen_do_read_msr+0x7f/0xa0)
    Call Trace:
     xen_read_msr+0x1e/0x30
     amd_get_mmconfig_range+0x2b/0x80
     quirk_amd_mmconfig_area+0x28/0x100
     pnp_fixup_device+0x39/0x50
     __pnp_add_device+0xf/0x150
     pnp_add_device+0x3d/0x100
     pnpacpi_add_device_handler+0x1f9/0x280
     acpi_ns_get_device_callback+0x104/0x1c0
     acpi_ns_walk_namespace+0x1d0/0x260
     acpi_get_devices+0x8a/0xb0
     pnpacpi_init+0x50/0x80
     do_one_initcall+0x46/0x2e0
     kernel_init_freeable+0x1da/0x2f0
     kernel_init+0x16/0x1b0
     ret_from_fork+0x30/0x50
     ret_from_fork_asm+0x1b/0x30
    
    Such access is conditional to the presence of a device with PnP ID
    "PNP0c01", which triggers the execution of the quirk_amd_mmconfig_area()
    function.  Note that prior to commit 3fac3734c43a MSR accesses when running
    as a PV guest would always use the safe variant, and thus silently handle
    the #GP.
    
    Fix by allowing access to the MSR on AMD systems for the hardware domain.
    
    Write attempts to the MSR will still result in #GP for all domain types.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b4071d28c5bd9ca4fed76031cbf0e782b74209b9
    master date: 2025-03-12 13:32:30 +0100
---
 xen/arch/x86/msr.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 9babd441f9..16eac6ae60 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -243,6 +243,14 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = 0;
         break;
 
+    case MSR_FAM10H_MMIO_CONF_BASE:
+        if ( !is_hardware_domain(d) ||
+             !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ||
+             rdmsr_safe(msr, *val) )
+            goto gp_fault;
+
+        break;
+
     case MSR_VIRT_SPEC_CTRL:
         if ( !cp->extd.virt_ssbd )
             goto gp_fault;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:01:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:01:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922439.1326338 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHOf-0000jz-7k; Thu, 20 Mar 2025 15:01:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922439.1326338; Thu, 20 Mar 2025 15:01:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHOf-0000jr-5D; Thu, 20 Mar 2025 15:01:25 +0000
Received: by outflank-mailman (input) for mailman id 922439;
 Thu, 20 Mar 2025 15:01:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHOd-0000hL-87
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:01:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHOd-00F2T7-1U
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:01:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHOd-00BMav-0d
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:01:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aihh4rdk88HBd4FyeNc6VkYc3PvTNfuXy2M6qvXtzcE=; b=KnaTw75MiYw32Z4vlHZNsN9LJi
	Hgy6Yq4Oi8dQhIGX3WySJtOfB1Dbg1WYGJCo4pG3GJi7SiYgfmkcF/xg55C+WEAIfclMt5HV4Zh4/
	MNc6bDfAnqkE2EMcssyWU5L1tkOMuYKWDOKzooraonQHGa16ZEDE9XsvQzW52hiQ8peo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/vmx: fix posted interrupts usage of msi_desc->msg field
Message-Id: <E1tvHOd-00BMav-0d@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:01:23 +0000

commit 0103cb6c1f1c5fe87c0feeea05d065c5eece6cd3
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:33:31 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:33:31 2025 +0100

    x86/vmx: fix posted interrupts usage of msi_desc->msg field
    
    The current usage of msi_desc->msg in vmx_pi_update_irte() will make the
    field contain a translated MSI message, instead of the expected
    untranslated one.  This breaks dump_msi(), that use the data in
    msi_desc->msg to print the interrupt details.
    
    Fix this by introducing a dummy local msi_msg, and use it with
    iommu_update_ire_from_msi().  vmx_pi_update_irte() relies on the MSI
    message not changing, so there's no need to propagate the resulting msi_msg
    to the hardware, and the contents can be ignored.
    
    Additionally add a comment to clarify that msi_desc->msg must always
    contain the untranslated MSI message.
    
    Fixes: a5e25908d18d ('VT-d: introduce new fields in msi_desc to track binding with guest interrupt')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 30f0e55a79206702b4e82e86dad6b35033157858
    master date: 2025-03-12 13:32:30 +0100
---
 xen/arch/x86/hvm/vmx/vmx.c     | 4 +++-
 xen/arch/x86/include/asm/msi.h | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index f410e509de..7c9659ece6 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -397,6 +397,7 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     const struct pi_desc *pi_desc = v ? &v->arch.hvm.vmx.pi_desc : NULL;
     struct irq_desc *desc;
     struct msi_desc *msi_desc;
+    struct msi_msg msg;
     int rc;
 
     desc = pirq_spin_lock_irq_desc(pirq, NULL);
@@ -411,12 +412,13 @@ static int cf_check vmx_pi_update_irte(const struct vcpu *v,
     }
     msi_desc->pi_desc = pi_desc;
     msi_desc->gvec = gvec;
+    msg = msi_desc->msg;
 
     spin_unlock_irq(&desc->lock);
 
     ASSERT(pcidevs_locked());
 
-    return iommu_update_ire_from_msi(msi_desc, &msi_desc->msg);
+    return iommu_update_ire_from_msi(msi_desc, &msg);
 
  unlock_out:
     spin_unlock_irq(&desc->lock);
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 5f5b499c82..9bf9d3e7c6 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -123,7 +123,7 @@ struct msi_desc {
     int irq;
     int remap_index;         /* index in interrupt remapping table */
 
-    struct msi_msg msg;      /* Last set MSI message */
+    struct msi_msg msg;      /* Last set MSI message (untranslated) */
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:01:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:01:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922440.1326342 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHOo-0000mE-9F; Thu, 20 Mar 2025 15:01:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922440.1326342; Thu, 20 Mar 2025 15:01:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHOo-0000m6-6j; Thu, 20 Mar 2025 15:01:34 +0000
Received: by outflank-mailman (input) for mailman id 922440;
 Thu, 20 Mar 2025 15:01:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHOn-0000m0-Ax
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:01:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHOn-00F2TE-1l
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:01:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHOn-00BMbh-0u
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:01:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M2lciwLWolOh8M73Ynvzg2pTCBSuYr/TQe3N4GQMqG8=; b=imsnSy7yST3T2uZvmIStdb7rcu
	tTnXBiPsbTi141yprXuHV85Xs781qNvVk/kXQOC9mp0tCNRlFWseZ8hATr9wyVpIT761a++EHNyH4
	ffLcP1gUrA0B/TBtjJHjgWO/HlbUcfXN+v+Py45G12JbGqbLyfX7s2ciRW9KBdNKBbHY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/hvm: check return code of hvm_pi_update_irte when binding
Message-Id: <E1tvHOn-00BMbh-0u@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:01:33 +0000

commit e757f535066061b15cae2b7130a82b15852efa84
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:33:52 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:33:52 2025 +0100

    x86/hvm: check return code of hvm_pi_update_irte when binding
    
    Consume the return code from hvm_pi_update_irte(), and propagate the error
    back to the caller if hvm_pi_update_irte() fails.
    
    Fixes: 35a1caf8b6b5 ('pass-through: update IRTE according to guest interrupt config changes')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: cb587f620ab56cc683347d8120ba63989fad2693
    master date: 2025-03-12 13:32:31 +0100
---
 xen/drivers/passthrough/x86/hvm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index f73292fd6c..6813107648 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -381,7 +381,15 @@ int pt_irq_create_bind(
 
         /* Use interrupt posting if it is supported. */
         if ( iommu_intpost )
-            hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+        {
+            rc = hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
+
+            if ( rc )
+            {
+                pt_irq_destroy_bind(d, pt_irq_bind);
+                return rc;
+            }
+        }
 
         if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:01:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:01:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922441.1326347 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHOy-0000oo-As; Thu, 20 Mar 2025 15:01:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922441.1326347; Thu, 20 Mar 2025 15:01:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHOy-0000og-87; Thu, 20 Mar 2025 15:01:44 +0000
Received: by outflank-mailman (input) for mailman id 922441;
 Thu, 20 Mar 2025 15:01:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHOx-0000oX-E6
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:01:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHOx-00F2TK-22
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:01:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHOx-00BMcO-1B
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:01:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X4Sh0eKOOv+TtVOuF4ZtiFkrQ1cgyK7r0Yf0aNML01s=; b=UJjy29COICx+91F/36fV8ZAX9M
	eocKdRgmbbHLpeTVLGiNtUYGZpxS57vKOJjgTVFe7YKM/fk9oyvPVyOkkuVTDsd6sJLLGsP63bEyQ
	nfWqFSj7WXwb6aLrFuvU1ngPw7qwr4aOBxtdrzgp1X0SxRcwbruCeV8el1b5JxFjSXfk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] libxl: avoid infinite loop in libxl__remove_directory()
Message-Id: <E1tvHOx-00BMcO-1B@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:01:43 +0000

commit 9adf83c9e52a06587b8bef7599c5b070b82f4466
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 20 13:34:15 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:34:15 2025 +0100

    libxl: avoid infinite loop in libxl__remove_directory()
    
    Infinitely retrying the rmdir() invocation makes little sense. While the
    original observation was the log filling the disk (due to repeated
    "Directory not empty" errors, in turn occurring for unclear reasons),
    the loop wants breaking even if there was no error message being logged
    (much like is done in the similar loops in libxl__remove_file() and
    libxl__remove_file_or_directory()).
    
    Fixes: c4dcbee67e6d ("libxl: provide libxl__remove_file et al")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 68baeb5c4852e652b9599e049f40477edac4060e
    master date: 2025-03-13 10:23:10 +0100
---
 tools/libs/light/libxl_utils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_utils.c b/tools/libs/light/libxl_utils.c
index e403bd9bcf..65ef196935 100644
--- a/tools/libs/light/libxl_utils.c
+++ b/tools/libs/light/libxl_utils.c
@@ -575,6 +575,7 @@ int libxl__remove_directory(libxl__gc *gc, const char *dirpath)
         if (errno == EINTR) continue;
         LOGE(ERROR, "failed to remove emptied directory %s", dirpath);
         rc = ERROR_FAIL;
+        break;
     }
 
  out:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:01:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:01:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922442.1326351 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHP8-0000sg-CI; Thu, 20 Mar 2025 15:01:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922442.1326351; Thu, 20 Mar 2025 15:01:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHP8-0000sZ-9f; Thu, 20 Mar 2025 15:01:54 +0000
Received: by outflank-mailman (input) for mailman id 922442;
 Thu, 20 Mar 2025 15:01:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHP7-0000sR-GN
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:01:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHP7-00F2Th-2I
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:01:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHP7-00BMdR-1R
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:01:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jTzbkfOVs6X/TD2/gyqpILBuGla+ZNJVRIx2cho06Cg=; b=Z/d+6oB62hpU4ngWewS+OK/KjP
	XV/M2h7SyNqy3yXZYbIsrhRruQ4V7lZ9QAYGb0XoEJCIGI1GbyNKUbyCb1jpRaoyWCi5JVweBhDyr
	3j78Zt268KIB+PJpizZTTaELeslzeZzp5lesMr+BsaM7s8tNpxlnN+TNV2kXYzVqfboU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] xen/sched: fix arinc653 to not use variables across cpupools
Message-Id: <E1tvHP7-00BMdR-1R@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:01:53 +0000

commit 8c1b4debf5fa09e630315c767890cfe715965e00
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Mar 20 13:34:45 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:34:45 2025 +0100

    xen/sched: fix arinc653 to not use variables across cpupools
    
    a653sched_do_schedule() is using two function local static variables,
    which is resulting in bad behavior when using more than one cpupool
    with the arinc653 scheduler.
    
    Fix that by moving those variables to the scheduler private data.
    
    Fixes: 22787f2e107c ("ARINC 653 scheduler")
    Reported-by: Choi Anderson <Anderson.Choi@boeing.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
    master commit: d0561ac8ab0e780b1e8ab41d0d15e9f9b076dee3
    master date: 2025-03-14 10:17:11 +0100
---
 xen/common/sched/arinc653.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index a82c0d7314..9ebae6d7ae 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -143,6 +143,12 @@ typedef struct a653sched_priv_s
      * pointers to all Xen UNIT structures for iterating through
      */
     struct list_head unit_list;
+
+    /**
+     * scheduling house keeping variables
+     */
+    unsigned int sched_index;
+    s_time_t next_switch_time;
 } a653sched_priv_t;
 
 /**************************************************************************
@@ -513,8 +519,6 @@ a653sched_do_schedule(
     bool tasklet_work_scheduled)
 {
     struct sched_unit *new_task = NULL;
-    static unsigned int sched_index = 0;
-    static s_time_t next_switch_time;
     a653sched_priv_t *sched_priv = SCHED_PRIV(ops);
     const unsigned int cpu = sched_get_resource_cpu(smp_processor_id());
     unsigned long flags;
@@ -528,18 +532,19 @@ a653sched_do_schedule(
         /* time to enter a new major frame
          * the first time this function is called, this will be true */
         /* start with the first domain in the schedule */
-        sched_index = 0;
+        sched_priv->sched_index = 0;
         sched_priv->next_major_frame = now + sched_priv->major_frame;
-        next_switch_time = now + sched_priv->schedule[0].runtime;
+        sched_priv->next_switch_time = now + sched_priv->schedule[0].runtime;
     }
     else
     {
-        while ( (now >= next_switch_time)
-                && (sched_index < sched_priv->num_schedule_entries) )
+        while ( (now >= sched_priv->next_switch_time) &&
+                (sched_priv->sched_index < sched_priv->num_schedule_entries) )
         {
             /* time to switch to the next domain in this major frame */
-            sched_index++;
-            next_switch_time += sched_priv->schedule[sched_index].runtime;
+            sched_priv->sched_index++;
+            sched_priv->next_switch_time +=
+                sched_priv->schedule[sched_priv->sched_index].runtime;
         }
     }
 
@@ -547,8 +552,8 @@ a653sched_do_schedule(
      * If we exhausted the domains in the schedule and still have time left
      * in the major frame then switch next at the next major frame.
      */
-    if ( sched_index >= sched_priv->num_schedule_entries )
-        next_switch_time = sched_priv->next_major_frame;
+    if ( sched_priv->sched_index >= sched_priv->num_schedule_entries )
+        sched_priv->next_switch_time = sched_priv->next_major_frame;
 
     /*
      * If there are more domains to run in the current major frame, set
@@ -556,8 +561,8 @@ a653sched_do_schedule(
      * Otherwise, set new_task equal to the address of the idle task's
      * sched_unit structure.
      */
-    new_task = (sched_index < sched_priv->num_schedule_entries)
-        ? sched_priv->schedule[sched_index].unit
+    new_task = (sched_priv->sched_index < sched_priv->num_schedule_entries)
+        ? sched_priv->schedule[sched_priv->sched_index].unit
         : IDLETASK(cpu);
 
     /* Check to see if the new task can be run (awake & runnable). */
@@ -589,7 +594,7 @@ a653sched_do_schedule(
      * Return the amount of time the next domain has to run and the address
      * of the selected task's UNIT structure.
      */
-    prev->next_time = next_switch_time - now;
+    prev->next_time = sched_priv->next_switch_time - now;
     prev->next_task = new_task;
     new_task->migrated = false;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:02:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:02:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922443.1326355 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHPI-0000xf-F8; Thu, 20 Mar 2025 15:02:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922443.1326355; Thu, 20 Mar 2025 15:02:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHPI-0000xX-CU; Thu, 20 Mar 2025 15:02:04 +0000
Received: by outflank-mailman (input) for mailman id 922443;
 Thu, 20 Mar 2025 15:02:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHPH-0000xM-J4
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:02:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHPH-00F2U6-2Z
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:02:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHPH-00BMf1-1j
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:02:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZwGENnbpclBZPXvlRCuUS+NyKhIAarLanF7psnchTzg=; b=nWTqnsr5uPbTEMf1Oz53oHJQMG
	jymJADe34boBVeKy0PN+zsSxlNKcI0EBvFr1qvzcQDESmeW2gTw5D9233zXfOxmOmLeeinv644Fqi
	KoJhQzR9oviHdjgZ1qnuO7agvV3C7Z9KEFttZjh4hBS4+U4Gq0lB5iWHm6uHC9tdL5WU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/ioremap: prevent additions against the NULL pointer
Message-Id: <E1tvHPH-00BMf1-1j@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:02:03 +0000

commit ca799f1baafc059a9d8708e7e6ca9ea4f8e893ed
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 20 13:35:04 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:35:04 2025 +0100

    x86/ioremap: prevent additions against the NULL pointer
    
    This was reported by clang UBSAN as:
    
    UBSAN: Undefined behaviour in arch/x86/mm.c:6297:40
    applying zero offset to null pointer
    [...]
    Xen call trace:
        [<ffff82d040303662>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304aa3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0406ebbc0>] F ioremap_wc+0xc8/0xe0
        [<ffff82d0406c3728>] F video_init+0xd0/0x180
        [<ffff82d0406ab6f5>] F console_init_preirq+0x3d/0x220
        [<ffff82d0406f1876>] F __start_xen+0x68e/0x5530
        [<ffff82d04020482e>] F __high_start+0x8e/0x90
    
    Fix bt_ioremap() and ioremap{,_wc}() to not add the offset if the returned
    pointer from __vmap() is NULL.
    
    Fixes: d0d4635d034f ('implement vmap()')
    Fixes: f390941a92f1 ('x86/DMI: fix table mapping when one lives above 1Mb')
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 9a6f2c52f75781acda39fab5cc96d1bcc54bf534
    master date: 2025-03-17 13:33:29 +0100
---
 xen/arch/x86/dmi_scan.c | 7 +++++--
 xen/arch/x86/mm.c       | 6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 81f80c053a..b517c068b8 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -113,6 +113,7 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
 {
     mfn_t mfn = _mfn(PFN_DOWN(addr));
     unsigned int offs = PAGE_OFFSET(addr);
+    void *va;
 
     if ( addr + len <= MB(1) )
         return __va(addr);
@@ -120,8 +121,10 @@ static const void *__init bt_ioremap(paddr_t addr, unsigned int len)
     if ( system_state < SYS_STATE_boot )
         return __acpi_map_table(addr, len);
 
-    return __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
-                  VMAP_DEFAULT) + offs;
+    va = __vmap(&mfn, PFN_UP(offs + len), 1, 1, PAGE_HYPERVISOR_RO,
+                VMAP_DEFAULT);
+
+    return va ? va + offs : NULL;
 }
 
 static void __init bt_iounmap(const void *ptr, unsigned int len)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 2f0e586463..1454a18fc2 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5994,7 +5994,9 @@ void __iomem *ioremap(paddr_t pa, size_t len)
         unsigned int offs = pa & (PAGE_SIZE - 1);
         unsigned int nr = PFN_UP(offs + len);
 
-        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT) + offs;
+        va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_UCMINUS, VMAP_DEFAULT);
+        if ( va )
+            va += offs;
     }
 
     return (void __force __iomem *)va;
@@ -6011,7 +6013,7 @@ void __iomem *__init ioremap_wc(paddr_t pa, size_t len)
 
     va = __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_WC, VMAP_DEFAULT);
 
-    return (void __force __iomem *)(va + offs);
+    return (void __force __iomem *)(va ? va + offs : NULL);
 }
 
 int create_perdomain_mapping(struct domain *d, unsigned long va,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:02:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:02:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922444.1326358 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHPS-000107-GV; Thu, 20 Mar 2025 15:02:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922444.1326358; Thu, 20 Mar 2025 15:02:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHPS-000101-Du; Thu, 20 Mar 2025 15:02:14 +0000
Received: by outflank-mailman (input) for mailman id 922444;
 Thu, 20 Mar 2025 15:02:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHPR-0000zv-M6
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:02:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHPR-00F2UC-2s
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:02:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHPR-00BMgD-21
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:02:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/s01/lQ/arIfoTpr7er7FYA/O53AkhzmastG6AqmUsI=; b=shVFPl+AY8KUkFymqEnzfpgHke
	gBg/pwW4DXuzHioONFx+EW4JtsEnpVrMfav7pkSNo2QcyczHCurbIWEd4tJmwRoICP1ODj0zHY9Ns
	Vg/AeeEuFecitm1lUf/PJEhSS5F1zOJPNn09Q1CTAtPSVP0vAag+/uQxWbDM43mdzKKo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
Message-Id: <E1tvHPR-00BMgD-21@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:02:13 +0000

commit 9523aaf3711d0ccb3756f0e655e30b470bd390d0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 13:35:23 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:35:23 2025 +0100

    x86/mm: Fix IS_ALIGNED() check in IS_LnE_ALIGNED()
    
    The current CI failures turn out to be a latent bug triggered by a narrow set
    of properties of the initrd and the host memory map, which CI encountered by
    chance.
    
    One step during boot involves constructing directmap mappings for modules.
    With some probing at the point of creation, it is observed that there's a 4k
    mapping missing towards the end of the initrd.
    
      (XEN) === Mapped Mod1 [0000000394001000, 00000003be1ff6dc] to Directmap
      (XEN) Probing paddr 394001000, va ffff830394001000
      (XEN) Probing paddr 3be1ff6db, va ffff8303be1ff6db
      (XEN) Probing paddr 3bdffffff, va ffff8303bdffffff
      (XEN) Probing paddr 3be001000, va ffff8303be001000
      (XEN) Probing paddr 3be000000, va ffff8303be000000
      (XEN) Early fatal page fault at e008:ffff82d04032014c (cr2=ffff8303be000000, ec=0000)
    
    The conditions for this bug appear to be map_pages_to_xen() call with a start
    address of exactly 4k beyond a 2M boundary, some number of full 2M pages, then
    a tail needing 4k pages.
    
    Anyway, the condition for spotting superpage boundaries in map_pages_to_xen()
    is wrong.  The IS_ALIGNED() macro expects a power of two for the alignment
    argument, and subtracts 1 itself.
    
    Fixing this causes the failing case to now boot.
    
    Fixes: 97fb6fcf26e8 ("x86/mm: introduce helpers to detect super page alignment")
    Debugged-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b07c7d63f9b587e4df5d71f6da9eaa433512c974
    master date: 2025-03-19 14:53:28 +0000
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 1454a18fc2..a17d024f2a 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5219,7 +5219,7 @@ int map_pages_to_xen(
                                                                 \
     ASSERT(!mfn_eq(m_, INVALID_MFN));                           \
     IS_ALIGNED(PFN_DOWN(v) | mfn_x(m_),                         \
-               (1UL << (PAGETABLE_ORDER * ((n) - 1))) - 1);     \
+               1UL << (PAGETABLE_ORDER * ((n) - 1)));           \
 })
 #define IS_L2E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 2)
 #define IS_L3E_ALIGNED(v, m) IS_LnE_ALIGNED(v, m, 3)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 20 15:02:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Mar 2025 15:02:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.922445.1326362 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHPc-00013m-I4; Thu, 20 Mar 2025 15:02:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 922445.1326362; Thu, 20 Mar 2025 15:02:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvHPc-00013e-FQ; Thu, 20 Mar 2025 15:02:24 +0000
Received: by outflank-mailman (input) for mailman id 922445;
 Thu, 20 Mar 2025 15:02:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvHPb-00013W-Of
 for xen-changelog@lists.xenproject.org; Thu, 20 Mar 2025 15:02:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHPb-00F2UK-38
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:02:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvHPb-00BMhO-2I
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Mar 2025 15:02:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=E4A6KEclBhFi4Bd5SUbiNkOgkBL6AxY4bEaa4qWKOp4=; b=Z824786VogWTi+ipXkls6LUAwq
	QCXNJb3KdJyU3D1PmADyBk7iRyS9Wsw+6CLnyfSGL+dvFVsmtFZ7nPV4BKgJGLS16NeR5F0U6v/AS
	sel2y2ZTzeVzXM4d9KAzWduJB1bP/nI4uQhZGH42l578pzJkN9UenRXQFwZrKlQJSNjI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] xen/arinc653: call xfree() with local IRQ enabled
Message-Id: <E1tvHPb-00BMhO-2I@xenbits.xenproject.org>
Date: Thu, 20 Mar 2025 15:02:23 +0000

commit 7dc271d2e6efe7252562a96149d0857538a124f3
Author:     Anderson Choi <anderson.choi@boeing.com>
AuthorDate: Thu Mar 20 13:35:40 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 20 13:35:40 2025 +0100

    xen/arinc653: call xfree() with local IRQ enabled
    
    xen panic is observed with the following configuration.
    
    1. Debug xen build (CONFIG_DEBUG=y)
    2. dom1 of an ARINC653 domain
    3. shutdown dom1 with xl command
    
    $ xl shutdown <domain_name>
    
    (XEN) ****************************************
    (XEN) Panic on CPU 2:
    (XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/xmalloc_tlsf.c:714
    (XEN) ****************************************
    
    panic was triggered since xfree() was called with local IRQ disabled and
    therefore assertion failed.
    
    Fix this by calling xfree() after local IRQ is enabled.
    
    Fixes: 19049f8d796a sched: fix locking in a653sched_free_vdata()
    Signed-off-by: Anderson Choi <anderson.choi@boeing.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
    master commit: 3ee55c9543fcf0b35593f030b53f56f3222046b7
    master date: 2025-03-19 16:44:00 +0000
---
 xen/common/sched/arinc653.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index 9ebae6d7ae..930361fa5c 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -463,10 +463,11 @@ a653sched_free_udata(const struct scheduler *ops, void *priv)
     if ( !is_idle_unit(av->unit) )
         list_del(&av->list);
 
-    xfree(av);
     update_schedule_units(ops);
 
     spin_unlock_irqrestore(&sched_priv->lock, flags);
+
+    xfree(av);
 }
 
 /**
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 10:44:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 10:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.923888.1327269 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvZr9-0008FR-Co; Fri, 21 Mar 2025 10:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 923888.1327269; Fri, 21 Mar 2025 10:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvZr9-0008FJ-A3; Fri, 21 Mar 2025 10:44:03 +0000
Received: by outflank-mailman (input) for mailman id 923888;
 Fri, 21 Mar 2025 10:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvZr8-0008FD-9V
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 10:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvZr8-00GzWn-13
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 10:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvZr7-00Dugh-3A
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 10:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h59tlXJDMVo3JcNu5DT+MEKqfO8hQOp1pRKBxRfkxKQ=; b=Zd8d9dxhS/sY/tSLNW9VoCTxzN
	K5q9z16IpGM71Oh6hWXstpaqn94yG22AG8eMMZTAFIBXiIx/+bnCWWPGrKPy6xQsgbARdV4Zd133y
	XTSx5X4uZx3llUB3vz/fV28dp3IA40Y2wR/SXireaFVQypGLlEz6lt7oTXtnAJ6E2NAo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vga: fix mapping of the VGA text buffer
Message-Id: <E1tvZr7-00Dugh-3A@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 10:44:01 +0000

commit 1ca5f69e35548e5196eadb329e5a3976821dc982
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 17 18:51:21 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 17:16:10 2025 +0100

    x86/vga: fix mapping of the VGA text buffer
    
    The call to ioremap_wc() in video_init() will always fail, because
    video_init() is called ahead of vm_init_type(), and so the underlying
    __vmap() call will fail to allocate the linear address space.
    
    Fix by reverting to the previous behavior and use __va() for the VGA text
    buffer, as it's below the 1MB boundary, and thus always mapped in the
    directmap.
    
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/video/vga.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/drivers/video/vga.c b/xen/drivers/video/vga.c
index b4d0183261..b577b24619 100644
--- a/xen/drivers/video/vga.c
+++ b/xen/drivers/video/vga.c
@@ -71,7 +71,7 @@ void __init video_init(void)
     {
     case XEN_VGATYPE_TEXT_MODE_3:
         if ( page_is_ram_type(paddr_to_pfn(0xB8000), RAM_TYPE_CONVENTIONAL) ||
-             ((video = ioremap_wc(0xB8000, 0x8000)) == NULL) )
+             ((video = __va(0xB8000)) == NULL) )
             return;
         outw(0x200a, 0x3d4); /* disable cursor */
         columns = vga_console_info.u.text_mode_3.columns;
@@ -158,7 +158,6 @@ void __init video_endboot(void)
         if ( !vgacon_keep )
         {
             memset(video, 0, columns * lines * 2);
-            iounmap(video);
             video = ZERO_BLOCK_PTR;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 10:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 10:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.923889.1327272 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvZrJ-0008H5-Du; Fri, 21 Mar 2025 10:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 923889.1327272; Fri, 21 Mar 2025 10:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvZrJ-0008Gy-BN; Fri, 21 Mar 2025 10:44:13 +0000
Received: by outflank-mailman (input) for mailman id 923889;
 Fri, 21 Mar 2025 10:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvZrI-0008Go-8t
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 10:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvZrI-00GzXE-1M
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 10:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvZrI-00Dujd-0S
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 10:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wQq2NvEOjgCCQaifaqOnjh82XuFmdLkdN6zw5OHdm0c=; b=K8HaA8IFJsdtl3XD8HLPuI9bxg
	olBzAKA1Du2BcbFKcV4VzoAMi3q2/TW5uNE9+4JGMzlqjZLMBx92Txc1Bog8K3rnXdInR1sJS/N3i
	vyq5foPHuXSaeYtpRIwp3cJQURfh9rJSEyQbgsc6eB3Ihic8mfoR6o2NVEBWgFy2I2tM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] kconfig/randconfig: enable UBSAN for randconfig
Message-Id: <E1tvZrI-00Dujd-0S@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 10:44:12 +0000

commit 6a804ff8b469a6f992e95eab720c99fe00622ab0
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 12 18:51:43 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 17:16:18 2025 +0100

    kconfig/randconfig: enable UBSAN for randconfig
    
    Introduce an additional Kconfig check to only offer the option if the
    compiler supports -fsanitize=undefined.
    
    We no longer use Travis CI, so the original motivation for not enabling
    UBSAN might no longer present.  Regardless, the option won't be present in
    the first place if the compiler doesn't support -fsanitize=undefined.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/Kconfig                        | 4 ++++
 xen/Kconfig.debug                  | 2 +-
 xen/tools/kconfig/allrandom.config | 1 -
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/Kconfig b/xen/Kconfig
index 72fdb83760..2128f0ccfc 100644
--- a/xen/Kconfig
+++ b/xen/Kconfig
@@ -37,6 +37,10 @@ config CC_HAS_VISIBILITY_ATTRIBUTE
 config CC_SPLIT_SECTIONS
 	bool
 
+# Compiler supports -fsanitize=undefined
+config CC_HAS_UBSAN
+	def_bool $(cc-option,-fsanitize=undefined)
+
 # Set code alignment.
 #
 # Allow setting on a boolean basis, and then convert such selection to an
diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index c4a8d86912..f7cc5ffaab 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -98,7 +98,7 @@ config SCRUB_DEBUG
 
 config UBSAN
 	bool "Undefined behaviour sanitizer"
-	depends on HAS_UBSAN
+	depends on HAS_UBSAN && CC_HAS_UBSAN
 	help
 	  Enable undefined behaviour sanitizer. It uses compiler to insert code
 	  snippets so that undefined behaviours in C are detected during runtime.
diff --git a/xen/tools/kconfig/allrandom.config b/xen/tools/kconfig/allrandom.config
index 76f74320b5..c7753ac4ad 100644
--- a/xen/tools/kconfig/allrandom.config
+++ b/xen/tools/kconfig/allrandom.config
@@ -1,4 +1,3 @@
 # Explicit option choices not subject to regular RANDCONFIG
 
 CONFIG_GCOV_FORMAT_AUTODETECT=y
-CONFIG_UBSAN=n
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 11:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 11:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.923948.1327307 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvaxr-0007NX-4G; Fri, 21 Mar 2025 11:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 923948.1327307; Fri, 21 Mar 2025 11:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvaxr-0007NP-1i; Fri, 21 Mar 2025 11:55:03 +0000
Received: by outflank-mailman (input) for mailman id 923948;
 Fri, 21 Mar 2025 11:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvaxq-0007NJ-6W
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 11:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvaxq-00H1BD-0o
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 11:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvaxp-00E522-36
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 11:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Hl6muhc225xV+kVojjHpB2UnzIMASzK4/ThzxtlIbBo=; b=ugtM9lNSRcF4p9S/irK2/RzDQ8
	WvndU5TmFXFLIfM01zLBv/YxFZyrFmNIwHDQ7AL5a7DdmqCeCzdBfPXj6eZ+qYnhJt44tPSm6iL9s
	QKIk2f4m9mllqheflibN+BJMqOwKxCubIajsZGyxLXu7KyjIdt6Zl0E42of9FgeMZPO4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vga: fix mapping of the VGA text buffer
Message-Id: <E1tvaxp-00E522-36@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 11:55:01 +0000

commit 1ca5f69e35548e5196eadb329e5a3976821dc982
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 17 18:51:21 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 17:16:10 2025 +0100

    x86/vga: fix mapping of the VGA text buffer
    
    The call to ioremap_wc() in video_init() will always fail, because
    video_init() is called ahead of vm_init_type(), and so the underlying
    __vmap() call will fail to allocate the linear address space.
    
    Fix by reverting to the previous behavior and use __va() for the VGA text
    buffer, as it's below the 1MB boundary, and thus always mapped in the
    directmap.
    
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/video/vga.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/drivers/video/vga.c b/xen/drivers/video/vga.c
index b4d0183261..b577b24619 100644
--- a/xen/drivers/video/vga.c
+++ b/xen/drivers/video/vga.c
@@ -71,7 +71,7 @@ void __init video_init(void)
     {
     case XEN_VGATYPE_TEXT_MODE_3:
         if ( page_is_ram_type(paddr_to_pfn(0xB8000), RAM_TYPE_CONVENTIONAL) ||
-             ((video = ioremap_wc(0xB8000, 0x8000)) == NULL) )
+             ((video = __va(0xB8000)) == NULL) )
             return;
         outw(0x200a, 0x3d4); /* disable cursor */
         columns = vga_console_info.u.text_mode_3.columns;
@@ -158,7 +158,6 @@ void __init video_endboot(void)
         if ( !vgacon_keep )
         {
             memset(video, 0, columns * lines * 2);
-            iounmap(video);
             video = ZERO_BLOCK_PTR;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 11:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 11:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.923949.1327311 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvay1-0007PE-6F; Fri, 21 Mar 2025 11:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 923949.1327311; Fri, 21 Mar 2025 11:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvay1-0007P6-35; Fri, 21 Mar 2025 11:55:13 +0000
Received: by outflank-mailman (input) for mailman id 923949;
 Fri, 21 Mar 2025 11:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvay0-0007Ow-6d
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 11:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvay0-00H1BZ-16
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 11:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvay0-00E552-0E
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 11:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Exg9yjaQd35zd8YtLWGrV1Sq/gXOpIcbVOhS3pGRpHk=; b=OTX7fjriKwV8Sifii/gFBRTmzZ
	/K8047raELf5CuFelAkX/b+F/82ub/kGbXuV9qhIQLCzztdtQ0SdikcSHyurCuMOdv/q/wiGfW0dE
	RjeZvofwzJ+GOmPcyQJXdJi887Sy+xWRGZIZx3JVoye49ur2JELIPwWuNCvHosAIAY2E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] kconfig/randconfig: enable UBSAN for randconfig
Message-Id: <E1tvay0-00E552-0E@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 11:55:12 +0000

commit 6a804ff8b469a6f992e95eab720c99fe00622ab0
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 12 18:51:43 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Thu Mar 20 17:16:18 2025 +0100

    kconfig/randconfig: enable UBSAN for randconfig
    
    Introduce an additional Kconfig check to only offer the option if the
    compiler supports -fsanitize=undefined.
    
    We no longer use Travis CI, so the original motivation for not enabling
    UBSAN might no longer present.  Regardless, the option won't be present in
    the first place if the compiler doesn't support -fsanitize=undefined.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/Kconfig                        | 4 ++++
 xen/Kconfig.debug                  | 2 +-
 xen/tools/kconfig/allrandom.config | 1 -
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/Kconfig b/xen/Kconfig
index 72fdb83760..2128f0ccfc 100644
--- a/xen/Kconfig
+++ b/xen/Kconfig
@@ -37,6 +37,10 @@ config CC_HAS_VISIBILITY_ATTRIBUTE
 config CC_SPLIT_SECTIONS
 	bool
 
+# Compiler supports -fsanitize=undefined
+config CC_HAS_UBSAN
+	def_bool $(cc-option,-fsanitize=undefined)
+
 # Set code alignment.
 #
 # Allow setting on a boolean basis, and then convert such selection to an
diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index c4a8d86912..f7cc5ffaab 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -98,7 +98,7 @@ config SCRUB_DEBUG
 
 config UBSAN
 	bool "Undefined behaviour sanitizer"
-	depends on HAS_UBSAN
+	depends on HAS_UBSAN && CC_HAS_UBSAN
 	help
 	  Enable undefined behaviour sanitizer. It uses compiler to insert code
 	  snippets so that undefined behaviours in C are detected during runtime.
diff --git a/xen/tools/kconfig/allrandom.config b/xen/tools/kconfig/allrandom.config
index 76f74320b5..c7753ac4ad 100644
--- a/xen/tools/kconfig/allrandom.config
+++ b/xen/tools/kconfig/allrandom.config
@@ -1,4 +1,3 @@
 # Explicit option choices not subject to regular RANDCONFIG
 
 CONFIG_GCOV_FORMAT_AUTODETECT=y
-CONFIG_UBSAN=n
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 13:33:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 13:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.923987.1327325 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvcUh-0001zJ-8e; Fri, 21 Mar 2025 13:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 923987.1327325; Fri, 21 Mar 2025 13:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvcUh-0001zB-5u; Fri, 21 Mar 2025 13:33:03 +0000
Received: by outflank-mailman (input) for mailman id 923987;
 Fri, 21 Mar 2025 13:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvcUg-0001z5-Dm
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 13:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvcUg-00H3OQ-11
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 13:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvcUg-00EKa6-04
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 13:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=L8EXoDJB197juAR5gp4VpCBgD3PoZG1bgLE2//uy6HU=; b=LxK6fZGrUMmrt2qr2F/4fezH8L
	8NCjoBUzaeU5oPQlCHl0Q00ZvdwA5nufAENMcudB1qaBOsBksYMRAf7nXFW8v0kL0OgijQDllQ2Ym
	kDs4c4kUME2tlbmoxbqNYv1npZMcBDhc6vec+31+AQzzYn2Wt/DNENs1bITcMN//Xr2k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/compiler: Fix the position of the visibility pragma
Message-Id: <E1tvcUg-00EKa6-04@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 13:33:02 +0000

commit ab7ce0c8ed90f729a186babd87e3cd1fbed8ab98
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 18 13:32:50 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 21 11:52:39 2025 +0000

    xen/compiler: Fix the position of the visibility pragma
    
    This needs to be ahead of everything.  Right now, it is after xen/init.h being
    included for -DINIT_SECTIONS_ONLY
    
      # 1 "./include/xen/compiler.h" 1
      # 83 "./include/xen/compiler.h"
      # 1 "./include/xen/init.h" 1
      # 62 "./include/xen/init.h"
      typedef int (*initcall_t)(void);
      typedef void (*exitcall_t)(void);
      # 72 "./include/xen/init.h"
      void do_presmp_initcalls(void);
      void do_initcalls(void);
      # 84 "./include/xen/compiler.h" 2
      # 122 "./include/xen/compiler.h"
      #pragma GCC visibility push(hidden)
    
    Fixes: 84c4461b7d3a ("Force out-of-line instances of inline functions into .init.text in init-only code")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/compiler.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index b118e4ba62..636a85bc41 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -15,6 +15,11 @@
 # endif
 #endif
 
+#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
+/* Results in more efficient PIC code (no indirections through GOT or PLT). */
+#pragma GCC visibility push(hidden)
+#endif
+
 #define barrier()     __asm__ __volatile__("": : :"memory")
 
 #define likely(x)     __builtin_expect(!!(x),1)
@@ -118,11 +123,6 @@
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
 
-#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
-/* Results in more efficient PIC code (no indirections through GOT or PLT). */
-#pragma GCC visibility push(hidden)
-#endif
-
 /* Make the optimizer believe the variable can be manipulated arbitrarily. */
 #define OPTIMIZER_HIDE_VAR(var) __asm__ ( "" : "+g" (var) )
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 13:33:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 13:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.923988.1327328 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvcUr-00020l-9q; Fri, 21 Mar 2025 13:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 923988.1327328; Fri, 21 Mar 2025 13:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvcUr-00020d-7L; Fri, 21 Mar 2025 13:33:13 +0000
Received: by outflank-mailman (input) for mailman id 923988;
 Fri, 21 Mar 2025 13:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvcUq-00020V-6y
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 13:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvcUq-00H3Ok-1L
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 13:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvcUq-00EKbp-0S
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 13:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KvufbNBKa8+o4pI3Cge+Bp2T2bbBGPMeyV5SvuEGGTk=; b=vWDUd6cdck9uSVc/Nwio2B1pNn
	nm1wQKFJoyYJHDLQIEnaxLKVjcvXqRnOqu1cH7hF785lAB3K8Aei5L6FZml5BvOvlYNCjDFeWD/CT
	mdy9kK8wwy7hSQN6OfQXSpgosAZMHv+ojPyCzmkB5K/H4vWK0icTLTTEFQunQktQkmO8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Simplify the expression for extra allocation space
Message-Id: <E1tvcUq-00EKbp-0S@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 13:33:12 +0000

commit ce703c84df1cb279605b0a85a45c6419464a16e8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Mar 19 12:12:37 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 21 11:52:39 2025 +0000

    x86/boot: Simplify the expression for extra allocation space
    
    The expression for one parameter of find_memory() is already complicated and
    about to become moreso.  Break it out into a new variable, and express it in
    an easier-to-follow way.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/hvm/dom0_build.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 6a4453103a..6591949984 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -654,6 +654,7 @@ static int __init pvh_load_kernel(
     const char *cmdline = image->cmdline_pa ? __va(image->cmdline_pa) : NULL;
     struct elf_binary elf;
     struct elf_dom_parms parms;
+    size_t extra_space;
     paddr_t last_addr;
     struct hvm_start_info start_info = { 0 };
     struct hvm_modlist_entry mod = { 0 };
@@ -711,13 +712,16 @@ static int __init pvh_load_kernel(
      * split into smaller allocations, done as a single region in order to
      * simplify it.
      */
-    last_addr = find_memory(d, &elf, sizeof(start_info) +
-                            (initrd ? ROUNDUP(initrd_len, PAGE_SIZE) +
-                                      sizeof(mod)
-                                    : 0) +
-                            (cmdline ? ROUNDUP(strlen(cmdline) + 1,
-                                               elf_64bit(&elf) ? 8 : 4)
-                                     : 0));
+    extra_space = sizeof(start_info);
+
+    if ( initrd )
+        extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
+
+    if ( cmdline )
+        extra_space += ROUNDUP(strlen(cmdline) + 1,
+                               elf_64bit(&elf) ? 8 : 4);
+
+    last_addr = find_memory(d, &elf, extra_space);
     if ( last_addr == INVALID_PADDR )
     {
         printk("Unable to find a memory region to load initrd and metadata\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 13:33:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 13:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.923989.1327333 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvcV1-00023c-BE; Fri, 21 Mar 2025 13:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 923989.1327333; Fri, 21 Mar 2025 13:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvcV1-00023U-8h; Fri, 21 Mar 2025 13:33:23 +0000
Received: by outflank-mailman (input) for mailman id 923989;
 Fri, 21 Mar 2025 13:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvcV0-00023M-9z
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 13:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvcV0-00H3Oo-1e
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 13:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvcV0-00EKcn-0l
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 13:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S+3Z2AKo2w8mBdxj8R1mkrizFXNmI4pQk/vuG7IoAzQ=; b=roEt/dyiIBJa5LVvelUgNMfweO
	SoTLZqzcCu20ezPUjKEwx4YF0NV1+dVwpUfvhu5/dnz4kudzo6tZYOTgbLyGu4FLVYr6GvEkO8VLW
	5/FNSjT/ceRXUE1d3GFlTYog6ZbLVm0NL1/RWKuqgZY2ozI0NK0aKggxCXAjXVrMvCQ8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Move cpu_init() out of trap_init()
Message-Id: <E1tvcV0-00EKcn-0l@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 13:33:22 +0000

commit c81a9835e44b59bce4f0dafd3b1a6082a983587a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 6 06:36:34 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 21 11:52:39 2025 +0000

    x86/traps: Move cpu_init() out of trap_init()
    
    cpu_init() doesn't particularly belong in trap_init().  This brings the BSP
    more in line with the APs.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/setup.c | 2 ++
 xen/arch/x86/traps.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 715719213d..5daa70fc0f 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2024,6 +2024,8 @@ void asmlinkage __init noreturn __start_xen(void)
 
     trap_init();
 
+    cpu_init();
+
     rcu_init();
 
     early_time_init();
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index df1155bfb6..a89f4f4f34 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1938,8 +1938,6 @@ void __init trap_init(void)
             l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
 
     percpu_traps_init();
-
-    cpu_init();
 }
 
 void asm_domain_crash_synchronous(unsigned long addr)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 13:33:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 13:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.923990.1327337 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvcVB-00026S-Cj; Fri, 21 Mar 2025 13:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 923990.1327337; Fri, 21 Mar 2025 13:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvcVB-00026K-A2; Fri, 21 Mar 2025 13:33:33 +0000
Received: by outflank-mailman (input) for mailman id 923990;
 Fri, 21 Mar 2025 13:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvcVA-000268-Eu
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 13:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvcVA-00H3Ov-1y
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 13:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvcVA-00EKeF-16
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 13:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JriWL8XEtyuUNxQVp3Ddi+0dhoJwPzKRZw7c6W76+mg=; b=R/UzBn7t9P3Nehp+kOLbmxbVgS
	O9WPHxoggpXChbes/YtQ2zT8Py4tm05Q9yNxbWesgiC4oZGPHl3+llEsSLpAkSxBLhKitbPZGzHer
	YXIQ/IoQU6cyJmwDAx9q7D2U5RhyimwAY1steJN0hdoYbqp72z7hzgRyiexdaY0ds6f0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Move percpu_traps_init() into traps-setup.c
Message-Id: <E1tvcVA-00EKeF-16@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 13:33:32 +0000

commit 2e26220e52cc46e49105f7e4a74ac11b1b8129b8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 31 15:56:34 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 21 11:52:39 2025 +0000

    x86/traps: Move percpu_traps_init() into traps-setup.c
    
    Move the declaration from asm/system.h into asm/traps.h.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/power.c         |  1 +
 xen/arch/x86/include/asm/system.h |  1 -
 xen/arch/x86/include/asm/traps.h  |  2 ++
 xen/arch/x86/setup.c              |  1 +
 xen/arch/x86/smpboot.c            |  1 +
 xen/arch/x86/traps-setup.c        | 15 +++++++++++++++
 xen/arch/x86/traps.c              |  8 --------
 7 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index fe70257864..3196a33b19 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -31,6 +31,7 @@
 #include <asm/spec_ctrl.h>
 #include <asm/tboot.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 
 #include <public/platform.h>
 
diff --git a/xen/arch/x86/include/asm/system.h b/xen/arch/x86/include/asm/system.h
index 73cb16ca68..73364056c7 100644
--- a/xen/arch/x86/include/asm/system.h
+++ b/xen/arch/x86/include/asm/system.h
@@ -266,7 +266,6 @@ static inline int local_irq_is_enabled(void)
 void trap_init(void);
 void init_idt_traps(void);
 void load_system_tables(void);
-void percpu_traps_init(void);
 void subarch_percpu_traps_init(void);
 
 #endif
diff --git a/xen/arch/x86/include/asm/traps.h b/xen/arch/x86/include/asm/traps.h
index 01ef362edc..825f7441c8 100644
--- a/xen/arch/x86/include/asm/traps.h
+++ b/xen/arch/x86/include/asm/traps.h
@@ -7,6 +7,8 @@
 #ifndef ASM_TRAP_H
 #define ASM_TRAP_H
 
+void percpu_traps_init(void);
+
 const char *vector_name(unsigned int vec);
 
 #endif /* ASM_TRAP_H */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 5daa70fc0f..67463482dc 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -56,6 +56,7 @@
 #include <asm/spec_ctrl.h>
 #include <asm/tboot.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 
 #include <xsm/xsm.h>
 
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index b63a9ce13e..54207e6d88 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -41,6 +41,7 @@
 #include <asm/tboot.h>
 #include <asm/time.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 
 uint32_t __ro_after_init trampoline_phys;
 enum ap_boot_method __read_mostly ap_boot_method = AP_BOOT_NORMAL;
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index 3ee2831958..fa78a35a7e 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -3,5 +3,20 @@
  * Configuration of event handling for all CPUs.
  */
 #include <asm/idt.h>
+#include <asm/msr.h>
+#include <asm/system.h>
+#include <asm/traps.h>
 
 DEFINE_PER_CPU_READ_MOSTLY(idt_entry_t *, idt);
+
+/*
+ * Set up per-CPU linkage registers for exception, interrupt and syscall
+ * handling.
+ */
+void percpu_traps_init(void)
+{
+    subarch_percpu_traps_init();
+
+    if ( cpu_has_xen_lbr )
+        wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
+}
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index a89f4f4f34..29d7e4123f 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1864,14 +1864,6 @@ void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
     panic("CONTROL-FLOW PROTECTION FAULT: #CP[%04x] %s\n", ec, err);
 }
 
-void percpu_traps_init(void)
-{
-    subarch_percpu_traps_init();
-
-    if ( cpu_has_xen_lbr )
-        wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
-}
-
 void nocall entry_PF(void);
 
 void __init init_idt_traps(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 13:33:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 13:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.923991.1327341 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvcVL-00028y-EB; Fri, 21 Mar 2025 13:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 923991.1327341; Fri, 21 Mar 2025 13:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvcVL-00028q-BS; Fri, 21 Mar 2025 13:33:43 +0000
Received: by outflank-mailman (input) for mailman id 923991;
 Fri, 21 Mar 2025 13:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvcVK-00028i-GB
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 13:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvcVK-00H3P2-2G
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 13:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvcVK-00EKgC-1P
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 13:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=L0qX21wgoz1xkV11YadRn0fd7QazldNGGXIFJnakFmc=; b=hlA/oOrTm9nirg4LuIBPxDGC2M
	+szV9GxhLM8yhvB4F/VZ0Kzqtcm4K+RlYA4U0akJhNatGPx2NAmUV5LqXP8Sn2ykoXxe1TYf1od5c
	GLXQwFPw1cbuiAZ7O2wuOHWsfPW1H67oskMY/uItLjpgeRFDzSahK0jQbaDmyWZS18uw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Move trap_init() into traps-setup.c
Message-Id: <E1tvcVK-00EKgC-1P@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 13:33:42 +0000

commit 45ea85affe48c48d8caaa070eea9882521d3ce8c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 17 18:48:18 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 21 11:52:39 2025 +0000

    x86/traps: Move trap_init() into traps-setup.c
    
    ... and rename to traps_init() for consistency.  Move the declaration from
    asm/system.h into asm/traps.h.
    
    This also involves moving init_ler() and variables.  Move the declaration of
    ler_msr from asm/msr.h to asm/traps.h.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/msr.h    |  2 --
 xen/arch/x86/include/asm/system.h |  1 -
 xen/arch/x86/include/asm/traps.h  |  3 ++
 xen/arch/x86/setup.c              |  2 +-
 xen/arch/x86/traps-setup.c        | 66 +++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c              | 61 ------------------------------------
 6 files changed, 70 insertions(+), 65 deletions(-)

diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 7b00a4db5d..549d40b404 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -279,8 +279,6 @@ static inline void write_efer(uint64_t val)
     wrmsrl(MSR_EFER, val);
 }
 
-extern unsigned int ler_msr;
-
 DECLARE_PER_CPU(uint32_t, tsc_aux);
 
 /* Lazy update of MSR_TSC_AUX */
diff --git a/xen/arch/x86/include/asm/system.h b/xen/arch/x86/include/asm/system.h
index 73364056c7..1bf6bd0268 100644
--- a/xen/arch/x86/include/asm/system.h
+++ b/xen/arch/x86/include/asm/system.h
@@ -263,7 +263,6 @@ static inline int local_irq_is_enabled(void)
 #define BROKEN_ACPI_Sx          0x0001
 #define BROKEN_INIT_AFTER_S1    0x0002
 
-void trap_init(void);
 void init_idt_traps(void);
 void load_system_tables(void);
 void subarch_percpu_traps_init(void);
diff --git a/xen/arch/x86/include/asm/traps.h b/xen/arch/x86/include/asm/traps.h
index 825f7441c8..3d30aa6738 100644
--- a/xen/arch/x86/include/asm/traps.h
+++ b/xen/arch/x86/include/asm/traps.h
@@ -7,8 +7,11 @@
 #ifndef ASM_TRAP_H
 #define ASM_TRAP_H
 
+void traps_init(void);
 void percpu_traps_init(void);
 
+extern unsigned int ler_msr;
+
 const char *vector_name(unsigned int vec);
 
 #endif /* ASM_TRAP_H */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 67463482dc..993a6202a3 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2023,7 +2023,7 @@ void asmlinkage __init noreturn __start_xen(void)
                                            &this_cpu(stubs).mfn);
     BUG_ON(!this_cpu(stubs.addr));
 
-    trap_init();
+    traps_init(); /* Needs stubs allocated. */
 
     cpu_init();
 
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index fa78a35a7e..1a7b42c14b 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -2,6 +2,9 @@
 /*
  * Configuration of event handling for all CPUs.
  */
+#include <xen/init.h>
+#include <xen/param.h>
+
 #include <asm/idt.h>
 #include <asm/msr.h>
 #include <asm/system.h>
@@ -9,6 +12,69 @@
 
 DEFINE_PER_CPU_READ_MOSTLY(idt_entry_t *, idt);
 
+/* LastExceptionFromIP on this hardware.  Zero if LER is not in use. */
+unsigned int __ro_after_init ler_msr;
+static bool __initdata opt_ler;
+boolean_param("ler", opt_ler);
+
+void nocall entry_PF(void);
+
+static void __init init_ler(void)
+{
+    unsigned int msr = 0;
+
+    if ( !opt_ler )
+        return;
+
+    /*
+     * Intel Pentium 4 is the only known CPU to not use the architectural MSR
+     * indicies.
+     */
+    switch ( boot_cpu_data.x86_vendor )
+    {
+    case X86_VENDOR_INTEL:
+        if ( boot_cpu_data.x86 == 0xf )
+        {
+            msr = MSR_P4_LER_FROM_LIP;
+            break;
+        }
+        fallthrough;
+    case X86_VENDOR_AMD:
+    case X86_VENDOR_HYGON:
+        msr = MSR_IA32_LASTINTFROMIP;
+        break;
+    }
+
+    if ( msr == 0 )
+    {
+        printk(XENLOG_WARNING "LER disabled: failed to identify MSRs\n");
+        return;
+    }
+
+    ler_msr = msr;
+    setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
+}
+
+/*
+ * Configure complete exception, interrupt and syscall handling.
+ */
+void __init traps_init(void)
+{
+    /* Replace early pagefault with real pagefault handler. */
+    _update_gate_addr_lower(&bsp_idt[X86_EXC_PF], entry_PF);
+
+    init_ler();
+
+    /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
+    this_cpu(gdt_l1e) =
+        l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
+    if ( IS_ENABLED(CONFIG_PV32) )
+        this_cpu(compat_gdt_l1e) =
+            l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
+
+    percpu_traps_init();
+}
+
 /*
  * Set up per-CPU linkage registers for exception, interrupt and syscall
  * handling.
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 29d7e4123f..79d92f21ac 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -107,12 +107,6 @@ DEFINE_PER_CPU_PAGE_ALIGNED(struct tss_page, tss_page);
 static int debug_stack_lines = 20;
 integer_param("debug_stack_lines", debug_stack_lines);
 
-static bool __initdata opt_ler;
-boolean_param("ler", opt_ler);
-
-/* LastExceptionFromIP on this hardware.  Zero if LER is not in use. */
-unsigned int __ro_after_init ler_msr;
-
 const unsigned int nmi_cpu;
 
 #define stack_words_per_line 4
@@ -1864,8 +1858,6 @@ void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
     panic("CONTROL-FLOW PROTECTION FAULT: #CP[%04x] %s\n", ec, err);
 }
 
-void nocall entry_PF(void);
-
 void __init init_idt_traps(void)
 {
     /* Specify dedicated interrupt stacks for NMI, #DF, and #MC. */
@@ -1879,59 +1871,6 @@ void __init init_idt_traps(void)
         this_cpu(compat_gdt) = boot_compat_gdt;
 }
 
-static void __init init_ler(void)
-{
-    unsigned int msr = 0;
-
-    if ( !opt_ler )
-        return;
-
-    /*
-     * Intel Pentium 4 is the only known CPU to not use the architectural MSR
-     * indicies.
-     */
-    switch ( boot_cpu_data.x86_vendor )
-    {
-    case X86_VENDOR_INTEL:
-        if ( boot_cpu_data.x86 == 0xf )
-        {
-            msr = MSR_P4_LER_FROM_LIP;
-            break;
-        }
-        fallthrough;
-    case X86_VENDOR_AMD:
-    case X86_VENDOR_HYGON:
-        msr = MSR_IA32_LASTINTFROMIP;
-        break;
-    }
-
-    if ( msr == 0 )
-    {
-        printk(XENLOG_WARNING "LER disabled: failed to identify MSRs\n");
-        return;
-    }
-
-    ler_msr = msr;
-    setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
-}
-
-void __init trap_init(void)
-{
-    /* Replace early pagefault with real pagefault handler. */
-    _update_gate_addr_lower(&bsp_idt[X86_EXC_PF], entry_PF);
-
-    init_ler();
-
-    /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
-    this_cpu(gdt_l1e) =
-        l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
-    if ( IS_ENABLED(CONFIG_PV32) )
-        this_cpu(compat_gdt_l1e) =
-            l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
-
-    percpu_traps_init();
-}
-
 void asm_domain_crash_synchronous(unsigned long addr)
 {
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 13:33:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 13:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.923992.1327345 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvcVV-0002Az-Fc; Fri, 21 Mar 2025 13:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 923992.1327345; Fri, 21 Mar 2025 13:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvcVV-0002Ar-Cu; Fri, 21 Mar 2025 13:33:53 +0000
Received: by outflank-mailman (input) for mailman id 923992;
 Fri, 21 Mar 2025 13:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvcVU-0002Al-JZ
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 13:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvcVU-00H3PA-2c
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 13:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvcVU-00EKhA-1h
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 13:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O7RkENm+sZU77LPBwnQ2tOz2UFXSf1b8LAGN2g2VYd4=; b=r1csw8WJHhlgknILt26LhsmBoA
	m6erBxt78lYzImFoFdH6XErU8z/LWfXjl2kWghi2yj14pLFIZc6XTG4bQEfwdwiUZvqRfFYzjTnWY
	Jgngu5eLskVbJsBAMYfItct1KTCi8s1zqcgJZxDdTuzHGNYvKo6oFjIaU5irWa8tjVic=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Introduce early_traps_init() and simplify setup
Message-Id: <E1tvcVU-00EKhA-1h@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 13:33:52 +0000

commit a35816b5cae88c8062e1de8700bcc4ecfbcd65ad
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Dec 28 14:56:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 21 11:52:39 2025 +0000

    x86/traps: Introduce early_traps_init() and simplify setup
    
    Something I overlooked when last cleaning up exception handling is that a TSS
    is not necessary if IST isn't configured, and IST isn't necessary until we're
    running guest code.
    
    Introduce early_traps_init(), and rearrange the existing logic between this
    and traps_init() later on boot, to allow defering TSS and IST setup.
    
    In early_traps_init(), load the IDT and invalidate TR/LDTR; this sufficient
    system-table setup to make exception handling work.  The setup of the BSPs
    per-cpu variables stay early too; they're used on certain error paths.
    
    Move load_system_tables() later into traps_init().  Note that it already
    contains enable_each_ist(), so this call is simply dropped.
    
    This removes some complexity prior to having exception support, and lays the
    groundwork to not even allocate a TSS when using FRED.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/system.h |  1 -
 xen/arch/x86/include/asm/traps.h  |  1 +
 xen/arch/x86/setup.c              |  5 ++---
 xen/arch/x86/traps-setup.c        | 32 ++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c              | 13 -------------
 5 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/include/asm/system.h b/xen/arch/x86/include/asm/system.h
index 1bf6bd0268..8ceaaf45d1 100644
--- a/xen/arch/x86/include/asm/system.h
+++ b/xen/arch/x86/include/asm/system.h
@@ -263,7 +263,6 @@ static inline int local_irq_is_enabled(void)
 #define BROKEN_ACPI_Sx          0x0001
 #define BROKEN_INIT_AFTER_S1    0x0002
 
-void init_idt_traps(void);
 void load_system_tables(void);
 void subarch_percpu_traps_init(void);
 
diff --git a/xen/arch/x86/include/asm/traps.h b/xen/arch/x86/include/asm/traps.h
index 3d30aa6738..72c33a33e2 100644
--- a/xen/arch/x86/include/asm/traps.h
+++ b/xen/arch/x86/include/asm/traps.h
@@ -7,6 +7,7 @@
 #ifndef ASM_TRAP_H
 #define ASM_TRAP_H
 
+void early_traps_init(void);
 void traps_init(void);
 void percpu_traps_init(void);
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 993a6202a3..7d6e52a55f 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1087,14 +1087,13 @@ void asmlinkage __init noreturn __start_xen(void)
     };
     const char *hypervisor_name;
 
-    /* Critical region without IDT or TSS.  Any fault is deadly! */
+    /* Critical region without exception handling.  Any fault is deadly! */
 
     init_shadow_spec_ctrl_state();
 
     percpu_init_areas();
 
-    init_idt_traps();
-    load_system_tables();
+    early_traps_init();
 
     smp_prepare_boot_cpu();
     sort_exception_tables();
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index 1a7b42c14b..a8385b26ae 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -55,6 +55,36 @@ static void __init init_ler(void)
     setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
 }
 
+/*
+ * Configure basic exception handling.  This is prior to parsing the command
+ * line or configuring a console, and needs to be as simple as possible.
+ *
+ * boot_gdt is already loaded, and bsp_idt[] is constructed without IST
+ * settings, so we don't need a TSS configured yet.
+ */
+void __init early_traps_init(void)
+{
+    const struct desc_ptr idtr = {
+        .base = (unsigned long)bsp_idt,
+        .limit = sizeof(bsp_idt) - 1,
+    };
+
+    lidt(&idtr);
+
+    /* Invalidate TR/LDTR as they're not set up yet. */
+    _set_tssldt_desc(boot_gdt + TSS_ENTRY - FIRST_RESERVED_GDT_ENTRY,
+                     0, 0, SYS_DESC_tss_avail);
+
+    ltr(TSS_SELECTOR);
+    lldt(0);
+
+    /* Set up the BSPs per-cpu references. */
+    this_cpu(idt) = bsp_idt;
+    this_cpu(gdt) = boot_gdt;
+    if ( IS_ENABLED(CONFIG_PV32) )
+        this_cpu(compat_gdt) = boot_compat_gdt;
+}
+
 /*
  * Configure complete exception, interrupt and syscall handling.
  */
@@ -63,6 +93,8 @@ void __init traps_init(void)
     /* Replace early pagefault with real pagefault handler. */
     _update_gate_addr_lower(&bsp_idt[X86_EXC_PF], entry_PF);
 
+    load_system_tables();
+
     init_ler();
 
     /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 79d92f21ac..25e0d5777e 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1858,19 +1858,6 @@ void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
     panic("CONTROL-FLOW PROTECTION FAULT: #CP[%04x] %s\n", ec, err);
 }
 
-void __init init_idt_traps(void)
-{
-    /* Specify dedicated interrupt stacks for NMI, #DF, and #MC. */
-    enable_each_ist(bsp_idt);
-
-    /* CPU0 uses the master IDT. */
-    this_cpu(idt) = bsp_idt;
-
-    this_cpu(gdt) = boot_gdt;
-    if ( IS_ENABLED(CONFIG_PV32) )
-        this_cpu(compat_gdt) = boot_compat_gdt;
-}
-
 void asm_domain_crash_synchronous(unsigned long addr)
 {
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 14:33:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 14:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.924111.1327433 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvdQk-0002Kw-PC; Fri, 21 Mar 2025 14:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 924111.1327433; Fri, 21 Mar 2025 14:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvdQk-0002Ko-MY; Fri, 21 Mar 2025 14:33:02 +0000
Received: by outflank-mailman (input) for mailman id 924111;
 Fri, 21 Mar 2025 14:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvdQk-0002Ki-3E
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 14:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvdQk-00H4rX-0W
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 14:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvdQj-00ETuV-2s
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 14:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/LXepsqHaQeQadFhLld2h3EGr3i/Cef+X1Z4CRRhnnQ=; b=LYeAWOB0R1uVWmMcO8A14Yib6d
	CdAli4NYo9QnBg51RGqhRxnqnuSzb2SGZA7tEr4U9I+L5V/t4BesJhhWvxOltwSoJdeRgNdLrZQC2
	xmErOrJiMm9cMbqLR+yI1a/rTSdNcjjviDicV19C+iu25/2mfo+oCHAhI5cWk/d/FKCE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/compiler: Fix the position of the visibility pragma
Message-Id: <E1tvdQj-00ETuV-2s@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 14:33:01 +0000

commit ab7ce0c8ed90f729a186babd87e3cd1fbed8ab98
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 18 13:32:50 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 21 11:52:39 2025 +0000

    xen/compiler: Fix the position of the visibility pragma
    
    This needs to be ahead of everything.  Right now, it is after xen/init.h being
    included for -DINIT_SECTIONS_ONLY
    
      # 1 "./include/xen/compiler.h" 1
      # 83 "./include/xen/compiler.h"
      # 1 "./include/xen/init.h" 1
      # 62 "./include/xen/init.h"
      typedef int (*initcall_t)(void);
      typedef void (*exitcall_t)(void);
      # 72 "./include/xen/init.h"
      void do_presmp_initcalls(void);
      void do_initcalls(void);
      # 84 "./include/xen/compiler.h" 2
      # 122 "./include/xen/compiler.h"
      #pragma GCC visibility push(hidden)
    
    Fixes: 84c4461b7d3a ("Force out-of-line instances of inline functions into .init.text in init-only code")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/compiler.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index b118e4ba62..636a85bc41 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -15,6 +15,11 @@
 # endif
 #endif
 
+#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
+/* Results in more efficient PIC code (no indirections through GOT or PLT). */
+#pragma GCC visibility push(hidden)
+#endif
+
 #define barrier()     __asm__ __volatile__("": : :"memory")
 
 #define likely(x)     __builtin_expect(!!(x),1)
@@ -118,11 +123,6 @@
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
 
-#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
-/* Results in more efficient PIC code (no indirections through GOT or PLT). */
-#pragma GCC visibility push(hidden)
-#endif
-
 /* Make the optimizer believe the variable can be manipulated arbitrarily. */
 #define OPTIMIZER_HIDE_VAR(var) __asm__ ( "" : "+g" (var) )
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 14:33:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 14:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.924112.1327439 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvdQu-0002MY-RI; Fri, 21 Mar 2025 14:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 924112.1327439; Fri, 21 Mar 2025 14:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvdQu-0002MO-Nw; Fri, 21 Mar 2025 14:33:12 +0000
Received: by outflank-mailman (input) for mailman id 924112;
 Fri, 21 Mar 2025 14:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvdQu-0002ME-3Q
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 14:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvdQu-00H4rr-0z
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 14:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvdQt-00ETvy-3B
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 14:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jcJrP9mAvAaHhkuaMoGBVpB32gHcR9y8ucVp+YBHG3I=; b=iDwd2QVHfKEN1WyRezMj8uQc0c
	ACiu8zWkZiUulcWm12el6M7iZH5AirkFxpCNkkYrXQzk4AKVHZ78KAiXZjy+9ZUEdR5UtYWbsWHS6
	L/WCGpvtS2353PnJlLuSbiq3g5Fr18p+pDvSlTiDoc5Q8qmhHTFHaZPtDP3DJUX8B/NM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Simplify the expression for extra allocation space
Message-Id: <E1tvdQt-00ETvy-3B@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 14:33:11 +0000

commit ce703c84df1cb279605b0a85a45c6419464a16e8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Mar 19 12:12:37 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 21 11:52:39 2025 +0000

    x86/boot: Simplify the expression for extra allocation space
    
    The expression for one parameter of find_memory() is already complicated and
    about to become moreso.  Break it out into a new variable, and express it in
    an easier-to-follow way.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/hvm/dom0_build.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 6a4453103a..6591949984 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -654,6 +654,7 @@ static int __init pvh_load_kernel(
     const char *cmdline = image->cmdline_pa ? __va(image->cmdline_pa) : NULL;
     struct elf_binary elf;
     struct elf_dom_parms parms;
+    size_t extra_space;
     paddr_t last_addr;
     struct hvm_start_info start_info = { 0 };
     struct hvm_modlist_entry mod = { 0 };
@@ -711,13 +712,16 @@ static int __init pvh_load_kernel(
      * split into smaller allocations, done as a single region in order to
      * simplify it.
      */
-    last_addr = find_memory(d, &elf, sizeof(start_info) +
-                            (initrd ? ROUNDUP(initrd_len, PAGE_SIZE) +
-                                      sizeof(mod)
-                                    : 0) +
-                            (cmdline ? ROUNDUP(strlen(cmdline) + 1,
-                                               elf_64bit(&elf) ? 8 : 4)
-                                     : 0));
+    extra_space = sizeof(start_info);
+
+    if ( initrd )
+        extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
+
+    if ( cmdline )
+        extra_space += ROUNDUP(strlen(cmdline) + 1,
+                               elf_64bit(&elf) ? 8 : 4);
+
+    last_addr = find_memory(d, &elf, extra_space);
     if ( last_addr == INVALID_PADDR )
     {
         printk("Unable to find a memory region to load initrd and metadata\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 14:33:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 14:33:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.924113.1327441 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvdR4-0002PG-Sr; Fri, 21 Mar 2025 14:33:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 924113.1327441; Fri, 21 Mar 2025 14:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvdR4-0002P9-Q3; Fri, 21 Mar 2025 14:33:22 +0000
Received: by outflank-mailman (input) for mailman id 924113;
 Fri, 21 Mar 2025 14:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvdR4-0002Ou-6z
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 14:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvdR4-00H4rv-1M
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 14:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvdR4-00ETxG-0Q
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 14:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sDBxa3jGtmtjaF7KQvg4OIHrVykyhTOe5L48RJj02rU=; b=u5VHrrmr8/CgDVshxskTJGZbtM
	XyF0tgP5AoPJvMnHV6BDSRXlB4AGbM3Ci3ucxMn7oehUuc5FsF3MjJvxn7ezIj/m/7ocqA4z+T+yC
	3hkvGETCAD7qOmkzUCmBzcVS4hqtVGFI/azrO7qN2hhMWNE1Ben6STOZJigka5oLH8l8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Move cpu_init() out of trap_init()
Message-Id: <E1tvdR4-00ETxG-0Q@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 14:33:22 +0000

commit c81a9835e44b59bce4f0dafd3b1a6082a983587a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 6 06:36:34 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 21 11:52:39 2025 +0000

    x86/traps: Move cpu_init() out of trap_init()
    
    cpu_init() doesn't particularly belong in trap_init().  This brings the BSP
    more in line with the APs.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/setup.c | 2 ++
 xen/arch/x86/traps.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 715719213d..5daa70fc0f 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2024,6 +2024,8 @@ void asmlinkage __init noreturn __start_xen(void)
 
     trap_init();
 
+    cpu_init();
+
     rcu_init();
 
     early_time_init();
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index df1155bfb6..a89f4f4f34 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1938,8 +1938,6 @@ void __init trap_init(void)
             l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
 
     percpu_traps_init();
-
-    cpu_init();
 }
 
 void asm_domain_crash_synchronous(unsigned long addr)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 14:33:32 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 14:33:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.924114.1327445 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvdRE-0002S9-UB; Fri, 21 Mar 2025 14:33:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 924114.1327445; Fri, 21 Mar 2025 14:33:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvdRE-0002S1-Ra; Fri, 21 Mar 2025 14:33:32 +0000
Received: by outflank-mailman (input) for mailman id 924114;
 Fri, 21 Mar 2025 14:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvdRE-0002Ru-AJ
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 14:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvdRE-00H4s0-1g
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 14:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvdRE-00ETyX-0o
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 14:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u50Bh+4cHz60hJQhqP7IDnpu4smTPVAVfh/2BjutdpY=; b=O20Z3rZMP62IRZ78rl64CIrbhb
	GC7VMGosUgXWvsEK/hQfWgO6o9PcfMTDuWBm7ag4bGusf2cBakpZF1PyUaEJcBacmL7eH6W14Zc84
	gbCADSDGLAZUu61pTB7IrIeOzgWCuhhgWdp/GnH0nJFprLTYReNwnB/Olh+isEppwiYA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Move percpu_traps_init() into traps-setup.c
Message-Id: <E1tvdRE-00ETyX-0o@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 14:33:32 +0000

commit 2e26220e52cc46e49105f7e4a74ac11b1b8129b8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 31 15:56:34 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 21 11:52:39 2025 +0000

    x86/traps: Move percpu_traps_init() into traps-setup.c
    
    Move the declaration from asm/system.h into asm/traps.h.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/power.c         |  1 +
 xen/arch/x86/include/asm/system.h |  1 -
 xen/arch/x86/include/asm/traps.h  |  2 ++
 xen/arch/x86/setup.c              |  1 +
 xen/arch/x86/smpboot.c            |  1 +
 xen/arch/x86/traps-setup.c        | 15 +++++++++++++++
 xen/arch/x86/traps.c              |  8 --------
 7 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index fe70257864..3196a33b19 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -31,6 +31,7 @@
 #include <asm/spec_ctrl.h>
 #include <asm/tboot.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 
 #include <public/platform.h>
 
diff --git a/xen/arch/x86/include/asm/system.h b/xen/arch/x86/include/asm/system.h
index 73cb16ca68..73364056c7 100644
--- a/xen/arch/x86/include/asm/system.h
+++ b/xen/arch/x86/include/asm/system.h
@@ -266,7 +266,6 @@ static inline int local_irq_is_enabled(void)
 void trap_init(void);
 void init_idt_traps(void);
 void load_system_tables(void);
-void percpu_traps_init(void);
 void subarch_percpu_traps_init(void);
 
 #endif
diff --git a/xen/arch/x86/include/asm/traps.h b/xen/arch/x86/include/asm/traps.h
index 01ef362edc..825f7441c8 100644
--- a/xen/arch/x86/include/asm/traps.h
+++ b/xen/arch/x86/include/asm/traps.h
@@ -7,6 +7,8 @@
 #ifndef ASM_TRAP_H
 #define ASM_TRAP_H
 
+void percpu_traps_init(void);
+
 const char *vector_name(unsigned int vec);
 
 #endif /* ASM_TRAP_H */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 5daa70fc0f..67463482dc 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -56,6 +56,7 @@
 #include <asm/spec_ctrl.h>
 #include <asm/tboot.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 
 #include <xsm/xsm.h>
 
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index b63a9ce13e..54207e6d88 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -41,6 +41,7 @@
 #include <asm/tboot.h>
 #include <asm/time.h>
 #include <asm/trampoline.h>
+#include <asm/traps.h>
 
 uint32_t __ro_after_init trampoline_phys;
 enum ap_boot_method __read_mostly ap_boot_method = AP_BOOT_NORMAL;
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index 3ee2831958..fa78a35a7e 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -3,5 +3,20 @@
  * Configuration of event handling for all CPUs.
  */
 #include <asm/idt.h>
+#include <asm/msr.h>
+#include <asm/system.h>
+#include <asm/traps.h>
 
 DEFINE_PER_CPU_READ_MOSTLY(idt_entry_t *, idt);
+
+/*
+ * Set up per-CPU linkage registers for exception, interrupt and syscall
+ * handling.
+ */
+void percpu_traps_init(void)
+{
+    subarch_percpu_traps_init();
+
+    if ( cpu_has_xen_lbr )
+        wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
+}
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index a89f4f4f34..29d7e4123f 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1864,14 +1864,6 @@ void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
     panic("CONTROL-FLOW PROTECTION FAULT: #CP[%04x] %s\n", ec, err);
 }
 
-void percpu_traps_init(void)
-{
-    subarch_percpu_traps_init();
-
-    if ( cpu_has_xen_lbr )
-        wrmsrl(MSR_IA32_DEBUGCTLMSR, IA32_DEBUGCTLMSR_LBR);
-}
-
 void nocall entry_PF(void);
 
 void __init init_idt_traps(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 14:33:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 14:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.924115.1327449 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvdRP-0002UM-Vb; Fri, 21 Mar 2025 14:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 924115.1327449; Fri, 21 Mar 2025 14:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvdRP-0002UE-T5; Fri, 21 Mar 2025 14:33:43 +0000
Received: by outflank-mailman (input) for mailman id 924115;
 Fri, 21 Mar 2025 14:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvdRO-0002U5-Dr
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 14:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvdRO-00H4s6-22
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 14:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvdRO-00EU07-17
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 14:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yh43h/hcvgpyxK+Ht3raBvr90OlUfroGPf1+2eVxbGQ=; b=lYquVYvTiitcvaKbMUtmDWWeXA
	jr9CF3qBZhOokFZKWNi6GbMbrBN/eHU+Nns7+D2bsTh+YB62Yia5C4fbMLEd145P8DJOQOCQNrYB3
	c8i4nXDE1rxSprgTcrie+y3xT8qHKUpgGQUZJdebVSgelbx6cKVPu0cVfs/YZEb/K/OQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Move trap_init() into traps-setup.c
Message-Id: <E1tvdRO-00EU07-17@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 14:33:42 +0000

commit 45ea85affe48c48d8caaa070eea9882521d3ce8c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 17 18:48:18 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 21 11:52:39 2025 +0000

    x86/traps: Move trap_init() into traps-setup.c
    
    ... and rename to traps_init() for consistency.  Move the declaration from
    asm/system.h into asm/traps.h.
    
    This also involves moving init_ler() and variables.  Move the declaration of
    ler_msr from asm/msr.h to asm/traps.h.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/msr.h    |  2 --
 xen/arch/x86/include/asm/system.h |  1 -
 xen/arch/x86/include/asm/traps.h  |  3 ++
 xen/arch/x86/setup.c              |  2 +-
 xen/arch/x86/traps-setup.c        | 66 +++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c              | 61 ------------------------------------
 6 files changed, 70 insertions(+), 65 deletions(-)

diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 7b00a4db5d..549d40b404 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -279,8 +279,6 @@ static inline void write_efer(uint64_t val)
     wrmsrl(MSR_EFER, val);
 }
 
-extern unsigned int ler_msr;
-
 DECLARE_PER_CPU(uint32_t, tsc_aux);
 
 /* Lazy update of MSR_TSC_AUX */
diff --git a/xen/arch/x86/include/asm/system.h b/xen/arch/x86/include/asm/system.h
index 73364056c7..1bf6bd0268 100644
--- a/xen/arch/x86/include/asm/system.h
+++ b/xen/arch/x86/include/asm/system.h
@@ -263,7 +263,6 @@ static inline int local_irq_is_enabled(void)
 #define BROKEN_ACPI_Sx          0x0001
 #define BROKEN_INIT_AFTER_S1    0x0002
 
-void trap_init(void);
 void init_idt_traps(void);
 void load_system_tables(void);
 void subarch_percpu_traps_init(void);
diff --git a/xen/arch/x86/include/asm/traps.h b/xen/arch/x86/include/asm/traps.h
index 825f7441c8..3d30aa6738 100644
--- a/xen/arch/x86/include/asm/traps.h
+++ b/xen/arch/x86/include/asm/traps.h
@@ -7,8 +7,11 @@
 #ifndef ASM_TRAP_H
 #define ASM_TRAP_H
 
+void traps_init(void);
 void percpu_traps_init(void);
 
+extern unsigned int ler_msr;
+
 const char *vector_name(unsigned int vec);
 
 #endif /* ASM_TRAP_H */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 67463482dc..993a6202a3 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2023,7 +2023,7 @@ void asmlinkage __init noreturn __start_xen(void)
                                            &this_cpu(stubs).mfn);
     BUG_ON(!this_cpu(stubs.addr));
 
-    trap_init();
+    traps_init(); /* Needs stubs allocated. */
 
     cpu_init();
 
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index fa78a35a7e..1a7b42c14b 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -2,6 +2,9 @@
 /*
  * Configuration of event handling for all CPUs.
  */
+#include <xen/init.h>
+#include <xen/param.h>
+
 #include <asm/idt.h>
 #include <asm/msr.h>
 #include <asm/system.h>
@@ -9,6 +12,69 @@
 
 DEFINE_PER_CPU_READ_MOSTLY(idt_entry_t *, idt);
 
+/* LastExceptionFromIP on this hardware.  Zero if LER is not in use. */
+unsigned int __ro_after_init ler_msr;
+static bool __initdata opt_ler;
+boolean_param("ler", opt_ler);
+
+void nocall entry_PF(void);
+
+static void __init init_ler(void)
+{
+    unsigned int msr = 0;
+
+    if ( !opt_ler )
+        return;
+
+    /*
+     * Intel Pentium 4 is the only known CPU to not use the architectural MSR
+     * indicies.
+     */
+    switch ( boot_cpu_data.x86_vendor )
+    {
+    case X86_VENDOR_INTEL:
+        if ( boot_cpu_data.x86 == 0xf )
+        {
+            msr = MSR_P4_LER_FROM_LIP;
+            break;
+        }
+        fallthrough;
+    case X86_VENDOR_AMD:
+    case X86_VENDOR_HYGON:
+        msr = MSR_IA32_LASTINTFROMIP;
+        break;
+    }
+
+    if ( msr == 0 )
+    {
+        printk(XENLOG_WARNING "LER disabled: failed to identify MSRs\n");
+        return;
+    }
+
+    ler_msr = msr;
+    setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
+}
+
+/*
+ * Configure complete exception, interrupt and syscall handling.
+ */
+void __init traps_init(void)
+{
+    /* Replace early pagefault with real pagefault handler. */
+    _update_gate_addr_lower(&bsp_idt[X86_EXC_PF], entry_PF);
+
+    init_ler();
+
+    /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
+    this_cpu(gdt_l1e) =
+        l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
+    if ( IS_ENABLED(CONFIG_PV32) )
+        this_cpu(compat_gdt_l1e) =
+            l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
+
+    percpu_traps_init();
+}
+
 /*
  * Set up per-CPU linkage registers for exception, interrupt and syscall
  * handling.
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 29d7e4123f..79d92f21ac 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -107,12 +107,6 @@ DEFINE_PER_CPU_PAGE_ALIGNED(struct tss_page, tss_page);
 static int debug_stack_lines = 20;
 integer_param("debug_stack_lines", debug_stack_lines);
 
-static bool __initdata opt_ler;
-boolean_param("ler", opt_ler);
-
-/* LastExceptionFromIP on this hardware.  Zero if LER is not in use. */
-unsigned int __ro_after_init ler_msr;
-
 const unsigned int nmi_cpu;
 
 #define stack_words_per_line 4
@@ -1864,8 +1858,6 @@ void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
     panic("CONTROL-FLOW PROTECTION FAULT: #CP[%04x] %s\n", ec, err);
 }
 
-void nocall entry_PF(void);
-
 void __init init_idt_traps(void)
 {
     /* Specify dedicated interrupt stacks for NMI, #DF, and #MC. */
@@ -1879,59 +1871,6 @@ void __init init_idt_traps(void)
         this_cpu(compat_gdt) = boot_compat_gdt;
 }
 
-static void __init init_ler(void)
-{
-    unsigned int msr = 0;
-
-    if ( !opt_ler )
-        return;
-
-    /*
-     * Intel Pentium 4 is the only known CPU to not use the architectural MSR
-     * indicies.
-     */
-    switch ( boot_cpu_data.x86_vendor )
-    {
-    case X86_VENDOR_INTEL:
-        if ( boot_cpu_data.x86 == 0xf )
-        {
-            msr = MSR_P4_LER_FROM_LIP;
-            break;
-        }
-        fallthrough;
-    case X86_VENDOR_AMD:
-    case X86_VENDOR_HYGON:
-        msr = MSR_IA32_LASTINTFROMIP;
-        break;
-    }
-
-    if ( msr == 0 )
-    {
-        printk(XENLOG_WARNING "LER disabled: failed to identify MSRs\n");
-        return;
-    }
-
-    ler_msr = msr;
-    setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
-}
-
-void __init trap_init(void)
-{
-    /* Replace early pagefault with real pagefault handler. */
-    _update_gate_addr_lower(&bsp_idt[X86_EXC_PF], entry_PF);
-
-    init_ler();
-
-    /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
-    this_cpu(gdt_l1e) =
-        l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
-    if ( IS_ENABLED(CONFIG_PV32) )
-        this_cpu(compat_gdt_l1e) =
-            l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
-
-    percpu_traps_init();
-}
-
 void asm_domain_crash_synchronous(unsigned long addr)
 {
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 21 14:33:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Mar 2025 14:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.924116.1327453 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvdRa-0002WR-1n; Fri, 21 Mar 2025 14:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 924116.1327453; Fri, 21 Mar 2025 14:33:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tvdRZ-0002WJ-UW; Fri, 21 Mar 2025 14:33:53 +0000
Received: by outflank-mailman (input) for mailman id 924116;
 Fri, 21 Mar 2025 14:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tvdRY-0002WB-Ig
 for xen-changelog@lists.xenproject.org; Fri, 21 Mar 2025 14:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvdRY-00H4sD-2X
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 14:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tvdRY-00EU0x-1U
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Mar 2025 14:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4y9ijDpLM0PuTWBd2Qj67ClHxvxKJ2yhHbkzPPkRIZc=; b=U4chWjxTdJSPijCXKEx1ZU6+Bx
	Peb8Fw608PZqgbHLFmkBRC65mOAGaoNlPWWh+oyKH5Jxc+NJMoqNnANOogDyC1ECW2E0ESkdIrPoY
	oVUNPpeB1DZc8efBgy0j6ud20MAxzBuqNSlr7Ri+HOHn8epzze7yVnpOS/tYra+Y6Q/M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Introduce early_traps_init() and simplify setup
Message-Id: <E1tvdRY-00EU0x-1U@xenbits.xenproject.org>
Date: Fri, 21 Mar 2025 14:33:52 +0000

commit a35816b5cae88c8062e1de8700bcc4ecfbcd65ad
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Dec 28 14:56:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 21 11:52:39 2025 +0000

    x86/traps: Introduce early_traps_init() and simplify setup
    
    Something I overlooked when last cleaning up exception handling is that a TSS
    is not necessary if IST isn't configured, and IST isn't necessary until we're
    running guest code.
    
    Introduce early_traps_init(), and rearrange the existing logic between this
    and traps_init() later on boot, to allow defering TSS and IST setup.
    
    In early_traps_init(), load the IDT and invalidate TR/LDTR; this sufficient
    system-table setup to make exception handling work.  The setup of the BSPs
    per-cpu variables stay early too; they're used on certain error paths.
    
    Move load_system_tables() later into traps_init().  Note that it already
    contains enable_each_ist(), so this call is simply dropped.
    
    This removes some complexity prior to having exception support, and lays the
    groundwork to not even allocate a TSS when using FRED.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/system.h |  1 -
 xen/arch/x86/include/asm/traps.h  |  1 +
 xen/arch/x86/setup.c              |  5 ++---
 xen/arch/x86/traps-setup.c        | 32 ++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c              | 13 -------------
 5 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/include/asm/system.h b/xen/arch/x86/include/asm/system.h
index 1bf6bd0268..8ceaaf45d1 100644
--- a/xen/arch/x86/include/asm/system.h
+++ b/xen/arch/x86/include/asm/system.h
@@ -263,7 +263,6 @@ static inline int local_irq_is_enabled(void)
 #define BROKEN_ACPI_Sx          0x0001
 #define BROKEN_INIT_AFTER_S1    0x0002
 
-void init_idt_traps(void);
 void load_system_tables(void);
 void subarch_percpu_traps_init(void);
 
diff --git a/xen/arch/x86/include/asm/traps.h b/xen/arch/x86/include/asm/traps.h
index 3d30aa6738..72c33a33e2 100644
--- a/xen/arch/x86/include/asm/traps.h
+++ b/xen/arch/x86/include/asm/traps.h
@@ -7,6 +7,7 @@
 #ifndef ASM_TRAP_H
 #define ASM_TRAP_H
 
+void early_traps_init(void);
 void traps_init(void);
 void percpu_traps_init(void);
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 993a6202a3..7d6e52a55f 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1087,14 +1087,13 @@ void asmlinkage __init noreturn __start_xen(void)
     };
     const char *hypervisor_name;
 
-    /* Critical region without IDT or TSS.  Any fault is deadly! */
+    /* Critical region without exception handling.  Any fault is deadly! */
 
     init_shadow_spec_ctrl_state();
 
     percpu_init_areas();
 
-    init_idt_traps();
-    load_system_tables();
+    early_traps_init();
 
     smp_prepare_boot_cpu();
     sort_exception_tables();
diff --git a/xen/arch/x86/traps-setup.c b/xen/arch/x86/traps-setup.c
index 1a7b42c14b..a8385b26ae 100644
--- a/xen/arch/x86/traps-setup.c
+++ b/xen/arch/x86/traps-setup.c
@@ -55,6 +55,36 @@ static void __init init_ler(void)
     setup_force_cpu_cap(X86_FEATURE_XEN_LBR);
 }
 
+/*
+ * Configure basic exception handling.  This is prior to parsing the command
+ * line or configuring a console, and needs to be as simple as possible.
+ *
+ * boot_gdt is already loaded, and bsp_idt[] is constructed without IST
+ * settings, so we don't need a TSS configured yet.
+ */
+void __init early_traps_init(void)
+{
+    const struct desc_ptr idtr = {
+        .base = (unsigned long)bsp_idt,
+        .limit = sizeof(bsp_idt) - 1,
+    };
+
+    lidt(&idtr);
+
+    /* Invalidate TR/LDTR as they're not set up yet. */
+    _set_tssldt_desc(boot_gdt + TSS_ENTRY - FIRST_RESERVED_GDT_ENTRY,
+                     0, 0, SYS_DESC_tss_avail);
+
+    ltr(TSS_SELECTOR);
+    lldt(0);
+
+    /* Set up the BSPs per-cpu references. */
+    this_cpu(idt) = bsp_idt;
+    this_cpu(gdt) = boot_gdt;
+    if ( IS_ENABLED(CONFIG_PV32) )
+        this_cpu(compat_gdt) = boot_compat_gdt;
+}
+
 /*
  * Configure complete exception, interrupt and syscall handling.
  */
@@ -63,6 +93,8 @@ void __init traps_init(void)
     /* Replace early pagefault with real pagefault handler. */
     _update_gate_addr_lower(&bsp_idt[X86_EXC_PF], entry_PF);
 
+    load_system_tables();
+
     init_ler();
 
     /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 79d92f21ac..25e0d5777e 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1858,19 +1858,6 @@ void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
     panic("CONTROL-FLOW PROTECTION FAULT: #CP[%04x] %s\n", ec, err);
 }
 
-void __init init_idt_traps(void)
-{
-    /* Specify dedicated interrupt stacks for NMI, #DF, and #MC. */
-    enable_each_ist(bsp_idt);
-
-    /* CPU0 uses the master IDT. */
-    this_cpu(idt) = bsp_idt;
-
-    this_cpu(gdt) = boot_gdt;
-    if ( IS_ENABLED(CONFIG_PV32) )
-        this_cpu(compat_gdt) = boot_compat_gdt;
-}
-
 void asm_domain_crash_synchronous(unsigned long addr)
 {
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 24 12:11:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Mar 2025 12:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.925430.1328289 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twgdz-0003S9-Ic; Mon, 24 Mar 2025 12:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 925430.1328289; Mon, 24 Mar 2025 12:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twgdz-0003S1-Fp; Mon, 24 Mar 2025 12:11:03 +0000
Received: by outflank-mailman (input) for mailman id 925430;
 Mon, 24 Mar 2025 12:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twgdy-0003Rp-1E
 for xen-changelog@lists.xenproject.org; Mon, 24 Mar 2025 12:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twgdx-005YK3-3D
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 12:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twgdx-00BIJZ-2K
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 12:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QMatCR6IKFt0lF2dMSKMPk1VC9CBd9urW2ugrEsQiXY=; b=5NQ+VrRNExg2m7NUhGjIiu/b9l
	eKfDznGkdoKc1TpEqwOdqTd5TE3YTXXclHAXskdtzvumUggym6fXIPXK93Fjv+KPu6BaKlSvWV4k8
	6BZuTdUEJcGe2EVyVXBpN/RewG6lO7fboi1P8l89Y30L2+gtDK3zzMu40MT65MGXhN8I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PVH: don't open-code elf_round_up()
Message-Id: <E1twgdx-00BIJZ-2K@xenbits.xenproject.org>
Date: Mon, 24 Mar 2025 12:11:01 +0000

commit d7ef23954c1ccdb99f4107ca26278950ab0bbfe8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 24 12:54:27 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 24 12:54:27 2025 +0100

    x86/PVH: don't open-code elf_round_up()
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/dom0_build.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 6591949984..6e287a81e7 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -718,8 +718,7 @@ static int __init pvh_load_kernel(
         extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
 
     if ( cmdline )
-        extra_space += ROUNDUP(strlen(cmdline) + 1,
-                               elf_64bit(&elf) ? 8 : 4);
+        extra_space += elf_round_up(&elf, strlen(cmdline) + 1);
 
     last_addr = find_memory(d, &elf, extra_space);
     if ( last_addr == INVALID_PADDR )
@@ -740,7 +739,7 @@ static int __init pvh_load_kernel(
 
         mod.paddr = last_addr;
         mod.size = initrd_len;
-        last_addr += ROUNDUP(initrd_len, elf_64bit(&elf) ? 8 : 4);
+        last_addr += elf_round_up(&elf, initrd_len);
         if ( initrd->cmdline_pa )
         {
             char *str = __va(initrd->cmdline_pa);
@@ -774,7 +773,7 @@ static int __init pvh_load_kernel(
          * Round up to 32/64 bits (depending on the guest kernel bitness) so
          * the modlist/start_info is aligned.
          */
-        last_addr += ROUNDUP(strlen(cmdline) + 1, elf_64bit(&elf) ? 8 : 4);
+        last_addr += elf_round_up(&elf, strlen(cmdline) + 1);
     }
     if ( initrd != NULL )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 24 12:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Mar 2025 12:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.925431.1328293 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twge9-0003iy-Ji; Mon, 24 Mar 2025 12:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 925431.1328293; Mon, 24 Mar 2025 12:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twge9-0003ir-HA; Mon, 24 Mar 2025 12:11:13 +0000
Received: by outflank-mailman (input) for mailman id 925431;
 Mon, 24 Mar 2025 12:11:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twge7-0003eR-TH
 for xen-changelog@lists.xenproject.org; Mon, 24 Mar 2025 12:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twge8-005YKl-0M
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 12:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twge7-00BIL0-2f
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 12:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Om9gTdBirPOTntFqi3+TQT5c4RrolkN+E+s5w0J0uOs=; b=aatY8fLkIAmqviggDxzgZlP6Vb
	8fsJILf7gZL+81lAOM7rhWpWxsjhU7qNqk2pO3b18WgkV40yInPnCTdXpUwK9ewNI1BmPEhZYTiQR
	q6zIcH15WcRBeKacIIHEiwGC6DwT/cLYmXbLDEvZbgp8W5sGM8hTgDydQtZHS71ZN5C8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/svm: use nsvm_efer_svm_enabled() to check guest's EFER.SVME
Message-Id: <E1twge7-00BIL0-2f@xenbits.xenproject.org>
Date: Mon, 24 Mar 2025 12:11:11 +0000

commit 10eb9e0aa1dd8a10c8c6c483a79dd4433e43a501
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Mon Mar 24 12:55:00 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 24 12:55:00 2025 +0100

    x86/svm: use nsvm_efer_svm_enabled() to check guest's EFER.SVME
    
    There's a macro for this, might improve readability a bit & save a bit of space.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/svm/nestedsvm.c | 2 +-
 xen/arch/x86/hvm/svm/svm.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 35a2cbfd7d..dc2b6a4253 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -1616,7 +1616,7 @@ void svm_nested_features_on_efer_update(struct vcpu *v)
      * Need state for transfering the nested gif status so only write on
      * the hvm_vcpu EFER.SVME changing.
      */
-    if ( v->arch.hvm.guest_efer & EFER_SVME )
+    if ( nsvm_efer_svm_enabled(v) )
     {
         if ( !vmcb->virt_ext.fields.vloadsave_enable &&
              paging_mode_hap(v->domain) &&
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 4b24891096..e33a38c1e4 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -253,7 +253,7 @@ static void cf_check svm_update_guest_efer(struct vcpu *v)
     vmcb_set_efer(vmcb, guest_efer);
 
     ASSERT(nestedhvm_enabled(v->domain) ||
-           !(v->arch.hvm.guest_efer & EFER_SVME));
+           !nsvm_efer_svm_enabled(v));
 
     if ( nestedhvm_enabled(v->domain) )
         svm_nested_features_on_efer_update(v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 24 12:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Mar 2025 12:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.925432.1328296 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twgeJ-0003t2-LC; Mon, 24 Mar 2025 12:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 925432.1328296; Mon, 24 Mar 2025 12:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twgeJ-0003su-Id; Mon, 24 Mar 2025 12:11:23 +0000
Received: by outflank-mailman (input) for mailman id 925432;
 Mon, 24 Mar 2025 12:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twgeH-0003oo-W5
 for xen-changelog@lists.xenproject.org; Mon, 24 Mar 2025 12:11:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twgeI-005YKz-0e
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 12:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twgeH-00BIOR-2z
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 12:11:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zBd1b1TpPcVSvMUBX3RuTBfLiuQG6vNctNGnuqM1Ibk=; b=taUe+upTZE38AG6+GvZ5Ft5Y9n
	CujQytfxMHMbaUEt2kB93GecUZ3tz6xu22KbltCzwtc1Jnw+MZ9A0WFSGbbSLsvbFjkXq1x7Eb4Rp
	7nQ0A2rI5VHReHx+tHFKKJucUA2+IdyfjfutuiTObGJ+6xv4OzERnf9Ik5jYRSh66rwo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] process/release: mention MAINTAINERS adjustments
Message-Id: <E1twgeH-00BIOR-2z@xenbits.xenproject.org>
Date: Mon, 24 Mar 2025 12:11:21 +0000

commit 86fc80ca8e6062025bea269929036d5a4dcb7f74
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 24 12:55:24 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 24 12:55:24 2025 +0100

    process/release: mention MAINTAINERS adjustments
    
    For many major releases I've been updating ./MAINTAINERS _after_ the
    respective branch was handed over to me. That update, however, is
    relevant not only from the .1 minor release onwards, but right from the
    .0 release. Hence it ought to be done as one of the last things before
    tagging the tree for the new major release.
    
    See the seemingly unrelated parts (as far as the commit subject goes) of
    e.g. 9d465658b405 ("update Xen version to 4.20.1-pre") for an example.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/process/release-technician-checklist.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/docs/process/release-technician-checklist.txt b/docs/process/release-technician-checklist.txt
index 4b061bf5f2..7bbe7c1489 100644
--- a/docs/process/release-technician-checklist.txt
+++ b/docs/process/release-technician-checklist.txt
@@ -53,6 +53,9 @@ t=RELEASE-$r
     - "Xen 4.5-unstable" on unstable
     - "Xen 4.5-rc" for release candidate
 
+* for major releases, drop staging-only text from MAINTAINERS and add stable
+  maintainer(s) there
+
 * change xen-unstable Config.mk
 #   QEMU_UPSTREAM_REVISION,
 #   QEMU_TRADITIONAL_REVISION
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 24 12:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Mar 2025 12:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.925433.1328301 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twgeT-00045N-MZ; Mon, 24 Mar 2025 12:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 925433.1328301; Mon, 24 Mar 2025 12:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twgeT-00045F-K2; Mon, 24 Mar 2025 12:11:33 +0000
Received: by outflank-mailman (input) for mailman id 925433;
 Mon, 24 Mar 2025 12:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twgeS-0003zh-35
 for xen-changelog@lists.xenproject.org; Mon, 24 Mar 2025 12:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twgeS-005YLG-0y
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 12:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twgeS-00BIQA-06
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 12:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7ZcO/hHWMK72D9qpHWwQ8ST98P4nC5sIWNEq3+WoV0k=; b=5Bz0B/+k0ZLqMri1BufGF1BG0m
	ropYEg2a8qfZ/IUb444xu+KttntQRUFHu2pEDsP9Sr6SRaBFeJnObzJohOKyn8Mj+V6cZRYSfZEOp
	E/hEEw8otfFEItZJMOG6bZ7+pl2DX6lOJSWrpzKHIfAuAS53WPVMMCJ8d49JSs+V0dQ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: make Viridian support optional
Message-Id: <E1twgeS-00BIQA-06@xenbits.xenproject.org>
Date: Mon, 24 Mar 2025 12:11:32 +0000

commit e0cf36bf295b40cac71af26b35eedee216e156ff
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Mon Mar 24 12:55:39 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 24 12:55:39 2025 +0100

    x86: make Viridian support optional
    
    Add config option HVM_VIRIDIAN that covers viridian code within HVM.
    Calls to viridian functions guarded by is_viridian_domain() and related macros.
    Having this option may be beneficial by reducing code footprint for systems
    that are not using Hyper-V.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/Kconfig              | 10 ++++++++++
 xen/arch/x86/hvm/Makefile             |  2 +-
 xen/arch/x86/hvm/hvm.c                | 27 ++++++++++++++++++---------
 xen/arch/x86/hvm/vlapic.c             | 11 +++++++----
 xen/arch/x86/include/asm/hvm/domain.h |  2 ++
 xen/arch/x86/include/asm/hvm/hvm.h    |  3 ++-
 xen/arch/x86/include/asm/hvm/vcpu.h   |  2 ++
 7 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
index 2def0f98e2..4b4f07495b 100644
--- a/xen/arch/x86/hvm/Kconfig
+++ b/xen/arch/x86/hvm/Kconfig
@@ -63,6 +63,16 @@ config ALTP2M
 
 	  If unsure, stay with defaults.
 
+config HVM_VIRIDIAN
+	bool "Hyper-V enlightenments for guests" if EXPERT
+	default y
+	help
+	  Support optimizations for Hyper-V guests such as faster hypercalls,
+	  efficient timer and interrupt handling, and enhanced paravirtualized
+	  I/O. This is to improve performance and compatibility of Windows VMs.
+
+	  If unsure, say Y.
+
 config MEM_PAGING
 	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
 	depends on VM_EVENT
diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
index 4c1fa5c6c2..6cc2e74fc4 100644
--- a/xen/arch/x86/hvm/Makefile
+++ b/xen/arch/x86/hvm/Makefile
@@ -1,6 +1,6 @@
 obj-$(CONFIG_AMD_SVM) += svm/
 obj-$(CONFIG_INTEL_VMX) += vmx/
-obj-y += viridian/
+obj-$(CONFIG_HVM_VIRIDIAN) += viridian/
 
 obj-y += asid.o
 obj-y += dm.o
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 5950f3160f..529068e80c 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -695,9 +695,12 @@ int hvm_domain_initialise(struct domain *d,
     if ( hvm_tsc_scaling_supported )
         d->arch.hvm.tsc_scaling_ratio = hvm_default_tsc_scaling_ratio;
 
-    rc = viridian_domain_init(d);
-    if ( rc )
-        goto fail2;
+    if ( is_viridian_domain(d) )
+    {
+        rc = viridian_domain_init(d);
+        if ( rc )
+            goto fail2;
+    }
 
     rc = alternative_call(hvm_funcs.domain_initialise, d);
     if ( rc != 0 )
@@ -733,7 +736,8 @@ void hvm_domain_relinquish_resources(struct domain *d)
     if ( hvm_funcs.nhvm_domain_relinquish_resources )
         alternative_vcall(hvm_funcs.nhvm_domain_relinquish_resources, d);
 
-    viridian_domain_deinit(d);
+    if ( is_viridian_domain(d) )
+        viridian_domain_deinit(d);
 
     ioreq_server_destroy_all(d);
 
@@ -1637,9 +1641,12 @@ int hvm_vcpu_initialise(struct vcpu *v)
          && (rc = nestedhvm_vcpu_initialise(v)) < 0 ) /* teardown: nestedhvm_vcpu_destroy */
         goto fail5;
 
-    rc = viridian_vcpu_init(v);
-    if ( rc )
-        goto fail6;
+    if ( is_viridian_domain(d) )
+    {
+        rc = viridian_vcpu_init(v);
+        if ( rc )
+            goto fail6;
+    }
 
     rc = ioreq_server_add_vcpu_all(d, v);
     if ( rc != 0 )
@@ -1669,13 +1676,15 @@ int hvm_vcpu_initialise(struct vcpu *v)
  fail2:
     hvm_vcpu_cacheattr_destroy(v);
  fail1:
-    viridian_vcpu_deinit(v);
+    if ( is_viridian_domain(d) )
+        viridian_vcpu_deinit(v);
     return rc;
 }
 
 void hvm_vcpu_destroy(struct vcpu *v)
 {
-    viridian_vcpu_deinit(v);
+    if ( is_viridian_domain(v->domain) )
+        viridian_vcpu_deinit(v);
 
     ioreq_server_remove_vcpu_all(v->domain, v);
 
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 065b2aab5b..3d76ce3f0d 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -426,7 +426,8 @@ void vlapic_EOI_set(struct vlapic *vlapic)
      * priority vector and then recurse to handle the lower priority
      * vector.
      */
-    bool missed_eoi = viridian_apic_assist_completed(v);
+    bool missed_eoi = has_viridian_apic_assist(v->domain) &&
+                      viridian_apic_assist_completed(v);
     int vector;
 
  again:
@@ -442,7 +443,7 @@ void vlapic_EOI_set(struct vlapic *vlapic)
      * NOTE: It is harmless to call viridian_apic_assist_clear() on a
      *       recursion, even though it is not necessary.
      */
-    if ( !missed_eoi )
+    if ( has_viridian_apic_assist(v->domain) && !missed_eoi )
         viridian_apic_assist_clear(v);
 
     vlapic_clear_vector(vector, &vlapic->regs->data[APIC_ISR]);
@@ -1360,7 +1361,8 @@ int vlapic_has_pending_irq(struct vcpu *v)
      * If so, we need to emulate the EOI here before comparing ISR
      * with IRR.
      */
-    if ( viridian_apic_assist_completed(v) )
+    if ( has_viridian_apic_assist(v->domain) &&
+         viridian_apic_assist_completed(v) )
         vlapic_EOI_set(vlapic);
 
     isr = vlapic_find_highest_isr(vlapic);
@@ -1373,7 +1375,8 @@ int vlapic_has_pending_irq(struct vcpu *v)
     if ( isr >= 0 &&
          (irr & 0xf0) <= (isr & 0xf0) )
     {
-        viridian_apic_assist_clear(v);
+        if ( has_viridian_apic_assist(v->domain) )
+            viridian_apic_assist_clear(v);
         return -1;
     }
 
diff --git a/xen/arch/x86/include/asm/hvm/domain.h b/xen/arch/x86/include/asm/hvm/domain.h
index 333501d5f2..07eec231f0 100644
--- a/xen/arch/x86/include/asm/hvm/domain.h
+++ b/xen/arch/x86/include/asm/hvm/domain.h
@@ -111,7 +111,9 @@ struct hvm_domain {
     /* hypervisor intercepted msix table */
     struct list_head       msixtbl_list;
 
+#ifdef CONFIG_HVM_VIRIDIAN
     struct viridian_domain *viridian;
+#endif
 
     /*
      * TSC value that VCPUs use to calculate their tsc_offset value.
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 963e820113..9c30457ece 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -507,7 +507,8 @@ hvm_get_cpl(struct vcpu *v)
     (has_hvm_params(d) ? (d)->arch.hvm.params[HVM_PARAM_VIRIDIAN] : 0)
 
 #define is_viridian_domain(d) \
-    (is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))
+    (IS_ENABLED(CONFIG_HVM_VIRIDIAN) && \
+     is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))
 
 #define is_viridian_vcpu(v) \
     is_viridian_domain((v)->domain)
diff --git a/xen/arch/x86/include/asm/hvm/vcpu.h b/xen/arch/x86/include/asm/hvm/vcpu.h
index 196fed6d5d..4c5a76a707 100644
--- a/xen/arch/x86/include/asm/hvm/vcpu.h
+++ b/xen/arch/x86/include/asm/hvm/vcpu.h
@@ -172,7 +172,9 @@ struct hvm_vcpu {
     /* Pending hw/sw interrupt (.vector = -1 means nothing pending). */
     struct x86_event     inject_event;
 
+#ifdef CONFIG_HVM_VIRIDIAN
     struct viridian_vcpu *viridian;
+#endif
 };
 
 #endif /* __ASM_X86_HVM_VCPU_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 24 13:44:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Mar 2025 13:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.925549.1328414 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twi5y-0004C0-GZ; Mon, 24 Mar 2025 13:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 925549.1328414; Mon, 24 Mar 2025 13:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twi5y-0004Bt-Dm; Mon, 24 Mar 2025 13:44:02 +0000
Received: by outflank-mailman (input) for mailman id 925549;
 Mon, 24 Mar 2025 13:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twi5x-0004Bl-RC
 for xen-changelog@lists.xenproject.org; Mon, 24 Mar 2025 13:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twi5x-005ae8-33
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 13:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twi5x-00BaKu-22
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 13:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=B92nJpn4HeR5W3u/rBNKhvVijyR808qLUokJWQOfkoY=; b=Y9Co0UHzIXB53FyBgv3t8s5iLc
	4L+uS2P925WdtGSkEG9gCFhiyUEKvziG+TMJIv7htOFzd7v/WywFrJZ/vBY+g+3n1cU+Nx1pSyfI0
	IlbVA8jqsAAt8om0KyiEWWwM05KHQbMckousQb8aLSyz3hR2JRyCqZqelu12dFoCxJ5U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "x86: make Viridian support optional"
Message-Id: <E1twi5x-00BaKu-22@xenbits.xenproject.org>
Date: Mon, 24 Mar 2025 13:44:01 +0000

commit 1fffcf10cd71f5d5669d6f5a67fa53b8912c4ef1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 24 14:36:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 24 14:36:57 2025 +0100

    Revert "x86: make Viridian support optional"
    
    This reverts commit e0cf36bf295b40cac71af26b35eedee216e156ff. It
    introduced not just UBSAN failures, but apparentlz actual NULL
    de-references.
---
 xen/arch/x86/hvm/Kconfig              | 10 ----------
 xen/arch/x86/hvm/Makefile             |  2 +-
 xen/arch/x86/hvm/hvm.c                | 27 +++++++++------------------
 xen/arch/x86/hvm/vlapic.c             | 11 ++++-------
 xen/arch/x86/include/asm/hvm/domain.h |  2 --
 xen/arch/x86/include/asm/hvm/hvm.h    |  3 +--
 xen/arch/x86/include/asm/hvm/vcpu.h   |  2 --
 7 files changed, 15 insertions(+), 42 deletions(-)

diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
index 4b4f07495b..2def0f98e2 100644
--- a/xen/arch/x86/hvm/Kconfig
+++ b/xen/arch/x86/hvm/Kconfig
@@ -63,16 +63,6 @@ config ALTP2M
 
 	  If unsure, stay with defaults.
 
-config HVM_VIRIDIAN
-	bool "Hyper-V enlightenments for guests" if EXPERT
-	default y
-	help
-	  Support optimizations for Hyper-V guests such as faster hypercalls,
-	  efficient timer and interrupt handling, and enhanced paravirtualized
-	  I/O. This is to improve performance and compatibility of Windows VMs.
-
-	  If unsure, say Y.
-
 config MEM_PAGING
 	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
 	depends on VM_EVENT
diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
index 6cc2e74fc4..4c1fa5c6c2 100644
--- a/xen/arch/x86/hvm/Makefile
+++ b/xen/arch/x86/hvm/Makefile
@@ -1,6 +1,6 @@
 obj-$(CONFIG_AMD_SVM) += svm/
 obj-$(CONFIG_INTEL_VMX) += vmx/
-obj-$(CONFIG_HVM_VIRIDIAN) += viridian/
+obj-y += viridian/
 
 obj-y += asid.o
 obj-y += dm.o
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 529068e80c..5950f3160f 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -695,12 +695,9 @@ int hvm_domain_initialise(struct domain *d,
     if ( hvm_tsc_scaling_supported )
         d->arch.hvm.tsc_scaling_ratio = hvm_default_tsc_scaling_ratio;
 
-    if ( is_viridian_domain(d) )
-    {
-        rc = viridian_domain_init(d);
-        if ( rc )
-            goto fail2;
-    }
+    rc = viridian_domain_init(d);
+    if ( rc )
+        goto fail2;
 
     rc = alternative_call(hvm_funcs.domain_initialise, d);
     if ( rc != 0 )
@@ -736,8 +733,7 @@ void hvm_domain_relinquish_resources(struct domain *d)
     if ( hvm_funcs.nhvm_domain_relinquish_resources )
         alternative_vcall(hvm_funcs.nhvm_domain_relinquish_resources, d);
 
-    if ( is_viridian_domain(d) )
-        viridian_domain_deinit(d);
+    viridian_domain_deinit(d);
 
     ioreq_server_destroy_all(d);
 
@@ -1641,12 +1637,9 @@ int hvm_vcpu_initialise(struct vcpu *v)
          && (rc = nestedhvm_vcpu_initialise(v)) < 0 ) /* teardown: nestedhvm_vcpu_destroy */
         goto fail5;
 
-    if ( is_viridian_domain(d) )
-    {
-        rc = viridian_vcpu_init(v);
-        if ( rc )
-            goto fail6;
-    }
+    rc = viridian_vcpu_init(v);
+    if ( rc )
+        goto fail6;
 
     rc = ioreq_server_add_vcpu_all(d, v);
     if ( rc != 0 )
@@ -1676,15 +1669,13 @@ int hvm_vcpu_initialise(struct vcpu *v)
  fail2:
     hvm_vcpu_cacheattr_destroy(v);
  fail1:
-    if ( is_viridian_domain(d) )
-        viridian_vcpu_deinit(v);
+    viridian_vcpu_deinit(v);
     return rc;
 }
 
 void hvm_vcpu_destroy(struct vcpu *v)
 {
-    if ( is_viridian_domain(v->domain) )
-        viridian_vcpu_deinit(v);
+    viridian_vcpu_deinit(v);
 
     ioreq_server_remove_vcpu_all(v->domain, v);
 
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 3d76ce3f0d..065b2aab5b 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -426,8 +426,7 @@ void vlapic_EOI_set(struct vlapic *vlapic)
      * priority vector and then recurse to handle the lower priority
      * vector.
      */
-    bool missed_eoi = has_viridian_apic_assist(v->domain) &&
-                      viridian_apic_assist_completed(v);
+    bool missed_eoi = viridian_apic_assist_completed(v);
     int vector;
 
  again:
@@ -443,7 +442,7 @@ void vlapic_EOI_set(struct vlapic *vlapic)
      * NOTE: It is harmless to call viridian_apic_assist_clear() on a
      *       recursion, even though it is not necessary.
      */
-    if ( has_viridian_apic_assist(v->domain) && !missed_eoi )
+    if ( !missed_eoi )
         viridian_apic_assist_clear(v);
 
     vlapic_clear_vector(vector, &vlapic->regs->data[APIC_ISR]);
@@ -1361,8 +1360,7 @@ int vlapic_has_pending_irq(struct vcpu *v)
      * If so, we need to emulate the EOI here before comparing ISR
      * with IRR.
      */
-    if ( has_viridian_apic_assist(v->domain) &&
-         viridian_apic_assist_completed(v) )
+    if ( viridian_apic_assist_completed(v) )
         vlapic_EOI_set(vlapic);
 
     isr = vlapic_find_highest_isr(vlapic);
@@ -1375,8 +1373,7 @@ int vlapic_has_pending_irq(struct vcpu *v)
     if ( isr >= 0 &&
          (irr & 0xf0) <= (isr & 0xf0) )
     {
-        if ( has_viridian_apic_assist(v->domain) )
-            viridian_apic_assist_clear(v);
+        viridian_apic_assist_clear(v);
         return -1;
     }
 
diff --git a/xen/arch/x86/include/asm/hvm/domain.h b/xen/arch/x86/include/asm/hvm/domain.h
index 07eec231f0..333501d5f2 100644
--- a/xen/arch/x86/include/asm/hvm/domain.h
+++ b/xen/arch/x86/include/asm/hvm/domain.h
@@ -111,9 +111,7 @@ struct hvm_domain {
     /* hypervisor intercepted msix table */
     struct list_head       msixtbl_list;
 
-#ifdef CONFIG_HVM_VIRIDIAN
     struct viridian_domain *viridian;
-#endif
 
     /*
      * TSC value that VCPUs use to calculate their tsc_offset value.
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 9c30457ece..963e820113 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -507,8 +507,7 @@ hvm_get_cpl(struct vcpu *v)
     (has_hvm_params(d) ? (d)->arch.hvm.params[HVM_PARAM_VIRIDIAN] : 0)
 
 #define is_viridian_domain(d) \
-    (IS_ENABLED(CONFIG_HVM_VIRIDIAN) && \
-     is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))
+    (is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))
 
 #define is_viridian_vcpu(v) \
     is_viridian_domain((v)->domain)
diff --git a/xen/arch/x86/include/asm/hvm/vcpu.h b/xen/arch/x86/include/asm/hvm/vcpu.h
index 4c5a76a707..196fed6d5d 100644
--- a/xen/arch/x86/include/asm/hvm/vcpu.h
+++ b/xen/arch/x86/include/asm/hvm/vcpu.h
@@ -172,9 +172,7 @@ struct hvm_vcpu {
     /* Pending hw/sw interrupt (.vector = -1 means nothing pending). */
     struct x86_event     inject_event;
 
-#ifdef CONFIG_HVM_VIRIDIAN
     struct viridian_vcpu *viridian;
-#endif
 };
 
 #endif /* __ASM_X86_HVM_VCPU_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 24 14:44:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Mar 2025 14:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.925714.1328579 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twj23-0001ho-Po; Mon, 24 Mar 2025 14:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 925714.1328579; Mon, 24 Mar 2025 14:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twj23-0001hg-Mi; Mon, 24 Mar 2025 14:44:03 +0000
Received: by outflank-mailman (input) for mailman id 925714;
 Mon, 24 Mar 2025 14:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twj22-0001ha-9f
 for xen-changelog@lists.xenproject.org; Mon, 24 Mar 2025 14:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twj22-005c9E-0h
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 14:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twj21-00Bjvg-2u
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 14:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hMf9oQfoxNegmGqJMWS3JYTlulIlb0TxKdinGoNnazM=; b=iYebXJnLIZ7ykVjO/S9U7cH6B9
	eOt0oWiek/stnGezD2Z+HoHsNvSn48Rd486TahPuPdifJinMFNOSt5MPToIIT+rtXGO7Ag0JaC/qY
	V+tnklqDzeBWYuGTNSraPvj47Em33rsDio96nxX9NKFz7pzH6q2yIX5i/BJrOCO08INY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PVH: don't open-code elf_round_up()
Message-Id: <E1twj21-00Bjvg-2u@xenbits.xenproject.org>
Date: Mon, 24 Mar 2025 14:44:01 +0000

commit d7ef23954c1ccdb99f4107ca26278950ab0bbfe8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 24 12:54:27 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 24 12:54:27 2025 +0100

    x86/PVH: don't open-code elf_round_up()
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/dom0_build.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 6591949984..6e287a81e7 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -718,8 +718,7 @@ static int __init pvh_load_kernel(
         extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
 
     if ( cmdline )
-        extra_space += ROUNDUP(strlen(cmdline) + 1,
-                               elf_64bit(&elf) ? 8 : 4);
+        extra_space += elf_round_up(&elf, strlen(cmdline) + 1);
 
     last_addr = find_memory(d, &elf, extra_space);
     if ( last_addr == INVALID_PADDR )
@@ -740,7 +739,7 @@ static int __init pvh_load_kernel(
 
         mod.paddr = last_addr;
         mod.size = initrd_len;
-        last_addr += ROUNDUP(initrd_len, elf_64bit(&elf) ? 8 : 4);
+        last_addr += elf_round_up(&elf, initrd_len);
         if ( initrd->cmdline_pa )
         {
             char *str = __va(initrd->cmdline_pa);
@@ -774,7 +773,7 @@ static int __init pvh_load_kernel(
          * Round up to 32/64 bits (depending on the guest kernel bitness) so
          * the modlist/start_info is aligned.
          */
-        last_addr += ROUNDUP(strlen(cmdline) + 1, elf_64bit(&elf) ? 8 : 4);
+        last_addr += elf_round_up(&elf, strlen(cmdline) + 1);
     }
     if ( initrd != NULL )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 24 14:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Mar 2025 14:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.925715.1328583 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twj2D-0001kF-SO; Mon, 24 Mar 2025 14:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 925715.1328583; Mon, 24 Mar 2025 14:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twj2D-0001k7-PP; Mon, 24 Mar 2025 14:44:13 +0000
Received: by outflank-mailman (input) for mailman id 925715;
 Mon, 24 Mar 2025 14:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twj2C-0001jc-46
 for xen-changelog@lists.xenproject.org; Mon, 24 Mar 2025 14:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twj2C-005c9Y-11
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 14:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twj2C-00BjxP-09
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 14:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OnS1xSsFt236l1gzsMjwH7uKtzEo6c2MlR0JiAfNjuw=; b=ZwO37GdNiIMm/WCDREEIyjvmza
	STsXgMcYfCnVyAZAISOcbb9X6n3nthQlwmsOxgLggCtvGXfn5hCPYBLySYbeGlfSssO9xv1y5hp+Q
	Hdwlw8e6tm9CtLHuTIlpy0khMokJ+rxLeyFnvis063kipUvxgfL+3zi+Cinc72DUHCyE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: use nsvm_efer_svm_enabled() to check guest's EFER.SVME
Message-Id: <E1twj2C-00BjxP-09@xenbits.xenproject.org>
Date: Mon, 24 Mar 2025 14:44:12 +0000

commit 10eb9e0aa1dd8a10c8c6c483a79dd4433e43a501
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Mon Mar 24 12:55:00 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 24 12:55:00 2025 +0100

    x86/svm: use nsvm_efer_svm_enabled() to check guest's EFER.SVME
    
    There's a macro for this, might improve readability a bit & save a bit of space.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/svm/nestedsvm.c | 2 +-
 xen/arch/x86/hvm/svm/svm.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 35a2cbfd7d..dc2b6a4253 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -1616,7 +1616,7 @@ void svm_nested_features_on_efer_update(struct vcpu *v)
      * Need state for transfering the nested gif status so only write on
      * the hvm_vcpu EFER.SVME changing.
      */
-    if ( v->arch.hvm.guest_efer & EFER_SVME )
+    if ( nsvm_efer_svm_enabled(v) )
     {
         if ( !vmcb->virt_ext.fields.vloadsave_enable &&
              paging_mode_hap(v->domain) &&
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 4b24891096..e33a38c1e4 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -253,7 +253,7 @@ static void cf_check svm_update_guest_efer(struct vcpu *v)
     vmcb_set_efer(vmcb, guest_efer);
 
     ASSERT(nestedhvm_enabled(v->domain) ||
-           !(v->arch.hvm.guest_efer & EFER_SVME));
+           !nsvm_efer_svm_enabled(v));
 
     if ( nestedhvm_enabled(v->domain) )
         svm_nested_features_on_efer_update(v);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 24 14:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Mar 2025 14:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.925716.1328586 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twj2N-0001mS-Tl; Mon, 24 Mar 2025 14:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 925716.1328586; Mon, 24 Mar 2025 14:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twj2N-0001mI-Qy; Mon, 24 Mar 2025 14:44:23 +0000
Received: by outflank-mailman (input) for mailman id 925716;
 Mon, 24 Mar 2025 14:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twj2M-0001m7-6T
 for xen-changelog@lists.xenproject.org; Mon, 24 Mar 2025 14:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twj2M-005c9c-1J
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 14:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twj2M-00Bjz3-0R
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 14:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MQ7MMkx6Uy1ls2F0xbXUw19sBamcviY0oGTMa51xjHA=; b=vhHaa/SjZuYhQEcblQyEzJ3sP+
	gt2QIGTDCSpsOYvsLoZxBUn4RtKIaZDgKCmIXgJUDKmSFHXzpUWLlEKGbxMYmK16TLMZiMFLVIPuO
	CvRmFJrHmiQievE2WJVresf4w2nZqLeQK39YRCRsttxVjAe8NcA4gYDzI3P3k+5Hcvic=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] process/release: mention MAINTAINERS adjustments
Message-Id: <E1twj2M-00Bjz3-0R@xenbits.xenproject.org>
Date: Mon, 24 Mar 2025 14:44:22 +0000

commit 86fc80ca8e6062025bea269929036d5a4dcb7f74
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 24 12:55:24 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 24 12:55:24 2025 +0100

    process/release: mention MAINTAINERS adjustments
    
    For many major releases I've been updating ./MAINTAINERS _after_ the
    respective branch was handed over to me. That update, however, is
    relevant not only from the .1 minor release onwards, but right from the
    .0 release. Hence it ought to be done as one of the last things before
    tagging the tree for the new major release.
    
    See the seemingly unrelated parts (as far as the commit subject goes) of
    e.g. 9d465658b405 ("update Xen version to 4.20.1-pre") for an example.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/process/release-technician-checklist.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/docs/process/release-technician-checklist.txt b/docs/process/release-technician-checklist.txt
index 4b061bf5f2..7bbe7c1489 100644
--- a/docs/process/release-technician-checklist.txt
+++ b/docs/process/release-technician-checklist.txt
@@ -53,6 +53,9 @@ t=RELEASE-$r
     - "Xen 4.5-unstable" on unstable
     - "Xen 4.5-rc" for release candidate
 
+* for major releases, drop staging-only text from MAINTAINERS and add stable
+  maintainer(s) there
+
 * change xen-unstable Config.mk
 #   QEMU_UPSTREAM_REVISION,
 #   QEMU_TRADITIONAL_REVISION
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 24 14:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Mar 2025 14:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.925717.1328591 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twj2X-0001pK-V7; Mon, 24 Mar 2025 14:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 925717.1328591; Mon, 24 Mar 2025 14:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twj2X-0001pC-SP; Mon, 24 Mar 2025 14:44:33 +0000
Received: by outflank-mailman (input) for mailman id 925717;
 Mon, 24 Mar 2025 14:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twj2W-0001on-Ae
 for xen-changelog@lists.xenproject.org; Mon, 24 Mar 2025 14:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twj2W-005c9h-1i
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 14:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twj2W-00Bk3B-0q
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 14:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EZ5vytlRU41P7wnw5RlAZ+iZpqXqZZ7mYwVMlXULPTc=; b=VtnhKtVDkkV4LLnZgx099ii5Gw
	Vb43HfAoq9oVYi0MY6UkOE1g667/Pu4KGb9mRDzweL0A67nDg1Mv7JC/nHfrjvm3x3TvNxJjPJc2Z
	oTkY6XgX1ILfVaTGW0jCNvl0KSB22Mg9UN3pguoH1XpVbk4qZ/Mygz01eWJF0TzsAbZE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: make Viridian support optional
Message-Id: <E1twj2W-00Bk3B-0q@xenbits.xenproject.org>
Date: Mon, 24 Mar 2025 14:44:32 +0000

commit e0cf36bf295b40cac71af26b35eedee216e156ff
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Mon Mar 24 12:55:39 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 24 12:55:39 2025 +0100

    x86: make Viridian support optional
    
    Add config option HVM_VIRIDIAN that covers viridian code within HVM.
    Calls to viridian functions guarded by is_viridian_domain() and related macros.
    Having this option may be beneficial by reducing code footprint for systems
    that are not using Hyper-V.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/Kconfig              | 10 ++++++++++
 xen/arch/x86/hvm/Makefile             |  2 +-
 xen/arch/x86/hvm/hvm.c                | 27 ++++++++++++++++++---------
 xen/arch/x86/hvm/vlapic.c             | 11 +++++++----
 xen/arch/x86/include/asm/hvm/domain.h |  2 ++
 xen/arch/x86/include/asm/hvm/hvm.h    |  3 ++-
 xen/arch/x86/include/asm/hvm/vcpu.h   |  2 ++
 7 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
index 2def0f98e2..4b4f07495b 100644
--- a/xen/arch/x86/hvm/Kconfig
+++ b/xen/arch/x86/hvm/Kconfig
@@ -63,6 +63,16 @@ config ALTP2M
 
 	  If unsure, stay with defaults.
 
+config HVM_VIRIDIAN
+	bool "Hyper-V enlightenments for guests" if EXPERT
+	default y
+	help
+	  Support optimizations for Hyper-V guests such as faster hypercalls,
+	  efficient timer and interrupt handling, and enhanced paravirtualized
+	  I/O. This is to improve performance and compatibility of Windows VMs.
+
+	  If unsure, say Y.
+
 config MEM_PAGING
 	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
 	depends on VM_EVENT
diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
index 4c1fa5c6c2..6cc2e74fc4 100644
--- a/xen/arch/x86/hvm/Makefile
+++ b/xen/arch/x86/hvm/Makefile
@@ -1,6 +1,6 @@
 obj-$(CONFIG_AMD_SVM) += svm/
 obj-$(CONFIG_INTEL_VMX) += vmx/
-obj-y += viridian/
+obj-$(CONFIG_HVM_VIRIDIAN) += viridian/
 
 obj-y += asid.o
 obj-y += dm.o
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 5950f3160f..529068e80c 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -695,9 +695,12 @@ int hvm_domain_initialise(struct domain *d,
     if ( hvm_tsc_scaling_supported )
         d->arch.hvm.tsc_scaling_ratio = hvm_default_tsc_scaling_ratio;
 
-    rc = viridian_domain_init(d);
-    if ( rc )
-        goto fail2;
+    if ( is_viridian_domain(d) )
+    {
+        rc = viridian_domain_init(d);
+        if ( rc )
+            goto fail2;
+    }
 
     rc = alternative_call(hvm_funcs.domain_initialise, d);
     if ( rc != 0 )
@@ -733,7 +736,8 @@ void hvm_domain_relinquish_resources(struct domain *d)
     if ( hvm_funcs.nhvm_domain_relinquish_resources )
         alternative_vcall(hvm_funcs.nhvm_domain_relinquish_resources, d);
 
-    viridian_domain_deinit(d);
+    if ( is_viridian_domain(d) )
+        viridian_domain_deinit(d);
 
     ioreq_server_destroy_all(d);
 
@@ -1637,9 +1641,12 @@ int hvm_vcpu_initialise(struct vcpu *v)
          && (rc = nestedhvm_vcpu_initialise(v)) < 0 ) /* teardown: nestedhvm_vcpu_destroy */
         goto fail5;
 
-    rc = viridian_vcpu_init(v);
-    if ( rc )
-        goto fail6;
+    if ( is_viridian_domain(d) )
+    {
+        rc = viridian_vcpu_init(v);
+        if ( rc )
+            goto fail6;
+    }
 
     rc = ioreq_server_add_vcpu_all(d, v);
     if ( rc != 0 )
@@ -1669,13 +1676,15 @@ int hvm_vcpu_initialise(struct vcpu *v)
  fail2:
     hvm_vcpu_cacheattr_destroy(v);
  fail1:
-    viridian_vcpu_deinit(v);
+    if ( is_viridian_domain(d) )
+        viridian_vcpu_deinit(v);
     return rc;
 }
 
 void hvm_vcpu_destroy(struct vcpu *v)
 {
-    viridian_vcpu_deinit(v);
+    if ( is_viridian_domain(v->domain) )
+        viridian_vcpu_deinit(v);
 
     ioreq_server_remove_vcpu_all(v->domain, v);
 
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 065b2aab5b..3d76ce3f0d 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -426,7 +426,8 @@ void vlapic_EOI_set(struct vlapic *vlapic)
      * priority vector and then recurse to handle the lower priority
      * vector.
      */
-    bool missed_eoi = viridian_apic_assist_completed(v);
+    bool missed_eoi = has_viridian_apic_assist(v->domain) &&
+                      viridian_apic_assist_completed(v);
     int vector;
 
  again:
@@ -442,7 +443,7 @@ void vlapic_EOI_set(struct vlapic *vlapic)
      * NOTE: It is harmless to call viridian_apic_assist_clear() on a
      *       recursion, even though it is not necessary.
      */
-    if ( !missed_eoi )
+    if ( has_viridian_apic_assist(v->domain) && !missed_eoi )
         viridian_apic_assist_clear(v);
 
     vlapic_clear_vector(vector, &vlapic->regs->data[APIC_ISR]);
@@ -1360,7 +1361,8 @@ int vlapic_has_pending_irq(struct vcpu *v)
      * If so, we need to emulate the EOI here before comparing ISR
      * with IRR.
      */
-    if ( viridian_apic_assist_completed(v) )
+    if ( has_viridian_apic_assist(v->domain) &&
+         viridian_apic_assist_completed(v) )
         vlapic_EOI_set(vlapic);
 
     isr = vlapic_find_highest_isr(vlapic);
@@ -1373,7 +1375,8 @@ int vlapic_has_pending_irq(struct vcpu *v)
     if ( isr >= 0 &&
          (irr & 0xf0) <= (isr & 0xf0) )
     {
-        viridian_apic_assist_clear(v);
+        if ( has_viridian_apic_assist(v->domain) )
+            viridian_apic_assist_clear(v);
         return -1;
     }
 
diff --git a/xen/arch/x86/include/asm/hvm/domain.h b/xen/arch/x86/include/asm/hvm/domain.h
index 333501d5f2..07eec231f0 100644
--- a/xen/arch/x86/include/asm/hvm/domain.h
+++ b/xen/arch/x86/include/asm/hvm/domain.h
@@ -111,7 +111,9 @@ struct hvm_domain {
     /* hypervisor intercepted msix table */
     struct list_head       msixtbl_list;
 
+#ifdef CONFIG_HVM_VIRIDIAN
     struct viridian_domain *viridian;
+#endif
 
     /*
      * TSC value that VCPUs use to calculate their tsc_offset value.
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 963e820113..9c30457ece 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -507,7 +507,8 @@ hvm_get_cpl(struct vcpu *v)
     (has_hvm_params(d) ? (d)->arch.hvm.params[HVM_PARAM_VIRIDIAN] : 0)
 
 #define is_viridian_domain(d) \
-    (is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))
+    (IS_ENABLED(CONFIG_HVM_VIRIDIAN) && \
+     is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))
 
 #define is_viridian_vcpu(v) \
     is_viridian_domain((v)->domain)
diff --git a/xen/arch/x86/include/asm/hvm/vcpu.h b/xen/arch/x86/include/asm/hvm/vcpu.h
index 196fed6d5d..4c5a76a707 100644
--- a/xen/arch/x86/include/asm/hvm/vcpu.h
+++ b/xen/arch/x86/include/asm/hvm/vcpu.h
@@ -172,7 +172,9 @@ struct hvm_vcpu {
     /* Pending hw/sw interrupt (.vector = -1 means nothing pending). */
     struct x86_event     inject_event;
 
+#ifdef CONFIG_HVM_VIRIDIAN
     struct viridian_vcpu *viridian;
+#endif
 };
 
 #endif /* __ASM_X86_HVM_VCPU_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 24 14:44:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 24 Mar 2025 14:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.925718.1328595 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twj2i-0001s2-0l; Mon, 24 Mar 2025 14:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 925718.1328595; Mon, 24 Mar 2025 14:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twj2h-0001rp-U9; Mon, 24 Mar 2025 14:44:43 +0000
Received: by outflank-mailman (input) for mailman id 925718;
 Mon, 24 Mar 2025 14:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twj2g-0001ra-De
 for xen-changelog@lists.xenproject.org; Mon, 24 Mar 2025 14:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twj2g-005c9n-21
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 14:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twj2g-00Bk7H-1A
 for xen-changelog@lists.xenproject.org;
 Mon, 24 Mar 2025 14:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FNSZ1m/aN5NnvY7yGtc8YOmX/HCUTrfnZOKeQqZWjrM=; b=D5oYBnPvoF7sx7yZxuvlWIOSa1
	7vsSc7P5ggPM7rl9UgHJG7p5JnFzeY6VhZGreLyP/6b/uYsfb1yiZW9II2o+v4o8+ibosC4GibkIR
	rV6SAJjVwZYUiMlEmRUCrMMJ8QjmtKiUk1+lettVDjj9HzRiR7s1DPn/GGgx0YhF6Oqs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "x86: make Viridian support optional"
Message-Id: <E1twj2g-00Bk7H-1A@xenbits.xenproject.org>
Date: Mon, 24 Mar 2025 14:44:42 +0000

commit 1fffcf10cd71f5d5669d6f5a67fa53b8912c4ef1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 24 14:36:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 24 14:36:57 2025 +0100

    Revert "x86: make Viridian support optional"
    
    This reverts commit e0cf36bf295b40cac71af26b35eedee216e156ff. It
    introduced not just UBSAN failures, but apparentlz actual NULL
    de-references.
---
 xen/arch/x86/hvm/Kconfig              | 10 ----------
 xen/arch/x86/hvm/Makefile             |  2 +-
 xen/arch/x86/hvm/hvm.c                | 27 +++++++++------------------
 xen/arch/x86/hvm/vlapic.c             | 11 ++++-------
 xen/arch/x86/include/asm/hvm/domain.h |  2 --
 xen/arch/x86/include/asm/hvm/hvm.h    |  3 +--
 xen/arch/x86/include/asm/hvm/vcpu.h   |  2 --
 7 files changed, 15 insertions(+), 42 deletions(-)

diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
index 4b4f07495b..2def0f98e2 100644
--- a/xen/arch/x86/hvm/Kconfig
+++ b/xen/arch/x86/hvm/Kconfig
@@ -63,16 +63,6 @@ config ALTP2M
 
 	  If unsure, stay with defaults.
 
-config HVM_VIRIDIAN
-	bool "Hyper-V enlightenments for guests" if EXPERT
-	default y
-	help
-	  Support optimizations for Hyper-V guests such as faster hypercalls,
-	  efficient timer and interrupt handling, and enhanced paravirtualized
-	  I/O. This is to improve performance and compatibility of Windows VMs.
-
-	  If unsure, say Y.
-
 config MEM_PAGING
 	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
 	depends on VM_EVENT
diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
index 6cc2e74fc4..4c1fa5c6c2 100644
--- a/xen/arch/x86/hvm/Makefile
+++ b/xen/arch/x86/hvm/Makefile
@@ -1,6 +1,6 @@
 obj-$(CONFIG_AMD_SVM) += svm/
 obj-$(CONFIG_INTEL_VMX) += vmx/
-obj-$(CONFIG_HVM_VIRIDIAN) += viridian/
+obj-y += viridian/
 
 obj-y += asid.o
 obj-y += dm.o
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 529068e80c..5950f3160f 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -695,12 +695,9 @@ int hvm_domain_initialise(struct domain *d,
     if ( hvm_tsc_scaling_supported )
         d->arch.hvm.tsc_scaling_ratio = hvm_default_tsc_scaling_ratio;
 
-    if ( is_viridian_domain(d) )
-    {
-        rc = viridian_domain_init(d);
-        if ( rc )
-            goto fail2;
-    }
+    rc = viridian_domain_init(d);
+    if ( rc )
+        goto fail2;
 
     rc = alternative_call(hvm_funcs.domain_initialise, d);
     if ( rc != 0 )
@@ -736,8 +733,7 @@ void hvm_domain_relinquish_resources(struct domain *d)
     if ( hvm_funcs.nhvm_domain_relinquish_resources )
         alternative_vcall(hvm_funcs.nhvm_domain_relinquish_resources, d);
 
-    if ( is_viridian_domain(d) )
-        viridian_domain_deinit(d);
+    viridian_domain_deinit(d);
 
     ioreq_server_destroy_all(d);
 
@@ -1641,12 +1637,9 @@ int hvm_vcpu_initialise(struct vcpu *v)
          && (rc = nestedhvm_vcpu_initialise(v)) < 0 ) /* teardown: nestedhvm_vcpu_destroy */
         goto fail5;
 
-    if ( is_viridian_domain(d) )
-    {
-        rc = viridian_vcpu_init(v);
-        if ( rc )
-            goto fail6;
-    }
+    rc = viridian_vcpu_init(v);
+    if ( rc )
+        goto fail6;
 
     rc = ioreq_server_add_vcpu_all(d, v);
     if ( rc != 0 )
@@ -1676,15 +1669,13 @@ int hvm_vcpu_initialise(struct vcpu *v)
  fail2:
     hvm_vcpu_cacheattr_destroy(v);
  fail1:
-    if ( is_viridian_domain(d) )
-        viridian_vcpu_deinit(v);
+    viridian_vcpu_deinit(v);
     return rc;
 }
 
 void hvm_vcpu_destroy(struct vcpu *v)
 {
-    if ( is_viridian_domain(v->domain) )
-        viridian_vcpu_deinit(v);
+    viridian_vcpu_deinit(v);
 
     ioreq_server_remove_vcpu_all(v->domain, v);
 
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 3d76ce3f0d..065b2aab5b 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -426,8 +426,7 @@ void vlapic_EOI_set(struct vlapic *vlapic)
      * priority vector and then recurse to handle the lower priority
      * vector.
      */
-    bool missed_eoi = has_viridian_apic_assist(v->domain) &&
-                      viridian_apic_assist_completed(v);
+    bool missed_eoi = viridian_apic_assist_completed(v);
     int vector;
 
  again:
@@ -443,7 +442,7 @@ void vlapic_EOI_set(struct vlapic *vlapic)
      * NOTE: It is harmless to call viridian_apic_assist_clear() on a
      *       recursion, even though it is not necessary.
      */
-    if ( has_viridian_apic_assist(v->domain) && !missed_eoi )
+    if ( !missed_eoi )
         viridian_apic_assist_clear(v);
 
     vlapic_clear_vector(vector, &vlapic->regs->data[APIC_ISR]);
@@ -1361,8 +1360,7 @@ int vlapic_has_pending_irq(struct vcpu *v)
      * If so, we need to emulate the EOI here before comparing ISR
      * with IRR.
      */
-    if ( has_viridian_apic_assist(v->domain) &&
-         viridian_apic_assist_completed(v) )
+    if ( viridian_apic_assist_completed(v) )
         vlapic_EOI_set(vlapic);
 
     isr = vlapic_find_highest_isr(vlapic);
@@ -1375,8 +1373,7 @@ int vlapic_has_pending_irq(struct vcpu *v)
     if ( isr >= 0 &&
          (irr & 0xf0) <= (isr & 0xf0) )
     {
-        if ( has_viridian_apic_assist(v->domain) )
-            viridian_apic_assist_clear(v);
+        viridian_apic_assist_clear(v);
         return -1;
     }
 
diff --git a/xen/arch/x86/include/asm/hvm/domain.h b/xen/arch/x86/include/asm/hvm/domain.h
index 07eec231f0..333501d5f2 100644
--- a/xen/arch/x86/include/asm/hvm/domain.h
+++ b/xen/arch/x86/include/asm/hvm/domain.h
@@ -111,9 +111,7 @@ struct hvm_domain {
     /* hypervisor intercepted msix table */
     struct list_head       msixtbl_list;
 
-#ifdef CONFIG_HVM_VIRIDIAN
     struct viridian_domain *viridian;
-#endif
 
     /*
      * TSC value that VCPUs use to calculate their tsc_offset value.
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 9c30457ece..963e820113 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -507,8 +507,7 @@ hvm_get_cpl(struct vcpu *v)
     (has_hvm_params(d) ? (d)->arch.hvm.params[HVM_PARAM_VIRIDIAN] : 0)
 
 #define is_viridian_domain(d) \
-    (IS_ENABLED(CONFIG_HVM_VIRIDIAN) && \
-     is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))
+    (is_hvm_domain(d) && (viridian_feature_mask(d) & HVMPV_base_freq))
 
 #define is_viridian_vcpu(v) \
     is_viridian_domain((v)->domain)
diff --git a/xen/arch/x86/include/asm/hvm/vcpu.h b/xen/arch/x86/include/asm/hvm/vcpu.h
index 4c5a76a707..196fed6d5d 100644
--- a/xen/arch/x86/include/asm/hvm/vcpu.h
+++ b/xen/arch/x86/include/asm/hvm/vcpu.h
@@ -172,9 +172,7 @@ struct hvm_vcpu {
     /* Pending hw/sw interrupt (.vector = -1 means nothing pending). */
     struct x86_event     inject_event;
 
-#ifdef CONFIG_HVM_VIRIDIAN
     struct viridian_vcpu *viridian;
-#endif
 };
 
 #endif /* __ASM_X86_HVM_VCPU_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 25 08:33:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Mar 2025 08:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.926131.1328982 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twziY-0000W2-Mw; Tue, 25 Mar 2025 08:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 926131.1328982; Tue, 25 Mar 2025 08:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twziY-0000Vs-K9; Tue, 25 Mar 2025 08:33:02 +0000
Received: by outflank-mailman (input) for mailman id 926131;
 Tue, 25 Mar 2025 08:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twziX-0000Vl-PC
 for xen-changelog@lists.xenproject.org; Tue, 25 Mar 2025 08:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twziX-007VTY-2k
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 08:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twziX-00Drrs-1d
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 08:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PBOnT3Oz7NRQNCpLyR7QK5Y/hUDLbl6fxeaGH3yhO9A=; b=KAbyzJY83TNjCEMw7sEPX44DxV
	PZV5LM/r5LQju9P0R7Ubd+6FAz3gvj7zsT092rJmueQ3IQZUqWnzvXlozWI6b1I/w3VwOKvGKxff/
	HQZyolpvbburEJBK5M/VtzklNPhhLtewmG4BiFOZYebZ3wRozQHwGqpGdOrsjlzPAWpw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: Add some details on XenServer PCI devices
Message-Id: <E1twziX-00Drrs-1d@xenbits.xenproject.org>
Date: Tue, 25 Mar 2025 08:33:01 +0000

commit 14694975cd7323fab114822cc764a3eb9808bc57
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Mar 25 09:22:43 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 25 09:22:43 2025 +0100

    docs: Add some details on XenServer PCI devices
    
    Describe the usage of devices 5853:0002 and 5853:C000.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 docs/man/xen-pci-device-reservations.7.pod | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/man/xen-pci-device-reservations.7.pod b/docs/man/xen-pci-device-reservations.7.pod
index 9ddf3a18ad..adc325069c 100644
--- a/docs/man/xen-pci-device-reservations.7.pod
+++ b/docs/man/xen-pci-device-reservations.7.pod
@@ -10,6 +10,9 @@ use of this is with device ID 0x0001 to advertise the Xen Platform PCI
 device - the presence of this virtual device enables a guest Operating
 System (subject to the availability of suitable drivers) to make use of
 paravirtualisation features such as disk and network devices etc.
+XenServer, for Windows machines, may present Xen Platform device with device
+ID 0x0002 instead of 0x0001. Device 0x0001 and 0x0002 should be mutually
+exclusive.
 
 Some Xen vendors wish to provide alternative and/or additional guest drivers
 that can bind to virtual devices[1]. This may be done using the Xen PCI
@@ -86,4 +89,8 @@ and unplug protocol.
 libxl provides support for creation of a single additional xen-pvdevice.
 See the vendor_device parameter in xl.cfg(5).
 
+XenServer might present a xen-pvdevice device with ID 0xC000.
+Such device is a placeholder for Windows update usage and is always exposed
+in conjunction with a Xen Platform PCI device, usually with ID 0x0002
+
 =back
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 25 08:33:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Mar 2025 08:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.926132.1328985 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twzii-0000XR-O3; Tue, 25 Mar 2025 08:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 926132.1328985; Tue, 25 Mar 2025 08:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twzii-0000XK-La; Tue, 25 Mar 2025 08:33:12 +0000
Received: by outflank-mailman (input) for mailman id 926132;
 Tue, 25 Mar 2025 08:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twzih-0000XC-Oh
 for xen-changelog@lists.xenproject.org; Tue, 25 Mar 2025 08:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twzih-007VTe-35
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 08:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twzih-00DrtI-2A
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 08:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l4x25CNSiv49dSBgFTdnyiUyTfEfrRj2UVAQ/XBnHlw=; b=eSYvW+KPHzim7GQnB8Nfu9WUwV
	H5fLEGqY055nM0NGyT+3+YOS4JC/7jr/c8TBKDQF24EZ/mWmlcgczTR3gIuKQNeY18d6/gYce/MHY
	f1Erg2lL+Z9X/grO0Wdx3kU5TCeAu8WGedD5zIQpElY2rtdVPdVWHNs806JUKLs8qxzs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/irq: introduce APIC_VECTOR_VALID()
Message-Id: <E1twzih-00DrtI-2A@xenbits.xenproject.org>
Date: Tue, 25 Mar 2025 08:33:11 +0000

commit b7234d32e31e4d18e4fcd27d38b9c17e0790488a
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Tue Mar 25 09:22:59 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 25 09:22:59 2025 +0100

    x86/irq: introduce APIC_VECTOR_VALID()
    
    Add new macro APIC_VECTOR_VALID() to validate the interrupt vector
    range as per [1]. This macro replaces hardcoded checks against the
    open-coded value 16 in LAPIC and virtual LAPIC code and simplifies
    the code a bit.
    
    [1] Intel SDM volume 3A
        Chapter "ADVANCED PROGRAMMABLE INTERRUPT CONTROLLER"
        Section "Valid Interrupt Vectors"
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/mcheck/mce_intel.c |  3 +--
 xen/arch/x86/hvm/vlapic.c           | 10 +++++-----
 xen/arch/x86/include/asm/apicdef.h  |  2 ++
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index 07b50f8793..1e52b1ac25 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -135,8 +135,7 @@ static void intel_init_thermal(struct cpuinfo_x86 *c)
      * BIOS has programmed on AP based on BSP's info we saved (since BIOS
      * is required to set the same value for all threads/cores).
      */
-    if ( (val & APIC_DM_MASK) != APIC_DM_FIXED
-         || (val & APIC_VECTOR_MASK) > 0xf )
+    if ( (val & APIC_DM_MASK) != APIC_DM_FIXED || APIC_VECTOR_VALID(val) )
         apic_write(APIC_LVTTHMR, val);
 
     if ( (msr_content & (1ULL<<3))
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 065b2aab5b..993e972cd7 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -123,7 +123,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int err_bit)
              * will end up back here.  Break the cycle by only injecting LVTERR
              * if it will succeed, and folding in RECVILL otherwise.
              */
-            if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
+            if ( APIC_VECTOR_VALID(lvterr) )
                 inj = true;
             else
                 set_bit(ilog2(APIC_ESR_RECVILL), &vlapic->hw.pending_esr);
@@ -136,7 +136,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int err_bit)
 
 bool vlapic_test_irq(const struct vlapic *vlapic, uint8_t vec)
 {
-    if ( unlikely(vec < 16) )
+    if ( unlikely(!APIC_VECTOR_VALID(vec)) )
         return false;
 
     if ( hvm_funcs.test_pir &&
@@ -150,7 +150,7 @@ void vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig)
 {
     struct vcpu *target = vlapic_vcpu(vlapic);
 
-    if ( unlikely(vec < 16) )
+    if ( unlikely(!APIC_VECTOR_VALID(vec)) )
     {
         vlapic_error(vlapic, ilog2(APIC_ESR_RECVILL));
         return;
@@ -523,7 +523,7 @@ void vlapic_ipi(
         struct vlapic *target = vlapic_lowest_prio(
             vlapic_domain(vlapic), vlapic, short_hand, dest, dest_mode);
 
-        if ( unlikely((icr_low & APIC_VECTOR_MASK) < 16) )
+        if ( unlikely(!APIC_VECTOR_VALID(icr_low)) )
             vlapic_error(vlapic, ilog2(APIC_ESR_SENDILL));
         else if ( target )
             vlapic_accept_irq(vlapic_vcpu(target), icr_low);
@@ -531,7 +531,7 @@ void vlapic_ipi(
     }
 
     case APIC_DM_FIXED:
-        if ( unlikely((icr_low & APIC_VECTOR_MASK) < 16) )
+        if ( unlikely(!APIC_VECTOR_VALID(icr_low)) )
         {
             vlapic_error(vlapic, ilog2(APIC_ESR_SENDILL));
             break;
diff --git a/xen/arch/x86/include/asm/apicdef.h b/xen/arch/x86/include/asm/apicdef.h
index 49e29ec801..63dab01dde 100644
--- a/xen/arch/x86/include/asm/apicdef.h
+++ b/xen/arch/x86/include/asm/apicdef.h
@@ -78,6 +78,8 @@
 #define			APIC_DM_STARTUP		0x00600
 #define			APIC_DM_EXTINT		0x00700
 #define			APIC_VECTOR_MASK	0x000FF
+#define			APIC_VECTOR_VALID(x)	\
+					(((x) & APIC_VECTOR_MASK) >= 16)
 #define		APIC_ICR2	0x310
 #define			GET_xAPIC_DEST_FIELD(x)	(((x)>>24)&0xFF)
 #define			SET_xAPIC_DEST_FIELD(x)	((x)<<24)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 25 08:33:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Mar 2025 08:33:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.926133.1328990 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twzis-0000ao-Qw; Tue, 25 Mar 2025 08:33:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 926133.1328990; Tue, 25 Mar 2025 08:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1twzis-0000ag-OO; Tue, 25 Mar 2025 08:33:22 +0000
Received: by outflank-mailman (input) for mailman id 926133;
 Tue, 25 Mar 2025 08:33:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1twzir-0000aZ-Ri
 for xen-changelog@lists.xenproject.org; Tue, 25 Mar 2025 08:33:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twzis-007VTl-0C
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 08:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1twzir-00DrwN-2V
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 08:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7/JHcemrWlxYOB4TePlUPqkA9UwjSnvghtoOb87iEvA=; b=TJbMEqBqyPKpEdMQIpH1iHkeC/
	yq3/qa95oYOgcmrzuwvTXvMOBJ/kOVX58XL/CgUiHqR9tj8W7zG89J2BjWa5iCiN7tgUdRcXMlFrZ
	NZd2vKiuMT6obXdkNCuv26hrTHck8oAKvhUP9YuqIzCnJ49xyKHIdcQfCKZ0hTZQJ48w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arinc653: move next_switch_time access under lock
Message-Id: <E1twzir-00DrwN-2V@xenbits.xenproject.org>
Date: Tue, 25 Mar 2025 08:33:21 +0000

commit 28fa31d6bb7835be530c2855dd6cf4e77438ae12
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 25 09:23:48 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 25 09:23:48 2025 +0100

    arinc653: move next_switch_time access under lock
    
    Even before its recent movement to the scheduler's private data
    structure it looks to have been wrong to update the field under lock,
    but then read it with the lock no longer held.
    
    Coverity-ID: 1644500
    Fixes: 9f0c658baedc ("arinc: add cpu-pool support to scheduler")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
---
 xen/common/sched/arinc653.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index 930361fa5c..432ccfe662 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -580,6 +580,9 @@ a653sched_do_schedule(
      */
     BUG_ON(now >= sched_priv->next_major_frame);
 
+    /* Return the amount of time the next domain has to run. */
+    prev->next_time = sched_priv->next_switch_time - now;
+
     spin_unlock_irqrestore(&sched_priv->lock, flags);
 
     /* Tasklet work (which runs in idle UNIT context) overrides all else. */
@@ -591,11 +594,7 @@ a653sched_do_schedule(
          && (sched_unit_master(new_task) != cpu) )
         new_task = IDLETASK(cpu);
 
-    /*
-     * Return the amount of time the next domain has to run and the address
-     * of the selected task's UNIT structure.
-     */
-    prev->next_time = sched_priv->next_switch_time - now;
+    /* Also return the address of the selected task's UNIT structure. */
     prev->next_task = new_task;
     new_task->migrated = false;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Mar 25 10:11:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Mar 2025 10:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.926251.1329106 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tx1FP-0002Nb-04; Tue, 25 Mar 2025 10:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 926251.1329106; Tue, 25 Mar 2025 10:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tx1FO-0002NT-TW; Tue, 25 Mar 2025 10:11:02 +0000
Received: by outflank-mailman (input) for mailman id 926251;
 Tue, 25 Mar 2025 10:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tx1FO-0002NF-42
 for xen-changelog@lists.xenproject.org; Tue, 25 Mar 2025 10:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tx1FN-007aau-2k
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 10:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tx1FN-00DzLR-1o
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 10:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lUT6qv7np++xf2REfLzIYJrpOe5QoIolhUC+DOu5XPE=; b=tGijeA5g2GWXpbWhYQNH1dNaWW
	xilpFCFtNQ179hwg+HfMwN9iRP4DTW3MId8l6VJ/cnLtaDnC6SSTDtkyrak31w+T1by/4uw6EDEnC
	wuLjyGOaWbmoHE18OFUeJs8QI9jITz3kcGSORueaSvCiX6c6umrGod6lhslK5JXFD43s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: Add some details on XenServer PCI devices
Message-Id: <E1tx1FN-00DzLR-1o@xenbits.xenproject.org>
Date: Tue, 25 Mar 2025 10:11:01 +0000

commit 14694975cd7323fab114822cc764a3eb9808bc57
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Mar 25 09:22:43 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 25 09:22:43 2025 +0100

    docs: Add some details on XenServer PCI devices
    
    Describe the usage of devices 5853:0002 and 5853:C000.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 docs/man/xen-pci-device-reservations.7.pod | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/man/xen-pci-device-reservations.7.pod b/docs/man/xen-pci-device-reservations.7.pod
index 9ddf3a18ad..adc325069c 100644
--- a/docs/man/xen-pci-device-reservations.7.pod
+++ b/docs/man/xen-pci-device-reservations.7.pod
@@ -10,6 +10,9 @@ use of this is with device ID 0x0001 to advertise the Xen Platform PCI
 device - the presence of this virtual device enables a guest Operating
 System (subject to the availability of suitable drivers) to make use of
 paravirtualisation features such as disk and network devices etc.
+XenServer, for Windows machines, may present Xen Platform device with device
+ID 0x0002 instead of 0x0001. Device 0x0001 and 0x0002 should be mutually
+exclusive.
 
 Some Xen vendors wish to provide alternative and/or additional guest drivers
 that can bind to virtual devices[1]. This may be done using the Xen PCI
@@ -86,4 +89,8 @@ and unplug protocol.
 libxl provides support for creation of a single additional xen-pvdevice.
 See the vendor_device parameter in xl.cfg(5).
 
+XenServer might present a xen-pvdevice device with ID 0xC000.
+Such device is a placeholder for Windows update usage and is always exposed
+in conjunction with a Xen Platform PCI device, usually with ID 0x0002
+
 =back
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 25 10:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Mar 2025 10:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.926252.1329110 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tx1FZ-0002PL-1U; Tue, 25 Mar 2025 10:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 926252.1329110; Tue, 25 Mar 2025 10:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tx1FY-0002PD-V6; Tue, 25 Mar 2025 10:11:12 +0000
Received: by outflank-mailman (input) for mailman id 926252;
 Tue, 25 Mar 2025 10:11:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tx1FX-0002P1-Pz
 for xen-changelog@lists.xenproject.org; Tue, 25 Mar 2025 10:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tx1FY-007ae5-02
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 10:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tx1FX-00DzLz-2A
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 10:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LVTetNNeKy25QUjF9PkAfxBGAQ9ROSIlp66isbo8iWk=; b=Zqo9gDCgzUJoP01kompiFgkfB3
	iRgTd5F+BqN3Kk8p+gHkgvHPNc7RunzMi6fXbEbtGeFLSSgFQxSOumXn+N/LqjaMNjNTHBFpd/kP+
	Dlq4Q7cyV1bXOFTg51sZxgdUclibldcSTMKtlRjmCOZaUFuRDJnCm3QP/kk7W03CtkgE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/irq: introduce APIC_VECTOR_VALID()
Message-Id: <E1tx1FX-00DzLz-2A@xenbits.xenproject.org>
Date: Tue, 25 Mar 2025 10:11:11 +0000

commit b7234d32e31e4d18e4fcd27d38b9c17e0790488a
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Tue Mar 25 09:22:59 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 25 09:22:59 2025 +0100

    x86/irq: introduce APIC_VECTOR_VALID()
    
    Add new macro APIC_VECTOR_VALID() to validate the interrupt vector
    range as per [1]. This macro replaces hardcoded checks against the
    open-coded value 16 in LAPIC and virtual LAPIC code and simplifies
    the code a bit.
    
    [1] Intel SDM volume 3A
        Chapter "ADVANCED PROGRAMMABLE INTERRUPT CONTROLLER"
        Section "Valid Interrupt Vectors"
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/mcheck/mce_intel.c |  3 +--
 xen/arch/x86/hvm/vlapic.c           | 10 +++++-----
 xen/arch/x86/include/asm/apicdef.h  |  2 ++
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index 07b50f8793..1e52b1ac25 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -135,8 +135,7 @@ static void intel_init_thermal(struct cpuinfo_x86 *c)
      * BIOS has programmed on AP based on BSP's info we saved (since BIOS
      * is required to set the same value for all threads/cores).
      */
-    if ( (val & APIC_DM_MASK) != APIC_DM_FIXED
-         || (val & APIC_VECTOR_MASK) > 0xf )
+    if ( (val & APIC_DM_MASK) != APIC_DM_FIXED || APIC_VECTOR_VALID(val) )
         apic_write(APIC_LVTTHMR, val);
 
     if ( (msr_content & (1ULL<<3))
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 065b2aab5b..993e972cd7 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -123,7 +123,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int err_bit)
              * will end up back here.  Break the cycle by only injecting LVTERR
              * if it will succeed, and folding in RECVILL otherwise.
              */
-            if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
+            if ( APIC_VECTOR_VALID(lvterr) )
                 inj = true;
             else
                 set_bit(ilog2(APIC_ESR_RECVILL), &vlapic->hw.pending_esr);
@@ -136,7 +136,7 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int err_bit)
 
 bool vlapic_test_irq(const struct vlapic *vlapic, uint8_t vec)
 {
-    if ( unlikely(vec < 16) )
+    if ( unlikely(!APIC_VECTOR_VALID(vec)) )
         return false;
 
     if ( hvm_funcs.test_pir &&
@@ -150,7 +150,7 @@ void vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig)
 {
     struct vcpu *target = vlapic_vcpu(vlapic);
 
-    if ( unlikely(vec < 16) )
+    if ( unlikely(!APIC_VECTOR_VALID(vec)) )
     {
         vlapic_error(vlapic, ilog2(APIC_ESR_RECVILL));
         return;
@@ -523,7 +523,7 @@ void vlapic_ipi(
         struct vlapic *target = vlapic_lowest_prio(
             vlapic_domain(vlapic), vlapic, short_hand, dest, dest_mode);
 
-        if ( unlikely((icr_low & APIC_VECTOR_MASK) < 16) )
+        if ( unlikely(!APIC_VECTOR_VALID(icr_low)) )
             vlapic_error(vlapic, ilog2(APIC_ESR_SENDILL));
         else if ( target )
             vlapic_accept_irq(vlapic_vcpu(target), icr_low);
@@ -531,7 +531,7 @@ void vlapic_ipi(
     }
 
     case APIC_DM_FIXED:
-        if ( unlikely((icr_low & APIC_VECTOR_MASK) < 16) )
+        if ( unlikely(!APIC_VECTOR_VALID(icr_low)) )
         {
             vlapic_error(vlapic, ilog2(APIC_ESR_SENDILL));
             break;
diff --git a/xen/arch/x86/include/asm/apicdef.h b/xen/arch/x86/include/asm/apicdef.h
index 49e29ec801..63dab01dde 100644
--- a/xen/arch/x86/include/asm/apicdef.h
+++ b/xen/arch/x86/include/asm/apicdef.h
@@ -78,6 +78,8 @@
 #define			APIC_DM_STARTUP		0x00600
 #define			APIC_DM_EXTINT		0x00700
 #define			APIC_VECTOR_MASK	0x000FF
+#define			APIC_VECTOR_VALID(x)	\
+					(((x) & APIC_VECTOR_MASK) >= 16)
 #define		APIC_ICR2	0x310
 #define			GET_xAPIC_DEST_FIELD(x)	(((x)>>24)&0xFF)
 #define			SET_xAPIC_DEST_FIELD(x)	((x)<<24)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 25 10:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Mar 2025 10:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.926253.1329114 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tx1Fj-0002Rj-34; Tue, 25 Mar 2025 10:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 926253.1329114; Tue, 25 Mar 2025 10:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tx1Fj-0002Rb-0N; Tue, 25 Mar 2025 10:11:23 +0000
Received: by outflank-mailman (input) for mailman id 926253;
 Tue, 25 Mar 2025 10:11:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tx1Fh-0002RM-Su
 for xen-changelog@lists.xenproject.org; Tue, 25 Mar 2025 10:11:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tx1Fi-007aeY-0K
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 10:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tx1Fh-00DzMS-2g
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 10:11:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q6ix5k/7YEneb6n6yk+SlIImjkVMyBRMa/QrNE0iFeU=; b=X1UE2XeZPIyLVyzNxkCNsP5xAD
	skzEzxAtXEexotPy9qbpinO1B7NVEPbMblOC7Ahq+xCIjm4gWBYAKU4hSZeUVJB01EIrWbrR1ps83
	PqLkF3lPkG6EcI75J/fpcbEdR1JX+Hw76mqpDrX8hApiYBR0hq7YS/3cJwhJJR9qnt+A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arinc653: move next_switch_time access under lock
Message-Id: <E1tx1Fh-00DzMS-2g@xenbits.xenproject.org>
Date: Tue, 25 Mar 2025 10:11:21 +0000

commit 28fa31d6bb7835be530c2855dd6cf4e77438ae12
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Mar 25 09:23:48 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 25 09:23:48 2025 +0100

    arinc653: move next_switch_time access under lock
    
    Even before its recent movement to the scheduler's private data
    structure it looks to have been wrong to update the field under lock,
    but then read it with the lock no longer held.
    
    Coverity-ID: 1644500
    Fixes: 9f0c658baedc ("arinc: add cpu-pool support to scheduler")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Nathan Studer <nathan.studer@dornerworks.com>
---
 xen/common/sched/arinc653.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/xen/common/sched/arinc653.c b/xen/common/sched/arinc653.c
index 930361fa5c..432ccfe662 100644
--- a/xen/common/sched/arinc653.c
+++ b/xen/common/sched/arinc653.c
@@ -580,6 +580,9 @@ a653sched_do_schedule(
      */
     BUG_ON(now >= sched_priv->next_major_frame);
 
+    /* Return the amount of time the next domain has to run. */
+    prev->next_time = sched_priv->next_switch_time - now;
+
     spin_unlock_irqrestore(&sched_priv->lock, flags);
 
     /* Tasklet work (which runs in idle UNIT context) overrides all else. */
@@ -591,11 +594,7 @@ a653sched_do_schedule(
          && (sched_unit_master(new_task) != cpu) )
         new_task = IDLETASK(cpu);
 
-    /*
-     * Return the amount of time the next domain has to run and the address
-     * of the selected task's UNIT structure.
-     */
-    prev->next_time = sched_priv->next_switch_time - now;
+    /* Also return the address of the selected task's UNIT structure. */
     prev->next_task = new_task;
     new_task->migrated = false;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 25 14:55:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Mar 2025 14:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.926593.1329428 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tx5gE-0004cY-SE; Tue, 25 Mar 2025 14:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 926593.1329428; Tue, 25 Mar 2025 14:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tx5gE-0004cQ-PR; Tue, 25 Mar 2025 14:55:02 +0000
Received: by outflank-mailman (input) for mailman id 926593;
 Tue, 25 Mar 2025 14:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tx5gE-0004cK-0Y
 for xen-changelog@lists.xenproject.org; Tue, 25 Mar 2025 14:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tx5gE-007j4G-0Q
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 14:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tx5gD-00Ed6T-2g
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 14:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hVEjxym9NCVCmy2TnlCAgG839NyPP4I9dMqcB2lb5oI=; b=vi5oYlfHgKf++BturlLEfSF0Gt
	SCoiHkaH5jz1gfpTPfL3eXW998+uRK9C9cgxr0WqnbrOI6GfsNBz9skoAA8yrp2mveM456rd3gNwk
	Zk9dzVyXLU4JBgbEbb77IFgewAXiklVvoQftD1Xoq1zdsHuzvxBxCjsLDkHZZClWc138=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] 9pfs: add fstat file operation hook
Message-Id: <E1tx5gD-00Ed6T-2g@xenbits.xenproject.org>
Date: Tue, 25 Mar 2025 14:55:01 +0000

commit c863ddea62f4cc9916144f593db53f6847ce8c8c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Mar 25 15:42:19 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 25 15:42:19 2025 +0100

    9pfs: add fstat file operation hook
    
    Add a file operations fstat hook to the 9pfs frontend.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 9pfront.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/9pfront.c b/9pfront.c
index 1741d60..e676da3 100644
--- a/9pfront.c
+++ b/9pfront.c
@@ -85,6 +85,8 @@ struct file_9pfs {
 
 #define P9_QID_SIZE    13
 
+#define QID_TYPE_DIR   0x80     /* Applies to qid[0]. */
+
 struct p9_header {
     uint32_t size;
     uint8_t cmd;
@@ -950,6 +952,33 @@ static int write_9pfs(struct file *file, const void *buf, size_t nbytes)
     return ret;
 }
 
+static int fstat_9pfs(struct file *file, struct stat *buf)
+{
+    struct file_9pfs *f9pfs = file->filedata;
+    struct p9_stat stat;
+    int ret;
+
+    ret = p9_stat(f9pfs->dev, f9pfs->fid, &stat);
+    if ( ret )
+    {
+        errno = EIO;
+        return -1;
+    }
+
+    buf->st_mode = (stat.qid[0] == QID_TYPE_DIR) ? S_IFDIR : S_IFREG;
+    buf->st_mode |= stat.mode & 0777;
+    buf->st_atime = stat.atime;
+    buf->st_mtime = stat.mtime;
+    buf->st_ctime = stat.mtime;   /* Best available estimate. */
+    buf->st_size = stat.length;
+    buf->st_uid = stat.n_uid;
+    buf->st_gid = stat.n_gid;
+
+    free_stat(&stat);
+
+    return 0;
+}
+
 static int close_9pfs(struct file *file)
 {
     struct file_9pfs *f9pfs = file->filedata;
@@ -1296,6 +1325,7 @@ static const struct file_ops ops_9pfs = {
     .read = read_9pfs,
     .write = write_9pfs,
     .close = close_9pfs,
+    .fstat = fstat_9pfs,
 };
 
 __attribute__((constructor))
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Mar 25 14:55:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Mar 2025 14:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.926594.1329431 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tx5gO-0004eG-TY; Tue, 25 Mar 2025 14:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 926594.1329431; Tue, 25 Mar 2025 14:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tx5gO-0004e9-Qp; Tue, 25 Mar 2025 14:55:12 +0000
Received: by outflank-mailman (input) for mailman id 926594;
 Tue, 25 Mar 2025 14:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tx5gO-0004e1-0g
 for xen-changelog@lists.xenproject.org; Tue, 25 Mar 2025 14:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tx5gO-007j4M-0i
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 14:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tx5gN-00Ed6z-34
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Mar 2025 14:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8ROZvEo3mXyEYRVp7eiq83kFG5V6PQyK0ku57Gy/2f4=; b=faLJcf4nzwP0aniyxumoI3bd1d
	npPoZd/zjr1cp9NzH8yuqWpNPFA3wppZaGsN40PGZK33AxFgEju0D5uONZMKRWO14UgER5dORzZdR
	ZvbKCMd9iqpoy6gP7EVj9oCUZfk27pDqW4iKH3LPiFlmWm/mVeZqUMm/L6g+tUqpwG9g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] 9pfs: add lseek file operation hook
Message-Id: <E1tx5gN-00Ed6z-34@xenbits.xenproject.org>
Date: Tue, 25 Mar 2025 14:55:11 +0000

commit 222ff9f23e5a198c675bd43e4c656d54d7db76c0
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Mar 25 15:42:27 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Mar 25 15:42:27 2025 +0100

    9pfs: add lseek file operation hook
    
    Add a file operations lseek hook to the 9pfs frontend. Just use the
    lseek_default() implementation.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 9pfront.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/9pfront.c b/9pfront.c
index e676da3..895426d 100644
--- a/9pfront.c
+++ b/9pfront.c
@@ -1326,6 +1326,7 @@ static const struct file_ops ops_9pfs = {
     .write = write_9pfs,
     .close = close_9pfs,
     .fstat = fstat_9pfs,
+    .lseek = lseek_default,
 };
 
 __attribute__((constructor))
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 11:44:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 11:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927685.1330406 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txPAx-0000DK-Gq; Wed, 26 Mar 2025 11:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927685.1330406; Wed, 26 Mar 2025 11:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txPAx-0000DB-E3; Wed, 26 Mar 2025 11:44:03 +0000
Received: by outflank-mailman (input) for mailman id 927685;
 Wed, 26 Mar 2025 11:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txPAw-0000D5-Bp
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 11:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txPAw-009j4x-0w
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 11:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txPAw-00H6nG-02
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 11:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5xt0kDvtcmrQx0DMbADTpxcCGi5NE+gI7PzAb9+bg5c=; b=6soHqk7cRFaf/93eXXkD6qZO4T
	T3DC2IOzHoWSoWGkL0o0OboFI0JVYm+3NQBsGQVddqO4nC0k4WBeKoCTIxj4ESjmA230RebzHFFcQ
	2YNxhVMfyxugEyDOLNDjPuApt2b6ltMpSbQT3TypAFIDTg142AfjL/AbGr9aWSz/dK/c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib/inflate.c: remove dead code
Message-Id: <E1txPAw-00H6nG-02@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 11:44:02 +0000

commit e1691d3de1fc3326fbb9388de7351d3f5ef6b8e0
Author:     Ariel Otilibili <ariel.otilibili-anieli@eurecom.fr>
AuthorDate: Wed Mar 26 12:30:35 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 26 12:30:35 2025 +0100

    lib/inflate.c: remove dead code
    
    This is a follow up from a discussion in Xen:
    
    The if-statement tests that `res` is non-zero; meaning the case zero is
    never reached.
    
    Link: https://lore.kernel.org/all/7587b503-b2ca-4476-8dc9-e9683d4ca5f0@suse.com/
    Link: https://lkml.kernel.org/r/20241219092615.644642-2-ariel.otilibili-anieli@eurecom.fr
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Ariel Otilibili <ariel.otilibili-anieli@eurecom.fr>
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 41c761dede6e
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/gzip/inflate.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/common/gzip/inflate.c b/xen/common/gzip/inflate.c
index b9a2d7a23a..cb146555c8 100644
--- a/xen/common/gzip/inflate.c
+++ b/xen/common/gzip/inflate.c
@@ -1164,8 +1164,6 @@ static int __init gunzip(struct gunzip_state *s)
     if ( (res = inflate(s)) )
     {
         switch (res) {
-        case 0:
-            break;
         case 1:
             error("invalid compressed format (err=1)");
             break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 11:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 11:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927686.1330409 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txPB7-0000Ex-I9; Wed, 26 Mar 2025 11:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927686.1330409; Wed, 26 Mar 2025 11:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txPB7-0000Ep-FO; Wed, 26 Mar 2025 11:44:13 +0000
Received: by outflank-mailman (input) for mailman id 927686;
 Wed, 26 Mar 2025 11:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txPB6-0000Ef-6C
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 11:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txPB6-009j51-1G
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 11:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txPB6-00H6nt-0M
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 11:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lcUiXn1hoKMovDNWS3lIPhCvQdxB3LkZIVZI03WrhQc=; b=lDuCFeq+L4coV6s30Z1kStTzzJ
	OOzEt8rYIX9gxCe3gKzEA0S4UAda0TgEbWMhsHvo/ivEMgFoEglDjezGNRbHac41VFXWoAH5ZJsXc
	VQVaCcY+juvuhRdFxN7Vk79MWLXgkyAwF0CU41R29/hxu3IEcFBdXZBd3MNThfwIAJVg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
Message-Id: <E1txPB6-00H6nt-0M@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 11:44:12 +0000

commit 6c0dc87bb0e08fb31a68bf4c4149a18b92628f14
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 26 12:30:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 26 12:30:57 2025 +0100

    xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
    
    malloc(), when passed zero size, may return NULL (the behavior is
    implementation defined). Mirror the ->gov_num check to the other two
    allocations as well. Don't chance then actually using a NULL in
    print_cpufreq_para().
    
    Fixes: 75e06d089d48 ("xenpm: add cpu frequency control interface, through which user can")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/misc/xenpm.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index 336d246346..db658ebadd 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -840,8 +840,9 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
     }
     else
     {
-        printf("scaling_avail_gov    : %s\n",
-               p_cpufreq->scaling_available_governors);
+        if ( p_cpufreq->gov_num )
+            printf("scaling_avail_gov    : %s\n",
+                   p_cpufreq->scaling_available_governors);
 
         printf("current_governor     : %s\n", p_cpufreq->u.s.scaling_governor);
         if ( !strncmp(p_cpufreq->u.s.scaling_governor,
@@ -907,7 +908,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
         p_cpufreq->scaling_available_frequencies = NULL;
         p_cpufreq->scaling_available_governors = NULL;
 
-        if (!(p_cpufreq->affected_cpus =
+        if (p_cpufreq->cpu_num &&
+            !(p_cpufreq->affected_cpus =
               malloc(p_cpufreq->cpu_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
@@ -916,7 +918,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
             ret = -ENOMEM;
             goto out;
         }
-        if (!(p_cpufreq->scaling_available_frequencies =
+        if (p_cpufreq->freq_num &&
+            !(p_cpufreq->scaling_available_frequencies =
               malloc(p_cpufreq->freq_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 11:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 11:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927687.1330415 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txPBH-0000HW-K2; Wed, 26 Mar 2025 11:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927687.1330415; Wed, 26 Mar 2025 11:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txPBH-0000HM-Gf; Wed, 26 Mar 2025 11:44:23 +0000
Received: by outflank-mailman (input) for mailman id 927687;
 Wed, 26 Mar 2025 11:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txPBG-0000HA-8p
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 11:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txPBG-009j57-1Y
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 11:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txPBG-00H6op-0g
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 11:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NrhbUbhTRvrs43eu4vM9Vi9r49DrLAM5hHYh1sTn8DE=; b=5L2Rf4sjFkcumlkPdCyZ3iABIT
	B9lTGuZtBnJl/SlZoDCjfJbhCq6n4HYPZaxzfUfPoF9MxXbBeypX1BS/swl2NqPUxZRHXNNbumd7v
	RPHiYFZPDISwm3UqE3ti7p+s5857+WuAElUku1fcNjf7fd1Gt9AcLyifNdfMAh1vzaRw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pmstat: fold two allocations in get_cpufreq_para()
Message-Id: <E1txPBG-00H6op-0g@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 11:44:22 +0000

commit a6bb5f145646ffe10536f030581260e8eae48e75
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 26 12:31:33 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 26 12:31:33 2025 +0100

    x86/pmstat: fold two allocations in get_cpufreq_para()
    
    There's little point in allocation two uint32_t[] arrays separately.
    We'll need the bigger of the two anyway, and hence we can use that
    bigger one also for transiently storing the smaller number of items.
    
    While there also drop j (we can use i twice) and adjust the type of
    the remaining two variables on that line.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/acpi/pmstat.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index df309e27b4..aae94529ab 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -193,11 +193,10 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
     const struct processor_pminfo *pmpt;
     struct cpufreq_policy *policy;
     uint32_t gov_num = 0;
-    uint32_t *affected_cpus;
-    uint32_t *scaling_available_frequencies;
+    uint32_t *data;
     char     *scaling_available_governors;
     struct list_head *pos;
-    uint32_t cpu, i, j = 0;
+    unsigned int cpu, i = 0;
 
     pmpt = processor_pminfo[op->cpuid];
     policy = per_cpu(cpufreq_cpu_policy, op->cpuid);
@@ -219,25 +218,22 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
         return -EAGAIN;
     }
 
-    if ( !(affected_cpus = xzalloc_array(uint32_t, op->u.get_para.cpu_num)) )
+    if ( !(data = xzalloc_array(uint32_t,
+                                max(op->u.get_para.cpu_num,
+                                    op->u.get_para.freq_num))) )
         return -ENOMEM;
+
     for_each_cpu(cpu, policy->cpus)
-        affected_cpus[j++] = cpu;
+        data[i++] = cpu;
     ret = copy_to_guest(op->u.get_para.affected_cpus,
-                       affected_cpus, op->u.get_para.cpu_num);
-    xfree(affected_cpus);
-    if ( ret )
-        return ret;
+                        data, op->u.get_para.cpu_num);
 
-    if ( !(scaling_available_frequencies =
-           xzalloc_array(uint32_t, op->u.get_para.freq_num)) )
-        return -ENOMEM;
     for ( i = 0; i < op->u.get_para.freq_num; i++ )
-        scaling_available_frequencies[i] =
-                        pmpt->perf.states[i].core_frequency * 1000;
+        data[i] = pmpt->perf.states[i].core_frequency * 1000;
     ret = copy_to_guest(op->u.get_para.scaling_available_frequencies,
-                   scaling_available_frequencies, op->u.get_para.freq_num);
-    xfree(scaling_available_frequencies);
+                        data, op->u.get_para.freq_num) ?: ret;
+
+    xfree(data);
     if ( ret )
         return ret;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 11:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 11:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927689.1330418 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txPBR-0000LC-Kg; Wed, 26 Mar 2025 11:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927689.1330418; Wed, 26 Mar 2025 11:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txPBR-0000L0-I1; Wed, 26 Mar 2025 11:44:33 +0000
Received: by outflank-mailman (input) for mailman id 927689;
 Wed, 26 Mar 2025 11:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txPBQ-0000KX-Bq
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 11:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txPBQ-009j5E-1q
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 11:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txPBQ-00H6pN-0y
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 11:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DbKYjP2sw3eWT6pyNnpyrW75DXgXM5y+vpwhKcXxtbs=; b=NTMsnUwUHoiPXm+X+p14rdMJMG
	rA/iDH9BodVkrJY/m6Th3DJVfgfbzqTADDOxxoauD6DZImFBQylJWcHoaZfuHfvY48/Pl3ORJi4Ua
	NUnP0PXrlULHKKu9D7dtX8A1EuS9XwuwvABi1oEIJOUt/7T/YPX6MI0IDDxBSYOyj75A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PVH: expose OEMx ACPI tables to Dom0
Message-Id: <E1txPBQ-00H6pN-0y@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 11:44:32 +0000

commit 6378909b41c40187a79df1d38ca4791b34393d67
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 26 12:32:03 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 26 12:32:03 2025 +0100

    x86/PVH: expose OEMx ACPI tables to Dom0
    
    What they contain we don't know, but we can't sensibly hide them. On my
    Skylake system OEM1 (with a description of "INTEL  CPU EIST") is what
    contains all the _PCT, _PPC, and _PSS methods, i.e. about everything
    needed for cpufreq. (_PSD interestingly are in an SSDT there.)
    
    Further OEM2 there has a description of "INTEL  CPU  HWP", while OEM4
    has "INTEL  CPU  CST". Pretty clearly all three need exposing for
    cpufreq and cpuidle to work.
    
    Fixes: 8b1a5268daf0 ("pvh/dom0: whitelist PVH Dom0 ACPI tables")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/dom0_build.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 6e287a81e7..13a7385432 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1010,12 +1010,20 @@ static bool __init pvh_acpi_table_allowed(const char *sig,
             return true;
         else
         {
+    skip:
             printk("Skipping table %.4s in non-ACPI non-reserved region\n",
                    sig);
             return false;
         }
     }
 
+    if ( !strncmp(sig, "OEM", 3) )
+    {
+        if ( acpi_memory_banned(address, size) )
+            goto skip;
+        return true;
+    }
+
     return false;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 12:44:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 12:44:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927765.1330492 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txQ70-0001bK-Dl; Wed, 26 Mar 2025 12:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927765.1330492; Wed, 26 Mar 2025 12:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txQ70-0001bD-B2; Wed, 26 Mar 2025 12:44:02 +0000
Received: by outflank-mailman (input) for mailman id 927765;
 Wed, 26 Mar 2025 12:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txQ6z-0001b5-Sc
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 12:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txQ70-009kTK-05
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 12:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txQ6z-00HAiD-2M
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 12:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RWNHuXqzoopdIyZFGlx+TZytv5hlUX+UUCqUT5zPffo=; b=gf+19T9KK4nRFLh85wi09YfQKp
	2aNpkTFTOUuMDb/2jbZRuWz1ZGi+veLWJnRvwKgv8j6taESqHBW1nFOzYmhLixpHlJLvJq62cenOd
	gFvNwNY67d4mSp043u1Hn6PH3kAY/GKS0ji4aqNRheAb9CtqpI/UAnNqG5inncxeDIQk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib/inflate.c: remove dead code
Message-Id: <E1txQ6z-00HAiD-2M@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 12:44:01 +0000

commit e1691d3de1fc3326fbb9388de7351d3f5ef6b8e0
Author:     Ariel Otilibili <ariel.otilibili-anieli@eurecom.fr>
AuthorDate: Wed Mar 26 12:30:35 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 26 12:30:35 2025 +0100

    lib/inflate.c: remove dead code
    
    This is a follow up from a discussion in Xen:
    
    The if-statement tests that `res` is non-zero; meaning the case zero is
    never reached.
    
    Link: https://lore.kernel.org/all/7587b503-b2ca-4476-8dc9-e9683d4ca5f0@suse.com/
    Link: https://lkml.kernel.org/r/20241219092615.644642-2-ariel.otilibili-anieli@eurecom.fr
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Ariel Otilibili <ariel.otilibili-anieli@eurecom.fr>
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 41c761dede6e
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/gzip/inflate.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/common/gzip/inflate.c b/xen/common/gzip/inflate.c
index b9a2d7a23a..cb146555c8 100644
--- a/xen/common/gzip/inflate.c
+++ b/xen/common/gzip/inflate.c
@@ -1164,8 +1164,6 @@ static int __init gunzip(struct gunzip_state *s)
     if ( (res = inflate(s)) )
     {
         switch (res) {
-        case 0:
-            break;
         case 1:
             error("invalid compressed format (err=1)");
             break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 12:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 12:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927766.1330496 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txQ7A-0001de-FK; Wed, 26 Mar 2025 12:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927766.1330496; Wed, 26 Mar 2025 12:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txQ7A-0001dW-CZ; Wed, 26 Mar 2025 12:44:12 +0000
Received: by outflank-mailman (input) for mailman id 927766;
 Wed, 26 Mar 2025 12:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txQ79-0001dO-Th
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 12:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txQ7A-009kTZ-0O
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 12:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txQ79-00HAj4-2k
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 12:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0BKFKXl8pf2NP+PCb5v2aDkaHwjR+xi8Z+Xt8ZJaOm4=; b=qv94fDR8bEyT0EcTNFfoZp5bPs
	kv7AlqhRQV6TFLvf2kXpnXkvhhCog6aJBLR/2pBNbOgLW37FoL+xKFROPkpSEUjOy013EkTwZxClo
	o7dLzRQMpa2a2IdO9dIkMfXd1Uf8fC2B8jO/8j3iBQnpHaNaLCVOlq9FFQaTej7bgLqE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
Message-Id: <E1txQ79-00HAj4-2k@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 12:44:11 +0000

commit 6c0dc87bb0e08fb31a68bf4c4149a18b92628f14
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 26 12:30:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 26 12:30:57 2025 +0100

    xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
    
    malloc(), when passed zero size, may return NULL (the behavior is
    implementation defined). Mirror the ->gov_num check to the other two
    allocations as well. Don't chance then actually using a NULL in
    print_cpufreq_para().
    
    Fixes: 75e06d089d48 ("xenpm: add cpu frequency control interface, through which user can")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/misc/xenpm.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index 336d246346..db658ebadd 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -840,8 +840,9 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
     }
     else
     {
-        printf("scaling_avail_gov    : %s\n",
-               p_cpufreq->scaling_available_governors);
+        if ( p_cpufreq->gov_num )
+            printf("scaling_avail_gov    : %s\n",
+                   p_cpufreq->scaling_available_governors);
 
         printf("current_governor     : %s\n", p_cpufreq->u.s.scaling_governor);
         if ( !strncmp(p_cpufreq->u.s.scaling_governor,
@@ -907,7 +908,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
         p_cpufreq->scaling_available_frequencies = NULL;
         p_cpufreq->scaling_available_governors = NULL;
 
-        if (!(p_cpufreq->affected_cpus =
+        if (p_cpufreq->cpu_num &&
+            !(p_cpufreq->affected_cpus =
               malloc(p_cpufreq->cpu_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
@@ -916,7 +918,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
             ret = -ENOMEM;
             goto out;
         }
-        if (!(p_cpufreq->scaling_available_frequencies =
+        if (p_cpufreq->freq_num &&
+            !(p_cpufreq->scaling_available_frequencies =
               malloc(p_cpufreq->freq_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 12:44:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 12:44:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927767.1330500 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txQ7K-0001gI-Gc; Wed, 26 Mar 2025 12:44:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927767.1330500; Wed, 26 Mar 2025 12:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txQ7K-0001gA-Dx; Wed, 26 Mar 2025 12:44:22 +0000
Received: by outflank-mailman (input) for mailman id 927767;
 Wed, 26 Mar 2025 12:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txQ7K-0001g1-09
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 12:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txQ7K-009kTf-0f
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 12:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txQ7J-00HAjq-32
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 12:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GRi9YumHQSOxW+BYqDDoJR4Nzgut+lHvIwPmPpF53ig=; b=VUG7ycY2dOJ5ByPYAJUAT+kgSr
	i00dom50cxNZ5PHP198EPeVzsEkmO2veAKa/riiqUOMf+nFPysV2xUdJVK9/mcdrSe+LY0yXfZA+m
	YTWk01Qrk67mn4wmEXxoXZDBOtQt6cHn7PFYSouwI7+jsWVDXytqMQDKjujemUQgBNnI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pmstat: fold two allocations in get_cpufreq_para()
Message-Id: <E1txQ7J-00HAjq-32@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 12:44:21 +0000

commit a6bb5f145646ffe10536f030581260e8eae48e75
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 26 12:31:33 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 26 12:31:33 2025 +0100

    x86/pmstat: fold two allocations in get_cpufreq_para()
    
    There's little point in allocation two uint32_t[] arrays separately.
    We'll need the bigger of the two anyway, and hence we can use that
    bigger one also for transiently storing the smaller number of items.
    
    While there also drop j (we can use i twice) and adjust the type of
    the remaining two variables on that line.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/acpi/pmstat.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index df309e27b4..aae94529ab 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -193,11 +193,10 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
     const struct processor_pminfo *pmpt;
     struct cpufreq_policy *policy;
     uint32_t gov_num = 0;
-    uint32_t *affected_cpus;
-    uint32_t *scaling_available_frequencies;
+    uint32_t *data;
     char     *scaling_available_governors;
     struct list_head *pos;
-    uint32_t cpu, i, j = 0;
+    unsigned int cpu, i = 0;
 
     pmpt = processor_pminfo[op->cpuid];
     policy = per_cpu(cpufreq_cpu_policy, op->cpuid);
@@ -219,25 +218,22 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
         return -EAGAIN;
     }
 
-    if ( !(affected_cpus = xzalloc_array(uint32_t, op->u.get_para.cpu_num)) )
+    if ( !(data = xzalloc_array(uint32_t,
+                                max(op->u.get_para.cpu_num,
+                                    op->u.get_para.freq_num))) )
         return -ENOMEM;
+
     for_each_cpu(cpu, policy->cpus)
-        affected_cpus[j++] = cpu;
+        data[i++] = cpu;
     ret = copy_to_guest(op->u.get_para.affected_cpus,
-                       affected_cpus, op->u.get_para.cpu_num);
-    xfree(affected_cpus);
-    if ( ret )
-        return ret;
+                        data, op->u.get_para.cpu_num);
 
-    if ( !(scaling_available_frequencies =
-           xzalloc_array(uint32_t, op->u.get_para.freq_num)) )
-        return -ENOMEM;
     for ( i = 0; i < op->u.get_para.freq_num; i++ )
-        scaling_available_frequencies[i] =
-                        pmpt->perf.states[i].core_frequency * 1000;
+        data[i] = pmpt->perf.states[i].core_frequency * 1000;
     ret = copy_to_guest(op->u.get_para.scaling_available_frequencies,
-                   scaling_available_frequencies, op->u.get_para.freq_num);
-    xfree(scaling_available_frequencies);
+                        data, op->u.get_para.freq_num) ?: ret;
+
+    xfree(data);
     if ( ret )
         return ret;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 12:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 12:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927768.1330504 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txQ7V-0001iu-I8; Wed, 26 Mar 2025 12:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927768.1330504; Wed, 26 Mar 2025 12:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txQ7V-0001im-FQ; Wed, 26 Mar 2025 12:44:33 +0000
Received: by outflank-mailman (input) for mailman id 927768;
 Wed, 26 Mar 2025 12:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txQ7U-0001ic-3t
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 12:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txQ7U-009kTv-12
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 12:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txQ7U-00HAkV-05
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 12:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+4Bh0sAjTjp7cE+44Bs9nZsU2sbmUKrHhZwUKJnZ+Y4=; b=3FdkwyG68w+v/JFPDdmmL+qAXZ
	2xJlNOnhtYSZm5hRhCbGMDj16lqA6YKMnFm4yFDFZRQkN+1Lcl69jX9fA0FUD99SjVoM6rAFbTmGO
	gVECJyvLy7Vhf5Qs9ehN+PelH/zV8v+6q+43KpLYWTIzJItCWm71kTri7FFSxTY6Hx+E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PVH: expose OEMx ACPI tables to Dom0
Message-Id: <E1txQ7U-00HAkV-05@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 12:44:32 +0000

commit 6378909b41c40187a79df1d38ca4791b34393d67
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 26 12:32:03 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Mar 26 12:32:03 2025 +0100

    x86/PVH: expose OEMx ACPI tables to Dom0
    
    What they contain we don't know, but we can't sensibly hide them. On my
    Skylake system OEM1 (with a description of "INTEL  CPU EIST") is what
    contains all the _PCT, _PPC, and _PSS methods, i.e. about everything
    needed for cpufreq. (_PSD interestingly are in an SSDT there.)
    
    Further OEM2 there has a description of "INTEL  CPU  HWP", while OEM4
    has "INTEL  CPU  CST". Pretty clearly all three need exposing for
    cpufreq and cpuidle to work.
    
    Fixes: 8b1a5268daf0 ("pvh/dom0: whitelist PVH Dom0 ACPI tables")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/dom0_build.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 6e287a81e7..13a7385432 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1010,12 +1010,20 @@ static bool __init pvh_acpi_table_allowed(const char *sig,
             return true;
         else
         {
+    skip:
             printk("Skipping table %.4s in non-ACPI non-reserved region\n",
                    sig);
             return false;
         }
     }
 
+    if ( !strncmp(sig, "OEM", 3) )
+    {
+        if ( acpi_memory_banned(address, size) )
+            goto skip;
+        return true;
+    }
+
     return false;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 13:55:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 13:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927818.1330558 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txRDj-0002TM-Ab; Wed, 26 Mar 2025 13:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927818.1330558; Wed, 26 Mar 2025 13:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txRDj-0002TF-7s; Wed, 26 Mar 2025 13:55:03 +0000
Received: by outflank-mailman (input) for mailman id 927818;
 Wed, 26 Mar 2025 13:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txRDi-0002T9-BK
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 13:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txRDi-009m4C-17
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 13:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txRDi-00HGns-0F
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 13:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JKkEn5XSj+LpBCRn2ygZWzFELjepM5HdIO6u0A3gghs=; b=kAiPuzoszIHa7qeUxypCEkmC4C
	f0VLmAj4OG2FY+oAndIU+5uWvG09elRumg6QDIVxYYDDKK7KEsxTOx3My/IZ9hH7fsWs7YBwONJTw
	/3JRRNFcJ8uIBs5kVwkVlKYG7DqMzRb4NhSDfqx3+6StnTCaWP/EoZQH0Ah+E9vCaCGU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Update build tests based on new minimum toolchain requirements
Message-Id: <E1txRDi-00HGns-0F@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 13:55:02 +0000

commit b72d3f5308d1a294d3aacabf3ace809478db416c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 14:13:56 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 26 11:54:59 2025 +0000

    CI: Update build tests based on new minimum toolchain requirements
    
    Drop CentOS 7 entirely.  It's way to old now.
    
    Ubuntu 22.04 is the oldest Ubuntu with a suitable version of Clang, so swap
    the 16.04 clang builds for 22.04.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 automation/build/centos/7.dockerfile | 72 ------------------------------------
 automation/gitlab-ci/build.yaml      | 30 +++++----------
 2 files changed, 10 insertions(+), 92 deletions(-)

diff --git a/automation/build/centos/7.dockerfile b/automation/build/centos/7.dockerfile
deleted file mode 100644
index f41dda7320..0000000000
--- a/automation/build/centos/7.dockerfile
+++ /dev/null
@@ -1,72 +0,0 @@
-# syntax=docker/dockerfile:1
-FROM --platform=linux/amd64 centos:7
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-RUN mkdir /build
-WORKDIR /build
-
-RUN <<EOF
-    set -e
-
-    # Fix up Yum config now that mirror.centos.org doesn't exist
-    sed -e 's/mirror.centos.org/vault.centos.org/g' \
-        -e 's/^#.*baseurl=https\?/baseurl=https/g' \
-        -e 's/^mirrorlist=https\?/#mirrorlist=https/g' \
-        -i /etc/yum.repos.d/*.repo
-
-    # Add the EPEL repo to get dev86
-    yum -y install epel-release
-
-    # Update everything (Base container is out of date)
-    yum -y update
-
-    DEPS=(
-        # Xen
-        binutils
-        gcc
-        make
-        python
-        # Kconfig
-        bison
-        flex
-        # Flask
-        checkpolicy
-
-        # Tools (general)
-        git
-        gzip
-        patch
-        perl
-        pkgconfig
-        wget
-        # libxenguest dombuilder
-        bzip2-devel
-        lz4-devel
-        lzo-devel
-        xz-devel
-        zlib-devel
-        zstd-devel
-        # libacpi
-        acpica-tools
-        # libxl
-        libuuid-devel
-        yajl-devel
-        # RomBIOS
-        dev86
-        # Header Check
-        gcc-c++
-        # xentop
-        ncurses-devel
-        # Python bindings
-        python-devel
-
-        # Stubdom download/extract
-        bzip2
-    )
-
-    yum -y install "${DEPS[@]}"
-
-    yum clean all
-    rm -rf /var/cache/yum
-EOF
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index f633068c31..2513908b05 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -545,16 +545,6 @@ archlinux-gcc-debug:
     CONTAINER: archlinux:current
   allow_failure: true
 
-centos-7-gcc:
-  extends: .gcc-x86-64-build
-  variables:
-    CONTAINER: centos:7
-
-centos-7-gcc-debug:
-  extends: .gcc-x86-64-build-debug
-  variables:
-    CONTAINER: centos:7
-
 debian-12-x86_64-gcc-ibt:
   extends: .gcc-x86-64-build
   variables:
@@ -607,16 +597,6 @@ fedora-41-x86_64-gcc-debug:
   variables:
     CONTAINER: fedora:41-x86_64
 
-ubuntu-16.04-x86_64-clang:
-  extends: .clang-x86-64-build
-  variables:
-    CONTAINER: ubuntu:16.04-x86_64
-
-ubuntu-16.04-x86_64-clang-debug:
-  extends: .clang-x86-64-build-debug
-  variables:
-    CONTAINER: ubuntu:16.04-x86_64
-
 ubuntu-16.04-x86_64-gcc:
   extends: .gcc-x86-64-build
   variables:
@@ -637,6 +617,16 @@ ubuntu-20.04-x86_64-gcc:
   variables:
     CONTAINER: ubuntu:20.04-x86_64
 
+ubuntu-22.04-x86_64-clang:
+  extends: .clang-x86-64-build
+  variables:
+    CONTAINER: ubuntu:22.04-x86_64
+
+ubuntu-22.04-x86_64-clang-debug:
+  extends: .clang-x86-64-build-debug
+  variables:
+    CONTAINER: ubuntu:22.04-x86_64
+
 ubuntu-22.04-x86_64-gcc:
   extends: .gcc-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 13:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 13:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927819.1330563 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txRDt-0002VG-CO; Wed, 26 Mar 2025 13:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927819.1330563; Wed, 26 Mar 2025 13:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txRDt-0002V8-9R; Wed, 26 Mar 2025 13:55:13 +0000
Received: by outflank-mailman (input) for mailman id 927819;
 Wed, 26 Mar 2025 13:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txRDs-0002Uz-BZ
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 13:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txRDs-009m4G-1b
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 13:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txRDs-00HGp2-0Y
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 13:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5WWbFV0FZQvDiuo/XgRib/2QN3jw5zD5AkUV/h6jdd0=; b=eTOvwglr3RKktXoGJdZXxKzamK
	85WsFiTecQaJCt0B7FYvQXZFuXF1ZAcPaqa2G8ht3LslnumWe3VHGGpvLyOkK26LDbD1k1QaookHo
	dDhaRm/4OSX5OzCiMqxHn6mblfppjnv9MVLYEzi2DtnRQGGeQPQQ9VMxTBlma/zqo8Bs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
Message-Id: <E1txRDs-00HGp2-0Y@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 13:55:12 +0000

commit b7264a15c28d30bb994ec9e58eba38932be231ec
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 24 21:44:30 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 26 11:54:59 2025 +0000

    x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
    
    In hvmemul_read_cr(), make the TRACE()/X86EMUL_OKAY path common in preparation
    for adding a %cr8 case.  Use a local 'val' variable instead of always
    operating on a deferenced pointer.
    
    In both, calculate curr once.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index dbf6b5543a..7e18e70c27 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2273,23 +2273,30 @@ static int cf_check hvmemul_write_io(
 
 static int cf_check hvmemul_read_cr(
     unsigned int reg,
-    unsigned long *val,
+    unsigned long *pval,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
+    unsigned long val;
+
     switch ( reg )
     {
     case 0:
     case 2:
     case 3:
     case 4:
-        *val = current->arch.hvm.guest_cr[reg];
-        TRACE(TRC_HVM_CR_READ64, reg, *val, *val >> 32);
-        return X86EMUL_OKAY;
-    default:
+        val = curr->arch.hvm.guest_cr[reg];
         break;
+
+    default:
+        return X86EMUL_UNHANDLEABLE;
     }
 
-    return X86EMUL_UNHANDLEABLE;
+    TRACE(TRC_HVM_CR_READ64, reg, val, val >> 32);
+
+    *pval = val;
+
+    return X86EMUL_OKAY;
 }
 
 static int cf_check hvmemul_write_cr(
@@ -2297,6 +2304,7 @@ static int cf_check hvmemul_write_cr(
     unsigned long val,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
     int rc;
 
     TRACE(TRC_HVM_CR_WRITE64, reg, val, val >> 32);
@@ -2307,13 +2315,13 @@ static int cf_check hvmemul_write_cr(
         break;
 
     case 2:
-        current->arch.hvm.guest_cr[2] = val;
+        curr->arch.hvm.guest_cr[2] = val;
         rc = X86EMUL_OKAY;
         break;
 
     case 3:
     {
-        bool noflush = hvm_pcid_enabled(current) && (val & X86_CR3_NOFLUSH);
+        bool noflush = hvm_pcid_enabled(curr) && (val & X86_CR3_NOFLUSH);
 
         if ( noflush )
             val &= ~X86_CR3_NOFLUSH;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 13:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 13:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927820.1330565 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txRE3-0002Y4-DU; Wed, 26 Mar 2025 13:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927820.1330565; Wed, 26 Mar 2025 13:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txRE3-0002Xw-At; Wed, 26 Mar 2025 13:55:23 +0000
Received: by outflank-mailman (input) for mailman id 927820;
 Wed, 26 Mar 2025 13:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txRE2-0002Xk-CW
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 13:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txRE2-009m4L-1u
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 13:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txRE2-00HGps-12
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 13:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=b3+3gHBF5H9sIxibsYKVxaleUUFxFUiQzpDruFktF5A=; b=YNpmX2++BQTEAQVVkCr74vSIq+
	gXKS5xtUv82R6Gkbz3uisxAd15dSTgyM6q7n0Fc4vrxtd96A759ygZ2PUbrln/8U3CA5CzTyzHYC6
	F7XsU+dYIFFUITeypuJYqh5LtpwdcyeMs5k0tmBRj6+GSYusg6RyuYqlo0zQlD2KMhic=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/emul: Emulate %cr8 accesses
Message-Id: <E1txRE2-00HGps-12@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 13:55:22 +0000

commit 14fd9b5642cd4805b49fbe716bf2cd577e724169
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 17 17:48:51 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 26 11:54:59 2025 +0000

    x86/emul: Emulate %cr8 accesses
    
    Petr reports:
    
      (XEN) MMIO emulation failed (1): d12v1 64bit @ 0010:fffff8057ba7dfbf -> 45 0f 20 c2 ...
    
    during introspection.
    
    This is MOV %cr8, which is wired up for hvm_mov_{to,from}_cr(); the VMExit
    fastpaths, but not for the full emulation slowpaths.
    
    Xen's handling of %cr8 turns out to be quite wrong.  At a minimum, we need
    storage for %cr8 separate to APIC_TPR, and to alter intercepts based on
    whether the vLAPIC is enabled or not.  But that's more work than there is time
    for in the short term, so make a stopgap fix.
    
    Extend hvmemul_{read,write}_cr() with %cr8 cases.  Unlike hvm_mov_to_cr(),
    hardware hasn't filtered out invalid values (#GP checks are ahead of
    intercepts), so introduce X86_CR8_VALID_MASK.
    
    Reported-by: Petr Beneš <w1benny@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c           | 15 +++++++++++++++
 xen/arch/x86/include/asm/x86-defns.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 7e18e70c27..04d07ccaf6 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2288,6 +2288,10 @@ static int cf_check hvmemul_read_cr(
         val = curr->arch.hvm.guest_cr[reg];
         break;
 
+    case 8:
+        val = (vlapic_get_reg(vcpu_vlapic(curr), APIC_TASKPRI) & 0xf0) >> 4;
+        break;
+
     default:
         return X86EMUL_UNHANDLEABLE;
     }
@@ -2333,6 +2337,17 @@ static int cf_check hvmemul_write_cr(
         rc = hvm_set_cr4(val, true);
         break;
 
+    case 8:
+        if ( val & ~X86_CR8_VALID_MASK )
+        {
+            rc = X86EMUL_EXCEPTION;
+            break;
+        }
+
+        vlapic_set_reg(vcpu_vlapic(curr), APIC_TASKPRI, val << 4);
+        rc = X86EMUL_OKAY;
+        break;
+
     default:
         rc = X86EMUL_UNHANDLEABLE;
         break;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 61b0cea8f3..23579c471f 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -76,6 +76,8 @@
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
 
+#define X86_CR8_VALID_MASK 0xf
+
 /*
  * XSTATE component flags in XCR0 | MSR_XSS
  */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 13:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 13:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927821.1330569 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txRED-0002bF-GP; Wed, 26 Mar 2025 13:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927821.1330569; Wed, 26 Mar 2025 13:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txRED-0002b7-Df; Wed, 26 Mar 2025 13:55:33 +0000
Received: by outflank-mailman (input) for mailman id 927821;
 Wed, 26 Mar 2025 13:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txREC-0002b1-Fi
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 13:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txREC-009m4R-2E
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 13:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txREC-00HGqI-1L
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 13:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6V1Dpq6WoxrEbvDzedd36tBQPmubOhc9ElefIlDAlBc=; b=LIlOKZDZAqsI9PbPeqmnqEO/8P
	66qUKRYLUjmCq24z1YgmeGutdTVIomd/V3+lOmYTuqaRihRBPGqCIFAS7DEJfCi7UJ4WVnk2I2sVJ
	JvtzBsGzT+2z6vf1b4hx2UsxCRrKiR6SByLHct87iKsWzshsre578rx9PzwtEXTa2XBA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/elf: Remove ASM_CALL_CONSTRAINT from elf_core_save_regs()
Message-Id: <E1txREC-00HGqI-1L@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 13:55:32 +0000

commit b9ad1f04bafc4f1b2f355a7ed9853add0a7c7448
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 25 17:55:33 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 26 11:54:59 2025 +0000

    x86/elf: Remove ASM_CALL_CONSTRAINT from elf_core_save_regs()
    
    I was mistaken about when ASM_CALL_CONSTRAINT is applicable.  It is not
    applicable for plain pushes/pops, so remove it from the flags logic.
    
    Clarify the description of ASM_CALL_CONSTRAINT to be explicit about unwinding
    using framepointers.
    
    Fixes: 0754534b8a38 ("x86/elf: Improve code generation in elf_core_save_regs()")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/asm_defns.h  | 5 +++--
 xen/arch/x86/include/asm/x86_64/elf.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/asm_defns.h b/xen/arch/x86/include/asm/asm_defns.h
index 92b4116a15..72a0082d31 100644
--- a/xen/arch/x86/include/asm/asm_defns.h
+++ b/xen/arch/x86/include/asm/asm_defns.h
@@ -28,8 +28,9 @@ asm ( "\t.equ CONFIG_INDIRECT_THUNK, "
 
 /*
  * This output constraint should be used for any inline asm which has a "call"
- * instruction.  Otherwise the asm may be inserted before the frame pointer
- * gets set up by the containing function.
+ * instruction, which forces the frame pointer to be set up prior to the asm
+ * block.  This matters when unwinding using frame pointers, where the asm's
+ * function can get skipped over.
  */
 #ifdef CONFIG_FRAME_POINTER
 register unsigned long current_stack_pointer asm("rsp");
diff --git a/xen/arch/x86/include/asm/x86_64/elf.h b/xen/arch/x86/include/asm/x86_64/elf.h
index f33be46dde..e7bec7327a 100644
--- a/xen/arch/x86/include/asm/x86_64/elf.h
+++ b/xen/arch/x86/include/asm/x86_64/elf.h
@@ -56,7 +56,7 @@ static inline void elf_core_save_regs(ELF_Gregset *core_regs,
     /* orig_rax not filled in for now */
     asm ( "lea (%%rip), %0" : "=r" (core_regs->rip) );
     asm ( "mov %%cs, %0" : "=m" (core_regs->cs) );
-    asm ( "pushfq; popq %0" : "=m" (core_regs->rflags) ASM_CALL_CONSTRAINT );
+    asm ( "pushfq; popq %0" : "=m" (core_regs->rflags) );
     asm ( "movq %%rsp, %0" : "=m" (core_regs->rsp) );
     asm ( "mov %%ss, %0" : "=m" (core_regs->ss) );
     rdmsrl(MSR_FS_BASE, core_regs->thread_fs);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 13:55:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 13:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927823.1330574 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txREN-0002e2-Hi; Wed, 26 Mar 2025 13:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927823.1330574; Wed, 26 Mar 2025 13:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txREN-0002du-F4; Wed, 26 Mar 2025 13:55:43 +0000
Received: by outflank-mailman (input) for mailman id 927823;
 Wed, 26 Mar 2025 13:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txREM-0002dT-Kb
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 13:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txREM-009m4X-2V
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 13:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txREM-00HGr1-1f
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 13:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LXdOqJMJNJ1v6eeQfgYPGxTHEsXqIVsD25T2sbj75EI=; b=UN9gRg/L/hIsxXSGSLCsmknjXH
	LojMoyTHQGY2gRM2FVL5FCTByURHeewpj0pmdC6xzruaeOg9Lpn+o+gXN7Fdsu/RvX9u+IqA4OR24
	WaI/IbbuUm6T16/qlARQV/Zj5pJoaQlg2dZFb1FSNMfW5W5MAQZpZsLKrVXjpEwAUB70=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/bitops: Account for POPCNT errata on earlier Intel CPUs
Message-Id: <E1txREM-00HGr1-1f@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 13:55:42 +0000

commit 38adc2d7879c9a68b21a1dddb09d9c9f34d15ee4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 25 18:02:03 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 26 11:54:59 2025 +0000

    x86/bitops: Account for POPCNT errata on earlier Intel CPUs
    
    Manually break the false dependency for the benefit of cases such as
    bitmap_weight() which is a reasonable hotpath.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/bitops.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index bb9d756460..87eac7782f 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -488,10 +488,16 @@ static always_inline unsigned int arch_hweightl(unsigned long x)
      *
      * This limits the POPCNT instruction to using the same ABI as a function
      * call (input in %rdi, output in %eax) but that's fine.
+     *
+     * On Intel CPUs prior to Cannon Lake, the POPCNT instruction has a false
+     * input dependency on it's destination register (errata HSD146, SKL029
+     * amongst others), impacting loops such as bitmap_weight().  Insert an
+     * XOR to manually break the dependency.
      */
     alternative_io("call arch_generic_hweightl",
+                   "xor %k[res], %k[res]\n\t"
                    "popcnt %[val], %q[res]", X86_FEATURE_POPCNT,
-                   ASM_OUTPUT2([res] "=a" (r) ASM_CALL_CONSTRAINT),
+                   ASM_OUTPUT2([res] "=&a" (r) ASM_CALL_CONSTRAINT),
                    [val] "D" (x));
 
     return r;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 14:55:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 14:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927945.1330698 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txS9n-0005Zk-Ax; Wed, 26 Mar 2025 14:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927945.1330698; Wed, 26 Mar 2025 14:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txS9n-0005Zc-8C; Wed, 26 Mar 2025 14:55:03 +0000
Received: by outflank-mailman (input) for mailman id 927945;
 Wed, 26 Mar 2025 14:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txS9l-0005ZW-RI
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 14:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txS9l-009nXo-2N
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 14:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txS9l-00HMzM-1W
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 14:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TCP28XIRnETJENQCxKI3zX0ZkyAMkrBz3NcJnv0kaoY=; b=CpRxZ7STuAhvYox/dDgh1baH2y
	JSwQfzgcS0nJ3GAKuvcB9Dfq8vbLbMrwu5go+SzNYcZcbxRVbm79jhgpm5wMzcvnGfyrHojaNZAes
	P3M4BQ/7a3hhGwYb9YweHZ9XZ2Ik+Cj6uPex505dwzv8Fy9jSztWAHpmsos9DUzR/Fco=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Update build tests based on new minimum toolchain requirements
Message-Id: <E1txS9l-00HMzM-1W@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 14:55:01 +0000

commit b72d3f5308d1a294d3aacabf3ace809478db416c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 14:13:56 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 26 11:54:59 2025 +0000

    CI: Update build tests based on new minimum toolchain requirements
    
    Drop CentOS 7 entirely.  It's way to old now.
    
    Ubuntu 22.04 is the oldest Ubuntu with a suitable version of Clang, so swap
    the 16.04 clang builds for 22.04.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 automation/build/centos/7.dockerfile | 72 ------------------------------------
 automation/gitlab-ci/build.yaml      | 30 +++++----------
 2 files changed, 10 insertions(+), 92 deletions(-)

diff --git a/automation/build/centos/7.dockerfile b/automation/build/centos/7.dockerfile
deleted file mode 100644
index f41dda7320..0000000000
--- a/automation/build/centos/7.dockerfile
+++ /dev/null
@@ -1,72 +0,0 @@
-# syntax=docker/dockerfile:1
-FROM --platform=linux/amd64 centos:7
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-RUN mkdir /build
-WORKDIR /build
-
-RUN <<EOF
-    set -e
-
-    # Fix up Yum config now that mirror.centos.org doesn't exist
-    sed -e 's/mirror.centos.org/vault.centos.org/g' \
-        -e 's/^#.*baseurl=https\?/baseurl=https/g' \
-        -e 's/^mirrorlist=https\?/#mirrorlist=https/g' \
-        -i /etc/yum.repos.d/*.repo
-
-    # Add the EPEL repo to get dev86
-    yum -y install epel-release
-
-    # Update everything (Base container is out of date)
-    yum -y update
-
-    DEPS=(
-        # Xen
-        binutils
-        gcc
-        make
-        python
-        # Kconfig
-        bison
-        flex
-        # Flask
-        checkpolicy
-
-        # Tools (general)
-        git
-        gzip
-        patch
-        perl
-        pkgconfig
-        wget
-        # libxenguest dombuilder
-        bzip2-devel
-        lz4-devel
-        lzo-devel
-        xz-devel
-        zlib-devel
-        zstd-devel
-        # libacpi
-        acpica-tools
-        # libxl
-        libuuid-devel
-        yajl-devel
-        # RomBIOS
-        dev86
-        # Header Check
-        gcc-c++
-        # xentop
-        ncurses-devel
-        # Python bindings
-        python-devel
-
-        # Stubdom download/extract
-        bzip2
-    )
-
-    yum -y install "${DEPS[@]}"
-
-    yum clean all
-    rm -rf /var/cache/yum
-EOF
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index f633068c31..2513908b05 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -545,16 +545,6 @@ archlinux-gcc-debug:
     CONTAINER: archlinux:current
   allow_failure: true
 
-centos-7-gcc:
-  extends: .gcc-x86-64-build
-  variables:
-    CONTAINER: centos:7
-
-centos-7-gcc-debug:
-  extends: .gcc-x86-64-build-debug
-  variables:
-    CONTAINER: centos:7
-
 debian-12-x86_64-gcc-ibt:
   extends: .gcc-x86-64-build
   variables:
@@ -607,16 +597,6 @@ fedora-41-x86_64-gcc-debug:
   variables:
     CONTAINER: fedora:41-x86_64
 
-ubuntu-16.04-x86_64-clang:
-  extends: .clang-x86-64-build
-  variables:
-    CONTAINER: ubuntu:16.04-x86_64
-
-ubuntu-16.04-x86_64-clang-debug:
-  extends: .clang-x86-64-build-debug
-  variables:
-    CONTAINER: ubuntu:16.04-x86_64
-
 ubuntu-16.04-x86_64-gcc:
   extends: .gcc-x86-64-build
   variables:
@@ -637,6 +617,16 @@ ubuntu-20.04-x86_64-gcc:
   variables:
     CONTAINER: ubuntu:20.04-x86_64
 
+ubuntu-22.04-x86_64-clang:
+  extends: .clang-x86-64-build
+  variables:
+    CONTAINER: ubuntu:22.04-x86_64
+
+ubuntu-22.04-x86_64-clang-debug:
+  extends: .clang-x86-64-build-debug
+  variables:
+    CONTAINER: ubuntu:22.04-x86_64
+
 ubuntu-22.04-x86_64-gcc:
   extends: .gcc-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 14:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 14:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927946.1330701 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txS9x-0005bd-C4; Wed, 26 Mar 2025 14:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927946.1330701; Wed, 26 Mar 2025 14:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txS9x-0005bV-9d; Wed, 26 Mar 2025 14:55:13 +0000
Received: by outflank-mailman (input) for mailman id 927946;
 Wed, 26 Mar 2025 14:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txS9v-0005bI-Lm
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 14:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txS9v-009nXu-2q
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 14:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txS9v-00HMzv-1o
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 14:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=36kyH6VfIXVelNXP4U//g6dIaUVoh6IS5JZdkbpvVZg=; b=XiheYo3qXTa5Ytjklh0wx8PT/K
	3Z3+djSFYIMBkPhaZzq1fTOa4FmMyFot+SZ88iAURHDWQ1Mq3WqtHaTuOdMPsfABCm6+mZme/Ahqt
	L/r6LW0Cf9JrIEj5OYJnR4yGgZjWqtOG6j+E48itBSZ0lEAUmJOYwRo2RYOehqQjLCXQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
Message-Id: <E1txS9v-00HMzv-1o@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 14:55:11 +0000

commit b7264a15c28d30bb994ec9e58eba38932be231ec
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 24 21:44:30 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 26 11:54:59 2025 +0000

    x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
    
    In hvmemul_read_cr(), make the TRACE()/X86EMUL_OKAY path common in preparation
    for adding a %cr8 case.  Use a local 'val' variable instead of always
    operating on a deferenced pointer.
    
    In both, calculate curr once.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index dbf6b5543a..7e18e70c27 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2273,23 +2273,30 @@ static int cf_check hvmemul_write_io(
 
 static int cf_check hvmemul_read_cr(
     unsigned int reg,
-    unsigned long *val,
+    unsigned long *pval,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
+    unsigned long val;
+
     switch ( reg )
     {
     case 0:
     case 2:
     case 3:
     case 4:
-        *val = current->arch.hvm.guest_cr[reg];
-        TRACE(TRC_HVM_CR_READ64, reg, *val, *val >> 32);
-        return X86EMUL_OKAY;
-    default:
+        val = curr->arch.hvm.guest_cr[reg];
         break;
+
+    default:
+        return X86EMUL_UNHANDLEABLE;
     }
 
-    return X86EMUL_UNHANDLEABLE;
+    TRACE(TRC_HVM_CR_READ64, reg, val, val >> 32);
+
+    *pval = val;
+
+    return X86EMUL_OKAY;
 }
 
 static int cf_check hvmemul_write_cr(
@@ -2297,6 +2304,7 @@ static int cf_check hvmemul_write_cr(
     unsigned long val,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
     int rc;
 
     TRACE(TRC_HVM_CR_WRITE64, reg, val, val >> 32);
@@ -2307,13 +2315,13 @@ static int cf_check hvmemul_write_cr(
         break;
 
     case 2:
-        current->arch.hvm.guest_cr[2] = val;
+        curr->arch.hvm.guest_cr[2] = val;
         rc = X86EMUL_OKAY;
         break;
 
     case 3:
     {
-        bool noflush = hvm_pcid_enabled(current) && (val & X86_CR3_NOFLUSH);
+        bool noflush = hvm_pcid_enabled(curr) && (val & X86_CR3_NOFLUSH);
 
         if ( noflush )
             val &= ~X86_CR3_NOFLUSH;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 14:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 14:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927947.1330706 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txSA7-0005eC-Dc; Wed, 26 Mar 2025 14:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927947.1330706; Wed, 26 Mar 2025 14:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txSA7-0005e4-B2; Wed, 26 Mar 2025 14:55:23 +0000
Received: by outflank-mailman (input) for mailman id 927947;
 Wed, 26 Mar 2025 14:55:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txSA5-0005dv-Qb
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 14:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txSA5-009nY0-39
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 14:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txSA5-00HN0V-2G
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 14:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Dmbn4Hcp9NIJs3p9GwWZuHCQMoz+WpnhIgKzm1/UajI=; b=h6i6VU4HgyZu7f8bfsQFaNtDvk
	GAY8OAwaNkkE7jBWjn51yqC5QG0KhVdWbddVqPeOCTH3TDbXiCQOu1r+98QewMRTVFnNDMLLN6VPw
	TaJoFcXsWYBi9CGpmIa3kAqderU02zgyzdwI6eBN70a7a6M7KMvULPIKGRdh0dsc0rVQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/emul: Emulate %cr8 accesses
Message-Id: <E1txSA5-00HN0V-2G@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 14:55:21 +0000

commit 14fd9b5642cd4805b49fbe716bf2cd577e724169
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 17 17:48:51 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 26 11:54:59 2025 +0000

    x86/emul: Emulate %cr8 accesses
    
    Petr reports:
    
      (XEN) MMIO emulation failed (1): d12v1 64bit @ 0010:fffff8057ba7dfbf -> 45 0f 20 c2 ...
    
    during introspection.
    
    This is MOV %cr8, which is wired up for hvm_mov_{to,from}_cr(); the VMExit
    fastpaths, but not for the full emulation slowpaths.
    
    Xen's handling of %cr8 turns out to be quite wrong.  At a minimum, we need
    storage for %cr8 separate to APIC_TPR, and to alter intercepts based on
    whether the vLAPIC is enabled or not.  But that's more work than there is time
    for in the short term, so make a stopgap fix.
    
    Extend hvmemul_{read,write}_cr() with %cr8 cases.  Unlike hvm_mov_to_cr(),
    hardware hasn't filtered out invalid values (#GP checks are ahead of
    intercepts), so introduce X86_CR8_VALID_MASK.
    
    Reported-by: Petr Beneš <w1benny@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c           | 15 +++++++++++++++
 xen/arch/x86/include/asm/x86-defns.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 7e18e70c27..04d07ccaf6 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2288,6 +2288,10 @@ static int cf_check hvmemul_read_cr(
         val = curr->arch.hvm.guest_cr[reg];
         break;
 
+    case 8:
+        val = (vlapic_get_reg(vcpu_vlapic(curr), APIC_TASKPRI) & 0xf0) >> 4;
+        break;
+
     default:
         return X86EMUL_UNHANDLEABLE;
     }
@@ -2333,6 +2337,17 @@ static int cf_check hvmemul_write_cr(
         rc = hvm_set_cr4(val, true);
         break;
 
+    case 8:
+        if ( val & ~X86_CR8_VALID_MASK )
+        {
+            rc = X86EMUL_EXCEPTION;
+            break;
+        }
+
+        vlapic_set_reg(vcpu_vlapic(curr), APIC_TASKPRI, val << 4);
+        rc = X86EMUL_OKAY;
+        break;
+
     default:
         rc = X86EMUL_UNHANDLEABLE;
         break;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 61b0cea8f3..23579c471f 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -76,6 +76,8 @@
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
 
+#define X86_CR8_VALID_MASK 0xf
+
 /*
  * XSTATE component flags in XCR0 | MSR_XSS
  */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 14:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 14:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927948.1330711 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txSAH-0005gb-FC; Wed, 26 Mar 2025 14:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927948.1330711; Wed, 26 Mar 2025 14:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txSAH-0005gT-CN; Wed, 26 Mar 2025 14:55:33 +0000
Received: by outflank-mailman (input) for mailman id 927948;
 Wed, 26 Mar 2025 14:55:31 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txSAF-0005gJ-RL
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 14:55:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txSAG-009nY4-0A
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 14:55:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txSAF-00HN19-2Y
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 14:55:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2sYLekuvNgH95ROEuGABGHEaALii+S7j8EbhwS99ldo=; b=C/bWFFpgUhU2AsKRdr9sfGukMk
	U68vh5wfJVjrqybOVy1BQamU1SAM8sYFe7g3cZo68wyGOx9XpOYAIlx91r+kcWNRIiaTPthhoYB8p
	aK7A/qsUJEMWZRwPg0HXKRa8B+yCVbUREBPpAOJmyvhk/W9kyenfdX2qYPaeCjVJuuLc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/elf: Remove ASM_CALL_CONSTRAINT from elf_core_save_regs()
Message-Id: <E1txSAF-00HN19-2Y@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 14:55:31 +0000

commit b9ad1f04bafc4f1b2f355a7ed9853add0a7c7448
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 25 17:55:33 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 26 11:54:59 2025 +0000

    x86/elf: Remove ASM_CALL_CONSTRAINT from elf_core_save_regs()
    
    I was mistaken about when ASM_CALL_CONSTRAINT is applicable.  It is not
    applicable for plain pushes/pops, so remove it from the flags logic.
    
    Clarify the description of ASM_CALL_CONSTRAINT to be explicit about unwinding
    using framepointers.
    
    Fixes: 0754534b8a38 ("x86/elf: Improve code generation in elf_core_save_regs()")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/asm_defns.h  | 5 +++--
 xen/arch/x86/include/asm/x86_64/elf.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/asm_defns.h b/xen/arch/x86/include/asm/asm_defns.h
index 92b4116a15..72a0082d31 100644
--- a/xen/arch/x86/include/asm/asm_defns.h
+++ b/xen/arch/x86/include/asm/asm_defns.h
@@ -28,8 +28,9 @@ asm ( "\t.equ CONFIG_INDIRECT_THUNK, "
 
 /*
  * This output constraint should be used for any inline asm which has a "call"
- * instruction.  Otherwise the asm may be inserted before the frame pointer
- * gets set up by the containing function.
+ * instruction, which forces the frame pointer to be set up prior to the asm
+ * block.  This matters when unwinding using frame pointers, where the asm's
+ * function can get skipped over.
  */
 #ifdef CONFIG_FRAME_POINTER
 register unsigned long current_stack_pointer asm("rsp");
diff --git a/xen/arch/x86/include/asm/x86_64/elf.h b/xen/arch/x86/include/asm/x86_64/elf.h
index f33be46dde..e7bec7327a 100644
--- a/xen/arch/x86/include/asm/x86_64/elf.h
+++ b/xen/arch/x86/include/asm/x86_64/elf.h
@@ -56,7 +56,7 @@ static inline void elf_core_save_regs(ELF_Gregset *core_regs,
     /* orig_rax not filled in for now */
     asm ( "lea (%%rip), %0" : "=r" (core_regs->rip) );
     asm ( "mov %%cs, %0" : "=m" (core_regs->cs) );
-    asm ( "pushfq; popq %0" : "=m" (core_regs->rflags) ASM_CALL_CONSTRAINT );
+    asm ( "pushfq; popq %0" : "=m" (core_regs->rflags) );
     asm ( "movq %%rsp, %0" : "=m" (core_regs->rsp) );
     asm ( "mov %%ss, %0" : "=m" (core_regs->ss) );
     rdmsrl(MSR_FS_BASE, core_regs->thread_fs);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 14:55:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 14:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.927949.1330713 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txSAR-0005j0-Go; Wed, 26 Mar 2025 14:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 927949.1330713; Wed, 26 Mar 2025 14:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txSAR-0005is-Dk; Wed, 26 Mar 2025 14:55:43 +0000
Received: by outflank-mailman (input) for mailman id 927949;
 Wed, 26 Mar 2025 14:55:41 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txSAP-0005ik-UN
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 14:55:41 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txSAQ-009nY8-0T
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 14:55:41 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txSAP-00HN1h-2o
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 14:55:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MA3zfXSXqOf+fJ3bqqvfYBXi3l5vH7ZAsm7jFf2Jpck=; b=qAeQcQIdRB9htuUL86kHewDD4o
	dSVNcQabwMstI7/ZI9LS2n9Fjjnj+bG56tTAMm7QGbjAEkUS3ztpx0Xlx0+oIBzjtQXiG2Jm8cQN+
	3afLGUAbRTu3SujYyr1ewJK+v+NwO4VpiVZggIh3Wv1UyduOexkDZNbdB7hCA7IUAVGo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/bitops: Account for POPCNT errata on earlier Intel CPUs
Message-Id: <E1txSAP-00HN1h-2o@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 14:55:41 +0000

commit 38adc2d7879c9a68b21a1dddb09d9c9f34d15ee4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Mar 25 18:02:03 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Mar 26 11:54:59 2025 +0000

    x86/bitops: Account for POPCNT errata on earlier Intel CPUs
    
    Manually break the false dependency for the benefit of cases such as
    bitmap_weight() which is a reasonable hotpath.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/bitops.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index bb9d756460..87eac7782f 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -488,10 +488,16 @@ static always_inline unsigned int arch_hweightl(unsigned long x)
      *
      * This limits the POPCNT instruction to using the same ABI as a function
      * call (input in %rdi, output in %eax) but that's fine.
+     *
+     * On Intel CPUs prior to Cannon Lake, the POPCNT instruction has a false
+     * input dependency on it's destination register (errata HSD146, SKL029
+     * amongst others), impacting loops such as bitmap_weight().  Insert an
+     * XOR to manually break the dependency.
      */
     alternative_io("call arch_generic_hweightl",
+                   "xor %k[res], %k[res]\n\t"
                    "popcnt %[val], %q[res]", X86_FEATURE_POPCNT,
-                   ASM_OUTPUT2([res] "=a" (r) ASM_CALL_CONSTRAINT),
+                   ASM_OUTPUT2([res] "=&a" (r) ASM_CALL_CONSTRAINT),
                    [val] "D" (x));
 
     return r;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 18:11:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 18:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.928206.1330947 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txVDS-0003l4-LN; Wed, 26 Mar 2025 18:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 928206.1330947; Wed, 26 Mar 2025 18:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txVDS-0003kt-Ih; Wed, 26 Mar 2025 18:11:02 +0000
Received: by outflank-mailman (input) for mailman id 928206;
 Wed, 26 Mar 2025 18:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txVDS-0003kn-9l
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 18:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txVDS-009tDg-13
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 18:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txVDS-000CLa-0C
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 18:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JLdl+6bS3gb+xIyMX2Mk5dTE8qJfRl3arUA57NJSNjU=; b=5KkR6i1LOKzBtJRP2zoFw3ukp4
	K0maSV9p1cqS/th3pGtkI1SvcL5VjDqPgi+D9wbDfD8iPlgAJ8nfXemnrxgf1ZzqMXXEIepXUghNI
	CQ6I+eVRpAvk/4X5du9RfjzGgYpA174tHLaN7wl7hzusSxx6TJCosWOkxO4X2GRIXDwM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/cirrus-ci: use matrix keyword to generate per-version build tasks
Message-Id: <E1txVDS-000CLa-0C@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 18:11:02 +0000

commit b548a7dc4bb4202410983dd3ef7b5f1b469bdac3
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Sat Mar 15 09:35:12 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 26 17:02:21 2025 +0100

    automation/cirrus-ci: use matrix keyword to generate per-version build tasks
    
    Move the current logic to use the matrix keyword to generate a task for
    each version of FreeBSD we want to build Xen on.  The matrix keyword
    however cannot be used in YAML aliases, so it needs to be explicitly used
    inside of each task, which creates a bit of duplication.  At least abstract
    the FreeBSD minor version numbers to avoid repetition of image names.
    
    Note that the full build uses matrix over an env variable instead of using
    it directly in image_family.  This is so that the alias can also be set
    based on the FreeBSD version, in preparation for adding further tasks that
    will depend on the full build having finished.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 78 +++++++++++++++++++++++++++++--------------------------------
 1 file changed, 37 insertions(+), 41 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 490f214f04..95d2d2d3db 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1,13 +1,9 @@
 # https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
-freebsd_13: &FREEBSD_13
-  freebsd_instance:
-    image_family: freebsd-13-5
-freebsd_14: &FREEBSD_14
-  freebsd_instance:
-    image_family: freebsd-14-2
-freebsd_15: &FREEBSD_15
-  freebsd_instance:
-    image_family: freebsd-15-0-snap
+freebsd_versions: &FREEBSD_VERSIONS
+  env:
+    FREEBSD_LEGACY:     freebsd-13-5
+    FREEBSD_PRODUCTION: freebsd-14-2
+    FREEBSD_CURRENT:    freebsd-15-0-snap
 
 freebsd_template: &FREEBSD_ENV
   environment:
@@ -24,7 +20,24 @@ freebsd_configure_artifacts: &FREEBSD_CONFIGURE_ARTIFACTS
       path: xen-config
       type: text/plain
 
-freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
+task:
+  name: 'FreeBSD: full build'
+
+  # It's not possible to use the matrix keyword in YAML aliases, as they
+  # keyword usage is restricted to task, docker_builder or pipe.  Attempting to
+  # use a YAML alias with the duplicated keys doesn't work either. Use an env
+  # variable so the version can also be appended to the task alias.
+  << : *FREEBSD_VERSIONS
+  env:
+    matrix:
+      FREEBSD_VERSION: $FREEBSD_LEGACY
+      FREEBSD_VERSION: $FREEBSD_PRODUCTION
+      FREEBSD_VERSION: $FREEBSD_CURRENT
+
+  alias: freebsd_full_$FREEBSD_VERSION
+  freebsd_instance:
+    image_family: $FREEBSD_VERSION
+
   << : *FREEBSD_ENV
 
   install_script: pkg install -y seabios gmake ninja bash
@@ -42,7 +55,20 @@ freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
   build_script:
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
-freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
+task:
+  name: 'FreeBSD: randconfig build'
+
+  # It's not possible to use the matrix keyword in YAML aliases, as they
+  # keyword usage is restricted to task, docker_builder or pipe.  Attempting to
+  # use a YAML alias with the duplicated `image_family` keys doesn't work
+  # either. Abstract the version numbers at least.
+  << : *FREEBSD_VERSIONS
+  freebsd_instance:
+    matrix:
+      image_family: $FREEBSD_LEGACY
+      image_family: $FREEBSD_PRODUCTION
+      image_family: $FREEBSD_CURRENT
+
   << : *FREEBSD_ENV
 
   install_script: pkg install -y gmake python3 bison
@@ -56,33 +82,3 @@ freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
 
   build_script:
     - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
-
-task:
-  name: 'FreeBSD 13: full build'
-  << : *FREEBSD_13
-  << : *FREEBSD_FULL_BUILD_TEMPLATE
-
-task:
-  name: 'FreeBSD 14: full build'
-  << : *FREEBSD_14
-  << : *FREEBSD_FULL_BUILD_TEMPLATE
-
-task:
-  name: 'FreeBSD 15: full build'
-  << : *FREEBSD_15
-  << : *FREEBSD_FULL_BUILD_TEMPLATE
-
-task:
-  name: 'FreeBSD 13: randconfig'
-  << : *FREEBSD_13
-  << : *FREEBSD_RANDCONFIG_TEMPLATE
-
-task:
-  name: 'FreeBSD 14: randconfig'
-  << : *FREEBSD_14
-  << : *FREEBSD_RANDCONFIG_TEMPLATE
-
-task:
-  name: 'FreeBSD 15: randconfig'
-  << : *FREEBSD_15
-  << : *FREEBSD_RANDCONFIG_TEMPLATE
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 18:11:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 18:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.928207.1330952 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txVDc-0003mq-Ms; Wed, 26 Mar 2025 18:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 928207.1330952; Wed, 26 Mar 2025 18:11:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txVDc-0003mf-K6; Wed, 26 Mar 2025 18:11:12 +0000
Received: by outflank-mailman (input) for mailman id 928207;
 Wed, 26 Mar 2025 18:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txVDc-0003mX-7Q
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 18:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txVDc-009tDo-1O
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 18:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txVDc-000CNl-0T
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 18:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4VZVLqUWcNXOKsEg2vtNKUj8eoQzE+nIt6uaMEeCgtU=; b=KO+wfrHppEnoVHiHzxgBjf6FUo
	I9meNdwMaJXYyvEpt32M6oWkvwFg0HBlWZnSWJ/owoLkz9c6WFKzJ29eGByCXELq/raBKgU3hi3bS
	gA3Gc2LmFjzmGAPfshBxqp0Rk1ibSLowm84KoB6TbzKirOHfJQ3+f6nw1YvWoh0SlSck=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/cirrus-ci: build XTF
Message-Id: <E1txVDc-000CNl-0T@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 18:11:12 +0000

commit a92c0a9888f14baf8e66a16e960bc524cc8194e6
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 12:16:19 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 26 17:02:21 2025 +0100

    automation/cirrus-ci: build XTF
    
    In preparation for using the XTF selftests to smoke test the FreeBSD based
    Xen builds.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index 95d2d2d3db..a6e4a5d030 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -12,6 +12,12 @@ freebsd_template: &FREEBSD_ENV
     CIRRUS_CLONE_DEPTH: 1
     CIRRUS_LOG_TIMESTAMP: true
 
+freebsd_template_latest: &FREEBSD_ENV_PRODUCTION
+  << : *FREEBSD_VERSIONS
+  freebsd_instance:
+    image_family: $FREEBSD_PRODUCTION
+  << : *FREEBSD_ENV
+
 freebsd_configure_artifacts: &FREEBSD_CONFIGURE_ARTIFACTS
   always:
     rename_script:
@@ -82,3 +88,21 @@ task:
 
   build_script:
     - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
+
+task:
+  name: 'FreeBSD: XTF build'
+  alias: xtf
+
+  << : *FREEBSD_ENV_PRODUCTION
+
+  clone_script:
+    - pkg install -y git
+    - git clone --depth 1 https://xenbits.xen.org/git-http/xtf.git
+
+  install_script: pkg install -y gmake
+
+  build_script:
+    - cd xtf
+    - cc --version
+    - git rev-parse HEAD
+    - gmake -j`sysctl -n hw.ncpu` LLVM=y
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 18:11:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 18:11:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.928208.1330956 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txVDm-0003pD-OB; Wed, 26 Mar 2025 18:11:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 928208.1330956; Wed, 26 Mar 2025 18:11:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txVDm-0003p5-LY; Wed, 26 Mar 2025 18:11:22 +0000
Received: by outflank-mailman (input) for mailman id 928208;
 Wed, 26 Mar 2025 18:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txVDm-0003oz-AJ
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 18:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txVDm-009tDw-1g
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 18:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txVDm-000COO-0o
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 18:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=R5vJn5P93XVtI8Numrks+7F0l+dMQZyhOrt3jI6NEF4=; b=O33D1eKfzpX22WSueuAmjkiNDx
	Qj0X3h2wqV2QUdbPRUblQVZ0S/BokPz7KsbANm0yzvdl8PeoURivBRwDGjIycNt2UBCAZodFE+ax8
	/QHVUnov5rwhsP/7u7Fgq28HPt0Hs4kcw9BnZ/Qw1ZePjTrSxJpvVjF0n7YnmLXJpPSk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/cirrus-ci: store XTF and Xen build artifacts
Message-Id: <E1txVDm-000COO-0o@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 18:11:22 +0000

commit c9de0e2ce41700132ffb9f25930fcca9da5e78af
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 13:01:36 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 26 17:02:21 2025 +0100

    automation/cirrus-ci: store XTF and Xen build artifacts
    
    In preparation for adding some smoke tests that will consume those outputs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index a6e4a5d030..38b654f75c 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -61,6 +61,14 @@ task:
   build_script:
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
+  xen_artifacts:
+    path: xen/xen
+    type: application/octet-stream
+
+  debug_artifacts:
+    path: xen/xen-syms
+    type: application/octet-stream
+
 task:
   name: 'FreeBSD: randconfig build'
 
@@ -106,3 +114,7 @@ task:
     - cc --version
     - git rev-parse HEAD
     - gmake -j`sysctl -n hw.ncpu` LLVM=y
+
+  xtf_artifacts:
+    path: xtf/tests/selftest/test-*-selftest
+    type: application/octet-stream
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 18:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 18:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.928209.1330959 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txVDx-0003rd-Pu; Wed, 26 Mar 2025 18:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 928209.1330959; Wed, 26 Mar 2025 18:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txVDx-0003rV-Mz; Wed, 26 Mar 2025 18:11:33 +0000
Received: by outflank-mailman (input) for mailman id 928209;
 Wed, 26 Mar 2025 18:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txVDw-0003rI-FL
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 18:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txVDw-009tE5-2B
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 18:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txVDw-000CRx-17
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 18:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TPnv8LFcn80mpvbgTnngHgvVPSCZFnW1D9+VQBhO3oc=; b=IOmnOE5w1lrRzQOqSB/niO3OxE
	MC6O8W8sAs3cZCmcMjN/dQVFQXu49e4EKPx9f18BEFROrGyV1HHITbx/eniIsex6xaQgX0waKU4te
	4IIPDjnDXTK2eouEcgyYjlTN24mBEK97ehbEluyS1V9+cEmEXQk5/2BhSUrL4z3lhx0A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/cirrus-ci: add smoke tests for the FreeBSD builds
Message-Id: <E1txVDw-000CRx-17@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 18:11:32 +0000

commit 7973cba4dbf72f6b963c780e9d1e0b99fd9622b9
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 13:37:46 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 26 17:02:21 2025 +0100

    automation/cirrus-ci: add smoke tests for the FreeBSD builds
    
    Introduce a basic set of smoke tests using the XTF selftest image, and run
    them on QEMU.  Use the matrix keyword to create a different task for each
    XTF flavor on each FreeBSD build.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml  | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 CHANGELOG.md |  1 +
 2 files changed, 55 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index 38b654f75c..3163ab8f11 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -5,6 +5,8 @@ freebsd_versions: &FREEBSD_VERSIONS
     FREEBSD_PRODUCTION: freebsd-14-2
     FREEBSD_CURRENT:    freebsd-15-0-snap
 
+# Build jobs
+
 freebsd_template: &FREEBSD_ENV
   environment:
     APPEND_LIB: /usr/local/lib
@@ -118,3 +120,55 @@ task:
   xtf_artifacts:
     path: xtf/tests/selftest/test-*-selftest
     type: application/octet-stream
+
+# Test jobs
+
+task:
+  name: 'FreeBSD: XTF selftest'
+
+  << : *FREEBSD_ENV_PRODUCTION
+
+  env:
+    matrix:
+      FREEBSD_BUILD: $FREEBSD_LEGACY
+      FREEBSD_BUILD: $FREEBSD_PRODUCTION
+      FREEBSD_BUILD: $FREEBSD_CURRENT
+
+  depends_on:
+    - freebsd_full_$FREEBSD_BUILD
+    - xtf
+
+  install_script: pkg install -y qemu-nox11 expect
+
+  env:
+    matrix:
+      XTF_ARCH: hvm32
+      XTF_ARCH: hvm32pae
+      XTF_ARCH: hvm32pse
+      XTF_ARCH: hvm64
+      XTF_ARCH: pv64
+
+  fetch_script:
+    - fetch https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/xtf/xtf.zip
+    - fetch https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/freebsd_full_$FREEBSD_BUILD/xen.zip
+    - unzip xtf.zip
+    - unzip xen.zip
+
+  test_script: |
+    case "$XTF_ARCH" in \
+      *hvm*) \
+        XEN_EXTRA_CMD="dom0=pvh dom0-iommu=none" \
+        ;; \
+    esac
+    export TEST_CMD="qemu-system-x86_64 -kernel xen/xen -initrd xtf/tests/selftest/test-${XTF_ARCH}-selftest \
+                                        -append \"loglvl=all console=com1 noreboot console_timestamps=boot dom0=verbose ${XEN_EXTRA_CMD}\" \
+                                        -m 512 -nographic -monitor none -serial stdio"
+    export TEST_LOG="serial-${FREEBSD_BUILD}-${XTF_ARCH}.txt"
+    export PASSED="Test result: SUCCESS"
+    export TEST_TIMEOUT=120
+    ./automation/scripts/console.exp | sed 's/\r\+$//'
+
+  always:
+    serial_artifacts:
+      path: serial-*.txt
+      type: text/plain
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a5919585d..35ab674924 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    - Resizable BARs is supported for PVH dom0.
    - Support PCI passthrough for HVM domUs when dom0 is PVH (note SR-IOV
      capability usage is not yet supported on PVH dom0).
+   - Smoke tests for the FreeBSD Xen builds in Cirrus CI.
 
 ### Removed
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 19:22:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 19:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.928224.1330964 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txWKB-0000zo-Ig; Wed, 26 Mar 2025 19:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 928224.1330964; Wed, 26 Mar 2025 19:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txWKB-0000zg-G2; Wed, 26 Mar 2025 19:22:03 +0000
Received: by outflank-mailman (input) for mailman id 928224;
 Wed, 26 Mar 2025 19:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txWKA-0000za-1M
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 19:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txWK9-009uv7-2q
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 19:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txWK9-000J6U-1n
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 19:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4WACzznUkGFegZ06LqxjPI47yN4Oe0Js22fHTu+aA8w=; b=1jYh9EjcsgGKYMgJKLomv++01J
	UOovXrf5jz4sMZ3joJIml2JHYI9RIUdmoW1JHizd4yI4yx1QKOkAyTZTTv2aI/SIF898aV3mzg25V
	uPXaIEHoOEdrdsxgpJCjyYREizJWL7rXB3iR7Poxgan339PH+xNyF33Ey7ZfEeP9hdSU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/cirrus-ci: use matrix keyword to generate per-version build tasks
Message-Id: <E1txWK9-000J6U-1n@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 19:22:01 +0000

commit b548a7dc4bb4202410983dd3ef7b5f1b469bdac3
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Sat Mar 15 09:35:12 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 26 17:02:21 2025 +0100

    automation/cirrus-ci: use matrix keyword to generate per-version build tasks
    
    Move the current logic to use the matrix keyword to generate a task for
    each version of FreeBSD we want to build Xen on.  The matrix keyword
    however cannot be used in YAML aliases, so it needs to be explicitly used
    inside of each task, which creates a bit of duplication.  At least abstract
    the FreeBSD minor version numbers to avoid repetition of image names.
    
    Note that the full build uses matrix over an env variable instead of using
    it directly in image_family.  This is so that the alias can also be set
    based on the FreeBSD version, in preparation for adding further tasks that
    will depend on the full build having finished.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 78 +++++++++++++++++++++++++++++--------------------------------
 1 file changed, 37 insertions(+), 41 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 490f214f04..95d2d2d3db 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1,13 +1,9 @@
 # https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
-freebsd_13: &FREEBSD_13
-  freebsd_instance:
-    image_family: freebsd-13-5
-freebsd_14: &FREEBSD_14
-  freebsd_instance:
-    image_family: freebsd-14-2
-freebsd_15: &FREEBSD_15
-  freebsd_instance:
-    image_family: freebsd-15-0-snap
+freebsd_versions: &FREEBSD_VERSIONS
+  env:
+    FREEBSD_LEGACY:     freebsd-13-5
+    FREEBSD_PRODUCTION: freebsd-14-2
+    FREEBSD_CURRENT:    freebsd-15-0-snap
 
 freebsd_template: &FREEBSD_ENV
   environment:
@@ -24,7 +20,24 @@ freebsd_configure_artifacts: &FREEBSD_CONFIGURE_ARTIFACTS
       path: xen-config
       type: text/plain
 
-freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
+task:
+  name: 'FreeBSD: full build'
+
+  # It's not possible to use the matrix keyword in YAML aliases, as they
+  # keyword usage is restricted to task, docker_builder or pipe.  Attempting to
+  # use a YAML alias with the duplicated keys doesn't work either. Use an env
+  # variable so the version can also be appended to the task alias.
+  << : *FREEBSD_VERSIONS
+  env:
+    matrix:
+      FREEBSD_VERSION: $FREEBSD_LEGACY
+      FREEBSD_VERSION: $FREEBSD_PRODUCTION
+      FREEBSD_VERSION: $FREEBSD_CURRENT
+
+  alias: freebsd_full_$FREEBSD_VERSION
+  freebsd_instance:
+    image_family: $FREEBSD_VERSION
+
   << : *FREEBSD_ENV
 
   install_script: pkg install -y seabios gmake ninja bash
@@ -42,7 +55,20 @@ freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
   build_script:
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
-freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
+task:
+  name: 'FreeBSD: randconfig build'
+
+  # It's not possible to use the matrix keyword in YAML aliases, as they
+  # keyword usage is restricted to task, docker_builder or pipe.  Attempting to
+  # use a YAML alias with the duplicated `image_family` keys doesn't work
+  # either. Abstract the version numbers at least.
+  << : *FREEBSD_VERSIONS
+  freebsd_instance:
+    matrix:
+      image_family: $FREEBSD_LEGACY
+      image_family: $FREEBSD_PRODUCTION
+      image_family: $FREEBSD_CURRENT
+
   << : *FREEBSD_ENV
 
   install_script: pkg install -y gmake python3 bison
@@ -56,33 +82,3 @@ freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
 
   build_script:
     - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
-
-task:
-  name: 'FreeBSD 13: full build'
-  << : *FREEBSD_13
-  << : *FREEBSD_FULL_BUILD_TEMPLATE
-
-task:
-  name: 'FreeBSD 14: full build'
-  << : *FREEBSD_14
-  << : *FREEBSD_FULL_BUILD_TEMPLATE
-
-task:
-  name: 'FreeBSD 15: full build'
-  << : *FREEBSD_15
-  << : *FREEBSD_FULL_BUILD_TEMPLATE
-
-task:
-  name: 'FreeBSD 13: randconfig'
-  << : *FREEBSD_13
-  << : *FREEBSD_RANDCONFIG_TEMPLATE
-
-task:
-  name: 'FreeBSD 14: randconfig'
-  << : *FREEBSD_14
-  << : *FREEBSD_RANDCONFIG_TEMPLATE
-
-task:
-  name: 'FreeBSD 15: randconfig'
-  << : *FREEBSD_15
-  << : *FREEBSD_RANDCONFIG_TEMPLATE
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 19:22:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 19:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.928225.1330967 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txWKK-00011J-K5; Wed, 26 Mar 2025 19:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 928225.1330967; Wed, 26 Mar 2025 19:22:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txWKK-00011B-HR; Wed, 26 Mar 2025 19:22:12 +0000
Received: by outflank-mailman (input) for mailman id 928225;
 Wed, 26 Mar 2025 19:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txWKJ-000113-Q7
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 19:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txWKK-009uvL-02
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 19:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txWKJ-000J7f-2H
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 19:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=htJaGs3BZYlxQ9nxcVrCGGYKnKGVXdmOfhjqhb0yUlQ=; b=Gq/ouTNUtAaUy8uFmvR9DrWH2y
	9mHPb0/J7luJxD0z0sm5ChClbXdkGBrpVeY10hD2bw2jcXwR0Jyv5O7JLFWWYDH11zMO+eEfJF+Zd
	ITGqZRCHAGMZjYRXSGuscRDx5eA9EuFgFNrh+cLhcw6ksBbmr8PnR8/zjpfqXzPPzOP0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/cirrus-ci: build XTF
Message-Id: <E1txWKJ-000J7f-2H@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 19:22:11 +0000

commit a92c0a9888f14baf8e66a16e960bc524cc8194e6
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 12:16:19 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 26 17:02:21 2025 +0100

    automation/cirrus-ci: build XTF
    
    In preparation for using the XTF selftests to smoke test the FreeBSD based
    Xen builds.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index 95d2d2d3db..a6e4a5d030 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -12,6 +12,12 @@ freebsd_template: &FREEBSD_ENV
     CIRRUS_CLONE_DEPTH: 1
     CIRRUS_LOG_TIMESTAMP: true
 
+freebsd_template_latest: &FREEBSD_ENV_PRODUCTION
+  << : *FREEBSD_VERSIONS
+  freebsd_instance:
+    image_family: $FREEBSD_PRODUCTION
+  << : *FREEBSD_ENV
+
 freebsd_configure_artifacts: &FREEBSD_CONFIGURE_ARTIFACTS
   always:
     rename_script:
@@ -82,3 +88,21 @@ task:
 
   build_script:
     - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
+
+task:
+  name: 'FreeBSD: XTF build'
+  alias: xtf
+
+  << : *FREEBSD_ENV_PRODUCTION
+
+  clone_script:
+    - pkg install -y git
+    - git clone --depth 1 https://xenbits.xen.org/git-http/xtf.git
+
+  install_script: pkg install -y gmake
+
+  build_script:
+    - cd xtf
+    - cc --version
+    - git rev-parse HEAD
+    - gmake -j`sysctl -n hw.ncpu` LLVM=y
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 19:22:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 19:22:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.928226.1330971 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txWKU-00013w-LS; Wed, 26 Mar 2025 19:22:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 928226.1330971; Wed, 26 Mar 2025 19:22:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txWKU-00013o-Iu; Wed, 26 Mar 2025 19:22:22 +0000
Received: by outflank-mailman (input) for mailman id 928226;
 Wed, 26 Mar 2025 19:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txWKT-00013i-Uo
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 19:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txWKU-009uvT-0K
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 19:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txWKT-000J8g-2g
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 19:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OMHOrM0Ki4A6WqBc3nvPBt17ZIAWg//APzL+Immx1wg=; b=5cHkS0TIfUT/rkAf9RaTwmcy7r
	r+vGrbiNz7tzm91/hsAqd1vl0W2aUnQHgfzcgYsz+IJJ5nMKu8FWFJhFsv+qRp1JV8fOe1hpE8QAJ
	lHnJY9ehndAbshbo6DtJD6qGvwHICkqlwFY9RFfWiI2GPCp9/ll2BZdSV4ZqE9/WaIz0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/cirrus-ci: store XTF and Xen build artifacts
Message-Id: <E1txWKT-000J8g-2g@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 19:22:21 +0000

commit c9de0e2ce41700132ffb9f25930fcca9da5e78af
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 13:01:36 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 26 17:02:21 2025 +0100

    automation/cirrus-ci: store XTF and Xen build artifacts
    
    In preparation for adding some smoke tests that will consume those outputs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index a6e4a5d030..38b654f75c 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -61,6 +61,14 @@ task:
   build_script:
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
+  xen_artifacts:
+    path: xen/xen
+    type: application/octet-stream
+
+  debug_artifacts:
+    path: xen/xen-syms
+    type: application/octet-stream
+
 task:
   name: 'FreeBSD: randconfig build'
 
@@ -106,3 +114,7 @@ task:
     - cc --version
     - git rev-parse HEAD
     - gmake -j`sysctl -n hw.ncpu` LLVM=y
+
+  xtf_artifacts:
+    path: xtf/tests/selftest/test-*-selftest
+    type: application/octet-stream
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Mar 26 19:22:32 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Mar 2025 19:22:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.928227.1330976 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txWKe-00016e-OO; Wed, 26 Mar 2025 19:22:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 928227.1330976; Wed, 26 Mar 2025 19:22:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txWKe-00016W-Lc; Wed, 26 Mar 2025 19:22:32 +0000
Received: by outflank-mailman (input) for mailman id 928227;
 Wed, 26 Mar 2025 19:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txWKe-00016J-04
 for xen-changelog@lists.xenproject.org; Wed, 26 Mar 2025 19:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txWKe-009uva-0e
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 19:22:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txWKd-000J9m-2y
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Mar 2025 19:22:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YukIoC7pE2vS13YFqqUCJivWbFIakMv6X0pIwt0PGwc=; b=XhTgnfyk47MIQDQ0O52MDT5hIz
	askFcHwDAYHNyRwDjI3bCrhL8IY2I5nMO86MRqSK0ZLhRj+DEfUlnto6jE+fooLsk6kH5I75aVFa7
	B76xUyYYGJXzs2YFtgKYufMojDL88SH+UfsyFYK+mM+0zzknG6IymF4743o9FH7u8oz0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/cirrus-ci: add smoke tests for the FreeBSD builds
Message-Id: <E1txWKd-000J9m-2y@xenbits.xenproject.org>
Date: Wed, 26 Mar 2025 19:22:31 +0000

commit 7973cba4dbf72f6b963c780e9d1e0b99fd9622b9
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Mar 14 13:37:46 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Mar 26 17:02:21 2025 +0100

    automation/cirrus-ci: add smoke tests for the FreeBSD builds
    
    Introduce a basic set of smoke tests using the XTF selftest image, and run
    them on QEMU.  Use the matrix keyword to create a different task for each
    XTF flavor on each FreeBSD build.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .cirrus.yml  | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 CHANGELOG.md |  1 +
 2 files changed, 55 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index 38b654f75c..3163ab8f11 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -5,6 +5,8 @@ freebsd_versions: &FREEBSD_VERSIONS
     FREEBSD_PRODUCTION: freebsd-14-2
     FREEBSD_CURRENT:    freebsd-15-0-snap
 
+# Build jobs
+
 freebsd_template: &FREEBSD_ENV
   environment:
     APPEND_LIB: /usr/local/lib
@@ -118,3 +120,55 @@ task:
   xtf_artifacts:
     path: xtf/tests/selftest/test-*-selftest
     type: application/octet-stream
+
+# Test jobs
+
+task:
+  name: 'FreeBSD: XTF selftest'
+
+  << : *FREEBSD_ENV_PRODUCTION
+
+  env:
+    matrix:
+      FREEBSD_BUILD: $FREEBSD_LEGACY
+      FREEBSD_BUILD: $FREEBSD_PRODUCTION
+      FREEBSD_BUILD: $FREEBSD_CURRENT
+
+  depends_on:
+    - freebsd_full_$FREEBSD_BUILD
+    - xtf
+
+  install_script: pkg install -y qemu-nox11 expect
+
+  env:
+    matrix:
+      XTF_ARCH: hvm32
+      XTF_ARCH: hvm32pae
+      XTF_ARCH: hvm32pse
+      XTF_ARCH: hvm64
+      XTF_ARCH: pv64
+
+  fetch_script:
+    - fetch https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/xtf/xtf.zip
+    - fetch https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/freebsd_full_$FREEBSD_BUILD/xen.zip
+    - unzip xtf.zip
+    - unzip xen.zip
+
+  test_script: |
+    case "$XTF_ARCH" in \
+      *hvm*) \
+        XEN_EXTRA_CMD="dom0=pvh dom0-iommu=none" \
+        ;; \
+    esac
+    export TEST_CMD="qemu-system-x86_64 -kernel xen/xen -initrd xtf/tests/selftest/test-${XTF_ARCH}-selftest \
+                                        -append \"loglvl=all console=com1 noreboot console_timestamps=boot dom0=verbose ${XEN_EXTRA_CMD}\" \
+                                        -m 512 -nographic -monitor none -serial stdio"
+    export TEST_LOG="serial-${FREEBSD_BUILD}-${XTF_ARCH}.txt"
+    export PASSED="Test result: SUCCESS"
+    export TEST_TIMEOUT=120
+    ./automation/scripts/console.exp | sed 's/\r\+$//'
+
+  always:
+    serial_artifacts:
+      path: serial-*.txt
+      type: text/plain
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a5919585d..35ab674924 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    - Resizable BARs is supported for PVH dom0.
    - Support PCI passthrough for HVM domUs when dom0 is PVH (note SR-IOV
      capability usage is not yet supported on PVH dom0).
+   - Smoke tests for the FreeBSD Xen builds in Cirrus CI.
 
 ### Removed
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 11:33:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 11:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929046.1331669 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txlTq-0000BM-IP; Thu, 27 Mar 2025 11:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929046.1331669; Thu, 27 Mar 2025 11:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txlTq-0000BE-Fy; Thu, 27 Mar 2025 11:33:02 +0000
Received: by outflank-mailman (input) for mailman id 929046;
 Thu, 27 Mar 2025 11:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txlTp-0000Au-SH
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 11:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txlTp-00BlPC-2N
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 11:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txlTp-001T75-2C
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 11:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xT0Rz0KwoP3hPd4V++56ZYRch/ITIwo+01BFgaBckhk=; b=W/DDY8RBdsynyqT2hylNhCBuKB
	v8aZ0fLO+WwgYnV+tziL5VfxiaeHUgOTF1vHRRYnHw0wkTR0F+EDzyAUOkfkLdMQmqW3NThlIA3ev
	C+R8VmSOxnIQesyrVFScOSvMhZMeK26kSiiSMGNcHBPzjDOeqYIPlYH+otF0tX8Z97iw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PVH: account for module command line length
Message-Id: <E1txlTp-001T75-2C@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 11:33:01 +0000

commit 989584e532c9517a0f789e993f5f6744beaebe3e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 12:21:08 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 12:21:08 2025 +0100

    x86/PVH: account for module command line length
    
    As per observation in practice, initrd->cmdline_pa is not normally zero.
    Hence so far we always appended at least one byte. That alone may
    already render insufficient the "allocation" made by find_memory().
    Things would be worse when there's actually a (perhaps long) command
    line.
    
    Skip setup when the command line is empty. Amend the "allocation" size
    by padding and actual size of module command line. Along these lines
    also skip initrd setup when the initrd is zero size.
    
    Fixes: 0ecb8eb09f9f ("x86/pvh: pass module command line to dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/hvm/dom0_build.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 13a7385432..daf1b6f88b 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -652,6 +652,7 @@ static int __init pvh_load_kernel(
     unsigned long image_len = image->size;
     unsigned long initrd_len = initrd ? initrd->size : 0;
     const char *cmdline = image->cmdline_pa ? __va(image->cmdline_pa) : NULL;
+    const char *initrd_cmdline = NULL;
     struct elf_binary elf;
     struct elf_dom_parms parms;
     size_t extra_space;
@@ -715,7 +716,23 @@ static int __init pvh_load_kernel(
     extra_space = sizeof(start_info);
 
     if ( initrd )
-        extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
+    {
+        size_t initrd_space = elf_round_up(&elf, initrd_len);
+
+        if ( initrd->cmdline_pa )
+        {
+            initrd_cmdline = __va(initrd->cmdline_pa);
+            if ( !*initrd_cmdline )
+                initrd_cmdline = NULL;
+        }
+        if ( initrd_cmdline )
+            initrd_space += strlen(initrd_cmdline) + 1;
+
+        if ( initrd_space )
+            extra_space += ROUNDUP(initrd_space, PAGE_SIZE) + sizeof(mod);
+        else
+            initrd = NULL;
+    }
 
     if ( cmdline )
         extra_space += elf_round_up(&elf, strlen(cmdline) + 1);
@@ -740,12 +757,11 @@ static int __init pvh_load_kernel(
         mod.paddr = last_addr;
         mod.size = initrd_len;
         last_addr += elf_round_up(&elf, initrd_len);
-        if ( initrd->cmdline_pa )
+        if ( initrd_cmdline )
         {
-            char *str = __va(initrd->cmdline_pa);
-            size_t len = strlen(str) + 1;
+            size_t len = strlen(initrd_cmdline) + 1;
 
-            rc = hvm_copy_to_guest_phys(last_addr, str, len, v);
+            rc = hvm_copy_to_guest_phys(last_addr, initrd_cmdline, len, v);
             if ( rc )
             {
                 printk("Unable to copy module command line\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 11:33:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 11:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929050.1331673 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txlU0-0000JW-Jo; Thu, 27 Mar 2025 11:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929050.1331673; Thu, 27 Mar 2025 11:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txlU0-0000JO-HO; Thu, 27 Mar 2025 11:33:12 +0000
Received: by outflank-mailman (input) for mailman id 929050;
 Thu, 27 Mar 2025 11:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txlTz-0000JB-Rf
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 11:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txlTz-00BlPY-2f
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 11:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txlTz-001T86-2X
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 11:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8/3+kmfKUIPN6u/LQxEz+9Xh933BsbzdryE//hi2gr4=; b=UC3KLR4WEyYHx8Hk7fs/031sJb
	1qdjRNuW9YIljGpba2M+g6LSQ86bMAu1rNAlnYI5E+17y8vb30PHpF8eG1prBhJ0olLj5/mqw/ePx
	e9zlpSndwQ9NCP3zhnrf/HlSAJKrJzDB/IpwIG+aPJdbNFAA0J/Lg1y0C+Eydf+6fXMU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pmstat: correct get_cpufreq_para()'s error return value
Message-Id: <E1txlTz-001T86-2X@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 11:33:11 +0000

commit 855337ca4947508ffca23393e291c54b5307cc9a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 12:22:06 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 12:22:06 2025 +0100

    x86/pmstat: correct get_cpufreq_para()'s error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 7542c4ff00f2 ("Add user PM control interface")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/acpi/pmstat.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index aae94529ab..c51b9ca358 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -230,12 +230,12 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
 
     for ( i = 0; i < op->u.get_para.freq_num; i++ )
         data[i] = pmpt->perf.states[i].core_frequency * 1000;
-    ret = copy_to_guest(op->u.get_para.scaling_available_frequencies,
-                        data, op->u.get_para.freq_num) ?: ret;
+    ret += copy_to_guest(op->u.get_para.scaling_available_frequencies,
+                         data, op->u.get_para.freq_num);
 
     xfree(data);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     op->u.get_para.cpuinfo_cur_freq =
         cpufreq_driver.get ? alternative_call(cpufreq_driver.get, op->cpuid)
@@ -272,7 +272,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                             gov_num * CPUFREQ_NAME_LEN);
         xfree(scaling_available_governors);
         if ( ret )
-            return ret;
+            return -EFAULT;
 
         op->u.get_para.u.s.scaling_cur_freq = policy->cur;
         op->u.get_para.u.s.scaling_max_freq = policy->max;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 11:33:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 11:33:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929052.1331678 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txlUA-0000ON-Le; Thu, 27 Mar 2025 11:33:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929052.1331678; Thu, 27 Mar 2025 11:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txlUA-0000OF-J1; Thu, 27 Mar 2025 11:33:22 +0000
Received: by outflank-mailman (input) for mailman id 929052;
 Thu, 27 Mar 2025 11:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txlU9-0000O7-Uz
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 11:33:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txlU9-00BlPe-30
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 11:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txlU9-001T8m-2q
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 11:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zkT01JKedvybvyVmZJqXCZin0K0ZnWEWKZBXTh/70FE=; b=HbXVpERemdQ2nSp3j7SfrZSFe6
	qo2leYzAZoVWMGE2xDx4aAHFQiU2GpIF1pwjv0DeSSsi49Z4V3tIGGqiys3a4ENhD76f/p9ebFql/
	U51hpGcibTdbuDQvXsvaCMQr1wk8UNsRLDRu9TaholoEHHzKJymJ9wTFT20D5ncCqgOY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
Message-Id: <E1txlU9-001T8m-2q@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 11:33:21 +0000

commit 341c0df40bf73b0a5e27db27023ec400858a472d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 12:22:39 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 12:22:39 2025 +0100

    Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 86039f2e8c20 ("xen/arm: vpl011: Add a new domctl API to initialize vpl011")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/domctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index 9d047065ba..ad914c915f 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -172,8 +172,8 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
             break;
         }
 
-        if ( !rc )
-            rc = copy_to_guest(u_domctl, domctl, 1);
+        if ( !rc && copy_to_guest(u_domctl, domctl, 1) )
+            rc = -EFAULT;
 
         return rc;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 11:33:32 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 11:33:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929054.1331682 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txlUK-0000R1-Mz; Thu, 27 Mar 2025 11:33:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929054.1331682; Thu, 27 Mar 2025 11:33:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txlUK-0000Qt-KQ; Thu, 27 Mar 2025 11:33:32 +0000
Received: by outflank-mailman (input) for mailman id 929054;
 Thu, 27 Mar 2025 11:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txlUK-0000Qn-2x
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 11:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txlUK-00BlPi-09
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 11:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txlUJ-001T9b-3A
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 11:33:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Vrdprl5MGUdfnB9PGhiAmOwCEVV6h5oH4suvfrdkBys=; b=shx2b/R46aZ90orTvlM6CTKXjU
	jpK14+WIqHPxqm7gPLvgXoHfy3mODz3KR4vsr1Tu8TuOynT4goqZKX2F5DO/22cN4PcX7b8pp5mXq
	0ESThuLklFJLePKAIiM9qeLSWJN3BnHsqQankONYgMEnB+wOS1eE2oCQpJrUvz2ZDX48=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: add H extension to -march
Message-Id: <E1txlUJ-001T9b-3A@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 11:33:31 +0000

commit 2addc9f05130a9fb3aa65bd47ff314c47e7eaed4
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Mar 27 12:23:10 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 12:23:10 2025 +0100

    xen/riscv: add H extension to -march
    
    H provides additional instructions and CSRs that control the new stage of
    address translation and support hosting a guest OS in virtual S-mode
    (VS-mode).
    
    According to the Unprivileged Architecture (version 20240411) specification:
    ```
    Table 74 summarizes the standardized extension names. The table also defines
    the canonical order in which extension names must appear in the name string,
    with top-to-bottom in table indicating first-to-last in the name string, e.g.,
    RV32IMACV is legal, whereas RV32IMAVC is not.
    ```
    According to Table 74, the h extension is placed last in the one-letter
    extensions name part of the ISA string.
    
    `h` is a standalone extension based on the patch [1] but it wasn't so
    before.
    As the minimal supported GCC version to build Xen for RISC-V is 12.2.0,
    and for that version, h is still considered a prefix for the hypervisor
    extension but the name of hypervisor extension must be more then 1 letter
    extension, a workaround ( with using `hh` as an H extension name ) is
    implemented as otherwise the following compilation error will occur:
     error: '-march=rv64gc_h_zbb_zihintpause': name of hypervisor extension
            must be more than 1 letter
    
    After GCC version 13.1.0, the commit [1] introducing H extension support
    allows us to drop the workaround with `hh` as hypervisor extension name
    and use only one h in -march.
    
    [1] https://github.com/gcc-mirror/gcc/commit/0cd11d301013af50a3fae0694c909952e94e20d5#diff-d6f7db0db31bfb339b01bec450f1b905381eb4730cc5ab2b2794971e34647d64R148
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/riscv/booting.txt |  4 ++++
 xen/arch/riscv/arch.mk      | 11 +++++++++--
 xen/arch/riscv/cpufeature.c |  1 +
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/docs/misc/riscv/booting.txt b/docs/misc/riscv/booting.txt
index cb4d79f12c..3a8474a27d 100644
--- a/docs/misc/riscv/booting.txt
+++ b/docs/misc/riscv/booting.txt
@@ -3,6 +3,10 @@ System requirements
 
 The following extensions are expected to be supported by a system on which
 Xen is run:
+- H:
+  Provides additional instructions and CSRs that control the new stage of
+  address translation and support hosting a guest OS in virtual S-mode
+  (VS-mode).
 - Zbb:
   RISC-V doesn't have a CLZ instruction in the base ISA.
   As a consequence, __builtin_ffs() emits a library call to ffs() on GCC,
diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 236ea7c8a6..599544429f 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -9,7 +9,6 @@ riscv-abi-$(CONFIG_RISCV_64) := -mabi=lp64
 riscv-march-$(CONFIG_RISCV_64) := rv64
 riscv-march-y += ima
 riscv-march-$(CONFIG_RISCV_ISA_C) += c
-riscv-march-y += _zicsr_zifencei_zbb
 
 riscv-generic-flags := $(riscv-abi-y) -march=$(subst $(space),,$(riscv-march-y))
 
@@ -25,10 +24,18 @@ $(eval $(1) := \
 	$(call as-insn,$(CC) $(riscv-generic-flags)_$(1),$(value $(1)-insn),_$(1)))
 endef
 
+h-insn := "hfence.gvma"
+$(call check-extension,h)
+
+ifneq ($(h),_h)
+hh-insn := "hfence.gvma"
+$(call check-extension,hh)
+endif
+
 zihintpause-insn := "pause"
 $(call check-extension,zihintpause)
 
-extensions := $(zihintpause)
+extensions := $(h) $(hh) $(zihintpause) _zicsr_zifencei_zbb
 
 extensions := $(subst $(space),,$(extensions))
 
diff --git a/xen/arch/riscv/cpufeature.c b/xen/arch/riscv/cpufeature.c
index bf09aa1170..5aafab0f49 100644
--- a/xen/arch/riscv/cpufeature.c
+++ b/xen/arch/riscv/cpufeature.c
@@ -146,6 +146,7 @@ static const struct riscv_isa_ext_data __initconst required_extensions[] = {
 #ifdef CONFIG_RISCV_ISA_C
     RISCV_ISA_EXT_DATA(c),
 #endif
+    RISCV_ISA_EXT_DATA(h),
     RISCV_ISA_EXT_DATA(zicsr),
     RISCV_ISA_EXT_DATA(zifencei),
     RISCV_ISA_EXT_DATA(zihintpause),
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 12:33:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 12:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929184.1331796 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txmPv-000429-B4; Thu, 27 Mar 2025 12:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929184.1331796; Thu, 27 Mar 2025 12:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txmPv-000421-8Z; Thu, 27 Mar 2025 12:33:03 +0000
Received: by outflank-mailman (input) for mailman id 929184;
 Thu, 27 Mar 2025 12:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txmPt-00041t-Ty
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 12:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txmPt-00BmnS-2L
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 12:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txmPt-001Xpm-2E
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 12:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3MclvCIuU4JTgbLLl3WHhJcKvi7hAZI5K38Imt7HKUs=; b=UKpSjeKYoZcwGF4oSOgIGdjJ8c
	61Sz2rwydNN0/cREDE1CgBwovhZwEWaLNzOpgN/KzY9Osr8kY53Df4DLvjI34PyqCShDmdFE8Jd4J
	HPRHuCPxBPoKH84IoL3DZwS/yv/SGH5LSsuxxlzP5UuLxfVqg7zLvAmuS4NwPXcTR1tw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM/vgic: Fix out-of-bounds accesses in vgic_mmio_write_sgir()
Message-Id: <E1txmPt-001Xpm-2E@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 12:33:01 +0000

commit be7f0cc651d8d02a95820792204c0558f1f29e03
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Mar 26 15:26:56 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Mar 27 11:54:23 2025 +0000

    ARM/vgic: Fix out-of-bounds accesses in vgic_mmio_write_sgir()
    
    The switch() statement is over bits 24:25 (unshifted) of the guest provided
    value.  This makes case 0x3: dead, and not an implementation of the 4th
    possible state.
    
    A guest which writes (0x3 << 24) | (0xff << 16) to this register will skip the
    early exit, then enter bitmap_for_each() with targets not bound by nr_vcpus.
    
    If the guest has fewer than 8 vCPUs, bitmap_for_each() will read off the end
    of d->vcpu[] and use the resulting vcpu pointer to ultimately derive irq, and
    perform out-of-bounds writes.
    
    Fix this by changing case 0x3 to default.
    
    Fixes: 08c688ca6422 ("ARM: new VGIC: Add SGIR register handler")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/vgic/vgic-mmio-v2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/vgic/vgic-mmio-v2.c b/xen/arch/arm/vgic/vgic-mmio-v2.c
index 670b335db2..7d1391ac9b 100644
--- a/xen/arch/arm/vgic/vgic-mmio-v2.c
+++ b/xen/arch/arm/vgic/vgic-mmio-v2.c
@@ -104,7 +104,8 @@ static void vgic_mmio_write_sgir(struct vcpu *source_vcpu,
     case GICD_SGI_TARGET_SELF:                    /* this very vCPU only */
         targets = (1U << source_vcpu->vcpu_id);
         break;
-    case 0x3:                                     /* reserved */
+
+    default:
         return;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 12:33:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 12:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929185.1331800 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txmQ5-000445-CZ; Thu, 27 Mar 2025 12:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929185.1331800; Thu, 27 Mar 2025 12:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txmQ5-00043x-9v; Thu, 27 Mar 2025 12:33:13 +0000
Received: by outflank-mailman (input) for mailman id 929185;
 Thu, 27 Mar 2025 12:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txmQ3-00043d-Rc
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 12:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txmQ3-00Bmnz-2e
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 12:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txmQ3-001Xql-2W
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 12:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NnqzNfO85GQx/+XZcyKF7cV0aeIb442GpUXxrcJ1X+M=; b=K8jqnCpQWk2FR/gUaQB8qOM5+U
	wL8TxTJxVZWhmac64jIIXOD13bvcqY7jYA0/tC5yzdwPcQ0IvttVRf6GGov0WrOKMAivK+PkrCv5s
	Mg/OFEDw1b315pJshqAc5De30yzP9JoG3xAuWIlm1vwMevvifn59vg3pV+KSwf4D7JY8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM/vgic: Use for_each_set_bit() in vgic_mmio_write_sgir()
Message-Id: <E1txmQ3-001Xql-2W@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 12:33:11 +0000

commit eeb679da8f8d5d96948315ce30e4d750be6a1f51
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 30 14:25:28 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Mar 27 11:54:23 2025 +0000

    ARM/vgic: Use for_each_set_bit() in vgic_mmio_write_sgir()
    
    The bitmap_for_each() expression only inspects the bottom 8 bits of targets.
    Change it's type to uint8_t and use for_each_set_bit() which is more efficient
    over scalars.
    
    GICD_SGI_TARGET_LIST_MASK is 2 bits wide.  Two cases discard the prior
    calculation of targets, and one case exits early.
    
    Therefore, move the GICD_SGI_TARGET_MASK calculation into the only case which
    wants it, and use MASK_EXTR() to simplify the expression.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/vgic/vgic-mmio-v2.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/vgic/vgic-mmio-v2.c b/xen/arch/arm/vgic/vgic-mmio-v2.c
index 7d1391ac9b..b7c2d7ce99 100644
--- a/xen/arch/arm/vgic/vgic-mmio-v2.c
+++ b/xen/arch/arm/vgic/vgic-mmio-v2.c
@@ -88,13 +88,12 @@ static void vgic_mmio_write_sgir(struct vcpu *source_vcpu,
     struct domain *d = source_vcpu->domain;
     unsigned int nr_vcpus = d->max_vcpus;
     unsigned int intid = val & GICD_SGI_INTID_MASK;
-    unsigned long targets = (val & GICD_SGI_TARGET_MASK) >>
-                            GICD_SGI_TARGET_SHIFT;
-    unsigned int vcpu_id;
+    uint8_t targets = 0;
 
     switch ( val & GICD_SGI_TARGET_LIST_MASK )
     {
     case GICD_SGI_TARGET_LIST:                    /* as specified by targets */
+        targets = MASK_EXTR(val, GICD_SGI_TARGET_MASK);
         targets &= GENMASK(nr_vcpus - 1, 0);      /* limit to existing VCPUs */
         break;
     case GICD_SGI_TARGET_OTHERS:
@@ -109,7 +108,7 @@ static void vgic_mmio_write_sgir(struct vcpu *source_vcpu,
         return;
     }
 
-    bitmap_for_each ( vcpu_id, &targets, 8 )
+    for_each_set_bit ( vcpu_id, targets )
     {
         struct vcpu *vcpu = d->vcpu[vcpu_id];
         struct vgic_irq *irq = vgic_get_irq(d, vcpu, intid);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 12:44:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 12:44:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929199.1331814 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txmaZ-00072w-Aj; Thu, 27 Mar 2025 12:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929199.1331814; Thu, 27 Mar 2025 12:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txmaZ-00072o-89; Thu, 27 Mar 2025 12:44:03 +0000
Received: by outflank-mailman (input) for mailman id 929199;
 Thu, 27 Mar 2025 12:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txmaY-00072i-1y
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 12:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txmaX-00Bn3Z-2K
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 12:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txmaX-001Yvo-2C
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 12:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KlZF8ZdpKNomlfPZAxCh6H4jiV+EdL+ubBVC1dFTR7U=; b=2J43zsf0LpvyHGO5+XVfK1ZsCO
	TB2dZwnf5Didr24Iu1Ykyh/NzD41f1O+Sxd8LL+SfqyXjhq/XcMF0UWUW4EbcDkO0OiCN1RashLmT
	RyLHSYHK9xhVVZkrlltDCer7PiZCTCjnHu3Rs7z2PXKbgFJgZju6rO1yBMSdQdy3uwmo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PVH: account for module command line length
Message-Id: <E1txmaX-001Yvo-2C@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 12:44:01 +0000

commit 989584e532c9517a0f789e993f5f6744beaebe3e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 12:21:08 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 12:21:08 2025 +0100

    x86/PVH: account for module command line length
    
    As per observation in practice, initrd->cmdline_pa is not normally zero.
    Hence so far we always appended at least one byte. That alone may
    already render insufficient the "allocation" made by find_memory().
    Things would be worse when there's actually a (perhaps long) command
    line.
    
    Skip setup when the command line is empty. Amend the "allocation" size
    by padding and actual size of module command line. Along these lines
    also skip initrd setup when the initrd is zero size.
    
    Fixes: 0ecb8eb09f9f ("x86/pvh: pass module command line to dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/hvm/dom0_build.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 13a7385432..daf1b6f88b 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -652,6 +652,7 @@ static int __init pvh_load_kernel(
     unsigned long image_len = image->size;
     unsigned long initrd_len = initrd ? initrd->size : 0;
     const char *cmdline = image->cmdline_pa ? __va(image->cmdline_pa) : NULL;
+    const char *initrd_cmdline = NULL;
     struct elf_binary elf;
     struct elf_dom_parms parms;
     size_t extra_space;
@@ -715,7 +716,23 @@ static int __init pvh_load_kernel(
     extra_space = sizeof(start_info);
 
     if ( initrd )
-        extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
+    {
+        size_t initrd_space = elf_round_up(&elf, initrd_len);
+
+        if ( initrd->cmdline_pa )
+        {
+            initrd_cmdline = __va(initrd->cmdline_pa);
+            if ( !*initrd_cmdline )
+                initrd_cmdline = NULL;
+        }
+        if ( initrd_cmdline )
+            initrd_space += strlen(initrd_cmdline) + 1;
+
+        if ( initrd_space )
+            extra_space += ROUNDUP(initrd_space, PAGE_SIZE) + sizeof(mod);
+        else
+            initrd = NULL;
+    }
 
     if ( cmdline )
         extra_space += elf_round_up(&elf, strlen(cmdline) + 1);
@@ -740,12 +757,11 @@ static int __init pvh_load_kernel(
         mod.paddr = last_addr;
         mod.size = initrd_len;
         last_addr += elf_round_up(&elf, initrd_len);
-        if ( initrd->cmdline_pa )
+        if ( initrd_cmdline )
         {
-            char *str = __va(initrd->cmdline_pa);
-            size_t len = strlen(str) + 1;
+            size_t len = strlen(initrd_cmdline) + 1;
 
-            rc = hvm_copy_to_guest_phys(last_addr, str, len, v);
+            rc = hvm_copy_to_guest_phys(last_addr, initrd_cmdline, len, v);
             if ( rc )
             {
                 printk("Unable to copy module command line\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 12:44:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 12:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929201.1331822 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txmai-00077J-JZ; Thu, 27 Mar 2025 12:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929201.1331822; Thu, 27 Mar 2025 12:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txmai-00076i-Fu; Thu, 27 Mar 2025 12:44:12 +0000
Received: by outflank-mailman (input) for mailman id 929201;
 Thu, 27 Mar 2025 12:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txmah-00074a-Ra
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 12:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txmah-00Bn3z-2f
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 12:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txmah-001YwY-2V
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 12:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rgX3A0EPEX43qerz5TRkqslB53zKSU8vfkz5hBzttxI=; b=XL7y+reGjj5TM7CXJGmaB6W5JJ
	fUwrBPWPux//wxj4M7YRPafK1Qw2xMd9zxoZ0r4vzZR2e/2tqXCUubo3mzDT4emPOsMLLtFmUK5xq
	0ELSRFC+nfHhsP8lFRWFHgtJTOROL7ND46mQsUdVQHB19Hy56TIu5F3IAyyak7pfPfvU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pmstat: correct get_cpufreq_para()'s error return value
Message-Id: <E1txmah-001YwY-2V@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 12:44:11 +0000

commit 855337ca4947508ffca23393e291c54b5307cc9a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 12:22:06 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 12:22:06 2025 +0100

    x86/pmstat: correct get_cpufreq_para()'s error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 7542c4ff00f2 ("Add user PM control interface")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/acpi/pmstat.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index aae94529ab..c51b9ca358 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -230,12 +230,12 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
 
     for ( i = 0; i < op->u.get_para.freq_num; i++ )
         data[i] = pmpt->perf.states[i].core_frequency * 1000;
-    ret = copy_to_guest(op->u.get_para.scaling_available_frequencies,
-                        data, op->u.get_para.freq_num) ?: ret;
+    ret += copy_to_guest(op->u.get_para.scaling_available_frequencies,
+                         data, op->u.get_para.freq_num);
 
     xfree(data);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     op->u.get_para.cpuinfo_cur_freq =
         cpufreq_driver.get ? alternative_call(cpufreq_driver.get, op->cpuid)
@@ -272,7 +272,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                             gov_num * CPUFREQ_NAME_LEN);
         xfree(scaling_available_governors);
         if ( ret )
-            return ret;
+            return -EFAULT;
 
         op->u.get_para.u.s.scaling_cur_freq = policy->cur;
         op->u.get_para.u.s.scaling_max_freq = policy->max;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 12:44:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 12:44:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929203.1331832 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txmas-0007O2-Ju; Thu, 27 Mar 2025 12:44:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929203.1331832; Thu, 27 Mar 2025 12:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txmas-0007Nu-HH; Thu, 27 Mar 2025 12:44:22 +0000
Received: by outflank-mailman (input) for mailman id 929203;
 Thu, 27 Mar 2025 12:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txmas-0007NZ-0G
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 12:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txmar-00Bn45-39
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 12:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txmar-001YxX-2p
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 12:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rbqtBd177/FUN2sCX15jpnj/btDiRMaj7FzTxCgn2XQ=; b=hwunFClLeu08QASKV5aPoKw568
	8EZ7JB1oODqbxyg0EllGAyFUlz+L4VeIZhEpUrVLjtG/2kUyn6Ou0GToos4JULFU7uaLT6XXHA91k
	w1dwqu21ssWZTbrsTp+KLYJSbSy9ypNjqaBlheVpZw+XavLAUXqOnXVm1nbd9ksSzFa8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
Message-Id: <E1txmar-001YxX-2p@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 12:44:21 +0000

commit 341c0df40bf73b0a5e27db27023ec400858a472d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 12:22:39 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 12:22:39 2025 +0100

    Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 86039f2e8c20 ("xen/arm: vpl011: Add a new domctl API to initialize vpl011")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/domctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index 9d047065ba..ad914c915f 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -172,8 +172,8 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
             break;
         }
 
-        if ( !rc )
-            rc = copy_to_guest(u_domctl, domctl, 1);
+        if ( !rc && copy_to_guest(u_domctl, domctl, 1) )
+            rc = -EFAULT;
 
         return rc;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 12:44:32 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 12:44:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929207.1331836 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txmb2-0007WH-Lf; Thu, 27 Mar 2025 12:44:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929207.1331836; Thu, 27 Mar 2025 12:44:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txmb2-0007W9-Il; Thu, 27 Mar 2025 12:44:32 +0000
Received: by outflank-mailman (input) for mailman id 929207;
 Thu, 27 Mar 2025 12:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txmb2-0007Vy-2u
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 12:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txmb2-00Bn4E-0C
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 12:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txmb2-001Yy5-06
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 12:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gb7BUmHEdpWsVOJhTaIVzdfO7XK+p0HG9otX8bOwKGs=; b=vvKLKR74MLDYV726bklSo/j46U
	EBO4elQqlxl0yjh6WMG5xDn3f5v/uhhxcbZDXTU+SxiUiBkb3nRTKC9QtQdw86LkmLlM76fWsoEV2
	57kGkNwTFp1E+Lq6Q+J4YeqV6dLmC8+fZKXskG7fwn7ES3Jgk9ur+/vmd6r0EMt5+vXg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: add H extension to -march
Message-Id: <E1txmb2-001Yy5-06@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 12:44:32 +0000

commit 2addc9f05130a9fb3aa65bd47ff314c47e7eaed4
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Mar 27 12:23:10 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 12:23:10 2025 +0100

    xen/riscv: add H extension to -march
    
    H provides additional instructions and CSRs that control the new stage of
    address translation and support hosting a guest OS in virtual S-mode
    (VS-mode).
    
    According to the Unprivileged Architecture (version 20240411) specification:
    ```
    Table 74 summarizes the standardized extension names. The table also defines
    the canonical order in which extension names must appear in the name string,
    with top-to-bottom in table indicating first-to-last in the name string, e.g.,
    RV32IMACV is legal, whereas RV32IMAVC is not.
    ```
    According to Table 74, the h extension is placed last in the one-letter
    extensions name part of the ISA string.
    
    `h` is a standalone extension based on the patch [1] but it wasn't so
    before.
    As the minimal supported GCC version to build Xen for RISC-V is 12.2.0,
    and for that version, h is still considered a prefix for the hypervisor
    extension but the name of hypervisor extension must be more then 1 letter
    extension, a workaround ( with using `hh` as an H extension name ) is
    implemented as otherwise the following compilation error will occur:
     error: '-march=rv64gc_h_zbb_zihintpause': name of hypervisor extension
            must be more than 1 letter
    
    After GCC version 13.1.0, the commit [1] introducing H extension support
    allows us to drop the workaround with `hh` as hypervisor extension name
    and use only one h in -march.
    
    [1] https://github.com/gcc-mirror/gcc/commit/0cd11d301013af50a3fae0694c909952e94e20d5#diff-d6f7db0db31bfb339b01bec450f1b905381eb4730cc5ab2b2794971e34647d64R148
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/riscv/booting.txt |  4 ++++
 xen/arch/riscv/arch.mk      | 11 +++++++++--
 xen/arch/riscv/cpufeature.c |  1 +
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/docs/misc/riscv/booting.txt b/docs/misc/riscv/booting.txt
index cb4d79f12c..3a8474a27d 100644
--- a/docs/misc/riscv/booting.txt
+++ b/docs/misc/riscv/booting.txt
@@ -3,6 +3,10 @@ System requirements
 
 The following extensions are expected to be supported by a system on which
 Xen is run:
+- H:
+  Provides additional instructions and CSRs that control the new stage of
+  address translation and support hosting a guest OS in virtual S-mode
+  (VS-mode).
 - Zbb:
   RISC-V doesn't have a CLZ instruction in the base ISA.
   As a consequence, __builtin_ffs() emits a library call to ffs() on GCC,
diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 236ea7c8a6..599544429f 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -9,7 +9,6 @@ riscv-abi-$(CONFIG_RISCV_64) := -mabi=lp64
 riscv-march-$(CONFIG_RISCV_64) := rv64
 riscv-march-y += ima
 riscv-march-$(CONFIG_RISCV_ISA_C) += c
-riscv-march-y += _zicsr_zifencei_zbb
 
 riscv-generic-flags := $(riscv-abi-y) -march=$(subst $(space),,$(riscv-march-y))
 
@@ -25,10 +24,18 @@ $(eval $(1) := \
 	$(call as-insn,$(CC) $(riscv-generic-flags)_$(1),$(value $(1)-insn),_$(1)))
 endef
 
+h-insn := "hfence.gvma"
+$(call check-extension,h)
+
+ifneq ($(h),_h)
+hh-insn := "hfence.gvma"
+$(call check-extension,hh)
+endif
+
 zihintpause-insn := "pause"
 $(call check-extension,zihintpause)
 
-extensions := $(zihintpause)
+extensions := $(h) $(hh) $(zihintpause) _zicsr_zifencei_zbb
 
 extensions := $(subst $(space),,$(extensions))
 
diff --git a/xen/arch/riscv/cpufeature.c b/xen/arch/riscv/cpufeature.c
index bf09aa1170..5aafab0f49 100644
--- a/xen/arch/riscv/cpufeature.c
+++ b/xen/arch/riscv/cpufeature.c
@@ -146,6 +146,7 @@ static const struct riscv_isa_ext_data __initconst required_extensions[] = {
 #ifdef CONFIG_RISCV_ISA_C
     RISCV_ISA_EXT_DATA(c),
 #endif
+    RISCV_ISA_EXT_DATA(h),
     RISCV_ISA_EXT_DATA(zicsr),
     RISCV_ISA_EXT_DATA(zifencei),
     RISCV_ISA_EXT_DATA(zihintpause),
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 13:44:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 13:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929331.1331940 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnWd-0001Y8-2X; Thu, 27 Mar 2025 13:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929331.1331940; Thu, 27 Mar 2025 13:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnWc-0001Y0-W8; Thu, 27 Mar 2025 13:44:02 +0000
Received: by outflank-mailman (input) for mailman id 929331;
 Thu, 27 Mar 2025 13:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnWc-0001Xu-57
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 13:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnWb-00BoTJ-2V
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 13:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnWb-001gaW-2C
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 13:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XyDpnxhC+N/QbOxKBskjDfby7Rz0dhFnYeSgDfUqUto=; b=pPU2vDT2/jpgdlom+VOWSZmtx0
	42Yxwaa92rK7NOtVCHitulT5v7nyb34wWuBufOOSg3xAqbabIBOJunJUAzdlAGUQAGyvEqwolLirD
	q8vVJmNN1J+08H8tRxpsOofoX5L0qqImRO1dyS1xmJ+s0I93UzydwNTCh7qyTGYnFyhk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM/vgic: Fix out-of-bounds accesses in vgic_mmio_write_sgir()
Message-Id: <E1txnWb-001gaW-2C@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 13:44:01 +0000

commit be7f0cc651d8d02a95820792204c0558f1f29e03
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Mar 26 15:26:56 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Mar 27 11:54:23 2025 +0000

    ARM/vgic: Fix out-of-bounds accesses in vgic_mmio_write_sgir()
    
    The switch() statement is over bits 24:25 (unshifted) of the guest provided
    value.  This makes case 0x3: dead, and not an implementation of the 4th
    possible state.
    
    A guest which writes (0x3 << 24) | (0xff << 16) to this register will skip the
    early exit, then enter bitmap_for_each() with targets not bound by nr_vcpus.
    
    If the guest has fewer than 8 vCPUs, bitmap_for_each() will read off the end
    of d->vcpu[] and use the resulting vcpu pointer to ultimately derive irq, and
    perform out-of-bounds writes.
    
    Fix this by changing case 0x3 to default.
    
    Fixes: 08c688ca6422 ("ARM: new VGIC: Add SGIR register handler")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/vgic/vgic-mmio-v2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/vgic/vgic-mmio-v2.c b/xen/arch/arm/vgic/vgic-mmio-v2.c
index 670b335db2..7d1391ac9b 100644
--- a/xen/arch/arm/vgic/vgic-mmio-v2.c
+++ b/xen/arch/arm/vgic/vgic-mmio-v2.c
@@ -104,7 +104,8 @@ static void vgic_mmio_write_sgir(struct vcpu *source_vcpu,
     case GICD_SGI_TARGET_SELF:                    /* this very vCPU only */
         targets = (1U << source_vcpu->vcpu_id);
         break;
-    case 0x3:                                     /* reserved */
+
+    default:
         return;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 13:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 13:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929332.1331944 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnWn-0001aK-5J; Thu, 27 Mar 2025 13:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929332.1331944; Thu, 27 Mar 2025 13:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnWn-0001aA-2e; Thu, 27 Mar 2025 13:44:13 +0000
Received: by outflank-mailman (input) for mailman id 929332;
 Thu, 27 Mar 2025 13:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnWl-0001Zx-Um
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 13:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnWl-00BoTN-2y
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 13:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnWl-001gbX-2g
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 13:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nRDWXOHkkbNzc/qtaPZKa+WITz2QCXY1fWf8eKcQtWc=; b=mvVA1QgSj3ezQjHGu7lVRDBG+d
	sIqrViWXSph9pNiOo9OyhghAmNhhDmTD/sgCtIOoj6QT2r3q7TtescrsLBpn7+Pz6RTAc6JTGfLne
	5OLXTlOKTIRyKCCK+RRZqn3mYJl4PLdETropJL8/ATjzJIrPheCtuugfzpD/u2T8o0so=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM/vgic: Use for_each_set_bit() in vgic_mmio_write_sgir()
Message-Id: <E1txnWl-001gbX-2g@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 13:44:11 +0000

commit eeb679da8f8d5d96948315ce30e4d750be6a1f51
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 30 14:25:28 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Mar 27 11:54:23 2025 +0000

    ARM/vgic: Use for_each_set_bit() in vgic_mmio_write_sgir()
    
    The bitmap_for_each() expression only inspects the bottom 8 bits of targets.
    Change it's type to uint8_t and use for_each_set_bit() which is more efficient
    over scalars.
    
    GICD_SGI_TARGET_LIST_MASK is 2 bits wide.  Two cases discard the prior
    calculation of targets, and one case exits early.
    
    Therefore, move the GICD_SGI_TARGET_MASK calculation into the only case which
    wants it, and use MASK_EXTR() to simplify the expression.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/vgic/vgic-mmio-v2.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/vgic/vgic-mmio-v2.c b/xen/arch/arm/vgic/vgic-mmio-v2.c
index 7d1391ac9b..b7c2d7ce99 100644
--- a/xen/arch/arm/vgic/vgic-mmio-v2.c
+++ b/xen/arch/arm/vgic/vgic-mmio-v2.c
@@ -88,13 +88,12 @@ static void vgic_mmio_write_sgir(struct vcpu *source_vcpu,
     struct domain *d = source_vcpu->domain;
     unsigned int nr_vcpus = d->max_vcpus;
     unsigned int intid = val & GICD_SGI_INTID_MASK;
-    unsigned long targets = (val & GICD_SGI_TARGET_MASK) >>
-                            GICD_SGI_TARGET_SHIFT;
-    unsigned int vcpu_id;
+    uint8_t targets = 0;
 
     switch ( val & GICD_SGI_TARGET_LIST_MASK )
     {
     case GICD_SGI_TARGET_LIST:                    /* as specified by targets */
+        targets = MASK_EXTR(val, GICD_SGI_TARGET_MASK);
         targets &= GENMASK(nr_vcpus - 1, 0);      /* limit to existing VCPUs */
         break;
     case GICD_SGI_TARGET_OTHERS:
@@ -109,7 +108,7 @@ static void vgic_mmio_write_sgir(struct vcpu *source_vcpu,
         return;
     }
 
-    bitmap_for_each ( vcpu_id, &targets, 8 )
+    for_each_set_bit ( vcpu_id, targets )
     {
         struct vcpu *vcpu = d->vcpu[vcpu_id];
         struct vgic_irq *irq = vgic_get_irq(d, vcpu, intid);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:11:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929364.1331968 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnwl-00089b-Be; Thu, 27 Mar 2025 14:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929364.1331968; Thu, 27 Mar 2025 14:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnwl-00089T-8y; Thu, 27 Mar 2025 14:11:03 +0000
Received: by outflank-mailman (input) for mailman id 929364;
 Thu, 27 Mar 2025 14:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnwk-00088r-A1
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnwk-00BpGk-0Z
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnwk-001jbx-0M
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ioobqm/nya+CqWmYiLrkrLoMbcNi8138wPZmIwWExBc=; b=wru+o90Ev/3l1nr1rzaS5gc53n
	6WhtZXqjNc9nLKilkS+z0CP4N/TSB6M+su6TPnkSZugfMkwQEGdjeCwK3PCQAtFa3ne8DdZ0ieSpP
	0DQf+yYODgx5wQf2zC6IjB70R8krZ69ED3ltE+hGqajkcZKY4T9sdP8cAA2e3j/C+ShU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/mkelf32: account for offset when detecting note segment placement
Message-Id: <E1txnwk-001jbx-0M@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:11:02 +0000

commit 8c788b41d7a8fa378f4d8b639955f01bb571809f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 14:55:29 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:55:29 2025 +0100

    x86/mkelf32: account for offset when detecting note segment placement
    
    mkelf32 attempt to check that the program header defined NOTE segment falls
    inside of the LOAD segment, as the build-id should be loaded for Xen at
    runtime to check.
    
    However the current code doesn't take into account the LOAD program header
    segment offset when calculating overlap with the NOTE segment.  This
    results in incorrect detection, and the following build error:
    
    arch/x86/boot/mkelf32 --notes xen-syms ./.xen.elf32 0x200000 \
                   `nm xen-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$/0x\1/p'`
    Expected .note section within .text section!
    Offset 4244776 not within 2910364!
    
    When xen-syms has the following program headers:
    
    Program Header:
        LOAD off    0x0000000000200000 vaddr 0xffff82d040200000 paddr 0x0000000000200000 align 2**21
             filesz 0x00000000002c689c memsz 0x00000000003f7e20 flags rwx
        NOTE off    0x000000000040c528 vaddr 0xffff82d04040c528 paddr 0x000000000040c528 align 2**2
             filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
    
    Account for the program header offset of the LOAD segment when checking
    whether the NOTE segments is contained within.  Also fix the logic to
    ensure the NOTE segments is fully contained between the LOAD segment.
    
    Fixes: a353cab905af ('build_id: Provide ld-embedded build-ids')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6e5fed7cb67c9f84653cdbd3924b8a119ef653be
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/boot/mkelf32.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 5f9e7e440e..f0f406687c 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -358,11 +358,13 @@ int main(int argc, char **argv)
         note_sz = in64_phdr.p_memsz;
         note_base = in64_phdr.p_vaddr - note_base;
 
-        if ( in64_phdr.p_offset > dat_siz || offset > in64_phdr.p_offset )
+        if ( in64_phdr.p_offset < offset ||
+             in64_phdr.p_offset + in64_phdr.p_filesz > offset + dat_siz )
         {
             fprintf(stderr, "Expected .note section within .text section!\n" \
-                    "Offset %"PRId64" not within %d!\n",
-                    in64_phdr.p_offset, dat_siz);
+                    ".note: [%"PRIx64", %"PRIx64") .text: [%x, %x)\n",
+                    in64_phdr.p_offset, in64_phdr.p_offset + in64_phdr.p_filesz,
+                    offset, offset + dat_siz);
             return 1;
         }
         /* Gets us the absolute offset within the .text section. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929370.1331972 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnwv-0000J1-Da; Thu, 27 Mar 2025 14:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929370.1331972; Thu, 27 Mar 2025 14:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnwv-0000Ic-AW; Thu, 27 Mar 2025 14:11:13 +0000
Received: by outflank-mailman (input) for mailman id 929370;
 Thu, 27 Mar 2025 14:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnwu-0000FI-9j
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnwu-00BpGo-0s
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnwu-001jdX-0l
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DWSVzF0R1KLu+1cQY74htox0HQfqvYK5Zi3s59yfxAI=; b=au+cLXJnijS5teJhbLB4HNwmd8
	+hWMSHdfEJYoGmnh5vB7bYTvXHEQMVVPnBdlDFBCLm2t2pdbH09x2yP6QP5uM2kvVyvA2JQ9sxOjl
	VkOL7t57YQ6RFV9SmC/KFac2B8zGBHs7SI9lLFLEJASy3Z49IuBivBsCc8nnMqbl23cM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
Message-Id: <E1txnwu-001jdX-0l@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:11:12 +0000

commit fbb06cfa739052ee243dc875e2641343b3fc029c
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 14:55:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:55:57 2025 +0100

    x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in arch/x86/mm/shadow/private.h:515:30
    pointer operation overflowed ffff82e000000000 to ffff82dfffffffe0
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d040471b2d>] F arch/x86/mm/shadow/guest_2.c#sh_page_fault__guest_2+0x1e350
        [<ffff82d0403b206b>] F svm_vmexit_handler+0xdf3/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Fix by moving the call to mfn_to_page() after the check of whether the
    passed gmfn is valid.  This avoid the call to mfn_to_page() with an
    INVALID_MFN parameter.
    
    While there make the page local variable const, it's not modified by the
    function.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 45ee73f1b24246f13cd9583cb2ee25fb9c782db8
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/mm/shadow/private.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index a5fc3a7676..cef9dbef2e 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -512,13 +512,14 @@ static inline unsigned long __backpointer(const struct page_info *sp)
 static inline int
 sh_mfn_is_a_page_table(mfn_t gmfn)
 {
-    struct page_info *page = mfn_to_page(gmfn);
+    const struct page_info *page;
     struct domain *owner;
     unsigned long type_info;
 
     if ( !mfn_valid(gmfn) )
         return 0;
 
+    page = mfn_to_page(gmfn);
     owner = page_get_owner(page);
     if ( owner && shadow_mode_refcounts(owner)
          && (page->count_info & PGC_shadowed_pt) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929374.1331976 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnx5-0000pB-EY; Thu, 27 Mar 2025 14:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929374.1331976; Thu, 27 Mar 2025 14:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnx5-0000p3-Bx; Thu, 27 Mar 2025 14:11:23 +0000
Received: by outflank-mailman (input) for mailman id 929374;
 Thu, 27 Mar 2025 14:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnx4-0000nk-D0
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnx4-00BpH8-1C
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnx4-001jeJ-13
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HfKUw7AYRPPDEgqsfCkE6pmzjzDbfxsUXAlLmtFPCeA=; b=xrN/thDhvCZvvXiSyS+kYZ7upS
	ob+DBYJQouKUV1F0YbRrQbl33w2EzXznajwVPkTa0e5nCnHaWp39AJtubeEFHil9IQvsSFUA9JvXM
	3RmShuoFGgU9vJdTNGiLTXwIUzChuKt4Ctcg26PZnA4ilF14NxVFOO6r8+Nz2ZPNp428=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
Message-Id: <E1txnx4-001jeJ-13@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:11:22 +0000

commit da36efa8521a2ba3cd8b63105fe92324776953f6
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 14:56:22 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:56:22 2025 +0100

    x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in common/compat/memory.c:90:9
    pointer operation overflowed ffff820080000000 to 0000020080000000
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0402a6259>] F compat_memory_op+0xf1/0x4d20
        [<ffff82d04041532d>] F hvm_memory_op+0x55/0xe0
        [<ffff82d040416150>] F hvm_hypercall+0xae8/0x21b0
        [<ffff82d0403b24ca>] F svm_vmexit_handler+0x1252/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Adjust the calculations in COMPAT_ARG_XLAT_VIRT_BASE to subtract from the
    per-domain area to obtain the mirrored linear address in the 4th slot,
    instead of overflowing the per-domain linear address.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: fc302866f42f552337ae7d8d78877aec36e6e2ff
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/include/asm/x86_64/uaccess.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/x86_64/uaccess.h b/xen/arch/x86/include/asm/x86_64/uaccess.h
index c6fa3fd381..9f515b2638 100644
--- a/xen/arch/x86/include/asm/x86_64/uaccess.h
+++ b/xen/arch/x86/include/asm/x86_64/uaccess.h
@@ -9,9 +9,9 @@
  * a secondary mapping installed, which needs to be used for such accesses in
  * the PV case, and will also be used for HVM to avoid extra conditionals.
  */
-#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) + \
-                                   (PERDOMAIN_ALT_VIRT_START - \
-                                    PERDOMAIN_VIRT_START))
+#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) - \
+                                   PERDOMAIN_VIRT_START + \
+                                   PERDOMAIN_ALT_VIRT_START)
 #define COMPAT_ARG_XLAT_SIZE      (2*PAGE_SIZE)
 struct vcpu;
 int setup_compat_arg_xlat(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:11:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929376.1331980 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnxG-0000ts-Ft; Thu, 27 Mar 2025 14:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929376.1331980; Thu, 27 Mar 2025 14:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnxG-0000tk-DM; Thu, 27 Mar 2025 14:11:34 +0000
Received: by outflank-mailman (input) for mailman id 929376;
 Thu, 27 Mar 2025 14:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnxE-0000tL-Gg
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnxE-00BpHF-1Z
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnxE-001jfF-1N
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vTlbbfWwb89qXNsS5d4Ih/aY0R5NWTCLsxmHNIE6F/g=; b=T/KRf3Df+QMD9QVgDYv16XT68M
	LXj2Taa1ExcRvNBWle6JSBZBUystHyI20iEWqrJEm0briLtpYxmLzgN9xZ32gT4b70Bt862KDsO9S
	RF1IAOeQw577cyWSZLqEAXCLDgBbc7PIAaXoQW9/K2vxZpCd1Lu2I6D48h0Xg6edKToo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/vga: fix mapping of the VGA text buffer
Message-Id: <E1txnxE-001jfF-1N@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:11:32 +0000

commit de440d0407d2a5b9f60333adb548eceb4b74d626
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 14:56:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:56:57 2025 +0100

    x86/vga: fix mapping of the VGA text buffer
    
    The call to ioremap_wc() in video_init() will always fail, because
    video_init() is called ahead of vm_init_type(), and so the underlying
    __vmap() call will fail to allocate the linear address space.
    
    Fix by reverting to the previous behavior and use __va() for the VGA text
    buffer, as it's below the 1MB boundary, and thus always mapped in the
    directmap.
    
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1ca5f69e35548e5196eadb329e5a3976821dc982
    master date: 2025-03-20 17:16:10 +0100
---
 xen/drivers/video/vga.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/drivers/video/vga.c b/xen/drivers/video/vga.c
index b4d0183261..b577b24619 100644
--- a/xen/drivers/video/vga.c
+++ b/xen/drivers/video/vga.c
@@ -71,7 +71,7 @@ void __init video_init(void)
     {
     case XEN_VGATYPE_TEXT_MODE_3:
         if ( page_is_ram_type(paddr_to_pfn(0xB8000), RAM_TYPE_CONVENTIONAL) ||
-             ((video = ioremap_wc(0xB8000, 0x8000)) == NULL) )
+             ((video = __va(0xB8000)) == NULL) )
             return;
         outw(0x200a, 0x3d4); /* disable cursor */
         columns = vga_console_info.u.text_mode_3.columns;
@@ -158,7 +158,6 @@ void __init video_endboot(void)
         if ( !vgacon_keep )
         {
             memset(video, 0, columns * lines * 2);
-            iounmap(video);
             video = ZERO_BLOCK_PTR;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:11:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929377.1331986 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnxQ-0000wU-IL; Thu, 27 Mar 2025 14:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929377.1331986; Thu, 27 Mar 2025 14:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnxQ-0000wJ-Eo; Thu, 27 Mar 2025 14:11:44 +0000
Received: by outflank-mailman (input) for mailman id 929377;
 Thu, 27 Mar 2025 14:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnxO-0000w0-JI
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnxO-00BpHJ-1p
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnxO-001jg7-1k
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=St99LiwxDpwft+LGiKbSWfBng3zI0rxFpa6sGxfD250=; b=617qCkyHqmRr8GH1E0d7i08w0P
	FYysj7fqianaf741KffQEHMEQ74on2X/xkAsMmRIXe/9YQmYev6uvAvHICCXZ8Pdx/9EZfvYikKwK
	ECthpR7fLuHDkntulOmLvcYuIPaOd6kH7FW0b7uLQW/6q76AgptBOXAUauxd5p79nvyw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] xen/compiler: Fix the position of the visibility pragma
Message-Id: <E1txnxO-001jg7-1k@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:11:42 +0000

commit 859e2c4f846654e7966a2305fa17811a5d072c76
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 14:57:31 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:57:31 2025 +0100

    xen/compiler: Fix the position of the visibility pragma
    
    This needs to be ahead of everything.  Right now, it is after xen/init.h being
    included for -DINIT_SECTIONS_ONLY
    
      # 1 "./include/xen/compiler.h" 1
      # 83 "./include/xen/compiler.h"
      # 1 "./include/xen/init.h" 1
      # 62 "./include/xen/init.h"
      typedef int (*initcall_t)(void);
      typedef void (*exitcall_t)(void);
      # 72 "./include/xen/init.h"
      void do_presmp_initcalls(void);
      void do_initcalls(void);
      # 84 "./include/xen/compiler.h" 2
      # 122 "./include/xen/compiler.h"
      #pragma GCC visibility push(hidden)
    
    Fixes: 84c4461b7d3a ("Force out-of-line instances of inline functions into .init.text in init-only code")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: ab7ce0c8ed90f729a186babd87e3cd1fbed8ab98
    master date: 2025-03-21 11:52:39 +0000
---
 xen/include/xen/compiler.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index b118e4ba62..636a85bc41 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -15,6 +15,11 @@
 # endif
 #endif
 
+#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
+/* Results in more efficient PIC code (no indirections through GOT or PLT). */
+#pragma GCC visibility push(hidden)
+#endif
+
 #define barrier()     __asm__ __volatile__("": : :"memory")
 
 #define likely(x)     __builtin_expect(!!(x),1)
@@ -118,11 +123,6 @@
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
 
-#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
-/* Results in more efficient PIC code (no indirections through GOT or PLT). */
-#pragma GCC visibility push(hidden)
-#endif
-
 /* Make the optimizer believe the variable can be manipulated arbitrarily. */
 #define OPTIMIZER_HIDE_VAR(var) __asm__ ( "" : "+g" (var) )
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:11:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929378.1331988 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnxa-0000zN-Iv; Thu, 27 Mar 2025 14:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929378.1331988; Thu, 27 Mar 2025 14:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnxa-0000zF-GE; Thu, 27 Mar 2025 14:11:54 +0000
Received: by outflank-mailman (input) for mailman id 929378;
 Thu, 27 Mar 2025 14:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnxY-0000yo-Ma
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnxY-00BpHP-29
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnxY-001jhq-20
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qnUuThMV3wvdcrqeSXEeZBrp/whCDPXeu0a5shVFy0A=; b=pDTrXwTw6BtpYnC+f23vMj3LmU
	kQNs87k7aHLQGhFQGlpsToLOEtjLa43OpuV7eDuo3IXAlAyWhifaRNbkcywjaPY/yStv3EJGIItbm
	6ktn7obwQqn63gORHR+mVzbsOZ3zLxE721IZGsWSpd/NvdjZq7zjJLl7W94anRuwb62c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/boot: Simplify the expression for extra allocation space
Message-Id: <E1txnxY-001jhq-20@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:11:52 +0000

commit 92afeb2961f03a514a7ae6e7c08818f6cdc0aa59
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 14:57:55 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:57:55 2025 +0100

    x86/boot: Simplify the expression for extra allocation space
    
    The expression for one parameter of find_memory() is already complicated and
    about to become moreso.  Break it out into a new variable, and express it in
    an easier-to-follow way.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: ce703c84df1cb279605b0a85a45c6419464a16e8
    master date: 2025-03-21 11:52:39 +0000
---
 xen/arch/x86/hvm/dom0_build.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 6a4453103a..6591949984 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -654,6 +654,7 @@ static int __init pvh_load_kernel(
     const char *cmdline = image->cmdline_pa ? __va(image->cmdline_pa) : NULL;
     struct elf_binary elf;
     struct elf_dom_parms parms;
+    size_t extra_space;
     paddr_t last_addr;
     struct hvm_start_info start_info = { 0 };
     struct hvm_modlist_entry mod = { 0 };
@@ -711,13 +712,16 @@ static int __init pvh_load_kernel(
      * split into smaller allocations, done as a single region in order to
      * simplify it.
      */
-    last_addr = find_memory(d, &elf, sizeof(start_info) +
-                            (initrd ? ROUNDUP(initrd_len, PAGE_SIZE) +
-                                      sizeof(mod)
-                                    : 0) +
-                            (cmdline ? ROUNDUP(strlen(cmdline) + 1,
-                                               elf_64bit(&elf) ? 8 : 4)
-                                     : 0));
+    extra_space = sizeof(start_info);
+
+    if ( initrd )
+        extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
+
+    if ( cmdline )
+        extra_space += ROUNDUP(strlen(cmdline) + 1,
+                               elf_64bit(&elf) ? 8 : 4);
+
+    last_addr = find_memory(d, &elf, extra_space);
     if ( last_addr == INVALID_PADDR )
     {
         printk("Unable to find a memory region to load initrd and metadata\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:12:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929379.1331992 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnxk-000139-MA; Thu, 27 Mar 2025 14:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929379.1331992; Thu, 27 Mar 2025 14:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnxk-00012w-JQ; Thu, 27 Mar 2025 14:12:04 +0000
Received: by outflank-mailman (input) for mailman id 929379;
 Thu, 27 Mar 2025 14:12:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnxi-00012e-PR
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnxi-00BpHm-2Q
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnxi-001jlf-2K
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QrMzspJQJSQaKZ0PmxWCSnIquwBipvOLf72FPU5XwZY=; b=OPeUd143A/lAiVX6vKufuLcvQ/
	1j2Vw4H1Fe/+VZCdhdxUcWZuLjq+Q2ECwzGmJTLAiMsCnk5IsAzAYeOwiBfZ7yJhxcaQvakntGrxX
	Svvd8FCznAPBtA9kjwvnyK9PaMMaGtSjvUubria0FOXYWsLSVpFPxNFo9zXIBbj7EpOg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
Message-Id: <E1txnxi-001jlf-2K@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:12:02 +0000

commit fcbd016bd24c8d0ce14447db90352904cabe3688
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 14:58:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:58:51 2025 +0100

    xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
    
    malloc(), when passed zero size, may return NULL (the behavior is
    implementation defined). Mirror the ->gov_num check to the other two
    allocations as well. Don't chance then actually using a NULL in
    print_cpufreq_para().
    
    Fixes: 75e06d089d48 ("xenpm: add cpu frequency control interface, through which user can")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: 6c0dc87bb0e08fb31a68bf4c4149a18b92628f14
    master date: 2025-03-26 12:30:57 +0100
---
 tools/misc/xenpm.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index 336d246346..db658ebadd 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -840,8 +840,9 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
     }
     else
     {
-        printf("scaling_avail_gov    : %s\n",
-               p_cpufreq->scaling_available_governors);
+        if ( p_cpufreq->gov_num )
+            printf("scaling_avail_gov    : %s\n",
+                   p_cpufreq->scaling_available_governors);
 
         printf("current_governor     : %s\n", p_cpufreq->u.s.scaling_governor);
         if ( !strncmp(p_cpufreq->u.s.scaling_governor,
@@ -907,7 +908,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
         p_cpufreq->scaling_available_frequencies = NULL;
         p_cpufreq->scaling_available_governors = NULL;
 
-        if (!(p_cpufreq->affected_cpus =
+        if (p_cpufreq->cpu_num &&
+            !(p_cpufreq->affected_cpus =
               malloc(p_cpufreq->cpu_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
@@ -916,7 +918,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
             ret = -ENOMEM;
             goto out;
         }
-        if (!(p_cpufreq->scaling_available_frequencies =
+        if (p_cpufreq->freq_num &&
+            !(p_cpufreq->scaling_available_frequencies =
               malloc(p_cpufreq->freq_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:12:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929380.1331995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnxu-000162-NR; Thu, 27 Mar 2025 14:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929380.1331995; Thu, 27 Mar 2025 14:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnxu-00015u-Kr; Thu, 27 Mar 2025 14:12:14 +0000
Received: by outflank-mailman (input) for mailman id 929380;
 Thu, 27 Mar 2025 14:12:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnxs-00015f-S3
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:12:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnxs-00BpIJ-2h
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnxs-001jmc-2c
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Xjln9I96BwD5uwV3/Wd5r6SQK+pD8P1cNTrp+c5E7Qk=; b=ael8/rVPqsCGd31CommALAXiHc
	3PXMR4n2iRKMf+SLaRYsbVvW8nUCLVTOYJifMwWfwvKTC7/BNxMv8cwVlAx2nzRP1C9yHsrHbVH+b
	HTQf6KGE+9gf4ezT4oRJcQntFUq7scTieEt9FRpE4/WGTbbT1i66ohYEzxb6T+IH4xpU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/PVH: expose OEMx ACPI tables to Dom0
Message-Id: <E1txnxs-001jmc-2c@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:12:12 +0000

commit a1f8f1e6818848e1112e7835cdc4696131f8f0dd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 14:58:59 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:58:59 2025 +0100

    x86/PVH: expose OEMx ACPI tables to Dom0
    
    What they contain we don't know, but we can't sensibly hide them. On my
    Skylake system OEM1 (with a description of "INTEL  CPU EIST") is what
    contains all the _PCT, _PPC, and _PSS methods, i.e. about everything
    needed for cpufreq. (_PSD interestingly are in an SSDT there.)
    
    Further OEM2 there has a description of "INTEL  CPU  HWP", while OEM4
    has "INTEL  CPU  CST". Pretty clearly all three need exposing for
    cpufreq and cpuidle to work.
    
    Fixes: 8b1a5268daf0 ("pvh/dom0: whitelist PVH Dom0 ACPI tables")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 6378909b41c40187a79df1d38ca4791b34393d67
    master date: 2025-03-26 12:32:03 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 6591949984..60c56e126d 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1011,12 +1011,20 @@ static bool __init pvh_acpi_table_allowed(const char *sig,
             return true;
         else
         {
+    skip:
             printk("Skipping table %.4s in non-ACPI non-reserved region\n",
                    sig);
             return false;
         }
     }
 
+    if ( !strncmp(sig, "OEM", 3) )
+    {
+        if ( acpi_memory_banned(address, size) )
+            goto skip;
+        return true;
+    }
+
     return false;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:12:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929381.1332000 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txny4-00018Y-Ov; Thu, 27 Mar 2025 14:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929381.1332000; Thu, 27 Mar 2025 14:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txny4-00018O-MF; Thu, 27 Mar 2025 14:12:24 +0000
Received: by outflank-mailman (input) for mailman id 929381;
 Thu, 27 Mar 2025 14:12:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txny2-00018F-Uc
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:12:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txny2-00BpIU-2y
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txny2-001jnH-2s
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:12:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KHB1gyaXc+9lPUVA2LVLxwx7wA/S77o85PGGskCw+D0=; b=TklOlFTgLTabT4KKDoAMIr9oWq
	dz086kB4aW+uTR4jdPKuPXJO7oG3oQToaP1ga2l61AyqkiS3j9A9KBwMeyyB46QBZxsd314JMMiXQ
	/P8GHhyZOOMSF3uAytVSphaNKzUCT/0fKRrTTK0bmxWghdhnxIdDlAlrpXDNkra9G5iA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
Message-Id: <E1txny2-001jnH-2s@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:12:22 +0000

commit 990a3d8710ec7d2270ac65cc073b82f8f2925d4f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 14:59:36 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:59:36 2025 +0100

    x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
    
    In hvmemul_read_cr(), make the TRACE()/X86EMUL_OKAY path common in preparation
    for adding a %cr8 case.  Use a local 'val' variable instead of always
    operating on a deferenced pointer.
    
    In both, calculate curr once.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b7264a15c28d30bb994ec9e58eba38932be231ec
    master date: 2025-03-26 11:54:59 +0000
---
 xen/arch/x86/hvm/emulate.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 3cd7f2e22f..02698e93a1 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2293,23 +2293,30 @@ static int cf_check hvmemul_write_io(
 
 static int cf_check hvmemul_read_cr(
     unsigned int reg,
-    unsigned long *val,
+    unsigned long *pval,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
+    unsigned long val;
+
     switch ( reg )
     {
     case 0:
     case 2:
     case 3:
     case 4:
-        *val = current->arch.hvm.guest_cr[reg];
-        TRACE(TRC_HVM_CR_READ64, reg, *val, *val >> 32);
-        return X86EMUL_OKAY;
-    default:
+        val = curr->arch.hvm.guest_cr[reg];
         break;
+
+    default:
+        return X86EMUL_UNHANDLEABLE;
     }
 
-    return X86EMUL_UNHANDLEABLE;
+    TRACE(TRC_HVM_CR_READ64, reg, val, val >> 32);
+
+    *pval = val;
+
+    return X86EMUL_OKAY;
 }
 
 static int cf_check hvmemul_write_cr(
@@ -2317,6 +2324,7 @@ static int cf_check hvmemul_write_cr(
     unsigned long val,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
     int rc;
 
     TRACE(TRC_HVM_CR_WRITE64, reg, val, val >> 32);
@@ -2327,13 +2335,13 @@ static int cf_check hvmemul_write_cr(
         break;
 
     case 2:
-        current->arch.hvm.guest_cr[2] = val;
+        curr->arch.hvm.guest_cr[2] = val;
         rc = X86EMUL_OKAY;
         break;
 
     case 3:
     {
-        bool noflush = hvm_pcid_enabled(current) && (val & X86_CR3_NOFLUSH);
+        bool noflush = hvm_pcid_enabled(curr) && (val & X86_CR3_NOFLUSH);
 
         if ( noflush )
             val &= ~X86_CR3_NOFLUSH;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:12:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929382.1332003 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnyE-0001B5-QH; Thu, 27 Mar 2025 14:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929382.1332003; Thu, 27 Mar 2025 14:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnyE-0001Ax-Nd; Thu, 27 Mar 2025 14:12:34 +0000
Received: by outflank-mailman (input) for mailman id 929382;
 Thu, 27 Mar 2025 14:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnyD-0001Ah-1J
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnyD-00BpId-01
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnyC-001joo-39
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:12:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YV7o5VkUT9euf2d/1VxvLTkb/N07J6oYGiaRmyBNu9Y=; b=Wy1E08GOsTIVi/t+H/bOwRlPEW
	BtDPzuaKbF7eo98mt+a24uzswW8VL3H3XcHqHzeGx7BQLP16JcP2emXx+o8MQsH7bfoCmSpjoDCb8
	ueFGGVQZdvT4FRMStxxHUl/1Qrim1HLvt/thTz0XEER0QSwzmktJy/6xz5JewF+03orU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/emul: Emulate %cr8 accesses
Message-Id: <E1txnyC-001joo-39@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:12:32 +0000

commit f14c523da1eeba708d93b8a65b88efdd94f2984e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 14:59:58 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:59:58 2025 +0100

    x86/emul: Emulate %cr8 accesses
    
    Petr reports:
    
      (XEN) MMIO emulation failed (1): d12v1 64bit @ 0010:fffff8057ba7dfbf -> 45 0f 20 c2 ...
    
    during introspection.
    
    This is MOV %cr8, which is wired up for hvm_mov_{to,from}_cr(); the VMExit
    fastpaths, but not for the full emulation slowpaths.
    
    Xen's handling of %cr8 turns out to be quite wrong.  At a minimum, we need
    storage for %cr8 separate to APIC_TPR, and to alter intercepts based on
    whether the vLAPIC is enabled or not.  But that's more work than there is time
    for in the short term, so make a stopgap fix.
    
    Extend hvmemul_{read,write}_cr() with %cr8 cases.  Unlike hvm_mov_to_cr(),
    hardware hasn't filtered out invalid values (#GP checks are ahead of
    intercepts), so introduce X86_CR8_VALID_MASK.
    
    Reported-by: Petr Beneš <w1benny@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 14fd9b5642cd4805b49fbe716bf2cd577e724169
    master date: 2025-03-26 11:54:59 +0000
---
 xen/arch/x86/hvm/emulate.c           | 15 +++++++++++++++
 xen/arch/x86/include/asm/x86-defns.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 02698e93a1..23e436d7db 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2308,6 +2308,10 @@ static int cf_check hvmemul_read_cr(
         val = curr->arch.hvm.guest_cr[reg];
         break;
 
+    case 8:
+        val = (vlapic_get_reg(vcpu_vlapic(curr), APIC_TASKPRI) & 0xf0) >> 4;
+        break;
+
     default:
         return X86EMUL_UNHANDLEABLE;
     }
@@ -2353,6 +2357,17 @@ static int cf_check hvmemul_write_cr(
         rc = hvm_set_cr4(val, true);
         break;
 
+    case 8:
+        if ( val & ~X86_CR8_VALID_MASK )
+        {
+            rc = X86EMUL_EXCEPTION;
+            break;
+        }
+
+        vlapic_set_reg(vcpu_vlapic(curr), APIC_TASKPRI, val << 4);
+        rc = X86EMUL_OKAY;
+        break;
+
     default:
         rc = X86EMUL_UNHANDLEABLE;
         break;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 2493ec277f..8afa9826a3 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -76,6 +76,8 @@
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
 
+#define X86_CR8_VALID_MASK 0xf
+
 /*
  * XSTATE component flags in XCR0 | MSR_XSS
  */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:12:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929384.1332017 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnyO-0001UO-3D; Thu, 27 Mar 2025 14:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929384.1332017; Thu, 27 Mar 2025 14:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnyO-0001UG-0M; Thu, 27 Mar 2025 14:12:44 +0000
Received: by outflank-mailman (input) for mailman id 929384;
 Thu, 27 Mar 2025 14:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnyN-0001To-3f
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnyN-00BpIn-0H
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnyN-001jrr-0C
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yPdYVe21OPHxGqijc64W7n4pC7PUc/OeJN0QVI40TkY=; b=RwtdODBVTVm5gEq/IquDBu9XTg
	CpVvmKkT2CUWIdWdiuyqlWQuBf03li2CoDn3HL+ek+nDhQD//6moz1m7Sgk2KQq16HRAkTizNDKHJ
	bpnm4zTWZkv6yLRGeMkuHfBbk7vYMkCOitmHbdRVHL3dY+qODAW99XkchlFon4lNM/pk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/PVH: account for module command line length
Message-Id: <E1txnyN-001jrr-0C@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:12:43 +0000

commit 108fcc6a73022b242d08faa625e744aa9dbd11d5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:00:36 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:00:36 2025 +0100

    x86/PVH: account for module command line length
    
    As per observation in practice, initrd->cmdline_pa is not normally zero.
    Hence so far we always appended at least one byte. That alone may
    already render insufficient the "allocation" made by find_memory().
    Things would be worse when there's actually a (perhaps long) command
    line.
    
    Skip setup when the command line is empty. Amend the "allocation" size
    by padding and actual size of module command line. Along these lines
    also skip initrd setup when the initrd is zero size.
    
    Fixes: 0ecb8eb09f9f ("x86/pvh: pass module command line to dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: 989584e532c9517a0f789e993f5f6744beaebe3e
    master date: 2025-03-27 12:21:08 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 60c56e126d..7551cbe167 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -652,6 +652,7 @@ static int __init pvh_load_kernel(
     unsigned long image_len = image->size;
     unsigned long initrd_len = initrd ? initrd->size : 0;
     const char *cmdline = image->cmdline_pa ? __va(image->cmdline_pa) : NULL;
+    const char *initrd_cmdline = NULL;
     struct elf_binary elf;
     struct elf_dom_parms parms;
     size_t extra_space;
@@ -715,7 +716,23 @@ static int __init pvh_load_kernel(
     extra_space = sizeof(start_info);
 
     if ( initrd )
-        extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
+    {
+        size_t initrd_space = elf_round_up(&elf, initrd_len);
+
+        if ( initrd->cmdline_pa )
+        {
+            initrd_cmdline = __va(initrd->cmdline_pa);
+            if ( !*initrd_cmdline )
+                initrd_cmdline = NULL;
+        }
+        if ( initrd_cmdline )
+            initrd_space += strlen(initrd_cmdline) + 1;
+
+        if ( initrd_space )
+            extra_space += ROUNDUP(initrd_space, PAGE_SIZE) + sizeof(mod);
+        else
+            initrd = NULL;
+    }
 
     if ( cmdline )
         extra_space += ROUNDUP(strlen(cmdline) + 1,
@@ -740,13 +757,12 @@ static int __init pvh_load_kernel(
 
         mod.paddr = last_addr;
         mod.size = initrd_len;
-        last_addr += ROUNDUP(initrd_len, elf_64bit(&elf) ? 8 : 4);
-        if ( initrd->cmdline_pa )
+        last_addr += elf_round_up(&elf, initrd_len);
+        if ( initrd_cmdline )
         {
-            char *str = __va(initrd->cmdline_pa);
-            size_t len = strlen(str) + 1;
+            size_t len = strlen(initrd_cmdline) + 1;
 
-            rc = hvm_copy_to_guest_phys(last_addr, str, len, v);
+            rc = hvm_copy_to_guest_phys(last_addr, initrd_cmdline, len, v);
             if ( rc )
             {
                 printk("Unable to copy module command line\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:12:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:12:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929388.1332023 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnyY-0001aR-4p; Thu, 27 Mar 2025 14:12:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929388.1332023; Thu, 27 Mar 2025 14:12:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnyY-0001aJ-1h; Thu, 27 Mar 2025 14:12:54 +0000
Received: by outflank-mailman (input) for mailman id 929388;
 Thu, 27 Mar 2025 14:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnyX-0001Zv-6K
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnyX-00BpIr-0X
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnyX-001jsy-0R
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jjoWBLtDOH02mhPs8VhRuAgxHd28+rCh0COBOWC2lRI=; b=rjCQ3zlJuNjv2K/baW7f1wbgOw
	+AWBd9onVTd82JknOgSEuk6+ioUOzNbB8XP06ftj/zxxDPLoa4WhQBc1ZSHOgvJQPwkwrEY/kyZro
	EQN12r5GvtcEnfFQh8TTn7ZrUC8M76mflV+VCh4yybfOL4Y4ilC4XexZcIrNbFshUQf0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] x86/pmstat: correct get_cpufreq_para()'s error return value
Message-Id: <E1txnyX-001jsy-0R@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:12:53 +0000

commit 52c99f4b4303c21878a6bddc5cf1f9bf464a280e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:00:50 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:00:50 2025 +0100

    x86/pmstat: correct get_cpufreq_para()'s error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 7542c4ff00f2 ("Add user PM control interface")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 855337ca4947508ffca23393e291c54b5307cc9a
    master date: 2025-03-27 12:22:06 +0100
---
 xen/drivers/acpi/pmstat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index df309e27b4..b6ea19d103 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -227,7 +227,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                        affected_cpus, op->u.get_para.cpu_num);
     xfree(affected_cpus);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     if ( !(scaling_available_frequencies =
            xzalloc_array(uint32_t, op->u.get_para.freq_num)) )
@@ -239,7 +239,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                    scaling_available_frequencies, op->u.get_para.freq_num);
     xfree(scaling_available_frequencies);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     op->u.get_para.cpuinfo_cur_freq =
         cpufreq_driver.get ? alternative_call(cpufreq_driver.get, op->cpuid)
@@ -276,7 +276,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                             gov_num * CPUFREQ_NAME_LEN);
         xfree(scaling_available_governors);
         if ( ret )
-            return ret;
+            return -EFAULT;
 
         op->u.get_para.u.s.scaling_cur_freq = policy->cur;
         op->u.get_para.u.s.scaling_max_freq = policy->max;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:13:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:13:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929391.1332026 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnyi-0001if-5u; Thu, 27 Mar 2025 14:13:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929391.1332026; Thu, 27 Mar 2025 14:13:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txnyi-0001iX-35; Thu, 27 Mar 2025 14:13:04 +0000
Received: by outflank-mailman (input) for mailman id 929391;
 Thu, 27 Mar 2025 14:13:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txnyh-0001iE-8w
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:13:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnyh-00BpJ9-0n
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txnyh-001jtu-0i
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7nly6J8fE1TxomcYDuHvtA5IkU+BZjtXSOhU/u8MHkA=; b=fp69BdSL+B0+U6JXxcWZeBhV5J
	TjC4TAkfvdgDQFfpaxT6VhzjBZFR+A1gHOqWjaGeCJg2xte98Ta1KRUbe+mgK+nC8tgH2gnHzLL2V
	araT/o2udNUTHd4NnTUwzpwpfSRknS3Em1MKigTP/QFtVgg2h9kclqokeBckA1Z4c7Sc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
Message-Id: <E1txnyh-001jtu-0i@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:13:03 +0000

commit a2cf6f9d5275073c08f5778371dd2f04c6e744f8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:01:18 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:01:18 2025 +0100

    Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 86039f2e8c20 ("xen/arm: vpl011: Add a new domctl API to initialize vpl011")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 341c0df40bf73b0a5e27db27023ec400858a472d
    master date: 2025-03-27 12:22:39 +0100
---
 xen/arch/arm/domctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index 9d047065ba..ad914c915f 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -172,8 +172,8 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
             break;
         }
 
-        if ( !rc )
-            rc = copy_to_guest(u_domctl, domctl, 1);
+        if ( !rc && copy_to_guest(u_domctl, domctl, 1) )
+            rc = -EFAULT;
 
         return rc;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:22:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:22:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929434.1332070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo7P-0005xg-Qp; Thu, 27 Mar 2025 14:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929434.1332070; Thu, 27 Mar 2025 14:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo7P-0005xY-Nv; Thu, 27 Mar 2025 14:22:03 +0000
Received: by outflank-mailman (input) for mailman id 929434;
 Thu, 27 Mar 2025 14:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo7O-0005xA-MT
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo7O-00BpWh-12
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo7O-001ktp-0v
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Of9TmhB74Fkdcc38mjgSSDTA6pZ0MeWSBFmwRvgKifc=; b=onKc5V5lUDW+Is67kA2hmtwc3R
	ed/HKwb5y0taEFYhkdjeNhz6LD9txHUOc9vSCcguPFPUrZM5LifuN7VWeXIUCeu6+eFShTR2Uoygd
	2BY6PWVMmq7jji5wUKMRXxw0ZsJil/RwpJlX5p1vn21dV/mgIdZDic6AmcjiaIoouPIU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/mkelf32: account for offset when detecting note segment placement
Message-Id: <E1txo7O-001ktp-0v@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:22:02 +0000

commit ed87d5f1bf2bc75e057f59c7c67c5f52401bdd47
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:02:20 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:02:20 2025 +0100

    x86/mkelf32: account for offset when detecting note segment placement
    
    mkelf32 attempt to check that the program header defined NOTE segment falls
    inside of the LOAD segment, as the build-id should be loaded for Xen at
    runtime to check.
    
    However the current code doesn't take into account the LOAD program header
    segment offset when calculating overlap with the NOTE segment.  This
    results in incorrect detection, and the following build error:
    
    arch/x86/boot/mkelf32 --notes xen-syms ./.xen.elf32 0x200000 \
                   `nm xen-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$/0x\1/p'`
    Expected .note section within .text section!
    Offset 4244776 not within 2910364!
    
    When xen-syms has the following program headers:
    
    Program Header:
        LOAD off    0x0000000000200000 vaddr 0xffff82d040200000 paddr 0x0000000000200000 align 2**21
             filesz 0x00000000002c689c memsz 0x00000000003f7e20 flags rwx
        NOTE off    0x000000000040c528 vaddr 0xffff82d04040c528 paddr 0x000000000040c528 align 2**2
             filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
    
    Account for the program header offset of the LOAD segment when checking
    whether the NOTE segments is contained within.  Also fix the logic to
    ensure the NOTE segments is fully contained between the LOAD segment.
    
    Fixes: a353cab905af ('build_id: Provide ld-embedded build-ids')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6e5fed7cb67c9f84653cdbd3924b8a119ef653be
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/boot/mkelf32.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 3d639c2e08..7b90338ca8 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -366,11 +366,13 @@ int main(int argc, char **argv)
         note_sz = in64_phdr.p_memsz;
         note_base = in64_phdr.p_vaddr - note_base;
 
-        if ( in64_phdr.p_offset > dat_siz || offset > in64_phdr.p_offset )
+        if ( in64_phdr.p_offset < offset ||
+             in64_phdr.p_offset + in64_phdr.p_filesz > offset + dat_siz )
         {
             fprintf(stderr, "Expected .note section within .text section!\n" \
-                    "Offset %"PRId64" not within %d!\n",
-                    in64_phdr.p_offset, dat_siz);
+                    ".note: [%"PRIx64", %"PRIx64") .text: [%x, %x)\n",
+                    in64_phdr.p_offset, in64_phdr.p_offset + in64_phdr.p_filesz,
+                    offset, offset + dat_siz);
             return 1;
         }
         /* Gets us the absolute offset within the .text section. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:22:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929437.1332074 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo7Y-00067e-Ro; Thu, 27 Mar 2025 14:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929437.1332074; Thu, 27 Mar 2025 14:22:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo7Y-00067W-PD; Thu, 27 Mar 2025 14:22:12 +0000
Received: by outflank-mailman (input) for mailman id 929437;
 Thu, 27 Mar 2025 14:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo7Y-00067M-EC
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo7Y-00BpWv-1K
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo7Y-001kuo-1D
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oABKDrE/1proWedsVFwqTzZfzWfjZc6oOv3z+UDtEw8=; b=sy15JTXv4uOfZAjMFgA7AI8spN
	pFVzhNLxH0sQlOX/ZE2u9qZ5juw3t8pLcKu0dBUDuTKisrJaveOi0G5A88IuSmlNQ5XH856mtXUNA
	zI2co2Uy3Et5j0IcZXya+18h23dSTbu3tXjVhBNn0K7kWQP97TtdrHsvv+KmNYmuEM0A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
Message-Id: <E1txo7Y-001kuo-1D@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:22:12 +0000

commit b3a9e6d6fe9c1596dd31c039b529a66cd00b303a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:02:28 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:02:28 2025 +0100

    x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in arch/x86/mm/shadow/private.h:515:30
    pointer operation overflowed ffff82e000000000 to ffff82dfffffffe0
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d040471b2d>] F arch/x86/mm/shadow/guest_2.c#sh_page_fault__guest_2+0x1e350
        [<ffff82d0403b206b>] F svm_vmexit_handler+0xdf3/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Fix by moving the call to mfn_to_page() after the check of whether the
    passed gmfn is valid.  This avoid the call to mfn_to_page() with an
    INVALID_MFN parameter.
    
    While there make the page local variable const, it's not modified by the
    function.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 45ee73f1b24246f13cd9583cb2ee25fb9c782db8
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/mm/shadow/private.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index a5fc3a7676..cef9dbef2e 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -512,13 +512,14 @@ static inline unsigned long __backpointer(const struct page_info *sp)
 static inline int
 sh_mfn_is_a_page_table(mfn_t gmfn)
 {
-    struct page_info *page = mfn_to_page(gmfn);
+    const struct page_info *page;
     struct domain *owner;
     unsigned long type_info;
 
     if ( !mfn_valid(gmfn) )
         return 0;
 
+    page = mfn_to_page(gmfn);
     owner = page_get_owner(page);
     if ( owner && shadow_mode_refcounts(owner)
          && (page->count_info & PGC_shadowed_pt) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:22:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:22:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929440.1332077 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo7i-0006Aw-TF; Thu, 27 Mar 2025 14:22:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929440.1332077; Thu, 27 Mar 2025 14:22:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo7i-0006Ao-Qj; Thu, 27 Mar 2025 14:22:22 +0000
Received: by outflank-mailman (input) for mailman id 929440;
 Thu, 27 Mar 2025 14:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo7i-0006Ai-HH
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo7i-00BpXM-1c
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo7i-001kvO-1V
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y/Y2788wwrdQaoaqxM6hLJlV3egiFJax/7N/VCKvI7c=; b=Fdwc16w3xGdjnwoSbVikDZhXa0
	japjSByOljvECkI5pQJvWcwWVFWT5hcVAiRrWfmI80r1BnzH+hb3TJZaXJvDm2GRHgNuTP+Ey4Gu0
	STmUz0MWNIP5vedMgtf8hFpWG5cZiG8xJomiZjQ74hNjTgMiIdndhB7O7c4VZ0TvYgHc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
Message-Id: <E1txo7i-001kvO-1V@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:22:22 +0000

commit 11ad7d71610c3d3fc5edd545d05a6328cdba235f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:02:49 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:02:49 2025 +0100

    x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in common/compat/memory.c:90:9
    pointer operation overflowed ffff820080000000 to 0000020080000000
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0402a6259>] F compat_memory_op+0xf1/0x4d20
        [<ffff82d04041532d>] F hvm_memory_op+0x55/0xe0
        [<ffff82d040416150>] F hvm_hypercall+0xae8/0x21b0
        [<ffff82d0403b24ca>] F svm_vmexit_handler+0x1252/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Adjust the calculations in COMPAT_ARG_XLAT_VIRT_BASE to subtract from the
    per-domain area to obtain the mirrored linear address in the 4th slot,
    instead of overflowing the per-domain linear address.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: fc302866f42f552337ae7d8d78877aec36e6e2ff
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/include/asm/x86_64/uaccess.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/x86_64/uaccess.h b/xen/arch/x86/include/asm/x86_64/uaccess.h
index c6fa3fd381..9f515b2638 100644
--- a/xen/arch/x86/include/asm/x86_64/uaccess.h
+++ b/xen/arch/x86/include/asm/x86_64/uaccess.h
@@ -9,9 +9,9 @@
  * a secondary mapping installed, which needs to be used for such accesses in
  * the PV case, and will also be used for HVM to avoid extra conditionals.
  */
-#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) + \
-                                   (PERDOMAIN_ALT_VIRT_START - \
-                                    PERDOMAIN_VIRT_START))
+#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) - \
+                                   PERDOMAIN_VIRT_START + \
+                                   PERDOMAIN_ALT_VIRT_START)
 #define COMPAT_ARG_XLAT_SIZE      (2*PAGE_SIZE)
 struct vcpu;
 int setup_compat_arg_xlat(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:22:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929442.1332083 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo7t-0006Ff-VI; Thu, 27 Mar 2025 14:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929442.1332083; Thu, 27 Mar 2025 14:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo7t-0006FX-SA; Thu, 27 Mar 2025 14:22:33 +0000
Received: by outflank-mailman (input) for mailman id 929442;
 Thu, 27 Mar 2025 14:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo7s-0006FF-Jz
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo7s-00BpXT-1t
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo7s-001kwJ-1n
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=B4BYmJksd1eaP079afmPIHYMQ0rOZCgct1FN5VXtP8E=; b=fJmCfAis8HUWufINuP/IYbWbAC
	LzmbDWKqZrnxFTRgQs36NitIAkqw16FtOgyZnNplCZOXyFypwg8X75T8gXUJ3Eoi63Pode3G8vBcd
	2TbsQtbjLg29JuHvcKh95i1V4NP8tT34Ac7gge7z5kIquR9AQsT2LXjA7T6OURNHSTxg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/vga: fix mapping of the VGA text buffer
Message-Id: <E1txo7s-001kwJ-1n@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:22:32 +0000

commit e9a46d5fe5deaa91be4931d25f1ffc1ee4dc4d19
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:03:20 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:03:20 2025 +0100

    x86/vga: fix mapping of the VGA text buffer
    
    The call to ioremap_wc() in video_init() will always fail, because
    video_init() is called ahead of vm_init_type(), and so the underlying
    __vmap() call will fail to allocate the linear address space.
    
    Fix by reverting to the previous behavior and use __va() for the VGA text
    buffer, as it's below the 1MB boundary, and thus always mapped in the
    directmap.
    
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1ca5f69e35548e5196eadb329e5a3976821dc982
    master date: 2025-03-20 17:16:10 +0100
---
 xen/drivers/video/vga.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/drivers/video/vga.c b/xen/drivers/video/vga.c
index b4d0183261..b577b24619 100644
--- a/xen/drivers/video/vga.c
+++ b/xen/drivers/video/vga.c
@@ -71,7 +71,7 @@ void __init video_init(void)
     {
     case XEN_VGATYPE_TEXT_MODE_3:
         if ( page_is_ram_type(paddr_to_pfn(0xB8000), RAM_TYPE_CONVENTIONAL) ||
-             ((video = ioremap_wc(0xB8000, 0x8000)) == NULL) )
+             ((video = __va(0xB8000)) == NULL) )
             return;
         outw(0x200a, 0x3d4); /* disable cursor */
         columns = vga_console_info.u.text_mode_3.columns;
@@ -158,7 +158,6 @@ void __init video_endboot(void)
         if ( !vgacon_keep )
         {
             memset(video, 0, columns * lines * 2);
-            iounmap(video);
             video = ZERO_BLOCK_PTR;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:22:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929443.1332086 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo84-0006Iy-07; Thu, 27 Mar 2025 14:22:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929443.1332086; Thu, 27 Mar 2025 14:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo83-0006Iq-Ta; Thu, 27 Mar 2025 14:22:43 +0000
Received: by outflank-mailman (input) for mailman id 929443;
 Thu, 27 Mar 2025 14:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo82-0006If-Mw
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo82-00BpXg-2B
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo82-001kzr-24
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=giSp6TuQqeRB+nsIay0HcBJBTygRWwkEQyOCcIqzhgA=; b=gcFBbmuv0UI6qNVMp0GHM8Vn2j
	BFR/JfqCnvUg8wbnV9Qe/fgV5JlJ22CA7GlQPhisZsuZZio2P7eQLxM95KEQXWhodMoQGo0WVFyuW
	Tv9T/Ovrjl1Bk66FUWOGwXVcX8oK5s7lQ8ruTYKodpLL+e+pXKHhFueau28QbKumVhZ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/compiler: Fix the position of the visibility pragma
Message-Id: <E1txo82-001kzr-24@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:22:42 +0000

commit 3aca2a93c0538cd31eab4ea9c4eaa7c4c5804f87
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:03:56 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:03:56 2025 +0100

    xen/compiler: Fix the position of the visibility pragma
    
    This needs to be ahead of everything.  Right now, it is after xen/init.h being
    included for -DINIT_SECTIONS_ONLY
    
      # 1 "./include/xen/compiler.h" 1
      # 83 "./include/xen/compiler.h"
      # 1 "./include/xen/init.h" 1
      # 62 "./include/xen/init.h"
      typedef int (*initcall_t)(void);
      typedef void (*exitcall_t)(void);
      # 72 "./include/xen/init.h"
      void do_presmp_initcalls(void);
      void do_initcalls(void);
      # 84 "./include/xen/compiler.h" 2
      # 122 "./include/xen/compiler.h"
      #pragma GCC visibility push(hidden)
    
    Fixes: 84c4461b7d3a ("Force out-of-line instances of inline functions into .init.text in init-only code")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: ab7ce0c8ed90f729a186babd87e3cd1fbed8ab98
    master date: 2025-03-21 11:52:39 +0000
---
 xen/include/xen/compiler.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 444bf80142..c8a143151b 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -15,6 +15,11 @@
 # endif
 #endif
 
+#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
+/* Results in more efficient PIC code (no indirections through GOT or PLT). */
+#pragma GCC visibility push(hidden)
+#endif
+
 #define barrier()     __asm__ __volatile__("": : :"memory")
 
 #define likely(x)     __builtin_expect(!!(x),1)
@@ -118,11 +123,6 @@
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
 
-#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
-/* Results in more efficient PIC code (no indirections through GOT or PLT). */
-#pragma GCC visibility push(hidden)
-#endif
-
 /* Make the optimizer believe the variable can be manipulated arbitrarily. */
 #define OPTIMIZER_HIDE_VAR(var) __asm__ ( "" : "+g" (var) )
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:22:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929444.1332089 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo8E-0006LU-1M; Thu, 27 Mar 2025 14:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929444.1332089; Thu, 27 Mar 2025 14:22:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo8D-0006LM-Uz; Thu, 27 Mar 2025 14:22:53 +0000
Received: by outflank-mailman (input) for mailman id 929444;
 Thu, 27 Mar 2025 14:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo8C-0006LC-Pb
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo8C-00BpXo-2T
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo8C-001l2g-2M
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fyvW2c9MM1zzPu+M0RJSrttPiSwLMqgFufZ7I4Arshs=; b=TiJ4wM1lnIcmS3rn7YqZoW7Ksq
	1SvsBj2o3u4k9VLDH8690y1Nl4sniA+keJK83+Pi49TMiJx25aO+xwVNk/29vZqaIz5tl+YwkZwEN
	A5YWs2VQeNqCGVxuLhFOY8U9h62tW77b0tpIxJqP/4jZV2/yltpWN9pJfYrvrlgfBKc8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/boot: Simplify the expression for extra allocation space
Message-Id: <E1txo8C-001l2g-2M@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:22:52 +0000

commit c1f70e216ca9a05b537d23781fa45ce837e26685
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:04:03 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:04:03 2025 +0100

    x86/boot: Simplify the expression for extra allocation space
    
    The expression for one parameter of find_memory() is already complicated and
    about to become moreso.  Break it out into a new variable, and express it in
    an easier-to-follow way.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: ce703c84df1cb279605b0a85a45c6419464a16e8
    master date: 2025-03-21 11:52:39 +0000
---
 xen/arch/x86/hvm/dom0_build.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 81445d5b37..716879b710 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -653,6 +653,7 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
     unsigned long initrd_len = initrd ? initrd->mod_end : 0;
     struct elf_binary elf;
     struct elf_dom_parms parms;
+    size_t extra_space;
     paddr_t last_addr;
     struct hvm_start_info start_info = { 0 };
     struct hvm_modlist_entry mod = { 0 };
@@ -710,13 +711,16 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
      * split into smaller allocations, done as a single region in order to
      * simplify it.
      */
-    last_addr = find_memory(d, &elf, sizeof(start_info) +
-                            (initrd ? ROUNDUP(initrd_len, PAGE_SIZE) +
-                                      sizeof(mod)
-                                    : 0) +
-                            (cmdline ? ROUNDUP(strlen(cmdline) + 1,
-                                               elf_64bit(&elf) ? 8 : 4)
-                                     : 0));
+    extra_space = sizeof(start_info);
+
+    if ( initrd )
+        extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
+
+    if ( cmdline )
+        extra_space += ROUNDUP(strlen(cmdline) + 1,
+                               elf_64bit(&elf) ? 8 : 4);
+
+    last_addr = find_memory(d, &elf, extra_space);
     if ( last_addr == INVALID_PADDR )
     {
         printk("Unable to find a memory region to load initrd and metadata\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:23:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929445.1332094 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo8O-0006OV-3H; Thu, 27 Mar 2025 14:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929445.1332094; Thu, 27 Mar 2025 14:23:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo8O-0006ON-07; Thu, 27 Mar 2025 14:23:04 +0000
Received: by outflank-mailman (input) for mailman id 929445;
 Thu, 27 Mar 2025 14:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo8M-0006O9-Sj
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo8M-00BpYB-2k
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo8M-001l3b-2e
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dc3tsbnF6ywF8B+DBCP1prdTwL/TkzeKaqPBztCJrUE=; b=D2+OGDyN8jiBVP2JvBBZ1w27pr
	mlBwB1HKtAmCid1m0L4s4lEzU0grkdAojQhYtvoWkSieSXUfZ0V8t317SkvP/lfTv7m/wMApVb3pd
	oQi2IFE6b7ykLO2L2VUY9K7n3cyEITUk+Vlp8wlkvYv/J+UEF8Nr7/cF/upe5szlQYZs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
Message-Id: <E1txo8M-001l3b-2e@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:23:02 +0000

commit 748be9a974d95056763828bbb2572fdbc7b71ef7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:04:48 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:04:48 2025 +0100

    xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
    
    malloc(), when passed zero size, may return NULL (the behavior is
    implementation defined). Mirror the ->gov_num check to the other two
    allocations as well. Don't chance then actually using a NULL in
    print_cpufreq_para().
    
    Fixes: 75e06d089d48 ("xenpm: add cpu frequency control interface, through which user can")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: 6c0dc87bb0e08fb31a68bf4c4149a18b92628f14
    master date: 2025-03-26 12:30:57 +0100
---
 tools/misc/xenpm.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index 336d246346..db658ebadd 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -840,8 +840,9 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
     }
     else
     {
-        printf("scaling_avail_gov    : %s\n",
-               p_cpufreq->scaling_available_governors);
+        if ( p_cpufreq->gov_num )
+            printf("scaling_avail_gov    : %s\n",
+                   p_cpufreq->scaling_available_governors);
 
         printf("current_governor     : %s\n", p_cpufreq->u.s.scaling_governor);
         if ( !strncmp(p_cpufreq->u.s.scaling_governor,
@@ -907,7 +908,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
         p_cpufreq->scaling_available_frequencies = NULL;
         p_cpufreq->scaling_available_governors = NULL;
 
-        if (!(p_cpufreq->affected_cpus =
+        if (p_cpufreq->cpu_num &&
+            !(p_cpufreq->affected_cpus =
               malloc(p_cpufreq->cpu_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
@@ -916,7 +918,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
             ret = -ENOMEM;
             goto out;
         }
-        if (!(p_cpufreq->scaling_available_frequencies =
+        if (p_cpufreq->freq_num &&
+            !(p_cpufreq->scaling_available_frequencies =
               malloc(p_cpufreq->freq_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:23:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929446.1332097 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo8Y-0006Ri-65; Thu, 27 Mar 2025 14:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929446.1332097; Thu, 27 Mar 2025 14:23:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo8Y-0006Ra-3B; Thu, 27 Mar 2025 14:23:14 +0000
Received: by outflank-mailman (input) for mailman id 929446;
 Thu, 27 Mar 2025 14:23:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo8W-0006RP-V5
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo8W-00BpYX-31
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo8W-001l4Y-2w
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:23:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dDtMCg9F07vh/QSSgVu936ytKrYVT2Nj4tWRVr9LU9E=; b=5Ogu/AOsI8IqIOf9pi0JL7FFmf
	HsEv7ybKcsqzA0RklLl4XoK0XHs89AcXQ+1LC48Q+sLQg73SNP/r17ECDwx73ufhjxqsRsoLn3enN
	L1SA8l4zVYnztfwnOzTjKKRwTagPGdOzIhk/TO8uTJuXfeW8i6fBUd/CiSf6TS9Oy9V8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/PVH: expose OEMx ACPI tables to Dom0
Message-Id: <E1txo8W-001l4Y-2w@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:23:12 +0000

commit c9f077bc4107728a41b88acdbcee90dad9901aa6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:05:11 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:05:11 2025 +0100

    x86/PVH: expose OEMx ACPI tables to Dom0
    
    What they contain we don't know, but we can't sensibly hide them. On my
    Skylake system OEM1 (with a description of "INTEL  CPU EIST") is what
    contains all the _PCT, _PPC, and _PSS methods, i.e. about everything
    needed for cpufreq. (_PSD interestingly are in an SSDT there.)
    
    Further OEM2 there has a description of "INTEL  CPU  HWP", while OEM4
    has "INTEL  CPU  CST". Pretty clearly all three need exposing for
    cpufreq and cpuidle to work.
    
    Fixes: 8b1a5268daf0 ("pvh/dom0: whitelist PVH Dom0 ACPI tables")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 6378909b41c40187a79df1d38ca4791b34393d67
    master date: 2025-03-26 12:32:03 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 716879b710..4a094ae317 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1010,12 +1010,20 @@ static bool __init pvh_acpi_table_allowed(const char *sig,
             return true;
         else
         {
+    skip:
             printk("Skipping table %.4s in non-ACPI non-reserved region\n",
                    sig);
             return false;
         }
     }
 
+    if ( !strncmp(sig, "OEM", 3) )
+    {
+        if ( acpi_memory_banned(address, size) )
+            goto skip;
+        return true;
+    }
+
     return false;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:23:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:23:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929447.1332102 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo8i-0006UM-7Z; Thu, 27 Mar 2025 14:23:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929447.1332102; Thu, 27 Mar 2025 14:23:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo8i-0006UE-4h; Thu, 27 Mar 2025 14:23:24 +0000
Received: by outflank-mailman (input) for mailman id 929447;
 Thu, 27 Mar 2025 14:23:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo8h-0006U0-29
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:23:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo8h-00BpYb-07
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:23:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo8g-001l6q-3C
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:23:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IajNVlCltbWGZqYogJr3A0SfqidLHTl+SvB91Ij7Pnc=; b=MoEu8bGNrBVShsQe5Ju8a/h8pm
	dXpd3TDoNMW327qT6UE3JY8tzLS+5k1kOEswQAJnLnulOtUV5wLkE/4oSEZ30VBrnh39aVHr6Uxqr
	XKzJtX4llKW0MX4TkyZQodfl/uDr/hZtTDWHt5KYRgl301i9mPtnIVwKcBx3ygOAVgJk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
Message-Id: <E1txo8g-001l6q-3C@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:23:22 +0000

commit 7ef9a36a68ca966562564f9a971670651e51d14b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:05:35 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:05:35 2025 +0100

    x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
    
    In hvmemul_read_cr(), make the TRACE()/X86EMUL_OKAY path common in preparation
    for adding a %cr8 case.  Use a local 'val' variable instead of always
    operating on a deferenced pointer.
    
    In both, calculate curr once.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b7264a15c28d30bb994ec9e58eba38932be231ec
    master date: 2025-03-26 11:54:59 +0000
---
 xen/arch/x86/hvm/emulate.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index abc4f5f261..cb071be586 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2294,23 +2294,30 @@ static int cf_check hvmemul_write_io(
 
 static int cf_check hvmemul_read_cr(
     unsigned int reg,
-    unsigned long *val,
+    unsigned long *pval,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
+    unsigned long val;
+
     switch ( reg )
     {
     case 0:
     case 2:
     case 3:
     case 4:
-        *val = current->arch.hvm.guest_cr[reg];
-        TRACE(TRC_HVM_CR_READ64, reg, *val, *val >> 32);
-        return X86EMUL_OKAY;
-    default:
+        val = curr->arch.hvm.guest_cr[reg];
         break;
+
+    default:
+        return X86EMUL_UNHANDLEABLE;
     }
 
-    return X86EMUL_UNHANDLEABLE;
+    TRACE(TRC_HVM_CR_READ64, reg, val, val >> 32);
+
+    *pval = val;
+
+    return X86EMUL_OKAY;
 }
 
 static int cf_check hvmemul_write_cr(
@@ -2318,6 +2325,7 @@ static int cf_check hvmemul_write_cr(
     unsigned long val,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
     int rc;
 
     TRACE(TRC_HVM_CR_WRITE64, reg, val, val >> 32);
@@ -2328,13 +2336,13 @@ static int cf_check hvmemul_write_cr(
         break;
 
     case 2:
-        current->arch.hvm.guest_cr[2] = val;
+        curr->arch.hvm.guest_cr[2] = val;
         rc = X86EMUL_OKAY;
         break;
 
     case 3:
     {
-        bool noflush = hvm_pcid_enabled(current) && (val & X86_CR3_NOFLUSH);
+        bool noflush = hvm_pcid_enabled(curr) && (val & X86_CR3_NOFLUSH);
 
         if ( noflush )
             val &= ~X86_CR3_NOFLUSH;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:23:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:23:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929449.1332105 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo8s-0006X6-8q; Thu, 27 Mar 2025 14:23:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929449.1332105; Thu, 27 Mar 2025 14:23:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo8s-0006Wy-6E; Thu, 27 Mar 2025 14:23:34 +0000
Received: by outflank-mailman (input) for mailman id 929449;
 Thu, 27 Mar 2025 14:23:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo8r-0006Wj-4r
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:23:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo8r-00BpYg-0O
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:23:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo8r-001l8B-0J
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:23:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s2/GmfS4Yd6RqbUGp9D/eBzFFEy0hv+K+5gljZLWHjw=; b=XiPsZ6h49NytMuF8XroQEmyFAC
	kSWwTHivxnnwoNE9wHnPMY8fJ/kiaG9GOab3Smt/w6Tudo7I78imwLOVhLcr4VWhxjJsnysaLuxyz
	UpXxisyW+ipYq0CdVkOYq64I6xDbyiLUFmgO/CyRNt0+xh2MdH9k13XRmx5V53X82sVo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/emul: Emulate %cr8 accesses
Message-Id: <E1txo8r-001l8B-0J@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:23:33 +0000

commit d74241aae512c0711405b1844c45d95206d4f6e6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:06:09 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:06:09 2025 +0100

    x86/emul: Emulate %cr8 accesses
    
    Petr reports:
    
      (XEN) MMIO emulation failed (1): d12v1 64bit @ 0010:fffff8057ba7dfbf -> 45 0f 20 c2 ...
    
    during introspection.
    
    This is MOV %cr8, which is wired up for hvm_mov_{to,from}_cr(); the VMExit
    fastpaths, but not for the full emulation slowpaths.
    
    Xen's handling of %cr8 turns out to be quite wrong.  At a minimum, we need
    storage for %cr8 separate to APIC_TPR, and to alter intercepts based on
    whether the vLAPIC is enabled or not.  But that's more work than there is time
    for in the short term, so make a stopgap fix.
    
    Extend hvmemul_{read,write}_cr() with %cr8 cases.  Unlike hvm_mov_to_cr(),
    hardware hasn't filtered out invalid values (#GP checks are ahead of
    intercepts), so introduce X86_CR8_VALID_MASK.
    
    Reported-by: Petr Beneš <w1benny@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 14fd9b5642cd4805b49fbe716bf2cd577e724169
    master date: 2025-03-26 11:54:59 +0000
---
 xen/arch/x86/hvm/emulate.c           | 15 +++++++++++++++
 xen/arch/x86/include/asm/x86-defns.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index cb071be586..f4b9352c39 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2309,6 +2309,10 @@ static int cf_check hvmemul_read_cr(
         val = curr->arch.hvm.guest_cr[reg];
         break;
 
+    case 8:
+        val = (vlapic_get_reg(vcpu_vlapic(curr), APIC_TASKPRI) & 0xf0) >> 4;
+        break;
+
     default:
         return X86EMUL_UNHANDLEABLE;
     }
@@ -2354,6 +2358,17 @@ static int cf_check hvmemul_write_cr(
         rc = hvm_set_cr4(val, true);
         break;
 
+    case 8:
+        if ( val & ~X86_CR8_VALID_MASK )
+        {
+            rc = X86EMUL_EXCEPTION;
+            break;
+        }
+
+        vlapic_set_reg(vcpu_vlapic(curr), APIC_TASKPRI, val << 4);
+        rc = X86EMUL_OKAY;
+        break;
+
     default:
         rc = X86EMUL_UNHANDLEABLE;
         break;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index caa92829ea..64af953898 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -76,6 +76,8 @@
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
 
+#define X86_CR8_VALID_MASK 0xf
+
 /*
  * XSTATE component flags in XCR0 | MSR_XSS
  */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:23:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:23:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929450.1332110 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo92-0006Zh-AN; Thu, 27 Mar 2025 14:23:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929450.1332110; Thu, 27 Mar 2025 14:23:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo92-0006ZZ-7l; Thu, 27 Mar 2025 14:23:44 +0000
Received: by outflank-mailman (input) for mailman id 929450;
 Thu, 27 Mar 2025 14:23:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo91-0006ZP-7b
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:23:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo91-00BpYm-0f
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:23:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo91-001l9h-0Z
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:23:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1h/WyJiRSANpkak1IfXlC+x2nrtACd3Q+wpbvZ855+o=; b=vFLpObVvgfSBfkioEqm7nvU+cB
	+GhK0k3KhCNC550D7pRlyqovTpg+tHLz0yhCS8og6nJ8vrUy3s4yKoUPsDbw+JMyJ/I+RR6iwcDgl
	I/5pVMQtbnmkzWprXqw7Ll2wfE0VUEdCO+D4jQKjBrI8O02KV7bvvfRYYwO8+L+S3P00=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/PVH: account for module command line length
Message-Id: <E1txo91-001l9h-0Z@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:23:43 +0000

commit 43e1996c02d2c810920577574aefe6dfdb19f5ad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:06:33 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:06:33 2025 +0100

    x86/PVH: account for module command line length
    
    As per observation in practice, initrd->cmdline_pa is not normally zero.
    Hence so far we always appended at least one byte. That alone may
    already render insufficient the "allocation" made by find_memory().
    Things would be worse when there's actually a (perhaps long) command
    line.
    
    Skip setup when the command line is empty. Amend the "allocation" size
    by padding and actual size of module command line. Along these lines
    also skip initrd setup when the initrd is zero size.
    
    Fixes: 0ecb8eb09f9f ("x86/pvh: pass module command line to dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: 989584e532c9517a0f789e993f5f6744beaebe3e
    master date: 2025-03-27 12:21:08 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 4a094ae317..2b4505ebbf 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -651,6 +651,7 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
     void *image_start = image_base + image_headroom;
     unsigned long image_len = image->mod_end;
     unsigned long initrd_len = initrd ? initrd->mod_end : 0;
+    const char *initrd_cmdline = NULL;
     struct elf_binary elf;
     struct elf_dom_parms parms;
     size_t extra_space;
@@ -714,7 +715,23 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
     extra_space = sizeof(start_info);
 
     if ( initrd )
-        extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
+    {
+        size_t initrd_space = elf_round_up(&elf, initrd_len);
+
+        if ( initrd->string )
+        {
+            initrd_cmdline = __va(initrd->string);
+            if ( !*initrd_cmdline )
+                initrd_cmdline = NULL;
+        }
+        if ( initrd_cmdline )
+            initrd_space += strlen(initrd_cmdline) + 1;
+
+        if ( initrd_space )
+            extra_space += ROUNDUP(initrd_space, PAGE_SIZE) + sizeof(mod);
+        else
+            initrd = NULL;
+    }
 
     if ( cmdline )
         extra_space += ROUNDUP(strlen(cmdline) + 1,
@@ -739,13 +756,12 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
 
         mod.paddr = last_addr;
         mod.size = initrd_len;
-        last_addr += ROUNDUP(initrd_len, elf_64bit(&elf) ? 8 : 4);
-        if ( initrd->string )
+        last_addr += elf_round_up(&elf, initrd_len);
+        if ( initrd_cmdline )
         {
-            char *str = __va(initrd->string);
-            size_t len = strlen(str) + 1;
+            size_t len = strlen(initrd_cmdline) + 1;
 
-            rc = hvm_copy_to_guest_phys(last_addr, str, len, v);
+            rc = hvm_copy_to_guest_phys(last_addr, initrd_cmdline, len, v);
             if ( rc )
             {
                 printk("Unable to copy module command line\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:23:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:23:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929451.1332114 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo9C-0006e0-Bg; Thu, 27 Mar 2025 14:23:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929451.1332114; Thu, 27 Mar 2025 14:23:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo9C-0006dt-98; Thu, 27 Mar 2025 14:23:54 +0000
Received: by outflank-mailman (input) for mailman id 929451;
 Thu, 27 Mar 2025 14:23:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo9B-0006dZ-AA
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:23:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo9B-00Bpbk-0v
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:23:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo9B-001lAx-0q
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:23:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=m8/jca1eEsI2J7UjUV749rlkg77mkx6TQ4/i0yKcGM4=; b=NCkP37bD7oIzUi42bRNKwtan9G
	hTEQuPO50qaJEmvQVKmtefb7AEY8ruDpuov+POUR5W+QKXPD7VSxDPuR5jwgzHeA4rbIDIbK12qmg
	ycC3nwRzOadv63hbhy+J4KAhE8/M1e6N9CdrQSjXVWgkhFC6lbVb87EzP8CtT/2hVy+Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/pmstat: correct get_cpufreq_para()'s error return value
Message-Id: <E1txo9B-001lAx-0q@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:23:53 +0000

commit 46da7056e4a043a995b733357219a38b50c25911
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:06:45 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:06:45 2025 +0100

    x86/pmstat: correct get_cpufreq_para()'s error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 7542c4ff00f2 ("Add user PM control interface")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 855337ca4947508ffca23393e291c54b5307cc9a
    master date: 2025-03-27 12:22:06 +0100
---
 xen/drivers/acpi/pmstat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index 998d2e3c65..f607bc110f 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -227,7 +227,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                        affected_cpus, op->u.get_para.cpu_num);
     xfree(affected_cpus);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     if ( !(scaling_available_frequencies =
            xzalloc_array(uint32_t, op->u.get_para.freq_num)) )
@@ -239,7 +239,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                    scaling_available_frequencies, op->u.get_para.freq_num);
     xfree(scaling_available_frequencies);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     op->u.get_para.cpuinfo_cur_freq =
         cpufreq_driver.get ? alternative_call(cpufreq_driver.get, op->cpuid)
@@ -275,7 +275,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                             gov_num * CPUFREQ_NAME_LEN);
         xfree(scaling_available_governors);
         if ( ret )
-            return ret;
+            return -EFAULT;
 
         op->u.get_para.u.s.scaling_cur_freq = policy->cur;
         op->u.get_para.u.s.scaling_max_freq = policy->max;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:24:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:24:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929453.1332118 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo9M-0006gl-DA; Thu, 27 Mar 2025 14:24:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929453.1332118; Thu, 27 Mar 2025 14:24:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txo9M-0006gd-Ac; Thu, 27 Mar 2025 14:24:04 +0000
Received: by outflank-mailman (input) for mailman id 929453;
 Thu, 27 Mar 2025 14:24:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txo9L-0006gV-Cr
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:24:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo9L-00BpcY-1B
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:24:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txo9L-001lCt-16
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:24:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RFBPfjl3vg1HeAzpGROBP/oCp2DfuFaFx9R4ygJfBuw=; b=zTbRruxIWNWzZpwf0HC3srZpWN
	RsxjSt1iZVKH9XPBRoJEYSuEpzckhOIFpSI7Mw4zFU8OZPU25/zVHgroT815nj4/cWVwi1BdXKipC
	o0EHhwv2DyMXPVqsXBwoIGSd1EQvt9sT/7wm7Qls3QF/i5QrfXsHzgJ5hmzI0bbbsxME=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
Message-Id: <E1txo9L-001lCt-16@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:24:03 +0000

commit edf9509e4d2b0f15bea591735f3fc7226bb8ed5d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:06:53 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:06:53 2025 +0100

    Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 86039f2e8c20 ("xen/arm: vpl011: Add a new domctl API to initialize vpl011")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 341c0df40bf73b0a5e27db27023ec400858a472d
    master date: 2025-03-27 12:22:39 +0100
---
 xen/arch/arm/domctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index 12a12ee781..7a502afa6b 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -172,8 +172,8 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
             break;
         }
 
-        if ( !rc )
-            rc = copy_to_guest(u_domctl, domctl, 1);
+        if ( !rc && copy_to_guest(u_domctl, domctl, 1) )
+            rc = -EFAULT;
 
         return rc;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:33:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929469.1332132 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoI4-0001A0-C7; Thu, 27 Mar 2025 14:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929469.1332132; Thu, 27 Mar 2025 14:33:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoI4-00019s-9K; Thu, 27 Mar 2025 14:33:04 +0000
Received: by outflank-mailman (input) for mailman id 929469;
 Thu, 27 Mar 2025 14:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoI2-00019e-J5
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoI2-00Bpmg-1G
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoI2-001mJb-19
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=32gIkEslxhlxWW21gJ/Mxqf5+Y/DQNx1/Kgvaba7c5M=; b=LmY9TG+Lmw4J/kScWmcWVOG0XA
	FvDkiGh5XUkxqPv4sjHQ4b9qwyDRK4kwZLHHtUaPM61t/P/mVdQo96VRQN758Ea2zggZ48y/zzOqv
	c/5HoK0eCq5eW8zFunWkUujQ+Dc/B7R1lc0Go2PUWiu6AxqTO475GRlrgtFtt1PuAgpc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/mkelf32: account for offset when detecting note segment placement
Message-Id: <E1txoI2-001mJb-19@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:33:02 +0000

commit 190ef8c03b4a70f570224c3208070a45c59a8446
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:22:48 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:22:48 2025 +0100

    x86/mkelf32: account for offset when detecting note segment placement
    
    mkelf32 attempt to check that the program header defined NOTE segment falls
    inside of the LOAD segment, as the build-id should be loaded for Xen at
    runtime to check.
    
    However the current code doesn't take into account the LOAD program header
    segment offset when calculating overlap with the NOTE segment.  This
    results in incorrect detection, and the following build error:
    
    arch/x86/boot/mkelf32 --notes xen-syms ./.xen.elf32 0x200000 \
                   `nm xen-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$/0x\1/p'`
    Expected .note section within .text section!
    Offset 4244776 not within 2910364!
    
    When xen-syms has the following program headers:
    
    Program Header:
        LOAD off    0x0000000000200000 vaddr 0xffff82d040200000 paddr 0x0000000000200000 align 2**21
             filesz 0x00000000002c689c memsz 0x00000000003f7e20 flags rwx
        NOTE off    0x000000000040c528 vaddr 0xffff82d04040c528 paddr 0x000000000040c528 align 2**2
             filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
    
    Account for the program header offset of the LOAD segment when checking
    whether the NOTE segments is contained within.  Also fix the logic to
    ensure the NOTE segments is fully contained between the LOAD segment.
    
    Fixes: a353cab905af ('build_id: Provide ld-embedded build-ids')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6e5fed7cb67c9f84653cdbd3924b8a119ef653be
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/boot/mkelf32.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 3d639c2e08..7b90338ca8 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -366,11 +366,13 @@ int main(int argc, char **argv)
         note_sz = in64_phdr.p_memsz;
         note_base = in64_phdr.p_vaddr - note_base;
 
-        if ( in64_phdr.p_offset > dat_siz || offset > in64_phdr.p_offset )
+        if ( in64_phdr.p_offset < offset ||
+             in64_phdr.p_offset + in64_phdr.p_filesz > offset + dat_siz )
         {
             fprintf(stderr, "Expected .note section within .text section!\n" \
-                    "Offset %"PRId64" not within %d!\n",
-                    in64_phdr.p_offset, dat_siz);
+                    ".note: [%"PRIx64", %"PRIx64") .text: [%x, %x)\n",
+                    in64_phdr.p_offset, in64_phdr.p_offset + in64_phdr.p_filesz,
+                    offset, offset + dat_siz);
             return 1;
         }
         /* Gets us the absolute offset within the .text section. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:33:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929470.1332136 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoIE-0001CO-FQ; Thu, 27 Mar 2025 14:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929470.1332136; Thu, 27 Mar 2025 14:33:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoIE-0001CD-Cg; Thu, 27 Mar 2025 14:33:14 +0000
Received: by outflank-mailman (input) for mailman id 929470;
 Thu, 27 Mar 2025 14:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoIC-0001Bx-Gs
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoIC-00Bpmm-1Z
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoIC-001mMF-1S
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UcLFpucQYMvupRFi/T9mqrzAJTh6/B+intgIzyJddYU=; b=rDQ4PquuPQgsjxmoCPGesC6ixU
	4hmqqMJOfPuxhNF3qcJsdMfvkKcArN00tEjNz5U3+rKhDZJ6+3x2g1ODDUTjfP8YBJZ+ZyGSIP81u
	HfVwd+xeczNL5jS+CpLXbAsL10IuQ2aHJSwjT4hSpRUjzDBvHmqvIiAX4tQdP9w6euKE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
Message-Id: <E1txoIC-001mMF-1S@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:33:12 +0000

commit 069721d639d24457d44ec16cd90c59f41ebf092d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:23:00 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:23:00 2025 +0100

    x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in arch/x86/mm/shadow/private.h:515:30
    pointer operation overflowed ffff82e000000000 to ffff82dfffffffe0
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d040471b2d>] F arch/x86/mm/shadow/guest_2.c#sh_page_fault__guest_2+0x1e350
        [<ffff82d0403b206b>] F svm_vmexit_handler+0xdf3/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Fix by moving the call to mfn_to_page() after the check of whether the
    passed gmfn is valid.  This avoid the call to mfn_to_page() with an
    INVALID_MFN parameter.
    
    While there make the page local variable const, it's not modified by the
    function.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 45ee73f1b24246f13cd9583cb2ee25fb9c782db8
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/mm/shadow/private.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index a5fc3a7676..cef9dbef2e 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -512,13 +512,14 @@ static inline unsigned long __backpointer(const struct page_info *sp)
 static inline int
 sh_mfn_is_a_page_table(mfn_t gmfn)
 {
-    struct page_info *page = mfn_to_page(gmfn);
+    const struct page_info *page;
     struct domain *owner;
     unsigned long type_info;
 
     if ( !mfn_valid(gmfn) )
         return 0;
 
+    page = mfn_to_page(gmfn);
     owner = page_get_owner(page);
     if ( owner && shadow_mode_refcounts(owner)
          && (page->count_info & PGC_shadowed_pt) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:33:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929471.1332141 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoIO-0001F9-Gr; Thu, 27 Mar 2025 14:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929471.1332141; Thu, 27 Mar 2025 14:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoIO-0001F1-E1; Thu, 27 Mar 2025 14:33:24 +0000
Received: by outflank-mailman (input) for mailman id 929471;
 Thu, 27 Mar 2025 14:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoIM-0001Er-LY
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoIM-00Bpn6-23
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoIM-001mO5-1k
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v5Hk86rrqHTCYcu7yFu5YyDge9F9mnaErjzbMixBDco=; b=b37+wHMv7ZQ10yji88BFV68p/g
	Vpl37egdMsX/YKcs2OGJ1hLJDKV974yQGs68mB2oWnw4e7S6lqeeCCsUjwwNIpVRCgB4sxchgKlu7
	aZG7dhBUCstpoQVeW4fwnKx9nl1HQvpQJWV3yYupTVGvjo9+diYeKWYJ+vqbkLHHD3fo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
Message-Id: <E1txoIM-001mO5-1k@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:33:22 +0000

commit 1a2b76c9bc909021698f959059dc074710ecaf0b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:23:46 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:23:46 2025 +0100

    x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in common/compat/memory.c:90:9
    pointer operation overflowed ffff820080000000 to 0000020080000000
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0402a6259>] F compat_memory_op+0xf1/0x4d20
        [<ffff82d04041532d>] F hvm_memory_op+0x55/0xe0
        [<ffff82d040416150>] F hvm_hypercall+0xae8/0x21b0
        [<ffff82d0403b24ca>] F svm_vmexit_handler+0x1252/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Adjust the calculations in COMPAT_ARG_XLAT_VIRT_BASE to subtract from the
    per-domain area to obtain the mirrored linear address in the 4th slot,
    instead of overflowing the per-domain linear address.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: fc302866f42f552337ae7d8d78877aec36e6e2ff
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/include/asm/x86_64/uaccess.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/x86_64/uaccess.h b/xen/arch/x86/include/asm/x86_64/uaccess.h
index ba79f950fb..8b4528bc20 100644
--- a/xen/arch/x86/include/asm/x86_64/uaccess.h
+++ b/xen/arch/x86/include/asm/x86_64/uaccess.h
@@ -9,9 +9,9 @@
  * a secondary mapping installed, which needs to be used for such accesses in
  * the PV case, and will also be used for HVM to avoid extra conditionals.
  */
-#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) + \
-                                   (PERDOMAIN_ALT_VIRT_START - \
-                                    PERDOMAIN_VIRT_START))
+#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) - \
+                                   PERDOMAIN_VIRT_START + \
+                                   PERDOMAIN_ALT_VIRT_START)
 #define COMPAT_ARG_XLAT_SIZE      (2*PAGE_SIZE)
 struct vcpu;
 int setup_compat_arg_xlat(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:33:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929472.1332144 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoIY-0001IT-IS; Thu, 27 Mar 2025 14:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929472.1332144; Thu, 27 Mar 2025 14:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoIY-0001HP-FU; Thu, 27 Mar 2025 14:33:34 +0000
Received: by outflank-mailman (input) for mailman id 929472;
 Thu, 27 Mar 2025 14:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoIW-0001HA-OO
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoIW-00BpnD-2M
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoIW-001mPa-2D
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q7JEpcsiD3So88PkCt+oVxVil8RNXq2d4gMY5a5f+js=; b=11SJmQYmRI7IhgyMSUWdRMH0L5
	O1nKOvfqGVNfyhWSWpOekTtfiwJ0aRChjPztTbQFbUaEqIrr4Wn0SvYIr0lzg7FkI4LQ4xIEvFGfx
	Pw5NWBuFu+P93/TxJw4G5M794Z5tJIqD7cI7xPWhQdnq7reVyCJefRZP//XmpLEaHq7s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/vga: fix mapping of the VGA text buffer
Message-Id: <E1txoIW-001mPa-2D@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:33:32 +0000

commit d033cbdaaf4143a6c7d5358391e08d2bb62859da
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:24:13 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:24:13 2025 +0100

    x86/vga: fix mapping of the VGA text buffer
    
    The call to ioremap_wc() in video_init() will always fail, because
    video_init() is called ahead of vm_init_type(), and so the underlying
    __vmap() call will fail to allocate the linear address space.
    
    Fix by reverting to the previous behavior and use __va() for the VGA text
    buffer, as it's below the 1MB boundary, and thus always mapped in the
    directmap.
    
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1ca5f69e35548e5196eadb329e5a3976821dc982
    master date: 2025-03-20 17:16:10 +0100
---
 xen/drivers/video/vga.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/drivers/video/vga.c b/xen/drivers/video/vga.c
index 18b590cdf0..15c28a8f34 100644
--- a/xen/drivers/video/vga.c
+++ b/xen/drivers/video/vga.c
@@ -71,7 +71,7 @@ void __init video_init(void)
     {
     case XEN_VGATYPE_TEXT_MODE_3:
         if ( page_is_ram_type(paddr_to_pfn(0xB8000), RAM_TYPE_CONVENTIONAL) ||
-             ((video = ioremap_wc(0xB8000, 0x8000)) == NULL) )
+             ((video = __va(0xB8000)) == NULL) )
             return;
         outw(0x200a, 0x3d4); /* disable cursor */
         columns = vga_console_info.u.text_mode_3.columns;
@@ -158,7 +158,6 @@ void __init video_endboot(void)
         if ( !vgacon_keep )
         {
             memset(video, 0, columns * lines * 2);
-            iounmap(video);
             video = ZERO_BLOCK_PTR;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:33:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929473.1332147 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoIi-0001Kc-JZ; Thu, 27 Mar 2025 14:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929473.1332147; Thu, 27 Mar 2025 14:33:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoIi-0001KU-H0; Thu, 27 Mar 2025 14:33:44 +0000
Received: by outflank-mailman (input) for mailman id 929473;
 Thu, 27 Mar 2025 14:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoIg-0001KM-RT
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoIg-00BpnJ-2d
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoIg-001mQe-2X
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FWXEhWUIDCvKDvA5/wWOeNfNKOzfPAyzmQ5i6yyQiBA=; b=mMHPUM8nSYlVLdHjmnuh2LHQq3
	2tlNU8zbeQP5XCQFSZg3d7ue1wUbZcWb4clN0tZLztSYA/mocs6GY4w3RJYMzZGJ1nUF8BQTEmw2A
	g2l6Bk0+WyjvB0RWDbB4W0fP0QBscqusVj68BYO296BZcN9OdVLU94R4fU3pqy2iooxI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xen/compiler: Fix the position of the visibility pragma
Message-Id: <E1txoIg-001mQe-2X@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:33:42 +0000

commit bd3dc6b0c174fc0fe21b495b9e61bd44ac16b5ff
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:24:36 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:24:36 2025 +0100

    xen/compiler: Fix the position of the visibility pragma
    
    This needs to be ahead of everything.  Right now, it is after xen/init.h being
    included for -DINIT_SECTIONS_ONLY
    
      # 1 "./include/xen/compiler.h" 1
      # 83 "./include/xen/compiler.h"
      # 1 "./include/xen/init.h" 1
      # 62 "./include/xen/init.h"
      typedef int (*initcall_t)(void);
      typedef void (*exitcall_t)(void);
      # 72 "./include/xen/init.h"
      void do_presmp_initcalls(void);
      void do_initcalls(void);
      # 84 "./include/xen/compiler.h" 2
      # 122 "./include/xen/compiler.h"
      #pragma GCC visibility push(hidden)
    
    Fixes: 84c4461b7d3a ("Force out-of-line instances of inline functions into .init.text in init-only code")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: ab7ce0c8ed90f729a186babd87e3cd1fbed8ab98
    master date: 2025-03-21 11:52:39 +0000
---
 xen/include/xen/compiler.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index dd99e57308..dfffe53035 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -15,6 +15,11 @@
 # endif
 #endif
 
+#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
+/* Results in more efficient PIC code (no indirections through GOT or PLT). */
+#pragma GCC visibility push(hidden)
+#endif
+
 #define barrier()     __asm__ __volatile__("": : :"memory")
 
 #define likely(x)     __builtin_expect(!!(x),1)
@@ -125,11 +130,6 @@
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
 
-#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
-/* Results in more efficient PIC code (no indirections through GOT or PLT). */
-#pragma GCC visibility push(hidden)
-#endif
-
 /* Make the optimizer believe the variable can be manipulated arbitrarily. */
 #define OPTIMIZER_HIDE_VAR(var) __asm__ ( "" : "+g" (var) )
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:33:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929474.1332154 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoIs-0001OT-M1; Thu, 27 Mar 2025 14:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929474.1332154; Thu, 27 Mar 2025 14:33:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoIs-0001OL-IK; Thu, 27 Mar 2025 14:33:54 +0000
Received: by outflank-mailman (input) for mailman id 929474;
 Thu, 27 Mar 2025 14:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoIq-0001O4-Ua
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoIq-00BpnO-2x
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoIq-001mRi-2o
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PhnhpluKEFxpQHtFHPiskinYnaTfdvEzMfGV4S/F4VM=; b=Z4vB7szqujvc0jdrE8vYPjBBMA
	oFmXk2w4r1LqpKw0tJTU1Ddet/zbaD92CET7HIStXFlMTjDV4HFxpbEHbRudrJnFlhsS2tg5/F4n2
	a9fmVO1keCyTdeC9biWg/g7GcDK7LTSIkcu508b0vAv+25UkgilWfWBEuuBHhfphlLTk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/boot: Simplify the expression for extra allocation space
Message-Id: <E1txoIq-001mRi-2o@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:33:52 +0000

commit 311956bfeeabf5ee5fb9021195942d232021d54b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:24:43 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:24:43 2025 +0100

    x86/boot: Simplify the expression for extra allocation space
    
    The expression for one parameter of find_memory() is already complicated and
    about to become moreso.  Break it out into a new variable, and express it in
    an easier-to-follow way.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: ce703c84df1cb279605b0a85a45c6419464a16e8
    master date: 2025-03-21 11:52:39 +0000
---
 xen/arch/x86/hvm/dom0_build.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 411beb3f06..2a1bbd6929 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -540,6 +540,7 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
     unsigned long image_len = image->mod_end;
     struct elf_binary elf;
     struct elf_dom_parms parms;
+    size_t extra_space;
     paddr_t last_addr;
     struct hvm_start_info start_info = { 0 };
     struct hvm_modlist_entry mod = { 0 };
@@ -592,13 +593,16 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
      * split into smaller allocations, done as a single region in order to
      * simplify it.
      */
-    last_addr = find_memory(d, &elf, sizeof(start_info) +
-                            (initrd ? ROUNDUP(initrd->mod_end, PAGE_SIZE) +
-                                      sizeof(mod)
-                                    : 0) +
-                            (cmdline ? ROUNDUP(strlen(cmdline) + 1,
-                                               elf_64bit(&elf) ? 8 : 4)
-                                     : 0));
+    extra_space = sizeof(start_info);
+
+    if ( initrd )
+        extra_space += sizeof(mod) + ROUNDUP(initrd->mod_end, PAGE_SIZE);
+
+    if ( cmdline )
+        extra_space += ROUNDUP(strlen(cmdline) + 1,
+                               elf_64bit(&elf) ? 8 : 4);
+
+    last_addr = find_memory(d, &elf, extra_space);
     if ( last_addr == INVALID_PADDR )
     {
         printk("Unable to find a memory region to load initrd and metadata\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:34:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929475.1332156 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJ2-0001RU-MH; Thu, 27 Mar 2025 14:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929475.1332156; Thu, 27 Mar 2025 14:34:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJ2-0001RM-Jm; Thu, 27 Mar 2025 14:34:04 +0000
Received: by outflank-mailman (input) for mailman id 929475;
 Thu, 27 Mar 2025 14:34:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoJ1-0001RB-1I
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:34:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJ0-00BprA-3D
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJ0-001mTC-38
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:34:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kCH42wn8tQU1cv9ofKUHI7of0faC9q0HoYnQcxbtluY=; b=LeZNKvpt3P1emS/F0pm2inI5fX
	P1F7tS6nq21u0UVeUoyu1rHfjl9K/+DPuhDbbjTvZN/VqC82dA176vZ1ozM1Wv+QPNksn4MVXi2ol
	Eo63wP/2XygVfWWQggdNb37Em3AXC8xiMpJhFkqhI8Uvp8G6j7tLrfymB7sfv+Npjktw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
Message-Id: <E1txoJ0-001mTC-38@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:34:02 +0000

commit 204701a9488b6e19fbc22528aef3946590d0c2ad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:25:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:25:30 2025 +0100

    xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
    
    malloc(), when passed zero size, may return NULL (the behavior is
    implementation defined). Mirror the ->gov_num check to the other two
    allocations as well. Don't chance then actually using a NULL in
    print_cpufreq_para().
    
    Fixes: 75e06d089d48 ("xenpm: add cpu frequency control interface, through which user can")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: 6c0dc87bb0e08fb31a68bf4c4149a18b92628f14
    master date: 2025-03-26 12:30:57 +0100
---
 tools/misc/xenpm.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index d982482a3f..f6661851d4 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -827,8 +827,9 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
     }
     else
     {
-        printf("scaling_avail_gov    : %s\n",
-               p_cpufreq->scaling_available_governors);
+        if ( p_cpufreq->gov_num )
+            printf("scaling_avail_gov    : %s\n",
+                   p_cpufreq->scaling_available_governors);
 
         printf("current_governor     : %s\n", p_cpufreq->u.s.scaling_governor);
         if ( !strncmp(p_cpufreq->u.s.scaling_governor,
@@ -894,7 +895,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
         p_cpufreq->scaling_available_frequencies = NULL;
         p_cpufreq->scaling_available_governors = NULL;
 
-        if (!(p_cpufreq->affected_cpus =
+        if (p_cpufreq->cpu_num &&
+            !(p_cpufreq->affected_cpus =
               malloc(p_cpufreq->cpu_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
@@ -903,7 +905,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
             ret = -ENOMEM;
             goto out;
         }
-        if (!(p_cpufreq->scaling_available_frequencies =
+        if (p_cpufreq->freq_num &&
+            !(p_cpufreq->scaling_available_frequencies =
               malloc(p_cpufreq->freq_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:34:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929476.1332159 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJC-0001Tk-Ni; Thu, 27 Mar 2025 14:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929476.1332159; Thu, 27 Mar 2025 14:34:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJC-0001Tc-L9; Thu, 27 Mar 2025 14:34:14 +0000
Received: by outflank-mailman (input) for mailman id 929476;
 Thu, 27 Mar 2025 14:34:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoJB-0001TW-42
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:34:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJB-00BprX-0J
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJB-001mU8-0A
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:34:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RUB6YmdUt/N2GZyofqruby4+NtVuk//ZFzzxncmrTqo=; b=aPvBftWcoYFG7bQWVhqZoG484C
	lDWs2cA875ZELBiHp6nHO63U58C6v1UmJ3QBzBMnQKPqU7vk+MKQGnsF8a4OTTSdVoWUcshGmG+0g
	Jq98QCuuqJRZiXb3MXgkbZfytVjtybUx05pBKVPXcAGvaWS7VUZyvghEliICFUDu6X5A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/PVH: expose OEMx ACPI tables to Dom0
Message-Id: <E1txoJB-001mU8-0A@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:34:13 +0000

commit dd78223a3c102a94ea596e85de1fc2af767bf9af
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:25:39 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:25:39 2025 +0100

    x86/PVH: expose OEMx ACPI tables to Dom0
    
    What they contain we don't know, but we can't sensibly hide them. On my
    Skylake system OEM1 (with a description of "INTEL  CPU EIST") is what
    contains all the _PCT, _PPC, and _PSS methods, i.e. about everything
    needed for cpufreq. (_PSD interestingly are in an SSDT there.)
    
    Further OEM2 there has a description of "INTEL  CPU  HWP", while OEM4
    has "INTEL  CPU  CST". Pretty clearly all three need exposing for
    cpufreq and cpuidle to work.
    
    Fixes: 8b1a5268daf0 ("pvh/dom0: whitelist PVH Dom0 ACPI tables")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 6378909b41c40187a79df1d38ca4791b34393d67
    master date: 2025-03-26 12:32:03 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 2a1bbd6929..fe8eca28f0 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -892,12 +892,20 @@ static bool __init pvh_acpi_table_allowed(const char *sig,
             return true;
         else
         {
+    skip:
             printk("Skipping table %.4s in non-ACPI non-reserved region\n",
                    sig);
             return false;
         }
     }
 
+    if ( !strncmp(sig, "OEM", 3) )
+    {
+        if ( acpi_memory_banned(address, size) )
+            goto skip;
+        return true;
+    }
+
     return false;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:34:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:34:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929477.1332165 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJM-0001W5-Q2; Thu, 27 Mar 2025 14:34:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929477.1332165; Thu, 27 Mar 2025 14:34:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJM-0001Vv-Mc; Thu, 27 Mar 2025 14:34:24 +0000
Received: by outflank-mailman (input) for mailman id 929477;
 Thu, 27 Mar 2025 14:34:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoJL-0001Vh-6x
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:34:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJL-00Bprb-0a
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJL-001mV5-0U
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:34:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ix1EYxpvnKD4aR7MqQYcGOuRW7+H6x5fXaxH6M9faQw=; b=OEaXHIr540YW+e+8g30Hj4SmB1
	kGRpVAI+2VMIUjGpEjp3Uj9Ii1ZDcb5kJRJUSu8ogxPdKvBv0SOKARgmgKow1d9UJrRIInPqQLg/w
	IV90gCU6RmM4bfEIWs08MapubWgN4FqFdqMrIoa2iqHbjDATe3vfrNNTdo18ycGbCGdU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
Message-Id: <E1txoJL-001mV5-0U@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:34:23 +0000

commit 360d646efa9c75ac77cb8fda674c7594924a56bd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:25:48 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:25:48 2025 +0100

    x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
    
    In hvmemul_read_cr(), make the TRACE()/X86EMUL_OKAY path common in preparation
    for adding a %cr8 case.  Use a local 'val' variable instead of always
    operating on a deferenced pointer.
    
    In both, calculate curr once.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b7264a15c28d30bb994ec9e58eba38932be231ec
    master date: 2025-03-26 11:54:59 +0000
---
 xen/arch/x86/hvm/emulate.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index a447c7270e..705dcb2cfa 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2222,23 +2222,30 @@ static int cf_check hvmemul_write_io(
 
 static int cf_check hvmemul_read_cr(
     unsigned int reg,
-    unsigned long *val,
+    unsigned long *pval,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
+    unsigned long val;
+
     switch ( reg )
     {
     case 0:
     case 2:
     case 3:
     case 4:
-        *val = current->arch.hvm.guest_cr[reg];
-        HVMTRACE_LONG_2D(CR_READ, reg, TRC_PAR_LONG(*val));
-        return X86EMUL_OKAY;
-    default:
+        val = curr->arch.hvm.guest_cr[reg];
         break;
+
+    default:
+        return X86EMUL_UNHANDLEABLE;
     }
 
-    return X86EMUL_UNHANDLEABLE;
+    HVMTRACE_LONG_2D(CR_READ, reg, TRC_PAR_LONG(val));
+
+    *pval = val;
+
+    return X86EMUL_OKAY;
 }
 
 static int cf_check hvmemul_write_cr(
@@ -2246,6 +2253,7 @@ static int cf_check hvmemul_write_cr(
     unsigned long val,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
     int rc;
 
     HVMTRACE_LONG_2D(CR_WRITE, reg, TRC_PAR_LONG(val));
@@ -2256,13 +2264,13 @@ static int cf_check hvmemul_write_cr(
         break;
 
     case 2:
-        current->arch.hvm.guest_cr[2] = val;
+        curr->arch.hvm.guest_cr[2] = val;
         rc = X86EMUL_OKAY;
         break;
 
     case 3:
     {
-        bool noflush = hvm_pcid_enabled(current) && (val & X86_CR3_NOFLUSH);
+        bool noflush = hvm_pcid_enabled(curr) && (val & X86_CR3_NOFLUSH);
 
         if ( noflush )
             val &= ~X86_CR3_NOFLUSH;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:34:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:34:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929478.1332168 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJV-0001Z7-SM; Thu, 27 Mar 2025 14:34:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929478.1332168; Thu, 27 Mar 2025 14:34:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJV-0001Yz-Pl; Thu, 27 Mar 2025 14:34:33 +0000
Received: by outflank-mailman (input) for mailman id 929478;
 Thu, 27 Mar 2025 14:34:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoJV-0001Ys-9d
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:34:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJV-00Bpri-0r
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJV-001mWJ-0m
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:34:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+Jo0fVfeZzVQbV2A6js4zJ9FfYBjCF5LrwXhaM+egA4=; b=cLulRbPMtXLhuk7r2hYvXK6fM7
	8GjmrjWpgl3havhr/Xby8O54fW9dVUmwsXENybooOQ2YvIb4KsZVa5zu8R7H8otDCSp2uq1SI6Oyn
	Y5EkIM1JYJnhbFSaQ0UstmCz0fHlps06xekICHaIWS+1q54+71BdbPpa8yQw7E0Z64X0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/emul: Emulate %cr8 accesses
Message-Id: <E1txoJV-001mWJ-0m@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:34:33 +0000

commit 74071cb36ddeddddeecb23400ce67d5bd94c7208
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:26:09 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:26:09 2025 +0100

    x86/emul: Emulate %cr8 accesses
    
    Petr reports:
    
      (XEN) MMIO emulation failed (1): d12v1 64bit @ 0010:fffff8057ba7dfbf -> 45 0f 20 c2 ...
    
    during introspection.
    
    This is MOV %cr8, which is wired up for hvm_mov_{to,from}_cr(); the VMExit
    fastpaths, but not for the full emulation slowpaths.
    
    Xen's handling of %cr8 turns out to be quite wrong.  At a minimum, we need
    storage for %cr8 separate to APIC_TPR, and to alter intercepts based on
    whether the vLAPIC is enabled or not.  But that's more work than there is time
    for in the short term, so make a stopgap fix.
    
    Extend hvmemul_{read,write}_cr() with %cr8 cases.  Unlike hvm_mov_to_cr(),
    hardware hasn't filtered out invalid values (#GP checks are ahead of
    intercepts), so introduce X86_CR8_VALID_MASK.
    
    Reported-by: Petr Beneš <w1benny@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 14fd9b5642cd4805b49fbe716bf2cd577e724169
    master date: 2025-03-26 11:54:59 +0000
---
 xen/arch/x86/hvm/emulate.c           | 15 +++++++++++++++
 xen/arch/x86/include/asm/x86-defns.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 705dcb2cfa..2e6ebcbf36 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2237,6 +2237,10 @@ static int cf_check hvmemul_read_cr(
         val = curr->arch.hvm.guest_cr[reg];
         break;
 
+    case 8:
+        val = (vlapic_get_reg(vcpu_vlapic(curr), APIC_TASKPRI) & 0xf0) >> 4;
+        break;
+
     default:
         return X86EMUL_UNHANDLEABLE;
     }
@@ -2282,6 +2286,17 @@ static int cf_check hvmemul_write_cr(
         rc = hvm_set_cr4(val, true);
         break;
 
+    case 8:
+        if ( val & ~X86_CR8_VALID_MASK )
+        {
+            rc = X86EMUL_EXCEPTION;
+            break;
+        }
+
+        vlapic_set_reg(vcpu_vlapic(curr), APIC_TASKPRI, val << 4);
+        rc = X86EMUL_OKAY;
+        break;
+
     default:
         rc = X86EMUL_UNHANDLEABLE;
         break;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 4e4737d56c..968a975886 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -76,6 +76,8 @@
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
 
+#define X86_CR8_VALID_MASK 0xf
+
 /*
  * XSTATE component flags in XCR0
  */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:34:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:34:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929479.1332171 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJf-0001bY-Tu; Thu, 27 Mar 2025 14:34:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929479.1332171; Thu, 27 Mar 2025 14:34:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJf-0001bQ-RB; Thu, 27 Mar 2025 14:34:43 +0000
Received: by outflank-mailman (input) for mailman id 929479;
 Thu, 27 Mar 2025 14:34:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoJf-0001bK-CS
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:34:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJf-00Bpro-18
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJf-001mX6-12
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:34:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZaoqYftSYxcXI0GMgzwfGKI8cln9ieT7kMoeWC/zy4A=; b=TixwSMUz7/R9MpShIeSK1RwYD1
	UOUseScT9gDic4hMlFR1JvCeDgFoRlO4XHMCy/9yCw8wo/ezRpiuNLM3O+szyUL0opbXzOkD7jFGZ
	/gzh1oYjs3yqCk1C6uc9pEv7ptEELilIWMux+CnFW6ofIeTgEPFTh1lwPLtF/WEne0kA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/PVH: account for module command line length
Message-Id: <E1txoJf-001mX6-12@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:34:43 +0000

commit a2a336fbc95a26f1a6ce1e2e77cd18e0eb48d8c5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:26:37 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:26:37 2025 +0100

    x86/PVH: account for module command line length
    
    As per observation in practice, initrd->cmdline_pa is not normally zero.
    Hence so far we always appended at least one byte. That alone may
    already render insufficient the "allocation" made by find_memory().
    Things would be worse when there's actually a (perhaps long) command
    line.
    
    Skip setup when the command line is empty. Amend the "allocation" size
    by padding and actual size of module command line. Along these lines
    also skip initrd setup when the initrd is zero size.
    
    Fixes: 0ecb8eb09f9f ("x86/pvh: pass module command line to dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: 989584e532c9517a0f789e993f5f6744beaebe3e
    master date: 2025-03-27 12:21:08 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index fe8eca28f0..b4a843f62f 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -538,6 +538,7 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
 {
     void *image_start = image_base + image_headroom;
     unsigned long image_len = image->mod_end;
+    const char *initrd_cmdline = NULL;
     struct elf_binary elf;
     struct elf_dom_parms parms;
     size_t extra_space;
@@ -596,7 +597,23 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
     extra_space = sizeof(start_info);
 
     if ( initrd )
-        extra_space += sizeof(mod) + ROUNDUP(initrd->mod_end, PAGE_SIZE);
+    {
+        size_t initrd_space = elf_round_up(&elf, initrd->mod_end);
+
+        if ( initrd->string )
+        {
+            initrd_cmdline = __va(initrd->string);
+            if ( !*initrd_cmdline )
+                initrd_cmdline = NULL;
+        }
+        if ( initrd_cmdline )
+            initrd_space += strlen(initrd_cmdline) + 1;
+
+        if ( initrd_space )
+            extra_space += ROUNDUP(initrd_space, PAGE_SIZE) + sizeof(mod);
+        else
+            initrd = NULL;
+    }
 
     if ( cmdline )
         extra_space += ROUNDUP(strlen(cmdline) + 1,
@@ -621,13 +638,12 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
 
         mod.paddr = last_addr;
         mod.size = initrd->mod_end;
-        last_addr += ROUNDUP(initrd->mod_end, elf_64bit(&elf) ? 8 : 4);
-        if ( initrd->string )
+        last_addr += elf_round_up(&elf, initrd->mod_end);
+        if ( initrd_cmdline )
         {
-            char *str = __va(initrd->string);
-            size_t len = strlen(str) + 1;
+            size_t len = strlen(initrd_cmdline) + 1;
 
-            rc = hvm_copy_to_guest_phys(last_addr, str, len, v);
+            rc = hvm_copy_to_guest_phys(last_addr, initrd_cmdline, len, v);
             if ( rc )
             {
                 printk("Unable to copy module command line\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:34:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:34:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929480.1332175 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJp-0001dt-VL; Thu, 27 Mar 2025 14:34:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929480.1332175; Thu, 27 Mar 2025 14:34:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJp-0001dl-Sh; Thu, 27 Mar 2025 14:34:53 +0000
Received: by outflank-mailman (input) for mailman id 929480;
 Thu, 27 Mar 2025 14:34:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoJp-0001dd-Eu
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:34:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJp-00Bprs-1P
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJp-001mYb-1K
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:34:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7QhkVnRXLxNCDLN4uYS5WCLfVk/n+vDBkx4mblRYzRU=; b=krdSM3QgjqWgSkm9zczsfEtCXN
	vdS4ucO7BAO6QmW2FKnP9RNmi6stJar/7IKcQ8UUylwENfBeSIUauMTY5Gg5Uq18rUE7QwIp2um3u
	xdFDL+rEyggYttSz3cXmyVSN9kzUUvfo+ySBMDeyVFs2SwWlEkD4/m+eY5c9Z3tYEPPw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/pmstat: correct get_cpufreq_para()'s error return value
Message-Id: <E1txoJp-001mYb-1K@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:34:53 +0000

commit 38bde3bf911e6796ddd93578128eb8d1c32058d5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:26:52 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:26:52 2025 +0100

    x86/pmstat: correct get_cpufreq_para()'s error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 7542c4ff00f2 ("Add user PM control interface")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 855337ca4947508ffca23393e291c54b5307cc9a
    master date: 2025-03-27 12:22:06 +0100
---
 xen/drivers/acpi/pmstat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index 803971bdb0..9e82f06ee1 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -225,7 +225,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                        affected_cpus, op->u.get_para.cpu_num);
     xfree(affected_cpus);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     if ( !(scaling_available_frequencies =
            xzalloc_array(uint32_t, op->u.get_para.freq_num)) )
@@ -237,7 +237,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                    scaling_available_frequencies, op->u.get_para.freq_num);
     xfree(scaling_available_frequencies);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     op->u.get_para.cpuinfo_cur_freq =
         cpufreq_driver.get ? alternative_call(cpufreq_driver.get, op->cpuid)
@@ -273,7 +273,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                             gov_num * CPUFREQ_NAME_LEN);
         xfree(scaling_available_governors);
         if ( ret )
-            return ret;
+            return -EFAULT;
 
         op->u.get_para.u.s.scaling_cur_freq = policy->cur;
         op->u.get_para.u.s.scaling_max_freq = policy->max;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 14:35:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 14:35:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929481.1332180 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoK0-0001gc-0b; Thu, 27 Mar 2025 14:35:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929481.1332180; Thu, 27 Mar 2025 14:35:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoJz-0001gU-U7; Thu, 27 Mar 2025 14:35:03 +0000
Received: by outflank-mailman (input) for mailman id 929481;
 Thu, 27 Mar 2025 14:35:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoJz-0001gL-Hj
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 14:35:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJz-00BpsB-1g
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoJz-001mZc-1a
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 14:35:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XqC0hOZYBxz47pi9LJHmzOsKsaCbynRJ1d46oZibPtY=; b=BOB2QiH7Pd0Lxjvbk0cIh2ymeG
	6u8e2y6VfztNtMw0gKet9mpNeLdRDW4mH9ftniAfOyzIj+mGsK6b9pDeRku2pPHdRsvahjIGCxs65
	IEz974zFpervdmQJhNNebmuiMAkwk3GbDh//YDw9+0DTJcuQWjhGtcdiyIFx3/BUHx5w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
Message-Id: <E1txoJz-001mZc-1a@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 14:35:03 +0000

commit d2257148a7c940c4836afdaece66c566fb416a9b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:27:09 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:27:09 2025 +0100

    Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 86039f2e8c20 ("xen/arm: vpl011: Add a new domctl API to initialize vpl011")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 341c0df40bf73b0a5e27db27023ec400858a472d
    master date: 2025-03-27 12:22:39 +0100
---
 xen/arch/arm/domctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index ad56efb0f5..8e9851e560 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -171,8 +171,8 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
             break;
         }
 
-        if ( !rc )
-            rc = copy_to_guest(u_domctl, domctl, 1);
+        if ( !rc && copy_to_guest(u_domctl, domctl, 1) )
+            rc = -EFAULT;
 
         return rc;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:11:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929556.1332244 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txosp-0004tB-SP; Thu, 27 Mar 2025 15:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929556.1332244; Thu, 27 Mar 2025 15:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txosp-0004t3-Q4; Thu, 27 Mar 2025 15:11:03 +0000
Received: by outflank-mailman (input) for mailman id 929556;
 Thu, 27 Mar 2025 15:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoso-0004sr-HM
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoso-00BqoO-0d
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoso-001qfH-0K
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u/WvCmqDm22zIj5A28h1JnReCtf7j0LqulmBrC9zS3k=; b=nF3JI3hIjUMW2E0hWNCtzStlc9
	BYjNoUwHPVobyL0K+J/d8EbOIYC/1O+HdeVL2H+gKN4Xuuf5QZnjTCVa/4luWwPK/d+Kv5g9LIJ48
	dgbpTHVcV+IqOZdjBWUM29vBgXgiUzPex5si0AZmFYKsNE0uFosEdP1nBCY9O262CiI4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/mkelf32: account for offset when detecting note segment placement
Message-Id: <E1txoso-001qfH-0K@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:11:02 +0000

commit 8c788b41d7a8fa378f4d8b639955f01bb571809f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 14:55:29 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:55:29 2025 +0100

    x86/mkelf32: account for offset when detecting note segment placement
    
    mkelf32 attempt to check that the program header defined NOTE segment falls
    inside of the LOAD segment, as the build-id should be loaded for Xen at
    runtime to check.
    
    However the current code doesn't take into account the LOAD program header
    segment offset when calculating overlap with the NOTE segment.  This
    results in incorrect detection, and the following build error:
    
    arch/x86/boot/mkelf32 --notes xen-syms ./.xen.elf32 0x200000 \
                   `nm xen-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$/0x\1/p'`
    Expected .note section within .text section!
    Offset 4244776 not within 2910364!
    
    When xen-syms has the following program headers:
    
    Program Header:
        LOAD off    0x0000000000200000 vaddr 0xffff82d040200000 paddr 0x0000000000200000 align 2**21
             filesz 0x00000000002c689c memsz 0x00000000003f7e20 flags rwx
        NOTE off    0x000000000040c528 vaddr 0xffff82d04040c528 paddr 0x000000000040c528 align 2**2
             filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
    
    Account for the program header offset of the LOAD segment when checking
    whether the NOTE segments is contained within.  Also fix the logic to
    ensure the NOTE segments is fully contained between the LOAD segment.
    
    Fixes: a353cab905af ('build_id: Provide ld-embedded build-ids')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6e5fed7cb67c9f84653cdbd3924b8a119ef653be
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/boot/mkelf32.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 5f9e7e440e..f0f406687c 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -358,11 +358,13 @@ int main(int argc, char **argv)
         note_sz = in64_phdr.p_memsz;
         note_base = in64_phdr.p_vaddr - note_base;
 
-        if ( in64_phdr.p_offset > dat_siz || offset > in64_phdr.p_offset )
+        if ( in64_phdr.p_offset < offset ||
+             in64_phdr.p_offset + in64_phdr.p_filesz > offset + dat_siz )
         {
             fprintf(stderr, "Expected .note section within .text section!\n" \
-                    "Offset %"PRId64" not within %d!\n",
-                    in64_phdr.p_offset, dat_siz);
+                    ".note: [%"PRIx64", %"PRIx64") .text: [%x, %x)\n",
+                    in64_phdr.p_offset, in64_phdr.p_offset + in64_phdr.p_filesz,
+                    offset, offset + dat_siz);
             return 1;
         }
         /* Gets us the absolute offset within the .text section. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:11:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929557.1332248 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txosy-00051E-UO; Thu, 27 Mar 2025 15:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929557.1332248; Thu, 27 Mar 2025 15:11:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txosy-000513-RW; Thu, 27 Mar 2025 15:11:12 +0000
Received: by outflank-mailman (input) for mailman id 929557;
 Thu, 27 Mar 2025 15:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txosy-00050x-AD
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txosy-00BqoS-0v
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txosy-001qgF-0o
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8cKEcjWmmJ5+12/UIoZYaQkybuGJK+aCZViwd7C3Jdk=; b=IHjj53p/8QH3lGI9xEV45nQUXv
	UeLzLffLO8svnCAd8QQabLB362pT+nPZQetSDke6Ns1cW3zRzlaNZAvln0xzRwfby7RW3jJ4IoVJ3
	UjEfPRUEQK25d0YEzz4Mm5cT9xIMb4TTOWhGaKsJJyMQuTeJt7vNdYKhJb9rOxl61+g8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
Message-Id: <E1txosy-001qgF-0o@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:11:12 +0000

commit fbb06cfa739052ee243dc875e2641343b3fc029c
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 14:55:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:55:57 2025 +0100

    x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in arch/x86/mm/shadow/private.h:515:30
    pointer operation overflowed ffff82e000000000 to ffff82dfffffffe0
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d040471b2d>] F arch/x86/mm/shadow/guest_2.c#sh_page_fault__guest_2+0x1e350
        [<ffff82d0403b206b>] F svm_vmexit_handler+0xdf3/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Fix by moving the call to mfn_to_page() after the check of whether the
    passed gmfn is valid.  This avoid the call to mfn_to_page() with an
    INVALID_MFN parameter.
    
    While there make the page local variable const, it's not modified by the
    function.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 45ee73f1b24246f13cd9583cb2ee25fb9c782db8
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/mm/shadow/private.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index a5fc3a7676..cef9dbef2e 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -512,13 +512,14 @@ static inline unsigned long __backpointer(const struct page_info *sp)
 static inline int
 sh_mfn_is_a_page_table(mfn_t gmfn)
 {
-    struct page_info *page = mfn_to_page(gmfn);
+    const struct page_info *page;
     struct domain *owner;
     unsigned long type_info;
 
     if ( !mfn_valid(gmfn) )
         return 0;
 
+    page = mfn_to_page(gmfn);
     owner = page_get_owner(page);
     if ( owner && shadow_mode_refcounts(owner)
          && (page->count_info & PGC_shadowed_pt) )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:11:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929558.1332252 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txot9-0005K8-VV; Thu, 27 Mar 2025 15:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929558.1332252; Thu, 27 Mar 2025 15:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txot9-0005K0-Sx; Thu, 27 Mar 2025 15:11:23 +0000
Received: by outflank-mailman (input) for mailman id 929558;
 Thu, 27 Mar 2025 15:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txot8-0005Bo-Dc
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txot8-00Bqom-1D
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txot8-001qgy-16
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vTYeTWB9+e7e9llFyMgPyoT1GmzqThr1YdOeof6La8Y=; b=Mfp0tT6fvgkZ1m7uLiY8TnBwxU
	pmMbmH1geUvFdxIWvSKdzjukRTz1s6gBtEA58IuBePE87VIv/MHQ3qbJl/1KvMTfFj8Vad8CRA/Vn
	bQAhYoP+9XtkKZtqDIQoYONFi22jy+2HMpQXKSf0qzO6KIyvE0b5rkfvlIMdf27dspKc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
Message-Id: <E1txot8-001qgy-16@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:11:22 +0000

commit da36efa8521a2ba3cd8b63105fe92324776953f6
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 14:56:22 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:56:22 2025 +0100

    x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in common/compat/memory.c:90:9
    pointer operation overflowed ffff820080000000 to 0000020080000000
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0402a6259>] F compat_memory_op+0xf1/0x4d20
        [<ffff82d04041532d>] F hvm_memory_op+0x55/0xe0
        [<ffff82d040416150>] F hvm_hypercall+0xae8/0x21b0
        [<ffff82d0403b24ca>] F svm_vmexit_handler+0x1252/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Adjust the calculations in COMPAT_ARG_XLAT_VIRT_BASE to subtract from the
    per-domain area to obtain the mirrored linear address in the 4th slot,
    instead of overflowing the per-domain linear address.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: fc302866f42f552337ae7d8d78877aec36e6e2ff
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/include/asm/x86_64/uaccess.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/x86_64/uaccess.h b/xen/arch/x86/include/asm/x86_64/uaccess.h
index c6fa3fd381..9f515b2638 100644
--- a/xen/arch/x86/include/asm/x86_64/uaccess.h
+++ b/xen/arch/x86/include/asm/x86_64/uaccess.h
@@ -9,9 +9,9 @@
  * a secondary mapping installed, which needs to be used for such accesses in
  * the PV case, and will also be used for HVM to avoid extra conditionals.
  */
-#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) + \
-                                   (PERDOMAIN_ALT_VIRT_START - \
-                                    PERDOMAIN_VIRT_START))
+#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) - \
+                                   PERDOMAIN_VIRT_START + \
+                                   PERDOMAIN_ALT_VIRT_START)
 #define COMPAT_ARG_XLAT_SIZE      (2*PAGE_SIZE)
 struct vcpu;
 int setup_compat_arg_xlat(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:11:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929560.1332255 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txotK-0005Sl-2J; Thu, 27 Mar 2025 15:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929560.1332255; Thu, 27 Mar 2025 15:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txotJ-0005Sd-Vw; Thu, 27 Mar 2025 15:11:33 +0000
Received: by outflank-mailman (input) for mailman id 929560;
 Thu, 27 Mar 2025 15:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txotI-0005Ou-GZ
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txotI-00Bqot-1Z
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txotI-001qhb-1P
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sn/JEzAeotDRjJCDVaBXI7X0johu1xM2JV0R2Po/SY8=; b=m8mtt3oEiyPnX/vxe/eyGEIM3n
	J3CT5dgAYX5OZtkNEj2hKlBRu8/+uBG8YB9TDuRdEBBj0j8gP8drTfq3lGgMGs8xDPkcN3gYW/u2l
	XLJQS9wttg5xQQR/ofZI3j9UC2SgSzEGJ3ICf4D5Z5VtepFHTuXVEYq/CfBWyK4jqIfc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/vga: fix mapping of the VGA text buffer
Message-Id: <E1txotI-001qhb-1P@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:11:32 +0000

commit de440d0407d2a5b9f60333adb548eceb4b74d626
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 14:56:57 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:56:57 2025 +0100

    x86/vga: fix mapping of the VGA text buffer
    
    The call to ioremap_wc() in video_init() will always fail, because
    video_init() is called ahead of vm_init_type(), and so the underlying
    __vmap() call will fail to allocate the linear address space.
    
    Fix by reverting to the previous behavior and use __va() for the VGA text
    buffer, as it's below the 1MB boundary, and thus always mapped in the
    directmap.
    
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1ca5f69e35548e5196eadb329e5a3976821dc982
    master date: 2025-03-20 17:16:10 +0100
---
 xen/drivers/video/vga.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/drivers/video/vga.c b/xen/drivers/video/vga.c
index b4d0183261..b577b24619 100644
--- a/xen/drivers/video/vga.c
+++ b/xen/drivers/video/vga.c
@@ -71,7 +71,7 @@ void __init video_init(void)
     {
     case XEN_VGATYPE_TEXT_MODE_3:
         if ( page_is_ram_type(paddr_to_pfn(0xB8000), RAM_TYPE_CONVENTIONAL) ||
-             ((video = ioremap_wc(0xB8000, 0x8000)) == NULL) )
+             ((video = __va(0xB8000)) == NULL) )
             return;
         outw(0x200a, 0x3d4); /* disable cursor */
         columns = vga_console_info.u.text_mode_3.columns;
@@ -158,7 +158,6 @@ void __init video_endboot(void)
         if ( !vgacon_keep )
         {
             memset(video, 0, columns * lines * 2);
-            iounmap(video);
             video = ZERO_BLOCK_PTR;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:11:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929561.1332260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txotU-0005jv-3w; Thu, 27 Mar 2025 15:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929561.1332260; Thu, 27 Mar 2025 15:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txotU-0005jn-1E; Thu, 27 Mar 2025 15:11:44 +0000
Received: by outflank-mailman (input) for mailman id 929561;
 Thu, 27 Mar 2025 15:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txotS-0005jb-JZ
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txotS-00Bqox-1r
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txotS-001qia-1k
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KBYiiSjRB0DugVdzyrHLl2g0wQOQv32ipyZPEyhfkCQ=; b=YSIw1eO1B6LTv12MbVqC32DFib
	DEUEqVxTI+C2anGU2G15muBsN8jXCJY5Z4zc0sNwkkLeemkLN3brdNdNiTCcLvkMIE+Jn7nCGxipU
	5C5fiaZHNgj5Gubacl6Z19q5liHKYfYaqKevAR/U2RGIgtDTPXFcmY6BT0xVtQ/p9bBk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] xen/compiler: Fix the position of the visibility pragma
Message-Id: <E1txotS-001qia-1k@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:11:42 +0000

commit 859e2c4f846654e7966a2305fa17811a5d072c76
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 14:57:31 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:57:31 2025 +0100

    xen/compiler: Fix the position of the visibility pragma
    
    This needs to be ahead of everything.  Right now, it is after xen/init.h being
    included for -DINIT_SECTIONS_ONLY
    
      # 1 "./include/xen/compiler.h" 1
      # 83 "./include/xen/compiler.h"
      # 1 "./include/xen/init.h" 1
      # 62 "./include/xen/init.h"
      typedef int (*initcall_t)(void);
      typedef void (*exitcall_t)(void);
      # 72 "./include/xen/init.h"
      void do_presmp_initcalls(void);
      void do_initcalls(void);
      # 84 "./include/xen/compiler.h" 2
      # 122 "./include/xen/compiler.h"
      #pragma GCC visibility push(hidden)
    
    Fixes: 84c4461b7d3a ("Force out-of-line instances of inline functions into .init.text in init-only code")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: ab7ce0c8ed90f729a186babd87e3cd1fbed8ab98
    master date: 2025-03-21 11:52:39 +0000
---
 xen/include/xen/compiler.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index b118e4ba62..636a85bc41 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -15,6 +15,11 @@
 # endif
 #endif
 
+#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
+/* Results in more efficient PIC code (no indirections through GOT or PLT). */
+#pragma GCC visibility push(hidden)
+#endif
+
 #define barrier()     __asm__ __volatile__("": : :"memory")
 
 #define likely(x)     __builtin_expect(!!(x),1)
@@ -118,11 +123,6 @@
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
 
-#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
-/* Results in more efficient PIC code (no indirections through GOT or PLT). */
-#pragma GCC visibility push(hidden)
-#endif
-
 /* Make the optimizer believe the variable can be manipulated arbitrarily. */
 #define OPTIMIZER_HIDE_VAR(var) __asm__ ( "" : "+g" (var) )
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:11:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929562.1332264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txote-0005nn-5Y; Thu, 27 Mar 2025 15:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929562.1332264; Thu, 27 Mar 2025 15:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txote-0005ng-2d; Thu, 27 Mar 2025 15:11:54 +0000
Received: by outflank-mailman (input) for mailman id 929562;
 Thu, 27 Mar 2025 15:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txotc-0005nS-MW
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txotc-00Bqp3-29
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txotc-001qjI-22
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bomp+iuyFOoU/i92yhukuVUEgw6VBX4UT58WJIZnTTk=; b=aw9EQjfO2CGYc4Bt7iFSVyInzT
	ziivHNmiLaNePYQKos5KsZfvHD6WA9F/rU2+A7ks3E/hK1gbA4JKo+4Kvfy3V7ki4pHrw5em6rtxd
	7phmuOYeWiqbNbvR7a+hfkZvrhMqGmey5mbuBZJJ8k41ubBal7hleP/vR/QtPCQVyfc4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/boot: Simplify the expression for extra allocation space
Message-Id: <E1txotc-001qjI-22@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:11:52 +0000

commit 92afeb2961f03a514a7ae6e7c08818f6cdc0aa59
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 14:57:55 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:57:55 2025 +0100

    x86/boot: Simplify the expression for extra allocation space
    
    The expression for one parameter of find_memory() is already complicated and
    about to become moreso.  Break it out into a new variable, and express it in
    an easier-to-follow way.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: ce703c84df1cb279605b0a85a45c6419464a16e8
    master date: 2025-03-21 11:52:39 +0000
---
 xen/arch/x86/hvm/dom0_build.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 6a4453103a..6591949984 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -654,6 +654,7 @@ static int __init pvh_load_kernel(
     const char *cmdline = image->cmdline_pa ? __va(image->cmdline_pa) : NULL;
     struct elf_binary elf;
     struct elf_dom_parms parms;
+    size_t extra_space;
     paddr_t last_addr;
     struct hvm_start_info start_info = { 0 };
     struct hvm_modlist_entry mod = { 0 };
@@ -711,13 +712,16 @@ static int __init pvh_load_kernel(
      * split into smaller allocations, done as a single region in order to
      * simplify it.
      */
-    last_addr = find_memory(d, &elf, sizeof(start_info) +
-                            (initrd ? ROUNDUP(initrd_len, PAGE_SIZE) +
-                                      sizeof(mod)
-                                    : 0) +
-                            (cmdline ? ROUNDUP(strlen(cmdline) + 1,
-                                               elf_64bit(&elf) ? 8 : 4)
-                                     : 0));
+    extra_space = sizeof(start_info);
+
+    if ( initrd )
+        extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
+
+    if ( cmdline )
+        extra_space += ROUNDUP(strlen(cmdline) + 1,
+                               elf_64bit(&elf) ? 8 : 4);
+
+    last_addr = find_memory(d, &elf, extra_space);
     if ( last_addr == INVALID_PADDR )
     {
         printk("Unable to find a memory region to load initrd and metadata\n");
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:12:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929563.1332268 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoto-0005rg-6b; Thu, 27 Mar 2025 15:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929563.1332268; Thu, 27 Mar 2025 15:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoto-0005rX-42; Thu, 27 Mar 2025 15:12:04 +0000
Received: by outflank-mailman (input) for mailman id 929563;
 Thu, 27 Mar 2025 15:12:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txotm-0005rL-PQ
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txotm-00BqpQ-2R
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txotm-001qlD-2L
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3L3ric6NjCXzp9pkm7hpR38+zxt+oB1BjKLMur933fY=; b=auqJflujj0WrYNGa/ZnmTvbATg
	SiKmLFOpAkISTRqDMVNj5sWXtvJYfLga5wNv9QDeR+4SZ8RaxERpppbzQcrTCocRV9fe2+z7qAoG2
	eEFlXluDQi6nNnGy00Y6rdvF/yOFg7hRSzmZIvP1yl3gTZKkb084aICUOc33pZlYNvZU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
Message-Id: <E1txotm-001qlD-2L@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:12:02 +0000

commit fcbd016bd24c8d0ce14447db90352904cabe3688
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 14:58:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:58:51 2025 +0100

    xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
    
    malloc(), when passed zero size, may return NULL (the behavior is
    implementation defined). Mirror the ->gov_num check to the other two
    allocations as well. Don't chance then actually using a NULL in
    print_cpufreq_para().
    
    Fixes: 75e06d089d48 ("xenpm: add cpu frequency control interface, through which user can")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: 6c0dc87bb0e08fb31a68bf4c4149a18b92628f14
    master date: 2025-03-26 12:30:57 +0100
---
 tools/misc/xenpm.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index 336d246346..db658ebadd 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -840,8 +840,9 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
     }
     else
     {
-        printf("scaling_avail_gov    : %s\n",
-               p_cpufreq->scaling_available_governors);
+        if ( p_cpufreq->gov_num )
+            printf("scaling_avail_gov    : %s\n",
+                   p_cpufreq->scaling_available_governors);
 
         printf("current_governor     : %s\n", p_cpufreq->u.s.scaling_governor);
         if ( !strncmp(p_cpufreq->u.s.scaling_governor,
@@ -907,7 +908,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
         p_cpufreq->scaling_available_frequencies = NULL;
         p_cpufreq->scaling_available_governors = NULL;
 
-        if (!(p_cpufreq->affected_cpus =
+        if (p_cpufreq->cpu_num &&
+            !(p_cpufreq->affected_cpus =
               malloc(p_cpufreq->cpu_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
@@ -916,7 +918,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
             ret = -ENOMEM;
             goto out;
         }
-        if (!(p_cpufreq->scaling_available_frequencies =
+        if (p_cpufreq->freq_num &&
+            !(p_cpufreq->scaling_available_frequencies =
               malloc(p_cpufreq->freq_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:12:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929564.1332272 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoty-0005u5-84; Thu, 27 Mar 2025 15:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929564.1332272; Thu, 27 Mar 2025 15:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoty-0005tx-5R; Thu, 27 Mar 2025 15:12:14 +0000
Received: by outflank-mailman (input) for mailman id 929564;
 Thu, 27 Mar 2025 15:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txotw-0005tp-Us
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:12:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txotw-00BqpW-2z
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txotw-001qlx-2c
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A0K0oi/D4jFF8sSstLie1XQ4Y60GzPPVeeNsC5WGL44=; b=FYJFKVw0sTXdxsNVtM8w37nsLj
	6MeubMqWesDAx01JL6IXkXcp0BI4Iywx19sGOYGsq/TvsfGgNdBoKwx6IKQ07s2orMgfdsZa1Ebhv
	eC0o6TZxYllR5JJOv/1WVgAsuMUvd/sdJ3l9/MiM5V+CXo3CcBuA6aVx/hZxpqtEcZ8M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/PVH: expose OEMx ACPI tables to Dom0
Message-Id: <E1txotw-001qlx-2c@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:12:12 +0000

commit a1f8f1e6818848e1112e7835cdc4696131f8f0dd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 14:58:59 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:58:59 2025 +0100

    x86/PVH: expose OEMx ACPI tables to Dom0
    
    What they contain we don't know, but we can't sensibly hide them. On my
    Skylake system OEM1 (with a description of "INTEL  CPU EIST") is what
    contains all the _PCT, _PPC, and _PSS methods, i.e. about everything
    needed for cpufreq. (_PSD interestingly are in an SSDT there.)
    
    Further OEM2 there has a description of "INTEL  CPU  HWP", while OEM4
    has "INTEL  CPU  CST". Pretty clearly all three need exposing for
    cpufreq and cpuidle to work.
    
    Fixes: 8b1a5268daf0 ("pvh/dom0: whitelist PVH Dom0 ACPI tables")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 6378909b41c40187a79df1d38ca4791b34393d67
    master date: 2025-03-26 12:32:03 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 6591949984..60c56e126d 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1011,12 +1011,20 @@ static bool __init pvh_acpi_table_allowed(const char *sig,
             return true;
         else
         {
+    skip:
             printk("Skipping table %.4s in non-ACPI non-reserved region\n",
                    sig);
             return false;
         }
     }
 
+    if ( !strncmp(sig, "OEM", 3) )
+    {
+        if ( acpi_memory_banned(address, size) )
+            goto skip;
+        return true;
+    }
+
     return false;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:12:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929565.1332276 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txou8-0005wK-9T; Thu, 27 Mar 2025 15:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929565.1332276; Thu, 27 Mar 2025 15:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txou8-0005wC-6n; Thu, 27 Mar 2025 15:12:24 +0000
Received: by outflank-mailman (input) for mailman id 929565;
 Thu, 27 Mar 2025 15:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txou7-0005vx-1E
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txou7-00Bqq3-01
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txou6-001qn7-3B
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:12:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eLx5JzE6MYnigAQlSM3Isq4J9f5f1BmV7tolXt23Gss=; b=6BNMNZUyTK9xbJq+4F2vkzTsCT
	81cwbOtMAFzwpasCo0hHvp0cqRDdqS/MdpF8nZeJApwkfDhsEYMkt9DHT5gwvnR6fQfrwctZlWPY+
	NHo6TycDTzdc9zEB6GwraYiAqKA8jqb0Jv5LV7/wfKAZ6GTiDsv0Al0LbHtjNnMa4L4k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
Message-Id: <E1txou6-001qn7-3B@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:12:22 +0000

commit 990a3d8710ec7d2270ac65cc073b82f8f2925d4f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 14:59:36 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:59:36 2025 +0100

    x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
    
    In hvmemul_read_cr(), make the TRACE()/X86EMUL_OKAY path common in preparation
    for adding a %cr8 case.  Use a local 'val' variable instead of always
    operating on a deferenced pointer.
    
    In both, calculate curr once.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b7264a15c28d30bb994ec9e58eba38932be231ec
    master date: 2025-03-26 11:54:59 +0000
---
 xen/arch/x86/hvm/emulate.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 3cd7f2e22f..02698e93a1 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2293,23 +2293,30 @@ static int cf_check hvmemul_write_io(
 
 static int cf_check hvmemul_read_cr(
     unsigned int reg,
-    unsigned long *val,
+    unsigned long *pval,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
+    unsigned long val;
+
     switch ( reg )
     {
     case 0:
     case 2:
     case 3:
     case 4:
-        *val = current->arch.hvm.guest_cr[reg];
-        TRACE(TRC_HVM_CR_READ64, reg, *val, *val >> 32);
-        return X86EMUL_OKAY;
-    default:
+        val = curr->arch.hvm.guest_cr[reg];
         break;
+
+    default:
+        return X86EMUL_UNHANDLEABLE;
     }
 
-    return X86EMUL_UNHANDLEABLE;
+    TRACE(TRC_HVM_CR_READ64, reg, val, val >> 32);
+
+    *pval = val;
+
+    return X86EMUL_OKAY;
 }
 
 static int cf_check hvmemul_write_cr(
@@ -2317,6 +2324,7 @@ static int cf_check hvmemul_write_cr(
     unsigned long val,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
     int rc;
 
     TRACE(TRC_HVM_CR_WRITE64, reg, val, val >> 32);
@@ -2327,13 +2335,13 @@ static int cf_check hvmemul_write_cr(
         break;
 
     case 2:
-        current->arch.hvm.guest_cr[2] = val;
+        curr->arch.hvm.guest_cr[2] = val;
         rc = X86EMUL_OKAY;
         break;
 
     case 3:
     {
-        bool noflush = hvm_pcid_enabled(current) && (val & X86_CR3_NOFLUSH);
+        bool noflush = hvm_pcid_enabled(curr) && (val & X86_CR3_NOFLUSH);
 
         if ( noflush )
             val &= ~X86_CR3_NOFLUSH;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:12:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929566.1332279 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txouI-0005ys-Ah; Thu, 27 Mar 2025 15:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929566.1332279; Thu, 27 Mar 2025 15:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txouI-0005yl-8D; Thu, 27 Mar 2025 15:12:34 +0000
Received: by outflank-mailman (input) for mailman id 929566;
 Thu, 27 Mar 2025 15:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txouH-0005ya-3v
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txouH-00BqqA-0J
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txouH-001qnr-0D
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=m+W7Hj4bEGKrL6utCidA52uKK/XGtNheWiLIImYbzw4=; b=IggyP9o2av/7l7/t6ebuLAg4BV
	1+jesfr56iAjcBPniHfy4c3HO6UZoyObF3jq34Ec8YMlPCi8gR9xNMiOPLxpEsv8I+CUlx56wbh8f
	j94Wdr/h3cz2QUuq2yImT89XfsnDYnackw6jVt+QYyOoSSaDI7Y/j2rd8DKqZs3dUk3k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/emul: Emulate %cr8 accesses
Message-Id: <E1txouH-001qnr-0D@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:12:33 +0000

commit f14c523da1eeba708d93b8a65b88efdd94f2984e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 14:59:58 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 14:59:58 2025 +0100

    x86/emul: Emulate %cr8 accesses
    
    Petr reports:
    
      (XEN) MMIO emulation failed (1): d12v1 64bit @ 0010:fffff8057ba7dfbf -> 45 0f 20 c2 ...
    
    during introspection.
    
    This is MOV %cr8, which is wired up for hvm_mov_{to,from}_cr(); the VMExit
    fastpaths, but not for the full emulation slowpaths.
    
    Xen's handling of %cr8 turns out to be quite wrong.  At a minimum, we need
    storage for %cr8 separate to APIC_TPR, and to alter intercepts based on
    whether the vLAPIC is enabled or not.  But that's more work than there is time
    for in the short term, so make a stopgap fix.
    
    Extend hvmemul_{read,write}_cr() with %cr8 cases.  Unlike hvm_mov_to_cr(),
    hardware hasn't filtered out invalid values (#GP checks are ahead of
    intercepts), so introduce X86_CR8_VALID_MASK.
    
    Reported-by: Petr Beneš <w1benny@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 14fd9b5642cd4805b49fbe716bf2cd577e724169
    master date: 2025-03-26 11:54:59 +0000
---
 xen/arch/x86/hvm/emulate.c           | 15 +++++++++++++++
 xen/arch/x86/include/asm/x86-defns.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 02698e93a1..23e436d7db 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2308,6 +2308,10 @@ static int cf_check hvmemul_read_cr(
         val = curr->arch.hvm.guest_cr[reg];
         break;
 
+    case 8:
+        val = (vlapic_get_reg(vcpu_vlapic(curr), APIC_TASKPRI) & 0xf0) >> 4;
+        break;
+
     default:
         return X86EMUL_UNHANDLEABLE;
     }
@@ -2353,6 +2357,17 @@ static int cf_check hvmemul_write_cr(
         rc = hvm_set_cr4(val, true);
         break;
 
+    case 8:
+        if ( val & ~X86_CR8_VALID_MASK )
+        {
+            rc = X86EMUL_EXCEPTION;
+            break;
+        }
+
+        vlapic_set_reg(vcpu_vlapic(curr), APIC_TASKPRI, val << 4);
+        rc = X86EMUL_OKAY;
+        break;
+
     default:
         rc = X86EMUL_UNHANDLEABLE;
         break;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 2493ec277f..8afa9826a3 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -76,6 +76,8 @@
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
 
+#define X86_CR8_VALID_MASK 0xf
+
 /*
  * XSTATE component flags in XCR0 | MSR_XSS
  */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:12:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929567.1332284 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txouS-00061s-Di; Thu, 27 Mar 2025 15:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929567.1332284; Thu, 27 Mar 2025 15:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txouS-00061k-Ax; Thu, 27 Mar 2025 15:12:44 +0000
Received: by outflank-mailman (input) for mailman id 929567;
 Thu, 27 Mar 2025 15:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txouR-00061a-7F
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txouR-00BqqV-0c
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txouR-001qrG-0U
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HWWS1LKf135WtQPzVjkstlbNzgligE6025D9oF93D7Y=; b=bfjQVBZ9UyIohiCQt1DPfbjfDV
	LKGBDFfA+JYgav31QxyfFvqBIvEl9nuLBAec+/ZXKl6yHG993mhUQebYkZc87gNXnixsm8s685k0U
	ENjXRJeBzFnXPyT4f7XPHNPwS6CaAnNfh/cjlL1RHyoWgXNeGzmMnVGmOY4le+p2MOsE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/PVH: account for module command line length
Message-Id: <E1txouR-001qrG-0U@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:12:43 +0000

commit 108fcc6a73022b242d08faa625e744aa9dbd11d5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:00:36 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:00:36 2025 +0100

    x86/PVH: account for module command line length
    
    As per observation in practice, initrd->cmdline_pa is not normally zero.
    Hence so far we always appended at least one byte. That alone may
    already render insufficient the "allocation" made by find_memory().
    Things would be worse when there's actually a (perhaps long) command
    line.
    
    Skip setup when the command line is empty. Amend the "allocation" size
    by padding and actual size of module command line. Along these lines
    also skip initrd setup when the initrd is zero size.
    
    Fixes: 0ecb8eb09f9f ("x86/pvh: pass module command line to dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: 989584e532c9517a0f789e993f5f6744beaebe3e
    master date: 2025-03-27 12:21:08 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 60c56e126d..7551cbe167 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -652,6 +652,7 @@ static int __init pvh_load_kernel(
     unsigned long image_len = image->size;
     unsigned long initrd_len = initrd ? initrd->size : 0;
     const char *cmdline = image->cmdline_pa ? __va(image->cmdline_pa) : NULL;
+    const char *initrd_cmdline = NULL;
     struct elf_binary elf;
     struct elf_dom_parms parms;
     size_t extra_space;
@@ -715,7 +716,23 @@ static int __init pvh_load_kernel(
     extra_space = sizeof(start_info);
 
     if ( initrd )
-        extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
+    {
+        size_t initrd_space = elf_round_up(&elf, initrd_len);
+
+        if ( initrd->cmdline_pa )
+        {
+            initrd_cmdline = __va(initrd->cmdline_pa);
+            if ( !*initrd_cmdline )
+                initrd_cmdline = NULL;
+        }
+        if ( initrd_cmdline )
+            initrd_space += strlen(initrd_cmdline) + 1;
+
+        if ( initrd_space )
+            extra_space += ROUNDUP(initrd_space, PAGE_SIZE) + sizeof(mod);
+        else
+            initrd = NULL;
+    }
 
     if ( cmdline )
         extra_space += ROUNDUP(strlen(cmdline) + 1,
@@ -740,13 +757,12 @@ static int __init pvh_load_kernel(
 
         mod.paddr = last_addr;
         mod.size = initrd_len;
-        last_addr += ROUNDUP(initrd_len, elf_64bit(&elf) ? 8 : 4);
-        if ( initrd->cmdline_pa )
+        last_addr += elf_round_up(&elf, initrd_len);
+        if ( initrd_cmdline )
         {
-            char *str = __va(initrd->cmdline_pa);
-            size_t len = strlen(str) + 1;
+            size_t len = strlen(initrd_cmdline) + 1;
 
-            rc = hvm_copy_to_guest_phys(last_addr, str, len, v);
+            rc = hvm_copy_to_guest_phys(last_addr, initrd_cmdline, len, v);
             if ( rc )
             {
                 printk("Unable to copy module command line\n");
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:12:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:12:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929568.1332287 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txouc-00064j-Eu; Thu, 27 Mar 2025 15:12:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929568.1332287; Thu, 27 Mar 2025 15:12:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txouc-00064b-CK; Thu, 27 Mar 2025 15:12:54 +0000
Received: by outflank-mailman (input) for mailman id 929568;
 Thu, 27 Mar 2025 15:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoub-00064R-BV
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoub-00Bqqs-13
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoub-001qs1-0n
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d1Bjyre5UOLI3ALfi0LJi3zdsISFimupftQjQ1ZicJ0=; b=QVOrWi5j/BQ7KnbqS4XltKIadY
	gQ2oNr7S6fXPRnLIOxTQF4PLPlSOhjVBLImWmU6dwK+POqMlq2uhPIKBWpm/EIm/RAbACsm0t3U2c
	AbGqz64TZGgppJTHItVBoMIKKqUFzXR3QYquQEC9ibDY8G2l1kRvw7uVfJnxnE0L+w0w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] x86/pmstat: correct get_cpufreq_para()'s error return value
Message-Id: <E1txoub-001qs1-0n@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:12:53 +0000

commit 52c99f4b4303c21878a6bddc5cf1f9bf464a280e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:00:50 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:00:50 2025 +0100

    x86/pmstat: correct get_cpufreq_para()'s error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 7542c4ff00f2 ("Add user PM control interface")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 855337ca4947508ffca23393e291c54b5307cc9a
    master date: 2025-03-27 12:22:06 +0100
---
 xen/drivers/acpi/pmstat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index df309e27b4..b6ea19d103 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -227,7 +227,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                        affected_cpus, op->u.get_para.cpu_num);
     xfree(affected_cpus);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     if ( !(scaling_available_frequencies =
            xzalloc_array(uint32_t, op->u.get_para.freq_num)) )
@@ -239,7 +239,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                    scaling_available_frequencies, op->u.get_para.freq_num);
     xfree(scaling_available_frequencies);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     op->u.get_para.cpuinfo_cur_freq =
         cpufreq_driver.get ? alternative_call(cpufreq_driver.get, op->cpuid)
@@ -276,7 +276,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                             gov_num * CPUFREQ_NAME_LEN);
         xfree(scaling_available_governors);
         if ( ret )
-            return ret;
+            return -EFAULT;
 
         op->u.get_para.u.s.scaling_cur_freq = policy->cur;
         op->u.get_para.u.s.scaling_max_freq = policy->max;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:13:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:13:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929569.1332292 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoum-00067p-GA; Thu, 27 Mar 2025 15:13:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929569.1332292; Thu, 27 Mar 2025 15:13:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txoum-00067h-Df; Thu, 27 Mar 2025 15:13:04 +0000
Received: by outflank-mailman (input) for mailman id 929569;
 Thu, 27 Mar 2025 15:13:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txoul-00067W-Dw
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:13:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoul-00BqrU-1I
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txoul-001qt6-1D
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=87V9hCy6N+5d6gcxm1/ZokmKEvbVpsWEBYE5Zx0N3kg=; b=kbfa9ujViF28VH1sitk87W+9nW
	dHZIzidxVNHB/sktAxdrNmyqLPrbJUekN2Qvky4fHKleF7Unw+tBVJ0ElVMtY2pXX+NR1w8BWjpJQ
	ZV5iL4PgdQimvL7+8p7+o3wfiBQvolqCO4r9r04z8Pb1Me4WzZB1ABZQUPwJg6Fx4l4I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
Message-Id: <E1txoul-001qt6-1D@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:13:03 +0000

commit a2cf6f9d5275073c08f5778371dd2f04c6e744f8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:01:18 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:01:18 2025 +0100

    Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 86039f2e8c20 ("xen/arm: vpl011: Add a new domctl API to initialize vpl011")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 341c0df40bf73b0a5e27db27023ec400858a472d
    master date: 2025-03-27 12:22:39 +0100
---
 xen/arch/arm/domctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index 9d047065ba..ad914c915f 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -172,8 +172,8 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
             break;
         }
 
-        if ( !rc )
-            rc = copy_to_guest(u_domctl, domctl, 1);
+        if ( !rc && copy_to_guest(u_domctl, domctl, 1) )
+            rc = -EFAULT;
 
         return rc;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:55:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929660.1332375 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpZP-0002n6-2A; Thu, 27 Mar 2025 15:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929660.1332375; Thu, 27 Mar 2025 15:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpZO-0002mz-Vq; Thu, 27 Mar 2025 15:55:02 +0000
Received: by outflank-mailman (input) for mailman id 929660;
 Thu, 27 Mar 2025 15:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpZO-0002ll-0h
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpZN-00BrsP-2r
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpZN-001wHK-2k
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p+mZcLGItHr8FjRy1v/YzwWga8oueqBhmli5NAWDOVc=; b=hTduxZMFCk4soDYFTbNoiqXmm/
	8egfBaLaAWWicz5bVMUEF1u8F3YgMyFwH0bulyCQZrxKZLolh4q6SWosmNOqVW8LVdVujeDkLdSnG
	qJxRUmi5+owLcIVT1Z6Z/GnVEWo28+36/8EKxoFhZO8rvu/WVVSpUFUaHa9wzyZUxB5k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/mkelf32: account for offset when detecting note segment placement
Message-Id: <E1txpZN-001wHK-2k@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:55:01 +0000

commit ed87d5f1bf2bc75e057f59c7c67c5f52401bdd47
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:02:20 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:02:20 2025 +0100

    x86/mkelf32: account for offset when detecting note segment placement
    
    mkelf32 attempt to check that the program header defined NOTE segment falls
    inside of the LOAD segment, as the build-id should be loaded for Xen at
    runtime to check.
    
    However the current code doesn't take into account the LOAD program header
    segment offset when calculating overlap with the NOTE segment.  This
    results in incorrect detection, and the following build error:
    
    arch/x86/boot/mkelf32 --notes xen-syms ./.xen.elf32 0x200000 \
                   `nm xen-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$/0x\1/p'`
    Expected .note section within .text section!
    Offset 4244776 not within 2910364!
    
    When xen-syms has the following program headers:
    
    Program Header:
        LOAD off    0x0000000000200000 vaddr 0xffff82d040200000 paddr 0x0000000000200000 align 2**21
             filesz 0x00000000002c689c memsz 0x00000000003f7e20 flags rwx
        NOTE off    0x000000000040c528 vaddr 0xffff82d04040c528 paddr 0x000000000040c528 align 2**2
             filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
    
    Account for the program header offset of the LOAD segment when checking
    whether the NOTE segments is contained within.  Also fix the logic to
    ensure the NOTE segments is fully contained between the LOAD segment.
    
    Fixes: a353cab905af ('build_id: Provide ld-embedded build-ids')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6e5fed7cb67c9f84653cdbd3924b8a119ef653be
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/boot/mkelf32.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 3d639c2e08..7b90338ca8 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -366,11 +366,13 @@ int main(int argc, char **argv)
         note_sz = in64_phdr.p_memsz;
         note_base = in64_phdr.p_vaddr - note_base;
 
-        if ( in64_phdr.p_offset > dat_siz || offset > in64_phdr.p_offset )
+        if ( in64_phdr.p_offset < offset ||
+             in64_phdr.p_offset + in64_phdr.p_filesz > offset + dat_siz )
         {
             fprintf(stderr, "Expected .note section within .text section!\n" \
-                    "Offset %"PRId64" not within %d!\n",
-                    in64_phdr.p_offset, dat_siz);
+                    ".note: [%"PRIx64", %"PRIx64") .text: [%x, %x)\n",
+                    in64_phdr.p_offset, in64_phdr.p_offset + in64_phdr.p_filesz,
+                    offset, offset + dat_siz);
             return 1;
         }
         /* Gets us the absolute offset within the .text section. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929661.1332379 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpZZ-0002pU-3d; Thu, 27 Mar 2025 15:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929661.1332379; Thu, 27 Mar 2025 15:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpZZ-0002pM-13; Thu, 27 Mar 2025 15:55:13 +0000
Received: by outflank-mailman (input) for mailman id 929661;
 Thu, 27 Mar 2025 15:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpZY-0002p4-0J
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpZX-00Brsg-39
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpZX-001wHv-32
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EYrlsxUuJr48j4AIR+XjM3suyScHsgISncOYZ3jFMWU=; b=qiF5kD1pFok5Uv2BzN36ltu/zC
	WJkaVWyT5Mb3BlzFwQ5uxbzwBlmKAvksqfBlFTqBbZWcVW6xHk5utKb5qxlQ+lYt9rTMNzjh0toNi
	bz4Rj1/IM8JFBJKqYIysdEg/CFC4xhSvh32a6xQpjCsdsoDG22CPJMdJOOPcaju2qWrI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
Message-Id: <E1txpZX-001wHv-32@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:55:11 +0000

commit b3a9e6d6fe9c1596dd31c039b529a66cd00b303a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:02:28 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:02:28 2025 +0100

    x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in arch/x86/mm/shadow/private.h:515:30
    pointer operation overflowed ffff82e000000000 to ffff82dfffffffe0
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d040471b2d>] F arch/x86/mm/shadow/guest_2.c#sh_page_fault__guest_2+0x1e350
        [<ffff82d0403b206b>] F svm_vmexit_handler+0xdf3/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Fix by moving the call to mfn_to_page() after the check of whether the
    passed gmfn is valid.  This avoid the call to mfn_to_page() with an
    INVALID_MFN parameter.
    
    While there make the page local variable const, it's not modified by the
    function.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 45ee73f1b24246f13cd9583cb2ee25fb9c782db8
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/mm/shadow/private.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index a5fc3a7676..cef9dbef2e 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -512,13 +512,14 @@ static inline unsigned long __backpointer(const struct page_info *sp)
 static inline int
 sh_mfn_is_a_page_table(mfn_t gmfn)
 {
-    struct page_info *page = mfn_to_page(gmfn);
+    const struct page_info *page;
     struct domain *owner;
     unsigned long type_info;
 
     if ( !mfn_valid(gmfn) )
         return 0;
 
+    page = mfn_to_page(gmfn);
     owner = page_get_owner(page);
     if ( owner && shadow_mode_refcounts(owner)
          && (page->count_info & PGC_shadowed_pt) )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929662.1332383 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpZj-0002sZ-58; Thu, 27 Mar 2025 15:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929662.1332383; Thu, 27 Mar 2025 15:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpZj-0002sR-2R; Thu, 27 Mar 2025 15:55:23 +0000
Received: by outflank-mailman (input) for mailman id 929662;
 Thu, 27 Mar 2025 15:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpZi-0002s1-3g
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpZi-00Brt0-0E
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpZi-001wIZ-06
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bgB1oDUJ7VrP6PRMEUMmA0yg+qmFPHdcoHSfBaeFoes=; b=37nWH37hAzCiEy40GLf3pQkihi
	aJb1zPsBhJxj38rEYU6d9a5nWZRmYQFl0KA7V5WW5TJSK+HHdkfhomD2r4Y1eHKM2cr8SffmMcyZL
	4kBEbDpYbWyt9qtfpD1t/0//x5ZZgP+ABJ/CPI7VF/vPcj8fsplkVoMSChbCkOHOW8I4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
Message-Id: <E1txpZi-001wIZ-06@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:55:22 +0000

commit 11ad7d71610c3d3fc5edd545d05a6328cdba235f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:02:49 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:02:49 2025 +0100

    x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in common/compat/memory.c:90:9
    pointer operation overflowed ffff820080000000 to 0000020080000000
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0402a6259>] F compat_memory_op+0xf1/0x4d20
        [<ffff82d04041532d>] F hvm_memory_op+0x55/0xe0
        [<ffff82d040416150>] F hvm_hypercall+0xae8/0x21b0
        [<ffff82d0403b24ca>] F svm_vmexit_handler+0x1252/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Adjust the calculations in COMPAT_ARG_XLAT_VIRT_BASE to subtract from the
    per-domain area to obtain the mirrored linear address in the 4th slot,
    instead of overflowing the per-domain linear address.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: fc302866f42f552337ae7d8d78877aec36e6e2ff
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/include/asm/x86_64/uaccess.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/x86_64/uaccess.h b/xen/arch/x86/include/asm/x86_64/uaccess.h
index c6fa3fd381..9f515b2638 100644
--- a/xen/arch/x86/include/asm/x86_64/uaccess.h
+++ b/xen/arch/x86/include/asm/x86_64/uaccess.h
@@ -9,9 +9,9 @@
  * a secondary mapping installed, which needs to be used for such accesses in
  * the PV case, and will also be used for HVM to avoid extra conditionals.
  */
-#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) + \
-                                   (PERDOMAIN_ALT_VIRT_START - \
-                                    PERDOMAIN_VIRT_START))
+#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) - \
+                                   PERDOMAIN_VIRT_START + \
+                                   PERDOMAIN_ALT_VIRT_START)
 #define COMPAT_ARG_XLAT_SIZE      (2*PAGE_SIZE)
 struct vcpu;
 int setup_compat_arg_xlat(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:55:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929663.1332388 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpZt-0002vC-6J; Thu, 27 Mar 2025 15:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929663.1332388; Thu, 27 Mar 2025 15:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpZt-0002v4-3m; Thu, 27 Mar 2025 15:55:33 +0000
Received: by outflank-mailman (input) for mailman id 929663;
 Thu, 27 Mar 2025 15:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpZs-0002up-6O
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpZs-00Brt4-0V
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpZs-001wJk-0O
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1rPNvkNuKoXvp2Jq6WGL8GehGLblipWMBqbX2PLy8Ss=; b=SU4NxlZrq0piV4FLQOOxUwddNR
	3FB1Iz1LNeX0dQU6uPqRwaBeaQVzkzMdNykGRWx5QcZ6guKB9wAFyN4x+A2Qu2NJtuLJJkYErLllu
	bGE6ZeqVrmqU9ICAcxuUDl+uK6PEab+VmY0OpMxm/YoG+7TXc2l17iIoKdTPgS16YvMc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/vga: fix mapping of the VGA text buffer
Message-Id: <E1txpZs-001wJk-0O@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:55:32 +0000

commit e9a46d5fe5deaa91be4931d25f1ffc1ee4dc4d19
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:03:20 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:03:20 2025 +0100

    x86/vga: fix mapping of the VGA text buffer
    
    The call to ioremap_wc() in video_init() will always fail, because
    video_init() is called ahead of vm_init_type(), and so the underlying
    __vmap() call will fail to allocate the linear address space.
    
    Fix by reverting to the previous behavior and use __va() for the VGA text
    buffer, as it's below the 1MB boundary, and thus always mapped in the
    directmap.
    
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1ca5f69e35548e5196eadb329e5a3976821dc982
    master date: 2025-03-20 17:16:10 +0100
---
 xen/drivers/video/vga.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/drivers/video/vga.c b/xen/drivers/video/vga.c
index b4d0183261..b577b24619 100644
--- a/xen/drivers/video/vga.c
+++ b/xen/drivers/video/vga.c
@@ -71,7 +71,7 @@ void __init video_init(void)
     {
     case XEN_VGATYPE_TEXT_MODE_3:
         if ( page_is_ram_type(paddr_to_pfn(0xB8000), RAM_TYPE_CONVENTIONAL) ||
-             ((video = ioremap_wc(0xB8000, 0x8000)) == NULL) )
+             ((video = __va(0xB8000)) == NULL) )
             return;
         outw(0x200a, 0x3d4); /* disable cursor */
         columns = vga_console_info.u.text_mode_3.columns;
@@ -158,7 +158,6 @@ void __init video_endboot(void)
         if ( !vgacon_keep )
         {
             memset(video, 0, columns * lines * 2);
-            iounmap(video);
             video = ZERO_BLOCK_PTR;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:55:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929664.1332391 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpa3-0002yE-8y; Thu, 27 Mar 2025 15:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929664.1332391; Thu, 27 Mar 2025 15:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpa3-0002y6-6V; Thu, 27 Mar 2025 15:55:43 +0000
Received: by outflank-mailman (input) for mailman id 929664;
 Thu, 27 Mar 2025 15:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpa2-0002xx-8f
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpa2-00BrtK-0l
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpa2-001wKr-0f
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=z1Zb9sNCQZjKVGZ/fBa8DOojwXfG0Rcn+QDRciPCz/k=; b=okefFiEiqMHacnhNwwImn3376y
	nQIgKJGhZ3ZgRy7bvHEqm7kFP7lkKWTZoeurKKZKvuh61E0DLO8wRCNZRdoTCDX4gwMbgfLuK6xsn
	FCGGDpEQ/uagO5X8wRai4EkUCQlwDF1xiJn+5Iv1mhaMO5kNBiB8rdOati8eOn3ojbtQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/compiler: Fix the position of the visibility pragma
Message-Id: <E1txpa2-001wKr-0f@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:55:42 +0000

commit 3aca2a93c0538cd31eab4ea9c4eaa7c4c5804f87
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:03:56 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:03:56 2025 +0100

    xen/compiler: Fix the position of the visibility pragma
    
    This needs to be ahead of everything.  Right now, it is after xen/init.h being
    included for -DINIT_SECTIONS_ONLY
    
      # 1 "./include/xen/compiler.h" 1
      # 83 "./include/xen/compiler.h"
      # 1 "./include/xen/init.h" 1
      # 62 "./include/xen/init.h"
      typedef int (*initcall_t)(void);
      typedef void (*exitcall_t)(void);
      # 72 "./include/xen/init.h"
      void do_presmp_initcalls(void);
      void do_initcalls(void);
      # 84 "./include/xen/compiler.h" 2
      # 122 "./include/xen/compiler.h"
      #pragma GCC visibility push(hidden)
    
    Fixes: 84c4461b7d3a ("Force out-of-line instances of inline functions into .init.text in init-only code")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: ab7ce0c8ed90f729a186babd87e3cd1fbed8ab98
    master date: 2025-03-21 11:52:39 +0000
---
 xen/include/xen/compiler.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 444bf80142..c8a143151b 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -15,6 +15,11 @@
 # endif
 #endif
 
+#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
+/* Results in more efficient PIC code (no indirections through GOT or PLT). */
+#pragma GCC visibility push(hidden)
+#endif
+
 #define barrier()     __asm__ __volatile__("": : :"memory")
 
 #define likely(x)     __builtin_expect(!!(x),1)
@@ -118,11 +123,6 @@
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
 
-#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
-/* Results in more efficient PIC code (no indirections through GOT or PLT). */
-#pragma GCC visibility push(hidden)
-#endif
-
 /* Make the optimizer believe the variable can be manipulated arbitrarily. */
 #define OPTIMIZER_HIDE_VAR(var) __asm__ ( "" : "+g" (var) )
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:55:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929665.1332396 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpaD-00030T-Al; Thu, 27 Mar 2025 15:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929665.1332396; Thu, 27 Mar 2025 15:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpaD-00030K-7w; Thu, 27 Mar 2025 15:55:53 +0000
Received: by outflank-mailman (input) for mailman id 929665;
 Thu, 27 Mar 2025 15:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpaC-000306-BU
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpaC-00BrtQ-12
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpaC-001wLu-0w
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H02XShv/fWLv935IagMiladE94GC38rpsLzZymse5vQ=; b=bDCwNqD6qsdGpwaZIycN2mE2BE
	LPlNfFhn5VjXERoLejjfLUoczPYdLs7KINSzkoWLf9OyqEDKyJwWSzFRcw91wPp65UTNJVKWsTbZf
	vHUfD0aF84zDJC3DoqovaQWSQkYsf9MWd+j0kh61l4q4MAnbN0BB6tecmorVCKGV8lFM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/boot: Simplify the expression for extra allocation space
Message-Id: <E1txpaC-001wLu-0w@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:55:52 +0000

commit c1f70e216ca9a05b537d23781fa45ce837e26685
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:04:03 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:04:03 2025 +0100

    x86/boot: Simplify the expression for extra allocation space
    
    The expression for one parameter of find_memory() is already complicated and
    about to become moreso.  Break it out into a new variable, and express it in
    an easier-to-follow way.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: ce703c84df1cb279605b0a85a45c6419464a16e8
    master date: 2025-03-21 11:52:39 +0000
---
 xen/arch/x86/hvm/dom0_build.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 81445d5b37..716879b710 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -653,6 +653,7 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
     unsigned long initrd_len = initrd ? initrd->mod_end : 0;
     struct elf_binary elf;
     struct elf_dom_parms parms;
+    size_t extra_space;
     paddr_t last_addr;
     struct hvm_start_info start_info = { 0 };
     struct hvm_modlist_entry mod = { 0 };
@@ -710,13 +711,16 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
      * split into smaller allocations, done as a single region in order to
      * simplify it.
      */
-    last_addr = find_memory(d, &elf, sizeof(start_info) +
-                            (initrd ? ROUNDUP(initrd_len, PAGE_SIZE) +
-                                      sizeof(mod)
-                                    : 0) +
-                            (cmdline ? ROUNDUP(strlen(cmdline) + 1,
-                                               elf_64bit(&elf) ? 8 : 4)
-                                     : 0));
+    extra_space = sizeof(start_info);
+
+    if ( initrd )
+        extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
+
+    if ( cmdline )
+        extra_space += ROUNDUP(strlen(cmdline) + 1,
+                               elf_64bit(&elf) ? 8 : 4);
+
+    last_addr = find_memory(d, &elf, extra_space);
     if ( last_addr == INVALID_PADDR )
     {
         printk("Unable to find a memory region to load initrd and metadata\n");
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:56:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929666.1332402 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpaN-00033a-Cu; Thu, 27 Mar 2025 15:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929666.1332402; Thu, 27 Mar 2025 15:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpaN-00033S-9H; Thu, 27 Mar 2025 15:56:03 +0000
Received: by outflank-mailman (input) for mailman id 929666;
 Thu, 27 Mar 2025 15:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpaM-000338-E3
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpaM-00Brth-1J
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpaM-001wN4-1D
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cf1dFj47GL29l3GXh8DSYe0Ua3NPoqysoMUQYeL306Y=; b=Gmd5jhmTEj7kV/9fNvRGrb+9sV
	gTe+15VdK+CdBpNn+r9lOYI53ZpaP3CsdsCDQ7P6W0qnRCX2XgMmcnvGhzxeC+zRge6LywO/FB2nR
	OZvzOjIv5zMl4VF5V5tADMrSa9LLLixFP4Xbfs4xlF9mTSds/HFWFBg9TUAz9DN5OcPc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
Message-Id: <E1txpaM-001wN4-1D@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:56:02 +0000

commit 748be9a974d95056763828bbb2572fdbc7b71ef7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:04:48 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:04:48 2025 +0100

    xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
    
    malloc(), when passed zero size, may return NULL (the behavior is
    implementation defined). Mirror the ->gov_num check to the other two
    allocations as well. Don't chance then actually using a NULL in
    print_cpufreq_para().
    
    Fixes: 75e06d089d48 ("xenpm: add cpu frequency control interface, through which user can")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: 6c0dc87bb0e08fb31a68bf4c4149a18b92628f14
    master date: 2025-03-26 12:30:57 +0100
---
 tools/misc/xenpm.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index 336d246346..db658ebadd 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -840,8 +840,9 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
     }
     else
     {
-        printf("scaling_avail_gov    : %s\n",
-               p_cpufreq->scaling_available_governors);
+        if ( p_cpufreq->gov_num )
+            printf("scaling_avail_gov    : %s\n",
+                   p_cpufreq->scaling_available_governors);
 
         printf("current_governor     : %s\n", p_cpufreq->u.s.scaling_governor);
         if ( !strncmp(p_cpufreq->u.s.scaling_governor,
@@ -907,7 +908,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
         p_cpufreq->scaling_available_frequencies = NULL;
         p_cpufreq->scaling_available_governors = NULL;
 
-        if (!(p_cpufreq->affected_cpus =
+        if (p_cpufreq->cpu_num &&
+            !(p_cpufreq->affected_cpus =
               malloc(p_cpufreq->cpu_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
@@ -916,7 +918,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
             ret = -ENOMEM;
             goto out;
         }
-        if (!(p_cpufreq->scaling_available_frequencies =
+        if (p_cpufreq->freq_num &&
+            !(p_cpufreq->scaling_available_frequencies =
               malloc(p_cpufreq->freq_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:56:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:56:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929667.1332403 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpaX-00036P-DK; Thu, 27 Mar 2025 15:56:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929667.1332403; Thu, 27 Mar 2025 15:56:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpaX-00036I-Ai; Thu, 27 Mar 2025 15:56:13 +0000
Received: by outflank-mailman (input) for mailman id 929667;
 Thu, 27 Mar 2025 15:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpaW-00036C-Gw
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpaW-00Brtn-1a
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpaW-001wOD-1U
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+m+eD+uHg2C4CXHy8x0PP2JL6sbth83BEXpY5r2kKXg=; b=Jbc6L2M32xN0xzEORrIeECdMbY
	BvSLNyeWvzWDwOLomEf9MVKw95gK9jMFwoQ9Y9pYobjLRndwkETXP8hvmIYC6+7WiRhenoFmFC5Ha
	IIAiaCsHYCQlSUH4gWQemMYQ4vAEmYpX6dFamYU71NsVy3oF2kDThOvyt6lZIUYGfvJY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/PVH: expose OEMx ACPI tables to Dom0
Message-Id: <E1txpaW-001wOD-1U@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:56:12 +0000

commit c9f077bc4107728a41b88acdbcee90dad9901aa6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:05:11 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:05:11 2025 +0100

    x86/PVH: expose OEMx ACPI tables to Dom0
    
    What they contain we don't know, but we can't sensibly hide them. On my
    Skylake system OEM1 (with a description of "INTEL  CPU EIST") is what
    contains all the _PCT, _PPC, and _PSS methods, i.e. about everything
    needed for cpufreq. (_PSD interestingly are in an SSDT there.)
    
    Further OEM2 there has a description of "INTEL  CPU  HWP", while OEM4
    has "INTEL  CPU  CST". Pretty clearly all three need exposing for
    cpufreq and cpuidle to work.
    
    Fixes: 8b1a5268daf0 ("pvh/dom0: whitelist PVH Dom0 ACPI tables")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 6378909b41c40187a79df1d38ca4791b34393d67
    master date: 2025-03-26 12:32:03 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 716879b710..4a094ae317 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1010,12 +1010,20 @@ static bool __init pvh_acpi_table_allowed(const char *sig,
             return true;
         else
         {
+    skip:
             printk("Skipping table %.4s in non-ACPI non-reserved region\n",
                    sig);
             return false;
         }
     }
 
+    if ( !strncmp(sig, "OEM", 3) )
+    {
+        if ( acpi_memory_banned(address, size) )
+            goto skip;
+        return true;
+    }
+
     return false;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:56:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:56:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929668.1332407 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpah-00038u-Ek; Thu, 27 Mar 2025 15:56:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929668.1332407; Thu, 27 Mar 2025 15:56:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpah-00038m-CG; Thu, 27 Mar 2025 15:56:23 +0000
Received: by outflank-mailman (input) for mailman id 929668;
 Thu, 27 Mar 2025 15:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpag-00038c-JW
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpag-00BruA-1r
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpag-001wOm-1m
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F1YE10S6dtUMiEiL/+B2PxBManiUrPLKf7Tgth6bYn8=; b=GOlnMlteKWyovVQ/N7a823cBkZ
	Skt0pOVh5LZcHstZfwOMBSKu/2gov1Qnz1CLWctt7dFSm9egIM01vSHFEzbaD2C4U46/OiLgF1VrF
	8+BMk5q4Rinm2dyrHCpazNJmtKvfNJkYUUhy7rN2JjEHfG4rK1Pc0SeHhZANTopGdEzY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
Message-Id: <E1txpag-001wOm-1m@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:56:22 +0000

commit 7ef9a36a68ca966562564f9a971670651e51d14b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:05:35 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:05:35 2025 +0100

    x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
    
    In hvmemul_read_cr(), make the TRACE()/X86EMUL_OKAY path common in preparation
    for adding a %cr8 case.  Use a local 'val' variable instead of always
    operating on a deferenced pointer.
    
    In both, calculate curr once.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b7264a15c28d30bb994ec9e58eba38932be231ec
    master date: 2025-03-26 11:54:59 +0000
---
 xen/arch/x86/hvm/emulate.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index abc4f5f261..cb071be586 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2294,23 +2294,30 @@ static int cf_check hvmemul_write_io(
 
 static int cf_check hvmemul_read_cr(
     unsigned int reg,
-    unsigned long *val,
+    unsigned long *pval,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
+    unsigned long val;
+
     switch ( reg )
     {
     case 0:
     case 2:
     case 3:
     case 4:
-        *val = current->arch.hvm.guest_cr[reg];
-        TRACE(TRC_HVM_CR_READ64, reg, *val, *val >> 32);
-        return X86EMUL_OKAY;
-    default:
+        val = curr->arch.hvm.guest_cr[reg];
         break;
+
+    default:
+        return X86EMUL_UNHANDLEABLE;
     }
 
-    return X86EMUL_UNHANDLEABLE;
+    TRACE(TRC_HVM_CR_READ64, reg, val, val >> 32);
+
+    *pval = val;
+
+    return X86EMUL_OKAY;
 }
 
 static int cf_check hvmemul_write_cr(
@@ -2318,6 +2325,7 @@ static int cf_check hvmemul_write_cr(
     unsigned long val,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
     int rc;
 
     TRACE(TRC_HVM_CR_WRITE64, reg, val, val >> 32);
@@ -2328,13 +2336,13 @@ static int cf_check hvmemul_write_cr(
         break;
 
     case 2:
-        current->arch.hvm.guest_cr[2] = val;
+        curr->arch.hvm.guest_cr[2] = val;
         rc = X86EMUL_OKAY;
         break;
 
     case 3:
     {
-        bool noflush = hvm_pcid_enabled(current) && (val & X86_CR3_NOFLUSH);
+        bool noflush = hvm_pcid_enabled(curr) && (val & X86_CR3_NOFLUSH);
 
         if ( noflush )
             val &= ~X86_CR3_NOFLUSH;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:56:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:56:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929669.1332412 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpar-0003BP-GF; Thu, 27 Mar 2025 15:56:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929669.1332412; Thu, 27 Mar 2025 15:56:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpar-0003BH-Di; Thu, 27 Mar 2025 15:56:33 +0000
Received: by outflank-mailman (input) for mailman id 929669;
 Thu, 27 Mar 2025 15:56:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpaq-0003B7-Mb
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpaq-00Bruj-28
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpaq-001wPh-23
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nAlIhjTGh71LGiDt0+cPO+BucpIuQzT0zHyZTgGNkuQ=; b=FX3qKChORTs6Tv6iGmN4DAKpRq
	0PgEHL5sHRiKYdFfDTE/99bGR7iEBoicTXXy7mZKG9P0OWbpaN4Mutt8EZ0YKv5vFaf4fxu5HW9K4
	wF1oJSJKUHJWve6iLCy2EpGYHaohvWkmKqeWOzhIwAqofYsTNubvl5cXSFQg4lla5P+Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/emul: Emulate %cr8 accesses
Message-Id: <E1txpaq-001wPh-23@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:56:32 +0000

commit d74241aae512c0711405b1844c45d95206d4f6e6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:06:09 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:06:09 2025 +0100

    x86/emul: Emulate %cr8 accesses
    
    Petr reports:
    
      (XEN) MMIO emulation failed (1): d12v1 64bit @ 0010:fffff8057ba7dfbf -> 45 0f 20 c2 ...
    
    during introspection.
    
    This is MOV %cr8, which is wired up for hvm_mov_{to,from}_cr(); the VMExit
    fastpaths, but not for the full emulation slowpaths.
    
    Xen's handling of %cr8 turns out to be quite wrong.  At a minimum, we need
    storage for %cr8 separate to APIC_TPR, and to alter intercepts based on
    whether the vLAPIC is enabled or not.  But that's more work than there is time
    for in the short term, so make a stopgap fix.
    
    Extend hvmemul_{read,write}_cr() with %cr8 cases.  Unlike hvm_mov_to_cr(),
    hardware hasn't filtered out invalid values (#GP checks are ahead of
    intercepts), so introduce X86_CR8_VALID_MASK.
    
    Reported-by: Petr Beneš <w1benny@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 14fd9b5642cd4805b49fbe716bf2cd577e724169
    master date: 2025-03-26 11:54:59 +0000
---
 xen/arch/x86/hvm/emulate.c           | 15 +++++++++++++++
 xen/arch/x86/include/asm/x86-defns.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index cb071be586..f4b9352c39 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2309,6 +2309,10 @@ static int cf_check hvmemul_read_cr(
         val = curr->arch.hvm.guest_cr[reg];
         break;
 
+    case 8:
+        val = (vlapic_get_reg(vcpu_vlapic(curr), APIC_TASKPRI) & 0xf0) >> 4;
+        break;
+
     default:
         return X86EMUL_UNHANDLEABLE;
     }
@@ -2354,6 +2358,17 @@ static int cf_check hvmemul_write_cr(
         rc = hvm_set_cr4(val, true);
         break;
 
+    case 8:
+        if ( val & ~X86_CR8_VALID_MASK )
+        {
+            rc = X86EMUL_EXCEPTION;
+            break;
+        }
+
+        vlapic_set_reg(vcpu_vlapic(curr), APIC_TASKPRI, val << 4);
+        rc = X86EMUL_OKAY;
+        break;
+
     default:
         rc = X86EMUL_UNHANDLEABLE;
         break;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index caa92829ea..64af953898 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -76,6 +76,8 @@
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
 
+#define X86_CR8_VALID_MASK 0xf
+
 /*
  * XSTATE component flags in XCR0 | MSR_XSS
  */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:56:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:56:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929670.1332416 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpb1-0003Dt-I4; Thu, 27 Mar 2025 15:56:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929670.1332416; Thu, 27 Mar 2025 15:56:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpb1-0003Dl-F8; Thu, 27 Mar 2025 15:56:43 +0000
Received: by outflank-mailman (input) for mailman id 929670;
 Thu, 27 Mar 2025 15:56:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpb0-0003Df-P5
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:56:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpb0-00Brun-2P
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:56:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpb0-001wQI-2J
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:56:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZTxQ8SdmY8iEEey4t/GDe1Ydw7uQ3FiKT4rGOqSccFY=; b=hUNZHZ0Nz5JznWTQzyqQ8ENIWb
	yExhpGlN3FKW1ixh1NlwpNzNe+R+zG02m+BJqojZXxFt2HTXQDU9oAFtV4dInnzKeRzN+9Pd5XU2/
	28A0qvfQVOB1vJJdhWKlSrtPFHdNuhu9jrh/k4IoKyVRbtMFwEKOEPRngoaQIzWLhPp8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/PVH: account for module command line length
Message-Id: <E1txpb0-001wQI-2J@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:56:42 +0000

commit 43e1996c02d2c810920577574aefe6dfdb19f5ad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:06:33 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:06:33 2025 +0100

    x86/PVH: account for module command line length
    
    As per observation in practice, initrd->cmdline_pa is not normally zero.
    Hence so far we always appended at least one byte. That alone may
    already render insufficient the "allocation" made by find_memory().
    Things would be worse when there's actually a (perhaps long) command
    line.
    
    Skip setup when the command line is empty. Amend the "allocation" size
    by padding and actual size of module command line. Along these lines
    also skip initrd setup when the initrd is zero size.
    
    Fixes: 0ecb8eb09f9f ("x86/pvh: pass module command line to dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: 989584e532c9517a0f789e993f5f6744beaebe3e
    master date: 2025-03-27 12:21:08 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 4a094ae317..2b4505ebbf 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -651,6 +651,7 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
     void *image_start = image_base + image_headroom;
     unsigned long image_len = image->mod_end;
     unsigned long initrd_len = initrd ? initrd->mod_end : 0;
+    const char *initrd_cmdline = NULL;
     struct elf_binary elf;
     struct elf_dom_parms parms;
     size_t extra_space;
@@ -714,7 +715,23 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
     extra_space = sizeof(start_info);
 
     if ( initrd )
-        extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
+    {
+        size_t initrd_space = elf_round_up(&elf, initrd_len);
+
+        if ( initrd->string )
+        {
+            initrd_cmdline = __va(initrd->string);
+            if ( !*initrd_cmdline )
+                initrd_cmdline = NULL;
+        }
+        if ( initrd_cmdline )
+            initrd_space += strlen(initrd_cmdline) + 1;
+
+        if ( initrd_space )
+            extra_space += ROUNDUP(initrd_space, PAGE_SIZE) + sizeof(mod);
+        else
+            initrd = NULL;
+    }
 
     if ( cmdline )
         extra_space += ROUNDUP(strlen(cmdline) + 1,
@@ -739,13 +756,12 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
 
         mod.paddr = last_addr;
         mod.size = initrd_len;
-        last_addr += ROUNDUP(initrd_len, elf_64bit(&elf) ? 8 : 4);
-        if ( initrd->string )
+        last_addr += elf_round_up(&elf, initrd_len);
+        if ( initrd_cmdline )
         {
-            char *str = __va(initrd->string);
-            size_t len = strlen(str) + 1;
+            size_t len = strlen(initrd_cmdline) + 1;
 
-            rc = hvm_copy_to_guest_phys(last_addr, str, len, v);
+            rc = hvm_copy_to_guest_phys(last_addr, initrd_cmdline, len, v);
             if ( rc )
             {
                 printk("Unable to copy module command line\n");
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:56:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:56:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929671.1332420 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpbB-0003Gy-Km; Thu, 27 Mar 2025 15:56:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929671.1332420; Thu, 27 Mar 2025 15:56:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpbB-0003Gq-I1; Thu, 27 Mar 2025 15:56:53 +0000
Received: by outflank-mailman (input) for mailman id 929671;
 Thu, 27 Mar 2025 15:56:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpbA-0003Gk-Rm
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:56:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpbA-00Brut-2g
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:56:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpbA-001wSv-2b
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:56:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=koUZLaegArq4COspoCrvGVGucr9w2k8aD8ZLfBvYUMY=; b=WDL1ywjksZx0PcoLKDLEJpmskQ
	a4zmeTKWn70zWUowwff0d1Jat6bUXnhEOMyLKvLtn8UwJ+JKEUyP9p/Swwx91qV6JFY4mEbi5L8GU
	d1yWNlh+irUld+4aEe3E8wYPoa9Sl/+X1sVD3WyoIL4YoDmFVixyfkZlzTEThxjXv1tw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/pmstat: correct get_cpufreq_para()'s error return value
Message-Id: <E1txpbA-001wSv-2b@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:56:52 +0000

commit 46da7056e4a043a995b733357219a38b50c25911
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:06:45 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:06:45 2025 +0100

    x86/pmstat: correct get_cpufreq_para()'s error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 7542c4ff00f2 ("Add user PM control interface")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 855337ca4947508ffca23393e291c54b5307cc9a
    master date: 2025-03-27 12:22:06 +0100
---
 xen/drivers/acpi/pmstat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index 998d2e3c65..f607bc110f 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -227,7 +227,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                        affected_cpus, op->u.get_para.cpu_num);
     xfree(affected_cpus);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     if ( !(scaling_available_frequencies =
            xzalloc_array(uint32_t, op->u.get_para.freq_num)) )
@@ -239,7 +239,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                    scaling_available_frequencies, op->u.get_para.freq_num);
     xfree(scaling_available_frequencies);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     op->u.get_para.cpuinfo_cur_freq =
         cpufreq_driver.get ? alternative_call(cpufreq_driver.get, op->cpuid)
@@ -275,7 +275,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                             gov_num * CPUFREQ_NAME_LEN);
         xfree(scaling_available_governors);
         if ( ret )
-            return ret;
+            return -EFAULT;
 
         op->u.get_para.u.s.scaling_cur_freq = policy->cur;
         op->u.get_para.u.s.scaling_max_freq = policy->max;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 15:57:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 15:57:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929672.1332424 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpbL-0003Jc-Lu; Thu, 27 Mar 2025 15:57:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929672.1332424; Thu, 27 Mar 2025 15:57:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txpbL-0003JU-JJ; Thu, 27 Mar 2025 15:57:03 +0000
Received: by outflank-mailman (input) for mailman id 929672;
 Thu, 27 Mar 2025 15:57:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txpbK-0003JO-UL
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 15:57:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpbK-00BrvG-2w
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:57:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txpbK-001wTc-2r
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 15:57:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/fZPEPGJPvTyf2W1jVx6x0diHNV0Nr5ZEwanU0mfAcY=; b=Spt9b/xtqWXL0j1pX2hsYFfrmH
	HHUiVhVVYwpjSNlevc3FMiE4HZLcgQ3VvhsDcae2uUaoUhnp8pigp0CK+KHZKY1IsBEzJXC5C9S3W
	hZ05f5oHbxMDNzEUhUC2zggiBe3Rsh+wG751gwPi8CnSBv6lNuF/qpvjYdYWvOwaKmjA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
Message-Id: <E1txpbK-001wTc-2r@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 15:57:02 +0000

commit edf9509e4d2b0f15bea591735f3fc7226bb8ed5d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:06:53 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:06:53 2025 +0100

    Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 86039f2e8c20 ("xen/arm: vpl011: Add a new domctl API to initialize vpl011")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 341c0df40bf73b0a5e27db27023ec400858a472d
    master date: 2025-03-27 12:22:39 +0100
---
 xen/arch/arm/domctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index 12a12ee781..7a502afa6b 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -172,8 +172,8 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
             break;
         }
 
-        if ( !rc )
-            rc = copy_to_guest(u_domctl, domctl, 1);
+        if ( !rc && copy_to_guest(u_domctl, domctl, 1) )
+            rc = -EFAULT;
 
         return rc;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:44:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929807.1332558 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqKp-0005f3-0k; Thu, 27 Mar 2025 16:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929807.1332558; Thu, 27 Mar 2025 16:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqKo-0005ev-U9; Thu, 27 Mar 2025 16:44:02 +0000
Received: by outflank-mailman (input) for mailman id 929807;
 Thu, 27 Mar 2025 16:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqKo-0005ee-GE
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqKo-00Btbd-1A
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqKo-0020o2-13
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ny6y8FCDM32dTrL5gTKD6nOkp1AFwzbMUbxSvtPi7Es=; b=Qj6+p2zdmTgYNJ/1cLWYHWpvDj
	q0bHKBjeRL600UqtUANuCF7CgrdjIKPvsmIi0XCeuXzmlxPr4VcSQcVdlNCxvFnZwgOftweDEkzKH
	sxv0ZSwe3a5g/eArsCtICTt/EknNgTkje7xgCO1J2dhmlW2PVynWmUGCHOxeyYDipmkI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/mkelf32: account for offset when detecting note segment placement
Message-Id: <E1txqKo-0020o2-13@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:44:02 +0000

commit 190ef8c03b4a70f570224c3208070a45c59a8446
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:22:48 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:22:48 2025 +0100

    x86/mkelf32: account for offset when detecting note segment placement
    
    mkelf32 attempt to check that the program header defined NOTE segment falls
    inside of the LOAD segment, as the build-id should be loaded for Xen at
    runtime to check.
    
    However the current code doesn't take into account the LOAD program header
    segment offset when calculating overlap with the NOTE segment.  This
    results in incorrect detection, and the following build error:
    
    arch/x86/boot/mkelf32 --notes xen-syms ./.xen.elf32 0x200000 \
                   `nm xen-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$/0x\1/p'`
    Expected .note section within .text section!
    Offset 4244776 not within 2910364!
    
    When xen-syms has the following program headers:
    
    Program Header:
        LOAD off    0x0000000000200000 vaddr 0xffff82d040200000 paddr 0x0000000000200000 align 2**21
             filesz 0x00000000002c689c memsz 0x00000000003f7e20 flags rwx
        NOTE off    0x000000000040c528 vaddr 0xffff82d04040c528 paddr 0x000000000040c528 align 2**2
             filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
    
    Account for the program header offset of the LOAD segment when checking
    whether the NOTE segments is contained within.  Also fix the logic to
    ensure the NOTE segments is fully contained between the LOAD segment.
    
    Fixes: a353cab905af ('build_id: Provide ld-embedded build-ids')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6e5fed7cb67c9f84653cdbd3924b8a119ef653be
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/boot/mkelf32.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 3d639c2e08..7b90338ca8 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -366,11 +366,13 @@ int main(int argc, char **argv)
         note_sz = in64_phdr.p_memsz;
         note_base = in64_phdr.p_vaddr - note_base;
 
-        if ( in64_phdr.p_offset > dat_siz || offset > in64_phdr.p_offset )
+        if ( in64_phdr.p_offset < offset ||
+             in64_phdr.p_offset + in64_phdr.p_filesz > offset + dat_siz )
         {
             fprintf(stderr, "Expected .note section within .text section!\n" \
-                    "Offset %"PRId64" not within %d!\n",
-                    in64_phdr.p_offset, dat_siz);
+                    ".note: [%"PRIx64", %"PRIx64") .text: [%x, %x)\n",
+                    in64_phdr.p_offset, in64_phdr.p_offset + in64_phdr.p_filesz,
+                    offset, offset + dat_siz);
             return 1;
         }
         /* Gets us the absolute offset within the .text section. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929810.1332562 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqKz-0005m9-23; Thu, 27 Mar 2025 16:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929810.1332562; Thu, 27 Mar 2025 16:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqKy-0005m1-VV; Thu, 27 Mar 2025 16:44:12 +0000
Received: by outflank-mailman (input) for mailman id 929810;
 Thu, 27 Mar 2025 16:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqKy-0005lr-FX
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqKy-00Btbn-1S
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqKy-0020pN-1K
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nG+nQDM2iii3sxl1jpKWF9coOgVM8radfBo4v+jw410=; b=6o7nGcjFDHXAGbvN2eNecpLwxj
	Cn5Ia/AAU75dVxtQOVxbqQef3hV20HEG/w2T9iZTh1yIv2mNwpQoojscY4/pNwZ0/53xXPh6ZNA+q
	NgIxnH4BDeLt/uVM7oVnQ9Nj4TpNqXIu7tz5nFWHV6+GhZx8zO4t03TllsnOLrk7Yy2M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
Message-Id: <E1txqKy-0020pN-1K@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:44:12 +0000

commit 069721d639d24457d44ec16cd90c59f41ebf092d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:23:00 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:23:00 2025 +0100

    x86/shadow: fix UB pointer arithmetic in sh_mfn_is_a_page_table()
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in arch/x86/mm/shadow/private.h:515:30
    pointer operation overflowed ffff82e000000000 to ffff82dfffffffe0
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d040471b2d>] F arch/x86/mm/shadow/guest_2.c#sh_page_fault__guest_2+0x1e350
        [<ffff82d0403b206b>] F svm_vmexit_handler+0xdf3/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Fix by moving the call to mfn_to_page() after the check of whether the
    passed gmfn is valid.  This avoid the call to mfn_to_page() with an
    INVALID_MFN parameter.
    
    While there make the page local variable const, it's not modified by the
    function.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 45ee73f1b24246f13cd9583cb2ee25fb9c782db8
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/mm/shadow/private.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index a5fc3a7676..cef9dbef2e 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -512,13 +512,14 @@ static inline unsigned long __backpointer(const struct page_info *sp)
 static inline int
 sh_mfn_is_a_page_table(mfn_t gmfn)
 {
-    struct page_info *page = mfn_to_page(gmfn);
+    const struct page_info *page;
     struct domain *owner;
     unsigned long type_info;
 
     if ( !mfn_valid(gmfn) )
         return 0;
 
+    page = mfn_to_page(gmfn);
     owner = page_get_owner(page);
     if ( owner && shadow_mode_refcounts(owner)
          && (page->count_info & PGC_shadowed_pt) )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929815.1332565 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqL9-0005ui-3H; Thu, 27 Mar 2025 16:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929815.1332565; Thu, 27 Mar 2025 16:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqL9-0005uY-0u; Thu, 27 Mar 2025 16:44:23 +0000
Received: by outflank-mailman (input) for mailman id 929815;
 Thu, 27 Mar 2025 16:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqL8-0005uO-Jz
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqL8-00BtcD-1j
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqL8-0020qU-1c
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7rP6fnKzGxBqQGCv3pc2Gc5ATUpq6T3X56ELyRO9WuE=; b=P3z6XZJ0B3MQ3hNNsYc1pqc0aL
	UAafdT62GfJTyAc/AdOvIUjWOABG9XnTl26Ce5OySiYUJt/BWhX3ytHIyAFwZV3/ouMZgcRaNlnOk
	YeBnUL5AWCMfB8NxPXQ+N8zydnbIG+XZv1KAwWyzHLDG95zJBwe93A8FwS5HSCqIlJh0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
Message-Id: <E1txqL8-0020qU-1c@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:44:22 +0000

commit 1a2b76c9bc909021698f959059dc074710ecaf0b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:23:46 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:23:46 2025 +0100

    x86/xlat: fix UB pointer arithmetic in COMPAT_ARG_XLAT_VIRT_BASE
    
    UBSAN complains with:
    
    UBSAN: Undefined behaviour in common/compat/memory.c:90:9
    pointer operation overflowed ffff820080000000 to 0000020080000000
    [...]
    Xen call trace:
        [<ffff82d040303782>] R common/ubsan/ubsan.c#ubsan_epilogue+0xa/0xc0
        [<ffff82d040304bc3>] F __ubsan_handle_pointer_overflow+0xcb/0x100
        [<ffff82d0402a6259>] F compat_memory_op+0xf1/0x4d20
        [<ffff82d04041532d>] F hvm_memory_op+0x55/0xe0
        [<ffff82d040416150>] F hvm_hypercall+0xae8/0x21b0
        [<ffff82d0403b24ca>] F svm_vmexit_handler+0x1252/0x2450
        [<ffff82d0402049c0>] F svm_stgi_label+0x5/0x15
    
    Adjust the calculations in COMPAT_ARG_XLAT_VIRT_BASE to subtract from the
    per-domain area to obtain the mirrored linear address in the 4th slot,
    instead of overflowing the per-domain linear address.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: fc302866f42f552337ae7d8d78877aec36e6e2ff
    master date: 2025-03-20 12:28:30 +0100
---
 xen/arch/x86/include/asm/x86_64/uaccess.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/x86_64/uaccess.h b/xen/arch/x86/include/asm/x86_64/uaccess.h
index ba79f950fb..8b4528bc20 100644
--- a/xen/arch/x86/include/asm/x86_64/uaccess.h
+++ b/xen/arch/x86/include/asm/x86_64/uaccess.h
@@ -9,9 +9,9 @@
  * a secondary mapping installed, which needs to be used for such accesses in
  * the PV case, and will also be used for HVM to avoid extra conditionals.
  */
-#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) + \
-                                   (PERDOMAIN_ALT_VIRT_START - \
-                                    PERDOMAIN_VIRT_START))
+#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) - \
+                                   PERDOMAIN_VIRT_START + \
+                                   PERDOMAIN_ALT_VIRT_START)
 #define COMPAT_ARG_XLAT_SIZE      (2*PAGE_SIZE)
 struct vcpu;
 int setup_compat_arg_xlat(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:44:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929818.1332579 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqLJ-0006FL-G6; Thu, 27 Mar 2025 16:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929818.1332579; Thu, 27 Mar 2025 16:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqLJ-0006FC-DL; Thu, 27 Mar 2025 16:44:33 +0000
Received: by outflank-mailman (input) for mailman id 929818;
 Thu, 27 Mar 2025 16:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqLI-0006EW-LF
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqLI-00BtcT-21
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqLI-0020rE-1u
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aiFf8X40WHouUymdQvQ52DVRQ6a8hdkb9MWG6jE20oo=; b=ShMMrGSb2fLaNM2Fwym0qyt5G7
	4xlY6f0ncXgP2ylGFMt/duW4o+OEwD7JSNiquTaLL06NlSsS7J9BBQddDE/a0sBt22WYFVnt7FwwY
	26CW6gW1cYfgk4dlsdkyLcAB2nfhcyYJEPC5vjLUZ3ZPDT5rjMT0aaUEMGWvVNb4CVa0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/vga: fix mapping of the VGA text buffer
Message-Id: <E1txqLI-0020rE-1u@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:44:32 +0000

commit d033cbdaaf4143a6c7d5358391e08d2bb62859da
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Mar 27 15:24:13 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:24:13 2025 +0100

    x86/vga: fix mapping of the VGA text buffer
    
    The call to ioremap_wc() in video_init() will always fail, because
    video_init() is called ahead of vm_init_type(), and so the underlying
    __vmap() call will fail to allocate the linear address space.
    
    Fix by reverting to the previous behavior and use __va() for the VGA text
    buffer, as it's below the 1MB boundary, and thus always mapped in the
    directmap.
    
    Fixes: 81d195c6c0e2 ('x86: introduce ioremap_wc()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1ca5f69e35548e5196eadb329e5a3976821dc982
    master date: 2025-03-20 17:16:10 +0100
---
 xen/drivers/video/vga.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/drivers/video/vga.c b/xen/drivers/video/vga.c
index 18b590cdf0..15c28a8f34 100644
--- a/xen/drivers/video/vga.c
+++ b/xen/drivers/video/vga.c
@@ -71,7 +71,7 @@ void __init video_init(void)
     {
     case XEN_VGATYPE_TEXT_MODE_3:
         if ( page_is_ram_type(paddr_to_pfn(0xB8000), RAM_TYPE_CONVENTIONAL) ||
-             ((video = ioremap_wc(0xB8000, 0x8000)) == NULL) )
+             ((video = __va(0xB8000)) == NULL) )
             return;
         outw(0x200a, 0x3d4); /* disable cursor */
         columns = vga_console_info.u.text_mode_3.columns;
@@ -158,7 +158,6 @@ void __init video_endboot(void)
         if ( !vgacon_keep )
         {
             memset(video, 0, columns * lines * 2);
-            iounmap(video);
             video = ZERO_BLOCK_PTR;
         }
         break;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:44:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929823.1332584 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqLT-0006NU-HR; Thu, 27 Mar 2025 16:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929823.1332584; Thu, 27 Mar 2025 16:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqLT-0006NN-Ev; Thu, 27 Mar 2025 16:44:43 +0000
Received: by outflank-mailman (input) for mailman id 929823;
 Thu, 27 Mar 2025 16:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqLS-0006N8-No
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqLS-00Btcg-2H
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqLS-0020rn-2C
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QL69HjvwbvwYsXlKuNknx6DHah+yY/pKqvAYq0+6T0c=; b=lObgjnhBRevwJMLudP98gpc/8C
	o06VDr1knvFyQARQ6kebd0WIv/gcCAyLxavczHKE8G2vSP8HxaytmkXUD4FZCloMSPB/m1dGjjKaQ
	bDGTxi4GDQksqckDaBZ99dHho4HJPcafhE96UjzzWnFslYew61CBpndWv7EAmt66rO58=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] xen/compiler: Fix the position of the visibility pragma
Message-Id: <E1txqLS-0020rn-2C@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:44:42 +0000

commit bd3dc6b0c174fc0fe21b495b9e61bd44ac16b5ff
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:24:36 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:24:36 2025 +0100

    xen/compiler: Fix the position of the visibility pragma
    
    This needs to be ahead of everything.  Right now, it is after xen/init.h being
    included for -DINIT_SECTIONS_ONLY
    
      # 1 "./include/xen/compiler.h" 1
      # 83 "./include/xen/compiler.h"
      # 1 "./include/xen/init.h" 1
      # 62 "./include/xen/init.h"
      typedef int (*initcall_t)(void);
      typedef void (*exitcall_t)(void);
      # 72 "./include/xen/init.h"
      void do_presmp_initcalls(void);
      void do_initcalls(void);
      # 84 "./include/xen/compiler.h" 2
      # 122 "./include/xen/compiler.h"
      #pragma GCC visibility push(hidden)
    
    Fixes: 84c4461b7d3a ("Force out-of-line instances of inline functions into .init.text in init-only code")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: ab7ce0c8ed90f729a186babd87e3cd1fbed8ab98
    master date: 2025-03-21 11:52:39 +0000
---
 xen/include/xen/compiler.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index dd99e57308..dfffe53035 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -15,6 +15,11 @@
 # endif
 #endif
 
+#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
+/* Results in more efficient PIC code (no indirections through GOT or PLT). */
+#pragma GCC visibility push(hidden)
+#endif
+
 #define barrier()     __asm__ __volatile__("": : :"memory")
 
 #define likely(x)     __builtin_expect(!!(x),1)
@@ -125,11 +130,6 @@
 #define __must_be_array(a) \
   BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
 
-#ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
-/* Results in more efficient PIC code (no indirections through GOT or PLT). */
-#pragma GCC visibility push(hidden)
-#endif
-
 /* Make the optimizer believe the variable can be manipulated arbitrarily. */
 #define OPTIMIZER_HIDE_VAR(var) __asm__ ( "" : "+g" (var) )
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:44:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929828.1332587 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqLe-0006Z5-Jo; Thu, 27 Mar 2025 16:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929828.1332587; Thu, 27 Mar 2025 16:44:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqLe-0006Yy-GY; Thu, 27 Mar 2025 16:44:54 +0000
Received: by outflank-mailman (input) for mailman id 929828;
 Thu, 27 Mar 2025 16:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqLc-0006XW-Qa
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqLc-00Btcl-2Z
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqLc-0020sK-2T
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X+ap6+39D6q3LXqr5g31rj07w8vSVHezOGupx4B+ggI=; b=xqwBoSG6AzS5NemhQW8gxq/t6N
	YKUt6XYVmGpjqnvTk9r34AQ0oNetG9490an/XOTrvhsun4ninajrse5wQtiYUcLeRoe6UiiF4rh2S
	rVZZSpq62+w+GDsKnkwQcORfCFzDNZalR9fd7WKMVGpehAZgahSwWLl6fzh2u1LlY+nk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/boot: Simplify the expression for extra allocation space
Message-Id: <E1txqLc-0020sK-2T@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:44:52 +0000

commit 311956bfeeabf5ee5fb9021195942d232021d54b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:24:43 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:24:43 2025 +0100

    x86/boot: Simplify the expression for extra allocation space
    
    The expression for one parameter of find_memory() is already complicated and
    about to become moreso.  Break it out into a new variable, and express it in
    an easier-to-follow way.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: ce703c84df1cb279605b0a85a45c6419464a16e8
    master date: 2025-03-21 11:52:39 +0000
---
 xen/arch/x86/hvm/dom0_build.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 411beb3f06..2a1bbd6929 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -540,6 +540,7 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
     unsigned long image_len = image->mod_end;
     struct elf_binary elf;
     struct elf_dom_parms parms;
+    size_t extra_space;
     paddr_t last_addr;
     struct hvm_start_info start_info = { 0 };
     struct hvm_modlist_entry mod = { 0 };
@@ -592,13 +593,16 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
      * split into smaller allocations, done as a single region in order to
      * simplify it.
      */
-    last_addr = find_memory(d, &elf, sizeof(start_info) +
-                            (initrd ? ROUNDUP(initrd->mod_end, PAGE_SIZE) +
-                                      sizeof(mod)
-                                    : 0) +
-                            (cmdline ? ROUNDUP(strlen(cmdline) + 1,
-                                               elf_64bit(&elf) ? 8 : 4)
-                                     : 0));
+    extra_space = sizeof(start_info);
+
+    if ( initrd )
+        extra_space += sizeof(mod) + ROUNDUP(initrd->mod_end, PAGE_SIZE);
+
+    if ( cmdline )
+        extra_space += ROUNDUP(strlen(cmdline) + 1,
+                               elf_64bit(&elf) ? 8 : 4);
+
+    last_addr = find_memory(d, &elf, extra_space);
     if ( last_addr == INVALID_PADDR )
     {
         printk("Unable to find a memory region to load initrd and metadata\n");
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:45:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929830.1332592 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqLo-0006eP-MW; Thu, 27 Mar 2025 16:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929830.1332592; Thu, 27 Mar 2025 16:45:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqLo-0006eI-Jh; Thu, 27 Mar 2025 16:45:04 +0000
Received: by outflank-mailman (input) for mailman id 929830;
 Thu, 27 Mar 2025 16:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqLm-0006dt-TN
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqLm-00BtdM-2p
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqLm-0020t7-2k
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6SveSOhp6Zxdc4085pkqGyuG7qgjptFvlAHg4L+ZPNs=; b=QTO/x+nbT009IO6y8kNtPUlwOO
	nZHxu6uRTA9NPCnXWzSFB8p/DHTBLv/eVhGQzINkhwD2Xvax8Ej6Y7eFLX9386jF7GM34GrIyJ5us
	eF5DlU1U3l3NGDDfnNKer44uMr+8O4x4nPBnpWy5ybeahcWSpgNvcVv03pb47S5jogE8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
Message-Id: <E1txqLm-0020t7-2k@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:45:02 +0000

commit 204701a9488b6e19fbc22528aef3946590d0c2ad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:25:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:25:30 2025 +0100

    xenpm: sanitize allocations in show_cpufreq_para_by_cpuid()
    
    malloc(), when passed zero size, may return NULL (the behavior is
    implementation defined). Mirror the ->gov_num check to the other two
    allocations as well. Don't chance then actually using a NULL in
    print_cpufreq_para().
    
    Fixes: 75e06d089d48 ("xenpm: add cpu frequency control interface, through which user can")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: 6c0dc87bb0e08fb31a68bf4c4149a18b92628f14
    master date: 2025-03-26 12:30:57 +0100
---
 tools/misc/xenpm.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index d982482a3f..f6661851d4 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -827,8 +827,9 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
     }
     else
     {
-        printf("scaling_avail_gov    : %s\n",
-               p_cpufreq->scaling_available_governors);
+        if ( p_cpufreq->gov_num )
+            printf("scaling_avail_gov    : %s\n",
+                   p_cpufreq->scaling_available_governors);
 
         printf("current_governor     : %s\n", p_cpufreq->u.s.scaling_governor);
         if ( !strncmp(p_cpufreq->u.s.scaling_governor,
@@ -894,7 +895,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
         p_cpufreq->scaling_available_frequencies = NULL;
         p_cpufreq->scaling_available_governors = NULL;
 
-        if (!(p_cpufreq->affected_cpus =
+        if (p_cpufreq->cpu_num &&
+            !(p_cpufreq->affected_cpus =
               malloc(p_cpufreq->cpu_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
@@ -903,7 +905,8 @@ static int show_cpufreq_para_by_cpuid(xc_interface *xc_handle, int cpuid)
             ret = -ENOMEM;
             goto out;
         }
-        if (!(p_cpufreq->scaling_available_frequencies =
+        if (p_cpufreq->freq_num &&
+            !(p_cpufreq->scaling_available_frequencies =
               malloc(p_cpufreq->freq_num * sizeof(uint32_t))))
         {
             fprintf(stderr,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:45:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:45:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929831.1332595 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqLy-0006hV-Nc; Thu, 27 Mar 2025 16:45:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929831.1332595; Thu, 27 Mar 2025 16:45:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqLy-0006hO-LC; Thu, 27 Mar 2025 16:45:14 +0000
Received: by outflank-mailman (input) for mailman id 929831;
 Thu, 27 Mar 2025 16:45:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqLw-0006h3-W7
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqLw-00BtdT-37
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqLw-0020tj-31
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CQTWk30heFLq93izajZ7DtjD08wmBjzGezcVznbgE3Q=; b=cuDuz+3S+ZCNMGrIVB3gN4QO7I
	j81VIARbcZJX1K8EwZF1talUB3lgYBxY+9y7+ygbryc3afuCpVMU3cS18CurtXnjK3pM0RACLcODY
	CTIlJsVjuSkE7PhgIVONpEAIzKz8uJBmWjuiwCGFwAB4ytNd9GOHVVmIMPoYaKiOUevA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/PVH: expose OEMx ACPI tables to Dom0
Message-Id: <E1txqLw-0020tj-31@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:45:12 +0000

commit dd78223a3c102a94ea596e85de1fc2af767bf9af
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:25:39 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:25:39 2025 +0100

    x86/PVH: expose OEMx ACPI tables to Dom0
    
    What they contain we don't know, but we can't sensibly hide them. On my
    Skylake system OEM1 (with a description of "INTEL  CPU EIST") is what
    contains all the _PCT, _PPC, and _PSS methods, i.e. about everything
    needed for cpufreq. (_PSD interestingly are in an SSDT there.)
    
    Further OEM2 there has a description of "INTEL  CPU  HWP", while OEM4
    has "INTEL  CPU  CST". Pretty clearly all three need exposing for
    cpufreq and cpuidle to work.
    
    Fixes: 8b1a5268daf0 ("pvh/dom0: whitelist PVH Dom0 ACPI tables")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 6378909b41c40187a79df1d38ca4791b34393d67
    master date: 2025-03-26 12:32:03 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 2a1bbd6929..fe8eca28f0 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -892,12 +892,20 @@ static bool __init pvh_acpi_table_allowed(const char *sig,
             return true;
         else
         {
+    skip:
             printk("Skipping table %.4s in non-ACPI non-reserved region\n",
                    sig);
             return false;
         }
     }
 
+    if ( !strncmp(sig, "OEM", 3) )
+    {
+        if ( acpi_memory_banned(address, size) )
+            goto skip;
+        return true;
+    }
+
     return false;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:45:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:45:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929832.1332600 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqM8-0006kM-PJ; Thu, 27 Mar 2025 16:45:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929832.1332600; Thu, 27 Mar 2025 16:45:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqM8-0006kE-Md; Thu, 27 Mar 2025 16:45:24 +0000
Received: by outflank-mailman (input) for mailman id 929832;
 Thu, 27 Mar 2025 16:45:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqM7-0006k2-2h
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:45:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqM7-00Bte2-0A
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:45:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqM7-0020uJ-04
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:45:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZxCVV5UDQ95TIKxlVLBaDPdCJEaZFyKo3CGlLdi7Dqo=; b=2u/JT3rN5IbqyHr+kx2ce0Mgqe
	PdsY29IQvFFiUFbhH5R1Xo4sidPIWSRG2eNI+flue2YPBJW8PQsq1dsxbzU2e6Cb4kIwu9+ViSH6z
	PDp1NZnKQqK/IKaxDjV6SqseT/HcjzG3Lo0sfOIZJnzF6ApqF+wfdrHWr6r3EzXRCYhg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
Message-Id: <E1txqM7-0020uJ-04@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:45:23 +0000

commit 360d646efa9c75ac77cb8fda674c7594924a56bd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:25:48 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:25:48 2025 +0100

    x86/emul: Rearrange the logic in hvmemul_{read,write}_cr()
    
    In hvmemul_read_cr(), make the TRACE()/X86EMUL_OKAY path common in preparation
    for adding a %cr8 case.  Use a local 'val' variable instead of always
    operating on a deferenced pointer.
    
    In both, calculate curr once.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b7264a15c28d30bb994ec9e58eba38932be231ec
    master date: 2025-03-26 11:54:59 +0000
---
 xen/arch/x86/hvm/emulate.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index a447c7270e..705dcb2cfa 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2222,23 +2222,30 @@ static int cf_check hvmemul_write_io(
 
 static int cf_check hvmemul_read_cr(
     unsigned int reg,
-    unsigned long *val,
+    unsigned long *pval,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
+    unsigned long val;
+
     switch ( reg )
     {
     case 0:
     case 2:
     case 3:
     case 4:
-        *val = current->arch.hvm.guest_cr[reg];
-        HVMTRACE_LONG_2D(CR_READ, reg, TRC_PAR_LONG(*val));
-        return X86EMUL_OKAY;
-    default:
+        val = curr->arch.hvm.guest_cr[reg];
         break;
+
+    default:
+        return X86EMUL_UNHANDLEABLE;
     }
 
-    return X86EMUL_UNHANDLEABLE;
+    HVMTRACE_LONG_2D(CR_READ, reg, TRC_PAR_LONG(val));
+
+    *pval = val;
+
+    return X86EMUL_OKAY;
 }
 
 static int cf_check hvmemul_write_cr(
@@ -2246,6 +2253,7 @@ static int cf_check hvmemul_write_cr(
     unsigned long val,
     struct x86_emulate_ctxt *ctxt)
 {
+    struct vcpu *curr = current;
     int rc;
 
     HVMTRACE_LONG_2D(CR_WRITE, reg, TRC_PAR_LONG(val));
@@ -2256,13 +2264,13 @@ static int cf_check hvmemul_write_cr(
         break;
 
     case 2:
-        current->arch.hvm.guest_cr[2] = val;
+        curr->arch.hvm.guest_cr[2] = val;
         rc = X86EMUL_OKAY;
         break;
 
     case 3:
     {
-        bool noflush = hvm_pcid_enabled(current) && (val & X86_CR3_NOFLUSH);
+        bool noflush = hvm_pcid_enabled(curr) && (val & X86_CR3_NOFLUSH);
 
         if ( noflush )
             val &= ~X86_CR3_NOFLUSH;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:45:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:45:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929833.1332604 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqMI-0006n1-Qi; Thu, 27 Mar 2025 16:45:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929833.1332604; Thu, 27 Mar 2025 16:45:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqMI-0006mt-O9; Thu, 27 Mar 2025 16:45:34 +0000
Received: by outflank-mailman (input) for mailman id 929833;
 Thu, 27 Mar 2025 16:45:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqMH-0006mY-5e
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:45:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqMH-00Bteu-0T
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:45:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqMH-0020ut-0N
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:45:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X4jFO5da1AX+YuE0O3K9mRTJmLfXM3ACPRzZTFnTGwU=; b=crw6szn2hpE9yTV9jT7vFscegn
	koNp8OKQsb71yDuEmfQmj5/vmfYVHlbOK/iJqOx0SBEaxmOpNYICnZcvptXgstgbgnSHTH0BGxvQE
	WhvpiFP9HOPFSAU+EQowynJejEeysw5Qhhx3PBLdfkKVv/rBU4Qg6oHk7wbtT44+XZW0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/emul: Emulate %cr8 accesses
Message-Id: <E1txqMH-0020ut-0N@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:45:33 +0000

commit 74071cb36ddeddddeecb23400ce67d5bd94c7208
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 27 15:26:09 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:26:09 2025 +0100

    x86/emul: Emulate %cr8 accesses
    
    Petr reports:
    
      (XEN) MMIO emulation failed (1): d12v1 64bit @ 0010:fffff8057ba7dfbf -> 45 0f 20 c2 ...
    
    during introspection.
    
    This is MOV %cr8, which is wired up for hvm_mov_{to,from}_cr(); the VMExit
    fastpaths, but not for the full emulation slowpaths.
    
    Xen's handling of %cr8 turns out to be quite wrong.  At a minimum, we need
    storage for %cr8 separate to APIC_TPR, and to alter intercepts based on
    whether the vLAPIC is enabled or not.  But that's more work than there is time
    for in the short term, so make a stopgap fix.
    
    Extend hvmemul_{read,write}_cr() with %cr8 cases.  Unlike hvm_mov_to_cr(),
    hardware hasn't filtered out invalid values (#GP checks are ahead of
    intercepts), so introduce X86_CR8_VALID_MASK.
    
    Reported-by: Petr Beneš <w1benny@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 14fd9b5642cd4805b49fbe716bf2cd577e724169
    master date: 2025-03-26 11:54:59 +0000
---
 xen/arch/x86/hvm/emulate.c           | 15 +++++++++++++++
 xen/arch/x86/include/asm/x86-defns.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 705dcb2cfa..2e6ebcbf36 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2237,6 +2237,10 @@ static int cf_check hvmemul_read_cr(
         val = curr->arch.hvm.guest_cr[reg];
         break;
 
+    case 8:
+        val = (vlapic_get_reg(vcpu_vlapic(curr), APIC_TASKPRI) & 0xf0) >> 4;
+        break;
+
     default:
         return X86EMUL_UNHANDLEABLE;
     }
@@ -2282,6 +2286,17 @@ static int cf_check hvmemul_write_cr(
         rc = hvm_set_cr4(val, true);
         break;
 
+    case 8:
+        if ( val & ~X86_CR8_VALID_MASK )
+        {
+            rc = X86EMUL_EXCEPTION;
+            break;
+        }
+
+        vlapic_set_reg(vcpu_vlapic(curr), APIC_TASKPRI, val << 4);
+        rc = X86EMUL_OKAY;
+        break;
+
     default:
         rc = X86EMUL_UNHANDLEABLE;
         break;
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 4e4737d56c..968a975886 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -76,6 +76,8 @@
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
 #define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
 
+#define X86_CR8_VALID_MASK 0xf
+
 /*
  * XSTATE component flags in XCR0
  */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:45:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:45:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929834.1332608 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqMS-0006pZ-Sg; Thu, 27 Mar 2025 16:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929834.1332608; Thu, 27 Mar 2025 16:45:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqMS-0006pR-Pb; Thu, 27 Mar 2025 16:45:44 +0000
Received: by outflank-mailman (input) for mailman id 929834;
 Thu, 27 Mar 2025 16:45:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqMR-0006pH-A4
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:45:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqMR-00Bthf-0v
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:45:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqMR-0020vT-0e
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:45:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4oT6clRc+gFNfmahd3qixLHzvJcTMc3j0jPmsWhrv6w=; b=HKZxqavpISHb5a0PG/epwBMcNA
	fWbkVgnFW2/wIBgeybU46uj2zbCvaduSSayiXhlwvv3pyzttcOD68rCKCCGM16urLw3p+JYYxR0mg
	fHsBe1tS4mxSDGz+fPM9c6sviMM9GfuU6smmbHeCaIXQxjeHFrlIGiqRA/7puis2H17M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/PVH: account for module command line length
Message-Id: <E1txqMR-0020vT-0e@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:45:43 +0000

commit a2a336fbc95a26f1a6ce1e2e77cd18e0eb48d8c5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:26:37 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:26:37 2025 +0100

    x86/PVH: account for module command line length
    
    As per observation in practice, initrd->cmdline_pa is not normally zero.
    Hence so far we always appended at least one byte. That alone may
    already render insufficient the "allocation" made by find_memory().
    Things would be worse when there's actually a (perhaps long) command
    line.
    
    Skip setup when the command line is empty. Amend the "allocation" size
    by padding and actual size of module command line. Along these lines
    also skip initrd setup when the initrd is zero size.
    
    Fixes: 0ecb8eb09f9f ("x86/pvh: pass module command line to dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    master commit: 989584e532c9517a0f789e993f5f6744beaebe3e
    master date: 2025-03-27 12:21:08 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index fe8eca28f0..b4a843f62f 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -538,6 +538,7 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
 {
     void *image_start = image_base + image_headroom;
     unsigned long image_len = image->mod_end;
+    const char *initrd_cmdline = NULL;
     struct elf_binary elf;
     struct elf_dom_parms parms;
     size_t extra_space;
@@ -596,7 +597,23 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
     extra_space = sizeof(start_info);
 
     if ( initrd )
-        extra_space += sizeof(mod) + ROUNDUP(initrd->mod_end, PAGE_SIZE);
+    {
+        size_t initrd_space = elf_round_up(&elf, initrd->mod_end);
+
+        if ( initrd->string )
+        {
+            initrd_cmdline = __va(initrd->string);
+            if ( !*initrd_cmdline )
+                initrd_cmdline = NULL;
+        }
+        if ( initrd_cmdline )
+            initrd_space += strlen(initrd_cmdline) + 1;
+
+        if ( initrd_space )
+            extra_space += ROUNDUP(initrd_space, PAGE_SIZE) + sizeof(mod);
+        else
+            initrd = NULL;
+    }
 
     if ( cmdline )
         extra_space += ROUNDUP(strlen(cmdline) + 1,
@@ -621,13 +638,12 @@ static int __init pvh_load_kernel(struct domain *d, const module_t *image,
 
         mod.paddr = last_addr;
         mod.size = initrd->mod_end;
-        last_addr += ROUNDUP(initrd->mod_end, elf_64bit(&elf) ? 8 : 4);
-        if ( initrd->string )
+        last_addr += elf_round_up(&elf, initrd->mod_end);
+        if ( initrd_cmdline )
         {
-            char *str = __va(initrd->string);
-            size_t len = strlen(str) + 1;
+            size_t len = strlen(initrd_cmdline) + 1;
 
-            rc = hvm_copy_to_guest_phys(last_addr, str, len, v);
+            rc = hvm_copy_to_guest_phys(last_addr, initrd_cmdline, len, v);
             if ( rc )
             {
                 printk("Unable to copy module command line\n");
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:45:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:45:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929835.1332611 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqMc-0006s8-Tp; Thu, 27 Mar 2025 16:45:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929835.1332611; Thu, 27 Mar 2025 16:45:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqMc-0006s0-R8; Thu, 27 Mar 2025 16:45:54 +0000
Received: by outflank-mailman (input) for mailman id 929835;
 Thu, 27 Mar 2025 16:45:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqMb-0006rq-Cr
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:45:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqMb-00Bthn-1C
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:45:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqMb-0020wA-16
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:45:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WC13THmD0m7zx3ipo5mmZKPLSj1YfetqLuIWWoF7s+Y=; b=NmzfIac7NHk4a7sAjBN2jDj6j0
	+oUGxjG5zQVvvaeKkUy6DTCMbVS8UIO7XkKUjCEPMKaRVKwtHTBQrtr/rVjUgb6SCm+WS49yo/JxW
	uDt4syMZ4J2tgsLcTs4447eyCiL7kJY4Qe4CEVlUntq5GAOZpEK21BfD15XBPo4di/9A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/pmstat: correct get_cpufreq_para()'s error return value
Message-Id: <E1txqMb-0020wA-16@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:45:53 +0000

commit 38bde3bf911e6796ddd93578128eb8d1c32058d5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:26:52 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:26:52 2025 +0100

    x86/pmstat: correct get_cpufreq_para()'s error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 7542c4ff00f2 ("Add user PM control interface")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 855337ca4947508ffca23393e291c54b5307cc9a
    master date: 2025-03-27 12:22:06 +0100
---
 xen/drivers/acpi/pmstat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index 803971bdb0..9e82f06ee1 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -225,7 +225,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                        affected_cpus, op->u.get_para.cpu_num);
     xfree(affected_cpus);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     if ( !(scaling_available_frequencies =
            xzalloc_array(uint32_t, op->u.get_para.freq_num)) )
@@ -237,7 +237,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                    scaling_available_frequencies, op->u.get_para.freq_num);
     xfree(scaling_available_frequencies);
     if ( ret )
-        return ret;
+        return -EFAULT;
 
     op->u.get_para.cpuinfo_cur_freq =
         cpufreq_driver.get ? alternative_call(cpufreq_driver.get, op->cpuid)
@@ -273,7 +273,7 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
                             gov_num * CPUFREQ_NAME_LEN);
         xfree(scaling_available_governors);
         if ( ret )
-            return ret;
+            return -EFAULT;
 
         op->u.get_para.u.s.scaling_cur_freq = policy->cur;
         op->u.get_para.u.s.scaling_max_freq = policy->max;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Mar 27 16:46:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Mar 2025 16:46:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.929836.1332615 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqMm-0006vH-VJ; Thu, 27 Mar 2025 16:46:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 929836.1332615; Thu, 27 Mar 2025 16:46:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1txqMm-0006v9-Sa; Thu, 27 Mar 2025 16:46:04 +0000
Received: by outflank-mailman (input) for mailman id 929836;
 Thu, 27 Mar 2025 16:46:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1txqMl-0006v0-Fb
 for xen-changelog@lists.xenproject.org; Thu, 27 Mar 2025 16:46:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqMl-00Bti6-1T
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:46:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1txqMl-0020xO-1N
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Mar 2025 16:46:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GL14upbSen0sXc3dQ7JwhA2VZpxycCMVmeZgrx9eIlk=; b=kw9YhkB2fq4UhFoSoamstNh4we
	vKK6GjGAbfI3oJlW0NmeiQLGZoJ53hidYAfqpyOEz2JJ/RUQa2tOgE1txR9XQ7RBLnA0EBdzknfa/
	7LVZl5ivbYTL2JLR4KQ+AjTBCUl1V3WOADmJ0WE+rxAsic49ww/7L8TXamLViIujSXCw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
Message-Id: <E1txqMl-0020xO-1N@xenbits.xenproject.org>
Date: Thu, 27 Mar 2025 16:46:03 +0000

commit d2257148a7c940c4836afdaece66c566fb416a9b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Mar 27 15:27:09 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Mar 27 15:27:09 2025 +0100

    Arm/domctl: correct XEN_DOMCTL_vuart_op error return value
    
    copy_to_guest() returns the number of bytes not copied; that's not what
    the function should return to its caller though. Convert to returning
    -EFAULT instead.
    
    Fixes: 86039f2e8c20 ("xen/arm: vpl011: Add a new domctl API to initialize vpl011")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 341c0df40bf73b0a5e27db27023ec400858a472d
    master date: 2025-03-27 12:22:39 +0100
---
 xen/arch/arm/domctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index ad56efb0f5..8e9851e560 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -171,8 +171,8 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
             break;
         }
 
-        if ( !rc )
-            rc = copy_to_guest(u_domctl, domctl, 1);
+        if ( !rc && copy_to_guest(u_domctl, domctl, 1) )
+            rc = -EFAULT;
 
         return rc;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Mar 28 09:00:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Mar 2025 09:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.930355.1332995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ty5ZL-0005cw-4O; Fri, 28 Mar 2025 09:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 930355.1332995; Fri, 28 Mar 2025 09:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ty5ZL-0005cb-1Z; Fri, 28 Mar 2025 09:00:03 +0000
Received: by outflank-mailman (input) for mailman id 930355;
 Fri, 28 Mar 2025 09:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ty5ZK-0005VV-9T
 for xen-changelog@lists.xenproject.org; Fri, 28 Mar 2025 09:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ty5ZK-00Dkbo-0r
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 09:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ty5ZK-003nwt-0h
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 09:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nQG1kpMCtUSmUtlvZwsFGYHuUuYG71Jffw9SKlvYMww=; b=eT9eY065ySFQUs4lBLxvUcGzq4
	uhI+oPL/LbYnazi0NEM6LiEn55+SFfwsZZBJdxQ1RZW69vFYyXxpEdPq8pbNgrcUuiLG+yzG2nnpA
	AGYMiJBeK5ngeVIVdV2HGRj3FubctbVYYG6T+0c1+eBMcZJ2iNBa/GonCtYtnNlQDQuQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM/vgic: Use for_each_set_bit() in vgic-mmio*
Message-Id: <E1ty5ZK-003nwt-0h@xenbits.xenproject.org>
Date: Fri, 28 Mar 2025 09:00:02 +0000

commit 4abb6cff724afaf713aca08fa80e79de4a81bf61
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 30 14:25:28 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 28 08:00:53 2025 +0000

    ARM/vgic: Use for_each_set_bit() in vgic-mmio*
    
    These are all loops over a scalar value, and don't need to call general bitop
    helpers behind the scenes.
    
    Clamp data to the width of the access in dispatch_mmio_write(), rather than
    doing so in every handler.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/vgic/vgic-mmio.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/vgic/vgic-mmio.c b/xen/arch/arm/vgic/vgic-mmio.c
index 4ad350c21c..b4ba34cfc3 100644
--- a/xen/arch/arm/vgic/vgic-mmio.c
+++ b/xen/arch/arm/vgic/vgic-mmio.c
@@ -70,9 +70,8 @@ void vgic_mmio_write_senable(struct vcpu *vcpu,
                              unsigned long val)
 {
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
-    unsigned int i;
 
-    bitmap_for_each ( i, &val, len * 8 )
+    for_each_set_bit ( i, val )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
         unsigned long flags;
@@ -115,9 +114,8 @@ void vgic_mmio_write_cenable(struct vcpu *vcpu,
                              unsigned long val)
 {
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
-    unsigned int i;
 
-    bitmap_for_each ( i, &val, len * 8 )
+    for_each_set_bit ( i, val )
     {
         struct vgic_irq *irq;
         unsigned long flags;
@@ -183,11 +181,10 @@ void vgic_mmio_write_spending(struct vcpu *vcpu,
                               unsigned long val)
 {
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
-    unsigned int i;
     unsigned long flags;
     irq_desc_t *desc;
 
-    bitmap_for_each ( i, &val, len * 8 )
+    for_each_set_bit ( i, val )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -231,11 +228,10 @@ void vgic_mmio_write_cpending(struct vcpu *vcpu,
                               unsigned long val)
 {
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
-    unsigned int i;
     unsigned long flags;
     irq_desc_t *desc;
 
-    bitmap_for_each ( i, &val, len * 8 )
+    for_each_set_bit ( i, val )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -327,9 +323,8 @@ void vgic_mmio_write_cactive(struct vcpu *vcpu,
                              unsigned long val)
 {
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
-    unsigned int i;
 
-    bitmap_for_each ( i, &val, len * 8 )
+    for_each_set_bit ( i, val )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -357,9 +352,8 @@ void vgic_mmio_write_sactive(struct vcpu *vcpu,
                              unsigned long val)
 {
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
-    unsigned int i;
 
-    bitmap_for_each ( i, &val, len * 8 )
+    for_each_set_bit ( i, val )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -591,6 +585,10 @@ static int dispatch_mmio_write(struct vcpu *vcpu, mmio_info_t *info,
     if ( !region )
         return 0;
 
+    /* Clamp data to the width of the access. */
+    if ( len < sizeof(data) )
+        data &= (1UL << (len * 8)) - 1;
+
     switch (iodev->iodev_type)
     {
     case IODEV_DIST:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 28 09:00:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Mar 2025 09:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.930357.1332999 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ty5ZV-0006Ic-5S; Fri, 28 Mar 2025 09:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 930357.1332999; Fri, 28 Mar 2025 09:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ty5ZV-0006IT-2u; Fri, 28 Mar 2025 09:00:13 +0000
Received: by outflank-mailman (input) for mailman id 930357;
 Fri, 28 Mar 2025 09:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ty5ZU-0006IN-Ch
 for xen-changelog@lists.xenproject.org; Fri, 28 Mar 2025 09:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ty5ZU-00Dkbx-18
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 09:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ty5ZU-003nzU-11
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 09:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IrLejY9tdtJhYsSLnvxO/D8T4nWb4fVCiDYb1S2dzmA=; b=yE39cybRRhljmT0hTsLOrdC3Il
	oPswDzZ0jnFsB4T0tDFrKi6q83IDwnMrIRZZI+XtaUpyt6I3RrX7q+jrqDO0g6shaqOm5mKqsD9SL
	nLhlckvFbr3WdzB47gihiX8VeZ94MLfkb5THnUo08UHR9wxvK5y0ylMJngDBEOJktTyA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Xen: Update compiler baseline checks
Message-Id: <E1ty5ZU-003nzU-11@xenbits.xenproject.org>
Date: Fri, 28 Mar 2025 09:00:12 +0000

commit 40458f7525504000ad26d7ef73cb452a976828fa
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 14:05:58 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 28 08:00:53 2025 +0000

    Xen: Update compiler baseline checks
    
    We have checks in both xen/compiler.h, and Config.mk.  Both are incomplete.
    
    The check in Config.mk sees $(CC) in system and cross-compiler form, so cannot
    express anything more than the global baseline.  Change it to simply 5.1.
    
    In xen/compiler.h, rewrite the expression for clarity/brevity.
    
    Include a GCC 12.2 check for RISCV, and include a Clang 11 baseline check.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk                  |  4 ++--
 xen/include/xen/compiler.h | 26 ++++++++++++++------------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/Config.mk b/Config.mk
index 8a73f3da62..8a60d4a55a 100644
--- a/Config.mk
+++ b/Config.mk
@@ -125,8 +125,8 @@ define cc-ver-check-closure
     endif
 endef
 
-# Require GCC v4.1+
-check-$(gcc) = $(call cc-ver-check,CC,0x040100,"Xen requires at least gcc-4.1")
+# Require GCC v5.1 as the project global baseline
+check-$(gcc) = $(call cc-ver-check,CC,0x050100,"Xen requires at least GCC 5.1")
 $(eval $(check-y))
 
 ld-ver-build-id = $(shell $(1) --build-id 2>&1 | \
diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 636a85bc41..38b8fa3d38 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -1,19 +1,21 @@
 #ifndef __LINUX_COMPILER_H
 #define __LINUX_COMPILER_H
 
-#if !defined(__GNUC__) || (__GNUC__ < 4)
-#error Sorry, your compiler is too old/not recognized.
-#elif CONFIG_CC_IS_GCC
-# if defined(CONFIG_ARM_32) && CONFIG_GCC_VERSION < 40900
-#  error Sorry, your version of GCC is too old - please use 4.9 or newer.
-# elif defined(CONFIG_ARM_64) && CONFIG_GCC_VERSION < 50100
-/*
- * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
- * https://lore.kernel.org/r/20210107111841.GN1551@shell.armlinux.org.uk
- */
-#  error Sorry, your version of GCC is too old - please use 5.1 or newer.
+#if CONFIG_CC_IS_GCC
+
+# if defined(CONFIG_RISCV) && CONFIG_GCC_VERSION < 120200
+#  error Sorry, please use GCC >= 12.2
+# elif CONFIG_GCC_VERSION < 50100
+#  error Sorry, please use GCC >= 5.1
 # endif
-#endif
+
+#elif CONFIG_CC_IS_CLANG
+
+# if CONFIG_CLANG_VERSION < 110000
+#  error Sorry, please use Clang >= 11
+# endif
+
+#endif /* Compiler checks. */
 
 #ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
 /* Results in more efficient PIC code (no indirections through GOT or PLT). */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 28 09:00:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Mar 2025 09:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.930358.1333004 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ty5Zg-0006LS-7X; Fri, 28 Mar 2025 09:00:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 930358.1333004; Fri, 28 Mar 2025 09:00:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ty5Zg-0006LK-4W; Fri, 28 Mar 2025 09:00:24 +0000
Received: by outflank-mailman (input) for mailman id 930358;
 Fri, 28 Mar 2025 09:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ty5Ze-0006L7-FR
 for xen-changelog@lists.xenproject.org; Fri, 28 Mar 2025 09:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ty5Ze-00Dkc1-1O
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 09:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ty5Ze-003o0U-1I
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 09:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DNEHUx1Nj13ejEziBv6H6EKA4TpbvSgJxltbMZl6jaM=; b=1LYpiyurFkUb2O28BchoYad+9F
	T9bfTwja2JJLrdT35EMQc5KNF6p1zfhdDvFFoDIVVDQB155wUm17mcfzrr58XCrR3QlOSF4W3/iQK
	NxTHYMk477idmSOOm2eYGIxWkiGo1tCYRbpHvIaYwPyJNL5aeCVMJcoJIrIFAIV/rJ2o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG: Minimum toolchain requirements for x86 and ARM
Message-Id: <E1ty5Ze-003o0U-1I@xenbits.xenproject.org>
Date: Fri, 28 Mar 2025 09:00:22 +0000

commit eecb9f437b2c3e2d22d0af93dc6b1f4d978313a7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 14:10:58 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 28 08:00:53 2025 +0000

    CHANGELOG: Minimum toolchain requirements for x86 and ARM
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 35ab674924..8f6afa5c85 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ## [4.21.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
 ### Changed
+ - The minimum toolchain requirements have increased for some architectures:
+   - For x86, GCC 5.1 and Binutils 2.25, or Clang/LLVM 11
+   - For ARM32 and ARM64, GCC 5.1 and Binutils 2.25
 
 ### Added
  - On x86:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 28 10:22:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Mar 2025 10:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.930451.1333077 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ty6qh-00047O-1C; Fri, 28 Mar 2025 10:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 930451.1333077; Fri, 28 Mar 2025 10:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ty6qg-00047G-Up; Fri, 28 Mar 2025 10:22:02 +0000
Received: by outflank-mailman (input) for mailman id 930451;
 Fri, 28 Mar 2025 10:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ty6qf-00047A-Sx
 for xen-changelog@lists.xenproject.org; Fri, 28 Mar 2025 10:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ty6qf-00DmZ2-26
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 10:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ty6qf-003y5T-1t
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 10:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HbOLHuWLsKjRnAHFvLTNOK/z+SSB7HdQLbY1YIubmVk=; b=yup78qOhiWL5qsxEQ4H89v/J0B
	ZG89Xmz48siHdUsfnuonarG92MlldfnemEgMrqyKeAobkWU6fWPXnn4VsMpPXY398AQuPNDhpVXGk
	pM+7oxJJ+/jeRoRXaS+e5kLV75rrr6y5UW44ILH6Erkf6r83WBnoFHmnXrqbngbPu0ok=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM/vgic: Use for_each_set_bit() in vgic-mmio*
Message-Id: <E1ty6qf-003y5T-1t@xenbits.xenproject.org>
Date: Fri, 28 Mar 2025 10:22:01 +0000

commit 4abb6cff724afaf713aca08fa80e79de4a81bf61
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 30 14:25:28 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 28 08:00:53 2025 +0000

    ARM/vgic: Use for_each_set_bit() in vgic-mmio*
    
    These are all loops over a scalar value, and don't need to call general bitop
    helpers behind the scenes.
    
    Clamp data to the width of the access in dispatch_mmio_write(), rather than
    doing so in every handler.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/vgic/vgic-mmio.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/vgic/vgic-mmio.c b/xen/arch/arm/vgic/vgic-mmio.c
index 4ad350c21c..b4ba34cfc3 100644
--- a/xen/arch/arm/vgic/vgic-mmio.c
+++ b/xen/arch/arm/vgic/vgic-mmio.c
@@ -70,9 +70,8 @@ void vgic_mmio_write_senable(struct vcpu *vcpu,
                              unsigned long val)
 {
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
-    unsigned int i;
 
-    bitmap_for_each ( i, &val, len * 8 )
+    for_each_set_bit ( i, val )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
         unsigned long flags;
@@ -115,9 +114,8 @@ void vgic_mmio_write_cenable(struct vcpu *vcpu,
                              unsigned long val)
 {
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
-    unsigned int i;
 
-    bitmap_for_each ( i, &val, len * 8 )
+    for_each_set_bit ( i, val )
     {
         struct vgic_irq *irq;
         unsigned long flags;
@@ -183,11 +181,10 @@ void vgic_mmio_write_spending(struct vcpu *vcpu,
                               unsigned long val)
 {
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
-    unsigned int i;
     unsigned long flags;
     irq_desc_t *desc;
 
-    bitmap_for_each ( i, &val, len * 8 )
+    for_each_set_bit ( i, val )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -231,11 +228,10 @@ void vgic_mmio_write_cpending(struct vcpu *vcpu,
                               unsigned long val)
 {
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
-    unsigned int i;
     unsigned long flags;
     irq_desc_t *desc;
 
-    bitmap_for_each ( i, &val, len * 8 )
+    for_each_set_bit ( i, val )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -327,9 +323,8 @@ void vgic_mmio_write_cactive(struct vcpu *vcpu,
                              unsigned long val)
 {
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
-    unsigned int i;
 
-    bitmap_for_each ( i, &val, len * 8 )
+    for_each_set_bit ( i, val )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -357,9 +352,8 @@ void vgic_mmio_write_sactive(struct vcpu *vcpu,
                              unsigned long val)
 {
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
-    unsigned int i;
 
-    bitmap_for_each ( i, &val, len * 8 )
+    for_each_set_bit ( i, val )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -591,6 +585,10 @@ static int dispatch_mmio_write(struct vcpu *vcpu, mmio_info_t *info,
     if ( !region )
         return 0;
 
+    /* Clamp data to the width of the access. */
+    if ( len < sizeof(data) )
+        data &= (1UL << (len * 8)) - 1;
+
     switch (iodev->iodev_type)
     {
     case IODEV_DIST:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 28 10:22:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Mar 2025 10:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.930452.1333080 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ty6qr-00049S-2m; Fri, 28 Mar 2025 10:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 930452.1333080; Fri, 28 Mar 2025 10:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ty6qr-00049K-0C; Fri, 28 Mar 2025 10:22:13 +0000
Received: by outflank-mailman (input) for mailman id 930452;
 Fri, 28 Mar 2025 10:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ty6qp-00048p-P2
 for xen-changelog@lists.xenproject.org; Fri, 28 Mar 2025 10:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ty6qp-00DmZH-2P
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 10:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ty6qp-003y71-2H
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 10:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6Vkv7wpGrm9zODkm4q4DhsVPc/NUiT6pPl70q+HHLw8=; b=eYsrjy4db6NCrEmPoqwOrY/2DG
	XhigF1OM05EnnmIkJzoacnngkGeDs0nieJ2clWUWWRoj/dEqB4l0qxaUtTXv5xp4ynVoZUV4rkTMJ
	SU1mQTloX1lsnibv95CM8hYrYptGGPjvTUa5AExna/ZmE5F/xM0amb3qAesbTBgRRWdc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Xen: Update compiler baseline checks
Message-Id: <E1ty6qp-003y71-2H@xenbits.xenproject.org>
Date: Fri, 28 Mar 2025 10:22:11 +0000

commit 40458f7525504000ad26d7ef73cb452a976828fa
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 14:05:58 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 28 08:00:53 2025 +0000

    Xen: Update compiler baseline checks
    
    We have checks in both xen/compiler.h, and Config.mk.  Both are incomplete.
    
    The check in Config.mk sees $(CC) in system and cross-compiler form, so cannot
    express anything more than the global baseline.  Change it to simply 5.1.
    
    In xen/compiler.h, rewrite the expression for clarity/brevity.
    
    Include a GCC 12.2 check for RISCV, and include a Clang 11 baseline check.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk                  |  4 ++--
 xen/include/xen/compiler.h | 26 ++++++++++++++------------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/Config.mk b/Config.mk
index 8a73f3da62..8a60d4a55a 100644
--- a/Config.mk
+++ b/Config.mk
@@ -125,8 +125,8 @@ define cc-ver-check-closure
     endif
 endef
 
-# Require GCC v4.1+
-check-$(gcc) = $(call cc-ver-check,CC,0x040100,"Xen requires at least gcc-4.1")
+# Require GCC v5.1 as the project global baseline
+check-$(gcc) = $(call cc-ver-check,CC,0x050100,"Xen requires at least GCC 5.1")
 $(eval $(check-y))
 
 ld-ver-build-id = $(shell $(1) --build-id 2>&1 | \
diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 636a85bc41..38b8fa3d38 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -1,19 +1,21 @@
 #ifndef __LINUX_COMPILER_H
 #define __LINUX_COMPILER_H
 
-#if !defined(__GNUC__) || (__GNUC__ < 4)
-#error Sorry, your compiler is too old/not recognized.
-#elif CONFIG_CC_IS_GCC
-# if defined(CONFIG_ARM_32) && CONFIG_GCC_VERSION < 40900
-#  error Sorry, your version of GCC is too old - please use 4.9 or newer.
-# elif defined(CONFIG_ARM_64) && CONFIG_GCC_VERSION < 50100
-/*
- * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293
- * https://lore.kernel.org/r/20210107111841.GN1551@shell.armlinux.org.uk
- */
-#  error Sorry, your version of GCC is too old - please use 5.1 or newer.
+#if CONFIG_CC_IS_GCC
+
+# if defined(CONFIG_RISCV) && CONFIG_GCC_VERSION < 120200
+#  error Sorry, please use GCC >= 12.2
+# elif CONFIG_GCC_VERSION < 50100
+#  error Sorry, please use GCC >= 5.1
 # endif
-#endif
+
+#elif CONFIG_CC_IS_CLANG
+
+# if CONFIG_CLANG_VERSION < 110000
+#  error Sorry, please use Clang >= 11
+# endif
+
+#endif /* Compiler checks. */
 
 #ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
 /* Results in more efficient PIC code (no indirections through GOT or PLT). */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 28 10:22:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Mar 2025 10:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.930453.1333084 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ty6r1-0004C3-4E; Fri, 28 Mar 2025 10:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 930453.1333084; Fri, 28 Mar 2025 10:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ty6r1-0004Bv-1i; Fri, 28 Mar 2025 10:22:23 +0000
Received: by outflank-mailman (input) for mailman id 930453;
 Fri, 28 Mar 2025 10:22:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1ty6qz-0004Bj-SY
 for xen-changelog@lists.xenproject.org; Fri, 28 Mar 2025 10:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ty6qz-00DmZP-2k
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 10:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1ty6qz-003y7b-2Z
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 10:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/8LkhIVOw+r3DU/KlllYvJeEAcBhNPqccCEhM9Ypw7A=; b=L2rA4uKNHxMEBvNyFcCVkIW6eV
	Yy0G1sw076ns8zRLRGXMeUdm5eSSyD5k5NzNdEjVIpo8VWqveYzWea2rAg+FawaRPeOhkB5s0WT9p
	4cktndUyuyzLbyD1m+uITmpy+7hSfyUfr3OJlEM2AEmox5gQtV1OvsGnLCUhPD1p1wNU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG: Minimum toolchain requirements for x86 and ARM
Message-Id: <E1ty6qz-003y7b-2Z@xenbits.xenproject.org>
Date: Fri, 28 Mar 2025 10:22:21 +0000

commit eecb9f437b2c3e2d22d0af93dc6b1f4d978313a7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Mar 20 14:10:58 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Mar 28 08:00:53 2025 +0000

    CHANGELOG: Minimum toolchain requirements for x86 and ARM
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 35ab674924..8f6afa5c85 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ## [4.21.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
 ### Changed
+ - The minimum toolchain requirements have increased for some architectures:
+   - For x86, GCC 5.1 and Binutils 2.25, or Clang/LLVM 11
+   - For ARM32 and ARM64, GCC 5.1 and Binutils 2.25
 
 ### Added
  - On x86:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Mar 28 17:00:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Mar 2025 17:00:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.930996.1333504 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tyD3r-0003Wx-UM; Fri, 28 Mar 2025 17:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 930996.1333504; Fri, 28 Mar 2025 17:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tyD3r-0003WW-RH; Fri, 28 Mar 2025 17:00:03 +0000
Received: by outflank-mailman (input) for mailman id 930996;
 Fri, 28 Mar 2025 17:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tyD3p-000398-U9
 for xen-changelog@lists.xenproject.org; Fri, 28 Mar 2025 17:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tyD3p-00Dwkd-2g
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 17:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tyD3p-004m5Y-2a
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 17:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jf3OHsH2kvvNjvyBrdbIocO+TdTNY0kgaHPsAZXWpVo=; b=PQ173lq1ZaQ5wiDp+hOzvTg91r
	9j1XxEBPt9DF0xw+O1zrKgppO1xujRxSRuGWowOktlxMviS1UXXwk+BlG0+JC/0FR669IlzrhoPgH
	cOWk63XsRS6zkDxkE1MNIT1w1YlxV+WNiQ+ENwmMkaa5ItGvz9a4EwWOL5Y5EEtJd9/E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] kconfig/randconfig: Remove non-existing config
Message-Id: <E1tyD3p-004m5Y-2a@xenbits.xenproject.org>
Date: Fri, 28 Mar 2025 17:00:01 +0000

commit 1e18f132af00001e92eca7517a79298b7b1c8a77
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Wed Mar 26 14:29:04 2025 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 28 11:00:31 2025 +0100

    kconfig/randconfig: Remove non-existing config
    
    CONFIG_GCOV_FORMAT_AUTODETECT has been removed in 767e6c5fd55b.
    
    Fixes: 767e6c5fd55b ("kconfig/gcov: remove gcc version choice from kconfig")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/tools/kconfig/allrandom.config | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/tools/kconfig/allrandom.config b/xen/tools/kconfig/allrandom.config
index c7753ac4ad..f04b589a80 100644
--- a/xen/tools/kconfig/allrandom.config
+++ b/xen/tools/kconfig/allrandom.config
@@ -1,3 +1,2 @@
 # Explicit option choices not subject to regular RANDCONFIG
 
-CONFIG_GCOV_FORMAT_AUTODETECT=y
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 28 17:00:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Mar 2025 17:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.930997.1333508 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tyD41-00040W-VH; Fri, 28 Mar 2025 17:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 930997.1333508; Fri, 28 Mar 2025 17:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tyD41-00040O-Sb; Fri, 28 Mar 2025 17:00:13 +0000
Received: by outflank-mailman (input) for mailman id 930997;
 Fri, 28 Mar 2025 17:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tyD3z-000401-VI
 for xen-changelog@lists.xenproject.org; Fri, 28 Mar 2025 17:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tyD3z-00Dwkl-32
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 17:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tyD3z-004m7p-2t
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 17:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+35P33vRuwT5UoTlzXuAhs9ru0qFv/FDek8hurb9Hvs=; b=S4nYcbIxflXKShUKVh4GgHjJfK
	zx8rpa2RimSi53dbUC1Q2iNI/X/lspaihXAKpY0xNYY76apVN+TvZkVgRgdYoTN84tGAMPIQs52Zo
	LNzWGQdHM6Sjt+++CB69UvGP8oAqKUvpRmQ9PS6Wp2Y00fzt72I/Hdk01PEc30YAmfaE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/arm: Fix nr_spis handling v2
Message-Id: <E1tyD3z-004m7p-2t@xenbits.xenproject.org>
Date: Fri, 28 Mar 2025 17:00:11 +0000

commit 26d56ef796edf382e6cc07c2184659507889d07f
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Mar 25 12:00:29 2025 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 28 11:03:36 2025 +0100

    tools/arm: Fix nr_spis handling v2
    
    We are missing a way to detect whether a user provided a value for
    nr_spis equal to 0 or did not provide any value (default is also 0) which
    can cause issues when calculated nr_spis is > 0 and the value from domain
    config is 0. Fix it by setting default value for nr_spis to newly added
    LIBXL_NR_SPIS_DEFAULT i.e. UINT32_MAX (max supported nr of SPIs is 960
    anyway).
    
    Fixes: 55d62b8d4636 ("tools/arm: Reject configuration with incorrect nr_spis value")
    Reported-by: Luca Fancellu <luca.fancellu@arm.com>
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/libxl.h            |  1 +
 tools/libs/light/libxl_arm.c     | 17 +++++++++++------
 tools/libs/light/libxl_types.idl |  2 +-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index f8fe4afd7d..b7ad7735ca 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1579,6 +1579,7 @@ bool libxl_defbool_val(libxl_defbool db);
 
 const char *libxl_defbool_to_string(libxl_defbool b);
 
+#define LIBXL_NR_SPIS_DEFAULT (~(uint32_t)0)
 #define LIBXL_TIMER_MODE_DEFAULT -1
 #define LIBXL_MEMKB_DEFAULT ~0ULL
 
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 2d895408ca..75c811053c 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -84,7 +84,7 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
                                       libxl_domain_config *d_config,
                                       struct xen_domctl_createdomain *config)
 {
-    uint32_t nr_spis = 0;
+    uint32_t nr_spis = 0, cfg_nr_spis = d_config->b_info.arch_arm.nr_spis;
     unsigned int i;
     uint32_t vuart_irq, virtio_irq = 0;
     bool vuart_enabled = false, virtio_enabled = false;
@@ -181,13 +181,18 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
 
     LOG(DEBUG, "Configure the domain");
 
-    if (nr_spis > d_config->b_info.arch_arm.nr_spis) {
-        LOG(ERROR, "Provided nr_spis value is too small (minimum required %u)\n",
-            nr_spis);
-        return ERROR_FAIL;
+    /* Check if a user provided a value or not */
+    if (cfg_nr_spis != LIBXL_NR_SPIS_DEFAULT) {
+        if (nr_spis > cfg_nr_spis) {
+            LOG(ERROR, "Provided nr_spis value is too small (minimum required %u)\n",
+                nr_spis);
+            return ERROR_FAIL;
+        }
+        config->arch.nr_spis = cfg_nr_spis;
+    } else {
+        config->arch.nr_spis = nr_spis;
     }
 
-    config->arch.nr_spis = max(nr_spis, d_config->b_info.arch_arm.nr_spis);
     LOG(DEBUG, " - Allocate %u SPIs", config->arch.nr_spis);
 
     switch (d_config->b_info.arch_arm.gic_version) {
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index bd4b8721ff..9bb2969931 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -723,7 +723,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("arch_arm", Struct(None, [("gic_version", libxl_gic_version),
                                ("vuart", libxl_vuart_type),
                                ("sve_vl", libxl_sve_type),
-                               ("nr_spis", uint32),
+                               ("nr_spis", uint32, {'init_val': 'LIBXL_NR_SPIS_DEFAULT'}),
                               ])),
     ("arch_x86", Struct(None, [("msr_relaxed", libxl_defbool),
                               ])),
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Mar 28 17:00:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Mar 2025 17:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.930999.1333512 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tyD4C-00043P-0Q; Fri, 28 Mar 2025 17:00:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 930999.1333512; Fri, 28 Mar 2025 17:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tyD4B-00043H-U4; Fri, 28 Mar 2025 17:00:23 +0000
Received: by outflank-mailman (input) for mailman id 930999;
 Fri, 28 Mar 2025 17:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tyD4A-000430-2e
 for xen-changelog@lists.xenproject.org; Fri, 28 Mar 2025 17:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tyD4A-00Dwkp-08
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 17:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tyD49-004m8M-3C
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Mar 2025 17:00:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ch8bfH6dJr7KapNdOJiFUKy3UKcEs4PU7yzepG/HWns=; b=qKX9TxljfS5svk+lww8mXKoGxE
	GMPWYNNTYB6WBWhBz+JAT0gOqYut++Te+6I/2yFm/utuxE0O7qPtbEnvLQF2VUATj6evHzfxGMDYw
	HsIXPsAeElKdPyIzkf6Q/gfPFue3rW9LVgr20uPwgpSQcFyewn1+/YqIWJraxHC+4SPA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Change pipeline name for scheduled pipeline
Message-Id: <E1tyD49-004m8M-3C@xenbits.xenproject.org>
Date: Fri, 28 Mar 2025 17:00:21 +0000

commit dc0da10be66122480ffc8b8fac5d2ed582864fc1
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Thu Mar 27 10:34:01 2025 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 28 11:04:16 2025 +0100

    CI: Change pipeline name for scheduled pipeline
    
    This description is already displayed on the web UI of the list of
    pipeline, but using it as "name" will make it available in webhooks as
    well and can be used by a bot.
    
    This doesn't change the behavior for other pipeline types, where the
    variable isn't set.
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b3beb2ff9d..7974ac4e82 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,6 +4,7 @@ variables:
     description: "Regex to select only some jobs, must be enclosed with /. For example /job1|job2/"
 
 workflow:
+  name: "$CI_PIPELINE_SCHEDULE_DESCRIPTION"
   rules:
     - if: $CI_COMMIT_BRANCH =~ /^(master|smoke|^coverity-tested\/.*|stable-.*)$/
       when: never
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 07:33:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 07:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.931961.1334128 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tz9dm-0005xW-Mf; Mon, 31 Mar 2025 07:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 931961.1334128; Mon, 31 Mar 2025 07:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tz9dm-0005xO-JZ; Mon, 31 Mar 2025 07:33:02 +0000
Received: by outflank-mailman (input) for mailman id 931961;
 Mon, 31 Mar 2025 07:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tz9dl-0005xG-TH
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 07:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tz9dl-002DfS-21
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 07:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tz9dl-00BG0d-1q
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 07:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7ZlK4vpyH3/A5X6GpqS9LP5rhgsy/gzVZ4ym9ZD2Nmw=; b=37AOAAQd+4MmZ2sbIpUV53ihXz
	/pseKGBjewaUVqVtCn0UhLeIOQKTxnQ65T91wrBOGC6uIyQR/sgxjEUQJUlzzPlBmJK4y5RHZFf0z
	KBS3eNdlQsIRuC5ME/cj2TkADI1P1p9fXCIGwwVbW3b/mbi6uCwW58SbWVlrYvPJAgZA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Arm32: use new-style entry annotations for library code
Message-Id: <E1tz9dl-00BG0d-1q@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 07:33:01 +0000

commit dc7cf3b6706f017afe43195998a4f3aaf4ead7e1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 31 09:17:46 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 31 09:17:46 2025 +0200

    Arm32: use new-style entry annotations for library code
    
    No functional change, albeit all globals now become hidden, and aliasing
    symbols (__aeabi_{u,}idiv) lose their function-ness and size.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com> # arm
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm32/lib/findbit.S   | 32 ++++++++++++++---------------
 xen/arch/arm/arm32/lib/lib1funcs.S | 42 ++++++++++++++++++--------------------
 xen/arch/arm/arm32/lib/lshrdi3.S   |  7 +++----
 xen/arch/arm/arm32/lib/memchr.S    |  5 ++---
 xen/arch/arm/arm32/lib/memcpy.S    |  4 ++--
 xen/arch/arm/arm32/lib/memmove.S   |  4 ++--
 xen/arch/arm/arm32/lib/memset.S    |  5 ++---
 xen/arch/arm/arm32/lib/strchr.S    |  5 ++---
 xen/arch/arm/arm32/lib/strrchr.S   |  5 ++---
 9 files changed, 51 insertions(+), 58 deletions(-)

diff --git a/xen/arch/arm/arm32/lib/findbit.S b/xen/arch/arm/arm32/lib/findbit.S
index 00674a31ef..b57ded0d20 100644
--- a/xen/arch/arm/arm32/lib/findbit.S
+++ b/xen/arch/arm/arm32/lib/findbit.S
@@ -20,7 +20,7 @@
  * Purpose  : Find a 'zero' bit
  * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit);
  */
-ENTRY(_find_first_zero_bit_le)
+FUNC(_find_first_zero_bit_le)
 		teq	r1, #0	
 		beq	3f
 		mov	r2, #0
@@ -35,13 +35,13 @@ ENTRY(_find_first_zero_bit_le)
 		blo	1b
 3:		mov	r0, r1			@ no free bits
 		mov	pc, lr
-ENDPROC(_find_first_zero_bit_le)
+END(_find_first_zero_bit_le)
 
 /*
  * Purpose  : Find next 'zero' bit
  * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
  */
-ENTRY(_find_next_zero_bit_le)
+FUNC(_find_next_zero_bit_le)
 		cmp	r1, r2
 		bls	3b
 		ands	ip, r2, #7
@@ -55,13 +55,13 @@ ENTRY(_find_next_zero_bit_le)
 		orr	r2, r2, #7		@ if zero, then no bits here
 		add	r2, r2, #1		@ align bit pointer
 		b	2b			@ loop for next bit
-ENDPROC(_find_next_zero_bit_le)
+END(_find_next_zero_bit_le)
 
 /*
  * Purpose  : Find a 'one' bit
  * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit);
  */
-ENTRY(_find_first_bit_le)
+FUNC(_find_first_bit_le)
 		teq	r1, #0	
 		beq	3f
 		mov	r2, #0
@@ -76,13 +76,13 @@ ENTRY(_find_first_bit_le)
 		blo	1b
 3:		mov	r0, r1			@ no free bits
 		mov	pc, lr
-ENDPROC(_find_first_bit_le)
+END(_find_first_bit_le)
 
 /*
  * Purpose  : Find next 'one' bit
  * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
  */
-ENTRY(_find_next_bit_le)
+FUNC(_find_next_bit_le)
 		cmp	r1, r2
 		bls	3b
 		ands	ip, r2, #7
@@ -95,11 +95,11 @@ ENTRY(_find_next_bit_le)
 		orr	r2, r2, #7		@ if zero, then no bits here
 		add	r2, r2, #1		@ align bit pointer
 		b	2b			@ loop for next bit
-ENDPROC(_find_next_bit_le)
+END(_find_next_bit_le)
 
 #ifdef __ARMEB__
 
-ENTRY(_find_first_zero_bit_be)
+FUNC(_find_first_zero_bit_be)
 		teq	r1, #0
 		beq	3f
 		mov	r2, #0
@@ -114,9 +114,9 @@ ENTRY(_find_first_zero_bit_be)
 		blo	1b
 3:		mov	r0, r1			@ no free bits
 		mov	pc, lr
-ENDPROC(_find_first_zero_bit_be)
+END(_find_first_zero_bit_be)
 
-ENTRY(_find_next_zero_bit_be)
+FUNC(_find_next_zero_bit_be)
 		cmp	r1, r2
 		bls	3b
 		ands	ip, r2, #7
@@ -131,9 +131,9 @@ ENTRY(_find_next_zero_bit_be)
 		orr	r2, r2, #7		@ if zero, then no bits here
 		add	r2, r2, #1		@ align bit pointer
 		b	2b			@ loop for next bit
-ENDPROC(_find_next_zero_bit_be)
+END(_find_next_zero_bit_be)
 
-ENTRY(_find_first_bit_be)
+FUNC(_find_first_bit_be)
 		teq	r1, #0
 		beq	3f
 		mov	r2, #0
@@ -148,9 +148,9 @@ ENTRY(_find_first_bit_be)
 		blo	1b
 3:		mov	r0, r1			@ no free bits
 		mov	pc, lr
-ENDPROC(_find_first_bit_be)
+END(_find_first_bit_be)
 
-ENTRY(_find_next_bit_be)
+FUNC(_find_next_bit_be)
 		cmp	r1, r2
 		bls	3b
 		ands	ip, r2, #7
@@ -164,7 +164,7 @@ ENTRY(_find_next_bit_be)
 		orr	r2, r2, #7		@ if zero, then no bits here
 		add	r2, r2, #1		@ align bit pointer
 		b	2b			@ loop for next bit
-ENDPROC(_find_next_bit_be)
+END(_find_next_bit_be)
 
 #endif
 
diff --git a/xen/arch/arm/arm32/lib/lib1funcs.S b/xen/arch/arm/arm32/lib/lib1funcs.S
index f1278bd6c1..46d12216c4 100644
--- a/xen/arch/arm/arm32/lib/lib1funcs.S
+++ b/xen/arch/arm/arm32/lib/lib1funcs.S
@@ -201,8 +201,8 @@ along with this program; see the file COPYING.  If not, see <http://www.gnu.org/
 .endm
 
 
-ENTRY(__udivsi3)
-ENTRY(__aeabi_uidiv)
+FUNC(__udivsi3)
+LABEL(__aeabi_uidiv)
 UNWIND(.fnstart)
 
 	subs	r2, r1, #1
@@ -228,10 +228,9 @@ UNWIND(.fnstart)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__udivsi3)
-ENDPROC(__aeabi_uidiv)
+END(__udivsi3)
 
-ENTRY(__umodsi3)
+FUNC(__umodsi3)
 UNWIND(.fnstart)
 
 	subs	r2, r1, #1			@ compare divisor with 1
@@ -247,10 +246,10 @@ UNWIND(.fnstart)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__umodsi3)
+END(__umodsi3)
 
-ENTRY(__divsi3)
-ENTRY(__aeabi_idiv)
+FUNC(__divsi3)
+LABEL(__aeabi_idiv)
 UNWIND(.fnstart)
 
 	cmp	r1, #0
@@ -289,10 +288,9 @@ UNWIND(.fnstart)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__divsi3)
-ENDPROC(__aeabi_idiv)
+END(__divsi3)
 
-ENTRY(__modsi3)
+FUNC(__modsi3)
 UNWIND(.fnstart)
 
 	cmp	r1, #0
@@ -314,11 +312,11 @@ UNWIND(.fnstart)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__modsi3)
+END(__modsi3)
 
 #ifdef CONFIG_AEABI
 
-ENTRY(__aeabi_uidivmod)
+FUNC(__aeabi_uidivmod)
 UNWIND(.fnstart)
 UNWIND(.save {r0, r1, ip, lr}	)
 
@@ -330,9 +328,9 @@ UNWIND(.save {r0, r1, ip, lr}	)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__aeabi_uidivmod)
+END(__aeabi_uidivmod)
 
-ENTRY(__aeabi_idivmod)
+FUNC(__aeabi_idivmod)
 UNWIND(.fnstart)
 UNWIND(.save {r0, r1, ip, lr}	)
 	stmfd	sp!, {r0, r1, ip, lr}
@@ -343,9 +341,9 @@ UNWIND(.save {r0, r1, ip, lr}	)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__aeabi_idivmod)
+END(__aeabi_idivmod)
 
-ENTRY(__aeabi_uldivmod)
+FUNC(__aeabi_uldivmod)
 UNWIND(.fnstart)
 UNWIND(.save {lr}	)
 	sub sp, sp, #8
@@ -357,9 +355,9 @@ UNWIND(.save {lr}	)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__aeabi_uldivmod)
+END(__aeabi_uldivmod)
 
-ENTRY(__aeabi_ldivmod)
+FUNC(__aeabi_ldivmod)
 UNWIND(.fnstart)
 UNWIND(.save {lr}	)
 	sub sp, sp, #16
@@ -371,10 +369,10 @@ UNWIND(.save {lr}	)
 	mov	pc, lr
 	
 UNWIND(.fnend)
-ENDPROC(__aeabi_ldivmod)
+END(__aeabi_ldivmod)
 #endif
 
-Ldiv0:
+FUNC_LOCAL(Ldiv0)
 UNWIND(.fnstart)
 UNWIND(.pad #4)
 UNWIND(.save {lr})
@@ -383,4 +381,4 @@ UNWIND(.save {lr})
 	mov	r0, #0			@ About as wrong as it could be.
 	ldr	pc, [sp], #8
 UNWIND(.fnend)
-ENDPROC(Ldiv0)
+END(Ldiv0)
diff --git a/xen/arch/arm/arm32/lib/lshrdi3.S b/xen/arch/arm/arm32/lib/lshrdi3.S
index 88b9655282..edbb89a222 100644
--- a/xen/arch/arm/arm32/lib/lshrdi3.S
+++ b/xen/arch/arm/arm32/lib/lshrdi3.S
@@ -34,8 +34,8 @@ along with this program; see the file COPYING.  If not, see <http://www.gnu.org/
 #define ah r1
 #endif
 
-ENTRY(__lshrdi3)
-ENTRY(__aeabi_llsr)
+FUNC(__lshrdi3)
+LABEL(__aeabi_llsr)
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
@@ -47,5 +47,4 @@ ENTRY(__aeabi_llsr)
 	mov	ah, ah, lsr r2
 	mov	pc, lr
 
-ENDPROC(__lshrdi3)
-ENDPROC(__aeabi_llsr)
+END(__lshrdi3)
diff --git a/xen/arch/arm/arm32/lib/memchr.S b/xen/arch/arm/arm32/lib/memchr.S
index f38374a43e..12b3a7a1c1 100644
--- a/xen/arch/arm/arm32/lib/memchr.S
+++ b/xen/arch/arm/arm32/lib/memchr.S
@@ -12,8 +12,7 @@
 #include "assembler.h"
 
 	.text
-	.align	5
-ENTRY(memchr)
+FUNC(memchr, 32)
 	and	r1, r1, #0xff
 1:	subs	r2, r2, #1
 	bmi	2f
@@ -23,4 +22,4 @@ ENTRY(memchr)
 	sub	r0, r0, #1
 2:	movne	r0, #0
 	mov	pc, lr
-ENDPROC(memchr)
+END(memchr)
diff --git a/xen/arch/arm/arm32/lib/memcpy.S b/xen/arch/arm/arm32/lib/memcpy.S
index cc99be8379..98e94f0943 100644
--- a/xen/arch/arm/arm32/lib/memcpy.S
+++ b/xen/arch/arm/arm32/lib/memcpy.S
@@ -54,8 +54,8 @@
 
 /* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
 
-ENTRY(memcpy)
+FUNC(memcpy)
 
 #include "copy_template.S"
 
-ENDPROC(memcpy)
+END(memcpy)
diff --git a/xen/arch/arm/arm32/lib/memmove.S b/xen/arch/arm/arm32/lib/memmove.S
index 15352dba14..45e3029875 100644
--- a/xen/arch/arm/arm32/lib/memmove.S
+++ b/xen/arch/arm/arm32/lib/memmove.S
@@ -24,7 +24,7 @@
  * occurring in the opposite direction.
  */
 
-ENTRY(memmove)
+FUNC(memmove)
 
 		subs	ip, r0, r1
 		cmphi	r2, ip
@@ -194,4 +194,4 @@ ENTRY(memmove)
 
 18:		backward_copy_shift	push=24	pull=8
 
-ENDPROC(memmove)
+END(memmove)
diff --git a/xen/arch/arm/arm32/lib/memset.S b/xen/arch/arm/arm32/lib/memset.S
index ce82c45910..b5790030d7 100644
--- a/xen/arch/arm/arm32/lib/memset.S
+++ b/xen/arch/arm/arm32/lib/memset.S
@@ -12,9 +12,8 @@
 #include "assembler.h"
 
 	.text
-	.align	5
 
-ENTRY(memset)
+FUNC(memset, 32)
 	and	r1, r1, #0xff
 	ands	r3, r0, #3		@ 1 unaligned?
 	mov	ip, r0			@ preserve r0 as return value
@@ -120,4 +119,4 @@ ENTRY(memset)
 	strb	r1, [ip], #1		@ 1
 	add	r2, r2, r3		@ 1 (r2 = r2 - (4 - r3))
 	b	1b
-ENDPROC(memset)
+END(memset)
diff --git a/xen/arch/arm/arm32/lib/strchr.S b/xen/arch/arm/arm32/lib/strchr.S
index fa53ad8bc6..6e06726fce 100644
--- a/xen/arch/arm/arm32/lib/strchr.S
+++ b/xen/arch/arm/arm32/lib/strchr.S
@@ -14,8 +14,7 @@
 #include "assembler.h"
 
 		.text
-		.align	5
-ENTRY(strchr)
+FUNC(strchr, 32)
 		and	r1, r1, #0xff
 1:		ldrb	r2, [r0], #1
 		teq	r2, r1
@@ -25,4 +24,4 @@ ENTRY(strchr)
 		movne	r0, #0
 		subeq	r0, r0, #1
 		mov	pc, lr
-ENDPROC(strchr)
+END(strchr)
diff --git a/xen/arch/arm/arm32/lib/strrchr.S b/xen/arch/arm/arm32/lib/strrchr.S
index 374ce3e59d..73d045cafc 100644
--- a/xen/arch/arm/arm32/lib/strrchr.S
+++ b/xen/arch/arm/arm32/lib/strrchr.S
@@ -12,8 +12,7 @@
 #include "assembler.h"
 
 		.text
-		.align	5
-ENTRY(strrchr)
+FUNC(strrchr, 32)
 		and	r1, r1, #0xff
 		mov	r3, #0
 1:		ldrb	r2, [r0], #1
@@ -23,4 +22,4 @@ ENTRY(strrchr)
 		bne	1b
 		mov	r0, r3
 		mov	pc, lr
-ENDPROC(strrchr)
+END(strrchr)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 07:33:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 07:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.931962.1334132 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tz9dw-0005zH-O2; Mon, 31 Mar 2025 07:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 931962.1334132; Mon, 31 Mar 2025 07:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tz9dw-0005z8-LC; Mon, 31 Mar 2025 07:33:12 +0000
Received: by outflank-mailman (input) for mailman id 931962;
 Mon, 31 Mar 2025 07:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tz9dv-0005z0-OH
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 07:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tz9dv-002DfX-2J
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 07:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tz9dv-00BG1Y-2C
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 07:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/wTCjN1VKv4DFwCv/BZvILK1Fpjc3RYMyYSExiGaS4M=; b=RBLd+qzqaNNGRbkvjLkVFtu1BA
	6ilznwGFHIvmBagYqCEr7ykW/o/HlP+zQ9a9iHXg2WFQrLm3XTi6HwXiv1Bpv1GYWlNoS6S7uDiCk
	nmjK0mUK1qWUoTUMdOg1zUuumVlCkpXC/BE3ldPEe7uJmfTcg9xI+3F/2KeyRSSOR51g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Arm32: use new-style entry annotations for entry code
Message-Id: <E1tz9dv-00BG1Y-2C@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 07:33:11 +0000

commit 58e7a8d6fddb6d09ded315a2724faa63f7fc7aba
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 31 09:18:19 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 31 09:18:19 2025 +0200

    Arm32: use new-style entry annotations for entry code
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com> # arm
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm32/entry.S | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S
index 38826142ad..94bba440f0 100644
--- a/xen/arch/arm/arm32/entry.S
+++ b/xen/arch/arm/arm32/entry.S
@@ -31,7 +31,7 @@
  *  r4: Set to a non-zero value if a pending Abort exception took place.
  *      Otherwise, it will be set to zero.
  */
-prepare_context_from_guest:
+FUNC_LOCAL(prepare_context_from_guest)
 #ifdef CONFIG_ARM32_HARDEN_BRANCH_PREDICTOR
         /*
          * Restore vectors table to the default as it may have been
@@ -140,7 +140,7 @@ abort_guest_exit_end:
 
 skip_check:
         b   enter_hypervisor_from_guest_preirq
-ENDPROC(prepare_context_from_guest)
+END(prepare_context_from_guest)
 
         /*
          * Macro to define a trap entry.
@@ -362,13 +362,13 @@ trap_irq:
 trap_fiq:
         vector fiq
 
-return_from_trap:
+LABEL_LOCAL(return_from_trap)
         /*
          * Restore the stack pointer from r11. It was saved on exception
          * entry (see __DEFINE_TRAP_ENTRY).
          */
         mov sp, r11
-ENTRY(return_to_new_vcpu32)
+LABEL(return_to_new_vcpu32)
         ldr r11, [sp, #UREGS_cpsr]
         and r11, #PSR_MODE_MASK
         cmp r11, #PSR_MODE_HYP
@@ -426,6 +426,7 @@ return_to_hypervisor:
         clrex
         eret
         sb
+END(return_from_trap)
 
 /*
  * struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next)
@@ -435,12 +436,13 @@ return_to_hypervisor:
  *
  * Returns prev in r0
  */
-ENTRY(__context_switch)
+FUNC(__context_switch)
         add     ip, r0, #VCPU_arch_saved_context
         stmia   ip!, {r4 - sl, fp, sp, lr}      /* Save register state */
 
         add     r4, r1, #VCPU_arch_saved_context
         ldmia   r4, {r4 - sl, fp, sp, pc}       /* Load registers and return */
+END(__context_switch)
 
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 07:33:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 07:33:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.931963.1334136 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tz9e6-00062J-PP; Mon, 31 Mar 2025 07:33:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 931963.1334136; Mon, 31 Mar 2025 07:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tz9e6-000627-Ma; Mon, 31 Mar 2025 07:33:22 +0000
Received: by outflank-mailman (input) for mailman id 931963;
 Mon, 31 Mar 2025 07:33:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tz9e5-00061t-RN
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 07:33:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tz9e5-002Dfb-2d
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 07:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tz9e5-00BG2c-2V
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 07:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vvVo35S86VTz806fAeZsjfBamRXr/ZhSnA5l4KOhjbA=; b=e0zd1ZC9gp2xqwzCdUoaSWbOdu
	t7RCtTirJXT1N15fLRxXWKek733me3gH3Id5Jy7rOQ86WQ0GDDqm005QgD3h7lZqsQqJbvXUN9orI
	pU5pqZOn+HxNB06+jfjJa/AWC//TCj4yaHSHdZsZZfVBSuiipitE33EfUFWwuPJXC0xw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] trace: convert init_trace_bufs() to constructor
Message-Id: <E1tz9e5-00BG2c-2V@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 07:33:21 +0000

commit 4d8cd1a5b7228816ca07eb02033f1a3d1b2d69ad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 31 09:20:25 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 31 09:20:25 2025 +0200

    trace: convert init_trace_bufs() to constructor
    
    There's no need for each arch to invoke it directly, and there's no need
    for having a stub either. With the present placement of the calls to
    init_constructors() it can easily be a constructor itself.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/setup.c    | 2 --
 xen/arch/x86/setup.c    | 2 --
 xen/common/trace.c      | 4 +++-
 xen/include/xen/trace.h | 4 ----
 4 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index ffcae900d7..bf39d41e9b 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -491,8 +491,6 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
 
     heap_init_late();
 
-    init_trace_bufs();
-
     init_constructors();
 
     console_endboot();
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 7d6e52a55f..d70abb7e0c 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2145,8 +2145,6 @@ void asmlinkage __init noreturn __start_xen(void)
 
     heap_init_late();
 
-    init_trace_bufs();
-
     init_constructors();
 
     console_endboot();
diff --git a/xen/common/trace.c b/xen/common/trace.c
index 704edef39f..cfee6d7977 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -335,8 +335,10 @@ int trace_will_trace_event(u32 event)
  * This function is called at start of day in order to initialize the per-cpu
  * trace buffers.  The trace buffers are then available for debugging use, via
  * the %TRACE_xD macros exported in <xen/trace.h>.
+ *
+ * TODO: Try and make this a presmp_initcall() to improve alloc_trace_bufs().
  */
-void __init init_trace_bufs(void)
+static void __init __constructor init_trace_bufs(void)
 {
     cpumask_setall(&tb_cpu_mask);
     register_cpu_notifier(&cpu_nfb);
diff --git a/xen/include/xen/trace.h b/xen/include/xen/trace.h
index 914cecbc18..30ebdcc47f 100644
--- a/xen/include/xen/trace.h
+++ b/xen/include/xen/trace.h
@@ -29,9 +29,6 @@
 
 extern bool tb_init_done;
 
-/* Used to initialise trace buffer functionality */
-void init_trace_bufs(void);
-
 /* used to retrieve the physical address of the trace buffers */
 int tb_control(struct xen_sysctl_tbuf_op *tbc);
 
@@ -49,7 +46,6 @@ void __trace_hypercall(uint32_t event, unsigned long op,
 
 #define tb_init_done false
 
-static inline void init_trace_bufs(void) {}
 static inline int tb_control(struct xen_sysctl_tbuf_op *tbc)
 {
     return -ENOSYS;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 07:33:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 07:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.931965.1334142 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tz9eH-00065h-RW; Mon, 31 Mar 2025 07:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 931965.1334142; Mon, 31 Mar 2025 07:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tz9eH-00065Z-O1; Mon, 31 Mar 2025 07:33:33 +0000
Received: by outflank-mailman (input) for mailman id 931965;
 Mon, 31 Mar 2025 07:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tz9eG-00065D-0E
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 07:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tz9eF-002Dfy-36
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 07:33:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tz9eF-00BG38-2p
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 07:33:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ywX8HTekr/D93XAq7v1Ma1iODvcj20TDRCiWtmdKeUM=; b=tH3vd/P5glZFq1NmA3mmnezK9V
	YPD7v1qOnDPVvgEo4egQJzEMlMJ9IuUAi/4WYqg6x4Yq9FNoOgorGt5yEsLf6KJ2pGrbISk4hR36R
	hcirFhI9Orx4+33JF8D06jxlrVZ2kUeb2ictdrWZ0tQPIaC+pX+wICoyiZOWorVaY3do=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/P2M: synchronize fast and slow paths of p2m_get_page_from_gfn()
Message-Id: <E1tz9eF-00BG38-2p@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 07:33:31 +0000

commit a8325f981ce4ff8ac8bcc73735f357846b0a0fbb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 31 09:21:12 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 31 09:21:12 2025 +0200

    x86/P2M: synchronize fast and slow paths of p2m_get_page_from_gfn()
    
    Handling of both grants and foreign pages was different between the two
    paths.
    
    While permitting access to grants would be desirable, doing so would
    require more involved handling; undo that for the time being. In
    particular the page reference obtained would prevent the owning domain
    from changing e.g. the page's type (after the grantee has released the
    last reference of the grant). Instead perhaps another reference on the
    grant would need obtaining. Which in turn would require determining
    which grant that was.
    
    Foreign pages in any event need permitting on both paths.
    
    Introduce a helper function to be used on both paths, such that
    respective checking differs in just the extra "to be unshared" condition
    on the fast path.
    
    While there adjust the sanity check for foreign pages: Don't leak the
    reference on release builds when on a debug build the assertion would
    have triggered. (Thanks to Roger for the suggestion.)
    
    Fixes: 80ea7af17269 ("x86/mm: Introduce get_page_from_gfn()")
    Fixes: 50fe6e737059 ("pvh dom0: add and remove foreign pages")
    Fixes: cbbca7be4aaa ("x86/p2m: make p2m_get_page_from_gfn() handle grant case correctly")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c | 68 +++++++++++++++++++++++++++++----------------------
 1 file changed, 39 insertions(+), 29 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 4f8a781842..3a39b5d124 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -328,12 +328,46 @@ void p2m_put_gfn(struct p2m_domain *p2m, gfn_t gfn)
     gfn_unlock(p2m, gfn_x(gfn), 0);
 }
 
+static struct page_info *get_page_from_mfn_and_type(
+    const struct domain *d, mfn_t mfn, p2m_type_t t)
+{
+    struct page_info *page;
+
+    if ( !mfn_valid(mfn) )
+        return NULL;
+
+    page = mfn_to_page(mfn);
+
+    if ( p2m_is_ram(t) )
+    {
+        if ( p2m_is_shared(t) )
+            d = dom_cow;
+
+        if ( get_page(page, d) )
+            return page;
+    }
+    else if ( unlikely(p2m_is_foreign(t)) )
+    {
+        const struct domain *fdom = page_get_owner_and_reference(page);
+
+        if ( fdom )
+        {
+            if ( likely(fdom != d) )
+                return page;
+            ASSERT_UNREACHABLE();
+            put_page(page);
+        }
+    }
+
+    return NULL;
+}
+
 /* Atomically look up a GFN and take a reference count on the backing page. */
 struct page_info *p2m_get_page_from_gfn(
     struct p2m_domain *p2m, gfn_t gfn,
     p2m_type_t *t, p2m_access_t *a, p2m_query_t q)
 {
-    struct page_info *page = NULL;
+    struct page_info *page;
     p2m_access_t _a;
     p2m_type_t _t;
     mfn_t mfn;
@@ -347,26 +381,9 @@ struct page_info *p2m_get_page_from_gfn(
         /* Fast path: look up and get out */
         p2m_read_lock(p2m);
         mfn = p2m_get_gfn_type_access(p2m, gfn, t, a, 0, NULL, 0);
-        if ( p2m_is_any_ram(*t) && mfn_valid(mfn)
-             && !((q & P2M_UNSHARE) && p2m_is_shared(*t)) )
-        {
-            page = mfn_to_page(mfn);
-            if ( unlikely(p2m_is_foreign(*t)) || unlikely(p2m_is_grant(*t)) )
-            {
-                struct domain *fdom = page_get_owner_and_reference(page);
-
-                ASSERT(!p2m_is_foreign(*t) || fdom != p2m->domain);
-                if ( fdom == NULL )
-                    page = NULL;
-            }
-            else
-            {
-                struct domain *d = !p2m_is_shared(*t) ? p2m->domain : dom_cow;
-
-                if ( !get_page(page, d) )
-                    page = NULL;
-            }
-        }
+        page = !(q & P2M_UNSHARE) || !p2m_is_shared(*t)
+               ? get_page_from_mfn_and_type(p2m->domain, mfn, *t)
+               : NULL;
         p2m_read_unlock(p2m);
 
         if ( page )
@@ -380,14 +397,7 @@ struct page_info *p2m_get_page_from_gfn(
 
     /* Slow path: take the write lock and do fixups */
     mfn = get_gfn_type_access(p2m, gfn_x(gfn), t, a, q, NULL);
-    if ( p2m_is_ram(*t) && mfn_valid(mfn) )
-    {
-        struct domain *d = !p2m_is_shared(*t) ? p2m->domain : dom_cow;
-
-        page = mfn_to_page(mfn);
-        if ( !get_page(page, d) )
-            page = NULL;
-    }
+    page = get_page_from_mfn_and_type(p2m->domain, mfn, *t);
     put_gfn(p2m->domain, gfn_x(gfn));
 
     return page;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 07:33:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 07:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.931966.1334143 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tz9eR-00067z-S2; Mon, 31 Mar 2025 07:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 931966.1334143; Mon, 31 Mar 2025 07:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tz9eR-00067r-PS; Mon, 31 Mar 2025 07:33:43 +0000
Received: by outflank-mailman (input) for mailman id 931966;
 Mon, 31 Mar 2025 07:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tz9eQ-00067e-36
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 07:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tz9eQ-002Dg5-0D
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 07:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tz9eQ-00BG5z-03
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 07:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zm0UXn2V4NPBdvCxRnRA8/ney6H7sd0OiEerAQoeGag=; b=UkT40wVVCpj5W7/vcMK0rCcjnw
	3UZqrQkX7/UeGppRARb/h2iAVJJOytt7cT0fFkAUt3TJIS/En0IWf8ztmMDFBUAACmeVVSU1P2KiK
	r1zTNaRySxXmWmURZ8lhHkV9pygAbGNq9xLuQfyC7ZoLnaDZllX/Bkwt9nuX4qBOUnY4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/percpu: don't initialize percpu on resume
Message-Id: <E1tz9eQ-00BG5z-03@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 07:33:42 +0000

commit 282fa3fdb6a19c8ca56f79cdb9e6c1d1047d8e0a
Author:     Mykyta Poturai <mykyta_poturai@epam.com>
AuthorDate: Mon Mar 31 09:21:50 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 31 09:21:50 2025 +0200

    xen/percpu: don't initialize percpu on resume
    
    Invocation of the CPU_UP_PREPARE notification
    on ARM64 during resume causes a crash:
    
    (XEN) [  315.807606] Error bringing CPU1 up: -16
    (XEN) [  315.811926] Xen BUG at common/cpu.c:258
    [...]
    (XEN) [  316.142765] Xen call trace:
    (XEN) [  316.146048]    [<00000a0000202264>] enable_nonboot_cpus+0x128/0x1ac (PC)
    (XEN) [  316.153219]    [<00000a000020225c>] enable_nonboot_cpus+0x120/0x1ac (LR)
    (XEN) [  316.160391]    [<00000a0000278180>] suspend.c#system_suspend+0x4c/0x1a0
    (XEN) [  316.167476]    [<00000a0000206b70>] domain.c#continue_hypercall_tasklet_handler+0x54/0xd0
    (XEN) [  316.176117]    [<00000a0000226538>] tasklet.c#do_tasklet_work+0xb8/0x100
    (XEN) [  316.183288]    [<00000a0000226920>] do_tasklet+0x68/0xb0
    (XEN) [  316.189077]    [<00000a000026e120>] domain.c#idle_loop+0x7c/0x194
    (XEN) [  316.195644]    [<00000a0000277638>] shutdown.c#halt_this_cpu+0/0x14
    (XEN) [  316.202383]    [<0000000000000008>] 0000000000000008
    
    Freeing per-CPU areas and setting __per_cpu_offset to INVALID_PERCPU_AREA
    only occur when !park_offline_cpus and system_state is not SYS_STATE_suspend.
    On ARM64, park_offline_cpus is always false, so setting __per_cpu_offset to
    INVALID_PERCPU_AREA depends solely on the system state.
    
    If the system is suspended, this area is not freed, and during resume, an error
    occurs in init_percpu_area, causing a crash because INVALID_PERCPU_AREA is not
    set and park_offline_cpus remains 0:
    
        if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
            return park_offline_cpus ? 0 : -EBUSY;
    
    The same crash can occur on x86 if park_offline_cpus is set
    to 0 during Xen resume.
    
    Fixes: f75780d26b2f ("xen: move per-cpu area management into common code")
    Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
    Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/percpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/common/percpu.c b/xen/common/percpu.c
index e4e8b7bcab..c6ecd95a08 100644
--- a/xen/common/percpu.c
+++ b/xen/common/percpu.c
@@ -30,7 +30,9 @@ static int init_percpu_area(unsigned int cpu)
     char *p;
 
     if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
-        return park_offline_cpus ? 0 : -EBUSY;
+        return park_offline_cpus || system_state == SYS_STATE_resume
+               ? 0
+               : -EBUSY;
 
     if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL )
         return -ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 07:33:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 07:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.931967.1334148 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tz9eb-0006Ai-Uy; Mon, 31 Mar 2025 07:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 931967.1334148; Mon, 31 Mar 2025 07:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tz9eb-0006Aa-SC; Mon, 31 Mar 2025 07:33:53 +0000
Received: by outflank-mailman (input) for mailman id 931967;
 Mon, 31 Mar 2025 07:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tz9ea-0006AM-5s
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 07:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tz9ea-002DgA-0V
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 07:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tz9ea-00BG6c-0O
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 07:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u+8dVUocIS5EvdG2Z1VOFkuqhekUbmoPY29XtdIRWcM=; b=NAyOZukDeXjE8EmWYhD4xwEAz2
	L+0YywXLZy/C/WrlAzoJmTputCHMkIM0M874ePYJhu4juiWSSBwYDW1mb+v/yApn1MuLWdfGeo4tb
	oqy65Euumq20a+QUHAN3gzUIv9BGwrkolwOW//hlsVGsBS63WyvRTnZRF6uh3Wfm5XGw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: gcov: add support for gcc 14
Message-Id: <E1tz9ea-00BG6c-0O@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 07:33:52 +0000

commit 0d32dcb0731e59999b1b8578c5fcd17f0143a2a1
Author:     Volodymyr Babchuk <volodymyr_babchuk@epam.com>
AuthorDate: Mon Mar 31 09:22:11 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 31 09:22:11 2025 +0200

    xen: gcov: add support for gcc 14
    
    gcc 14 (with patch "Add condition coverage (MC/DC)") introduced 9th
    gcov counter. Also this version can call new merge function
    __gcov_merge_ior(), so we need a new stub for it.
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/coverage/gcc_4_7.c   | 4 +++-
 xen/common/coverage/gcov_base.c | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/common/coverage/gcc_4_7.c b/xen/common/coverage/gcc_4_7.c
index 1c20e35ee5..f4c1802303 100644
--- a/xen/common/coverage/gcc_4_7.c
+++ b/xen/common/coverage/gcc_4_7.c
@@ -28,8 +28,10 @@
 #define GCOV_COUNTERS 10
 #elif GCC_VERSION < 100000
 #define GCOV_COUNTERS 9
-#else
+#elif GCC_VERSION < 140000
 #define GCOV_COUNTERS 8
+#else
+#define GCOV_COUNTERS 9
 #endif
 
 #define GCOV_TAG_FUNCTION_LENGTH        3
diff --git a/xen/common/coverage/gcov_base.c b/xen/common/coverage/gcov_base.c
index d0c6d0a3f9..742034e039 100644
--- a/xen/common/coverage/gcov_base.c
+++ b/xen/common/coverage/gcov_base.c
@@ -56,6 +56,11 @@ void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
     /* Unused. */
 }
 
+void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
+{
+    /* Unused. */
+}
+
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 08:33:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 08:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932162.1334348 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAZr-0005pT-SO; Mon, 31 Mar 2025 08:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932162.1334348; Mon, 31 Mar 2025 08:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAZr-0005pL-Pi; Mon, 31 Mar 2025 08:33:03 +0000
Received: by outflank-mailman (input) for mailman id 932162;
 Mon, 31 Mar 2025 08:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzAZq-0005ld-GQ
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 08:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAZq-002FVR-0y
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAZq-00BJNH-0Z
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HZI4ihN1Wz2kfb8U4pvicg3SNLYl9gBvDmrr4MCnbNU=; b=pneDdIYfOUR48cDF6l8h5XrZcP
	7rkPoE0xi5hVkScxB9wZy/RCM3qeyev+ljri9OCAPW/dCCUWeck5TEJ3G9RuO+/qJeVQ0n1EheGqc
	tWa/UkNJF7wVmps95Hs2yowlzcIqlV7WAmyLvCJP7XJ0XFtfHbtLnygtyRCCsJlx0cdU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] kconfig/randconfig: Remove non-existing config
Message-Id: <E1tzAZq-00BJNH-0Z@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 08:33:02 +0000

commit 1e18f132af00001e92eca7517a79298b7b1c8a77
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Wed Mar 26 14:29:04 2025 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 28 11:00:31 2025 +0100

    kconfig/randconfig: Remove non-existing config
    
    CONFIG_GCOV_FORMAT_AUTODETECT has been removed in 767e6c5fd55b.
    
    Fixes: 767e6c5fd55b ("kconfig/gcov: remove gcc version choice from kconfig")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/tools/kconfig/allrandom.config | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/tools/kconfig/allrandom.config b/xen/tools/kconfig/allrandom.config
index c7753ac4ad..f04b589a80 100644
--- a/xen/tools/kconfig/allrandom.config
+++ b/xen/tools/kconfig/allrandom.config
@@ -1,3 +1,2 @@
 # Explicit option choices not subject to regular RANDCONFIG
 
-CONFIG_GCOV_FORMAT_AUTODETECT=y
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 08:33:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 08:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932174.1334361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAa2-0006IN-4I; Mon, 31 Mar 2025 08:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932174.1334361; Mon, 31 Mar 2025 08:33:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAa2-0006IF-1S; Mon, 31 Mar 2025 08:33:14 +0000
Received: by outflank-mailman (input) for mailman id 932174;
 Mon, 31 Mar 2025 08:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzAa0-0006Fu-ED
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 08:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAa0-002FVW-1H
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAa0-00BJOR-1A
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0r+gKTwkCswhfWZjb0Eovn9WaPbS3/i0JS7MugwmWR4=; b=Pfi0GCekMNwrzyGDevY61s6yaJ
	NpsBeqmsiSrkWtczfzNbCxmkr4ubMUZEk3yPT1rr/O9csmNHg6I/DIaL0MqtC39ziNSgZi8NTwUxR
	4w3PPdD7b1itmUuH6ue81tLWIKMdoVLDpbM1m7bsKokwEjkdMpc2QCf/pCDGZ5NuIJBQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/arm: Fix nr_spis handling v2
Message-Id: <E1tzAa0-00BJOR-1A@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 08:33:12 +0000

commit 26d56ef796edf382e6cc07c2184659507889d07f
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Mar 25 12:00:29 2025 +0100
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 28 11:03:36 2025 +0100

    tools/arm: Fix nr_spis handling v2
    
    We are missing a way to detect whether a user provided a value for
    nr_spis equal to 0 or did not provide any value (default is also 0) which
    can cause issues when calculated nr_spis is > 0 and the value from domain
    config is 0. Fix it by setting default value for nr_spis to newly added
    LIBXL_NR_SPIS_DEFAULT i.e. UINT32_MAX (max supported nr of SPIs is 960
    anyway).
    
    Fixes: 55d62b8d4636 ("tools/arm: Reject configuration with incorrect nr_spis value")
    Reported-by: Luca Fancellu <luca.fancellu@arm.com>
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/libxl.h            |  1 +
 tools/libs/light/libxl_arm.c     | 17 +++++++++++------
 tools/libs/light/libxl_types.idl |  2 +-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index f8fe4afd7d..b7ad7735ca 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1579,6 +1579,7 @@ bool libxl_defbool_val(libxl_defbool db);
 
 const char *libxl_defbool_to_string(libxl_defbool b);
 
+#define LIBXL_NR_SPIS_DEFAULT (~(uint32_t)0)
 #define LIBXL_TIMER_MODE_DEFAULT -1
 #define LIBXL_MEMKB_DEFAULT ~0ULL
 
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 2d895408ca..75c811053c 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -84,7 +84,7 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
                                       libxl_domain_config *d_config,
                                       struct xen_domctl_createdomain *config)
 {
-    uint32_t nr_spis = 0;
+    uint32_t nr_spis = 0, cfg_nr_spis = d_config->b_info.arch_arm.nr_spis;
     unsigned int i;
     uint32_t vuart_irq, virtio_irq = 0;
     bool vuart_enabled = false, virtio_enabled = false;
@@ -181,13 +181,18 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
 
     LOG(DEBUG, "Configure the domain");
 
-    if (nr_spis > d_config->b_info.arch_arm.nr_spis) {
-        LOG(ERROR, "Provided nr_spis value is too small (minimum required %u)\n",
-            nr_spis);
-        return ERROR_FAIL;
+    /* Check if a user provided a value or not */
+    if (cfg_nr_spis != LIBXL_NR_SPIS_DEFAULT) {
+        if (nr_spis > cfg_nr_spis) {
+            LOG(ERROR, "Provided nr_spis value is too small (minimum required %u)\n",
+                nr_spis);
+            return ERROR_FAIL;
+        }
+        config->arch.nr_spis = cfg_nr_spis;
+    } else {
+        config->arch.nr_spis = nr_spis;
     }
 
-    config->arch.nr_spis = max(nr_spis, d_config->b_info.arch_arm.nr_spis);
     LOG(DEBUG, " - Allocate %u SPIs", config->arch.nr_spis);
 
     switch (d_config->b_info.arch_arm.gic_version) {
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index bd4b8721ff..9bb2969931 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -723,7 +723,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("arch_arm", Struct(None, [("gic_version", libxl_gic_version),
                                ("vuart", libxl_vuart_type),
                                ("sve_vl", libxl_sve_type),
-                               ("nr_spis", uint32),
+                               ("nr_spis", uint32, {'init_val': 'LIBXL_NR_SPIS_DEFAULT'}),
                               ])),
     ("arch_x86", Struct(None, [("msr_relaxed", libxl_defbool),
                               ])),
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 08:33:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 08:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932181.1334365 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAaC-0006YH-5W; Mon, 31 Mar 2025 08:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932181.1334365; Mon, 31 Mar 2025 08:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAaC-0006Y9-2t; Mon, 31 Mar 2025 08:33:24 +0000
Received: by outflank-mailman (input) for mailman id 932181;
 Mon, 31 Mar 2025 08:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzAaA-0006WP-H6
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 08:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAaA-002FVc-1b
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAaA-00BJPZ-1R
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=P2nWZidWys2wOpDoSEiXdlrlGcdtkv/mdEIOv1Zj07w=; b=AOZy/pWxjfiMzeCR0KUQSoovmh
	rZV7irjV8Y4YlgRHCd+dDkCabsr0w/aQLbmL5CfHo/q1bDmDyvVBVFRKl9F1heaxzMBM9HjWT1bE0
	p2uMPHrfLBUvSIJ9woL8+NgXCA3eFR0bPJAVvDM3/z9gDyo7SnhhtUzdN7kcG97GiYMw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Change pipeline name for scheduled pipeline
Message-Id: <E1tzAaA-00BJPZ-1R@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 08:33:22 +0000

commit dc0da10be66122480ffc8b8fac5d2ed582864fc1
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Thu Mar 27 10:34:01 2025 +0000
Commit:     Anthony PERARD <anthony.perard@vates.tech>
CommitDate: Fri Mar 28 11:04:16 2025 +0100

    CI: Change pipeline name for scheduled pipeline
    
    This description is already displayed on the web UI of the list of
    pipeline, but using it as "name" will make it available in webhooks as
    well and can be used by a bot.
    
    This doesn't change the behavior for other pipeline types, where the
    variable isn't set.
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b3beb2ff9d..7974ac4e82 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,6 +4,7 @@ variables:
     description: "Regex to select only some jobs, must be enclosed with /. For example /job1|job2/"
 
 workflow:
+  name: "$CI_PIPELINE_SCHEDULE_DESCRIPTION"
   rules:
     - if: $CI_COMMIT_BRANCH =~ /^(master|smoke|^coverity-tested\/.*|stable-.*)$/
       when: never
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 08:33:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 08:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932187.1334370 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAaL-0006rW-7P; Mon, 31 Mar 2025 08:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932187.1334370; Mon, 31 Mar 2025 08:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAaL-0006rM-4G; Mon, 31 Mar 2025 08:33:33 +0000
Received: by outflank-mailman (input) for mailman id 932187;
 Mon, 31 Mar 2025 08:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzAaK-0006pB-Js
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 08:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAaK-002FXo-1t
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAaK-00BJQA-1m
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QNhUSJwJ37npzzpgZRMSIObK7LvPp8xgcFVl2Gr+iVA=; b=P03gb79pun/SDknP+NbBIHFO0G
	xPinr2OxKUSRN5mNU96GT8nbaPqSzqSYOBhbZuhbfGzLPF8IPMiRc/KEj33o+YuwcpjfLSRBW95OX
	2+hxKO1vFqgzSyox92lOKA7STRISNHHuBZ/XUV/qNxoLYEpRoeDS6OP0Tw94NXytsjnA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Arm32: use new-style entry annotations for library code
Message-Id: <E1tzAaK-00BJQA-1m@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 08:33:32 +0000

commit dc7cf3b6706f017afe43195998a4f3aaf4ead7e1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 31 09:17:46 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 31 09:17:46 2025 +0200

    Arm32: use new-style entry annotations for library code
    
    No functional change, albeit all globals now become hidden, and aliasing
    symbols (__aeabi_{u,}idiv) lose their function-ness and size.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com> # arm
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm32/lib/findbit.S   | 32 ++++++++++++++---------------
 xen/arch/arm/arm32/lib/lib1funcs.S | 42 ++++++++++++++++++--------------------
 xen/arch/arm/arm32/lib/lshrdi3.S   |  7 +++----
 xen/arch/arm/arm32/lib/memchr.S    |  5 ++---
 xen/arch/arm/arm32/lib/memcpy.S    |  4 ++--
 xen/arch/arm/arm32/lib/memmove.S   |  4 ++--
 xen/arch/arm/arm32/lib/memset.S    |  5 ++---
 xen/arch/arm/arm32/lib/strchr.S    |  5 ++---
 xen/arch/arm/arm32/lib/strrchr.S   |  5 ++---
 9 files changed, 51 insertions(+), 58 deletions(-)

diff --git a/xen/arch/arm/arm32/lib/findbit.S b/xen/arch/arm/arm32/lib/findbit.S
index 00674a31ef..b57ded0d20 100644
--- a/xen/arch/arm/arm32/lib/findbit.S
+++ b/xen/arch/arm/arm32/lib/findbit.S
@@ -20,7 +20,7 @@
  * Purpose  : Find a 'zero' bit
  * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit);
  */
-ENTRY(_find_first_zero_bit_le)
+FUNC(_find_first_zero_bit_le)
 		teq	r1, #0	
 		beq	3f
 		mov	r2, #0
@@ -35,13 +35,13 @@ ENTRY(_find_first_zero_bit_le)
 		blo	1b
 3:		mov	r0, r1			@ no free bits
 		mov	pc, lr
-ENDPROC(_find_first_zero_bit_le)
+END(_find_first_zero_bit_le)
 
 /*
  * Purpose  : Find next 'zero' bit
  * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
  */
-ENTRY(_find_next_zero_bit_le)
+FUNC(_find_next_zero_bit_le)
 		cmp	r1, r2
 		bls	3b
 		ands	ip, r2, #7
@@ -55,13 +55,13 @@ ENTRY(_find_next_zero_bit_le)
 		orr	r2, r2, #7		@ if zero, then no bits here
 		add	r2, r2, #1		@ align bit pointer
 		b	2b			@ loop for next bit
-ENDPROC(_find_next_zero_bit_le)
+END(_find_next_zero_bit_le)
 
 /*
  * Purpose  : Find a 'one' bit
  * Prototype: int find_first_bit(const unsigned long *addr, unsigned int maxbit);
  */
-ENTRY(_find_first_bit_le)
+FUNC(_find_first_bit_le)
 		teq	r1, #0	
 		beq	3f
 		mov	r2, #0
@@ -76,13 +76,13 @@ ENTRY(_find_first_bit_le)
 		blo	1b
 3:		mov	r0, r1			@ no free bits
 		mov	pc, lr
-ENDPROC(_find_first_bit_le)
+END(_find_first_bit_le)
 
 /*
  * Purpose  : Find next 'one' bit
  * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
  */
-ENTRY(_find_next_bit_le)
+FUNC(_find_next_bit_le)
 		cmp	r1, r2
 		bls	3b
 		ands	ip, r2, #7
@@ -95,11 +95,11 @@ ENTRY(_find_next_bit_le)
 		orr	r2, r2, #7		@ if zero, then no bits here
 		add	r2, r2, #1		@ align bit pointer
 		b	2b			@ loop for next bit
-ENDPROC(_find_next_bit_le)
+END(_find_next_bit_le)
 
 #ifdef __ARMEB__
 
-ENTRY(_find_first_zero_bit_be)
+FUNC(_find_first_zero_bit_be)
 		teq	r1, #0
 		beq	3f
 		mov	r2, #0
@@ -114,9 +114,9 @@ ENTRY(_find_first_zero_bit_be)
 		blo	1b
 3:		mov	r0, r1			@ no free bits
 		mov	pc, lr
-ENDPROC(_find_first_zero_bit_be)
+END(_find_first_zero_bit_be)
 
-ENTRY(_find_next_zero_bit_be)
+FUNC(_find_next_zero_bit_be)
 		cmp	r1, r2
 		bls	3b
 		ands	ip, r2, #7
@@ -131,9 +131,9 @@ ENTRY(_find_next_zero_bit_be)
 		orr	r2, r2, #7		@ if zero, then no bits here
 		add	r2, r2, #1		@ align bit pointer
 		b	2b			@ loop for next bit
-ENDPROC(_find_next_zero_bit_be)
+END(_find_next_zero_bit_be)
 
-ENTRY(_find_first_bit_be)
+FUNC(_find_first_bit_be)
 		teq	r1, #0
 		beq	3f
 		mov	r2, #0
@@ -148,9 +148,9 @@ ENTRY(_find_first_bit_be)
 		blo	1b
 3:		mov	r0, r1			@ no free bits
 		mov	pc, lr
-ENDPROC(_find_first_bit_be)
+END(_find_first_bit_be)
 
-ENTRY(_find_next_bit_be)
+FUNC(_find_next_bit_be)
 		cmp	r1, r2
 		bls	3b
 		ands	ip, r2, #7
@@ -164,7 +164,7 @@ ENTRY(_find_next_bit_be)
 		orr	r2, r2, #7		@ if zero, then no bits here
 		add	r2, r2, #1		@ align bit pointer
 		b	2b			@ loop for next bit
-ENDPROC(_find_next_bit_be)
+END(_find_next_bit_be)
 
 #endif
 
diff --git a/xen/arch/arm/arm32/lib/lib1funcs.S b/xen/arch/arm/arm32/lib/lib1funcs.S
index f1278bd6c1..46d12216c4 100644
--- a/xen/arch/arm/arm32/lib/lib1funcs.S
+++ b/xen/arch/arm/arm32/lib/lib1funcs.S
@@ -201,8 +201,8 @@ along with this program; see the file COPYING.  If not, see <http://www.gnu.org/
 .endm
 
 
-ENTRY(__udivsi3)
-ENTRY(__aeabi_uidiv)
+FUNC(__udivsi3)
+LABEL(__aeabi_uidiv)
 UNWIND(.fnstart)
 
 	subs	r2, r1, #1
@@ -228,10 +228,9 @@ UNWIND(.fnstart)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__udivsi3)
-ENDPROC(__aeabi_uidiv)
+END(__udivsi3)
 
-ENTRY(__umodsi3)
+FUNC(__umodsi3)
 UNWIND(.fnstart)
 
 	subs	r2, r1, #1			@ compare divisor with 1
@@ -247,10 +246,10 @@ UNWIND(.fnstart)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__umodsi3)
+END(__umodsi3)
 
-ENTRY(__divsi3)
-ENTRY(__aeabi_idiv)
+FUNC(__divsi3)
+LABEL(__aeabi_idiv)
 UNWIND(.fnstart)
 
 	cmp	r1, #0
@@ -289,10 +288,9 @@ UNWIND(.fnstart)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__divsi3)
-ENDPROC(__aeabi_idiv)
+END(__divsi3)
 
-ENTRY(__modsi3)
+FUNC(__modsi3)
 UNWIND(.fnstart)
 
 	cmp	r1, #0
@@ -314,11 +312,11 @@ UNWIND(.fnstart)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__modsi3)
+END(__modsi3)
 
 #ifdef CONFIG_AEABI
 
-ENTRY(__aeabi_uidivmod)
+FUNC(__aeabi_uidivmod)
 UNWIND(.fnstart)
 UNWIND(.save {r0, r1, ip, lr}	)
 
@@ -330,9 +328,9 @@ UNWIND(.save {r0, r1, ip, lr}	)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__aeabi_uidivmod)
+END(__aeabi_uidivmod)
 
-ENTRY(__aeabi_idivmod)
+FUNC(__aeabi_idivmod)
 UNWIND(.fnstart)
 UNWIND(.save {r0, r1, ip, lr}	)
 	stmfd	sp!, {r0, r1, ip, lr}
@@ -343,9 +341,9 @@ UNWIND(.save {r0, r1, ip, lr}	)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__aeabi_idivmod)
+END(__aeabi_idivmod)
 
-ENTRY(__aeabi_uldivmod)
+FUNC(__aeabi_uldivmod)
 UNWIND(.fnstart)
 UNWIND(.save {lr}	)
 	sub sp, sp, #8
@@ -357,9 +355,9 @@ UNWIND(.save {lr}	)
 	mov	pc, lr
 
 UNWIND(.fnend)
-ENDPROC(__aeabi_uldivmod)
+END(__aeabi_uldivmod)
 
-ENTRY(__aeabi_ldivmod)
+FUNC(__aeabi_ldivmod)
 UNWIND(.fnstart)
 UNWIND(.save {lr}	)
 	sub sp, sp, #16
@@ -371,10 +369,10 @@ UNWIND(.save {lr}	)
 	mov	pc, lr
 	
 UNWIND(.fnend)
-ENDPROC(__aeabi_ldivmod)
+END(__aeabi_ldivmod)
 #endif
 
-Ldiv0:
+FUNC_LOCAL(Ldiv0)
 UNWIND(.fnstart)
 UNWIND(.pad #4)
 UNWIND(.save {lr})
@@ -383,4 +381,4 @@ UNWIND(.save {lr})
 	mov	r0, #0			@ About as wrong as it could be.
 	ldr	pc, [sp], #8
 UNWIND(.fnend)
-ENDPROC(Ldiv0)
+END(Ldiv0)
diff --git a/xen/arch/arm/arm32/lib/lshrdi3.S b/xen/arch/arm/arm32/lib/lshrdi3.S
index 88b9655282..edbb89a222 100644
--- a/xen/arch/arm/arm32/lib/lshrdi3.S
+++ b/xen/arch/arm/arm32/lib/lshrdi3.S
@@ -34,8 +34,8 @@ along with this program; see the file COPYING.  If not, see <http://www.gnu.org/
 #define ah r1
 #endif
 
-ENTRY(__lshrdi3)
-ENTRY(__aeabi_llsr)
+FUNC(__lshrdi3)
+LABEL(__aeabi_llsr)
 
 	subs	r3, r2, #32
 	rsb	ip, r2, #32
@@ -47,5 +47,4 @@ ENTRY(__aeabi_llsr)
 	mov	ah, ah, lsr r2
 	mov	pc, lr
 
-ENDPROC(__lshrdi3)
-ENDPROC(__aeabi_llsr)
+END(__lshrdi3)
diff --git a/xen/arch/arm/arm32/lib/memchr.S b/xen/arch/arm/arm32/lib/memchr.S
index f38374a43e..12b3a7a1c1 100644
--- a/xen/arch/arm/arm32/lib/memchr.S
+++ b/xen/arch/arm/arm32/lib/memchr.S
@@ -12,8 +12,7 @@
 #include "assembler.h"
 
 	.text
-	.align	5
-ENTRY(memchr)
+FUNC(memchr, 32)
 	and	r1, r1, #0xff
 1:	subs	r2, r2, #1
 	bmi	2f
@@ -23,4 +22,4 @@ ENTRY(memchr)
 	sub	r0, r0, #1
 2:	movne	r0, #0
 	mov	pc, lr
-ENDPROC(memchr)
+END(memchr)
diff --git a/xen/arch/arm/arm32/lib/memcpy.S b/xen/arch/arm/arm32/lib/memcpy.S
index cc99be8379..98e94f0943 100644
--- a/xen/arch/arm/arm32/lib/memcpy.S
+++ b/xen/arch/arm/arm32/lib/memcpy.S
@@ -54,8 +54,8 @@
 
 /* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
 
-ENTRY(memcpy)
+FUNC(memcpy)
 
 #include "copy_template.S"
 
-ENDPROC(memcpy)
+END(memcpy)
diff --git a/xen/arch/arm/arm32/lib/memmove.S b/xen/arch/arm/arm32/lib/memmove.S
index 15352dba14..45e3029875 100644
--- a/xen/arch/arm/arm32/lib/memmove.S
+++ b/xen/arch/arm/arm32/lib/memmove.S
@@ -24,7 +24,7 @@
  * occurring in the opposite direction.
  */
 
-ENTRY(memmove)
+FUNC(memmove)
 
 		subs	ip, r0, r1
 		cmphi	r2, ip
@@ -194,4 +194,4 @@ ENTRY(memmove)
 
 18:		backward_copy_shift	push=24	pull=8
 
-ENDPROC(memmove)
+END(memmove)
diff --git a/xen/arch/arm/arm32/lib/memset.S b/xen/arch/arm/arm32/lib/memset.S
index ce82c45910..b5790030d7 100644
--- a/xen/arch/arm/arm32/lib/memset.S
+++ b/xen/arch/arm/arm32/lib/memset.S
@@ -12,9 +12,8 @@
 #include "assembler.h"
 
 	.text
-	.align	5
 
-ENTRY(memset)
+FUNC(memset, 32)
 	and	r1, r1, #0xff
 	ands	r3, r0, #3		@ 1 unaligned?
 	mov	ip, r0			@ preserve r0 as return value
@@ -120,4 +119,4 @@ ENTRY(memset)
 	strb	r1, [ip], #1		@ 1
 	add	r2, r2, r3		@ 1 (r2 = r2 - (4 - r3))
 	b	1b
-ENDPROC(memset)
+END(memset)
diff --git a/xen/arch/arm/arm32/lib/strchr.S b/xen/arch/arm/arm32/lib/strchr.S
index fa53ad8bc6..6e06726fce 100644
--- a/xen/arch/arm/arm32/lib/strchr.S
+++ b/xen/arch/arm/arm32/lib/strchr.S
@@ -14,8 +14,7 @@
 #include "assembler.h"
 
 		.text
-		.align	5
-ENTRY(strchr)
+FUNC(strchr, 32)
 		and	r1, r1, #0xff
 1:		ldrb	r2, [r0], #1
 		teq	r2, r1
@@ -25,4 +24,4 @@ ENTRY(strchr)
 		movne	r0, #0
 		subeq	r0, r0, #1
 		mov	pc, lr
-ENDPROC(strchr)
+END(strchr)
diff --git a/xen/arch/arm/arm32/lib/strrchr.S b/xen/arch/arm/arm32/lib/strrchr.S
index 374ce3e59d..73d045cafc 100644
--- a/xen/arch/arm/arm32/lib/strrchr.S
+++ b/xen/arch/arm/arm32/lib/strrchr.S
@@ -12,8 +12,7 @@
 #include "assembler.h"
 
 		.text
-		.align	5
-ENTRY(strrchr)
+FUNC(strrchr, 32)
 		and	r1, r1, #0xff
 		mov	r3, #0
 1:		ldrb	r2, [r0], #1
@@ -23,4 +22,4 @@ ENTRY(strrchr)
 		bne	1b
 		mov	r0, r3
 		mov	pc, lr
-ENDPROC(strrchr)
+END(strrchr)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 08:33:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 08:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932193.1334374 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAaV-00074h-8v; Mon, 31 Mar 2025 08:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932193.1334374; Mon, 31 Mar 2025 08:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAaV-00074Z-5v; Mon, 31 Mar 2025 08:33:43 +0000
Received: by outflank-mailman (input) for mailman id 932193;
 Mon, 31 Mar 2025 08:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzAaU-00073H-ND
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 08:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAaU-002FZg-2E
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAaU-00BJRN-23
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6R5iPe/+VJr1/fbzrrele9WwM3RuOBWXeZxJ2efb2Ag=; b=6NzUuhPIo7iZb/zHWwEQ/Q5Xyh
	uxRnbmiQJ1BcbkmP2/69l1aJOUvOipohREsUPJdipLiJorsfICcd9Uk2OefhGFeLmmI1NfBfMSC78
	w9v17Gjs/PU+yIZJP456a44o+wUha3lNUT39cbBqTKtz5tdMGdGdCa/c3h1P6ZvnNQqo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Arm32: use new-style entry annotations for entry code
Message-Id: <E1tzAaU-00BJRN-23@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 08:33:42 +0000

commit 58e7a8d6fddb6d09ded315a2724faa63f7fc7aba
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 31 09:18:19 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 31 09:18:19 2025 +0200

    Arm32: use new-style entry annotations for entry code
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com> # arm
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm32/entry.S | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S
index 38826142ad..94bba440f0 100644
--- a/xen/arch/arm/arm32/entry.S
+++ b/xen/arch/arm/arm32/entry.S
@@ -31,7 +31,7 @@
  *  r4: Set to a non-zero value if a pending Abort exception took place.
  *      Otherwise, it will be set to zero.
  */
-prepare_context_from_guest:
+FUNC_LOCAL(prepare_context_from_guest)
 #ifdef CONFIG_ARM32_HARDEN_BRANCH_PREDICTOR
         /*
          * Restore vectors table to the default as it may have been
@@ -140,7 +140,7 @@ abort_guest_exit_end:
 
 skip_check:
         b   enter_hypervisor_from_guest_preirq
-ENDPROC(prepare_context_from_guest)
+END(prepare_context_from_guest)
 
         /*
          * Macro to define a trap entry.
@@ -362,13 +362,13 @@ trap_irq:
 trap_fiq:
         vector fiq
 
-return_from_trap:
+LABEL_LOCAL(return_from_trap)
         /*
          * Restore the stack pointer from r11. It was saved on exception
          * entry (see __DEFINE_TRAP_ENTRY).
          */
         mov sp, r11
-ENTRY(return_to_new_vcpu32)
+LABEL(return_to_new_vcpu32)
         ldr r11, [sp, #UREGS_cpsr]
         and r11, #PSR_MODE_MASK
         cmp r11, #PSR_MODE_HYP
@@ -426,6 +426,7 @@ return_to_hypervisor:
         clrex
         eret
         sb
+END(return_from_trap)
 
 /*
  * struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next)
@@ -435,12 +436,13 @@ return_to_hypervisor:
  *
  * Returns prev in r0
  */
-ENTRY(__context_switch)
+FUNC(__context_switch)
         add     ip, r0, #VCPU_arch_saved_context
         stmia   ip!, {r4 - sl, fp, sp, lr}      /* Save register state */
 
         add     r4, r1, #VCPU_arch_saved_context
         ldmia   r4, {r4 - sl, fp, sp, pc}       /* Load registers and return */
+END(__context_switch)
 
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 08:33:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 08:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932200.1334378 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAaf-0007K3-BY; Mon, 31 Mar 2025 08:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932200.1334378; Mon, 31 Mar 2025 08:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAaf-0007Jv-8p; Mon, 31 Mar 2025 08:33:53 +0000
Received: by outflank-mailman (input) for mailman id 932200;
 Mon, 31 Mar 2025 08:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzAae-0007Jf-Q6
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 08:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAae-002FZo-2W
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAae-00BJSe-2Q
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Wi1pMjiyPdOgTPHxa6rByrakt8RWfM/YrkZeRX0xeHQ=; b=xgfSSP+oT2A5cPCQ6cs2pQ9BBD
	Imk4kMRjQKewhwK59+Cbo2lQaAWGVQiuWc5dnlZy1R8EWdAmTYF7CbnarzkG9DsTgypU0zf0wJHKg
	Uo/KoydTrTCJ8Xuj/mryJ2p+nV01aZzFR7nRpPVUvEknDTciOSWWvLMuDJ5aDOqZypko=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] trace: convert init_trace_bufs() to constructor
Message-Id: <E1tzAae-00BJSe-2Q@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 08:33:52 +0000

commit 4d8cd1a5b7228816ca07eb02033f1a3d1b2d69ad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 31 09:20:25 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 31 09:20:25 2025 +0200

    trace: convert init_trace_bufs() to constructor
    
    There's no need for each arch to invoke it directly, and there's no need
    for having a stub either. With the present placement of the calls to
    init_constructors() it can easily be a constructor itself.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/setup.c    | 2 --
 xen/arch/x86/setup.c    | 2 --
 xen/common/trace.c      | 4 +++-
 xen/include/xen/trace.h | 4 ----
 4 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index ffcae900d7..bf39d41e9b 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -491,8 +491,6 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
 
     heap_init_late();
 
-    init_trace_bufs();
-
     init_constructors();
 
     console_endboot();
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 7d6e52a55f..d70abb7e0c 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2145,8 +2145,6 @@ void asmlinkage __init noreturn __start_xen(void)
 
     heap_init_late();
 
-    init_trace_bufs();
-
     init_constructors();
 
     console_endboot();
diff --git a/xen/common/trace.c b/xen/common/trace.c
index 704edef39f..cfee6d7977 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -335,8 +335,10 @@ int trace_will_trace_event(u32 event)
  * This function is called at start of day in order to initialize the per-cpu
  * trace buffers.  The trace buffers are then available for debugging use, via
  * the %TRACE_xD macros exported in <xen/trace.h>.
+ *
+ * TODO: Try and make this a presmp_initcall() to improve alloc_trace_bufs().
  */
-void __init init_trace_bufs(void)
+static void __init __constructor init_trace_bufs(void)
 {
     cpumask_setall(&tb_cpu_mask);
     register_cpu_notifier(&cpu_nfb);
diff --git a/xen/include/xen/trace.h b/xen/include/xen/trace.h
index 914cecbc18..30ebdcc47f 100644
--- a/xen/include/xen/trace.h
+++ b/xen/include/xen/trace.h
@@ -29,9 +29,6 @@
 
 extern bool tb_init_done;
 
-/* Used to initialise trace buffer functionality */
-void init_trace_bufs(void);
-
 /* used to retrieve the physical address of the trace buffers */
 int tb_control(struct xen_sysctl_tbuf_op *tbc);
 
@@ -49,7 +46,6 @@ void __trace_hypercall(uint32_t event, unsigned long op,
 
 #define tb_init_done false
 
-static inline void init_trace_bufs(void) {}
 static inline int tb_control(struct xen_sysctl_tbuf_op *tbc)
 {
     return -ENOSYS;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 08:34:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 08:34:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932201.1334382 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAap-0007NE-Cz; Mon, 31 Mar 2025 08:34:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932201.1334382; Mon, 31 Mar 2025 08:34:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAap-0007N6-AE; Mon, 31 Mar 2025 08:34:03 +0000
Received: by outflank-mailman (input) for mailman id 932201;
 Mon, 31 Mar 2025 08:34:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzAao-0007N0-TH
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 08:34:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAao-002FaD-2p
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAao-00BJTX-2g
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:34:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qi/7L3vNecLalS6DpiyPD//ePfsXz/CPyXJ9pPu8844=; b=EHfJRoybqQuR0ZjjgEKJjEeSRl
	BKWgXh5/tvOkby9vZQMZL5B0wdMdxo6P6kVvJI3UNX9WHXx79NQoyhRWWLjUNWO9nl1yKrXNvye5+
	a1rmEV/n6Z9rhRaKrV36DRcNP8HhYoVzb6du7NPTb6jq8lx3ZxMNrzv4gclJ9S7VZz+Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/P2M: synchronize fast and slow paths of p2m_get_page_from_gfn()
Message-Id: <E1tzAao-00BJTX-2g@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 08:34:02 +0000

commit a8325f981ce4ff8ac8bcc73735f357846b0a0fbb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Mar 31 09:21:12 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 31 09:21:12 2025 +0200

    x86/P2M: synchronize fast and slow paths of p2m_get_page_from_gfn()
    
    Handling of both grants and foreign pages was different between the two
    paths.
    
    While permitting access to grants would be desirable, doing so would
    require more involved handling; undo that for the time being. In
    particular the page reference obtained would prevent the owning domain
    from changing e.g. the page's type (after the grantee has released the
    last reference of the grant). Instead perhaps another reference on the
    grant would need obtaining. Which in turn would require determining
    which grant that was.
    
    Foreign pages in any event need permitting on both paths.
    
    Introduce a helper function to be used on both paths, such that
    respective checking differs in just the extra "to be unshared" condition
    on the fast path.
    
    While there adjust the sanity check for foreign pages: Don't leak the
    reference on release builds when on a debug build the assertion would
    have triggered. (Thanks to Roger for the suggestion.)
    
    Fixes: 80ea7af17269 ("x86/mm: Introduce get_page_from_gfn()")
    Fixes: 50fe6e737059 ("pvh dom0: add and remove foreign pages")
    Fixes: cbbca7be4aaa ("x86/p2m: make p2m_get_page_from_gfn() handle grant case correctly")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c | 68 +++++++++++++++++++++++++++++----------------------
 1 file changed, 39 insertions(+), 29 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 4f8a781842..3a39b5d124 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -328,12 +328,46 @@ void p2m_put_gfn(struct p2m_domain *p2m, gfn_t gfn)
     gfn_unlock(p2m, gfn_x(gfn), 0);
 }
 
+static struct page_info *get_page_from_mfn_and_type(
+    const struct domain *d, mfn_t mfn, p2m_type_t t)
+{
+    struct page_info *page;
+
+    if ( !mfn_valid(mfn) )
+        return NULL;
+
+    page = mfn_to_page(mfn);
+
+    if ( p2m_is_ram(t) )
+    {
+        if ( p2m_is_shared(t) )
+            d = dom_cow;
+
+        if ( get_page(page, d) )
+            return page;
+    }
+    else if ( unlikely(p2m_is_foreign(t)) )
+    {
+        const struct domain *fdom = page_get_owner_and_reference(page);
+
+        if ( fdom )
+        {
+            if ( likely(fdom != d) )
+                return page;
+            ASSERT_UNREACHABLE();
+            put_page(page);
+        }
+    }
+
+    return NULL;
+}
+
 /* Atomically look up a GFN and take a reference count on the backing page. */
 struct page_info *p2m_get_page_from_gfn(
     struct p2m_domain *p2m, gfn_t gfn,
     p2m_type_t *t, p2m_access_t *a, p2m_query_t q)
 {
-    struct page_info *page = NULL;
+    struct page_info *page;
     p2m_access_t _a;
     p2m_type_t _t;
     mfn_t mfn;
@@ -347,26 +381,9 @@ struct page_info *p2m_get_page_from_gfn(
         /* Fast path: look up and get out */
         p2m_read_lock(p2m);
         mfn = p2m_get_gfn_type_access(p2m, gfn, t, a, 0, NULL, 0);
-        if ( p2m_is_any_ram(*t) && mfn_valid(mfn)
-             && !((q & P2M_UNSHARE) && p2m_is_shared(*t)) )
-        {
-            page = mfn_to_page(mfn);
-            if ( unlikely(p2m_is_foreign(*t)) || unlikely(p2m_is_grant(*t)) )
-            {
-                struct domain *fdom = page_get_owner_and_reference(page);
-
-                ASSERT(!p2m_is_foreign(*t) || fdom != p2m->domain);
-                if ( fdom == NULL )
-                    page = NULL;
-            }
-            else
-            {
-                struct domain *d = !p2m_is_shared(*t) ? p2m->domain : dom_cow;
-
-                if ( !get_page(page, d) )
-                    page = NULL;
-            }
-        }
+        page = !(q & P2M_UNSHARE) || !p2m_is_shared(*t)
+               ? get_page_from_mfn_and_type(p2m->domain, mfn, *t)
+               : NULL;
         p2m_read_unlock(p2m);
 
         if ( page )
@@ -380,14 +397,7 @@ struct page_info *p2m_get_page_from_gfn(
 
     /* Slow path: take the write lock and do fixups */
     mfn = get_gfn_type_access(p2m, gfn_x(gfn), t, a, q, NULL);
-    if ( p2m_is_ram(*t) && mfn_valid(mfn) )
-    {
-        struct domain *d = !p2m_is_shared(*t) ? p2m->domain : dom_cow;
-
-        page = mfn_to_page(mfn);
-        if ( !get_page(page, d) )
-            page = NULL;
-    }
+    page = get_page_from_mfn_and_type(p2m->domain, mfn, *t);
     put_gfn(p2m->domain, gfn_x(gfn));
 
     return page;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 08:34:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 08:34:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932202.1334386 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAaz-0007Po-EM; Mon, 31 Mar 2025 08:34:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932202.1334386; Mon, 31 Mar 2025 08:34:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAaz-0007Pg-Bh; Mon, 31 Mar 2025 08:34:13 +0000
Received: by outflank-mailman (input) for mailman id 932202;
 Mon, 31 Mar 2025 08:34:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzAaz-0007Pa-0G
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 08:34:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAay-002FaJ-39
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAay-00BJU1-30
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:34:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bd9NoAM4Twbz1GMgBp6vR3rlh+/eTg4ZXOrD7f1x7t4=; b=TQWDAkX7nsWkD82pQ3BFqZxcff
	j/fskl7jBNcoczrM9KJYWx9zHwKc1sVAC8UE3nk/Sydzilt/FVMdWDs71y7YzcuHz0MySOOSmSaHE
	VzCH8kYa9+5PWO0AbDT+icfyp7QLVH8kgBf6yq2oCdTocc3J8RCZFgpFnJ0EZdyOcbuE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/percpu: don't initialize percpu on resume
Message-Id: <E1tzAay-00BJU1-30@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 08:34:12 +0000

commit 282fa3fdb6a19c8ca56f79cdb9e6c1d1047d8e0a
Author:     Mykyta Poturai <mykyta_poturai@epam.com>
AuthorDate: Mon Mar 31 09:21:50 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 31 09:21:50 2025 +0200

    xen/percpu: don't initialize percpu on resume
    
    Invocation of the CPU_UP_PREPARE notification
    on ARM64 during resume causes a crash:
    
    (XEN) [  315.807606] Error bringing CPU1 up: -16
    (XEN) [  315.811926] Xen BUG at common/cpu.c:258
    [...]
    (XEN) [  316.142765] Xen call trace:
    (XEN) [  316.146048]    [<00000a0000202264>] enable_nonboot_cpus+0x128/0x1ac (PC)
    (XEN) [  316.153219]    [<00000a000020225c>] enable_nonboot_cpus+0x120/0x1ac (LR)
    (XEN) [  316.160391]    [<00000a0000278180>] suspend.c#system_suspend+0x4c/0x1a0
    (XEN) [  316.167476]    [<00000a0000206b70>] domain.c#continue_hypercall_tasklet_handler+0x54/0xd0
    (XEN) [  316.176117]    [<00000a0000226538>] tasklet.c#do_tasklet_work+0xb8/0x100
    (XEN) [  316.183288]    [<00000a0000226920>] do_tasklet+0x68/0xb0
    (XEN) [  316.189077]    [<00000a000026e120>] domain.c#idle_loop+0x7c/0x194
    (XEN) [  316.195644]    [<00000a0000277638>] shutdown.c#halt_this_cpu+0/0x14
    (XEN) [  316.202383]    [<0000000000000008>] 0000000000000008
    
    Freeing per-CPU areas and setting __per_cpu_offset to INVALID_PERCPU_AREA
    only occur when !park_offline_cpus and system_state is not SYS_STATE_suspend.
    On ARM64, park_offline_cpus is always false, so setting __per_cpu_offset to
    INVALID_PERCPU_AREA depends solely on the system state.
    
    If the system is suspended, this area is not freed, and during resume, an error
    occurs in init_percpu_area, causing a crash because INVALID_PERCPU_AREA is not
    set and park_offline_cpus remains 0:
    
        if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
            return park_offline_cpus ? 0 : -EBUSY;
    
    The same crash can occur on x86 if park_offline_cpus is set
    to 0 during Xen resume.
    
    Fixes: f75780d26b2f ("xen: move per-cpu area management into common code")
    Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
    Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/percpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/common/percpu.c b/xen/common/percpu.c
index e4e8b7bcab..c6ecd95a08 100644
--- a/xen/common/percpu.c
+++ b/xen/common/percpu.c
@@ -30,7 +30,9 @@ static int init_percpu_area(unsigned int cpu)
     char *p;
 
     if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
-        return park_offline_cpus ? 0 : -EBUSY;
+        return park_offline_cpus || system_state == SYS_STATE_resume
+               ? 0
+               : -EBUSY;
 
     if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL )
         return -ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 08:34:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 08:34:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932203.1334389 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAbA-0007Te-Ff; Mon, 31 Mar 2025 08:34:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932203.1334389; Mon, 31 Mar 2025 08:34:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzAbA-0007TX-DB; Mon, 31 Mar 2025 08:34:24 +0000
Received: by outflank-mailman (input) for mailman id 932203;
 Mon, 31 Mar 2025 08:34:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzAb9-0007TI-2o
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 08:34:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAb9-002FaP-0B
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzAb9-00BJVB-06
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 08:34:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Bjb57FYIsSdYO/abdN9Wlz/3r5VLIMYGDH863idVfIw=; b=qIcyvldUGvJ6V1wdU2aKocHAEK
	L66EYYtxZTOnYWdASO6MsEloV6vWoyWrPgvc6hw7URwd+/4XejtW7mx+DCFIsSK8T7Qidj41gexjP
	NIMjZ2gVzre6eseV/z3m2HcgztKMmZq/BykrTn8ZR1jV47zpAix20KQ2jZgAw+luSxaE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: gcov: add support for gcc 14
Message-Id: <E1tzAb9-00BJVB-06@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 08:34:23 +0000

commit 0d32dcb0731e59999b1b8578c5fcd17f0143a2a1
Author:     Volodymyr Babchuk <volodymyr_babchuk@epam.com>
AuthorDate: Mon Mar 31 09:22:11 2025 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Mar 31 09:22:11 2025 +0200

    xen: gcov: add support for gcc 14
    
    gcc 14 (with patch "Add condition coverage (MC/DC)") introduced 9th
    gcov counter. Also this version can call new merge function
    __gcov_merge_ior(), so we need a new stub for it.
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/coverage/gcc_4_7.c   | 4 +++-
 xen/common/coverage/gcov_base.c | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/common/coverage/gcc_4_7.c b/xen/common/coverage/gcc_4_7.c
index 1c20e35ee5..f4c1802303 100644
--- a/xen/common/coverage/gcc_4_7.c
+++ b/xen/common/coverage/gcc_4_7.c
@@ -28,8 +28,10 @@
 #define GCOV_COUNTERS 10
 #elif GCC_VERSION < 100000
 #define GCOV_COUNTERS 9
-#else
+#elif GCC_VERSION < 140000
 #define GCOV_COUNTERS 8
+#else
+#define GCOV_COUNTERS 9
 #endif
 
 #define GCOV_TAG_FUNCTION_LENGTH        3
diff --git a/xen/common/coverage/gcov_base.c b/xen/common/coverage/gcov_base.c
index d0c6d0a3f9..742034e039 100644
--- a/xen/common/coverage/gcov_base.c
+++ b/xen/common/coverage/gcov_base.c
@@ -56,6 +56,11 @@ void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
     /* Unused. */
 }
 
+void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
+{
+    /* Unused. */
+}
+
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 09:22:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 09:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932286.1334434 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzBLH-0002mf-LD; Mon, 31 Mar 2025 09:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932286.1334434; Mon, 31 Mar 2025 09:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzBLH-0002mY-Id; Mon, 31 Mar 2025 09:22:03 +0000
Received: by outflank-mailman (input) for mailman id 932286;
 Mon, 31 Mar 2025 09:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzBLG-0002mS-OZ
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 09:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzBLG-002Gwv-1b
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 09:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzBLG-00BX0o-1Q
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 09:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t+InlyhopWP2WAHNEyKxlepmoVYGYNeb5m4HoRK1EuA=; b=R/ad2X4Sy0w/fBUZhCe/z2KCyg
	sJzPXowq5TrKccdPgjqLhS6fNODAB/s4bOkB5BEbLwg1Juy93SOsm/8j/VxilvrRNhq3PSgAjm9eU
	pwb8V96Ot1G0SqJKX/O1M0ou0Vkp9NsuXGeuIr36UcLavJ9lVsF4Q1FNYzex2Iw9epJU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm32: Move MM specific registers to enable_mmu
Message-Id: <E1tzBLG-00BX0o-1Q@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 09:22:02 +0000

commit c8c2045133fdd448f619f78b70c9ddf030e27f20
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Sun Mar 30 20:03:04 2025 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Mon Mar 31 10:29:43 2025 +0200

    xen/arm32: Move MM specific registers to enable_mmu
    
    All the memory management specific registers are initialized in enable_mmu.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm32/head.S     | 14 --------------
 xen/arch/arm/arm32/mmu/head.S | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 4ff5c220bc..50da179f81 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -218,20 +218,6 @@ cpu_init:
         add   pc, r1, r10                   /* Call paddr(init func) */
 
 cpu_init_done:
-        /* Set up memory attribute type tables */
-        mov_w r0, MAIR0VAL
-        mov_w r1, MAIR1VAL
-        mcr   CP32(r0, HMAIR0)
-        mcr   CP32(r1, HMAIR1)
-
-        /*
-         * Set up the HTCR:
-         * PT walks use Inner-Shareable accesses,
-         * PT walks are write-back, write-allocate in both cache levels,
-         * Full 32-bit address space goes through this table.
-         */
-        mov_w r0, (TCR_RES1|TCR_SH0_IS|TCR_ORGN0_WBWA|TCR_IRGN0_WBWA|TCR_T0SZ(0))
-        mcr   CP32(r0, HTCR)
 
         mov_w r0, HSCTLR_SET
         mcr   CP32(r0, HSCTLR)
diff --git a/xen/arch/arm/arm32/mmu/head.S b/xen/arch/arm/arm32/mmu/head.S
index 1e2bbf0c82..8fa74bd556 100644
--- a/xen/arch/arm/arm32/mmu/head.S
+++ b/xen/arch/arm/arm32/mmu/head.S
@@ -279,6 +279,21 @@ ENDPROC(create_page_tables)
 enable_mmu:
         PRINT("- Turning on paging -\r\n")
 
+        /* Set up memory attribute type tables */
+        mov_w r0, MAIR0VAL
+        mov_w r1, MAIR1VAL
+        mcr   CP32(r0, HMAIR0)
+        mcr   CP32(r1, HMAIR1)
+
+        /*
+         * Set up the HTCR:
+         * PT walks use Inner-Shareable accesses,
+         * PT walks are write-back, write-allocate in both cache levels,
+         * Full 32-bit address space goes through this table.
+         */
+        mov_w r0, (TCR_RES1|TCR_SH0_IS|TCR_ORGN0_WBWA|TCR_IRGN0_WBWA|TCR_T0SZ(0))
+        mcr   CP32(r0, HTCR)
+
         /*
          * The state of the TLBs is unknown before turning on the MMU.
          * Flush them to avoid stale one.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 09:22:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 09:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932287.1334437 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzBLR-0002tp-Mj; Mon, 31 Mar 2025 09:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932287.1334437; Mon, 31 Mar 2025 09:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzBLR-0002tR-K5; Mon, 31 Mar 2025 09:22:13 +0000
Received: by outflank-mailman (input) for mailman id 932287;
 Mon, 31 Mar 2025 09:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzBLQ-0002s0-Jy
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 09:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzBLQ-002Gwz-1t
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 09:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzBLQ-00BX1j-1m
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 09:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hkR+Bgay5vDt8JyQeUNofdoJ/b7qjTgBq1gFettDRpM=; b=pCcBa+eX3Kjqf5GlMGux/EBASy
	7KTwn67eR/3JQHpnUS7NpLVeaOEcwxvE4sm7N8pLSzuebPOuq5dQ4S5D65g2PgBDBsClwiMhiIftW
	ZkYBwnDPJKk8eWyi3OjANwOFXiqY6Ajt6Oj4jIUG3zTGAK0cuXwIPDI/26meeqac/mbY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm32: Allow ARM_PA_BITS_40 only if !MPU
Message-Id: <E1tzBLQ-00BX1j-1m@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 09:22:12 +0000

commit 50974cecf43ad89b38a86d092cb8edf9d867f0d6
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Sun Mar 30 20:03:07 2025 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Mon Mar 31 10:30:05 2025 +0200

    xen/arm32: Allow ARM_PA_BITS_40 only if !MPU
    
    ArmV8-R AArch32 does not support LPAE. The reason being PMSAv8-32
    supports 32-bit physical address only.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index ffdff1f0a3..466b7db63c 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -58,7 +58,7 @@ config ARM_PA_BITS_32
 
 config ARM_PA_BITS_40
 	bool "40-bit"
-	depends on ARM_32
+	depends on ARM_32 && !MPU
 endchoice
 
 config PADDR_BITS
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 09:22:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 09:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932288.1334442 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzBLb-0002ym-Om; Mon, 31 Mar 2025 09:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932288.1334442; Mon, 31 Mar 2025 09:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzBLb-0002ye-LX; Mon, 31 Mar 2025 09:22:23 +0000
Received: by outflank-mailman (input) for mailman id 932288;
 Mon, 31 Mar 2025 09:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzBLa-0002yU-NG
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 09:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzBLa-002Gx7-2E
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 09:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzBLa-00BX3I-24
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 09:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Bhep9+VlmLpYSjZFNYdF1BxrRbZa7bsied0D8FVMOKU=; b=bL/r1tSNXem5xDrt9LKh5sog4g
	d2Vz+Mco0AzTD4cVw90/oP/qOPhVbSeUFIemiEowTvAPBW5ejLGlHyNFnMkYcANtD5nn6HcZsWgCN
	B+8ZKdr4XB+ptH1909qNX2/lkkMGxEtkMqljA4pcYwnLHMJmjiTP7AorPz/ehDsut11U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm/efi: merge neighboring banks
Message-Id: <E1tzBLa-00BX3I-24@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 09:22:22 +0000

commit fb9a7f6cf34a5051a99aad58511aaf41bcddb710
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Mar 28 14:33:31 2025 -0700
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Mon Mar 31 10:31:12 2025 +0200

    xen/arm/efi: merge neighboring banks
    
    When booting from U-Boot bootefi, there can be a high number of
    neighboring RAM banks. See for example:
    
    (XEN) RAM: 0000000000000000 - 0000000000bfffff
    (XEN) RAM: 0000000000c00000 - 0000000000c00fff
    (XEN) RAM: 0000000000c01000 - 0000000000dfffff
    (XEN) RAM: 0000000000e00000 - 000000000279dfff
    (XEN) RAM: 000000000279e000 - 00000000029fffff
    (XEN) RAM: 0000000002a00000 - 0000000008379fff
    (XEN) RAM: 000000000837a000 - 00000000083fffff
    (XEN) RAM: 0000000008400000 - 0000000008518fff
    (XEN) RAM: 0000000008519000 - 00000000085fffff
    (XEN) RAM: 0000000008600000 - 0000000008613fff
    (XEN) RAM: 0000000008614000 - 00000000097fffff
    (XEN) RAM: 0000000009800000 - 00000000098a7fff
    (XEN) RAM: 00000000098a8000 - 0000000009dfffff
    (XEN) RAM: 0000000009e00000 - 0000000009ea7fff
    (XEN) RAM: 0000000009ea8000 - 000000001fffffff
    (XEN) RAM: 0000000020000000 - 000000002007ffff
    (XEN) RAM: 0000000020080000 - 0000000077b17fff
    (XEN) RAM: 0000000077b19000 - 0000000077b2bfff
    (XEN) RAM: 0000000077b2c000 - 0000000077c8dfff
    (XEN) RAM: 0000000077c8e000 - 0000000077c91fff
    (XEN) RAM: 0000000077ca7000 - 0000000077caafff
    (XEN) RAM: 0000000077cac000 - 0000000077caefff
    (XEN) RAM: 0000000077cd0000 - 0000000077cd2fff
    (XEN) RAM: 0000000077cd4000 - 0000000077cd7fff
    (XEN) RAM: 0000000077cd8000 - 000000007bd07fff
    (XEN) RAM: 000000007bd09000 - 000000007fd5ffff
    (XEN) RAM: 000000007fd70000 - 000000007fefffff
    (XEN) RAM: 0000000800000000 - 000000087fffffff
    
    Xen does not currently support boot modules that span multiple banks: at
    least one of the regions get freed twice. The first time from
    setup_mm->populate_boot_allocator, then again from
    discard_initial_modules->fw_unreserved_regions. With a high number of
    banks, it can be difficult to arrange the boot modules in a way that
    avoids spanning across multiple banks.
    
    This small patch merges neighboring regions, to make dealing with them
    more efficient, and to make it easier to load boot modules.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/efi/efi-boot.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index a80a5a7ab3..dcad46ca72 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -163,6 +163,7 @@ static bool __init meminfo_add_bank(struct membanks *mem,
     struct membank *bank;
     paddr_t start = desc->PhysicalStart;
     paddr_t size = desc->NumberOfPages * EFI_PAGE_SIZE;
+    unsigned int j;
 
     if ( mem->nr_banks >= mem->max_banks )
         return false;
@@ -171,6 +172,15 @@ static bool __init meminfo_add_bank(struct membanks *mem,
         return false;
 #endif
 
+    for ( j = 0; j < mem->nr_banks; j++ )
+    {
+        if ( (mem->bank[j].start + mem->bank[j].size) == start )
+        {
+            mem->bank[j].size += size;
+            return true;
+        }
+    }
+
     bank = &mem->bank[mem->nr_banks];
     bank->start = start;
     bank->size = size;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 10:22:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 10:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932363.1334496 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzCHL-0003st-2Q; Mon, 31 Mar 2025 10:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932363.1334496; Mon, 31 Mar 2025 10:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzCHK-0003sl-Vq; Mon, 31 Mar 2025 10:22:02 +0000
Received: by outflank-mailman (input) for mailman id 932363;
 Mon, 31 Mar 2025 10:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzCHJ-0003rG-Sw
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 10:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzCHJ-002IUG-1s
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 10:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzCHJ-00BcmQ-1k
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 10:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CFaQwluubQzgMOrdWc4jreG86ZAilI19U//JtfLEsmo=; b=yDl7uzs1ES/XY8Kv9cvnMgOBS7
	Cn3XPEpFd2ovTe0f2ofhDxwOkrp4toGmd9bKWlpgXutqQfprWeXAxYvrKut0TyzCfP6rb/n5tn8v7
	g8n9nJfIG5PP6/acq3UhGyejo4zJ7T4YiQbVY842SoH0YMhwwNQ7BJNHQcApEJnBZFgE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm32: Move MM specific registers to enable_mmu
Message-Id: <E1tzCHJ-00BcmQ-1k@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 10:22:01 +0000

commit c8c2045133fdd448f619f78b70c9ddf030e27f20
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Sun Mar 30 20:03:04 2025 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Mon Mar 31 10:29:43 2025 +0200

    xen/arm32: Move MM specific registers to enable_mmu
    
    All the memory management specific registers are initialized in enable_mmu.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm32/head.S     | 14 --------------
 xen/arch/arm/arm32/mmu/head.S | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 4ff5c220bc..50da179f81 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -218,20 +218,6 @@ cpu_init:
         add   pc, r1, r10                   /* Call paddr(init func) */
 
 cpu_init_done:
-        /* Set up memory attribute type tables */
-        mov_w r0, MAIR0VAL
-        mov_w r1, MAIR1VAL
-        mcr   CP32(r0, HMAIR0)
-        mcr   CP32(r1, HMAIR1)
-
-        /*
-         * Set up the HTCR:
-         * PT walks use Inner-Shareable accesses,
-         * PT walks are write-back, write-allocate in both cache levels,
-         * Full 32-bit address space goes through this table.
-         */
-        mov_w r0, (TCR_RES1|TCR_SH0_IS|TCR_ORGN0_WBWA|TCR_IRGN0_WBWA|TCR_T0SZ(0))
-        mcr   CP32(r0, HTCR)
 
         mov_w r0, HSCTLR_SET
         mcr   CP32(r0, HSCTLR)
diff --git a/xen/arch/arm/arm32/mmu/head.S b/xen/arch/arm/arm32/mmu/head.S
index 1e2bbf0c82..8fa74bd556 100644
--- a/xen/arch/arm/arm32/mmu/head.S
+++ b/xen/arch/arm/arm32/mmu/head.S
@@ -279,6 +279,21 @@ ENDPROC(create_page_tables)
 enable_mmu:
         PRINT("- Turning on paging -\r\n")
 
+        /* Set up memory attribute type tables */
+        mov_w r0, MAIR0VAL
+        mov_w r1, MAIR1VAL
+        mcr   CP32(r0, HMAIR0)
+        mcr   CP32(r1, HMAIR1)
+
+        /*
+         * Set up the HTCR:
+         * PT walks use Inner-Shareable accesses,
+         * PT walks are write-back, write-allocate in both cache levels,
+         * Full 32-bit address space goes through this table.
+         */
+        mov_w r0, (TCR_RES1|TCR_SH0_IS|TCR_ORGN0_WBWA|TCR_IRGN0_WBWA|TCR_T0SZ(0))
+        mcr   CP32(r0, HTCR)
+
         /*
          * The state of the TLBs is unknown before turning on the MMU.
          * Flush them to avoid stale one.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 10:22:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 10:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932364.1334500 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzCHV-0003xO-3c; Mon, 31 Mar 2025 10:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932364.1334500; Mon, 31 Mar 2025 10:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzCHV-0003xG-15; Mon, 31 Mar 2025 10:22:13 +0000
Received: by outflank-mailman (input) for mailman id 932364;
 Mon, 31 Mar 2025 10:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzCHT-0003ww-MR
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 10:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzCHT-002IUK-29
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 10:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzCHT-00Bco4-22
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 10:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4iBYoc9Nc67Gt7UO/tgQ0HZqD7eUgzi/QaNCQlpPgWo=; b=rnQr4EX/JW9hLkw3Trn1DKbcU7
	w3RT+kKUblKoKaGLjlSWKcw8evD3Xvtsbgrcrx2mu92KorvTOTbblEwoB2E3Af9xO6G5gUVWV1IfA
	xwbLjYOVUY1pU05Qp4kY2y4FEVy1M+JtbRcCzOUKL6M+YOcsZUbSi1ovUePPBbwYBeY8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm32: Allow ARM_PA_BITS_40 only if !MPU
Message-Id: <E1tzCHT-00Bco4-22@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 10:22:11 +0000

commit 50974cecf43ad89b38a86d092cb8edf9d867f0d6
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Sun Mar 30 20:03:07 2025 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Mon Mar 31 10:30:05 2025 +0200

    xen/arm32: Allow ARM_PA_BITS_40 only if !MPU
    
    ArmV8-R AArch32 does not support LPAE. The reason being PMSAv8-32
    supports 32-bit physical address only.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index ffdff1f0a3..466b7db63c 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -58,7 +58,7 @@ config ARM_PA_BITS_32
 
 config ARM_PA_BITS_40
 	bool "40-bit"
-	depends on ARM_32
+	depends on ARM_32 && !MPU
 endchoice
 
 config PADDR_BITS
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 10:22:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 10:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932365.1334504 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzCHf-00043w-5I; Mon, 31 Mar 2025 10:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932365.1334504; Mon, 31 Mar 2025 10:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzCHf-00043m-2U; Mon, 31 Mar 2025 10:22:23 +0000
Received: by outflank-mailman (input) for mailman id 932365;
 Mon, 31 Mar 2025 10:22:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzCHd-00043T-P7
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 10:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzCHd-002IUS-2Q
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 10:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzCHd-00Bcop-2J
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 10:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ViGDigzyCFvFnDrvqjsOPk95ooSjFw4lIUcBY7kX6cY=; b=jW0AWflGX3tinoDP6Qqh1uauF2
	FFc58Bac/Kq+cSEJ8ySQO25Wn8F9vTY0UCOq3DpWhIAGNEvdvb2RgHpqJOSazq/IuOTJDIad/dovr
	M+IMMMZhTL9uYRZNSJlhbF592EprI3Us0S3dkoLqVU/cbecZJAytay91xx5bTlmAVG5c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm/efi: merge neighboring banks
Message-Id: <E1tzCHd-00Bcop-2J@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 10:22:21 +0000

commit fb9a7f6cf34a5051a99aad58511aaf41bcddb710
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Mar 28 14:33:31 2025 -0700
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Mon Mar 31 10:31:12 2025 +0200

    xen/arm/efi: merge neighboring banks
    
    When booting from U-Boot bootefi, there can be a high number of
    neighboring RAM banks. See for example:
    
    (XEN) RAM: 0000000000000000 - 0000000000bfffff
    (XEN) RAM: 0000000000c00000 - 0000000000c00fff
    (XEN) RAM: 0000000000c01000 - 0000000000dfffff
    (XEN) RAM: 0000000000e00000 - 000000000279dfff
    (XEN) RAM: 000000000279e000 - 00000000029fffff
    (XEN) RAM: 0000000002a00000 - 0000000008379fff
    (XEN) RAM: 000000000837a000 - 00000000083fffff
    (XEN) RAM: 0000000008400000 - 0000000008518fff
    (XEN) RAM: 0000000008519000 - 00000000085fffff
    (XEN) RAM: 0000000008600000 - 0000000008613fff
    (XEN) RAM: 0000000008614000 - 00000000097fffff
    (XEN) RAM: 0000000009800000 - 00000000098a7fff
    (XEN) RAM: 00000000098a8000 - 0000000009dfffff
    (XEN) RAM: 0000000009e00000 - 0000000009ea7fff
    (XEN) RAM: 0000000009ea8000 - 000000001fffffff
    (XEN) RAM: 0000000020000000 - 000000002007ffff
    (XEN) RAM: 0000000020080000 - 0000000077b17fff
    (XEN) RAM: 0000000077b19000 - 0000000077b2bfff
    (XEN) RAM: 0000000077b2c000 - 0000000077c8dfff
    (XEN) RAM: 0000000077c8e000 - 0000000077c91fff
    (XEN) RAM: 0000000077ca7000 - 0000000077caafff
    (XEN) RAM: 0000000077cac000 - 0000000077caefff
    (XEN) RAM: 0000000077cd0000 - 0000000077cd2fff
    (XEN) RAM: 0000000077cd4000 - 0000000077cd7fff
    (XEN) RAM: 0000000077cd8000 - 000000007bd07fff
    (XEN) RAM: 000000007bd09000 - 000000007fd5ffff
    (XEN) RAM: 000000007fd70000 - 000000007fefffff
    (XEN) RAM: 0000000800000000 - 000000087fffffff
    
    Xen does not currently support boot modules that span multiple banks: at
    least one of the regions get freed twice. The first time from
    setup_mm->populate_boot_allocator, then again from
    discard_initial_modules->fw_unreserved_regions. With a high number of
    banks, it can be difficult to arrange the boot modules in a way that
    avoids spanning across multiple banks.
    
    This small patch merges neighboring regions, to make dealing with them
    more efficient, and to make it easier to load boot modules.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/efi/efi-boot.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index a80a5a7ab3..dcad46ca72 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -163,6 +163,7 @@ static bool __init meminfo_add_bank(struct membanks *mem,
     struct membank *bank;
     paddr_t start = desc->PhysicalStart;
     paddr_t size = desc->NumberOfPages * EFI_PAGE_SIZE;
+    unsigned int j;
 
     if ( mem->nr_banks >= mem->max_banks )
         return false;
@@ -171,6 +172,15 @@ static bool __init meminfo_add_bank(struct membanks *mem,
         return false;
 #endif
 
+    for ( j = 0; j < mem->nr_banks; j++ )
+    {
+        if ( (mem->bank[j].start + mem->bank[j].size) == start )
+        {
+            mem->bank[j].size += size;
+            return true;
+        }
+    }
+
     bank = &mem->bank[mem->nr_banks];
     bank->start = start;
     bank->size = size;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 15:44:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 15:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932783.1334837 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzHIx-0001pW-29; Mon, 31 Mar 2025 15:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932783.1334837; Mon, 31 Mar 2025 15:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzHIw-0001pO-Vl; Mon, 31 Mar 2025 15:44:02 +0000
Received: by outflank-mailman (input) for mailman id 932783;
 Mon, 31 Mar 2025 15:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzHIw-0001pI-CU
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 15:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzHIv-002Q3J-2z
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 15:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzHIv-00CSzV-2s
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 15:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=G+AM9rYXRC49wottkPyZxfwF+V5RDun5Sc6hzu3B1+Q=; b=v9Rs7Sdx7nV8EB131pBl+GRVRg
	vehvnBsaHdktWs6zy8akifnQATODucGxXEv4TLi6mtvxtw5NnNVFpcHlQoofQwFY4RoNG9pBjZf0R
	AgHH04NYHLZZV5Gp9cfvktDh5Flvmh7B/bcn9abZ/r2SAWNNvusApzzJSeA84TN2dpAA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/types: Drop compatibility for GCC < 4.4
Message-Id: <E1tzHIv-00CSzV-2s@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 15:44:01 +0000

commit 5e91dd16175b185e51cf465fc539177d18dd4b5a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 28 16:49:21 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 31 14:38:29 2025 +0100

    xen/types: Drop compatibility for GCC < 4.4
    
    We now have compiler types for every standard type we use.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/stdint.h | 19 -------------------
 xen/include/xen/types.h  |  3 +--
 2 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/xen/include/xen/stdint.h b/xen/include/xen/stdint.h
index a40165c6ae..dde12964bf 100644
--- a/xen/include/xen/stdint.h
+++ b/xen/include/xen/stdint.h
@@ -2,23 +2,6 @@
 #ifndef __XEN_STDINT_H__
 #define __XEN_STDINT_H__
 
-#ifndef __INT8_TYPE__ /* GCC <= 4.4 */
-
-/*
- * Define the types using GCC internal notation.  Clang understands this too.
- * https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html
- */
-typedef   signed __attribute__((__mode__(__QI__)))     int8_t;
-typedef unsigned __attribute__((__mode__(__QI__)))    uint8_t;
-typedef   signed __attribute__((__mode__(__HI__)))    int16_t;
-typedef unsigned __attribute__((__mode__(__HI__)))   uint16_t;
-typedef   signed __attribute__((__mode__(__SI__)))    int32_t;
-typedef unsigned __attribute__((__mode__(__SI__)))   uint32_t;
-typedef   signed __attribute__((__mode__(__DI__)))    int64_t;
-typedef unsigned __attribute__((__mode__(__DI__)))   uint64_t;
-
-#else
-
 typedef __INT8_TYPE__        int8_t;
 typedef __UINT8_TYPE__      uint8_t;
 typedef __INT16_TYPE__      int16_t;
@@ -28,6 +11,4 @@ typedef __UINT32_TYPE__    uint32_t;
 typedef __INT64_TYPE__      int64_t;
 typedef __UINT64_TYPE__    uint64_t;
 
-#endif
-
 #endif /* __XEN_STDINT_H__ */
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 543bfb2159..e8d419b954 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -17,6 +17,7 @@ typedef __SIZE_TYPE__ size_t;
 typedef signed long ssize_t;
 
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
+typedef __UINTPTR_TYPE__ uintptr_t;
 
 /*
  * Users of this macro are expected to pass a positive value.
@@ -58,8 +59,6 @@ typedef uint32_t __be32;
 typedef uint64_t __le64;
 typedef uint64_t __be64;
 
-typedef unsigned int __attribute__((__mode__(__pointer__))) uintptr_t;
-
 #define test_and_set_bool(b)   xchg(&(b), true)
 #define test_and_clear_bool(b) xchg(&(b), false)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 15:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 15:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932784.1334840 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzHJ7-0001rB-3N; Mon, 31 Mar 2025 15:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932784.1334840; Mon, 31 Mar 2025 15:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzHJ7-0001r4-0v; Mon, 31 Mar 2025 15:44:13 +0000
Received: by outflank-mailman (input) for mailman id 932784;
 Mon, 31 Mar 2025 15:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzHJ6-0001qy-2O
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 15:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzHJ6-002Q3P-07
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 15:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzHJ5-00CT0h-3C
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 15:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ngt5LRbrOh5zcb/RVHtJ0o1xZ79UGXp5Pnljr6iySDM=; b=mG0XKVhdnO9uHdmboBwkmw22EC
	/wLBMffnM940wwZpWMHwxV7LkdxvtN7WxfP4dUasbPqTtngEEFEZdUrHQEFvrUjxXXUIGBxI4l6zp
	POMJvCx2oLeBv6eNMnHtCCsq+8Xu1SV3UxB7rDkjWJN6prP5yVCrMry9O62A6giCpL6k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: Fix blowfish build in 64bit-clean environments
Message-Id: <E1tzHJ5-00CT0h-3C@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 15:44:11 +0000

commit 15341fcac7668858438333c6467364aa2d47ec94
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 28 17:18:51 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 31 14:38:56 2025 +0100

    x86emul: Fix blowfish build in 64bit-clean environments
    
    In a 64bit-clean environment, blowfish fails:
    
      make[6]: Leaving directory
      '/builddir/build/BUILD/xen-4.19.1/tools/tests/x86_emulator'
      In file included from /usr/include/features.h:535,
                       from /usr/include/bits/libc-header-start.h:33,
                       from /usr/include/stdint.h:26,
                       from
      /usr/lib/gcc/x86_64-xenserver-linux/12/include/stdint.h:9,
                       from blowfish.c:18:
      /usr/include/gnu/stubs.h:7:11: fatal error: gnu/stubs-32.h: No such
      file or directory
          7 | # include <gnu/stubs-32.h>
            |           ^~~~~~~~~~~~~~~~
      compilation terminated.
      make[6]: *** [testcase.mk:15: blowfish.bin] Error 1
    
    because of lack of glibc-i386-devel or equivelent.  It's non-fatal, but
    reduces the content in test_x86_emulator, which we do care about running.
    
    Instead, convert all emulator testcases to being freestanding builds, resuing
    the tools/firmware/include/ headers.
    
    This in turn requires making firmware's stdint.h compatible with 64bit builds.
    We now have compiler types for every standard type we use.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/include/stdint.h      | 27 ++++++++++-----------------
 tools/tests/x86_emulator/testcase.mk |  3 ++-
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/tools/firmware/include/stdint.h b/tools/firmware/include/stdint.h
index 16a0b6de19..5c41cb8bda 100644
--- a/tools/firmware/include/stdint.h
+++ b/tools/firmware/include/stdint.h
@@ -1,21 +1,14 @@
 #ifndef _STDINT_H_
 #define _STDINT_H_
 
-#if defined(__LP64__) || defined(__P64__)
-#error "32bit only header"
-#endif
-
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-
-typedef unsigned int uint32_t;
-typedef signed int int32_t;
-
-typedef unsigned long long uint64_t;
-typedef signed long long int64_t;
+typedef __INT8_TYPE__        int8_t;
+typedef __UINT8_TYPE__      uint8_t;
+typedef __INT16_TYPE__      int16_t;
+typedef __UINT16_TYPE__    uint16_t;
+typedef __INT32_TYPE__      int32_t;
+typedef __UINT32_TYPE__    uint32_t;
+typedef __INT64_TYPE__      int64_t;
+typedef __UINT64_TYPE__    uint64_t;
 
 #define INT8_MIN        (-0x7f-1)
 #define INT16_MIN       (-0x7fff-1)
@@ -32,8 +25,8 @@ typedef signed long long int64_t;
 #define UINT32_MAX      0xffffffffu
 #define UINT64_MAX      0xffffffffffffffffull
 
-typedef uint32_t uintptr_t;
+typedef __UINTPTR_TYPE__  uintptr_t;
 
-#define UINTPTR_MAX     UINT32_MAX
+#define UINTPTR_MAX     __UINTPTR_MAX__
 
 #endif
diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulator/testcase.mk
index 7875b95d7c..e47fd0917b 100644
--- a/tools/tests/x86_emulator/testcase.mk
+++ b/tools/tests/x86_emulator/testcase.mk
@@ -4,7 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
-CFLAGS += -fno-builtin -fno-stack-protector -g0 $($(TESTCASE)-cflags)
+CFLAGS += -ffreestanding -nostdinc -I$(XEN_ROOT)/tools/firmware/include
+CFLAGS += -fno-stack-protector -g0 $($(TESTCASE)-cflags)
 
 LDFLAGS_DIRECT += $(shell { $(LD) -v --warn-rwx-segments; } >/dev/null 2>&1 && echo --no-warn-rwx-segments)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 15:44:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 15:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932785.1334845 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzHJH-0001td-5Y; Mon, 31 Mar 2025 15:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932785.1334845; Mon, 31 Mar 2025 15:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzHJH-0001tV-2s; Mon, 31 Mar 2025 15:44:23 +0000
Received: by outflank-mailman (input) for mailman id 932785;
 Mon, 31 Mar 2025 15:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzHJG-0001tL-5Z
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 15:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzHJG-002Q3U-0R
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 15:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzHJG-00CT1n-0I
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 15:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UDhGnFj2b8SSBmwS96rTFi1lcEcjHV7yDRxVC0y5gPE=; b=O6kHbeBOyEkAfT9vNqSafemPRl
	F001+GqG4GApTrDhlx7rXmr5MvPmBwMZsr3FMwAmV2RgiPjLZbw/UNZl3Iqazte+Ivof4BN9Xo8Vb
	FBMjdnpuA3nJoQ/jUzLfMfRXM/df67L7S6V5t6E2I4sTfHKq7M4pdQwdVxiaeGJlgdW4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Add yet another HW runner
Message-Id: <E1tzHJG-00CT1n-0I@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 15:44:22 +0000

commit debe8bf537ec2c69a4734393cd2b0c7f57f74c0c
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Mar 14 04:06:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 31 15:04:25 2025 +0100

    CI: Add yet another HW runner
    
    This is AMD Zen2 (Ryzen 5 4500U specifically), in a HP Probook 445 G7.
    
    This one has working S3, so add a test for it here.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/gitlab-ci/test.yaml | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 9530e36e9a..225eb43998 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -155,6 +155,17 @@
   tags:
     - qubes-hw2
 
+.zen2-x86-64:
+  # it's really similar to the above
+  extends: .adl-x86-64
+  variables:
+    PCIDEV: "01:00.0"
+    PCIDEV_INTR: "MSI-X"
+    CONSOLE_OPTS: "console=com1 com1=115200,8n1,pci,msi,04:00.0"
+    SUT_ADDR: test-1.testnet
+  tags:
+    - qubes-hw1
+
 .zen3p-x86-64:
   # it's really similar to the above
   extends: .adl-x86-64
@@ -301,6 +312,22 @@ adl-tools-tests-pvh-x86-64-gcc-debug:
     - *x86-64-test-needs
     - alpine-3.18-gcc-debug
 
+zen2-smoke-x86-64-gcc-debug:
+  extends: .zen2-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
+zen2-suspend-x86-64-gcc-debug:
+  extends: .zen2-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh s3 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
 zen3p-smoke-x86-64-gcc-debug:
   extends: .zen3p-x86-64
   script:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 17:00:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 17:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932870.1334923 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzIUU-0005Kz-RO; Mon, 31 Mar 2025 17:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932870.1334923; Mon, 31 Mar 2025 17:00:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzIUU-0005KY-OT; Mon, 31 Mar 2025 17:00:02 +0000
Received: by outflank-mailman (input) for mailman id 932870;
 Mon, 31 Mar 2025 17:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzIUT-00057c-On
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 17:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzIUT-002SJY-1m
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 17:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzIUT-00CjDg-1b
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 17:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=smpAFsuVOVvTq/2X26GBDo2v+srA7CuVIwRAxUBpuRU=; b=MKRskiBnNGEiyDIO0R8R5FtNpV
	SLddEGXRpNPoWAoVJU0+PQsLRwhWcxRg9mQdlqkPBzOoFV9vQmmb9lISdP+v4oMnfc4rlAoxDIhK2
	xvj/bqUgZ+5GrIQCJ1pOmq6frIDI8VCVAAYHFymqgxLnpxzBAAZjt+StOudp50SOeygo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/types: Drop compatibility for GCC < 4.4
Message-Id: <E1tzIUT-00CjDg-1b@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 17:00:01 +0000

commit 5e91dd16175b185e51cf465fc539177d18dd4b5a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 28 16:49:21 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 31 14:38:29 2025 +0100

    xen/types: Drop compatibility for GCC < 4.4
    
    We now have compiler types for every standard type we use.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/stdint.h | 19 -------------------
 xen/include/xen/types.h  |  3 +--
 2 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/xen/include/xen/stdint.h b/xen/include/xen/stdint.h
index a40165c6ae..dde12964bf 100644
--- a/xen/include/xen/stdint.h
+++ b/xen/include/xen/stdint.h
@@ -2,23 +2,6 @@
 #ifndef __XEN_STDINT_H__
 #define __XEN_STDINT_H__
 
-#ifndef __INT8_TYPE__ /* GCC <= 4.4 */
-
-/*
- * Define the types using GCC internal notation.  Clang understands this too.
- * https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html
- */
-typedef   signed __attribute__((__mode__(__QI__)))     int8_t;
-typedef unsigned __attribute__((__mode__(__QI__)))    uint8_t;
-typedef   signed __attribute__((__mode__(__HI__)))    int16_t;
-typedef unsigned __attribute__((__mode__(__HI__)))   uint16_t;
-typedef   signed __attribute__((__mode__(__SI__)))    int32_t;
-typedef unsigned __attribute__((__mode__(__SI__)))   uint32_t;
-typedef   signed __attribute__((__mode__(__DI__)))    int64_t;
-typedef unsigned __attribute__((__mode__(__DI__)))   uint64_t;
-
-#else
-
 typedef __INT8_TYPE__        int8_t;
 typedef __UINT8_TYPE__      uint8_t;
 typedef __INT16_TYPE__      int16_t;
@@ -28,6 +11,4 @@ typedef __UINT32_TYPE__    uint32_t;
 typedef __INT64_TYPE__      int64_t;
 typedef __UINT64_TYPE__    uint64_t;
 
-#endif
-
 #endif /* __XEN_STDINT_H__ */
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 543bfb2159..e8d419b954 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -17,6 +17,7 @@ typedef __SIZE_TYPE__ size_t;
 typedef signed long ssize_t;
 
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
+typedef __UINTPTR_TYPE__ uintptr_t;
 
 /*
  * Users of this macro are expected to pass a positive value.
@@ -58,8 +59,6 @@ typedef uint32_t __be32;
 typedef uint64_t __le64;
 typedef uint64_t __be64;
 
-typedef unsigned int __attribute__((__mode__(__pointer__))) uintptr_t;
-
 #define test_and_set_bool(b)   xchg(&(b), true)
 #define test_and_clear_bool(b) xchg(&(b), false)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 17:00:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 17:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932871.1334929 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzIUe-00067g-Sm; Mon, 31 Mar 2025 17:00:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932871.1334929; Mon, 31 Mar 2025 17:00:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzIUe-00067Y-Pp; Mon, 31 Mar 2025 17:00:12 +0000
Received: by outflank-mailman (input) for mailman id 932871;
 Mon, 31 Mar 2025 17:00:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzIUd-00067I-MP
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 17:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzIUd-002SLo-26
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 17:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzIUd-00CjFP-1w
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 17:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v7QykMXkpM3GpiKr6vuo4EsdkRqxMQn6lteRVTKT0vE=; b=wnIxzqMRtif8QtQEViNNFcwAhD
	6ALcyGME3hs2qvNEwUK0cP0qiGFFGya3XI9JafwHbOEg77octzEztEyINDDJpwH9KatQZed5gciNt
	wkJhFrrOow3rpR6tB+K+XL6L88iUmOSra9Eyv+oT4iH1nUrUVSGlk/MhsdI96XO0PIHo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: Fix blowfish build in 64bit-clean environments
Message-Id: <E1tzIUd-00CjFP-1w@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 17:00:11 +0000

commit 15341fcac7668858438333c6467364aa2d47ec94
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 28 17:18:51 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 31 14:38:56 2025 +0100

    x86emul: Fix blowfish build in 64bit-clean environments
    
    In a 64bit-clean environment, blowfish fails:
    
      make[6]: Leaving directory
      '/builddir/build/BUILD/xen-4.19.1/tools/tests/x86_emulator'
      In file included from /usr/include/features.h:535,
                       from /usr/include/bits/libc-header-start.h:33,
                       from /usr/include/stdint.h:26,
                       from
      /usr/lib/gcc/x86_64-xenserver-linux/12/include/stdint.h:9,
                       from blowfish.c:18:
      /usr/include/gnu/stubs.h:7:11: fatal error: gnu/stubs-32.h: No such
      file or directory
          7 | # include <gnu/stubs-32.h>
            |           ^~~~~~~~~~~~~~~~
      compilation terminated.
      make[6]: *** [testcase.mk:15: blowfish.bin] Error 1
    
    because of lack of glibc-i386-devel or equivelent.  It's non-fatal, but
    reduces the content in test_x86_emulator, which we do care about running.
    
    Instead, convert all emulator testcases to being freestanding builds, resuing
    the tools/firmware/include/ headers.
    
    This in turn requires making firmware's stdint.h compatible with 64bit builds.
    We now have compiler types for every standard type we use.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/include/stdint.h      | 27 ++++++++++-----------------
 tools/tests/x86_emulator/testcase.mk |  3 ++-
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/tools/firmware/include/stdint.h b/tools/firmware/include/stdint.h
index 16a0b6de19..5c41cb8bda 100644
--- a/tools/firmware/include/stdint.h
+++ b/tools/firmware/include/stdint.h
@@ -1,21 +1,14 @@
 #ifndef _STDINT_H_
 #define _STDINT_H_
 
-#if defined(__LP64__) || defined(__P64__)
-#error "32bit only header"
-#endif
-
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-
-typedef unsigned int uint32_t;
-typedef signed int int32_t;
-
-typedef unsigned long long uint64_t;
-typedef signed long long int64_t;
+typedef __INT8_TYPE__        int8_t;
+typedef __UINT8_TYPE__      uint8_t;
+typedef __INT16_TYPE__      int16_t;
+typedef __UINT16_TYPE__    uint16_t;
+typedef __INT32_TYPE__      int32_t;
+typedef __UINT32_TYPE__    uint32_t;
+typedef __INT64_TYPE__      int64_t;
+typedef __UINT64_TYPE__    uint64_t;
 
 #define INT8_MIN        (-0x7f-1)
 #define INT16_MIN       (-0x7fff-1)
@@ -32,8 +25,8 @@ typedef signed long long int64_t;
 #define UINT32_MAX      0xffffffffu
 #define UINT64_MAX      0xffffffffffffffffull
 
-typedef uint32_t uintptr_t;
+typedef __UINTPTR_TYPE__  uintptr_t;
 
-#define UINTPTR_MAX     UINT32_MAX
+#define UINTPTR_MAX     __UINTPTR_MAX__
 
 #endif
diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulator/testcase.mk
index 7875b95d7c..e47fd0917b 100644
--- a/tools/tests/x86_emulator/testcase.mk
+++ b/tools/tests/x86_emulator/testcase.mk
@@ -4,7 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 
-CFLAGS += -fno-builtin -fno-stack-protector -g0 $($(TESTCASE)-cflags)
+CFLAGS += -ffreestanding -nostdinc -I$(XEN_ROOT)/tools/firmware/include
+CFLAGS += -fno-stack-protector -g0 $($(TESTCASE)-cflags)
 
 LDFLAGS_DIRECT += $(shell { $(LD) -v --warn-rwx-segments; } >/dev/null 2>&1 && echo --no-warn-rwx-segments)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Mar 31 17:00:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 31 Mar 2025 17:00:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.932872.1334932 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzIUo-0006AJ-Ts; Mon, 31 Mar 2025 17:00:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 932872.1334932; Mon, 31 Mar 2025 17:00:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tzIUo-0006AB-RC; Mon, 31 Mar 2025 17:00:22 +0000
Received: by outflank-mailman (input) for mailman id 932872;
 Mon, 31 Mar 2025 17:00:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tzIUn-00069t-QZ
 for xen-changelog@lists.xenproject.org; Mon, 31 Mar 2025 17:00:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzIUn-002SLs-2Z
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 17:00:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tzIUn-00CjGS-2G
 for xen-changelog@lists.xenproject.org;
 Mon, 31 Mar 2025 17:00:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Kdg18zd1n6/JqH1M7LWpy8WfEUd1RjKBvIiM3GLTSsY=; b=oOVwDslzT36O+6vXvNfZhQ1EJC
	JM4oV89Iywh/4zufurpyzG3H4qA+Su8da7f92ID+IIXdVNJQ7jWha8w+iJc3pEhPz5w80oc610psn
	0+uJDcE3Ah5g4hjcvuJvhtsLxa2yDfcCU5PeEKCDJp70+Cqq+IqXS9ognLLDZl9+0+Lw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Add yet another HW runner
Message-Id: <E1tzIUn-00CjGS-2G@xenbits.xenproject.org>
Date: Mon, 31 Mar 2025 17:00:21 +0000

commit debe8bf537ec2c69a4734393cd2b0c7f57f74c0c
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Mar 14 04:06:26 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Mar 31 15:04:25 2025 +0100

    CI: Add yet another HW runner
    
    This is AMD Zen2 (Ryzen 5 4500U specifically), in a HP Probook 445 G7.
    
    This one has working S3, so add a test for it here.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/gitlab-ci/test.yaml | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 9530e36e9a..225eb43998 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -155,6 +155,17 @@
   tags:
     - qubes-hw2
 
+.zen2-x86-64:
+  # it's really similar to the above
+  extends: .adl-x86-64
+  variables:
+    PCIDEV: "01:00.0"
+    PCIDEV_INTR: "MSI-X"
+    CONSOLE_OPTS: "console=com1 com1=115200,8n1,pci,msi,04:00.0"
+    SUT_ADDR: test-1.testnet
+  tags:
+    - qubes-hw1
+
 .zen3p-x86-64:
   # it's really similar to the above
   extends: .adl-x86-64
@@ -301,6 +312,22 @@ adl-tools-tests-pvh-x86-64-gcc-debug:
     - *x86-64-test-needs
     - alpine-3.18-gcc-debug
 
+zen2-smoke-x86-64-gcc-debug:
+  extends: .zen2-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
+zen2-suspend-x86-64-gcc-debug:
+  extends: .zen2-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh s3 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
 zen3p-smoke-x86-64-gcc-debug:
   extends: .zen3p-x86-64
   script:
--
generated by git-patchbot for /home/xen/git/xen.git#master


