From xen-changelog-bounces@lists.xenproject.org Mon Feb 03 10:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 Feb 2025 10:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.880535.1290604 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1teu6d-0001xF-8C; Mon, 03 Feb 2025 10:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 880535.1290604; Mon, 03 Feb 2025 10:55:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1teu6d-0001x7-5c; Mon, 03 Feb 2025 10:55:07 +0000
Received: by outflank-mailman (input) for mailman id 880535;
 Mon, 03 Feb 2025 10:55: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 1teu6b-0001x1-N1
 for xen-changelog@lists.xenproject.org; Mon, 03 Feb 2025 10:55: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 1teu6b-009e42-0q
 for xen-changelog@lists.xenproject.org;
 Mon, 03 Feb 2025 10:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1teu6a-002FyI-2E
 for xen-changelog@lists.xenproject.org;
 Mon, 03 Feb 2025 10:55: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=GlgSQ262xTv8+EkB9g/ME1xrci011c+a1JFt4FfpRBI=; b=nJtqUgmndPMSHruLtLrtgJ8PUV
	oW6efHoR5gINys0clp2YKBU1l5a5sjnIuc09Al5Lld5Ax/vW8WZobg/+vQJBzxzvfe3kU0Gb9822b
	X4uIUaiksqe4JMYVG6pBRDd2aM2s2eBcIr8zI4MCRO+Q8nllbwINkymSEXnZYNzli6v8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] AMD/IOMMU: log IVHD contents
Message-Id: <E1teu6a-002FyI-2E@xenbits.xenproject.org>
Date: Mon, 03 Feb 2025 10:55:04 +0000

commit 637d40c604e9e1e3df50258679e6c3577cfd9e17
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 3 11:43:49 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 3 11:43:49 2025 +0100

    AMD/IOMMU: log IVHD contents
    
    Despite all the verbosity with "iommu=debug", information on the IOMMUs
    themselves was missing.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Tested-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/drivers/passthrough/amd/iommu_acpi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c
index c416120326..5bdbfb5ba8 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -911,6 +911,11 @@ static int __init parse_ivhd_block(const struct acpi_ivrs_hardware *ivhd_block)
         return -ENODEV;
     }
 
+    AMD_IOMMU_DEBUG("IVHD: IOMMU @ %#lx cap @ %#x seg 0x%04x info %#x attr %#x\n",
+                    ivhd_block->base_address, ivhd_block->capability_offset,
+                    ivhd_block->pci_segment_group, ivhd_block->info,
+                    ivhd_block->iommu_attr);
+
     iommu = find_iommu_from_bdf_cap(ivhd_block->pci_segment_group,
                                     ivhd_block->header.device_id,
                                     ivhd_block->capability_offset);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Feb 03 11:33:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 Feb 2025 11:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.880548.1290624 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1teuhM-00077U-4P; Mon, 03 Feb 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 880548.1290624; Mon, 03 Feb 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 1teuhM-00077M-1q; Mon, 03 Feb 2025 11:33:04 +0000
Received: by outflank-mailman (input) for mailman id 880548;
 Mon, 03 Feb 2025 11: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 1teuhK-00077G-HY
 for xen-changelog@lists.xenproject.org; Mon, 03 Feb 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 1teuhJ-009f6O-35
 for xen-changelog@lists.xenproject.org;
 Mon, 03 Feb 2025 11:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1teuhK-002KS5-0S
 for xen-changelog@lists.xenproject.org;
 Mon, 03 Feb 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=cYCIEuUASA+xiJtpG7GZzmkYsZbvXiP66rnlA1Ct+SE=; b=tPlxkQvLEI+thFID+ZJYd7NQt4
	NNXZf5RexNA3y0ncXkLDUeDIKmEtvddGxBblqieYxZcTsLanAfITSxK0/fh8VAw/UyHVBLDP3iB4Z
	Q1yrwRq8Y9OHjN7gFtQD2ZRSxBQ3tVXKDSlpQsAccXULk8SyblH1TjT3HneG56lFfkww=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] AMD/IOMMU: log IVHD contents
Message-Id: <E1teuhK-002KS5-0S@xenbits.xenproject.org>
Date: Mon, 03 Feb 2025 11:33:02 +0000

commit 637d40c604e9e1e3df50258679e6c3577cfd9e17
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 3 11:43:49 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 3 11:43:49 2025 +0100

    AMD/IOMMU: log IVHD contents
    
    Despite all the verbosity with "iommu=debug", information on the IOMMUs
    themselves was missing.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Tested-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/drivers/passthrough/amd/iommu_acpi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c
index c416120326..5bdbfb5ba8 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -911,6 +911,11 @@ static int __init parse_ivhd_block(const struct acpi_ivrs_hardware *ivhd_block)
         return -ENODEV;
     }
 
+    AMD_IOMMU_DEBUG("IVHD: IOMMU @ %#lx cap @ %#x seg 0x%04x info %#x attr %#x\n",
+                    ivhd_block->base_address, ivhd_block->capability_offset,
+                    ivhd_block->pci_segment_group, ivhd_block->info,
+                    ivhd_block->iommu_attr);
+
     iommu = find_iommu_from_bdf_cap(ivhd_block->pci_segment_group,
                                     ivhd_block->header.device_id,
                                     ivhd_block->capability_offset);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 03 22:55:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 Feb 2025 22:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.881014.1291117 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tf5LN-0007Jl-Tu; Mon, 03 Feb 2025 22:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 881014.1291117; Mon, 03 Feb 2025 22:55: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 1tf5LN-0007Jd-RF; Mon, 03 Feb 2025 22:55:05 +0000
Received: by outflank-mailman (input) for mailman id 881014;
 Mon, 03 Feb 2025 22:55: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 1tf5LN-0007JU-2v
 for xen-changelog@lists.xenproject.org; Mon, 03 Feb 2025 22:55: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 1tf5LM-009zof-16
 for xen-changelog@lists.xenproject.org;
 Mon, 03 Feb 2025 22:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tf5LM-003edR-1f
 for xen-changelog@lists.xenproject.org;
 Mon, 03 Feb 2025 22:55: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=ilNCWVXYzmNqSIuMKgjvTPEPya0AIvJQOaQh+NO4mzg=; b=c405UToSwfN4t1FbBhq14lM/P+
	MkDT8GNHem2f/69XG3SjO9ds/lDnuBv0hJrzQp705s0QrppAjqESW32cNTTJcp/Q6EYhN5AiK+STU
	5xlwf2SpY7CJJiK7GSzGVFdP33TXGOP0xYUF8vVZfESiWBKjWxVDn7xpyMnGBQGbnJtI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: fix bind/unbind notification
Message-Id: <E1tf5LM-003edR-1f@xenbits.xenproject.org>
Date: Mon, 03 Feb 2025 22:55:04 +0000

commit 39c45caef271bc2b2e299217450cfda24c0c772a
Author:     Jens Wiklander <jens.wiklander@linaro.org>
AuthorDate: Mon Feb 3 11:21:12 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Feb 3 14:48:20 2025 -0800

    xen/arm: ffa: fix bind/unbind notification
    
    The notification bitmask is in passed in the FF-A ABI in two 32-bit
    registers w3 and w4. The lower 32-bits should go in w3 and the higher in
    w4. These two registers has unfortunately been swapped for
    FFA_NOTIFICATION_BIND and FFA_NOTIFICATION_UNBIND in the FF-A mediator.
    So fix that by using the correct registers.
    
    Fixes: b490f470f58d ("xen/arm: ffa: support notification")
    Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Relese-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/arm/tee/ffa_notif.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_notif.c b/xen/arch/arm/tee/ffa_notif.c
index 21b9e78f63..00efaf8f73 100644
--- a/xen/arch/arm/tee/ffa_notif.c
+++ b/xen/arch/arm/tee/ffa_notif.c
@@ -40,8 +40,8 @@ int ffa_handle_notification_bind(struct cpu_user_regs *regs)
      * We only support notifications from SP so no need to check the sender
      * endpoint ID, the SPMC will take care of that for us.
      */
-    return ffa_simple_call(FFA_NOTIFICATION_BIND, src_dst, flags, bitmap_hi,
-                           bitmap_lo);
+    return ffa_simple_call(FFA_NOTIFICATION_BIND, src_dst, flags, bitmap_lo,
+                           bitmap_hi);
 }
 
 int ffa_handle_notification_unbind(struct cpu_user_regs *regs)
@@ -61,8 +61,8 @@ int ffa_handle_notification_unbind(struct cpu_user_regs *regs)
      * We only support notifications from SP so no need to check the
      * destination endpoint ID, the SPMC will take care of that for us.
      */
-    return  ffa_simple_call(FFA_NOTIFICATION_UNBIND, src_dst, 0, bitmap_hi,
-                            bitmap_lo);
+    return  ffa_simple_call(FFA_NOTIFICATION_UNBIND, src_dst, 0, bitmap_lo,
+                            bitmap_hi);
 }
 
 void ffa_handle_notification_info_get(struct cpu_user_regs *regs)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Feb 03 23:44:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 03 Feb 2025 23:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.881015.1291122 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tf66k-0004Nd-78; Mon, 03 Feb 2025 23:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 881015.1291122; Mon, 03 Feb 2025 23: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 1tf66k-0004NU-4M; Mon, 03 Feb 2025 23:44:02 +0000
Received: by outflank-mailman (input) for mailman id 881015;
 Mon, 03 Feb 2025 23: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 1tf66j-0004NO-L9
 for xen-changelog@lists.xenproject.org; Mon, 03 Feb 2025 23: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 1tf66j-00A2c5-09
 for xen-changelog@lists.xenproject.org;
 Mon, 03 Feb 2025 23:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tf66j-003jpZ-0u
 for xen-changelog@lists.xenproject.org;
 Mon, 03 Feb 2025 23: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=Ib3XX3sKhxI+MRyaT4G7Cn3I3xOIK3kGIJ607NNxCMk=; b=VeZK0gUzNslRKPqE2B6hELdHAE
	newae54PZ6uptYjFTp68Bqsxi+nPfaTDBNaAVjL5GU392xqUpbm4UqsRSigwpzJFKY2Q19VH5l2iE
	0WeFsz99DyWvKaIgshdUZQOcS8BxKNNM+DqT6XUyk2JsYjhwnJkLIYa2js+VyiRF4kQM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: fix bind/unbind notification
Message-Id: <E1tf66j-003jpZ-0u@xenbits.xenproject.org>
Date: Mon, 03 Feb 2025 23:44:01 +0000

commit 39c45caef271bc2b2e299217450cfda24c0c772a
Author:     Jens Wiklander <jens.wiklander@linaro.org>
AuthorDate: Mon Feb 3 11:21:12 2025 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Feb 3 14:48:20 2025 -0800

    xen/arm: ffa: fix bind/unbind notification
    
    The notification bitmask is in passed in the FF-A ABI in two 32-bit
    registers w3 and w4. The lower 32-bits should go in w3 and the higher in
    w4. These two registers has unfortunately been swapped for
    FFA_NOTIFICATION_BIND and FFA_NOTIFICATION_UNBIND in the FF-A mediator.
    So fix that by using the correct registers.
    
    Fixes: b490f470f58d ("xen/arm: ffa: support notification")
    Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Relese-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/arm/tee/ffa_notif.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/tee/ffa_notif.c b/xen/arch/arm/tee/ffa_notif.c
index 21b9e78f63..00efaf8f73 100644
--- a/xen/arch/arm/tee/ffa_notif.c
+++ b/xen/arch/arm/tee/ffa_notif.c
@@ -40,8 +40,8 @@ int ffa_handle_notification_bind(struct cpu_user_regs *regs)
      * We only support notifications from SP so no need to check the sender
      * endpoint ID, the SPMC will take care of that for us.
      */
-    return ffa_simple_call(FFA_NOTIFICATION_BIND, src_dst, flags, bitmap_hi,
-                           bitmap_lo);
+    return ffa_simple_call(FFA_NOTIFICATION_BIND, src_dst, flags, bitmap_lo,
+                           bitmap_hi);
 }
 
 int ffa_handle_notification_unbind(struct cpu_user_regs *regs)
@@ -61,8 +61,8 @@ int ffa_handle_notification_unbind(struct cpu_user_regs *regs)
      * We only support notifications from SP so no need to check the
      * destination endpoint ID, the SPMC will take care of that for us.
      */
-    return  ffa_simple_call(FFA_NOTIFICATION_UNBIND, src_dst, 0, bitmap_hi,
-                            bitmap_lo);
+    return  ffa_simple_call(FFA_NOTIFICATION_UNBIND, src_dst, 0, bitmap_lo,
+                            bitmap_hi);
 }
 
 void ffa_handle_notification_info_get(struct cpu_user_regs *regs)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 04 12:55:17 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Feb 2025 12:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.881388.1291516 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tfISJ-0002kn-GM; Tue, 04 Feb 2025 12:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 881388.1291516; Tue, 04 Feb 2025 12:55:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tfISJ-0002kf-Dq; Tue, 04 Feb 2025 12:55:07 +0000
Received: by outflank-mailman (input) for mailman id 881388;
 Tue, 04 Feb 2025 12:55: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 1tfISH-0002kZ-Kl
 for xen-changelog@lists.xenproject.org; Tue, 04 Feb 2025 12:55: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 1tfISH-00Bm5B-0O
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Feb 2025 12:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tfISH-0057Z4-0p
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Feb 2025 12:55: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=CqlfquDiJr5NgG2yWcHRqXf/V9a+Ox+z44e8sbgQSgo=; b=53n0XJQoj0mJnp9jLyvAPylcd1
	ZzzFyFF/GIMu0u/SGI5KXZ8RG5twdw0UrQBZNMzTNPT0bGoW/asJYV8ZYavYbYXE4YDPN+IzHy4xz
	Kt4neeEtJrDMqevcnpnpOQPq4eLoZz1GIFwnBTMskuIJ8kloQCnvyc+L1aGWIiexEsgs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] AMD/IOMMU: drop stray MSI enabling
Message-Id: <E1tfISH-0057Z4-0p@xenbits.xenproject.org>
Date: Tue, 04 Feb 2025 12:55:05 +0000

commit 83187a21fd9bc26e23472ea351153ff8f7c2a7b8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 4 13:50:49 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 4 13:50:49 2025 +0100

    AMD/IOMMU: drop stray MSI enabling
    
    While the 2nd of the commits referenced below should have moved the call
    to amd_iommu_msi_enable() instead of adding another one, the situation
    wasn't quite right even before: It can't have done any good to enable
    MSI when no IRQ was allocated for it, yet.
    
    The other call to amd_iommu_msi_enable(), just out of patch context,
    needs to stay there until S3 resume is re-worked. For the boot path that
    call should be unnecessary, as iommu{,_maskable}_msi_startup() will have
    done it already (by way of invoking iommu_msi_unmask()).
    
    Fixes: 5f569f1ac50e ("AMD/IOMMU: allow enabling with IRQ not yet set up")
    Fixes: d9e49d1afe2e ("AMD/IOMMU: adjust setup of internal interrupt for x2APIC mode")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Tested-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/drivers/passthrough/amd/iommu_init.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 3023625020..05fd3bde6e 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -902,8 +902,6 @@ static void enable_iommu(struct amd_iommu *iommu)
         }
     }
 
-    amd_iommu_msi_enable(iommu, IOMMU_CONTROL_ENABLED);
-
     set_iommu_ht_flags(iommu);
     set_iommu_command_buffer_control(iommu, IOMMU_CONTROL_ENABLED);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 04 13:55:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 04 Feb 2025 13:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.881532.1291709 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tfJOJ-0003Wd-8K; Tue, 04 Feb 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 881532.1291709; Tue, 04 Feb 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 1tfJOJ-0003WW-5k; Tue, 04 Feb 2025 13:55:03 +0000
Received: by outflank-mailman (input) for mailman id 881532;
 Tue, 04 Feb 2025 13: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 1tfJOH-0003W4-Nq
 for xen-changelog@lists.xenproject.org; Tue, 04 Feb 2025 13: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 1tfJOH-00BnhV-0i
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Feb 2025 13:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tfJOH-005E3F-1W
 for xen-changelog@lists.xenproject.org;
 Tue, 04 Feb 2025 13: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=94C8x+isXFQwxshRpXiCSPL3rdYSUSh/XMAINWzIoos=; b=Hl/HnCmPXoNdFzzd/7qTZsXHD5
	i7AD9WvQpQ9q597IUW7sAqbhTg14b5VdEIJsloAXXAgo12cFyM0ls2MMEghBV6bAL2rq+aYq+qG6P
	iOgVbK1HJmhI/8tkihH79/UX+9yozIUop5Lqh2zy61vXjBdWT8QOtL/dAKsWew0de6uo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] AMD/IOMMU: drop stray MSI enabling
Message-Id: <E1tfJOH-005E3F-1W@xenbits.xenproject.org>
Date: Tue, 04 Feb 2025 13:55:01 +0000

commit 83187a21fd9bc26e23472ea351153ff8f7c2a7b8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 4 13:50:49 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 4 13:50:49 2025 +0100

    AMD/IOMMU: drop stray MSI enabling
    
    While the 2nd of the commits referenced below should have moved the call
    to amd_iommu_msi_enable() instead of adding another one, the situation
    wasn't quite right even before: It can't have done any good to enable
    MSI when no IRQ was allocated for it, yet.
    
    The other call to amd_iommu_msi_enable(), just out of patch context,
    needs to stay there until S3 resume is re-worked. For the boot path that
    call should be unnecessary, as iommu{,_maskable}_msi_startup() will have
    done it already (by way of invoking iommu_msi_unmask()).
    
    Fixes: 5f569f1ac50e ("AMD/IOMMU: allow enabling with IRQ not yet set up")
    Fixes: d9e49d1afe2e ("AMD/IOMMU: adjust setup of internal interrupt for x2APIC mode")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Tested-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/drivers/passthrough/amd/iommu_init.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 3023625020..05fd3bde6e 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -902,8 +902,6 @@ static void enable_iommu(struct amd_iommu *iommu)
         }
     }
 
-    amd_iommu_msi_enable(iommu, IOMMU_CONTROL_ENABLED);
-
     set_iommu_ht_flags(iommu);
     set_iommu_command_buffer_control(iommu, IOMMU_CONTROL_ENABLED);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 07 09:11:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Feb 2025 09:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.883505.1293465 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tgKOA-0005uk-FU; Fri, 07 Feb 2025 09:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 883505.1293465; Fri, 07 Feb 2025 09:11: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 1tgKOA-0005ud-Cv; Fri, 07 Feb 2025 09:11:06 +0000
Received: by outflank-mailman (input) for mailman id 883505;
 Fri, 07 Feb 2025 09:11: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 1tgKO9-0005uX-Aj
 for xen-changelog@lists.xenproject.org; Fri, 07 Feb 2025 09:11: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 1tgKO9-005Frc-0k
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Feb 2025 09:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tgKO8-00CQmb-2u
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Feb 2025 09:11: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=V2zI34HjiP5WACPi/QKFX5h6TacxKl49/ZxnekUR/wI=; b=b0tb0R0dlEoSPsljZF5XikBhio
	S+gKLg9OpxuQEuKUQ5xew1h+pNWfJSU1ugtMRrR6iOp81WkoEm1p4HhGmElGtKdUNKcJIF+fHm3RU
	hJrSLvQ3PkVkcNuXqpFXSmP84cKd3qO7qCr6iHrrEHEIUne1FE1mVXLLi7DMkFSrU4xY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] radix-tree: purge node allocation override hooks
Message-Id: <E1tgKO8-00CQmb-2u@xenbits.xenproject.org>
Date: Fri, 07 Feb 2025 09:11:04 +0000

commit 1275093a96fed45057db241b3aa6e191d9dcf596
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 7 09:59:11 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 7 09:59:11 2025 +0100

    radix-tree: purge node allocation override hooks
    
    These were needed by TMEM only, which is long gone. The Linux original
    doesn't have such either. This effectively reverts one of the "Other
    changes" from 8dc6738dbb3c ("Update radix-tree.[ch] from upstream Linux
    to gain RCU awareness").
    
    Positive side effect: Two cf_check go away.
    
    While there also convert xmalloc()+memset() to xzalloc(). (Don't convert
    to xvzalloc(), as that would require touching the freeing side, too.)
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/common/radix-tree.c      | 37 ++++++-------------------------------
 xen/include/xen/radix-tree.h | 10 ----------
 2 files changed, 6 insertions(+), 41 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index fb283a9d52..063ff1e69d 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -53,12 +53,6 @@ struct rcu_node {
 	struct rcu_head rcu_head;
 };
 
-static struct radix_tree_node *cf_check rcu_node_alloc(void *arg)
-{
-	struct rcu_node *rcu_node = xmalloc(struct rcu_node);
-	return rcu_node ? &rcu_node->node : NULL;
-}
-
 static void cf_check _rcu_node_free(struct rcu_head *head)
 {
 	struct rcu_node *rcu_node =
@@ -66,26 +60,20 @@ static void cf_check _rcu_node_free(struct rcu_head *head)
 	xfree(rcu_node);
 }
 
-static void cf_check rcu_node_free(struct radix_tree_node *node, void *arg)
-{
-	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
-	call_rcu(&rcu_node->rcu_head, _rcu_node_free);
-}
-
 static struct radix_tree_node *radix_tree_node_alloc(
 	struct radix_tree_root *root)
 {
-	struct radix_tree_node *ret;
-	ret = root->node_alloc(root->node_alloc_free_arg);
-	if (ret)
-		memset(ret, 0, sizeof(*ret));
-	return ret;
+	struct rcu_node *rcu_node = xzalloc(struct rcu_node);
+
+	return rcu_node ? &rcu_node->node : NULL;
 }
 
 static void radix_tree_node_free(
 	struct radix_tree_root *root, struct radix_tree_node *node)
 {
-	root->node_free(node, root->node_alloc_free_arg);
+	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
+
+	call_rcu(&rcu_node->rcu_head, _rcu_node_free);
 }
 
 /*
@@ -718,19 +706,6 @@ void radix_tree_destroy(
 void radix_tree_init(struct radix_tree_root *root)
 {
 	memset(root, 0, sizeof(*root));
-	root->node_alloc = rcu_node_alloc;
-	root->node_free = rcu_node_free;
-}
-
-void radix_tree_set_alloc_callbacks(
-	struct radix_tree_root *root,
-	radix_tree_alloc_fn_t *node_alloc,
-	radix_tree_free_fn_t *node_free,
-	void *node_alloc_free_arg)
-{
-	root->node_alloc = node_alloc;
-	root->node_free = node_free;
-	root->node_alloc_free_arg = node_alloc_free_arg;
 }
 
 static __init unsigned long __maxindex(unsigned int height)
diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 58c40312e6..9d5ffae3eb 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -66,11 +66,6 @@ typedef void radix_tree_free_fn_t(struct radix_tree_node *, void *);
 struct radix_tree_root {
 	unsigned int		height;
 	struct radix_tree_node	__rcu *rnode;
-
-	/* Allow to specify custom node alloc/dealloc routines. */
-	radix_tree_alloc_fn_t *node_alloc;
-	radix_tree_free_fn_t *node_free;
-	void *node_alloc_free_arg;
 };
 
 /*
@@ -78,11 +73,6 @@ struct radix_tree_root {
  */
 
 void radix_tree_init(struct radix_tree_root *root);
-void radix_tree_set_alloc_callbacks(
-	struct radix_tree_root *root,
-	radix_tree_alloc_fn_t *node_alloc,
-	radix_tree_free_fn_t *node_free,
-	void *node_alloc_free_arg);
 
 void radix_tree_destroy(
 	struct radix_tree_root *root,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 07 09:11:16 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Feb 2025 09:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.883506.1293469 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tgKOK-0005wW-HL; Fri, 07 Feb 2025 09:11:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 883506.1293469; Fri, 07 Feb 2025 09:11: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 1tgKOK-0005wO-EM; Fri, 07 Feb 2025 09:11:16 +0000
Received: by outflank-mailman (input) for mailman id 883506;
 Fri, 07 Feb 2025 09:11: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 1tgKOJ-0005wE-66
 for xen-changelog@lists.xenproject.org; Fri, 07 Feb 2025 09:11:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tgKOJ-005Frj-1H
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Feb 2025 09:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tgKOJ-00CQnP-0B
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Feb 2025 09:11:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f1vrLvbm2Gs9UhTGlSKDUkYC/rIl3c3U7Uacmi9R+nI=; b=JgJOMOnz0Ja2ZfWZ5caSyqGsqD
	7+AUgFsr4D+OlECGRhm8YXQcjdUsEa+A74IWxMXTXcHpEvdhXz55OHnM1Fkuh0ZmfQ3X1BNThslaD
	kjqkrF/2N2i0V3Sa+3eH/edVTUPqQ6/fXQXSfgXToXmHIZ97S0/M44oil5LWMEzpgK+4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] radix-tree: introduce RADIX_TREE{,_INIT}()
Message-Id: <E1tgKOJ-00CQnP-0B@xenbits.xenproject.org>
Date: Fri, 07 Feb 2025 09:11:15 +0000

commit 26fe09e34566d701ecaea76b4563bb9934e85861
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 7 10:00:04 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 7 10:00:04 2025 +0100

    radix-tree: introduce RADIX_TREE{,_INIT}()
    
    ... now that static initialization is possible. Use RADIX_TREE() for
    pci_segments and ivrs_maps.
    
    This then fixes an ordering issue on x86: With the call to
    radix_tree_init(), acpi_mmcfg_init()'s invocation of pci_segments_init()
    will zap the possible earlier introduction of segment 0 by
    amd_iommu_detect_one_acpi()'s call to pci_ro_device(), and thus the
    write-protection of the PCI devices representing AMD IOMMUs.
    
    Fixes: 3950f2485bbc ("x86/x2APIC: defer probe until after IOMMU ACPI table parsing")
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/common/radix-tree.c                  | 2 +-
 xen/drivers/passthrough/amd/iommu_init.c | 3 +--
 xen/drivers/passthrough/pci.c            | 3 +--
 xen/include/xen/radix-tree.h             | 3 +++
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index 063ff1e69d..a623a9ff66 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -705,7 +705,7 @@ void radix_tree_destroy(
 
 void radix_tree_init(struct radix_tree_root *root)
 {
-	memset(root, 0, sizeof(*root));
+	*root = (struct radix_tree_root)RADIX_TREE_INIT();
 }
 
 static __init unsigned long __maxindex(unsigned int height)
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 05fd3bde6e..ed5e684b93 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -31,7 +31,7 @@ static struct tasklet amd_iommu_irq_tasklet;
 unsigned int __read_mostly amd_iommu_acpi_info;
 unsigned int __read_mostly ivrs_bdf_entries;
 u8 __read_mostly ivhd_type;
-static struct radix_tree_root ivrs_maps;
+static RADIX_TREE(ivrs_maps);
 LIST_HEAD_RO_AFTER_INIT(amd_iommu_head);
 bool iommuv2_enabled;
 
@@ -1408,7 +1408,6 @@ int __init amd_iommu_prepare(bool xt)
         goto error_out;
     ivrs_bdf_entries = rc;
 
-    radix_tree_init(&ivrs_maps);
     for_each_amd_iommu ( iommu )
     {
         rc = amd_iommu_prepare_one(iommu);
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 777c6b1a7f..f398c3aa65 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -68,7 +68,7 @@ bool pcidevs_locked(void)
     return rspin_is_locked(&_pcidevs_lock);
 }
 
-static struct radix_tree_root pci_segments;
+static RADIX_TREE(pci_segments);
 
 static inline struct pci_seg *get_pseg(u16 seg)
 {
@@ -124,7 +124,6 @@ static int pci_segments_iterate(
 
 void __init pci_segments_init(void)
 {
-    radix_tree_init(&pci_segments);
     if ( !alloc_pseg(0) )
         panic("Could not initialize PCI segment 0\n");
 }
diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 9d5ffae3eb..4077365972 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -72,6 +72,9 @@ struct radix_tree_root {
  *** radix-tree API starts here **
  */
 
+#define RADIX_TREE_INIT() {}
+#define RADIX_TREE(name) struct radix_tree_root name = RADIX_TREE_INIT()
+
 void radix_tree_init(struct radix_tree_root *root);
 
 void radix_tree_destroy(
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 07 09:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Feb 2025 09:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.883520.1293487 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tgL4r-0002s3-Po; Fri, 07 Feb 2025 09:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 883520.1293487; Fri, 07 Feb 2025 09: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 1tgL4r-0002ru-Lz; Fri, 07 Feb 2025 09:55:13 +0000
Received: by outflank-mailman (input) for mailman id 883520;
 Fri, 07 Feb 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 1tgL4q-0002rk-LI
 for xen-changelog@lists.xenproject.org; Fri, 07 Feb 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 1tgL4q-005Gj2-2n
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Feb 2025 09:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tgL4q-00CVVV-1q
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Feb 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=wPkNpsFxvFiIsn3DLLgVqb31s4Otr66e+FJCa4G6yUU=; b=pzhXCzBR2SReRIF0HcTQvPrhnR
	Qt33EEUAGUwKYZJEulVXg4xZClegv2uklSFU7sHq38WqMgJhQQ9/coJOtmugx/ND1NKbxxsBMm2OO
	xLETSEtrngWJ6sFavLCaLDYN+vTir2jdXD3NojeuWKsYadZSZ8vO0Ir8OglMK056o+oM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] radix-tree: introduce RADIX_TREE{,_INIT}()
Message-Id: <E1tgL4q-00CVVV-1q@xenbits.xenproject.org>
Date: Fri, 07 Feb 2025 09:55:12 +0000

commit 26fe09e34566d701ecaea76b4563bb9934e85861
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 7 10:00:04 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 7 10:00:04 2025 +0100

    radix-tree: introduce RADIX_TREE{,_INIT}()
    
    ... now that static initialization is possible. Use RADIX_TREE() for
    pci_segments and ivrs_maps.
    
    This then fixes an ordering issue on x86: With the call to
    radix_tree_init(), acpi_mmcfg_init()'s invocation of pci_segments_init()
    will zap the possible earlier introduction of segment 0 by
    amd_iommu_detect_one_acpi()'s call to pci_ro_device(), and thus the
    write-protection of the PCI devices representing AMD IOMMUs.
    
    Fixes: 3950f2485bbc ("x86/x2APIC: defer probe until after IOMMU ACPI table parsing")
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/common/radix-tree.c                  | 2 +-
 xen/drivers/passthrough/amd/iommu_init.c | 3 +--
 xen/drivers/passthrough/pci.c            | 3 +--
 xen/include/xen/radix-tree.h             | 3 +++
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index 063ff1e69d..a623a9ff66 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -705,7 +705,7 @@ void radix_tree_destroy(
 
 void radix_tree_init(struct radix_tree_root *root)
 {
-	memset(root, 0, sizeof(*root));
+	*root = (struct radix_tree_root)RADIX_TREE_INIT();
 }
 
 static __init unsigned long __maxindex(unsigned int height)
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 05fd3bde6e..ed5e684b93 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -31,7 +31,7 @@ static struct tasklet amd_iommu_irq_tasklet;
 unsigned int __read_mostly amd_iommu_acpi_info;
 unsigned int __read_mostly ivrs_bdf_entries;
 u8 __read_mostly ivhd_type;
-static struct radix_tree_root ivrs_maps;
+static RADIX_TREE(ivrs_maps);
 LIST_HEAD_RO_AFTER_INIT(amd_iommu_head);
 bool iommuv2_enabled;
 
@@ -1408,7 +1408,6 @@ int __init amd_iommu_prepare(bool xt)
         goto error_out;
     ivrs_bdf_entries = rc;
 
-    radix_tree_init(&ivrs_maps);
     for_each_amd_iommu ( iommu )
     {
         rc = amd_iommu_prepare_one(iommu);
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 777c6b1a7f..f398c3aa65 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -68,7 +68,7 @@ bool pcidevs_locked(void)
     return rspin_is_locked(&_pcidevs_lock);
 }
 
-static struct radix_tree_root pci_segments;
+static RADIX_TREE(pci_segments);
 
 static inline struct pci_seg *get_pseg(u16 seg)
 {
@@ -124,7 +124,6 @@ static int pci_segments_iterate(
 
 void __init pci_segments_init(void)
 {
-    radix_tree_init(&pci_segments);
     if ( !alloc_pseg(0) )
         panic("Could not initialize PCI segment 0\n");
 }
diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 9d5ffae3eb..4077365972 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -72,6 +72,9 @@ struct radix_tree_root {
  *** radix-tree API starts here **
  */
 
+#define RADIX_TREE_INIT() {}
+#define RADIX_TREE(name) struct radix_tree_root name = RADIX_TREE_INIT()
+
 void radix_tree_init(struct radix_tree_root *root);
 
 void radix_tree_destroy(
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 07 09:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Feb 2025 09:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.883519.1293482 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tgL4h-0002qc-ND; Fri, 07 Feb 2025 09:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 883519.1293482; Fri, 07 Feb 2025 09: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 1tgL4h-0002qU-Kc; Fri, 07 Feb 2025 09:55:03 +0000
Received: by outflank-mailman (input) for mailman id 883519;
 Fri, 07 Feb 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 1tgL4g-0002qO-PX
 for xen-changelog@lists.xenproject.org; Fri, 07 Feb 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 1tgL4g-005Giv-2O
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Feb 2025 09:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tgL4g-00CVUq-1F
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Feb 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=LT0Grx7mKyX0996+rE8KfPfUeyocJm+Y363erdVroKg=; b=z7vBQz3w422drfIwmxw0yBtdHQ
	vpMGg6IExvAPNeAJZLOv5GFafa+MGwVxybYu+aiNUa2HLGn6Z3b8LupuT6kN9VXTwsSSFShaUt0fn
	46GDnPsFvLuO0fhU2gw4OOPKLdjMMPCDBXQKE2T+vGyXjSO0X8GEIb/XXAxzyFxqezVU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] radix-tree: purge node allocation override hooks
Message-Id: <E1tgL4g-00CVUq-1F@xenbits.xenproject.org>
Date: Fri, 07 Feb 2025 09:55:02 +0000

commit 1275093a96fed45057db241b3aa6e191d9dcf596
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 7 09:59:11 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 7 09:59:11 2025 +0100

    radix-tree: purge node allocation override hooks
    
    These were needed by TMEM only, which is long gone. The Linux original
    doesn't have such either. This effectively reverts one of the "Other
    changes" from 8dc6738dbb3c ("Update radix-tree.[ch] from upstream Linux
    to gain RCU awareness").
    
    Positive side effect: Two cf_check go away.
    
    While there also convert xmalloc()+memset() to xzalloc(). (Don't convert
    to xvzalloc(), as that would require touching the freeing side, too.)
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/common/radix-tree.c      | 37 ++++++-------------------------------
 xen/include/xen/radix-tree.h | 10 ----------
 2 files changed, 6 insertions(+), 41 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index fb283a9d52..063ff1e69d 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -53,12 +53,6 @@ struct rcu_node {
 	struct rcu_head rcu_head;
 };
 
-static struct radix_tree_node *cf_check rcu_node_alloc(void *arg)
-{
-	struct rcu_node *rcu_node = xmalloc(struct rcu_node);
-	return rcu_node ? &rcu_node->node : NULL;
-}
-
 static void cf_check _rcu_node_free(struct rcu_head *head)
 {
 	struct rcu_node *rcu_node =
@@ -66,26 +60,20 @@ static void cf_check _rcu_node_free(struct rcu_head *head)
 	xfree(rcu_node);
 }
 
-static void cf_check rcu_node_free(struct radix_tree_node *node, void *arg)
-{
-	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
-	call_rcu(&rcu_node->rcu_head, _rcu_node_free);
-}
-
 static struct radix_tree_node *radix_tree_node_alloc(
 	struct radix_tree_root *root)
 {
-	struct radix_tree_node *ret;
-	ret = root->node_alloc(root->node_alloc_free_arg);
-	if (ret)
-		memset(ret, 0, sizeof(*ret));
-	return ret;
+	struct rcu_node *rcu_node = xzalloc(struct rcu_node);
+
+	return rcu_node ? &rcu_node->node : NULL;
 }
 
 static void radix_tree_node_free(
 	struct radix_tree_root *root, struct radix_tree_node *node)
 {
-	root->node_free(node, root->node_alloc_free_arg);
+	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
+
+	call_rcu(&rcu_node->rcu_head, _rcu_node_free);
 }
 
 /*
@@ -718,19 +706,6 @@ void radix_tree_destroy(
 void radix_tree_init(struct radix_tree_root *root)
 {
 	memset(root, 0, sizeof(*root));
-	root->node_alloc = rcu_node_alloc;
-	root->node_free = rcu_node_free;
-}
-
-void radix_tree_set_alloc_callbacks(
-	struct radix_tree_root *root,
-	radix_tree_alloc_fn_t *node_alloc,
-	radix_tree_free_fn_t *node_free,
-	void *node_alloc_free_arg)
-{
-	root->node_alloc = node_alloc;
-	root->node_free = node_free;
-	root->node_alloc_free_arg = node_alloc_free_arg;
 }
 
 static __init unsigned long __maxindex(unsigned int height)
diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 58c40312e6..9d5ffae3eb 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -66,11 +66,6 @@ typedef void radix_tree_free_fn_t(struct radix_tree_node *, void *);
 struct radix_tree_root {
 	unsigned int		height;
 	struct radix_tree_node	__rcu *rnode;
-
-	/* Allow to specify custom node alloc/dealloc routines. */
-	radix_tree_alloc_fn_t *node_alloc;
-	radix_tree_free_fn_t *node_free;
-	void *node_alloc_free_arg;
 };
 
 /*
@@ -78,11 +73,6 @@ struct radix_tree_root {
  */
 
 void radix_tree_init(struct radix_tree_root *root);
-void radix_tree_set_alloc_callbacks(
-	struct radix_tree_root *root,
-	radix_tree_alloc_fn_t *node_alloc,
-	radix_tree_free_fn_t *node_free,
-	void *node_alloc_free_arg);
 
 void radix_tree_destroy(
 	struct radix_tree_root *root,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 07 12:00:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Feb 2025 12:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.883630.1293573 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tgN1i-0005kt-A6; Fri, 07 Feb 2025 12:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 883630.1293573; Fri, 07 Feb 2025 12: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 1tgN1i-0005kj-6e; Fri, 07 Feb 2025 12:00:06 +0000
Received: by outflank-mailman (input) for mailman id 883630;
 Fri, 07 Feb 2025 12:00: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 1tgN1g-0005Sl-RK
 for xen-changelog@lists.xenproject.org; Fri, 07 Feb 2025 12:00: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 1tgN1g-005JBR-2Z
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Feb 2025 12:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tgN1g-00CjvW-1U
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Feb 2025 12:00: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=d0sX8rFgkp5HZBmyPfNXgUuwBfS+E2/5rdB8zMuqQr0=; b=xredbufuiNTI6oOQeEVYn3GF1d
	KayAw8tZJHkXdnrJxpQutJZOOa9qaoW9GQFYRg0z04/6VX71jHiKQbiBGW5SfWmKq7vJFs6gs0wMh
	fPLmuA7ZAKJ2uWuZWSWSorFn+dYiMAjVIyHbnWQ2OfAIcYmtPRGBfSaupffEaHnAwltg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: enable UBSAN for debug tests
Message-Id: <E1tgN1g-00CjvW-1U@xenbits.xenproject.org>
Date: Fri, 07 Feb 2025 12:00:04 +0000

commit 8ef2ac727e21fda3f88a0b4f19eafacdcbe3eedc
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Wed Feb 5 18:37:23 2025 -0800
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 7 11:56:01 2025 +0000

    automation: enable UBSAN for debug tests
    
    automation: enable UBSAN for debug tests
    
    Enable CONFIG_UBSAN and CONFIG_UBSAN_FATAL for the ARM64 and x86_64
    build jobs, with debug enabled, which are later used for Xen tests on
    QEMU and/or real hardware.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    R-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 automation/gitlab-ci/build.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index bc4a8a5ad2..fb55d4ce55 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -333,6 +333,8 @@ alpine-3.18-gcc-debug:
       CONFIG_EXPERT=y
       CONFIG_UNSUPPORTED=y
       CONFIG_ARGO=y
+      CONFIG_UBSAN=y
+      CONFIG_UBSAN_FATAL=y
 
 debian-12-x86_64-gcc-debug:
   extends: .gcc-x86-64-build-debug
@@ -419,6 +421,9 @@ alpine-3.18-gcc-debug-arm64:
   extends: .gcc-arm64-build-debug
   variables:
     CONTAINER: alpine:3.18-arm64v8
+    EXTRA_XEN_CONFIG: |
+      CONFIG_UBSAN=y
+      CONFIG_UBSAN_FATAL=y
 
 alpine-3.18-gcc-arm64-randconfig:
   extends: .gcc-arm64-build
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 07 12:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 07 Feb 2025 12:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.883663.1293587 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tgNst-0005DD-9Q; Fri, 07 Feb 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 883663.1293587; Fri, 07 Feb 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 1tgNst-0005D3-6g; Fri, 07 Feb 2025 12:55:03 +0000
Received: by outflank-mailman (input) for mailman id 883663;
 Fri, 07 Feb 2025 12: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 1tgNsr-0005Cx-Tf
 for xen-changelog@lists.xenproject.org; Fri, 07 Feb 2025 12: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 1tgNsr-005KFs-2N
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Feb 2025 12:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tgNsr-00CqEm-1O
 for xen-changelog@lists.xenproject.org;
 Fri, 07 Feb 2025 12: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=ZvzTeSVnypwlD5ExbAKOFyULXuAdoRoUdkwLTf1kAm8=; b=VyTdswOT5Hq/JJaVElDRu1Hwbw
	m3SS817jd4r8IVC49Rl1remjfw5KIgjwiDmpkmRe8fbQoo9Fuo9PJy84qyFQrBv7kg/nx9eL2/yvq
	nKTFqsbbE4LneakZ5UKYpnKj4gNFJ1F4Sgf0z7++hEEDq6SJ95VFFLfUxAY85t7qHlME=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: enable UBSAN for debug tests
Message-Id: <E1tgNsr-00CqEm-1O@xenbits.xenproject.org>
Date: Fri, 07 Feb 2025 12:55:01 +0000

commit 8ef2ac727e21fda3f88a0b4f19eafacdcbe3eedc
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Wed Feb 5 18:37:23 2025 -0800
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 7 11:56:01 2025 +0000

    automation: enable UBSAN for debug tests
    
    automation: enable UBSAN for debug tests
    
    Enable CONFIG_UBSAN and CONFIG_UBSAN_FATAL for the ARM64 and x86_64
    build jobs, with debug enabled, which are later used for Xen tests on
    QEMU and/or real hardware.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    R-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 automation/gitlab-ci/build.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index bc4a8a5ad2..fb55d4ce55 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -333,6 +333,8 @@ alpine-3.18-gcc-debug:
       CONFIG_EXPERT=y
       CONFIG_UNSUPPORTED=y
       CONFIG_ARGO=y
+      CONFIG_UBSAN=y
+      CONFIG_UBSAN_FATAL=y
 
 debian-12-x86_64-gcc-debug:
   extends: .gcc-x86-64-build-debug
@@ -419,6 +421,9 @@ alpine-3.18-gcc-debug-arm64:
   extends: .gcc-arm64-build-debug
   variables:
     CONTAINER: alpine:3.18-arm64v8
+    EXTRA_XEN_CONFIG: |
+      CONFIG_UBSAN=y
+      CONFIG_UBSAN_FATAL=y
 
 alpine-3.18-gcc-arm64-randconfig:
   extends: .gcc-arm64-build
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 11 00:55:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Feb 2025 00:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.885054.1294816 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1theYN-0001a3-0w; Tue, 11 Feb 2025 00:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 885054.1294816; Tue, 11 Feb 2025 00:55: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 1theYM-0001Zv-UN; Tue, 11 Feb 2025 00:55:06 +0000
Received: by outflank-mailman (input) for mailman id 885054;
 Tue, 11 Feb 2025 00:55: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 1theYK-0001Zp-TR
 for xen-changelog@lists.xenproject.org; Tue, 11 Feb 2025 00:55: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 1theYK-00BQd2-39
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 00:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1theYK-003sDs-1n
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 00:55: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=6x47HTp3z4tDLi3g1hVWb3DmsdhwMX3YSFttAIMk2zo=; b=BeT0RWU7BU1NA+5m+G/NywtRIB
	tzj3KE1+LrvRd71cHzflUZrjyA0kZ+DdhqzkcSzY+P4rQbcmDA4wLuXryezsausKNTg9z4J81fwAM
	B6QRTdjyOgW4XWX8dzSZDvHzqvzPe2Q2Du1iPnxi4rH50lswtDE4gv4Gmxdj21NQex9o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] RISCV/boot: Run constructors during setup
Message-Id: <E1theYK-003sDs-1n@xenbits.xenproject.org>
Date: Tue, 11 Feb 2025 00:55:04 +0000

commit d80498066f23b66f76b2ef87435ec815889245b8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 7 14:35:37 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 10 23:40:12 2025 +0000

    RISCV/boot: Run constructors during setup
    
    Without this, RISC-V isn't running boot time selftests when they're compiled
    in.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/riscv/setup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 38ca4f3baa..f2b6e684ac 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -109,6 +109,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
      */
     system_state = SYS_STATE_boot;
 
+    init_constructors();
+
     if ( acpi_disabled )
     {
         printk("Booting using Device Tree\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 11 00:55:17 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Feb 2025 00:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.885055.1294819 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1theYX-0001bh-2E; Tue, 11 Feb 2025 00:55:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 885055.1294819; Tue, 11 Feb 2025 00:55:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1theYW-0001bW-Vm; Tue, 11 Feb 2025 00:55:16 +0000
Received: by outflank-mailman (input) for mailman id 885055;
 Tue, 11 Feb 2025 00:55: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 1theYU-0001bJ-UH
 for xen-changelog@lists.xenproject.org; Tue, 11 Feb 2025 00:55: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 1theYV-00BQdD-0S
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 00:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1theYU-003sFx-2Z
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 00:55: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=tGCaePtwgyYNu1G2rJYm/dEySW1xcDQsYpiMoBEdJBk=; b=bEOns8Ek9SvWR8q6bGhlv3foEm
	NSOv6yKqjO7PGT3hOVZgzFqnwhywrHmsoR7CAfqe4pOJDbpjXxHuv8CJUJqhkOVK+yabmj68H1g7y
	Qs88XOKVJqMzCWDcqSItGVBE+Gbkwh/mpSeAiyh6zVVHqWsG1ihFcEADqL5F6dWpVR+s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] RISCV/asm: Use CALL rather than JAL
Message-Id: <E1theYU-003sFx-2Z@xenbits.xenproject.org>
Date: Tue, 11 Feb 2025 00:55:14 +0000

commit 99fe58e81b9a57d36feebb6f148a87dfdfaf35ce
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 7 15:04:25 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 10 23:40:12 2025 +0000

    RISCV/asm: Use CALL rather than JAL
    
    JAL has a maximium displacement of 2M.  To branch further, it needs pairing
    with an AUIPC instruction.  CALL is a pseudoinstruction which allows the
    linker to pick the appropriate sequence when relaxations are enabled.
    
    This avoids a build failure of the form:
    
      prelink.o: in function `start':
      xen/xen/arch/riscv/riscv64/head.S:28:(.text.header+0x2c):
      relocation truncated to fit: R_RISCV_JAL against symbol `calc_phys_offset' defined in .init.text section in prelink.o
      make[3]: *** [arch/riscv/Makefile:18: xen-syms] Error 1
    
    when Xen gets large enough, e.g. with CONFIG_UBSAN enabled.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/riscv/entry.S        |  2 +-
 xen/arch/riscv/riscv64/head.S | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/riscv/entry.S b/xen/arch/riscv/entry.S
index bf974655f8..4db818ba8d 100644
--- a/xen/arch/riscv/entry.S
+++ b/xen/arch/riscv/entry.S
@@ -49,7 +49,7 @@ save_to_stack:
         REG_S   t0, CPU_USER_REGS_SSTATUS(sp)
 
         mv      a0, sp
-        jal     do_trap
+        call    do_trap
 
 restore_registers:
         /* Restore stack_cpu_regs */
diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
index 2a1b3dad91..9c40512e61 100644
--- a/xen/arch/riscv/riscv64/head.S
+++ b/xen/arch/riscv/riscv64/head.S
@@ -28,7 +28,7 @@ FUNC(start)
         add     t3, t3, __SIZEOF_POINTER__
         bltu    t3, t4, .L_clear_bss
 
-        jal     reset_stack
+        call    reset_stack
 
         /*
          * save hart_id ( bootcpu_id ) and dtb_base as a0 and a1 register can
@@ -37,16 +37,16 @@ FUNC(start)
         mv      s0, a0
         mv      s1, a1
 
-        jal     calc_phys_offset
+        call    calc_phys_offset
         mv      s2, a0
 
-        jal     setup_initial_pagetables
+        call    setup_initial_pagetables
 
         /* Calculate proper VA after jump from 1:1 mapping */
         la      a0, .L_primary_switched
         sub     a0, a0, s2
 
-        jal     turn_on_mmu
+        call    turn_on_mmu
 
 .L_primary_switched:
         /*
@@ -54,11 +54,11 @@ FUNC(start)
          * recalculated after jump from 1:1 mapping world as 1:1 mapping
          * will be removed soon in start_xen().
          */
-        jal     reset_stack
+        call    reset_stack
 
         /* Xen's boot cpu id is equal to 0 so setup TP register for it */
         li      a0, 0
-        jal     setup_tp
+        call    setup_tp
 
         /* restore hart_id ( bootcpu_id ) and dtb address */
         mv      a0, s0
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 11 00:55:26 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Feb 2025 00:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.885056.1294823 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1theYg-0001eT-3G; Tue, 11 Feb 2025 00:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 885056.1294823; Tue, 11 Feb 2025 00:55: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 1theYg-0001eM-0p; Tue, 11 Feb 2025 00:55:26 +0000
Received: by outflank-mailman (input) for mailman id 885056;
 Tue, 11 Feb 2025 00:55: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 1theYf-0001eG-4f
 for xen-changelog@lists.xenproject.org; Tue, 11 Feb 2025 00:55: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 1theYf-00BQdM-18
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 00:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1theYe-003sH9-38
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 00:55: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=wCY5IGct43361Xw7fEp/goEFhY6IIOJ9kksSvcjDt/k=; b=Mp/jC1l+XRSRtSwt73a9vWh5yW
	4JSMf0LwTO5SaEVkdFKxZ0Xn2IuwsqfKWcHJ29KmUnP79Wo0CYgLQ6kh7bhCgxkMzaSNtlUjdaMay
	BtbzfzAO/0MTmsJatbc/F9OLHCwFcbJzFAq3pZZtZvsyvfOe9mhwhD05fgAVZshBrkyQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] RISCV: Activate UBSAN in testing
Message-Id: <E1theYe-003sH9-38@xenbits.xenproject.org>
Date: Tue, 11 Feb 2025 00:55:24 +0000

commit 227e68a9bf2eca507cc79efcb3f6f80b35108ae9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 7 21:19:21 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 10 23:40:12 2025 +0000

    RISCV: Activate UBSAN in testing
    
    RISC-V has less complicated headers, so update ubsan.c to pull in everything
    it needs.  Provide dump_execution_state(), and update the printk() message to
    make it more obvious that it's an outstanding task.
    
    As with commit 8ef2ac727e21 ("automation: enable UBSAN for debug tests"),
    enable UBSAN in RISC-V testing too.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 automation/gitlab-ci/build.yaml        | 3 +++
 xen/arch/riscv/Kconfig                 | 1 +
 xen/arch/riscv/include/asm/processor.h | 2 ++
 xen/arch/riscv/traps.c                 | 2 +-
 xen/common/ubsan/ubsan.c               | 5 ++++-
 5 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index fb55d4ce55..35e224366f 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -359,6 +359,9 @@ debian-12-riscv64-gcc-debug:
     CONTAINER: debian:12-riscv64
     KBUILD_DEFCONFIG: tiny64_defconfig
     HYPERVISOR_ONLY: y
+    EXTRA_XEN_CONFIG: |
+      CONFIG_UBSAN=y
+      CONFIG_UBSAN_FATAL=y
 
 # Arm32 cross-build
 
diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index 00f329054c..fa95cd0a42 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -4,6 +4,7 @@ config RISCV
 	select GENERIC_BUG_FRAME
 	select HAS_DEVICE_TREE
 	select HAS_PMAP
+	select HAS_UBSAN
 	select HAS_VMAP
 
 config RISCV_64
diff --git a/xen/arch/riscv/include/asm/processor.h b/xen/arch/riscv/include/asm/processor.h
index 90b8009563..39696fb58d 100644
--- a/xen/arch/riscv/include/asm/processor.h
+++ b/xen/arch/riscv/include/asm/processor.h
@@ -91,6 +91,8 @@ static inline void sfence_vma(void)
     asm volatile ( "sfence.vma" ::: "memory" );
 }
 
+#define dump_execution_state() run_in_exception_handler(show_execution_state)
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* ASM__RISCV__PROCESSOR_H */
diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index d55a4a827b..ea3638a54f 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -140,7 +140,7 @@ void vcpu_show_execution_state(struct vcpu *v)
 
 void show_execution_state(const struct cpu_user_regs *regs)
 {
-    printk("implement show_execution_state(regs)\n");
+    printk("TODO: Implement show_execution_state(regs)\n");
 }
 
 void arch_hypercall_tasklet_result(struct vcpu *v, long res)
diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index 7f73f94759..e99370322b 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -10,8 +10,11 @@
  *
  */
 
-#include <xen/spinlock.h>
+#include <xen/bitops.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
 #include <xen/percpu.h>
+#include <xen/spinlock.h>
 
 #define __noreturn    noreturn
 #define pr_err(...) printk(XENLOG_ERR __VA_ARGS__)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 11 14:33:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Feb 2025 14:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.885622.1295420 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1thrJu-0007zJ-W8; Tue, 11 Feb 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 885622.1295420; Tue, 11 Feb 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 1thrJu-0007zB-TZ; Tue, 11 Feb 2025 14:33:02 +0000
Received: by outflank-mailman (input) for mailman id 885622;
 Tue, 11 Feb 2025 14: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 1thrJt-0007z5-SF
 for xen-changelog@lists.xenproject.org; Tue, 11 Feb 2025 14: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 1thrJt-00D7dx-37
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 14:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1thrJt-005KuK-27
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 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=6UzfMEKZKGOp6zS/wqk2x1Hg7ycWtiqUGEIJwqcIbIY=; b=43vv93DuesMlTXYZAfCkCy/K3s
	y7aNhvgGAwwRwhs6vDQgMr+BeZXZXSyWWoyvlJaK9Hy77LP67CbV2z9fRZgKl2QBPYLdfPdB1h8yE
	VZGL4YXBSHhO/3G+ZHJ2bQxwAq8TN5koYZAv6Afa2XcSORvBaxbMlTmzApTytw+HPLmI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] RISCV/boot: Run constructors during setup
Message-Id: <E1thrJt-005KuK-27@xenbits.xenproject.org>
Date: Tue, 11 Feb 2025 14:33:01 +0000

commit d80498066f23b66f76b2ef87435ec815889245b8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 7 14:35:37 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 10 23:40:12 2025 +0000

    RISCV/boot: Run constructors during setup
    
    Without this, RISC-V isn't running boot time selftests when they're compiled
    in.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/riscv/setup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 38ca4f3baa..f2b6e684ac 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -109,6 +109,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
      */
     system_state = SYS_STATE_boot;
 
+    init_constructors();
+
     if ( acpi_disabled )
     {
         printk("Booting using Device Tree\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 11 14:33:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Feb 2025 14:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.885623.1295425 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1thrK5-000811-1X; Tue, 11 Feb 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 885623.1295425; Tue, 11 Feb 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 1thrK4-00080t-V8; Tue, 11 Feb 2025 14:33:12 +0000
Received: by outflank-mailman (input) for mailman id 885623;
 Tue, 11 Feb 2025 14: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 1thrK3-00080h-SM
 for xen-changelog@lists.xenproject.org; Tue, 11 Feb 2025 14: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 1thrK4-00D7eM-0H
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 14:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1thrK3-005Kv3-2X
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 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=rLSYjUI4Fibbevf57s0sz63jds0KImtwvbheTDabie8=; b=5b4VIxYzRfoxcfE28dVNFP/R5h
	FTyn6LWlSzxPPTZ/JlSSgYWHX0WFr4Ou/1V0LoUhQIIC3J9IarBXkXc6Z2QpKZlX+zQe4iChDX4wA
	XW0nTxBFd4KY4uvdVtx1Zu3OsYPFtBDf71jCPiSRQTsx/2z0vZprCUkf63b1kS2tSsA0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] RISCV/asm: Use CALL rather than JAL
Message-Id: <E1thrK3-005Kv3-2X@xenbits.xenproject.org>
Date: Tue, 11 Feb 2025 14:33:11 +0000

commit 99fe58e81b9a57d36feebb6f148a87dfdfaf35ce
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 7 15:04:25 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 10 23:40:12 2025 +0000

    RISCV/asm: Use CALL rather than JAL
    
    JAL has a maximium displacement of 2M.  To branch further, it needs pairing
    with an AUIPC instruction.  CALL is a pseudoinstruction which allows the
    linker to pick the appropriate sequence when relaxations are enabled.
    
    This avoids a build failure of the form:
    
      prelink.o: in function `start':
      xen/xen/arch/riscv/riscv64/head.S:28:(.text.header+0x2c):
      relocation truncated to fit: R_RISCV_JAL against symbol `calc_phys_offset' defined in .init.text section in prelink.o
      make[3]: *** [arch/riscv/Makefile:18: xen-syms] Error 1
    
    when Xen gets large enough, e.g. with CONFIG_UBSAN enabled.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/riscv/entry.S        |  2 +-
 xen/arch/riscv/riscv64/head.S | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/riscv/entry.S b/xen/arch/riscv/entry.S
index bf974655f8..4db818ba8d 100644
--- a/xen/arch/riscv/entry.S
+++ b/xen/arch/riscv/entry.S
@@ -49,7 +49,7 @@ save_to_stack:
         REG_S   t0, CPU_USER_REGS_SSTATUS(sp)
 
         mv      a0, sp
-        jal     do_trap
+        call    do_trap
 
 restore_registers:
         /* Restore stack_cpu_regs */
diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
index 2a1b3dad91..9c40512e61 100644
--- a/xen/arch/riscv/riscv64/head.S
+++ b/xen/arch/riscv/riscv64/head.S
@@ -28,7 +28,7 @@ FUNC(start)
         add     t3, t3, __SIZEOF_POINTER__
         bltu    t3, t4, .L_clear_bss
 
-        jal     reset_stack
+        call    reset_stack
 
         /*
          * save hart_id ( bootcpu_id ) and dtb_base as a0 and a1 register can
@@ -37,16 +37,16 @@ FUNC(start)
         mv      s0, a0
         mv      s1, a1
 
-        jal     calc_phys_offset
+        call    calc_phys_offset
         mv      s2, a0
 
-        jal     setup_initial_pagetables
+        call    setup_initial_pagetables
 
         /* Calculate proper VA after jump from 1:1 mapping */
         la      a0, .L_primary_switched
         sub     a0, a0, s2
 
-        jal     turn_on_mmu
+        call    turn_on_mmu
 
 .L_primary_switched:
         /*
@@ -54,11 +54,11 @@ FUNC(start)
          * recalculated after jump from 1:1 mapping world as 1:1 mapping
          * will be removed soon in start_xen().
          */
-        jal     reset_stack
+        call    reset_stack
 
         /* Xen's boot cpu id is equal to 0 so setup TP register for it */
         li      a0, 0
-        jal     setup_tp
+        call    setup_tp
 
         /* restore hart_id ( bootcpu_id ) and dtb address */
         mv      a0, s0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 11 14:33:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Feb 2025 14:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.885624.1295430 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1thrKG-000849-37; Tue, 11 Feb 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 885624.1295430; Tue, 11 Feb 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 1thrKG-000841-0L; Tue, 11 Feb 2025 14:33:24 +0000
Received: by outflank-mailman (input) for mailman id 885624;
 Tue, 11 Feb 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 1thrKE-00083l-0t
 for xen-changelog@lists.xenproject.org; Tue, 11 Feb 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 1thrKE-00D7eQ-0j
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 14:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1thrKD-005KxL-2v
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 14: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=UoaBogS+x0rKi9/gyxP0NiCjtejagZmGynlF5FJghOc=; b=F0mNRPoEqdATMDtyJGUoywPzat
	LMv987u9GEpKBqiIDh6X9R0I2UkZAoTWHCQ3pUgyxkGE4tjOIPZ2M93tkWp3jYhj/EmN62RItIPTK
	Do94JJ+3af3fvgjcpwPbTJc16isRJQc4eLyYIrmBqm6dk73e0mU2oGqKlLibO9VsW1GU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] RISCV: Activate UBSAN in testing
Message-Id: <E1thrKD-005KxL-2v@xenbits.xenproject.org>
Date: Tue, 11 Feb 2025 14:33:21 +0000

commit 227e68a9bf2eca507cc79efcb3f6f80b35108ae9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 7 21:19:21 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 10 23:40:12 2025 +0000

    RISCV: Activate UBSAN in testing
    
    RISC-V has less complicated headers, so update ubsan.c to pull in everything
    it needs.  Provide dump_execution_state(), and update the printk() message to
    make it more obvious that it's an outstanding task.
    
    As with commit 8ef2ac727e21 ("automation: enable UBSAN for debug tests"),
    enable UBSAN in RISC-V testing too.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 automation/gitlab-ci/build.yaml        | 3 +++
 xen/arch/riscv/Kconfig                 | 1 +
 xen/arch/riscv/include/asm/processor.h | 2 ++
 xen/arch/riscv/traps.c                 | 2 +-
 xen/common/ubsan/ubsan.c               | 5 ++++-
 5 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index fb55d4ce55..35e224366f 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -359,6 +359,9 @@ debian-12-riscv64-gcc-debug:
     CONTAINER: debian:12-riscv64
     KBUILD_DEFCONFIG: tiny64_defconfig
     HYPERVISOR_ONLY: y
+    EXTRA_XEN_CONFIG: |
+      CONFIG_UBSAN=y
+      CONFIG_UBSAN_FATAL=y
 
 # Arm32 cross-build
 
diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index 00f329054c..fa95cd0a42 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -4,6 +4,7 @@ config RISCV
 	select GENERIC_BUG_FRAME
 	select HAS_DEVICE_TREE
 	select HAS_PMAP
+	select HAS_UBSAN
 	select HAS_VMAP
 
 config RISCV_64
diff --git a/xen/arch/riscv/include/asm/processor.h b/xen/arch/riscv/include/asm/processor.h
index 90b8009563..39696fb58d 100644
--- a/xen/arch/riscv/include/asm/processor.h
+++ b/xen/arch/riscv/include/asm/processor.h
@@ -91,6 +91,8 @@ static inline void sfence_vma(void)
     asm volatile ( "sfence.vma" ::: "memory" );
 }
 
+#define dump_execution_state() run_in_exception_handler(show_execution_state)
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* ASM__RISCV__PROCESSOR_H */
diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index d55a4a827b..ea3638a54f 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -140,7 +140,7 @@ void vcpu_show_execution_state(struct vcpu *v)
 
 void show_execution_state(const struct cpu_user_regs *regs)
 {
-    printk("implement show_execution_state(regs)\n");
+    printk("TODO: Implement show_execution_state(regs)\n");
 }
 
 void arch_hypercall_tasklet_result(struct vcpu *v, long res)
diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index 7f73f94759..e99370322b 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -10,8 +10,11 @@
  *
  */
 
-#include <xen/spinlock.h>
+#include <xen/bitops.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
 #include <xen/percpu.h>
+#include <xen/spinlock.h>
 
 #define __noreturn    noreturn
 #define pr_err(...) printk(XENLOG_ERR __VA_ARGS__)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 11 17:11:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Feb 2025 17:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.885806.1295603 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1thtms-0007EN-Lz; Tue, 11 Feb 2025 17:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 885806.1295603; Tue, 11 Feb 2025 17:11: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 1thtms-0007EF-JG; Tue, 11 Feb 2025 17:11:06 +0000
Received: by outflank-mailman (input) for mailman id 885806;
 Tue, 11 Feb 2025 17:11: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 1thtmr-0007E9-HP
 for xen-changelog@lists.xenproject.org; Tue, 11 Feb 2025 17:11: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 1thtmr-00DBRT-1t
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 17:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1thtmr-005cDP-0n
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 17:11: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=aLXUeh+nfgsXvw9cPNSX3R8mPsPvU/EbTOFNWDBXBTE=; b=bG2knMBLRrI1Ta8NZV6nI+My0h
	SQ5PexybQ5kVl+v8DL85Jr5ah969y6MEYOo+/Ad0N3pfN5eEjg5Y02CZxxpGNCkP4wDstnhrKArXy
	tZobpoM2RTaayxsArV+OmPijbQ0ehh6GsqWQkdc706dTMISR7OYa7Lt6iY8NxUf5e8/E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: fix typo in sysconfig.xencommons.in
Message-Id: <E1thtmr-005cDP-0n@xenbits.xenproject.org>
Date: Tue, 11 Feb 2025 17:11:05 +0000

commit b2da4fc05576b06226fade454d1d6a9c94d62ff5
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Tue Feb 11 07:31:57 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 11 17:09:00 2025 +0000

    tools: fix typo in sysconfig.xencommons.in
    
    Fixes: 7b61011e1450 ("tools: make xenstore domain easy configurable")
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 tools/hotplug/Linux/init.d/sysconfig.xencommons.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
index 1bdd830d8a..1720a9b075 100644
--- a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
+++ b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
@@ -8,7 +8,7 @@
 ## Type: string
 ## Default: daemon
 #
-# Select type of xentore service.
+# Select type of xenstore service.
 #
 # This can be either of:
 #  * daemon
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 11 20:55:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 11 Feb 2025 20:55:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.885966.1295733 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1thxHc-0000dE-Jx; Tue, 11 Feb 2025 20:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 885966.1295733; Tue, 11 Feb 2025 20: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 1thxHc-0000d2-GW; Tue, 11 Feb 2025 20:55:04 +0000
Received: by outflank-mailman (input) for mailman id 885966;
 Tue, 11 Feb 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 1thxHa-0000cw-GA
 for xen-changelog@lists.xenproject.org; Tue, 11 Feb 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 1thxHa-00DGFo-1N
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 2025 20:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1thxHa-005usb-0I
 for xen-changelog@lists.xenproject.org;
 Tue, 11 Feb 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=XYGZHhe480yKstTvlrY/6KVwJK7/kMSFlaufOyPnnhA=; b=A1VzmK7G8Uq0whiBs3lTysfTrg
	5ZBDkG7MtBCh5aXpZ/Zo7cPll2iNxi6x+pcrEhxsbqMC84SrTUKhmvkNtE+cWL6omU2iHd3DtDy/g
	cHHMXfRDNOqGh5lyVQwXIdgAfrN5APVC2Ws+hcB+d/DVppnJLZ4TrjkM7m0H2Pq6Pu9Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: fix typo in sysconfig.xencommons.in
Message-Id: <E1thxHa-005usb-0I@xenbits.xenproject.org>
Date: Tue, 11 Feb 2025 20:55:02 +0000

commit b2da4fc05576b06226fade454d1d6a9c94d62ff5
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Tue Feb 11 07:31:57 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 11 17:09:00 2025 +0000

    tools: fix typo in sysconfig.xencommons.in
    
    Fixes: 7b61011e1450 ("tools: make xenstore domain easy configurable")
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 tools/hotplug/Linux/init.d/sysconfig.xencommons.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
index 1bdd830d8a..1720a9b075 100644
--- a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
+++ b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
@@ -8,7 +8,7 @@
 ## Type: string
 ## Default: daemon
 #
-# Select type of xentore service.
+# Select type of xenstore service.
 #
 # This can be either of:
 #  * daemon
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 12 15:33:16 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Feb 2025 15:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.886522.1296148 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiEjb-00020l-E5; Wed, 12 Feb 2025 15:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 886522.1296148; Wed, 12 Feb 2025 15:33:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiEjb-00020d-BT; Wed, 12 Feb 2025 15:33:07 +0000
Received: by outflank-mailman (input) for mailman id 886522;
 Wed, 12 Feb 2025 15:33: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 1tiEjZ-00020X-FT
 for xen-changelog@lists.xenproject.org; Wed, 12 Feb 2025 15:33: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 1tiEjZ-00F1cq-1R
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 15:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tiEjZ-007tcX-0T
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 15:33: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=CNcsDKI0SfjSb57N0+eTXUIRF8FbBT+YcRUGCFkWYMk=; b=uUajlCVFOKtPyTHHh8PZGYF+ZJ
	52i1MgtEZ0/HVGmL3XwBXIwWbNgGSnam9Wthg/P9SRxMxWkjKfZhf7fB185lihgYd/GS+N92f4ZNM
	vG/f3rZA9F05qk/FzaEr9v8J4yiPLkzWSP4NeUx+4EG5YqZoyhJB0ytCy5LOe2+pWu9g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shutdown: offline APs with interrupts disabled on all CPUs
Message-Id: <E1tiEjZ-007tcX-0T@xenbits.xenproject.org>
Date: Wed, 12 Feb 2025 15:33:05 +0000

commit 1191ce954f64244a3c5f553116184928bcc677e8
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Jan 28 09:34:20 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Feb 12 15:56:07 2025 +0100

    x86/shutdown: offline APs with interrupts disabled on all CPUs
    
    The current shutdown logic in smp_send_stop() will disable the APs while
    having interrupts enabled on the BSP or possibly other APs. On AMD systems
    this can lead to local APIC errors:
    
    APIC error on CPU0: 00(08), Receive accept error
    
    Such error message can be printed in a loop, thus blocking the system from
    rebooting.  I assume this loop is created by the error being triggered by
    the console interrupt, which is further stirred by the ESR handler
    printing to the console.
    
    Intel SDM states:
    
    "Receive Accept Error.
    
    Set when the local APIC detects that the message it received was not
    accepted by any APIC on the APIC bus, including itself. Used only on P6
    family and Pentium processors."
    
    So the error shouldn't trigger on any Intel CPU supported by Xen.
    
    However AMD doesn't make such claims, and indeed the error is broadcast to
    all local APICs when an interrupt targets a CPU that's already offline.
    
    To prevent the error from stalling the shutdown process perform the
    disabling of APs and the BSP local APIC with interrupts disabled on all
    CPUs in the system, so that by the time interrupts are unmasked on the BSP
    the local APIC is already disabled.  This can still lead to a spurious:
    
    APIC error on CPU0: 00(00)
    
    As a result of an LVT Error getting injected while interrupts are masked on
    the CPU, and the vector only handled after the local APIC is already
    disabled.  ESR reports 0 because as part of disable_local_APIC() the ESR
    register is cleared.
    
    Note the NMI crash path doesn't have such issue, because disabling of APs
    and the caller local APIC is already done in the same contiguous region
    with interrupts disabled.  There's a possible window on the NMI crash path
    (nmi_shootdown_cpus()) where some APs might be disabled (and thus
    interrupts targeting them raising "Receive accept error") before others APs
    have interrupts disabled.  However the shutdown NMI will be handled,
    regardless of whether the AP is processing a local APIC error, and hence
    such interrupts will not cause the shutdown process to get stuck.
    
    Remove the call to fixup_irqs() in smp_send_stop(): it doesn't achieve the
    intended goal of moving all interrupts to the BSP anyway.  The logic in
    fixup_irqs() will move interrupts whose affinity doesn't overlap with the
    passed mask, but the movement of interrupts is done to any CPU set in
    cpu_online_map.  As in the shutdown path fixup_irqs() is called before APs
    are cleared from cpu_online_map this leads to interrupts being shuffled
    around, but not assigned to the BSP exclusively.
    
    The Fixes tag is more of a guess than a certainty; it's possible the
    previous sleep window in fixup_irqs() allowed any in-flight interrupt to be
    delivered before APs went offline.  However fixup_irqs() was still
    incorrectly used, as it didn't (and still doesn't) move all interrupts to
    target the provided cpu mask.
    
    Fixes: e2bb28d62158 ('x86/irq: forward pending interrupts to new destination in fixup_irqs()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/smp.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 02a6ed7593..1d3878826f 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -345,6 +345,11 @@ void __stop_this_cpu(void)
 
 static void cf_check stop_this_cpu(void *dummy)
 {
+    const bool *stop_aps = dummy;
+
+    while ( !*stop_aps )
+        cpu_relax();
+
     __stop_this_cpu();
     for ( ; ; )
         halt();
@@ -357,16 +362,25 @@ static void cf_check stop_this_cpu(void *dummy)
 void smp_send_stop(void)
 {
     unsigned int cpu = smp_processor_id();
+    bool stop_aps = false;
+
+    /*
+     * Perform AP offlining and disabling of interrupt controllers with all
+     * CPUs on the system having interrupts disabled to prevent interrupt
+     * delivery errors.  On AMD systems "Receive accept error" will be
+     * broadcast to local APICs if interrupts target CPUs that are offline.
+     */
+    if ( num_online_cpus() > 1 )
+        smp_call_function(stop_this_cpu, &stop_aps, 0);
+
+    local_irq_disable();
 
     if ( num_online_cpus() > 1 )
     {
         int timeout = 10;
 
-        local_irq_disable();
-        fixup_irqs(cpumask_of(cpu), 0);
-        local_irq_enable();
-
-        smp_call_function(stop_this_cpu, NULL, 0);
+        /* Signal APs to stop. */
+        stop_aps = true;
 
         /* Wait 10ms for all other CPUs to go offline. */
         while ( (num_online_cpus() > 1) && (timeout-- > 0) )
@@ -375,13 +389,12 @@ void smp_send_stop(void)
 
     if ( cpu_online(cpu) )
     {
-        local_irq_disable();
         disable_IO_APIC();
         hpet_disable();
         __stop_this_cpu();
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
-        local_irq_enable();
     }
+    local_irq_enable();
 }
 
 void smp_send_nmi_allbutself(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 12 15:33:17 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Feb 2025 15:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.886523.1296152 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiEjl-00022M-Fr; Wed, 12 Feb 2025 15:33:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 886523.1296152; Wed, 12 Feb 2025 15:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiEjl-00022E-Cv; Wed, 12 Feb 2025 15:33:17 +0000
Received: by outflank-mailman (input) for mailman id 886523;
 Wed, 12 Feb 2025 15:33: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 1tiEjj-00021p-Ch
 for xen-changelog@lists.xenproject.org; Wed, 12 Feb 2025 15:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tiEjj-00F1cw-1p
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 15:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tiEjj-007tdV-0t
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 15:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=D9nOSm4UsRcLStY0p+4J9hsVJSrEJC4/+Z2F8a5C7p4=; b=R1MdzC0z/8qEcfBODQprS2CIQ2
	9ekXndNhTbVXjFmMLiIMihUd24e3OSQASbNRGQUPvfZHBN/jD3zM/AP4ndAJlP+QPjRy0SkfQzfcO
	oZZ2vxjlDnHAw0rCGIIMdTXG0fflDL7DvncE1Ah8BQGQVirQuD53TjVWNcgS+m1nePmI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/irq: drop fixup_irqs() parameters
Message-Id: <E1tiEjj-007tdV-0t@xenbits.xenproject.org>
Date: Wed, 12 Feb 2025 15:33:15 +0000

commit 446a90345c89d61550ca75f449f2c7ce8b924a6a
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Jan 28 16:06:07 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Feb 12 15:56:07 2025 +0100

    x86/irq: drop fixup_irqs() parameters
    
    The solely remaining caller always passes the same globally available
    parameters.  Drop the parameters and modify fixup_irqs() to use
    cpu_online_map in place of the input mask parameter, and always be verbose
    in its output printing.
    
    While there remove some of the checks given the single context where
    fixup_irqs() is now called, which should always be in the CPU offline path,
    after the CPU going offline has been removed from cpu_online_map.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/include/asm/irq.h |  4 ++--
 xen/arch/x86/irq.c             | 30 +++++++++++++-----------------
 xen/arch/x86/smpboot.c         |  2 +-
 3 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index d3bc768068..354868ba31 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -168,8 +168,8 @@ void free_domain_pirqs(struct domain *d);
 int map_domain_emuirq_pirq(struct domain *d, int pirq, int emuirq);
 int unmap_domain_pirq_emuirq(struct domain *d, int pirq);
 
-/* Evacuate interrupts assigned to CPUs not present in the input CPU mask. */
-void fixup_irqs(const cpumask_t *mask, bool verbose);
+/* Evacuate interrupts assigned to CPUs not present in the CPU online map. */
+void fixup_irqs(void);
 void fixup_eoi(void);
 
 int  init_irq_data(void);
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index e56bacc88d..ff3ac832f4 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2590,17 +2590,21 @@ static int __init cf_check setup_dump_irqs(void)
 }
 __initcall(setup_dump_irqs);
 
-/* Evacuate interrupts assigned to CPUs not present in the input CPU mask. */
-void fixup_irqs(const cpumask_t *mask, bool verbose)
+/* Evacuate interrupts assigned to CPUs not present in the CPU online map. */
+void fixup_irqs(void)
 {
+    const unsigned int cpu = smp_processor_id();
     unsigned int irq;
     static int warned;
     struct irq_desc *desc;
 
+    /* Only to be called from the context of a CPU going offline. */
+    ASSERT(!cpu_online(cpu));
+
     for ( irq = 0; irq < nr_irqs; irq++ )
     {
         bool break_affinity = false, set_affinity = true, check_irr = false;
-        unsigned int vector, cpu = smp_processor_id();
+        unsigned int vector;
         cpumask_t *affinity = this_cpu(scratch_cpumask);
 
         if ( irq == 2 )
@@ -2644,12 +2648,6 @@ void fixup_irqs(const cpumask_t *mask, bool verbose)
         }
 
         if ( desc->arch.move_in_progress &&
-             /*
-              * Only attempt to adjust the mask if the current CPU is going
-              * offline, otherwise the whole system is going down and leaving
-              * stale data in the masks is fine.
-              */
-             !cpu_online(cpu) &&
              cpumask_test_cpu(cpu, desc->arch.old_cpu_mask) )
         {
             /*
@@ -2691,16 +2689,17 @@ void fixup_irqs(const cpumask_t *mask, bool verbose)
 
         /*
          * Avoid shuffling the interrupt around as long as current target CPUs
-         * are a subset of the input mask.  What fixup_irqs() cares about is
-         * evacuating interrupts from CPUs not in the input mask.
+         * are a subset of the online mask.  What fixup_irqs() cares about is
+         * evacuating interrupts from CPUs not in the online mask.
          */
-        if ( !desc->action || cpumask_subset(desc->arch.cpu_mask, mask) )
+        if ( !desc->action || cpumask_subset(desc->arch.cpu_mask,
+                                             &cpu_online_map) )
         {
             spin_unlock(&desc->lock);
             continue;
         }
 
-        if ( !cpumask_intersects(mask, desc->affinity) )
+        if ( !cpumask_intersects(&cpu_online_map, desc->affinity) )
         {
             break_affinity = true;
             cpumask_setall(affinity);
@@ -2716,7 +2715,7 @@ void fixup_irqs(const cpumask_t *mask, bool verbose)
          * the interrupt, signal to check whether there are any pending vectors
          * to be handled in the local APIC after the interrupt has been moved.
          */
-        if ( !cpu_online(cpu) && cpumask_test_cpu(cpu, desc->arch.cpu_mask) )
+        if ( cpumask_test_cpu(cpu, desc->arch.cpu_mask) )
             check_irr = true;
 
         if ( desc->handler->set_affinity )
@@ -2743,9 +2742,6 @@ void fixup_irqs(const cpumask_t *mask, bool verbose)
 
         spin_unlock(&desc->lock);
 
-        if ( !verbose )
-            continue;
-
         if ( !set_affinity )
             printk("Cannot set affinity for IRQ%u\n", irq);
         else if ( break_affinity )
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 79a79c54c3..891a29fca1 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1282,7 +1282,7 @@ void __cpu_disable(void)
 
     /* It's now safe to remove this processor from the online map */
     cpumask_clear_cpu(cpu, &cpu_online_map);
-    fixup_irqs(&cpu_online_map, 1);
+    fixup_irqs();
     fixup_eoi();
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 12 15:33:26 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Feb 2025 15:33:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.886524.1296156 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiEju-00026N-H9; Wed, 12 Feb 2025 15:33:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 886524.1296156; Wed, 12 Feb 2025 15:33: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 1tiEju-00026F-EM; Wed, 12 Feb 2025 15:33:26 +0000
Received: by outflank-mailman (input) for mailman id 886524;
 Wed, 12 Feb 2025 15:33: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 1tiEjt-000261-H8
 for xen-changelog@lists.xenproject.org; Wed, 12 Feb 2025 15:33: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 1tiEjt-00F1dK-2N
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 15:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tiEjt-007tfx-1E
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 15:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OqyB1rsnTTxyDRdp9nfxyADgBZ979V94iTJdtG5QzRE=; b=OjZpkCXFCF8auD/Pu/JG9500AO
	9pW/ldMDBGQ4/TzjGXr4MWAPbwjexhaCC30qQVTlny0DWzzEp9hWxj1/2D7/CqDnVqWgqQUicJYbZ
	t80p/C5i/JyE3JIxuXxgGW5LtBDcazhFL1kTbjj9QNVN1+Idt3Fnc5LJh5lENmUZ5jn8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/smp: perform disabling on interrupts ahead of AP shutdown
Message-Id: <E1tiEjt-007tfx-1E@xenbits.xenproject.org>
Date: Wed, 12 Feb 2025 15:33:25 +0000

commit db6daa9bf411260d2c1f5301e4fc786ae4a5cef8
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 6 12:20:04 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Feb 12 15:56:07 2025 +0100

    x86/smp: perform disabling on interrupts ahead of AP shutdown
    
    Move the disabling of interrupt sources so it's done ahead of the offlining
    of APs.  This is to prevent AMD systems triggering "Receive accept error"
    when interrupts target CPUs that are no longer online.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 1d3878826f..4d29a09a9a 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -374,6 +374,8 @@ void smp_send_stop(void)
         smp_call_function(stop_this_cpu, &stop_aps, 0);
 
     local_irq_disable();
+    disable_IO_APIC();
+    hpet_disable();
 
     if ( num_online_cpus() > 1 )
     {
@@ -389,8 +391,6 @@ void smp_send_stop(void)
 
     if ( cpu_online(cpu) )
     {
-        disable_IO_APIC();
-        hpet_disable();
         __stop_this_cpu();
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 12 15:33:36 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Feb 2025 15:33:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.886525.1296160 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiEk4-000299-IS; Wed, 12 Feb 2025 15:33:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 886525.1296160; Wed, 12 Feb 2025 15:33: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 1tiEk4-000291-Fq; Wed, 12 Feb 2025 15:33:36 +0000
Received: by outflank-mailman (input) for mailman id 886525;
 Wed, 12 Feb 2025 15:33: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 1tiEk3-00028r-LO
 for xen-changelog@lists.xenproject.org; Wed, 12 Feb 2025 15:33: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 1tiEk3-00F1dR-2n
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 15:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tiEk3-007thI-1o
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 15:33: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=al7O5ashVlB0F5N/SGkVDF9C5sit4icxxjz8tXu18X0=; b=x7/IvkUbJ8f9gY4MPOw5nh8pld
	HylWi4MibEd2cIQuRBNxh0nw4B3MdNlZBS/OmnMt/H0fY5x2LZ+oY0ljy6+0B7nK7VOYr+PvTcblJ
	TZoo0PDkfVEicFlTWePWFk1Y9WURsQcuGgAuFAyFiIWLuv3pLeJFdF7qDHn7jxasbGtQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pci: disable MSI(-X) on all devices at shutdown
Message-Id: <E1tiEk3-007thI-1o@xenbits.xenproject.org>
Date: Wed, 12 Feb 2025 15:33:35 +0000

commit 7ab6951981231b4c576a3588248c303001272588
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Feb 5 15:05:47 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Feb 12 15:56:07 2025 +0100

    x86/pci: disable MSI(-X) on all devices at shutdown
    
    Attempt to disable MSI(-X) capabilities on all PCI devices know by Xen at
    shutdown.  Doing such disabling should facilitate kexec chained kernel from
    booting more reliably, as device MSI(-X) interrupt generation should be
    quiesced.
    
    Only attempt to disable MSI(-X) on all devices in the crash context if the
    PCI lock is not taken, otherwise the PCI device list could be in an
    inconsistent state.  This requires introducing a new pcidevs_trylock()
    helper to check whether the lock is currently taken.
    
    Disabling MSI(-X) should prevent "Receive accept error" being raised as a
    result of non-disabled interrupts targeting offline CPUs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/crash.c           | 10 ++++++++++
 xen/arch/x86/include/asm/msi.h |  1 +
 xen/arch/x86/msi.c             | 18 ++++++++++++++++++
 xen/arch/x86/smp.c             |  1 +
 xen/drivers/passthrough/pci.c  | 42 ++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/pci.h          | 12 ++++++++++++
 6 files changed, 84 insertions(+)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index a789416ca3..22b1121d7a 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -175,6 +175,16 @@ static void nmi_shootdown_cpus(void)
          */
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
 
+        if ( pcidevs_trylock() )
+        {
+            /*
+             * Assume the PCI device list to be in a consistent state if the
+             * lock is not held when the crash happened.
+             */
+            pci_disable_msi_all();
+            pcidevs_unlock();
+        }
+
         disable_IO_APIC();
         hpet_disable();
     }
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 63adb19820..7f9e531f73 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -86,6 +86,7 @@ extern int pci_enable_msi(struct pci_dev *pdev, struct msi_info *msi,
 extern void pci_disable_msi(struct msi_desc *msi_desc);
 extern int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off);
 extern void pci_cleanup_msi(struct pci_dev *pdev);
+extern void pci_disable_msi_all(void);
 extern int setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc);
 extern int __setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc,
                            hw_irq_controller *handler);
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index e2360579de..c9fe942c46 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1248,6 +1248,24 @@ void pci_cleanup_msi(struct pci_dev *pdev)
     msi_free_irqs(pdev);
 }
 
+static int cf_check disable_msi(struct pci_dev *pdev, void *arg)
+{
+    msi_set_enable(pdev, 0);
+    msix_set_enable(pdev, 0);
+
+    return 0;
+}
+
+/* Disable MSI and/or MSI-X on all devices known by Xen. */
+void pci_disable_msi_all(void)
+{
+    int rc = pci_iterate_devices(disable_msi, NULL);
+
+    if ( rc )
+        printk(XENLOG_ERR
+               "Failed to disable MSI(-X) on some devices: %d\n", rc);
+}
+
 int pci_reset_msix_state(struct pci_dev *pdev)
 {
     unsigned int pos = pdev->msix_pos;
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 4d29a09a9a..28bc041e03 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -374,6 +374,7 @@ void smp_send_stop(void)
         smp_call_function(stop_this_cpu, &stop_aps, 0);
 
     local_irq_disable();
+    pci_disable_msi_all();
     disable_IO_APIC();
     hpet_disable();
 
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index f398c3aa65..e1a09344df 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -68,6 +68,11 @@ bool pcidevs_locked(void)
     return rspin_is_locked(&_pcidevs_lock);
 }
 
+bool pcidevs_trylock_unsafe(void)
+{
+    return _rspin_trylock(&_pcidevs_lock);
+}
+
 static RADIX_TREE(pci_segments);
 
 static inline struct pci_seg *get_pseg(u16 seg)
@@ -1802,6 +1807,43 @@ int iommu_do_pci_domctl(
     return ret;
 }
 
+struct segment_iter {
+    int (*handler)(struct pci_dev *pdev, void *arg);
+    void *arg;
+    int rc;
+};
+
+static int cf_check iterate_all(struct pci_seg *pseg, void *arg)
+{
+    struct segment_iter *iter = arg;
+    struct pci_dev *pdev;
+
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+    {
+        int rc = iter->handler(pdev, iter->arg);
+
+        if ( !iter->rc )
+            iter->rc = rc;
+    }
+
+    return 0;
+}
+
+/*
+ * Iterate without locking or preemption over all PCI devices known by Xen.
+ * Can be called with interrupts disabled.
+ */
+int pci_iterate_devices(int (*handler)(struct pci_dev *pdev, void *arg),
+                        void *arg)
+{
+    struct segment_iter iter = {
+        .handler = handler,
+        .arg = arg,
+    };
+
+    return pci_segments_iterate(iterate_all, &iter) ?: iter.rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index f784e91160..4f12bcf089 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -190,6 +190,11 @@ static always_inline void pcidevs_lock(void)
 }
 void pcidevs_unlock(void);
 bool __must_check pcidevs_locked(void);
+bool pcidevs_trylock_unsafe(void);
+static always_inline bool pcidevs_trylock(void)
+{
+    return lock_evaluate_nospec(pcidevs_trylock_unsafe());
+}
 
 #ifndef NDEBUG
 /*
@@ -226,6 +231,13 @@ struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf);
 struct pci_dev *pci_get_real_pdev(pci_sbdf_t sbdf);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
+/*
+ * Iterate without locking or preemption over all PCI devices known by Xen.
+ * Can be called with interrupts disabled.
+ */
+int pci_iterate_devices(int (*handler)(struct pci_dev *pdev, void *arg),
+                        void *arg);
+
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
 uint16_t pci_conf_read16(pci_sbdf_t sbdf, unsigned int reg);
 uint32_t pci_conf_read32(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 12 15:33:46 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Feb 2025 15:33:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.886526.1296164 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiEkE-0002C3-Jz; Wed, 12 Feb 2025 15:33:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 886526.1296164; Wed, 12 Feb 2025 15:33: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 1tiEkE-0002Bw-HC; Wed, 12 Feb 2025 15:33:46 +0000
Received: by outflank-mailman (input) for mailman id 886526;
 Wed, 12 Feb 2025 15:33: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 1tiEkD-0002Bo-P4
 for xen-changelog@lists.xenproject.org; Wed, 12 Feb 2025 15:33: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 1tiEkD-00F1dX-39
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 15:33:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tiEkD-007tkT-2F
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 15:33: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=STV62m6HTj1T99tjUJNrp/ZvpPhZHJEX6BrKOeINIa4=; b=Edg9Y5yKvV0xHgJGE3BSJ/S4gC
	0fM6K3mHYlYf27OX7r0g2S4NAltYnSSYOwcmdH9KhVajuj/vxzQKuSpbF2xXDiFzLh8a7mew70xkO
	VfJfsKZHwkXN+ZoNbidgwM46cmHsK2+i+PmRdqL1xLnTYjwMEg2F8CS/+/blmP4z11oY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/iommu: disable interrupts at shutdown
Message-Id: <E1tiEkD-007tkT-2F@xenbits.xenproject.org>
Date: Wed, 12 Feb 2025 15:33:45 +0000

commit 819c3cb186a86ef3e04fb5af4d9f9f6de032c3ee
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 4 11:46:14 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Feb 12 15:56:07 2025 +0100

    x86/iommu: disable interrupts at shutdown
    
    Add a new hook to inhibit interrupt generation by the IOMMU(s).  Note the
    hook is currently only implemented for x86 IOMMUs.  The purpose is to
    disable interrupt generation at shutdown so any kexec chained image finds
    the IOMMU(s) in a quiesced state.
    
    It would also prevent "Receive accept error" being raised as a result of
    non-disabled interrupts targeting offline CPUs.
    
    Note that the iommu_quiesce() call in nmi_shootdown_cpus() is still
    required even when there's a preceding iommu_crash_shutdown() call; the
    later can become a no-op depending on the setting of the "crash-disable"
    command line option.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/crash.c                        |  1 +
 xen/arch/x86/smp.c                          |  1 +
 xen/drivers/passthrough/amd/iommu.h         |  1 +
 xen/drivers/passthrough/amd/iommu_init.c    | 17 +++++++++++++++++
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  1 +
 xen/drivers/passthrough/iommu.c             | 12 ++++++++++++
 xen/drivers/passthrough/vtd/iommu.c         | 19 +++++++++++++++++++
 xen/include/xen/iommu.h                     |  3 +++
 8 files changed, 55 insertions(+)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 22b1121d7a..26057c71d3 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -187,6 +187,7 @@ static void nmi_shootdown_cpus(void)
 
         disable_IO_APIC();
         hpet_disable();
+        iommu_quiesce();
     }
 }
 
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 28bc041e03..516dab5528 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -377,6 +377,7 @@ void smp_send_stop(void)
     pci_disable_msi_all();
     disable_IO_APIC();
     hpet_disable();
+    iommu_quiesce();
 
     if ( num_online_cpus() > 1 )
     {
diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index c32e9e9a16..00e81b4b2a 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -292,6 +292,7 @@ extern unsigned long *shared_intremap_inuse;
 void cf_check amd_iommu_resume(void);
 int __must_check cf_check amd_iommu_suspend(void);
 void cf_check amd_iommu_crash_shutdown(void);
+void cf_check amd_iommu_quiesce(void);
 
 static inline u32 get_field_from_reg_u32(u32 reg_value, u32 mask, u32 shift)
 {
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index ed5e684b93..934adc5abe 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -1608,3 +1608,20 @@ void cf_check amd_iommu_resume(void)
         invalidate_all_domain_pages();
     }
 }
+
+void cf_check amd_iommu_quiesce(void)
+{
+    struct amd_iommu *iommu;
+
+    for_each_amd_iommu ( iommu )
+    {
+        if ( iommu->ctrl.int_cap_xt_en )
+        {
+            iommu->ctrl.int_cap_xt_en = false;
+            writeq(iommu->ctrl.raw,
+                   iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
+        }
+        else
+            amd_iommu_msi_enable(iommu, IOMMU_CONTROL_DISABLED);
+    }
+}
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index f96f59440b..d00697edb3 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -791,6 +791,7 @@ static const struct iommu_ops __initconst_cf_clobber _iommu_ops = {
     .crash_shutdown = amd_iommu_crash_shutdown,
     .get_reserved_device_memory = amd_iommu_get_reserved_device_memory,
     .dump_page_tables = amd_dump_page_tables,
+    .quiesce = amd_iommu_quiesce,
 };
 
 static const struct iommu_init_ops __initconstrel _iommu_init_ops = {
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 9e74a1fc72..16aad86973 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -663,6 +663,18 @@ void iommu_crash_shutdown(void)
 #endif
 }
 
+void iommu_quiesce(void)
+{
+    const struct iommu_ops *ops;
+
+    if ( !iommu_enabled )
+        return;
+
+    ops = iommu_get_ops();
+    if ( ops->quiesce )
+        iommu_vcall(ops, quiesce);
+}
+
 int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt)
 {
     const struct iommu_ops *ops;
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 9d7a9977a6..a1927d9f12 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -3207,6 +3207,24 @@ static int cf_check intel_iommu_quarantine_init(struct pci_dev *pdev,
     return rc;
 }
 
+static void cf_check vtd_quiesce(void)
+{
+    const struct acpi_drhd_unit *drhd;
+
+    for_each_drhd_unit ( drhd )
+    {
+        const struct vtd_iommu *iommu = drhd->iommu;
+        uint32_t sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
+
+        /*
+         * Open code dma_msi_mask() to avoid taking the spinlock which could
+         * deadlock if called from crash context.
+         */
+        sts |= DMA_FECTL_IM;
+        dmar_writel(iommu->reg, DMAR_FECTL_REG, sts);
+    }
+}
+
 static const struct iommu_ops __initconst_cf_clobber vtd_ops = {
     .page_sizes = PAGE_SIZE_4K,
     .init = intel_iommu_domain_init,
@@ -3236,6 +3254,7 @@ static const struct iommu_ops __initconst_cf_clobber vtd_ops = {
     .iotlb_flush = iommu_flush_iotlb,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_page_tables = vtd_dump_page_tables,
+    .quiesce = vtd_quiesce,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index b928c67e19..77a514019c 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -314,6 +314,8 @@ struct iommu_ops {
      */
     int (*dt_xlate)(device_t *dev, const struct dt_phandle_args *args);
 #endif
+    /* Inhibit all interrupt generation, to be used at shutdown. */
+    void (*quiesce)(void);
 };
 
 /*
@@ -404,6 +406,7 @@ static inline int iommu_do_domctl(struct xen_domctl *domctl, struct domain *d,
 int __must_check iommu_suspend(void);
 void iommu_resume(void);
 void iommu_crash_shutdown(void);
+void iommu_quiesce(void);
 int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt);
 int iommu_quarantine_dev_init(device_t *dev);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 12 19:00:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Feb 2025 19:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.886715.1296328 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiHxr-0003tL-1u; Wed, 12 Feb 2025 19:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 886715.1296328; Wed, 12 Feb 2025 19: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 1tiHxq-0003sw-VE; Wed, 12 Feb 2025 19:00:02 +0000
Received: by outflank-mailman (input) for mailman id 886715;
 Wed, 12 Feb 2025 19: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 1tiHxq-0003iH-40
 for xen-changelog@lists.xenproject.org; Wed, 12 Feb 2025 19: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 1tiHxq-00F6ew-0m
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 19:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tiHxp-008X24-2v
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 19: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=9l+SmMc6uV6zHc5yniEV07CAQUpW4+DoXJae7ZmPBmU=; b=D+QXqJqwfLEhcH73/VHofObfJE
	suqEySgRK1rLMff+9/Gb/3EcAoRPQ5lC+dKaOymp1+2cg9rVwCmK9TfJKd8XnY2k1EN1ZzBpjjpxN
	vrbLLtJer8+rwARufIyJirbklKDGqwRnUFRLFbwjt+j1AI+HCjhhZMhJgYK059r/ku2c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shutdown: offline APs with interrupts disabled on all CPUs
Message-Id: <E1tiHxp-008X24-2v@xenbits.xenproject.org>
Date: Wed, 12 Feb 2025 19:00:01 +0000

commit 1191ce954f64244a3c5f553116184928bcc677e8
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Jan 28 09:34:20 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Feb 12 15:56:07 2025 +0100

    x86/shutdown: offline APs with interrupts disabled on all CPUs
    
    The current shutdown logic in smp_send_stop() will disable the APs while
    having interrupts enabled on the BSP or possibly other APs. On AMD systems
    this can lead to local APIC errors:
    
    APIC error on CPU0: 00(08), Receive accept error
    
    Such error message can be printed in a loop, thus blocking the system from
    rebooting.  I assume this loop is created by the error being triggered by
    the console interrupt, which is further stirred by the ESR handler
    printing to the console.
    
    Intel SDM states:
    
    "Receive Accept Error.
    
    Set when the local APIC detects that the message it received was not
    accepted by any APIC on the APIC bus, including itself. Used only on P6
    family and Pentium processors."
    
    So the error shouldn't trigger on any Intel CPU supported by Xen.
    
    However AMD doesn't make such claims, and indeed the error is broadcast to
    all local APICs when an interrupt targets a CPU that's already offline.
    
    To prevent the error from stalling the shutdown process perform the
    disabling of APs and the BSP local APIC with interrupts disabled on all
    CPUs in the system, so that by the time interrupts are unmasked on the BSP
    the local APIC is already disabled.  This can still lead to a spurious:
    
    APIC error on CPU0: 00(00)
    
    As a result of an LVT Error getting injected while interrupts are masked on
    the CPU, and the vector only handled after the local APIC is already
    disabled.  ESR reports 0 because as part of disable_local_APIC() the ESR
    register is cleared.
    
    Note the NMI crash path doesn't have such issue, because disabling of APs
    and the caller local APIC is already done in the same contiguous region
    with interrupts disabled.  There's a possible window on the NMI crash path
    (nmi_shootdown_cpus()) where some APs might be disabled (and thus
    interrupts targeting them raising "Receive accept error") before others APs
    have interrupts disabled.  However the shutdown NMI will be handled,
    regardless of whether the AP is processing a local APIC error, and hence
    such interrupts will not cause the shutdown process to get stuck.
    
    Remove the call to fixup_irqs() in smp_send_stop(): it doesn't achieve the
    intended goal of moving all interrupts to the BSP anyway.  The logic in
    fixup_irqs() will move interrupts whose affinity doesn't overlap with the
    passed mask, but the movement of interrupts is done to any CPU set in
    cpu_online_map.  As in the shutdown path fixup_irqs() is called before APs
    are cleared from cpu_online_map this leads to interrupts being shuffled
    around, but not assigned to the BSP exclusively.
    
    The Fixes tag is more of a guess than a certainty; it's possible the
    previous sleep window in fixup_irqs() allowed any in-flight interrupt to be
    delivered before APs went offline.  However fixup_irqs() was still
    incorrectly used, as it didn't (and still doesn't) move all interrupts to
    target the provided cpu mask.
    
    Fixes: e2bb28d62158 ('x86/irq: forward pending interrupts to new destination in fixup_irqs()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/smp.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 02a6ed7593..1d3878826f 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -345,6 +345,11 @@ void __stop_this_cpu(void)
 
 static void cf_check stop_this_cpu(void *dummy)
 {
+    const bool *stop_aps = dummy;
+
+    while ( !*stop_aps )
+        cpu_relax();
+
     __stop_this_cpu();
     for ( ; ; )
         halt();
@@ -357,16 +362,25 @@ static void cf_check stop_this_cpu(void *dummy)
 void smp_send_stop(void)
 {
     unsigned int cpu = smp_processor_id();
+    bool stop_aps = false;
+
+    /*
+     * Perform AP offlining and disabling of interrupt controllers with all
+     * CPUs on the system having interrupts disabled to prevent interrupt
+     * delivery errors.  On AMD systems "Receive accept error" will be
+     * broadcast to local APICs if interrupts target CPUs that are offline.
+     */
+    if ( num_online_cpus() > 1 )
+        smp_call_function(stop_this_cpu, &stop_aps, 0);
+
+    local_irq_disable();
 
     if ( num_online_cpus() > 1 )
     {
         int timeout = 10;
 
-        local_irq_disable();
-        fixup_irqs(cpumask_of(cpu), 0);
-        local_irq_enable();
-
-        smp_call_function(stop_this_cpu, NULL, 0);
+        /* Signal APs to stop. */
+        stop_aps = true;
 
         /* Wait 10ms for all other CPUs to go offline. */
         while ( (num_online_cpus() > 1) && (timeout-- > 0) )
@@ -375,13 +389,12 @@ void smp_send_stop(void)
 
     if ( cpu_online(cpu) )
     {
-        local_irq_disable();
         disable_IO_APIC();
         hpet_disable();
         __stop_this_cpu();
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
-        local_irq_enable();
     }
+    local_irq_enable();
 }
 
 void smp_send_nmi_allbutself(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 12 19:00:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Feb 2025 19:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.886716.1296332 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiHy1-0004aQ-3I; Wed, 12 Feb 2025 19:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 886716.1296332; Wed, 12 Feb 2025 19: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 1tiHy1-0004aI-0R; Wed, 12 Feb 2025 19:00:13 +0000
Received: by outflank-mailman (input) for mailman id 886716;
 Wed, 12 Feb 2025 19: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 1tiHy0-0004aA-5w
 for xen-changelog@lists.xenproject.org; Wed, 12 Feb 2025 19: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 1tiHy0-00F6f3-1D
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 19:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tiHy0-008X8O-0E
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 19: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=kzFrzZzVduJktrHhzswqDKtFzwSQXKUedDkNlC+ZVlY=; b=nMWGxHcIYqeUqHlmpo24La5vto
	pxz/g0eob4eAnFOHlxSvw9+Y25+j72xIVSZtCtHCh3z95XYjK8qhP/t/QjFZ3Bn8etxHOsAxmBnDg
	93EYVjysAowWZMjLIOtZEnJFX7hMpEaQ1k7TC/tA74yHoKcSXRwffZt5A2EgcfPBRKGE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/irq: drop fixup_irqs() parameters
Message-Id: <E1tiHy0-008X8O-0E@xenbits.xenproject.org>
Date: Wed, 12 Feb 2025 19:00:12 +0000

commit 446a90345c89d61550ca75f449f2c7ce8b924a6a
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Jan 28 16:06:07 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Feb 12 15:56:07 2025 +0100

    x86/irq: drop fixup_irqs() parameters
    
    The solely remaining caller always passes the same globally available
    parameters.  Drop the parameters and modify fixup_irqs() to use
    cpu_online_map in place of the input mask parameter, and always be verbose
    in its output printing.
    
    While there remove some of the checks given the single context where
    fixup_irqs() is now called, which should always be in the CPU offline path,
    after the CPU going offline has been removed from cpu_online_map.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/include/asm/irq.h |  4 ++--
 xen/arch/x86/irq.c             | 30 +++++++++++++-----------------
 xen/arch/x86/smpboot.c         |  2 +-
 3 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index d3bc768068..354868ba31 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -168,8 +168,8 @@ void free_domain_pirqs(struct domain *d);
 int map_domain_emuirq_pirq(struct domain *d, int pirq, int emuirq);
 int unmap_domain_pirq_emuirq(struct domain *d, int pirq);
 
-/* Evacuate interrupts assigned to CPUs not present in the input CPU mask. */
-void fixup_irqs(const cpumask_t *mask, bool verbose);
+/* Evacuate interrupts assigned to CPUs not present in the CPU online map. */
+void fixup_irqs(void);
 void fixup_eoi(void);
 
 int  init_irq_data(void);
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index e56bacc88d..ff3ac832f4 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2590,17 +2590,21 @@ static int __init cf_check setup_dump_irqs(void)
 }
 __initcall(setup_dump_irqs);
 
-/* Evacuate interrupts assigned to CPUs not present in the input CPU mask. */
-void fixup_irqs(const cpumask_t *mask, bool verbose)
+/* Evacuate interrupts assigned to CPUs not present in the CPU online map. */
+void fixup_irqs(void)
 {
+    const unsigned int cpu = smp_processor_id();
     unsigned int irq;
     static int warned;
     struct irq_desc *desc;
 
+    /* Only to be called from the context of a CPU going offline. */
+    ASSERT(!cpu_online(cpu));
+
     for ( irq = 0; irq < nr_irqs; irq++ )
     {
         bool break_affinity = false, set_affinity = true, check_irr = false;
-        unsigned int vector, cpu = smp_processor_id();
+        unsigned int vector;
         cpumask_t *affinity = this_cpu(scratch_cpumask);
 
         if ( irq == 2 )
@@ -2644,12 +2648,6 @@ void fixup_irqs(const cpumask_t *mask, bool verbose)
         }
 
         if ( desc->arch.move_in_progress &&
-             /*
-              * Only attempt to adjust the mask if the current CPU is going
-              * offline, otherwise the whole system is going down and leaving
-              * stale data in the masks is fine.
-              */
-             !cpu_online(cpu) &&
              cpumask_test_cpu(cpu, desc->arch.old_cpu_mask) )
         {
             /*
@@ -2691,16 +2689,17 @@ void fixup_irqs(const cpumask_t *mask, bool verbose)
 
         /*
          * Avoid shuffling the interrupt around as long as current target CPUs
-         * are a subset of the input mask.  What fixup_irqs() cares about is
-         * evacuating interrupts from CPUs not in the input mask.
+         * are a subset of the online mask.  What fixup_irqs() cares about is
+         * evacuating interrupts from CPUs not in the online mask.
          */
-        if ( !desc->action || cpumask_subset(desc->arch.cpu_mask, mask) )
+        if ( !desc->action || cpumask_subset(desc->arch.cpu_mask,
+                                             &cpu_online_map) )
         {
             spin_unlock(&desc->lock);
             continue;
         }
 
-        if ( !cpumask_intersects(mask, desc->affinity) )
+        if ( !cpumask_intersects(&cpu_online_map, desc->affinity) )
         {
             break_affinity = true;
             cpumask_setall(affinity);
@@ -2716,7 +2715,7 @@ void fixup_irqs(const cpumask_t *mask, bool verbose)
          * the interrupt, signal to check whether there are any pending vectors
          * to be handled in the local APIC after the interrupt has been moved.
          */
-        if ( !cpu_online(cpu) && cpumask_test_cpu(cpu, desc->arch.cpu_mask) )
+        if ( cpumask_test_cpu(cpu, desc->arch.cpu_mask) )
             check_irr = true;
 
         if ( desc->handler->set_affinity )
@@ -2743,9 +2742,6 @@ void fixup_irqs(const cpumask_t *mask, bool verbose)
 
         spin_unlock(&desc->lock);
 
-        if ( !verbose )
-            continue;
-
         if ( !set_affinity )
             printk("Cannot set affinity for IRQ%u\n", irq);
         else if ( break_affinity )
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 79a79c54c3..891a29fca1 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1282,7 +1282,7 @@ void __cpu_disable(void)
 
     /* It's now safe to remove this processor from the online map */
     cpumask_clear_cpu(cpu, &cpu_online_map);
-    fixup_irqs(&cpu_online_map, 1);
+    fixup_irqs();
     fixup_eoi();
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 12 19:00:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Feb 2025 19:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.886717.1296336 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiHyB-0004dE-4L; Wed, 12 Feb 2025 19:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 886717.1296336; Wed, 12 Feb 2025 19: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 1tiHyB-0004d6-1p; Wed, 12 Feb 2025 19:00:23 +0000
Received: by outflank-mailman (input) for mailman id 886717;
 Wed, 12 Feb 2025 19: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 1tiHyA-0004cy-8C
 for xen-changelog@lists.xenproject.org; Wed, 12 Feb 2025 19: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 1tiHyA-00F6f7-1U
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 19:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tiHyA-008XCp-0c
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 19: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=EFtVsXphjDhGhUmSKteQRP+PxPkDEjV1J92vpdBLgNg=; b=7FZfVD4oZDbbEU51lBSailkk7b
	76C1Bp25qPU15srCUH0MA4go4d6bN45f4B9MXCQwvUULlkv5CU2vT+lU8CbXXhPzMZGa8sv7nboPj
	v0WZFIznLALiLPyEDJ8t13YAsUnBvxAEeSKNR5yI0g9gknYlLcPujk3lMjIpjz7hHqI8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/smp: perform disabling on interrupts ahead of AP shutdown
Message-Id: <E1tiHyA-008XCp-0c@xenbits.xenproject.org>
Date: Wed, 12 Feb 2025 19:00:22 +0000

commit db6daa9bf411260d2c1f5301e4fc786ae4a5cef8
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 6 12:20:04 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Feb 12 15:56:07 2025 +0100

    x86/smp: perform disabling on interrupts ahead of AP shutdown
    
    Move the disabling of interrupt sources so it's done ahead of the offlining
    of APs.  This is to prevent AMD systems triggering "Receive accept error"
    when interrupts target CPUs that are no longer online.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 1d3878826f..4d29a09a9a 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -374,6 +374,8 @@ void smp_send_stop(void)
         smp_call_function(stop_this_cpu, &stop_aps, 0);
 
     local_irq_disable();
+    disable_IO_APIC();
+    hpet_disable();
 
     if ( num_online_cpus() > 1 )
     {
@@ -389,8 +391,6 @@ void smp_send_stop(void)
 
     if ( cpu_online(cpu) )
     {
-        disable_IO_APIC();
-        hpet_disable();
         __stop_this_cpu();
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 12 19:00:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Feb 2025 19:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.886718.1296341 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiHyL-0004hD-5w; Wed, 12 Feb 2025 19:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 886718.1296341; Wed, 12 Feb 2025 19: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 1tiHyL-0004h5-3C; Wed, 12 Feb 2025 19:00:33 +0000
Received: by outflank-mailman (input) for mailman id 886718;
 Wed, 12 Feb 2025 19: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 1tiHyK-0004gs-Cv
 for xen-changelog@lists.xenproject.org; Wed, 12 Feb 2025 19: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 1tiHyK-00F6fR-1x
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 19:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tiHyK-008XEI-0w
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 19: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=uN4/eqwxyrxsjOi9MR1MoctFKpiKRKfF4pEMgbpMmsk=; b=IS1pSV7tPfjckVoLOGjeGwpxsJ
	L5V9nsedRMioFF+5VLT4jqGNU6G6uzFaVXpchKoaKuAY/P9O1eH004XNffHvtKp6ee2xoOknAfUCV
	YAw15P2+1dD/ETabqn0vp2P1VaVjfXn33AMBPvRQIfw7Pjth4C79gId4Wsui4q3vpMGU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pci: disable MSI(-X) on all devices at shutdown
Message-Id: <E1tiHyK-008XEI-0w@xenbits.xenproject.org>
Date: Wed, 12 Feb 2025 19:00:32 +0000

commit 7ab6951981231b4c576a3588248c303001272588
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Feb 5 15:05:47 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Feb 12 15:56:07 2025 +0100

    x86/pci: disable MSI(-X) on all devices at shutdown
    
    Attempt to disable MSI(-X) capabilities on all PCI devices know by Xen at
    shutdown.  Doing such disabling should facilitate kexec chained kernel from
    booting more reliably, as device MSI(-X) interrupt generation should be
    quiesced.
    
    Only attempt to disable MSI(-X) on all devices in the crash context if the
    PCI lock is not taken, otherwise the PCI device list could be in an
    inconsistent state.  This requires introducing a new pcidevs_trylock()
    helper to check whether the lock is currently taken.
    
    Disabling MSI(-X) should prevent "Receive accept error" being raised as a
    result of non-disabled interrupts targeting offline CPUs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/crash.c           | 10 ++++++++++
 xen/arch/x86/include/asm/msi.h |  1 +
 xen/arch/x86/msi.c             | 18 ++++++++++++++++++
 xen/arch/x86/smp.c             |  1 +
 xen/drivers/passthrough/pci.c  | 42 ++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/pci.h          | 12 ++++++++++++
 6 files changed, 84 insertions(+)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index a789416ca3..22b1121d7a 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -175,6 +175,16 @@ static void nmi_shootdown_cpus(void)
          */
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
 
+        if ( pcidevs_trylock() )
+        {
+            /*
+             * Assume the PCI device list to be in a consistent state if the
+             * lock is not held when the crash happened.
+             */
+            pci_disable_msi_all();
+            pcidevs_unlock();
+        }
+
         disable_IO_APIC();
         hpet_disable();
     }
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 63adb19820..7f9e531f73 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -86,6 +86,7 @@ extern int pci_enable_msi(struct pci_dev *pdev, struct msi_info *msi,
 extern void pci_disable_msi(struct msi_desc *msi_desc);
 extern int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off);
 extern void pci_cleanup_msi(struct pci_dev *pdev);
+extern void pci_disable_msi_all(void);
 extern int setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc);
 extern int __setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc,
                            hw_irq_controller *handler);
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index e2360579de..c9fe942c46 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1248,6 +1248,24 @@ void pci_cleanup_msi(struct pci_dev *pdev)
     msi_free_irqs(pdev);
 }
 
+static int cf_check disable_msi(struct pci_dev *pdev, void *arg)
+{
+    msi_set_enable(pdev, 0);
+    msix_set_enable(pdev, 0);
+
+    return 0;
+}
+
+/* Disable MSI and/or MSI-X on all devices known by Xen. */
+void pci_disable_msi_all(void)
+{
+    int rc = pci_iterate_devices(disable_msi, NULL);
+
+    if ( rc )
+        printk(XENLOG_ERR
+               "Failed to disable MSI(-X) on some devices: %d\n", rc);
+}
+
 int pci_reset_msix_state(struct pci_dev *pdev)
 {
     unsigned int pos = pdev->msix_pos;
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 4d29a09a9a..28bc041e03 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -374,6 +374,7 @@ void smp_send_stop(void)
         smp_call_function(stop_this_cpu, &stop_aps, 0);
 
     local_irq_disable();
+    pci_disable_msi_all();
     disable_IO_APIC();
     hpet_disable();
 
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index f398c3aa65..e1a09344df 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -68,6 +68,11 @@ bool pcidevs_locked(void)
     return rspin_is_locked(&_pcidevs_lock);
 }
 
+bool pcidevs_trylock_unsafe(void)
+{
+    return _rspin_trylock(&_pcidevs_lock);
+}
+
 static RADIX_TREE(pci_segments);
 
 static inline struct pci_seg *get_pseg(u16 seg)
@@ -1802,6 +1807,43 @@ int iommu_do_pci_domctl(
     return ret;
 }
 
+struct segment_iter {
+    int (*handler)(struct pci_dev *pdev, void *arg);
+    void *arg;
+    int rc;
+};
+
+static int cf_check iterate_all(struct pci_seg *pseg, void *arg)
+{
+    struct segment_iter *iter = arg;
+    struct pci_dev *pdev;
+
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+    {
+        int rc = iter->handler(pdev, iter->arg);
+
+        if ( !iter->rc )
+            iter->rc = rc;
+    }
+
+    return 0;
+}
+
+/*
+ * Iterate without locking or preemption over all PCI devices known by Xen.
+ * Can be called with interrupts disabled.
+ */
+int pci_iterate_devices(int (*handler)(struct pci_dev *pdev, void *arg),
+                        void *arg)
+{
+    struct segment_iter iter = {
+        .handler = handler,
+        .arg = arg,
+    };
+
+    return pci_segments_iterate(iterate_all, &iter) ?: iter.rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index f784e91160..4f12bcf089 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -190,6 +190,11 @@ static always_inline void pcidevs_lock(void)
 }
 void pcidevs_unlock(void);
 bool __must_check pcidevs_locked(void);
+bool pcidevs_trylock_unsafe(void);
+static always_inline bool pcidevs_trylock(void)
+{
+    return lock_evaluate_nospec(pcidevs_trylock_unsafe());
+}
 
 #ifndef NDEBUG
 /*
@@ -226,6 +231,13 @@ struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf);
 struct pci_dev *pci_get_real_pdev(pci_sbdf_t sbdf);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
+/*
+ * Iterate without locking or preemption over all PCI devices known by Xen.
+ * Can be called with interrupts disabled.
+ */
+int pci_iterate_devices(int (*handler)(struct pci_dev *pdev, void *arg),
+                        void *arg);
+
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
 uint16_t pci_conf_read16(pci_sbdf_t sbdf, unsigned int reg);
 uint32_t pci_conf_read32(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 12 19:00:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 12 Feb 2025 19:00:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.886719.1296344 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiHyV-0004k6-7g; Wed, 12 Feb 2025 19:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 886719.1296344; Wed, 12 Feb 2025 19: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 1tiHyV-0004jx-4b; Wed, 12 Feb 2025 19:00:43 +0000
Received: by outflank-mailman (input) for mailman id 886719;
 Wed, 12 Feb 2025 19: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 1tiHyU-0004jl-GY
 for xen-changelog@lists.xenproject.org; Wed, 12 Feb 2025 19: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 1tiHyU-00F6fV-2J
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 19:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tiHyU-008XGI-1R
 for xen-changelog@lists.xenproject.org;
 Wed, 12 Feb 2025 19: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=m0q3Ej8LkCGpFqlzvSSJjexATLzH4/a5rHsMSDPm3oo=; b=tbkY2wL2r4vkh4jxGa7Wq8iJr+
	7N73Ciy3Tj86yo7hlQtYUmTZ5ldHto6W1AvjNU4xhBtu1SBhV3l1e1NpCMovyRFMytuLo9FBgwsqG
	TcIcheblDXfxgKVWoUuiw+X5f+Bip3jrlImneD+yVfqF3qc7rIsc4nU3ERfWoUPHSauo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/iommu: disable interrupts at shutdown
Message-Id: <E1tiHyU-008XGI-1R@xenbits.xenproject.org>
Date: Wed, 12 Feb 2025 19:00:42 +0000

commit 819c3cb186a86ef3e04fb5af4d9f9f6de032c3ee
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 4 11:46:14 2025 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Wed Feb 12 15:56:07 2025 +0100

    x86/iommu: disable interrupts at shutdown
    
    Add a new hook to inhibit interrupt generation by the IOMMU(s).  Note the
    hook is currently only implemented for x86 IOMMUs.  The purpose is to
    disable interrupt generation at shutdown so any kexec chained image finds
    the IOMMU(s) in a quiesced state.
    
    It would also prevent "Receive accept error" being raised as a result of
    non-disabled interrupts targeting offline CPUs.
    
    Note that the iommu_quiesce() call in nmi_shootdown_cpus() is still
    required even when there's a preceding iommu_crash_shutdown() call; the
    later can become a no-op depending on the setting of the "crash-disable"
    command line option.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/crash.c                        |  1 +
 xen/arch/x86/smp.c                          |  1 +
 xen/drivers/passthrough/amd/iommu.h         |  1 +
 xen/drivers/passthrough/amd/iommu_init.c    | 17 +++++++++++++++++
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  1 +
 xen/drivers/passthrough/iommu.c             | 12 ++++++++++++
 xen/drivers/passthrough/vtd/iommu.c         | 19 +++++++++++++++++++
 xen/include/xen/iommu.h                     |  3 +++
 8 files changed, 55 insertions(+)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 22b1121d7a..26057c71d3 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -187,6 +187,7 @@ static void nmi_shootdown_cpus(void)
 
         disable_IO_APIC();
         hpet_disable();
+        iommu_quiesce();
     }
 }
 
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 28bc041e03..516dab5528 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -377,6 +377,7 @@ void smp_send_stop(void)
     pci_disable_msi_all();
     disable_IO_APIC();
     hpet_disable();
+    iommu_quiesce();
 
     if ( num_online_cpus() > 1 )
     {
diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index c32e9e9a16..00e81b4b2a 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -292,6 +292,7 @@ extern unsigned long *shared_intremap_inuse;
 void cf_check amd_iommu_resume(void);
 int __must_check cf_check amd_iommu_suspend(void);
 void cf_check amd_iommu_crash_shutdown(void);
+void cf_check amd_iommu_quiesce(void);
 
 static inline u32 get_field_from_reg_u32(u32 reg_value, u32 mask, u32 shift)
 {
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index ed5e684b93..934adc5abe 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -1608,3 +1608,20 @@ void cf_check amd_iommu_resume(void)
         invalidate_all_domain_pages();
     }
 }
+
+void cf_check amd_iommu_quiesce(void)
+{
+    struct amd_iommu *iommu;
+
+    for_each_amd_iommu ( iommu )
+    {
+        if ( iommu->ctrl.int_cap_xt_en )
+        {
+            iommu->ctrl.int_cap_xt_en = false;
+            writeq(iommu->ctrl.raw,
+                   iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
+        }
+        else
+            amd_iommu_msi_enable(iommu, IOMMU_CONTROL_DISABLED);
+    }
+}
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index f96f59440b..d00697edb3 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -791,6 +791,7 @@ static const struct iommu_ops __initconst_cf_clobber _iommu_ops = {
     .crash_shutdown = amd_iommu_crash_shutdown,
     .get_reserved_device_memory = amd_iommu_get_reserved_device_memory,
     .dump_page_tables = amd_dump_page_tables,
+    .quiesce = amd_iommu_quiesce,
 };
 
 static const struct iommu_init_ops __initconstrel _iommu_init_ops = {
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 9e74a1fc72..16aad86973 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -663,6 +663,18 @@ void iommu_crash_shutdown(void)
 #endif
 }
 
+void iommu_quiesce(void)
+{
+    const struct iommu_ops *ops;
+
+    if ( !iommu_enabled )
+        return;
+
+    ops = iommu_get_ops();
+    if ( ops->quiesce )
+        iommu_vcall(ops, quiesce);
+}
+
 int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt)
 {
     const struct iommu_ops *ops;
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 9d7a9977a6..a1927d9f12 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -3207,6 +3207,24 @@ static int cf_check intel_iommu_quarantine_init(struct pci_dev *pdev,
     return rc;
 }
 
+static void cf_check vtd_quiesce(void)
+{
+    const struct acpi_drhd_unit *drhd;
+
+    for_each_drhd_unit ( drhd )
+    {
+        const struct vtd_iommu *iommu = drhd->iommu;
+        uint32_t sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
+
+        /*
+         * Open code dma_msi_mask() to avoid taking the spinlock which could
+         * deadlock if called from crash context.
+         */
+        sts |= DMA_FECTL_IM;
+        dmar_writel(iommu->reg, DMAR_FECTL_REG, sts);
+    }
+}
+
 static const struct iommu_ops __initconst_cf_clobber vtd_ops = {
     .page_sizes = PAGE_SIZE_4K,
     .init = intel_iommu_domain_init,
@@ -3236,6 +3254,7 @@ static const struct iommu_ops __initconst_cf_clobber vtd_ops = {
     .iotlb_flush = iommu_flush_iotlb,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_page_tables = vtd_dump_page_tables,
+    .quiesce = vtd_quiesce,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index b928c67e19..77a514019c 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -314,6 +314,8 @@ struct iommu_ops {
      */
     int (*dt_xlate)(device_t *dev, const struct dt_phandle_args *args);
 #endif
+    /* Inhibit all interrupt generation, to be used at shutdown. */
+    void (*quiesce)(void);
 };
 
 /*
@@ -404,6 +406,7 @@ static inline int iommu_do_domctl(struct xen_domctl *domctl, struct domain *d,
 int __must_check iommu_suspend(void);
 void iommu_resume(void);
 void iommu_crash_shutdown(void);
+void iommu_quiesce(void);
 int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt);
 int iommu_quarantine_dev_init(device_t *dev);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 13 13:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Feb 2025 13:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.887604.1297064 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tiZVe-0006Et-RF; Thu, 13 Feb 2025 13:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 887604.1297064; Thu, 13 Feb 2025 13:44: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 1tiZVe-0006Em-Oi; Thu, 13 Feb 2025 13:44:06 +0000
Received: by outflank-mailman (input) for mailman id 887604;
 Thu, 13 Feb 2025 13:44: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 1tiZVd-0006Eg-FA
 for xen-changelog@lists.xenproject.org; Thu, 13 Feb 2025 13:44: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 1tiZVd-00GsYn-1J
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Feb 2025 13:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tiZVd-00C2mY-0I
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Feb 2025 13:44: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=hkcpjZulAzP+B+MkxJJaOP2ijjVcum4vKrln9YQJyqk=; b=3NGDBjlsiUCS2k2sdfdbku9OwA
	lhuFUjgqtRrUyZTZoyXZIam4wC6ChK0JWsFjAh0oa5EiGo4qJp2TBSzZ4geXnUfpjZO1liv7NKnpF
	Zf6Qp2eji7Nn8IN9bthaMn+UN1NraqMvRd3WqH+Y79urzthdsdGSABjLlXUKWNXyucj4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: use XVFREE() in hvmemul_cache_destroy()
Message-Id: <E1tiZVd-00C2mY-0I@xenbits.xenproject.org>
Date: Thu, 13 Feb 2025 13:44:05 +0000

commit b5b2f9877a8777af6b78944407527e0a450389a2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 13 14:32:13 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 13 14:32:13 2025 +0100

    x86/HVM: use XVFREE() in hvmemul_cache_destroy()
    
    My adjustments to move from xmalloc() et al to respective xvmalloc()
    flavors was flawed - a freeing instance wasn't converted.
    
    Fixes: 23d60dbb0493 ("x86/HVM: allocate emulation cache entries dynamically")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/include/asm/hvm/emulate.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index 760ce5e77c..45b03e4e37 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -123,7 +123,7 @@ static inline void hvmemul_cache_destroy(struct vcpu *v)
     unsigned int i;
 
     for ( i = 0; i < ARRAY_SIZE(v->arch.hvm.hvm_io.mmio_cache); ++i )
-        XFREE(v->arch.hvm.hvm_io.mmio_cache[i]);
+        XVFREE(v->arch.hvm.hvm_io.mmio_cache[i]);
     XVFREE(v->arch.hvm.hvm_io.cache);
 }
 bool hvmemul_read_cache(const struct vcpu *v, paddr_t gpa,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 13 16:22:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 13 Feb 2025 16:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.887868.1297307 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tibyV-0001E9-I6; Thu, 13 Feb 2025 16:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 887868.1297307; Thu, 13 Feb 2025 16: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 1tibyV-0001E2-FU; Thu, 13 Feb 2025 16:22:03 +0000
Received: by outflank-mailman (input) for mailman id 887868;
 Thu, 13 Feb 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 1tibyT-0001Dw-Uj
 for xen-changelog@lists.xenproject.org; Thu, 13 Feb 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 1tibyT-00GwTx-2X
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Feb 2025 16:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tibyT-00CWej-1X
 for xen-changelog@lists.xenproject.org;
 Thu, 13 Feb 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=KXXPP17GPWGjQ5K/P0iuy2SiOoE6Bo3pd1+/e2dtBSU=; b=JV879pC3/HQ4P5pEV1EhxI57yk
	xz+z16kxVBXzgxpEzF5FTv0Ap3j0ZCeGdCUv7NiGRJT9uKQz+E7GegDliIUaIKsNi/QFrC7Cl1g1B
	7XVhwYKmhViIFrZkSFkj65XSO7G65jbNMxo6FBNjV32UAoHe21h3YSssCQ59SiQ5BK9Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: use XVFREE() in hvmemul_cache_destroy()
Message-Id: <E1tibyT-00CWej-1X@xenbits.xenproject.org>
Date: Thu, 13 Feb 2025 16:22:01 +0000

commit b5b2f9877a8777af6b78944407527e0a450389a2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 13 14:32:13 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 13 14:32:13 2025 +0100

    x86/HVM: use XVFREE() in hvmemul_cache_destroy()
    
    My adjustments to move from xmalloc() et al to respective xvmalloc()
    flavors was flawed - a freeing instance wasn't converted.
    
    Fixes: 23d60dbb0493 ("x86/HVM: allocate emulation cache entries dynamically")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/include/asm/hvm/emulate.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index 760ce5e77c..45b03e4e37 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -123,7 +123,7 @@ static inline void hvmemul_cache_destroy(struct vcpu *v)
     unsigned int i;
 
     for ( i = 0; i < ARRAY_SIZE(v->arch.hvm.hvm_io.mmio_cache); ++i )
-        XFREE(v->arch.hvm.hvm_io.mmio_cache[i]);
+        XVFREE(v->arch.hvm.hvm_io.mmio_cache[i]);
     XVFREE(v->arch.hvm.hvm_io.cache);
 }
 bool hvmemul_read_cache(const struct vcpu *v, paddr_t gpa,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 14 00:55:16 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Feb 2025 00:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.888245.1297632 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tijz1-0001GC-5Y; Fri, 14 Feb 2025 00:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 888245.1297632; Fri, 14 Feb 2025 00:55:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tijz1-0001G2-2u; Fri, 14 Feb 2025 00:55:07 +0000
Received: by outflank-mailman (input) for mailman id 888245;
 Fri, 14 Feb 2025 00:55: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 1tijyz-0001Fw-LA
 for xen-changelog@lists.xenproject.org; Fri, 14 Feb 2025 00:55: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 1tijyz-00H7uL-1o
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Feb 2025 00:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tijyz-00E5GR-0m
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Feb 2025 00:55: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=rvDclouq86ukt0izSShqYvk6A+VPp80rcMMI4cB5aNk=; b=glyQH9RQ/z1t3txA+CtviKg3jt
	dk+BtEp1JXfWC658pWS7OjA73KXIUDB9Nk8rM6tQ03OEzu1PURX1QPsRpDwBxAPjBe1KDJHRzs/Pd
	O248eQSGI0Vm9W1ocZ6BDYrxz+Dxq5NuaV/rXRwgygUf2LBWALZN+tZSozYSodsqEhCQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM32/traps: Fix do_trap_undefined_instruction()'s detection of kernel text
Message-Id: <E1tijyz-00E5GR-0m@xenbits.xenproject.org>
Date: Fri, 14 Feb 2025 00:55:05 +0000

commit 414dde38b0cf8a38230c8c3f9e8564da9762e743
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 7 23:15:01 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 13 23:39:08 2025 +0000

    ARM32/traps: Fix do_trap_undefined_instruction()'s detection of kernel text
    
    While fixing some common/arch boundaries for UBSAN support on other
    architectures, the following debugging patch:
    
      diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
      index c1f2d1b89d43..58d1d048d339 100644
      --- a/xen/arch/arm/setup.c
      +++ b/xen/arch/arm/setup.c
      @@ -504,6 +504,8 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
    
           system_state = SYS_STATE_active;
    
      +    dump_execution_state();
      +
           for_each_domain( d )
               domain_unpause_by_systemcontroller(d);
    
    failed with:
    
      (XEN) *** Serial input to DOM0 (type 'CTRL-a' three times to switch input)
      (XEN) CPU0: Unexpected Trap: Undefined Instruction
      (XEN) ----[ Xen-4.20-rc  arm32  debug=n  Not tainted ]----
      (XEN) CPU:    0
      <snip>
      (XEN)
      (XEN) ****************************************
      (XEN) Panic on CPU 0:
      (XEN) CPU0: Unexpected Trap: Undefined Instruction
      (XEN) ****************************************
    
    This is because the condition for init text is wrong.  While there's nothing
    interesting from that point onwards in start_xen(), it's also wrong for
    livepatches too.
    
    Use is_active_kernel_text() which is the correct test for this purpose, and is
    aware of init and livepatch regions as well as their lifetimes.
    
    Fixes: 3e802c6ca1fb ("xen/arm: Correctly support WARN_ON")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/arm/arm32/traps.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/arm/arm32/traps.c b/xen/arch/arm/arm32/traps.c
index a2fc1c22cb..b88d41811b 100644
--- a/xen/arch/arm/arm32/traps.c
+++ b/xen/arch/arm/arm32/traps.c
@@ -36,8 +36,7 @@ void do_trap_undefined_instruction(struct cpu_user_regs *regs)
     uint32_t pc = regs->pc;
     uint32_t instr;
 
-    if ( !is_kernel_text(pc) &&
-         (system_state >= SYS_STATE_active || !is_kernel_inittext(pc)) )
+    if ( !is_active_kernel_text(pc) )
         goto die;
 
     /* PC should be always a multiple of 4, as Xen is using ARM instruction set */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 14 02:00:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 14 Feb 2025 02:00:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.888316.1297706 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tikzq-000414-Ft; Fri, 14 Feb 2025 02:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 888316.1297706; Fri, 14 Feb 2025 02: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 1tikzq-00040j-D4; Fri, 14 Feb 2025 02:00:02 +0000
Received: by outflank-mailman (input) for mailman id 888316;
 Fri, 14 Feb 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 1tikzq-0003uh-4h
 for xen-changelog@lists.xenproject.org; Fri, 14 Feb 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 1tikzq-000voV-0S
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Feb 2025 02:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tikzp-00EHR4-2h
 for xen-changelog@lists.xenproject.org;
 Fri, 14 Feb 2025 02: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=LFQcjsZYdbBIP/ZMXJQxz3yfULscKPjzMxKNf9yCpe4=; b=1Y0012bFFd7s/UJSz301E9thuH
	hpA+beBO6pIOF9+8OBLKiDJZhBivZs4MWifuB0TbGVBj9cvuPuZ7T4JXRuxxYKEq1d/ORu5alm6J8
	1NMMWJ24nVRRjwrHJr9Z5ulV58/aCrWgg5ytxuwlNONH3H4aAwafvD5oMdRjm+8Zsr30=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM32/traps: Fix do_trap_undefined_instruction()'s detection of kernel text
Message-Id: <E1tikzp-00EHR4-2h@xenbits.xenproject.org>
Date: Fri, 14 Feb 2025 02:00:01 +0000

commit 414dde38b0cf8a38230c8c3f9e8564da9762e743
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 7 23:15:01 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 13 23:39:08 2025 +0000

    ARM32/traps: Fix do_trap_undefined_instruction()'s detection of kernel text
    
    While fixing some common/arch boundaries for UBSAN support on other
    architectures, the following debugging patch:
    
      diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
      index c1f2d1b89d43..58d1d048d339 100644
      --- a/xen/arch/arm/setup.c
      +++ b/xen/arch/arm/setup.c
      @@ -504,6 +504,8 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
    
           system_state = SYS_STATE_active;
    
      +    dump_execution_state();
      +
           for_each_domain( d )
               domain_unpause_by_systemcontroller(d);
    
    failed with:
    
      (XEN) *** Serial input to DOM0 (type 'CTRL-a' three times to switch input)
      (XEN) CPU0: Unexpected Trap: Undefined Instruction
      (XEN) ----[ Xen-4.20-rc  arm32  debug=n  Not tainted ]----
      (XEN) CPU:    0
      <snip>
      (XEN)
      (XEN) ****************************************
      (XEN) Panic on CPU 0:
      (XEN) CPU0: Unexpected Trap: Undefined Instruction
      (XEN) ****************************************
    
    This is because the condition for init text is wrong.  While there's nothing
    interesting from that point onwards in start_xen(), it's also wrong for
    livepatches too.
    
    Use is_active_kernel_text() which is the correct test for this purpose, and is
    aware of init and livepatch regions as well as their lifetimes.
    
    Fixes: 3e802c6ca1fb ("xen/arm: Correctly support WARN_ON")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/arm/arm32/traps.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/arm/arm32/traps.c b/xen/arch/arm/arm32/traps.c
index a2fc1c22cb..b88d41811b 100644
--- a/xen/arch/arm/arm32/traps.c
+++ b/xen/arch/arm/arm32/traps.c
@@ -36,8 +36,7 @@ void do_trap_undefined_instruction(struct cpu_user_regs *regs)
     uint32_t pc = regs->pc;
     uint32_t instr;
 
-    if ( !is_kernel_text(pc) &&
-         (system_state >= SYS_STATE_active || !is_kernel_inittext(pc)) )
+    if ( !is_active_kernel_text(pc) )
         goto die;
 
     /* PC should be always a multiple of 4, as Xen is using ARM instruction set */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:33:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890362.1299345 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0J8-0005Sf-Ud; Mon, 17 Feb 2025 12:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890362.1299345; Mon, 17 Feb 2025 12:33: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 1tk0J8-0005SX-S0; Mon, 17 Feb 2025 12:33:06 +0000
Received: by outflank-mailman (input) for mailman id 890362;
 Mon, 17 Feb 2025 12:33: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 1tk0J7-0005SR-4Y
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:33: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 1tk0J7-006oYa-08
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0J6-00BIK8-2B
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:33: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=NpV6bVM13kIZCjNNcn/UU3yIr96Gg/WhT2LUcTKvVJo=; b=f56eSvRHYiyWYGQ8jTMVEXWsLF
	IIbZOOm3rVkR8r9AlGGaR0YAW3bB9BtQ/XAHdMOlUkci1Qu3npPsh2HP2ACzgseFDluXUwYZUchvH
	u4MeqKgimtxVrqmCtMakIoF+8et5xy4GVWrvPbmrv3obpvn1CQBBXI034yDdTdJOduW4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/HVM: reduce recursion in linear_{read,write}()
Message-Id: <E1tk0J6-00BIK8-2B@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:33:04 +0000

commit 41d38d270e18ded067b1800b76c2e0e16844d233
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:17:45 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:17:45 2025 +0100

    x86/HVM: reduce recursion in linear_{read,write}()
    
    Let's make explicit what the compiler may or may not do on our behalf:
    The 2nd of the recursive invocations each can fall through rather than
    re-invoking the function. This will save us from adding yet another
    parameter (or more) to the function, just for the recursive invocations.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 18053054b7583810dd356efc8d7018bbc8720f36
    master date: 2024-09-09 13:40:47 +0200
---
 xen/arch/x86/hvm/emulate.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 02e378365b..9e62b2f184 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1147,7 +1147,7 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned int offset = addr & ~PAGE_MASK;
-    int rc = HVMTRANS_bad_gfn_to_mfn;
+    int rc;
 
     if ( offset + bytes > PAGE_SIZE )
     {
@@ -1155,12 +1155,16 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
 
         /* Split the access at the page boundary. */
         rc = linear_read(addr, part1, p_data, pfec, hvmemul_ctxt);
-        if ( rc == X86EMUL_OKAY )
-            rc = linear_read(addr + part1, bytes - part1, p_data + part1,
-                             pfec, hvmemul_ctxt);
-        return rc;
+        if ( rc != X86EMUL_OKAY )
+            return rc;
+
+        addr += part1;
+        bytes -= part1;
+        p_data += part1;
     }
 
+    rc = HVMTRANS_bad_gfn_to_mfn;
+
     /*
      * If there is an MMIO cache entry for the access then we must be re-issuing
      * an access that was previously handled as MMIO. Thus it is imperative that
@@ -1202,7 +1206,7 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned int offset = addr & ~PAGE_MASK;
-    int rc = HVMTRANS_bad_gfn_to_mfn;
+    int rc;
 
     if ( offset + bytes > PAGE_SIZE )
     {
@@ -1210,12 +1214,16 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 
         /* Split the access at the page boundary. */
         rc = linear_write(addr, part1, p_data, pfec, hvmemul_ctxt);
-        if ( rc == X86EMUL_OKAY )
-            rc = linear_write(addr + part1, bytes - part1, p_data + part1,
-                              pfec, hvmemul_ctxt);
-        return rc;
+        if ( rc != X86EMUL_OKAY )
+            return rc;
+
+        addr += part1;
+        bytes -= part1;
+        p_data += part1;
     }
 
+    rc = HVMTRANS_bad_gfn_to_mfn;
+
     /*
      * If there is an MMIO cache entry for the access then we must be re-issuing
      * an access that was previously handled as MMIO. Thus it is imperative that
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:33:16 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890363.1299349 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0JI-0005UJ-02; Mon, 17 Feb 2025 12:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890363.1299349; Mon, 17 Feb 2025 12:33: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 1tk0JH-0005UD-TQ; Mon, 17 Feb 2025 12:33:15 +0000
Received: by outflank-mailman (input) for mailman id 890363;
 Mon, 17 Feb 2025 12:33: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 1tk0JG-0005U1-WF
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0JH-006oYx-0R
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0JG-00BIM9-2n
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:33: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=xzweEy+zp+82fyiJajoElG9F4nUkZzSw1kdaw+CIzUQ=; b=VvGEtISq8zcUvUfnQ9rlO1W0Pw
	nb3YsjIU663+6lGt8HdLzp5JYhaBDmjt5kbxzB4uwL3rcDAP/NKlbAQ8FbzwxJ5Soxah89ETqYlkP
	CF0JWNo4pSM/4vGqJ0zN1QGPwiCaedfvYKBQVyuXlUEJ0MYLBMibBEmv0racfmtOBD1A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/HVM: correct MMIO emulation cache bounds check
Message-Id: <E1tk0JG-00BIM9-2n@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:33:14 +0000

commit 15f83e27444768c60671d7b8c3fdc597c4fca563
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:18:15 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:18:15 2025 +0100

    x86/HVM: correct MMIO emulation cache bounds check
    
    To avoid overrunning the internal buffer we need to take the offset into
    the buffer into account.
    
    Fixes: d95da91fb497 ("x86/HVM: grow MMIO cache data size to 64 bytes")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: e5339bb689dfa79a914c6c96e1d82d61e1ae3161
    master date: 2025-01-23 11:14:48 +0100
---
 xen/arch/x86/hvm/emulate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 9e62b2f184..10737533ba 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -936,7 +936,7 @@ static int hvmemul_phys_mmio_access(
     }
 
     /* Accesses must not overflow the cache's buffer. */
-    if ( size > sizeof(cache->buffer) )
+    if ( offset + size > sizeof(cache->buffer) )
     {
         ASSERT_UNREACHABLE();
         return X86EMUL_UNHANDLEABLE;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:33:26 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:33:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890364.1299353 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0JS-0005Wq-1J; Mon, 17 Feb 2025 12:33:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890364.1299353; Mon, 17 Feb 2025 12:33: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 1tk0JR-0005Wh-Ur; Mon, 17 Feb 2025 12:33:25 +0000
Received: by outflank-mailman (input) for mailman id 890364;
 Mon, 17 Feb 2025 12:33: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 1tk0JR-0005WX-14
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:33: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 1tk0JR-006oZ2-0l
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0JQ-00BIOS-36
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:33: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=7mD31j+OiiGhgbNefA32Ni4H0VBDnzSdvXnk7xXEN3M=; b=LAxQCI0GKA3SmSTt6Ap86A4kH9
	13zwSi47SuEXkr3zz54QMaJlIIiGHXGGM9kWaX55Ys7Y8ajZ9vFM4VQQtSqtuupVy0OYb5B7//aJV
	OXA5NIZO04jK4Ufzo9GwMlxw5tYCkUSiNcSHkBihJW9yKaBePrsaVC3Q2nC+Qg4DT1wU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/HVM: allocate emulation cache entries dynamically
Message-Id: <E1tk0JQ-00BIOS-36@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:33:24 +0000

commit dcac022fd932a844d1d9a22fe231cef939921945
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:19:04 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:19:04 2025 +0100

    x86/HVM: allocate emulation cache entries dynamically
    
    Both caches may need higher capacity, and the upper bound will need to
    be determined dynamically based on CPUID policy (for AMX'es TILELOAD /
    TILESTORE at least).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 23d60dbb0493b2f9ec1d89be5341eec2ee9dab32
    master date: 2025-01-24 10:15:29 +0100
---
 xen/arch/x86/hvm/emulate.c             | 51 ++++++++++++++++++++++++++--------
 xen/arch/x86/include/asm/hvm/emulate.h |  4 +++
 xen/arch/x86/include/asm/hvm/vcpu.h    | 13 +--------
 3 files changed, 44 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 10737533ba..5c84aff1dc 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -26,6 +26,18 @@
 #include <asm/iocap.h>
 #include <asm/vm_event.h>
 
+/*
+ * We may read or write up to m512 or up to a tile row as a number of
+ * device-model transactions.
+ */
+struct hvm_mmio_cache {
+    unsigned long gla;
+    unsigned int size;     /* Amount of buffer[] actually used. */
+    unsigned int space:31; /* Allocated size of buffer[]. */
+    unsigned int dir:1;
+    uint8_t buffer[] __aligned(sizeof(long));
+};
+
 struct hvmemul_cache
 {
     /* The cache is disabled as long as num_ents > max_ents. */
@@ -936,7 +948,7 @@ static int hvmemul_phys_mmio_access(
     }
 
     /* Accesses must not overflow the cache's buffer. */
-    if ( offset + size > sizeof(cache->buffer) )
+    if ( offset + size > cache->space )
     {
         ASSERT_UNREACHABLE();
         return X86EMUL_UNHANDLEABLE;
@@ -1012,7 +1024,7 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
 
     for ( i = 0; i < hvio->mmio_cache_count; i ++ )
     {
-        cache = &hvio->mmio_cache[i];
+        cache = hvio->mmio_cache[i];
 
         if ( gla == cache->gla &&
              dir == cache->dir )
@@ -1028,10 +1040,11 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
 
     ++hvio->mmio_cache_count;
 
-    cache = &hvio->mmio_cache[i];
-    memset(cache, 0, sizeof (*cache));
+    cache = hvio->mmio_cache[i];
+    memset(cache->buffer, 0, cache->space);
 
     cache->gla = gla;
+    cache->size = 0;
     cache->dir = dir;
 
     return cache;
@@ -2977,16 +2990,21 @@ void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
 int hvmemul_cache_init(struct vcpu *v)
 {
     /*
-     * No insn can access more than 16 independent linear addresses (AVX512F
-     * scatters/gathers being the worst). Each such linear range can span a
-     * page boundary, i.e. may require two page walks. Account for each insn
-     * byte individually, for simplicity.
+     * AVX512F scatter/gather insns can access up to 16 independent linear
+     * addresses, up to 8 bytes size. Each such linear range can span a page
+     * boundary, i.e. may require two page walks.
+     */
+    unsigned int nents = 16 * 2 * (CONFIG_PAGING_LEVELS + 1);
+    unsigned int i, max_bytes = 64;
+    struct hvmemul_cache *cache;
+
+    /*
+     * Account for each insn byte individually, both for simplicity and to
+     * leave some slack space.
      */
-    const unsigned int nents = (CONFIG_PAGING_LEVELS + 1) *
-                               (MAX_INST_LEN + 16 * 2);
-    struct hvmemul_cache *cache = xmalloc_flex_struct(struct hvmemul_cache,
-                                                      ents, nents);
+    nents += MAX_INST_LEN * (CONFIG_PAGING_LEVELS + 1);
 
+    cache = xmalloc_flex_struct(struct hvmemul_cache, ents, nents);
     if ( !cache )
         return -ENOMEM;
 
@@ -2996,6 +3014,15 @@ int hvmemul_cache_init(struct vcpu *v)
 
     v->arch.hvm.hvm_io.cache = cache;
 
+    for ( i = 0; i < ARRAY_SIZE(v->arch.hvm.hvm_io.mmio_cache); ++i )
+    {
+        v->arch.hvm.hvm_io.mmio_cache[i] =
+            xmalloc_flex_struct(struct hvm_mmio_cache, buffer, max_bytes);
+        if ( !v->arch.hvm.hvm_io.mmio_cache[i] )
+            return -ENOMEM;
+        v->arch.hvm.hvm_io.mmio_cache[i]->space = max_bytes;
+    }
+
     return 0;
 }
 
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index 29d679442e..2e1eedefa7 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -119,6 +119,10 @@ int hvmemul_do_pio_buffer(uint16_t port,
 int __must_check hvmemul_cache_init(struct vcpu *v);
 static inline void hvmemul_cache_destroy(struct vcpu *v)
 {
+    unsigned int i;
+
+    for ( i = 0; i < ARRAY_SIZE(v->arch.hvm.hvm_io.mmio_cache); ++i )
+        XFREE(v->arch.hvm.hvm_io.mmio_cache[i]);
     XFREE(v->arch.hvm.hvm_io.cache);
 }
 bool hvmemul_read_cache(const struct vcpu *v, paddr_t gpa,
diff --git a/xen/arch/x86/include/asm/hvm/vcpu.h b/xen/arch/x86/include/asm/hvm/vcpu.h
index 64c7a6fede..ddf9f8b831 100644
--- a/xen/arch/x86/include/asm/hvm/vcpu.h
+++ b/xen/arch/x86/include/asm/hvm/vcpu.h
@@ -22,17 +22,6 @@ struct hvm_vcpu_asid {
     uint32_t asid;
 };
 
-/*
- * We may read or write up to m512 as a number of device-model
- * transactions.
- */
-struct hvm_mmio_cache {
-    unsigned long gla;
-    unsigned int size;
-    uint8_t dir;
-    uint8_t buffer[64] __aligned(sizeof(long));
-};
-
 struct hvm_vcpu_io {
     /*
      * HVM emulation:
@@ -48,7 +37,7 @@ struct hvm_vcpu_io {
      * We may need to handle up to 3 distinct memory accesses per
      * instruction.
      */
-    struct hvm_mmio_cache mmio_cache[3];
+    struct hvm_mmio_cache *mmio_cache[3];
     unsigned int mmio_cache_count;
 
     /* For retries we shouldn't re-fetch the instruction. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:33:37 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:33:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890365.1299357 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Jd-0005Za-2g; Mon, 17 Feb 2025 12:33:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890365.1299357; Mon, 17 Feb 2025 12:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Jd-0005ZS-06; Mon, 17 Feb 2025 12:33:37 +0000
Received: by outflank-mailman (input) for mailman id 890365;
 Mon, 17 Feb 2025 12:33: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 1tk0Jb-0005ZD-5P
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:33: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 1tk0Jb-006oZ7-1C
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Jb-00BIQY-0B
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:33: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=Ekma8v6FOEu7Jm6xeDh9CbtbYk1LblrhWuXrJlXxxLA=; b=WRHQYKCLD7LV2e2spmfajSL3My
	httDvX9ASTnWa7KH5JpmizNY9UChTBddoBoYqtlYjx/yE799Rzs2Hy1ucrh7lES6a63h4Ix3NdLv+
	5dPb4aGvZhU/r0xBG82KRIdOcGRRF+6FI27urjQjC0HTJyKusVtHWkc/D4ArkP9BW1uU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/HVM: correct read/write split at page boundaries
Message-Id: <E1tk0Jb-00BIQY-0B@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:33:35 +0000

commit e990bf3de5fafd1414c0091c1066ce1463b01c1d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:19:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:19:51 2025 +0100

    x86/HVM: correct read/write split at page boundaries
    
    The MMIO cache is intended to have one entry used per independent memory
    access that an insn does. This, in particular, is supposed to be
    ignoring any page boundary crossing. Therefore when looking up a cache
    entry, the access'es starting (linear) address is relevant, not the one
    possibly advanced past a page boundary.
    
    In order for the same offset-into-buffer variable to be usable in
    hvmemul_phys_mmio_access() for both the caller's buffer and the cache
    entry's it is further necessary to have the un-adjusted caller buffer
    passed into there.
    
    Fixes: 2d527ba310dc ("x86/hvm: split all linear reads and writes at page boundary")
    Reported-by: Manuel Andreas <manuel.andreas@tum.de>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 672894a11fe06e664a0ebfb600baf5dbb897b9e4
    master date: 2025-01-24 10:15:56 +0100
---
 xen/arch/x86/hvm/emulate.c | 92 ++++++++++++++++++++++++++++++----------------
 1 file changed, 61 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 5c84aff1dc..fb4de6ee0a 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -31,8 +31,9 @@
  * device-model transactions.
  */
 struct hvm_mmio_cache {
-    unsigned long gla;
-    unsigned int size;     /* Amount of buffer[] actually used. */
+    unsigned long gla;     /* Start of original access (e.g. insn operand). */
+    unsigned int skip;     /* Offset to start of MMIO */
+    unsigned int size;     /* Amount of buffer[] actually used, incl @skip. */
     unsigned int space:31; /* Allocated size of buffer[]. */
     unsigned int dir:1;
     uint8_t buffer[] __aligned(sizeof(long));
@@ -954,6 +955,13 @@ static int hvmemul_phys_mmio_access(
         return X86EMUL_UNHANDLEABLE;
     }
 
+    /* Accesses must not be to the unused leading space. */
+    if ( offset < cache->skip )
+    {
+        ASSERT_UNREACHABLE();
+        return X86EMUL_UNHANDLEABLE;
+    }
+
     /*
      * hvmemul_do_io() cannot handle non-power-of-2 accesses or
      * accesses larger than sizeof(long), so choose the highest power
@@ -1011,13 +1019,15 @@ static int hvmemul_phys_mmio_access(
 
 /*
  * Multi-cycle MMIO handling is based upon the assumption that emulation
- * of the same instruction will not access the same MMIO region more
- * than once. Hence we can deal with re-emulation (for secondary or
- * subsequent cycles) by looking up the result or previous I/O in a
- * cache indexed by linear MMIO address.
+ * of the same instruction will not access the exact same MMIO region
+ * more than once in exactly the same way (if it does, the accesses will
+ * be "folded"). Hence we can deal with re-emulation (for secondary or
+ * subsequent cycles) by looking up the result of previous I/O in a cache
+ * indexed by linear address and access type.
  */
 static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
-    struct hvm_vcpu_io *hvio, unsigned long gla, uint8_t dir, bool create)
+    struct hvm_vcpu_io *hvio, unsigned long gla, uint8_t dir,
+    unsigned int skip)
 {
     unsigned int i;
     struct hvm_mmio_cache *cache;
@@ -1031,7 +1041,11 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
             return cache;
     }
 
-    if ( !create )
+    /*
+     * Bail if a new entry shouldn't be allocated, relying on ->space having
+     * the same value for all entries.
+     */
+    if ( skip >= hvio->mmio_cache[0]->space )
         return NULL;
 
     i = hvio->mmio_cache_count;
@@ -1044,7 +1058,8 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
     memset(cache->buffer, 0, cache->space);
 
     cache->gla = gla;
-    cache->size = 0;
+    cache->skip = skip;
+    cache->size = skip;
     cache->dir = dir;
 
     return cache;
@@ -1065,12 +1080,14 @@ static void latch_linear_to_phys(struct hvm_vcpu_io *hvio, unsigned long gla,
 
 static int hvmemul_linear_mmio_access(
     unsigned long gla, unsigned int size, uint8_t dir, void *buffer,
-    uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt, bool known_gpfn)
+    uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt,
+    unsigned long start_gla, bool known_gpfn)
 {
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned long offset = gla & ~PAGE_MASK;
-    struct hvm_mmio_cache *cache = hvmemul_find_mmio_cache(hvio, gla, dir, true);
-    unsigned int chunk, buffer_offset = 0;
+    unsigned int chunk, buffer_offset = gla - start_gla;
+    struct hvm_mmio_cache *cache = hvmemul_find_mmio_cache(hvio, start_gla,
+                                                           dir, buffer_offset);
     paddr_t gpa;
     unsigned long one_rep = 1;
     int rc;
@@ -1118,19 +1135,19 @@ static int hvmemul_linear_mmio_access(
 static inline int hvmemul_linear_mmio_read(
     unsigned long gla, unsigned int size, void *buffer,
     uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt,
-    bool translate)
+    unsigned long start_gla, bool translate)
 {
-    return hvmemul_linear_mmio_access(gla, size, IOREQ_READ, buffer,
-                                      pfec, hvmemul_ctxt, translate);
+    return hvmemul_linear_mmio_access(gla, size, IOREQ_READ, buffer, pfec,
+                                      hvmemul_ctxt, start_gla, translate);
 }
 
 static inline int hvmemul_linear_mmio_write(
     unsigned long gla, unsigned int size, void *buffer,
     uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt,
-    bool translate)
+    unsigned long start_gla, bool translate)
 {
-    return hvmemul_linear_mmio_access(gla, size, IOREQ_WRITE, buffer,
-                                      pfec, hvmemul_ctxt, translate);
+    return hvmemul_linear_mmio_access(gla, size, IOREQ_WRITE, buffer, pfec,
+                                      hvmemul_ctxt, start_gla, translate);
 }
 
 static bool known_gla(unsigned long addr, unsigned int bytes, uint32_t pfec)
@@ -1159,7 +1176,10 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
 {
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
+    void *buffer = p_data;
+    unsigned long start = addr;
     unsigned int offset = addr & ~PAGE_MASK;
+    const struct hvm_mmio_cache *cache;
     int rc;
 
     if ( offset + bytes > PAGE_SIZE )
@@ -1183,8 +1203,17 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
      * an access that was previously handled as MMIO. Thus it is imperative that
      * we handle this access in the same way to guarantee completion and hence
      * clean up any interim state.
+     *
+     * Care must be taken, however, to correctly deal with crossing RAM/MMIO or
+     * MMIO/RAM boundaries. While we want to use a single cache entry (tagged
+     * by the starting linear address), we need to continue issuing (i.e. also
+     * upon replay) the RAM access for anything that's ahead of or past MMIO,
+     * i.e. in RAM.
      */
-    if ( !hvmemul_find_mmio_cache(hvio, addr, IOREQ_READ, false) )
+    cache = hvmemul_find_mmio_cache(hvio, start, IOREQ_READ, ~0);
+    if ( !cache ||
+         addr + bytes <= start + cache->skip ||
+         addr >= start + cache->size )
         rc = hvm_copy_from_guest_linear(p_data, addr, bytes, pfec, &pfinfo);
 
     switch ( rc )
@@ -1200,8 +1229,8 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
         if ( pfec & PFEC_insn_fetch )
             return X86EMUL_UNHANDLEABLE;
 
-        return hvmemul_linear_mmio_read(addr, bytes, p_data, pfec,
-                                        hvmemul_ctxt,
+        return hvmemul_linear_mmio_read(addr, bytes, buffer, pfec,
+                                        hvmemul_ctxt, start,
                                         known_gla(addr, bytes, pfec));
 
     case HVMTRANS_gfn_paged_out:
@@ -1218,7 +1247,10 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 {
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
+    void *buffer = p_data;
+    unsigned long start = addr;
     unsigned int offset = addr & ~PAGE_MASK;
+    const struct hvm_mmio_cache *cache;
     int rc;
 
     if ( offset + bytes > PAGE_SIZE )
@@ -1237,13 +1269,11 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 
     rc = HVMTRANS_bad_gfn_to_mfn;
 
-    /*
-     * If there is an MMIO cache entry for the access then we must be re-issuing
-     * an access that was previously handled as MMIO. Thus it is imperative that
-     * we handle this access in the same way to guarantee completion and hence
-     * clean up any interim state.
-     */
-    if ( !hvmemul_find_mmio_cache(hvio, addr, IOREQ_WRITE, false) )
+    /* See commentary in linear_read(). */
+    cache = hvmemul_find_mmio_cache(hvio, start, IOREQ_WRITE, ~0);
+    if ( !cache ||
+         addr + bytes <= start + cache->skip ||
+         addr >= start + cache->size )
         rc = hvm_copy_to_guest_linear(addr, p_data, bytes, pfec, &pfinfo);
 
     switch ( rc )
@@ -1256,8 +1286,8 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
         return X86EMUL_EXCEPTION;
 
     case HVMTRANS_bad_gfn_to_mfn:
-        return hvmemul_linear_mmio_write(addr, bytes, p_data, pfec,
-                                         hvmemul_ctxt,
+        return hvmemul_linear_mmio_write(addr, bytes, buffer, pfec,
+                                         hvmemul_ctxt, start,
                                          known_gla(addr, bytes, pfec));
 
     case HVMTRANS_gfn_paged_out:
@@ -1644,7 +1674,7 @@ static int cf_check hvmemul_cmpxchg(
     {
         /* 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,
+                                         hvmemul_ctxt, addr,
                                          hvio->mmio_access.write_access &&
                                          hvio->mmio_gla == (addr & PAGE_MASK));
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:33:47 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:33:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890366.1299361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Jn-0005cQ-4g; Mon, 17 Feb 2025 12:33:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890366.1299361; Mon, 17 Feb 2025 12:33:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Jn-0005cI-1g; Mon, 17 Feb 2025 12:33:47 +0000
Received: by outflank-mailman (input) for mailman id 890366;
 Mon, 17 Feb 2025 12:33: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 1tk0Jl-0005c7-9Q
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:33: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 1tk0Jl-006oZD-1b
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:33:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Jl-00BITs-0f
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:33: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=6i5jAo/hSXSLGvEkk3m1BjvMxYkGytHuJugyTFyuBZk=; b=v1dRyWejGfdukZ44Tv3ng+eJAV
	Kg/7h8g8UZoqrLImJblJg9ZQ3F6WNf4kEXQrOmMXrtbaR7H8Sj93EfdDp7eGs7MyDQ8sk1xTKn2kI
	EYykM3NvS6mWCAOPboIQ5Mpj+K2cITrvQwNC+f5w/swKzg3iVK7la9fk0W4RzEUtGBhE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/iommu: check for CMPXCHG16B when enabling IOMMU
Message-Id: <E1tk0Jl-00BITs-0f@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:33:45 +0000

commit 49c3324f3737fbdfdbfeab7a682f3c4665a732ce
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Mon Feb 17 13:20:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:20:14 2025 +0100

    x86/iommu: check for CMPXCHG16B when enabling IOMMU
    
    All hardware with VT-d/AMD-Vi has CMPXCHG16B support. Check this at
    initialisation time, and otherwise refuse to use the IOMMU.
    
    If the local APICs support x2APIC mode the IOMMU support for interrupt
    remapping will be checked earlier using a specific helper.  If no support
    for CX16 is detected by that earlier hook disable the IOMMU at that point
    and prevent further poking for CX16 later in the boot process, which would
    also fail.
    
    There's a possible corner case when running virtualized, and the underlying
    hypervisor exposing an IOMMU but no CMPXCHG16B support.  In which case
    ignoring the IOMMU is fine, albeit the most natural would be for the
    underlying hypervisor to also expose CMPXCHG16B support if an IOMMU is
    available to the VM.
    
    Note this change only introduces the checks, but doesn't remove the now
    stale checks for CX16 support sprinkled in the IOMMU code.  Further changes
    will take care of that.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2636fcdc15c707d5e097770133f0afb69e8d70c9
    master date: 2025-01-27 13:05:11 +0100
---
 xen/drivers/passthrough/amd/iommu_intr.c    | 13 +++++++++++++
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  6 ++++++
 xen/drivers/passthrough/vtd/intremap.c      | 13 +++++++++++++
 xen/drivers/passthrough/vtd/iommu.c         |  7 +++++++
 4 files changed, 39 insertions(+)

diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index 7fc796dec2..f07fd9e3d9 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -649,6 +649,19 @@ bool __init cf_check iov_supports_xt(void)
     if ( !iommu_enable || !iommu_intremap )
         return false;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        AMD_IOMMU_ERROR("no CMPXCHG16B support, disabling IOMMU\n");
+        /*
+         * Disable IOMMU support at once: there's no reason to check for CX16
+         * yet again when attempting to initialize IOMMU DMA remapping
+         * functionality or interrupt remapping without x2APIC support.
+         */
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+        return false;
+    }
+
     if ( amd_iommu_prepare(true) )
         return false;
 
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 73dcc4a2dd..f96f59440b 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -309,6 +309,12 @@ static int __init cf_check iov_detect(void)
     if ( !iommu_enable && !iommu_intremap )
         return 0;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        AMD_IOMMU_ERROR("no CMPXCHG16B support, disabling IOMMU\n");
+        return -ENODEV;
+    }
+
     if ( (init_done ? amd_iommu_init_late()
                     : amd_iommu_init(false)) != 0 )
     {
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index c504852eb8..233db5cb64 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -150,6 +150,19 @@ bool __init cf_check intel_iommu_supports_eim(void)
     if ( !iommu_qinval || !iommu_intremap || list_empty(&acpi_drhd_units) )
         return false;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        printk(XENLOG_ERR VTDPREFIX "no CMPXCHG16B support, disabling IOMMU\n");
+        /*
+         * Disable IOMMU support at once: there's no reason to check for CX16
+         * yet again when attempting to initialize IOMMU DMA remapping
+         * functionality or interrupt remapping without x2APIC support.
+         */
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+        return false;
+    }
+
     /* We MUST have a DRHD unit for each IOAPIC. */
     for ( apic = 0; apic < nr_ioapics; apic++ )
         if ( !ioapic_to_drhd(IO_APIC_ID(apic)) )
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index e13be244c1..ab38bbc8a5 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2630,6 +2630,13 @@ static int __init cf_check vtd_setup(void)
     int ret;
     bool reg_inval_supported = true;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        printk(XENLOG_ERR VTDPREFIX "no CMPXCHG16B support, disabling IOMMU\n");
+        ret = -ENODEV;
+        goto error;
+    }
+
     if ( list_empty(&acpi_drhd_units) )
     {
         ret = -ENODEV;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:33:57 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:33:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890367.1299365 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Jx-0005f4-7F; Mon, 17 Feb 2025 12:33:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890367.1299365; Mon, 17 Feb 2025 12:33:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Jx-0005ew-4e; Mon, 17 Feb 2025 12:33:57 +0000
Received: by outflank-mailman (input) for mailman id 890367;
 Mon, 17 Feb 2025 12:33: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 1tk0Jv-0005em-Cc
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:33: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 1tk0Jv-006oZI-1v
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:33:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Jv-00BIWL-10
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:33: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=ZuBBoj+j4yawjdRvGnEHocJc3Tg8ke6HFS904l2Aa/k=; b=4l3pBrOV3+nOievskNxswzhzgQ
	8xc9i+3m0ZaYjVLbIKYSKDleMWNFIWscGjci0nEqZ9zeVf9BC2KBV7oN/TSFNlKbK9fozZq2ZLlvD
	87xldRic6lM+e6pwnoyNYRQ2Q7E+TNSwP8xazyzFxQIC6ObQ47ZTyr8VqTamDCQxQV7c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] iommu/amd: atomically update IRTE
Message-Id: <E1tk0Jv-00BIWL-10@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:33:55 +0000

commit 457b9e11fa131f3a9f376aed3e00f0d16d6ea7c7
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:20:38 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:20:38 2025 +0100

    iommu/amd: atomically update IRTE
    
    Either when using a 32bit Interrupt Remapping Entry or a 128bit one update
    the entry atomically, by using cmpxchg unconditionally as IOMMU depends on
    it.  No longer disable the entry by setting RemapEn = 0 ahead of updating
    it.  As a consequence of not toggling RemapEn ahead of the update the
    Interrupt Remapping Table needs to be flushed after the entry update.
    
    This avoids a window where the IRTE has RemapEn = 0, which can lead to
    IO_PAGE_FAULT if the underlying interrupt source is not masked.
    
    There's no guidance in AMD-Vi specification about how IRTE update should be
    performed as opposed to DTE updating which has specific guidance.  However
    DTE updating claims that reads will always be at least 128bits in size, and
    hence for the purposes here assume that reads and caching of the IRTE
    entries in either 32 or 128 bit format will be done atomically from
    the IOMMU.
    
    Note that as part of introducing a new raw128 field in the IRTE struct, the
    current raw field is renamed to raw64 to explicitly contain the size in the
    field name.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: b953a99da98d63a7c827248abc450d4e8e015ab6
    master date: 2025-01-27 13:05:11 +0100
---
 xen/drivers/passthrough/amd/iommu_intr.c | 75 ++++++++++++++------------------
 1 file changed, 32 insertions(+), 43 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index f07fd9e3d9..c0273059cb 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -39,7 +39,8 @@ union irte32 {
 };
 
 union irte128 {
-    uint64_t raw[2];
+    uint64_t raw64[2];
+    __uint128_t raw128;
     struct {
         bool remap_en:1;
         bool sup_io_pf:1;
@@ -187,7 +188,7 @@ static void free_intremap_entry(const struct amd_iommu *iommu,
 
     if ( iommu->ctrl.ga_en )
     {
-        ACCESS_ONCE(entry.ptr128->raw[0]) = 0;
+        ACCESS_ONCE(entry.ptr128->raw64[0]) = 0;
         /*
          * Low half (containing RemapEn) needs to be cleared first.  Note that
          * strictly speaking smp_wmb() isn't enough, as conceptually it expands
@@ -197,7 +198,7 @@ static void free_intremap_entry(const struct amd_iommu *iommu,
          * variant will do.
          */
         smp_wmb();
-        entry.ptr128->raw[1] = 0;
+        entry.ptr128->raw64[1] = 0;
     }
     else
         ACCESS_ONCE(entry.ptr32->raw) = 0;
@@ -212,7 +213,7 @@ static void update_intremap_entry(const struct amd_iommu *iommu,
 {
     if ( iommu->ctrl.ga_en )
     {
-        union irte128 irte = {
+        const union irte128 irte = {
             .full = {
                 .remap_en = true,
                 .int_type = int_type,
@@ -222,19 +223,26 @@ static void update_intremap_entry(const struct amd_iommu *iommu,
                 .vector = vector,
             },
         };
+        __uint128_t old = entry.ptr128->raw128;
+        __uint128_t res = cmpxchg16b(&entry.ptr128->raw128, &old,
+                                     &irte.raw128);
 
-        ASSERT(!entry.ptr128->full.remap_en);
-        entry.ptr128->raw[1] = irte.raw[1];
         /*
-         * High half needs to be set before low one (containing RemapEn).  See
-         * comment in free_intremap_entry() regarding the choice of barrier.
+         * Hardware does not update the IRTE behind our backs, so the return
+         * value should match "old".
          */
-        smp_wmb();
-        ACCESS_ONCE(entry.ptr128->raw[0]) = irte.raw[0];
+        if ( res != old )
+        {
+            printk(XENLOG_ERR
+                   "unexpected IRTE %016lx_%016lx (expected %016lx_%016lx)\n",
+                   (uint64_t)(res >> 64), (uint64_t)res,
+                   (uint64_t)(old >> 64), (uint64_t)old);
+            ASSERT_UNREACHABLE();
+        }
     }
     else
     {
-        union irte32 irte = {
+        const union irte32 irte = {
             .flds = {
                 .remap_en = true,
                 .int_type = int_type,
@@ -299,21 +307,13 @@ static int update_intremap_entry_from_ioapic(
 
     entry = get_intremap_entry(iommu, req_id, offset);
 
-    /* The RemapEn fields match for all formats. */
-    while ( iommu->enabled && entry.ptr32->flds.remap_en )
-    {
-        entry.ptr32->flds.remap_en = false;
-        spin_unlock(lock);
-
-        amd_iommu_flush_intremap(iommu, req_id);
-
-        spin_lock(lock);
-    }
-
     update_intremap_entry(iommu, entry, vector, delivery_mode, dest_mode, dest);
 
     spin_unlock_irqrestore(lock, flags);
 
+    if ( !fresh )
+        amd_iommu_flush_intremap(iommu, req_id);
+
     set_rte_index(rte, offset);
 
     return 0;
@@ -322,7 +322,7 @@ static int update_intremap_entry_from_ioapic(
 void cf_check amd_iommu_ioapic_update_ire(
     unsigned int apic, unsigned int pin, uint64_t rte)
 {
-    struct IO_APIC_route_entry old_rte, new_rte;
+    struct IO_APIC_route_entry new_rte;
     int seg, bdf, rc;
     struct amd_iommu *iommu;
     unsigned int idx;
@@ -346,14 +346,6 @@ void cf_check amd_iommu_ioapic_update_ire(
         return;
     }
 
-    old_rte = __ioapic_read_entry(apic, pin, true);
-    /* mask the interrupt while we change the intremap table */
-    if ( !old_rte.mask )
-    {
-        old_rte.mask = 1;
-        __ioapic_write_entry(apic, pin, true, old_rte);
-    }
-
     /* Update interrupt remapping entry */
     rc = update_intremap_entry_from_ioapic(
              bdf, iommu, &new_rte,
@@ -425,6 +417,7 @@ static int update_intremap_entry_from_msi_msg(
     uint8_t delivery_mode, vector, dest_mode;
     spinlock_t *lock;
     unsigned int dest, offset, i;
+    bool fresh = false;
 
     req_id = get_dma_requestor_id(iommu->seg, bdf);
     alias_id = get_intremap_requestor_id(iommu->seg, bdf);
@@ -468,26 +461,21 @@ static int update_intremap_entry_from_msi_msg(
             return -ENOSPC;
         }
         *remap_index = offset;
+        fresh = true;
     }
 
     entry = get_intremap_entry(iommu, req_id, offset);
 
-    /* The RemapEn fields match for all formats. */
-    while ( iommu->enabled && entry.ptr32->flds.remap_en )
-    {
-        entry.ptr32->flds.remap_en = false;
-        spin_unlock(lock);
+    update_intremap_entry(iommu, entry, vector, delivery_mode, dest_mode, dest);
+    spin_unlock_irqrestore(lock, flags);
 
+    if ( !fresh )
+    {
         amd_iommu_flush_intremap(iommu, req_id);
         if ( alias_id != req_id )
             amd_iommu_flush_intremap(iommu, alias_id);
-
-        spin_lock(lock);
     }
 
-    update_intremap_entry(iommu, entry, vector, delivery_mode, dest_mode, dest);
-    spin_unlock_irqrestore(lock, flags);
-
     *data = (msg->data & ~(INTREMAP_MAX_ENTRIES - 1)) | offset;
 
     /*
@@ -735,7 +723,7 @@ static void dump_intremap_table(const struct amd_iommu *iommu,
     for ( count = 0; count < nr; count++ )
     {
         if ( iommu->ctrl.ga_en
-             ? !tbl.ptr128[count].raw[0] && !tbl.ptr128[count].raw[1]
+             ? !tbl.ptr128[count].raw64[0] && !tbl.ptr128[count].raw64[1]
              : !tbl.ptr32[count].raw )
                 continue;
 
@@ -748,7 +736,8 @@ static void dump_intremap_table(const struct amd_iommu *iommu,
 
         if ( iommu->ctrl.ga_en )
             printk("    IRTE[%03x] %016lx_%016lx\n",
-                   count, tbl.ptr128[count].raw[1], tbl.ptr128[count].raw[0]);
+                   count, tbl.ptr128[count].raw64[1],
+                   tbl.ptr128[count].raw64[0]);
         else
             printk("    IRTE[%03x] %08x\n", count, tbl.ptr32[count].raw);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:34:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:34:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890368.1299369 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0K7-0005i9-8p; Mon, 17 Feb 2025 12:34:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890368.1299369; Mon, 17 Feb 2025 12:34:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0K7-0005i1-62; Mon, 17 Feb 2025 12:34:07 +0000
Received: by outflank-mailman (input) for mailman id 890368;
 Mon, 17 Feb 2025 12:34: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 1tk0K5-0005hm-Hb
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:34: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 1tk0K5-006oZp-2Q
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:34:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0K5-00BIaQ-1N
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:34: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=eSBlwToRJ7cIMsGlwo0h9a5fZF8FHe1sHzS3N6Qk0Kw=; b=m8a6HphHOFfo9wlAYnSH75Hbh4
	rtTf70zoYkkZkoqWdOW2rOeR4Y0D4T4Mzauq9fqBUyDHFFJBnCaxa04TUk+VRaFDvomhmRMMRTACX
	qR3tMZn4Um1lU+E5m204O/sb8Cyuc1rZMiL1O2eGjwiYWuf4qbz0dfYpqglMHLG7uD08=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86emul: further correct 64-bit mode zero count repeated string insn handling
Message-Id: <E1tk0K5-00BIaQ-1N@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:34:05 +0000

commit b7b0ce5e11203bb81f99b1f05956cd766f55e802
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:21:00 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:21:00 2025 +0100

    x86emul: further correct 64-bit mode zero count repeated string insn handling
    
    In an entirely different context I came across Linux commit 428e3d08574b
    ("KVM: x86: Fix zero iterations REP-string"), which points out that
    we're still doing things wrong: For one, there's no zero-extension at
    all on AMD. And then while RCX is zero-extended from 32 bits uniformly
    for all string instructions on newer hardware, RSI/RDI are only for MOVS
    and STOS on the systems I have access to. (On an old family 0xf system
    I've further found that for REP LODS even RCX is not zero-extended.)
    
    While touching the lines anyway, replace two casts in get_rep_prefix().
    
    Fixes: 79e996a89f69 ("x86emul: correct 64-bit mode repeated string insn handling with zero count")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 5310a042c4e3135c471446c8253ad13250539957
    master date: 2025-01-27 15:23:19 +0100
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 31475208d1..3d837f7e9e 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -513,7 +513,7 @@ static inline void put_loop_count(
         regs->r(cx) = ad_bytes == 4 ? (uint32_t)count : count;
 }
 
-#define get_rep_prefix(using_si, using_di) ({                           \
+#define get_rep_prefix(extend_si, extend_di) ({                         \
     unsigned long max_reps = 1;                                         \
     if ( rep_prefix() )                                                 \
         max_reps = get_loop_count(&_regs, ad_bytes);                    \
@@ -521,14 +521,14 @@ static inline void put_loop_count(
     {                                                                   \
         /*                                                              \
          * Skip the instruction if no repetitions are required, but     \
-         * zero extend involved registers first when using 32-bit       \
+         * zero extend relevant registers first when using 32-bit       \
          * addressing in 64-bit mode.                                   \
          */                                                             \
-        if ( mode_64bit() && ad_bytes == 4 )                            \
+        if ( !amd_like(ctxt) && mode_64bit() && ad_bytes == 4 )         \
         {                                                               \
             _regs.r(cx) = 0;                                            \
-            if ( using_si ) _regs.r(si) = (uint32_t)_regs.r(si);        \
-            if ( using_di ) _regs.r(di) = (uint32_t)_regs.r(di);        \
+            if ( extend_si ) _regs.r(si) = _regs.esi;                   \
+            if ( extend_di ) _regs.r(di) = _regs.edi;                   \
         }                                                               \
         goto complete_insn;                                             \
     }                                                                   \
@@ -1815,7 +1815,7 @@ x86_emulate(
         dst.bytes = !(b & 1) ? 1 : (op_bytes == 8) ? 4 : op_bytes;
         if ( (rc = ioport_access_check(port, dst.bytes, ctxt, ops)) != 0 )
             goto done;
-        nr_reps = get_rep_prefix(false, true);
+        nr_reps = get_rep_prefix(false, false /* don't extend RSI/RDI */);
         dst.mem.off = truncate_ea_and_reps(_regs.r(di), nr_reps, dst.bytes);
         dst.mem.seg = x86_seg_es;
         /* Try the presumably most efficient approach first. */
@@ -1857,7 +1857,7 @@ x86_emulate(
         dst.bytes = !(b & 1) ? 1 : (op_bytes == 8) ? 4 : op_bytes;
         if ( (rc = ioport_access_check(port, dst.bytes, ctxt, ops)) != 0 )
             goto done;
-        nr_reps = get_rep_prefix(true, false);
+        nr_reps = get_rep_prefix(false, false /* don't extend RSI/RDI */);
         ea.mem.off = truncate_ea_and_reps(_regs.r(si), nr_reps, dst.bytes);
         /* Try the presumably most efficient approach first. */
         if ( !ops->rep_outs )
@@ -2194,7 +2194,7 @@ x86_emulate(
     case 0xa6 ... 0xa7: /* cmps */ {
         unsigned long next_eip = _regs.r(ip);
 
-        get_rep_prefix(true, true);
+        get_rep_prefix(false, false /* don't extend RSI/RDI */);
         src.bytes = dst.bytes = (d & ByteOp) ? 1 : op_bytes;
         if ( (rc = read_ulong(ea.mem.seg, truncate_ea(_regs.r(si)),
                               &dst.val, dst.bytes, ctxt, ops)) ||
@@ -2236,7 +2236,7 @@ x86_emulate(
     }
 
     case 0xac ... 0xad: /* lods */
-        get_rep_prefix(true, false);
+        get_rep_prefix(false, false /* don't extend RSI/RDI */);
         if ( (rc = read_ulong(ea.mem.seg, truncate_ea(_regs.r(si)),
                               &dst.val, dst.bytes, ctxt, ops)) != 0 )
             goto done;
@@ -2247,7 +2247,7 @@ x86_emulate(
     case 0xae ... 0xaf: /* scas */ {
         unsigned long next_eip = _regs.r(ip);
 
-        get_rep_prefix(false, true);
+        get_rep_prefix(false, false /* don't extend RSI/RDI */);
         if ( (rc = read_ulong(x86_seg_es, truncate_ea(_regs.r(di)),
                               &dst.val, src.bytes, ctxt, ops)) != 0 )
             goto done;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:34:17 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:34:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890369.1299373 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0KH-0005kb-A2; Mon, 17 Feb 2025 12:34:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890369.1299373; Mon, 17 Feb 2025 12:34:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0KH-0005kT-7T; Mon, 17 Feb 2025 12:34:17 +0000
Received: by outflank-mailman (input) for mailman id 890369;
 Mon, 17 Feb 2025 12:34: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 1tk0KF-0005kD-KA
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:34:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0KF-006oZt-2g
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:34:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0KF-00BIeW-1q
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:34:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VFz+jKK34EqcvHeszkP/dcyQJvK3WrIwzWDvJgr9TvU=; b=ii2XMDoIY4WIBfMHpnAKwUVm2S
	XXwNCScYcVhuoyxYWhcU7l0oriq3o/2XwFeo8UHntJ1FpenIuW4NLKzHK1DUgnUHL/QRia+BIFTJu
	Ees7iITYRYSCdRJyBOqEVRPaJ8jcVqYhcLwcRANAiQ+VfAQDo56wfeoab/gRh/d7DFnY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/PV: further harden guest memory accesses against speculative abuse
Message-Id: <E1tk0KF-00BIeW-1q@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:34:15 +0000

commit 125270d49dcc42c1249e0fb99abb8d33c9a8b439
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:21:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:21:30 2025 +0100

    x86/PV: further harden guest memory accesses against speculative abuse
    
    The original implementation has two issues: For one it doesn't preserve
    non-canonical-ness of inputs in the range 0x8000000000000000 through
    0x80007fffffffffff. Bogus guest pointers in that range would not cause a
    (#GP) fault upon access, when they should.
    
    And then there is an AMD-specific aspect, where only the low 48 bits of
    an address are used for speculative execution; the architecturally
    mandated #GP for non-canonical addresses would be raised at a later
    execution stage. Therefore to prevent Xen controlled data to make it
    into any of the caches in a guest controllable manner, we need to
    additionally ensure that for non-canonical inputs bit 47 would be clear.
    
    See the code comment for how addressing both is being achieved.
    
    Fixes: 4dc181599142 ("x86/PV: harden guest memory accesses against speculative abuse")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8306d773b03acec6062c0547ac05e3dd4a6960f6
    master date: 2025-01-27 15:23:59 +0100
---
 xen/arch/x86/include/asm/asm-defns.h | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/include/asm/asm-defns.h b/xen/arch/x86/include/asm/asm-defns.h
index d55dd3bbc3..32d6b44910 100644
--- a/xen/arch/x86/include/asm/asm-defns.h
+++ b/xen/arch/x86/include/asm/asm-defns.h
@@ -1,3 +1,5 @@
+#include <asm/page-bits.h>
+
 #ifndef HAVE_AS_CLAC_STAC
 .macro clac
     .byte 0x0f, 0x01, 0xca
@@ -65,17 +67,36 @@
 .macro guest_access_mask_ptr ptr:req, scratch1:req, scratch2:req
 #if defined(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS)
     /*
-     * Here we want
-     *
-     * ptr &= ~0ull >> (ptr < HYPERVISOR_VIRT_END);
-     *
+     * Here we want to adjust \ptr such that
+     * - if it's within Xen range, it becomes non-canonical,
+     * - otherwise if it's (non-)canonical on input, it retains that property,
+     * - if the result is non-canonical, bit 47 is clear (to avoid
+     *   potentially populating the cache with Xen data on AMD-like hardware),
      * but guaranteed without any conditional branches (hence in assembly).
+     *
+     * To achieve this we determine which bit to forcibly clear: Either bit 47
+     * (in case the address is below HYPERVISOR_VIRT_END) or bit 63.  Further
+     * we determine whether for forcably set bit 63: In case we first cleared
+     * it, we'll merely restore the original address.  In case we ended up
+     * clearing bit 47 (i.e. the address was either non-canonical or within Xen
+     * range), setting the bit will yield a guaranteed non-canonical address.
+     * If we didn't clear a bit, we also won't set one: The address was in the
+     * low half of address space in that case with bit 47 already clear.  The
+     * address can thus be left unchanged, whether canonical or not.
      */
     mov $(HYPERVISOR_VIRT_END - 1), \scratch1
-    mov $~0, \scratch2
+    mov $(VADDR_BITS - 1), \scratch2
     cmp \ptr, \scratch1
+    /*
+     * Not needed: The value we have in \scratch1 will be truncated to 6 bits,
+     * thus yielding the value we need.
+    mov $63, \scratch1
+     */
+    cmovnb \scratch2, \scratch1
+    xor \scratch2, \scratch2
+    btr \scratch1, \ptr
     rcr $1, \scratch2
-    and \scratch2, \ptr
+    or \scratch2, \ptr
 #elif defined(CONFIG_DEBUG) && defined(CONFIG_PV)
     xor $~\@, \scratch1
     xor $~\@, \scratch2
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:34:27 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:34:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890370.1299377 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0KR-0005n1-Bd; Mon, 17 Feb 2025 12:34:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890370.1299377; Mon, 17 Feb 2025 12:34:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0KR-0005mt-8x; Mon, 17 Feb 2025 12:34:27 +0000
Received: by outflank-mailman (input) for mailman id 890370;
 Mon, 17 Feb 2025 12:34: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 1tk0KP-0005md-OL
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:34: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 1tk0KP-006oZz-37
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:34:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0KP-00BIhJ-26
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:34:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oDsCpJx7cC3jGwJJ+JFFBIp6XIiwqLT7ItbLyaHLGTg=; b=DddCiSk5hjq2jh2sZO8rl0DxNO
	iafguUqmXk8qIm6e5A0Tnr2fGoD2uPTMSVKAb8cSxHeT2PXKBg7OVQx6CVMGKWw/UUUFgW5AAZ3kA
	1kqMKTKAcMZFy1Hz+fgY4wPTuzHitbHz+Mr5OI7DCmwpOm/vuqAYFT3aKo0CFBtLhRBI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/intel: Fix PERF_GLOBAL fixup when virtualised
Message-Id: <E1tk0KP-00BIhJ-26@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:34:25 +0000

commit c4d4fc58b6f7f10655958e2fb07c702f4fdb0b0b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 17 13:21:50 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:21:50 2025 +0100

    x86/intel: Fix PERF_GLOBAL fixup when virtualised
    
    Logic using performance counters needs to look at
    MSR_MISC_ENABLE.PERF_AVAILABLE before touching any other resources.
    
    When virtualised under ESX, Xen dies with a #GP fault trying to read
    MSR_CORE_PERF_GLOBAL_CTRL.
    
    Factor this logic out into a separate function (it's already too squashed to
    the RHS), and insert a check of MSR_MISC_ENABLE.PERF_AVAILABLE.
    
    This also avoids setting X86_FEATURE_ARCH_PERFMON if MSR_MISC_ENABLE says that
    PERF is unavailable, although oprofile (the only consumer of this flag)
    cross-checks too.
    
    Fixes: 6bdb965178bb ("x86/intel: ensure Global Performance Counter Control is setup correctly")
    Reported-by: Jonathan Katz <jonathan.katz@aptar.com>
    Link: https://xcp-ng.org/forum/topic/10286/nesting-xcp-ng-on-esx-8
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Tested-by: Jonathan Katz <jonathan.katz@aptar.com>
    master commit: dd05d265b8abda4cc7206b29cd71b77fb46658bf
    master date: 2025-01-28 11:19:45 +0000
---
 xen/arch/x86/cpu/intel.c | 64 ++++++++++++++++++++++++++++--------------------
 1 file changed, 37 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index af56e57bd8..bb9c6220de 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -535,39 +535,49 @@ static void intel_log_freq(const struct cpuinfo_x86 *c)
     printk("%u MHz\n", (factor * max_ratio + 50) / 100);
 }
 
+static void init_intel_perf(struct cpuinfo_x86 *c)
+{
+    uint64_t val;
+    unsigned int eax, ver, nr_cnt;
+
+    if ( c->cpuid_level <= 9 ||
+         ({  rdmsrl(MSR_IA32_MISC_ENABLE, val);
+             !(val & MSR_IA32_MISC_ENABLE_PERF_AVAIL); }) )
+        return;
+
+    eax = cpuid_eax(10);
+    ver = eax & 0xff;
+    nr_cnt = (eax >> 8) & 0xff;
+
+    if ( ver && nr_cnt > 1 && nr_cnt <= 32 )
+    {
+        unsigned int cnt_mask = (1UL << nr_cnt) - 1;
+
+        /*
+         * On (some?) Sapphire/Emerald Rapids platforms each package-BSP
+         * starts with all the enable bits for the general-purpose PMCs
+         * cleared.  Adjust so counters can be enabled from EVNTSEL.
+         */
+        rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, val);
+
+        if ( (val & cnt_mask) != cnt_mask )
+        {
+            printk("FIRMWARE BUG: CPU%u invalid PERF_GLOBAL_CTRL: %#"PRIx64" adjusting to %#"PRIx64"\n",
+                   smp_processor_id(), val, val | cnt_mask);
+            wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, val | cnt_mask);
+        }
+
+        __set_bit(X86_FEATURE_ARCH_PERFMON, c->x86_capability);
+    }
+}
+
 static void cf_check init_intel(struct cpuinfo_x86 *c)
 {
 	/* Detect the extended topology information if available */
 	detect_extended_topology(c);
 
 	init_intel_cacheinfo(c);
-	if (c->cpuid_level > 9) {
-		unsigned eax = cpuid_eax(10);
-		unsigned int cnt = (eax >> 8) & 0xff;
-
-		/* Check for version and the number of counters */
-		if ((eax & 0xff) && (cnt > 1) && (cnt <= 32)) {
-			uint64_t global_ctrl;
-			unsigned int cnt_mask = (1UL << cnt) - 1;
-
-			/*
-			 * On (some?) Sapphire/Emerald Rapids platforms each
-			 * package-BSP starts with all the enable bits for the
-			 * general-purpose PMCs cleared.  Adjust so counters
-			 * can be enabled from EVNTSEL.
-			 */
-			rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, global_ctrl);
-			if ((global_ctrl & cnt_mask) != cnt_mask) {
-				printk("CPU%u: invalid PERF_GLOBAL_CTRL: %#"
-				       PRIx64 " adjusting to %#" PRIx64 "\n",
-				       smp_processor_id(), global_ctrl,
-				       global_ctrl | cnt_mask);
-				wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL,
-				       global_ctrl | cnt_mask);
-			}
-			__set_bit(X86_FEATURE_ARCH_PERFMON, c->x86_capability);
-		}
-	}
+	init_intel_perf(c);
 
 	if ( !cpu_has(c, X86_FEATURE_XTOPOLOGY) )
 	{
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:34:37 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:34:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890371.1299380 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Kb-0005pY-DR; Mon, 17 Feb 2025 12:34:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890371.1299380; Mon, 17 Feb 2025 12:34:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Kb-0005pR-AM; Mon, 17 Feb 2025 12:34:37 +0000
Received: by outflank-mailman (input) for mailman id 890371;
 Mon, 17 Feb 2025 12:34: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 1tk0KZ-0005pD-RN
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:34: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 1tk0Ka-006oa5-0A
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:34:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0KZ-00BIja-2X
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:34: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=rW5cBcoBjTRWnPS2xHXhpNDWt2ujhzVxCJcbriT3i+c=; b=SigFelKQgENDwa74nnHwdNEazQ
	OCMbKFvZAHQiyPfNwvZeq+NhOz5uFJEooNRmXJrhHZ24VO4ykwd7yiw5H39Yb5UFYUoy0iZ2gRcBv
	4FdXtt8uLBov/q2X1rg9sp0Mx9rImL/X6zxFXcreHjvl/pMSad7ZQyfOqNXv4mNtgE4o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] radix-tree: purge node allocation override hooks
Message-Id: <E1tk0KZ-00BIja-2X@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:34:35 +0000

commit ebc8b4a4508a0b84c3f3b31324f688dabb210093
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:22:24 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:22:24 2025 +0100

    radix-tree: purge node allocation override hooks
    
    These were needed by TMEM only, which is long gone. The Linux original
    doesn't have such either. This effectively reverts one of the "Other
    changes" from 8dc6738dbb3c ("Update radix-tree.[ch] from upstream Linux
    to gain RCU awareness").
    
    Positive side effect: Two cf_check go away.
    
    While there also convert xmalloc()+memset() to xzalloc().
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 1275093a96fed45057db241b3aa6e191d9dcf596
    master date: 2025-02-07 09:59:11 +0100
---
 xen/common/radix-tree.c      | 37 ++++++-------------------------------
 xen/include/xen/radix-tree.h | 10 ----------
 2 files changed, 6 insertions(+), 41 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index adc3034222..994a5a3b3d 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -52,12 +52,6 @@ struct rcu_node {
 	struct rcu_head rcu_head;
 };
 
-static struct radix_tree_node *cf_check rcu_node_alloc(void *arg)
-{
-	struct rcu_node *rcu_node = xmalloc(struct rcu_node);
-	return rcu_node ? &rcu_node->node : NULL;
-}
-
 static void cf_check _rcu_node_free(struct rcu_head *head)
 {
 	struct rcu_node *rcu_node =
@@ -65,26 +59,20 @@ static void cf_check _rcu_node_free(struct rcu_head *head)
 	xfree(rcu_node);
 }
 
-static void cf_check rcu_node_free(struct radix_tree_node *node, void *arg)
-{
-	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
-	call_rcu(&rcu_node->rcu_head, _rcu_node_free);
-}
-
 static struct radix_tree_node *radix_tree_node_alloc(
 	struct radix_tree_root *root)
 {
-	struct radix_tree_node *ret;
-	ret = root->node_alloc(root->node_alloc_free_arg);
-	if (ret)
-		memset(ret, 0, sizeof(*ret));
-	return ret;
+	struct rcu_node *rcu_node = xzalloc(struct rcu_node);
+
+	return rcu_node ? &rcu_node->node : NULL;
 }
 
 static void radix_tree_node_free(
 	struct radix_tree_root *root, struct radix_tree_node *node)
 {
-	root->node_free(node, root->node_alloc_free_arg);
+	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
+
+	call_rcu(&rcu_node->rcu_head, _rcu_node_free);
 }
 
 /*
@@ -717,19 +705,6 @@ void radix_tree_destroy(
 void radix_tree_init(struct radix_tree_root *root)
 {
 	memset(root, 0, sizeof(*root));
-	root->node_alloc = rcu_node_alloc;
-	root->node_free = rcu_node_free;
-}
-
-void radix_tree_set_alloc_callbacks(
-	struct radix_tree_root *root,
-	radix_tree_alloc_fn_t *node_alloc,
-	radix_tree_free_fn_t *node_free,
-	void *node_alloc_free_arg)
-{
-	root->node_alloc = node_alloc;
-	root->node_free = node_free;
-	root->node_alloc_free_arg = node_alloc_free_arg;
 }
 
 static __init unsigned long __maxindex(unsigned int height)
diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 58c40312e6..9d5ffae3eb 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -66,11 +66,6 @@ typedef void radix_tree_free_fn_t(struct radix_tree_node *, void *);
 struct radix_tree_root {
 	unsigned int		height;
 	struct radix_tree_node	__rcu *rnode;
-
-	/* Allow to specify custom node alloc/dealloc routines. */
-	radix_tree_alloc_fn_t *node_alloc;
-	radix_tree_free_fn_t *node_free;
-	void *node_alloc_free_arg;
 };
 
 /*
@@ -78,11 +73,6 @@ struct radix_tree_root {
  */
 
 void radix_tree_init(struct radix_tree_root *root);
-void radix_tree_set_alloc_callbacks(
-	struct radix_tree_root *root,
-	radix_tree_alloc_fn_t *node_alloc,
-	radix_tree_free_fn_t *node_free,
-	void *node_alloc_free_arg);
 
 void radix_tree_destroy(
 	struct radix_tree_root *root,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:34:47 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:34:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890372.1299385 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Kl-0005sh-G4; Mon, 17 Feb 2025 12:34:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890372.1299385; Mon, 17 Feb 2025 12:34:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Kl-0005sY-DZ; Mon, 17 Feb 2025 12:34:47 +0000
Received: by outflank-mailman (input) for mailman id 890372;
 Mon, 17 Feb 2025 12:34:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tk0Kj-0005sL-Us
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:34: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 1tk0Kk-006oa9-0W
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:34:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Kj-00BIlC-2p
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:34: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=ubEDeGFFYm29sTwW7cLdS2HMeFRS/3kU345fpxDqbl8=; b=FEujVph3HQP9FNUu+1OdQrN17D
	SMX/7j60b+np4dOnUz1ACxZez54+vf9Sgmyy2oP+h7T/pA08ANLdig+JJXH0fQfN5NWmK6+1ptNFj
	y0VbWtRQTMOZWsa5zfmtWAsU26Lm9Jcwg1Ikebyt0VyV6T8et5QM+I8Ow+XSqyVNFbmM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] radix-tree: introduce RADIX_TREE{,_INIT}()
Message-Id: <E1tk0Kj-00BIlC-2p@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:34:45 +0000

commit 46e3e9d7398303a12714cacf1e56c6da505cffec
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:23:00 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:23:00 2025 +0100

    radix-tree: introduce RADIX_TREE{,_INIT}()
    
    ... now that static initialization is possible. Use RADIX_TREE() for
    pci_segments and ivrs_maps.
    
    This then fixes an ordering issue on x86: With the call to
    radix_tree_init(), acpi_mmcfg_init()'s invocation of pci_segments_init()
    will zap the possible earlier introduction of segment 0 by
    amd_iommu_detect_one_acpi()'s call to pci_ro_device(), and thus the
    write-protection of the PCI devices representing AMD IOMMUs.
    
    Fixes: 3950f2485bbc ("x86/x2APIC: defer probe until after IOMMU ACPI table parsing")
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 26fe09e34566d701ecaea76b4563bb9934e85861
    master date: 2025-02-07 10:00:04 +0100
---
 xen/common/radix-tree.c                  | 2 +-
 xen/drivers/passthrough/amd/iommu_init.c | 3 +--
 xen/drivers/passthrough/pci.c            | 3 +--
 xen/include/xen/radix-tree.h             | 3 +++
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index 994a5a3b3d..ac4bfbd3f4 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -704,7 +704,7 @@ void radix_tree_destroy(
 
 void radix_tree_init(struct radix_tree_root *root)
 {
-	memset(root, 0, sizeof(*root));
+	*root = (struct radix_tree_root)RADIX_TREE_INIT();
 }
 
 static __init unsigned long __maxindex(unsigned int height)
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 6c0dc2d5cb..b546c28667 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -31,7 +31,7 @@ static struct tasklet amd_iommu_irq_tasklet;
 unsigned int __read_mostly amd_iommu_acpi_info;
 unsigned int __read_mostly ivrs_bdf_entries;
 u8 __read_mostly ivhd_type;
-static struct radix_tree_root ivrs_maps;
+static RADIX_TREE(ivrs_maps);
 LIST_HEAD_READ_MOSTLY(amd_iommu_head);
 bool iommuv2_enabled;
 
@@ -1410,7 +1410,6 @@ int __init amd_iommu_prepare(bool xt)
         goto error_out;
     ivrs_bdf_entries = rc;
 
-    radix_tree_init(&ivrs_maps);
     for_each_amd_iommu ( iommu )
     {
         rc = amd_iommu_prepare_one(iommu);
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index ae620b3007..c7ee835b8a 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -68,7 +68,7 @@ bool pcidevs_locked(void)
     return rspin_is_locked(&_pcidevs_lock);
 }
 
-static struct radix_tree_root pci_segments;
+static RADIX_TREE(pci_segments);
 
 static inline struct pci_seg *get_pseg(u16 seg)
 {
@@ -124,7 +124,6 @@ static int pci_segments_iterate(
 
 void __init pci_segments_init(void)
 {
-    radix_tree_init(&pci_segments);
     if ( !alloc_pseg(0) )
         panic("Could not initialize PCI segment 0\n");
 }
diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 9d5ffae3eb..4077365972 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -72,6 +72,9 @@ struct radix_tree_root {
  *** radix-tree API starts here **
  */
 
+#define RADIX_TREE_INIT() {}
+#define RADIX_TREE(name) struct radix_tree_root name = RADIX_TREE_INIT()
+
 void radix_tree_init(struct radix_tree_root *root);
 
 void radix_tree_destroy(
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:34:57 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:34:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890373.1299389 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Kv-0005v6-Hk; Mon, 17 Feb 2025 12:34:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890373.1299389; Mon, 17 Feb 2025 12:34:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Kv-0005uy-F6; Mon, 17 Feb 2025 12:34:57 +0000
Received: by outflank-mailman (input) for mailman id 890373;
 Mon, 17 Feb 2025 12:34:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tk0Ku-0005up-1j
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:34:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Ku-006oaD-0q
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:34:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Kt-00BInj-3A
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:34: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=GD/OEBwzlMetXM+I4BE6rppOD/2RYieB0bxq8vYXYhw=; b=sropEhIVLXOgzxfcaVqpNX93O3
	3UbcSSgKUVPi4sylDyrcwb0IYBmSlShwXob7rzkWyJD2Qjcu5K0yi6ktb15O+bQMYVdLS9QW9vqzw
	OGysBclhgp2zeGcbnyzaa/xxaoaWqIgybfTqDy/Be6R1Tg23ljLlwi18KhGN+pFmUfWE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/shutdown: offline APs with interrupts disabled on all CPUs
Message-Id: <E1tk0Kt-00BInj-3A@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:34:55 +0000

commit e801a86d5eb2ed62c30c35f1d39cdccdf8d860e8
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:23:27 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:23:27 2025 +0100

    x86/shutdown: offline APs with interrupts disabled on all CPUs
    
    The current shutdown logic in smp_send_stop() will disable the APs while
    having interrupts enabled on the BSP or possibly other APs. On AMD systems
    this can lead to local APIC errors:
    
    APIC error on CPU0: 00(08), Receive accept error
    
    Such error message can be printed in a loop, thus blocking the system from
    rebooting.  I assume this loop is created by the error being triggered by
    the console interrupt, which is further stirred by the ESR handler
    printing to the console.
    
    Intel SDM states:
    
    "Receive Accept Error.
    
    Set when the local APIC detects that the message it received was not
    accepted by any APIC on the APIC bus, including itself. Used only on P6
    family and Pentium processors."
    
    So the error shouldn't trigger on any Intel CPU supported by Xen.
    
    However AMD doesn't make such claims, and indeed the error is broadcast to
    all local APICs when an interrupt targets a CPU that's already offline.
    
    To prevent the error from stalling the shutdown process perform the
    disabling of APs and the BSP local APIC with interrupts disabled on all
    CPUs in the system, so that by the time interrupts are unmasked on the BSP
    the local APIC is already disabled.  This can still lead to a spurious:
    
    APIC error on CPU0: 00(00)
    
    As a result of an LVT Error getting injected while interrupts are masked on
    the CPU, and the vector only handled after the local APIC is already
    disabled.  ESR reports 0 because as part of disable_local_APIC() the ESR
    register is cleared.
    
    Note the NMI crash path doesn't have such issue, because disabling of APs
    and the caller local APIC is already done in the same contiguous region
    with interrupts disabled.  There's a possible window on the NMI crash path
    (nmi_shootdown_cpus()) where some APs might be disabled (and thus
    interrupts targeting them raising "Receive accept error") before others APs
    have interrupts disabled.  However the shutdown NMI will be handled,
    regardless of whether the AP is processing a local APIC error, and hence
    such interrupts will not cause the shutdown process to get stuck.
    
    Remove the call to fixup_irqs() in smp_send_stop(): it doesn't achieve the
    intended goal of moving all interrupts to the BSP anyway.  The logic in
    fixup_irqs() will move interrupts whose affinity doesn't overlap with the
    passed mask, but the movement of interrupts is done to any CPU set in
    cpu_online_map.  As in the shutdown path fixup_irqs() is called before APs
    are cleared from cpu_online_map this leads to interrupts being shuffled
    around, but not assigned to the BSP exclusively.
    
    The Fixes tag is more of a guess than a certainty; it's possible the
    previous sleep window in fixup_irqs() allowed any in-flight interrupt to be
    delivered before APs went offline.  However fixup_irqs() was still
    incorrectly used, as it didn't (and still doesn't) move all interrupts to
    target the provided cpu mask.
    
    Fixes: e2bb28d62158 ('x86/irq: forward pending interrupts to new destination in fixup_irqs()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1191ce954f64244a3c5f553116184928bcc677e8
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/smp.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 04c6a05723..bd92496d3d 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -343,6 +343,11 @@ void __stop_this_cpu(void)
 
 static void cf_check stop_this_cpu(void *dummy)
 {
+    const bool *stop_aps = dummy;
+
+    while ( !*stop_aps )
+        cpu_relax();
+
     __stop_this_cpu();
     for ( ; ; )
         halt();
@@ -355,16 +360,25 @@ static void cf_check stop_this_cpu(void *dummy)
 void smp_send_stop(void)
 {
     unsigned int cpu = smp_processor_id();
+    bool stop_aps = false;
+
+    /*
+     * Perform AP offlining and disabling of interrupt controllers with all
+     * CPUs on the system having interrupts disabled to prevent interrupt
+     * delivery errors.  On AMD systems "Receive accept error" will be
+     * broadcast to local APICs if interrupts target CPUs that are offline.
+     */
+    if ( num_online_cpus() > 1 )
+        smp_call_function(stop_this_cpu, &stop_aps, 0);
+
+    local_irq_disable();
 
     if ( num_online_cpus() > 1 )
     {
         int timeout = 10;
 
-        local_irq_disable();
-        fixup_irqs(cpumask_of(cpu), 0);
-        local_irq_enable();
-
-        smp_call_function(stop_this_cpu, NULL, 0);
+        /* Signal APs to stop. */
+        stop_aps = true;
 
         /* Wait 10ms for all other CPUs to go offline. */
         while ( (num_online_cpus() > 1) && (timeout-- > 0) )
@@ -373,13 +387,12 @@ void smp_send_stop(void)
 
     if ( cpu_online(cpu) )
     {
-        local_irq_disable();
         disable_IO_APIC();
         hpet_disable();
         __stop_this_cpu();
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
-        local_irq_enable();
     }
+    local_irq_enable();
 }
 
 void smp_send_nmi_allbutself(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:35:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:35:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890374.1299393 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0L4-0005xo-J1; Mon, 17 Feb 2025 12:35:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890374.1299393; Mon, 17 Feb 2025 12:35: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 1tk0L4-0005xg-GQ; Mon, 17 Feb 2025 12:35:06 +0000
Received: by outflank-mailman (input) for mailman id 890374;
 Mon, 17 Feb 2025 12:35:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tk0L4-0005xV-4T
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:35:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0L4-006oal-17
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:35:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0L4-00BIq5-0G
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:35:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+axNH0fQG+WhiFqCHzlDZ5HQTMxp4YSKRD1C1VemZy4=; b=ezbxA160f/90Fc4IWjMfGELoFP
	00kLdOcIzQcYRRwrVIDblaHsYA2WrsF+2k/8rygX4Ki9UTUV+qZ/GDa78av6w4oZ0xihCXu1XaSWJ
	/qOZeNnubkdrmPUfJFXsUBQ0a1ZOOkUuV+pkYNhGkNJ+4dv8zdS3hoW8ZlJGoZCSbxnw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/smp: perform disabling on interrupts ahead of AP shutdown
Message-Id: <E1tk0L4-00BIq5-0G@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:35:06 +0000

commit 30aadc8dbc9ac1abf88bfeb370d1c27c5ea9d1e6
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:23:50 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:23:50 2025 +0100

    x86/smp: perform disabling on interrupts ahead of AP shutdown
    
    Move the disabling of interrupt sources so it's done ahead of the offlining
    of APs.  This is to prevent AMD systems triggering "Receive accept error"
    when interrupts target CPUs that are no longer online.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: db6daa9bf411260d2c1f5301e4fc786ae4a5cef8
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index bd92496d3d..eb134ecac8 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -372,6 +372,8 @@ void smp_send_stop(void)
         smp_call_function(stop_this_cpu, &stop_aps, 0);
 
     local_irq_disable();
+    disable_IO_APIC();
+    hpet_disable();
 
     if ( num_online_cpus() > 1 )
     {
@@ -387,8 +389,6 @@ void smp_send_stop(void)
 
     if ( cpu_online(cpu) )
     {
-        disable_IO_APIC();
-        hpet_disable();
         __stop_this_cpu();
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:35:16 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:35:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890375.1299397 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0LE-00060M-KX; Mon, 17 Feb 2025 12:35:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890375.1299397; Mon, 17 Feb 2025 12:35: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 1tk0LE-00060E-Hm; Mon, 17 Feb 2025 12:35:16 +0000
Received: by outflank-mailman (input) for mailman id 890375;
 Mon, 17 Feb 2025 12:35:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tk0LE-000607-7v
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:35:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0LE-006oar-1T
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:35:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0LE-00BIsa-0Z
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:35:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UDBhv5ibcbD+gcJfhxjiHN/zMk81tsuYR89F91BJp7A=; b=hiG4GlOf/ZY/0YWiZD8fBdgrL0
	ezBLf7x86PVfvjPb6gzPQk6finFLR1Uo7om0oFBKaQQZm6KiawoE34Kv/aGesZym93Y5voYRGFr48
	x1NQZE31w3Uxggcm1haPJVoCOCIACyWsVzC6bfv3O39H6pYGjnlN95duoeOuT1Y/S8z4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/pci: disable MSI(-X) on all devices at shutdown
Message-Id: <E1tk0LE-00BIsa-0Z@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:35:16 +0000

commit eae35da8f4c420f5f6752d4c0291be5ba4d22f5a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:24:03 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:24:03 2025 +0100

    x86/pci: disable MSI(-X) on all devices at shutdown
    
    Attempt to disable MSI(-X) capabilities on all PCI devices know by Xen at
    shutdown.  Doing such disabling should facilitate kexec chained kernel from
    booting more reliably, as device MSI(-X) interrupt generation should be
    quiesced.
    
    Only attempt to disable MSI(-X) on all devices in the crash context if the
    PCI lock is not taken, otherwise the PCI device list could be in an
    inconsistent state.  This requires introducing a new pcidevs_trylock()
    helper to check whether the lock is currently taken.
    
    Disabling MSI(-X) should prevent "Receive accept error" being raised as a
    result of non-disabled interrupts targeting offline CPUs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 7ab6951981231b4c576a3588248c303001272588
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/crash.c           | 10 ++++++++++
 xen/arch/x86/include/asm/msi.h |  1 +
 xen/arch/x86/msi.c             | 18 ++++++++++++++++++
 xen/arch/x86/smp.c             |  1 +
 xen/drivers/passthrough/pci.c  | 42 ++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/pci.h          | 12 ++++++++++++
 6 files changed, 84 insertions(+)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index a789416ca3..22b1121d7a 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -175,6 +175,16 @@ static void nmi_shootdown_cpus(void)
          */
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
 
+        if ( pcidevs_trylock() )
+        {
+            /*
+             * Assume the PCI device list to be in a consistent state if the
+             * lock is not held when the crash happened.
+             */
+            pci_disable_msi_all();
+            pcidevs_unlock();
+        }
+
         disable_IO_APIC();
         hpet_disable();
     }
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 748bc3cd6d..503c9447f6 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -86,6 +86,7 @@ extern int pci_enable_msi(struct pci_dev *pdev, struct msi_info *msi,
 extern void pci_disable_msi(struct msi_desc *msi_desc);
 extern int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off);
 extern void pci_cleanup_msi(struct pci_dev *pdev);
+extern void pci_disable_msi_all(void);
 extern int setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc);
 extern int __setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc,
                            hw_irq_controller *handler);
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 0d11448234..0c099215c7 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1245,6 +1245,24 @@ void pci_cleanup_msi(struct pci_dev *pdev)
     msi_free_irqs(pdev);
 }
 
+static int cf_check disable_msi(struct pci_dev *pdev, void *arg)
+{
+    msi_set_enable(pdev, 0);
+    msix_set_enable(pdev, 0);
+
+    return 0;
+}
+
+/* Disable MSI and/or MSI-X on all devices known by Xen. */
+void pci_disable_msi_all(void)
+{
+    int rc = pci_iterate_devices(disable_msi, NULL);
+
+    if ( rc )
+        printk(XENLOG_ERR
+               "Failed to disable MSI(-X) on some devices: %d\n", rc);
+}
+
 int pci_reset_msix_state(struct pci_dev *pdev)
 {
     unsigned int pos = pci_find_cap_offset(pdev->sbdf, PCI_CAP_ID_MSIX);
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index eb134ecac8..92341b7ee7 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -372,6 +372,7 @@ void smp_send_stop(void)
         smp_call_function(stop_this_cpu, &stop_aps, 0);
 
     local_irq_disable();
+    pci_disable_msi_all();
     disable_IO_APIC();
     hpet_disable();
 
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index c7ee835b8a..f4c8c505af 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -68,6 +68,11 @@ bool pcidevs_locked(void)
     return rspin_is_locked(&_pcidevs_lock);
 }
 
+bool pcidevs_trylock_unsafe(void)
+{
+    return _rspin_trylock(&_pcidevs_lock);
+}
+
 static RADIX_TREE(pci_segments);
 
 static inline struct pci_seg *get_pseg(u16 seg)
@@ -1816,6 +1821,43 @@ int iommu_do_pci_domctl(
     return ret;
 }
 
+struct segment_iter {
+    int (*handler)(struct pci_dev *pdev, void *arg);
+    void *arg;
+    int rc;
+};
+
+static int cf_check iterate_all(struct pci_seg *pseg, void *arg)
+{
+    struct segment_iter *iter = arg;
+    struct pci_dev *pdev;
+
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+    {
+        int rc = iter->handler(pdev, iter->arg);
+
+        if ( !iter->rc )
+            iter->rc = rc;
+    }
+
+    return 0;
+}
+
+/*
+ * Iterate without locking or preemption over all PCI devices known by Xen.
+ * Can be called with interrupts disabled.
+ */
+int pci_iterate_devices(int (*handler)(struct pci_dev *pdev, void *arg),
+                        void *arg)
+{
+    struct segment_iter iter = {
+        .handler = handler,
+        .arg = arg,
+    };
+
+    return pci_segments_iterate(iterate_all, &iter) ?: iter.rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 82e1221c9c..06f98c7c80 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -187,6 +187,11 @@ static always_inline void pcidevs_lock(void)
 }
 void pcidevs_unlock(void);
 bool __must_check pcidevs_locked(void);
+bool pcidevs_trylock_unsafe(void);
+static always_inline bool pcidevs_trylock(void)
+{
+    return lock_evaluate_nospec(pcidevs_trylock_unsafe());
+}
 
 #ifndef NDEBUG
 /*
@@ -223,6 +228,13 @@ struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf);
 struct pci_dev *pci_get_real_pdev(pci_sbdf_t sbdf);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
+/*
+ * Iterate without locking or preemption over all PCI devices known by Xen.
+ * Can be called with interrupts disabled.
+ */
+int pci_iterate_devices(int (*handler)(struct pci_dev *pdev, void *arg),
+                        void *arg);
+
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
 uint16_t pci_conf_read16(pci_sbdf_t sbdf, unsigned int reg);
 uint32_t pci_conf_read32(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:35:26 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:35:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890376.1299400 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0LO-00062r-Lr; Mon, 17 Feb 2025 12:35:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890376.1299400; Mon, 17 Feb 2025 12:35: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 1tk0LO-00062j-JJ; Mon, 17 Feb 2025 12:35:26 +0000
Received: by outflank-mailman (input) for mailman id 890376;
 Mon, 17 Feb 2025 12:35:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tk0LO-00062d-Ar
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:35:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0LO-006oax-1l
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:35:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0LO-00BIuy-0v
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:35:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tUhOw/lOlj5dsyt2pjArESgEJXqWqLJlzWVcuSs+zkA=; b=QtLiOgZ3LA7GLsaxd9qgcB3Weg
	0Kc8PLvxEj0LEkS7KU/YhIwSrkEq2asyHc2CcecxPCc4b1nq5WAVS8WHkAkVkE8V9Gmyj92zdZzz0
	LOOKC0jSZDw19m+iX76xToUUqQ2kWB9Sd9f/Shxs94wN9Y8227JHA9YwCTtFu++qsfZg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/iommu: disable interrupts at shutdown
Message-Id: <E1tk0LO-00BIuy-0v@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:35:26 +0000

commit 93302bb88855c5f308f1e67ac2cd84271aa2d73a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:24:23 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:24:23 2025 +0100

    x86/iommu: disable interrupts at shutdown
    
    Add a new hook to inhibit interrupt generation by the IOMMU(s).  Note the
    hook is currently only implemented for x86 IOMMUs.  The purpose is to
    disable interrupt generation at shutdown so any kexec chained image finds
    the IOMMU(s) in a quiesced state.
    
    It would also prevent "Receive accept error" being raised as a result of
    non-disabled interrupts targeting offline CPUs.
    
    Note that the iommu_quiesce() call in nmi_shootdown_cpus() is still
    required even when there's a preceding iommu_crash_shutdown() call; the
    later can become a no-op depending on the setting of the "crash-disable"
    command line option.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 819c3cb186a86ef3e04fb5af4d9f9f6de032c3ee
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/crash.c                        |  1 +
 xen/arch/x86/smp.c                          |  1 +
 xen/drivers/passthrough/amd/iommu.h         |  1 +
 xen/drivers/passthrough/amd/iommu_init.c    | 17 +++++++++++++++++
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  1 +
 xen/drivers/passthrough/iommu.c             | 12 ++++++++++++
 xen/drivers/passthrough/vtd/iommu.c         | 19 +++++++++++++++++++
 xen/include/xen/iommu.h                     |  3 +++
 8 files changed, 55 insertions(+)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 22b1121d7a..26057c71d3 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -187,6 +187,7 @@ static void nmi_shootdown_cpus(void)
 
         disable_IO_APIC();
         hpet_disable();
+        iommu_quiesce();
     }
 }
 
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 92341b7ee7..2cf36cb96c 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -375,6 +375,7 @@ void smp_send_stop(void)
     pci_disable_msi_all();
     disable_IO_APIC();
     hpet_disable();
+    iommu_quiesce();
 
     if ( num_online_cpus() > 1 )
     {
diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index 8d6f63d87f..9934316351 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -292,6 +292,7 @@ extern unsigned long *shared_intremap_inuse;
 void cf_check amd_iommu_resume(void);
 int __must_check cf_check amd_iommu_suspend(void);
 void cf_check amd_iommu_crash_shutdown(void);
+void cf_check amd_iommu_quiesce(void);
 
 static inline u32 get_field_from_reg_u32(u32 reg_value, u32 mask, u32 shift)
 {
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index b546c28667..d899f58a38 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -1610,3 +1610,20 @@ void cf_check amd_iommu_resume(void)
         invalidate_all_domain_pages();
     }
 }
+
+void cf_check amd_iommu_quiesce(void)
+{
+    struct amd_iommu *iommu;
+
+    for_each_amd_iommu ( iommu )
+    {
+        if ( iommu->ctrl.int_cap_xt_en )
+        {
+            iommu->ctrl.int_cap_xt_en = false;
+            writeq(iommu->ctrl.raw,
+                   iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
+        }
+        else
+            amd_iommu_msi_enable(iommu, IOMMU_CONTROL_DISABLED);
+    }
+}
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index f96f59440b..d00697edb3 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -791,6 +791,7 @@ static const struct iommu_ops __initconst_cf_clobber _iommu_ops = {
     .crash_shutdown = amd_iommu_crash_shutdown,
     .get_reserved_device_memory = amd_iommu_get_reserved_device_memory,
     .dump_page_tables = amd_dump_page_tables,
+    .quiesce = amd_iommu_quiesce,
 };
 
 static const struct iommu_init_ops __initconstrel _iommu_init_ops = {
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 50bfd62553..1a3180708c 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -662,6 +662,18 @@ void iommu_crash_shutdown(void)
 #endif
 }
 
+void iommu_quiesce(void)
+{
+    const struct iommu_ops *ops;
+
+    if ( !iommu_enabled )
+        return;
+
+    ops = iommu_get_ops();
+    if ( ops->quiesce )
+        iommu_vcall(ops, quiesce);
+}
+
 int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt)
 {
     const struct iommu_ops *ops;
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index ab38bbc8a5..f28de36458 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -3247,6 +3247,24 @@ static int cf_check intel_iommu_quarantine_init(struct pci_dev *pdev,
     return rc;
 }
 
+static void cf_check vtd_quiesce(void)
+{
+    const struct acpi_drhd_unit *drhd;
+
+    for_each_drhd_unit ( drhd )
+    {
+        const struct vtd_iommu *iommu = drhd->iommu;
+        uint32_t sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
+
+        /*
+         * Open code dma_msi_mask() to avoid taking the spinlock which could
+         * deadlock if called from crash context.
+         */
+        sts |= DMA_FECTL_IM;
+        dmar_writel(iommu->reg, DMAR_FECTL_REG, sts);
+    }
+}
+
 static const struct iommu_ops __initconst_cf_clobber vtd_ops = {
     .page_sizes = PAGE_SIZE_4K,
     .init = intel_iommu_domain_init,
@@ -3276,6 +3294,7 @@ static const struct iommu_ops __initconst_cf_clobber vtd_ops = {
     .iotlb_flush = iommu_flush_iotlb,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_page_tables = vtd_dump_page_tables,
+    .quiesce = vtd_quiesce,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 442ae5322d..04f195be04 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -314,6 +314,8 @@ struct iommu_ops {
      */
     int (*dt_xlate)(device_t *dev, const struct dt_phandle_args *args);
 #endif
+    /* Inhibit all interrupt generation, to be used at shutdown. */
+    void (*quiesce)(void);
 };
 
 /*
@@ -404,6 +406,7 @@ static inline int iommu_do_domctl(struct xen_domctl *domctl, struct domain *d,
 int __must_check iommu_suspend(void);
 void iommu_resume(void);
 void iommu_crash_shutdown(void);
+void iommu_quiesce(void);
 int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt);
 int iommu_quarantine_dev_init(device_t *dev);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:44:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890377.1299404 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Tm-0007Qe-Am; Mon, 17 Feb 2025 12:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890377.1299404; Mon, 17 Feb 2025 12:44: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 1tk0Tm-0007QW-8C; Mon, 17 Feb 2025 12:44:06 +0000
Received: by outflank-mailman (input) for mailman id 890377;
 Mon, 17 Feb 2025 12:44: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 1tk0Tl-0007QQ-Fk
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:44: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 1tk0Tl-006osD-1Q
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Tl-00BLdW-0T
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:44: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=BcyxZ9Xh1DfYeG7wEqbZXXz6/efEncl7eE410CEfIr8=; b=ytHNzhDwEPa5a/LyN8nhUEj1k3
	V6Of9erY0MnoUwJm+1kcmpv5XrQB0u2ouj83zWHRAkVwKfkJAxgk3WBjWX7nVOFN8nvH/NlOUJEiT
	lCxUIrcoZ+Ncsfs72Ov3zapE4yV0x8l3ezFXNFS1rE4V67qCDvgnGqkE5ghi2GmEBJG4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/HVM: reduce recursion in linear_{read,write}()
Message-Id: <E1tk0Tl-00BLdW-0T@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:44:05 +0000

commit da7790b8f259bc71135d561666d7a8256bf6b163
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:27:22 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:27:22 2025 +0100

    x86/HVM: reduce recursion in linear_{read,write}()
    
    Let's make explicit what the compiler may or may not do on our behalf:
    The 2nd of the recursive invocations each can fall through rather than
    re-invoking the function. This will save us from adding yet another
    parameter (or more) to the function, just for the recursive invocations.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 18053054b7583810dd356efc8d7018bbc8720f36
    master date: 2024-09-09 13:40:47 +0200
---
 xen/arch/x86/hvm/emulate.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 865aa08bbc..5742383139 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1148,7 +1148,7 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned int offset = addr & ~PAGE_MASK;
-    int rc = HVMTRANS_bad_gfn_to_mfn;
+    int rc;
 
     if ( offset + bytes > PAGE_SIZE )
     {
@@ -1156,12 +1156,16 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
 
         /* Split the access at the page boundary. */
         rc = linear_read(addr, part1, p_data, pfec, hvmemul_ctxt);
-        if ( rc == X86EMUL_OKAY )
-            rc = linear_read(addr + part1, bytes - part1, p_data + part1,
-                             pfec, hvmemul_ctxt);
-        return rc;
+        if ( rc != X86EMUL_OKAY )
+            return rc;
+
+        addr += part1;
+        bytes -= part1;
+        p_data += part1;
     }
 
+    rc = HVMTRANS_bad_gfn_to_mfn;
+
     /*
      * If there is an MMIO cache entry for the access then we must be re-issuing
      * an access that was previously handled as MMIO. Thus it is imperative that
@@ -1203,7 +1207,7 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned int offset = addr & ~PAGE_MASK;
-    int rc = HVMTRANS_bad_gfn_to_mfn;
+    int rc;
 
     if ( offset + bytes > PAGE_SIZE )
     {
@@ -1211,12 +1215,16 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 
         /* Split the access at the page boundary. */
         rc = linear_write(addr, part1, p_data, pfec, hvmemul_ctxt);
-        if ( rc == X86EMUL_OKAY )
-            rc = linear_write(addr + part1, bytes - part1, p_data + part1,
-                              pfec, hvmemul_ctxt);
-        return rc;
+        if ( rc != X86EMUL_OKAY )
+            return rc;
+
+        addr += part1;
+        bytes -= part1;
+        p_data += part1;
     }
 
+    rc = HVMTRANS_bad_gfn_to_mfn;
+
     /*
      * If there is an MMIO cache entry for the access then we must be re-issuing
      * an access that was previously handled as MMIO. Thus it is imperative that
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:44:16 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890378.1299408 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Tw-0007Se-C9; Mon, 17 Feb 2025 12:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890378.1299408; Mon, 17 Feb 2025 12:44: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 1tk0Tw-0007SW-9e; Mon, 17 Feb 2025 12:44:16 +0000
Received: by outflank-mailman (input) for mailman id 890378;
 Mon, 17 Feb 2025 12:44: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 1tk0Tv-0007SO-B2
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Tv-006osV-1l
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Tv-00BLfc-0q
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wPexirusv7vCdkv3vdM3NmgELJuQ0lFtUbwddgdSiuo=; b=Igm05MHqut0M6Cyq3nuoYW1t6t
	jXwKc4a/NijMqT42mdIgEFjDX991QbHrMgrDnPHU/Qu4W59jeiAiAklzk86bk+DSHqr76n9o5Lm8K
	Ji92sjF8TljH+jqSo+MTPisBQmMU5M9xW+f3aIa4gUsjvx048TYi3ug2xlL5fHId5JTo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/HVM: correct MMIO emulation cache bounds check
Message-Id: <E1tk0Tv-00BLfc-0q@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:44:15 +0000

commit 0d2799a557b4e08ab4eb2dada46afeb6e6f56c1f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:28:13 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:28:13 2025 +0100

    x86/HVM: correct MMIO emulation cache bounds check
    
    To avoid overrunning the internal buffer we need to take the offset into
    the buffer into account.
    
    Fixes: d95da91fb497 ("x86/HVM: grow MMIO cache data size to 64 bytes")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: e5339bb689dfa79a914c6c96e1d82d61e1ae3161
    master date: 2025-01-23 11:14:48 +0100
---
 xen/arch/x86/hvm/emulate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 5742383139..cebd4a5161 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -937,7 +937,7 @@ static int hvmemul_phys_mmio_access(
     }
 
     /* Accesses must not overflow the cache's buffer. */
-    if ( size > sizeof(cache->buffer) )
+    if ( offset + size > sizeof(cache->buffer) )
     {
         ASSERT_UNREACHABLE();
         return X86EMUL_UNHANDLEABLE;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:44:26 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890379.1299412 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0U6-0007VH-DQ; Mon, 17 Feb 2025 12:44:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890379.1299412; Mon, 17 Feb 2025 12:44: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 1tk0U6-0007VA-B2; Mon, 17 Feb 2025 12:44:26 +0000
Received: by outflank-mailman (input) for mailman id 890379;
 Mon, 17 Feb 2025 12:44: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 1tk0U5-0007Uz-Dt
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:44: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 1tk0U5-006osu-22
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0U5-00BLiN-1B
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=E8gd3dgZfXPicseaxDxVTm1DWs4gyc4FuWpWVsEMgWI=; b=qMLecAwkmU1yTFhEL9gqd3Q8JL
	mvUu9K7ALzs5wlfxaYHQnQMlleGNq7+viYipZMWS80mg14ADsXuT06kJMokqPdHrfuvew8UCCEg0M
	H86p/xj62ON9Tq/8thjAv8Qo+s/+QsUsfT3NtUzSRBmoRTfrBb/AMlC22jRirvsLUIWk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/HVM: allocate emulation cache entries dynamically
Message-Id: <E1tk0U5-00BLiN-1B@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:44:25 +0000

commit 115d878f09c056f7f002dfa509429d7235c40641
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:28:28 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:28:28 2025 +0100

    x86/HVM: allocate emulation cache entries dynamically
    
    Both caches may need higher capacity, and the upper bound will need to
    be determined dynamically based on CPUID policy (for AMX'es TILELOAD /
    TILESTORE at least).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 23d60dbb0493b2f9ec1d89be5341eec2ee9dab32
    master date: 2025-01-24 10:15:29 +0100
---
 xen/arch/x86/hvm/emulate.c             | 51 ++++++++++++++++++++++++++--------
 xen/arch/x86/include/asm/hvm/emulate.h |  4 +++
 xen/arch/x86/include/asm/hvm/vcpu.h    | 13 +--------
 3 files changed, 44 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index cebd4a5161..852d754056 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -27,6 +27,18 @@
 #include <asm/iocap.h>
 #include <asm/vm_event.h>
 
+/*
+ * We may read or write up to m512 or up to a tile row as a number of
+ * device-model transactions.
+ */
+struct hvm_mmio_cache {
+    unsigned long gla;
+    unsigned int size;     /* Amount of buffer[] actually used. */
+    unsigned int space:31; /* Allocated size of buffer[]. */
+    unsigned int dir:1;
+    uint8_t buffer[] __aligned(sizeof(long));
+};
+
 struct hvmemul_cache
 {
     /* The cache is disabled as long as num_ents > max_ents. */
@@ -937,7 +949,7 @@ static int hvmemul_phys_mmio_access(
     }
 
     /* Accesses must not overflow the cache's buffer. */
-    if ( offset + size > sizeof(cache->buffer) )
+    if ( offset + size > cache->space )
     {
         ASSERT_UNREACHABLE();
         return X86EMUL_UNHANDLEABLE;
@@ -1013,7 +1025,7 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
 
     for ( i = 0; i < hvio->mmio_cache_count; i ++ )
     {
-        cache = &hvio->mmio_cache[i];
+        cache = hvio->mmio_cache[i];
 
         if ( gla == cache->gla &&
              dir == cache->dir )
@@ -1029,10 +1041,11 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
 
     ++hvio->mmio_cache_count;
 
-    cache = &hvio->mmio_cache[i];
-    memset(cache, 0, sizeof (*cache));
+    cache = hvio->mmio_cache[i];
+    memset(cache->buffer, 0, cache->space);
 
     cache->gla = gla;
+    cache->size = 0;
     cache->dir = dir;
 
     return cache;
@@ -2978,16 +2991,21 @@ void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
 int hvmemul_cache_init(struct vcpu *v)
 {
     /*
-     * No insn can access more than 16 independent linear addresses (AVX512F
-     * scatters/gathers being the worst). Each such linear range can span a
-     * page boundary, i.e. may require two page walks. Account for each insn
-     * byte individually, for simplicity.
+     * AVX512F scatter/gather insns can access up to 16 independent linear
+     * addresses, up to 8 bytes size. Each such linear range can span a page
+     * boundary, i.e. may require two page walks.
+     */
+    unsigned int nents = 16 * 2 * (CONFIG_PAGING_LEVELS + 1);
+    unsigned int i, max_bytes = 64;
+    struct hvmemul_cache *cache;
+
+    /*
+     * Account for each insn byte individually, both for simplicity and to
+     * leave some slack space.
      */
-    const unsigned int nents = (CONFIG_PAGING_LEVELS + 1) *
-                               (MAX_INST_LEN + 16 * 2);
-    struct hvmemul_cache *cache = xmalloc_flex_struct(struct hvmemul_cache,
-                                                      ents, nents);
+    nents += MAX_INST_LEN * (CONFIG_PAGING_LEVELS + 1);
 
+    cache = xmalloc_flex_struct(struct hvmemul_cache, ents, nents);
     if ( !cache )
         return -ENOMEM;
 
@@ -2997,6 +3015,15 @@ int hvmemul_cache_init(struct vcpu *v)
 
     v->arch.hvm.hvm_io.cache = cache;
 
+    for ( i = 0; i < ARRAY_SIZE(v->arch.hvm.hvm_io.mmio_cache); ++i )
+    {
+        v->arch.hvm.hvm_io.mmio_cache[i] =
+            xmalloc_flex_struct(struct hvm_mmio_cache, buffer, max_bytes);
+        if ( !v->arch.hvm.hvm_io.mmio_cache[i] )
+            return -ENOMEM;
+        v->arch.hvm.hvm_io.mmio_cache[i]->space = max_bytes;
+    }
+
     return 0;
 }
 
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index 398d0db078..be24592084 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -119,6 +119,10 @@ int hvmemul_do_pio_buffer(uint16_t port,
 int __must_check hvmemul_cache_init(struct vcpu *v);
 static inline void hvmemul_cache_destroy(struct vcpu *v)
 {
+    unsigned int i;
+
+    for ( i = 0; i < ARRAY_SIZE(v->arch.hvm.hvm_io.mmio_cache); ++i )
+        XFREE(v->arch.hvm.hvm_io.mmio_cache[i]);
     XFREE(v->arch.hvm.hvm_io.cache);
 }
 bool hvmemul_read_cache(const struct vcpu *v, paddr_t gpa,
diff --git a/xen/arch/x86/include/asm/hvm/vcpu.h b/xen/arch/x86/include/asm/hvm/vcpu.h
index c9ef2b325b..3985994298 100644
--- a/xen/arch/x86/include/asm/hvm/vcpu.h
+++ b/xen/arch/x86/include/asm/hvm/vcpu.h
@@ -22,17 +22,6 @@ struct hvm_vcpu_asid {
     uint32_t asid;
 };
 
-/*
- * We may read or write up to m512 as a number of device-model
- * transactions.
- */
-struct hvm_mmio_cache {
-    unsigned long gla;
-    unsigned int size;
-    uint8_t dir;
-    uint8_t buffer[64] __aligned(sizeof(long));
-};
-
 struct hvm_vcpu_io {
     /*
      * HVM emulation:
@@ -48,7 +37,7 @@ struct hvm_vcpu_io {
      * We may need to handle up to 3 distinct memory accesses per
      * instruction.
      */
-    struct hvm_mmio_cache mmio_cache[3];
+    struct hvm_mmio_cache *mmio_cache[3];
     unsigned int mmio_cache_count;
 
     /* For retries we shouldn't re-fetch the instruction. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:44:36 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890380.1299417 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0UG-0007Xm-FU; Mon, 17 Feb 2025 12:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890380.1299417; Mon, 17 Feb 2025 12:44: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 1tk0UG-0007Xf-Cf; Mon, 17 Feb 2025 12:44:36 +0000
Received: by outflank-mailman (input) for mailman id 890380;
 Mon, 17 Feb 2025 12:44: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 1tk0UF-0007XW-HD
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:44: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 1tk0UF-006otG-2N
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0UF-00BLkX-1T
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:44: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=tz4UBkcOcaEt/ytDYZupZ8ECnqWBI+ywZaKNpm09ea4=; b=o196wHWIx1AJw/kgxr30x6//3R
	Bi8qM+H7c4dtQti7SysmXU9yRxFg1NAvolH61aMd6Y5HyrbjXrtWyhuEvA7Sf4AxvSr06/AivlukM
	4b5wZGEWeEK8UCNj/wFz7XBH7VqlNIXDYL9ebIpoMJTFVIUtnJ8HyllBYEt2XR/MRsMM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/HVM: correct read/write split at page boundaries
Message-Id: <E1tk0UF-00BLkX-1T@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:44:35 +0000

commit 58580992d381d55089b3628a8c08a5f92994e4bf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:29:05 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:29:05 2025 +0100

    x86/HVM: correct read/write split at page boundaries
    
    The MMIO cache is intended to have one entry used per independent memory
    access that an insn does. This, in particular, is supposed to be
    ignoring any page boundary crossing. Therefore when looking up a cache
    entry, the access'es starting (linear) address is relevant, not the one
    possibly advanced past a page boundary.
    
    In order for the same offset-into-buffer variable to be usable in
    hvmemul_phys_mmio_access() for both the caller's buffer and the cache
    entry's it is further necessary to have the un-adjusted caller buffer
    passed into there.
    
    Fixes: 2d527ba310dc ("x86/hvm: split all linear reads and writes at page boundary")
    Reported-by: Manuel Andreas <manuel.andreas@tum.de>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 672894a11fe06e664a0ebfb600baf5dbb897b9e4
    master date: 2025-01-24 10:15:56 +0100
---
 xen/arch/x86/hvm/emulate.c | 92 ++++++++++++++++++++++++++++++----------------
 1 file changed, 61 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 852d754056..a447c7270e 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -32,8 +32,9 @@
  * device-model transactions.
  */
 struct hvm_mmio_cache {
-    unsigned long gla;
-    unsigned int size;     /* Amount of buffer[] actually used. */
+    unsigned long gla;     /* Start of original access (e.g. insn operand). */
+    unsigned int skip;     /* Offset to start of MMIO */
+    unsigned int size;     /* Amount of buffer[] actually used, incl @skip. */
     unsigned int space:31; /* Allocated size of buffer[]. */
     unsigned int dir:1;
     uint8_t buffer[] __aligned(sizeof(long));
@@ -955,6 +956,13 @@ static int hvmemul_phys_mmio_access(
         return X86EMUL_UNHANDLEABLE;
     }
 
+    /* Accesses must not be to the unused leading space. */
+    if ( offset < cache->skip )
+    {
+        ASSERT_UNREACHABLE();
+        return X86EMUL_UNHANDLEABLE;
+    }
+
     /*
      * hvmemul_do_io() cannot handle non-power-of-2 accesses or
      * accesses larger than sizeof(long), so choose the highest power
@@ -1012,13 +1020,15 @@ static int hvmemul_phys_mmio_access(
 
 /*
  * Multi-cycle MMIO handling is based upon the assumption that emulation
- * of the same instruction will not access the same MMIO region more
- * than once. Hence we can deal with re-emulation (for secondary or
- * subsequent cycles) by looking up the result or previous I/O in a
- * cache indexed by linear MMIO address.
+ * of the same instruction will not access the exact same MMIO region
+ * more than once in exactly the same way (if it does, the accesses will
+ * be "folded"). Hence we can deal with re-emulation (for secondary or
+ * subsequent cycles) by looking up the result of previous I/O in a cache
+ * indexed by linear address and access type.
  */
 static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
-    struct hvm_vcpu_io *hvio, unsigned long gla, uint8_t dir, bool create)
+    struct hvm_vcpu_io *hvio, unsigned long gla, uint8_t dir,
+    unsigned int skip)
 {
     unsigned int i;
     struct hvm_mmio_cache *cache;
@@ -1032,7 +1042,11 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
             return cache;
     }
 
-    if ( !create )
+    /*
+     * Bail if a new entry shouldn't be allocated, relying on ->space having
+     * the same value for all entries.
+     */
+    if ( skip >= hvio->mmio_cache[0]->space )
         return NULL;
 
     i = hvio->mmio_cache_count;
@@ -1045,7 +1059,8 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
     memset(cache->buffer, 0, cache->space);
 
     cache->gla = gla;
-    cache->size = 0;
+    cache->skip = skip;
+    cache->size = skip;
     cache->dir = dir;
 
     return cache;
@@ -1066,12 +1081,14 @@ static void latch_linear_to_phys(struct hvm_vcpu_io *hvio, unsigned long gla,
 
 static int hvmemul_linear_mmio_access(
     unsigned long gla, unsigned int size, uint8_t dir, void *buffer,
-    uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt, bool_t known_gpfn)
+    uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt,
+    unsigned long start_gla, bool known_gpfn)
 {
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned long offset = gla & ~PAGE_MASK;
-    struct hvm_mmio_cache *cache = hvmemul_find_mmio_cache(hvio, gla, dir, true);
-    unsigned int chunk, buffer_offset = 0;
+    unsigned int chunk, buffer_offset = gla - start_gla;
+    struct hvm_mmio_cache *cache = hvmemul_find_mmio_cache(hvio, start_gla,
+                                                           dir, buffer_offset);
     paddr_t gpa;
     unsigned long one_rep = 1;
     int rc;
@@ -1119,19 +1136,19 @@ static int hvmemul_linear_mmio_access(
 static inline int hvmemul_linear_mmio_read(
     unsigned long gla, unsigned int size, void *buffer,
     uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt,
-    bool_t translate)
+    unsigned long start_gla, bool translate)
 {
-    return hvmemul_linear_mmio_access(gla, size, IOREQ_READ, buffer,
-                                      pfec, hvmemul_ctxt, translate);
+    return hvmemul_linear_mmio_access(gla, size, IOREQ_READ, buffer, pfec,
+                                      hvmemul_ctxt, start_gla, translate);
 }
 
 static inline int hvmemul_linear_mmio_write(
     unsigned long gla, unsigned int size, void *buffer,
     uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt,
-    bool_t translate)
+    unsigned long start_gla, bool translate)
 {
-    return hvmemul_linear_mmio_access(gla, size, IOREQ_WRITE, buffer,
-                                      pfec, hvmemul_ctxt, translate);
+    return hvmemul_linear_mmio_access(gla, size, IOREQ_WRITE, buffer, pfec,
+                                      hvmemul_ctxt, start_gla, translate);
 }
 
 static bool known_gla(unsigned long addr, unsigned int bytes, uint32_t pfec)
@@ -1160,7 +1177,10 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
 {
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
+    void *buffer = p_data;
+    unsigned long start = addr;
     unsigned int offset = addr & ~PAGE_MASK;
+    const struct hvm_mmio_cache *cache;
     int rc;
 
     if ( offset + bytes > PAGE_SIZE )
@@ -1184,8 +1204,17 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
      * an access that was previously handled as MMIO. Thus it is imperative that
      * we handle this access in the same way to guarantee completion and hence
      * clean up any interim state.
+     *
+     * Care must be taken, however, to correctly deal with crossing RAM/MMIO or
+     * MMIO/RAM boundaries. While we want to use a single cache entry (tagged
+     * by the starting linear address), we need to continue issuing (i.e. also
+     * upon replay) the RAM access for anything that's ahead of or past MMIO,
+     * i.e. in RAM.
      */
-    if ( !hvmemul_find_mmio_cache(hvio, addr, IOREQ_READ, false) )
+    cache = hvmemul_find_mmio_cache(hvio, start, IOREQ_READ, ~0);
+    if ( !cache ||
+         addr + bytes <= start + cache->skip ||
+         addr >= start + cache->size )
         rc = hvm_copy_from_guest_linear(p_data, addr, bytes, pfec, &pfinfo);
 
     switch ( rc )
@@ -1201,8 +1230,8 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
         if ( pfec & PFEC_insn_fetch )
             return X86EMUL_UNHANDLEABLE;
 
-        return hvmemul_linear_mmio_read(addr, bytes, p_data, pfec,
-                                        hvmemul_ctxt,
+        return hvmemul_linear_mmio_read(addr, bytes, buffer, pfec,
+                                        hvmemul_ctxt, start,
                                         known_gla(addr, bytes, pfec));
 
     case HVMTRANS_gfn_paged_out:
@@ -1219,7 +1248,10 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 {
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
+    void *buffer = p_data;
+    unsigned long start = addr;
     unsigned int offset = addr & ~PAGE_MASK;
+    const struct hvm_mmio_cache *cache;
     int rc;
 
     if ( offset + bytes > PAGE_SIZE )
@@ -1238,13 +1270,11 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 
     rc = HVMTRANS_bad_gfn_to_mfn;
 
-    /*
-     * If there is an MMIO cache entry for the access then we must be re-issuing
-     * an access that was previously handled as MMIO. Thus it is imperative that
-     * we handle this access in the same way to guarantee completion and hence
-     * clean up any interim state.
-     */
-    if ( !hvmemul_find_mmio_cache(hvio, addr, IOREQ_WRITE, false) )
+    /* See commentary in linear_read(). */
+    cache = hvmemul_find_mmio_cache(hvio, start, IOREQ_WRITE, ~0);
+    if ( !cache ||
+         addr + bytes <= start + cache->skip ||
+         addr >= start + cache->size )
         rc = hvm_copy_to_guest_linear(addr, p_data, bytes, pfec, &pfinfo);
 
     switch ( rc )
@@ -1257,8 +1287,8 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
         return X86EMUL_EXCEPTION;
 
     case HVMTRANS_bad_gfn_to_mfn:
-        return hvmemul_linear_mmio_write(addr, bytes, p_data, pfec,
-                                         hvmemul_ctxt,
+        return hvmemul_linear_mmio_write(addr, bytes, buffer, pfec,
+                                         hvmemul_ctxt, start,
                                          known_gla(addr, bytes, pfec));
 
     case HVMTRANS_gfn_paged_out:
@@ -1645,7 +1675,7 @@ static int cf_check hvmemul_cmpxchg(
     {
         /* 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,
+                                         hvmemul_ctxt, addr,
                                          hvio->mmio_access.write_access &&
                                          hvio->mmio_gla == (addr & PAGE_MASK));
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:44:46 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890381.1299423 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0UQ-0007aI-Hg; Mon, 17 Feb 2025 12:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890381.1299423; Mon, 17 Feb 2025 12:44: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 1tk0UQ-0007aA-EI; Mon, 17 Feb 2025 12:44:46 +0000
Received: by outflank-mailman (input) for mailman id 890381;
 Mon, 17 Feb 2025 12:44: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 1tk0UP-0007Zx-LE
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:44: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 1tk0UP-006otc-2g
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0UP-00BLmK-1p
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:44: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=ANWcND7PR0HznObNU8Z45J1BzSZZ3k3z98tkLiXd8cY=; b=bm+hhDLJvxKhzjUVLfOS6fQTZH
	0Ng13rr50r6pc9C4O5qpfEkOTM+wC1+1FTpyBnMnB14YOnJjsFVYEDkoW5XKdO+rlirnPQ/eu0vV3
	HcWGrDVjt8i9XxNzihrrWozdEGy6B+MtCPjPFOzxc/V2JhuNuxRH7LiHJ1NqLknHSrCs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/iommu: check for CMPXCHG16B when enabling IOMMU
Message-Id: <E1tk0UP-00BLmK-1p@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:44:45 +0000

commit 413945d3eeebba66b2613d24192f53f73117717c
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Mon Feb 17 13:29:27 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:29:27 2025 +0100

    x86/iommu: check for CMPXCHG16B when enabling IOMMU
    
    All hardware with VT-d/AMD-Vi has CMPXCHG16B support. Check this at
    initialisation time, and otherwise refuse to use the IOMMU.
    
    If the local APICs support x2APIC mode the IOMMU support for interrupt
    remapping will be checked earlier using a specific helper.  If no support
    for CX16 is detected by that earlier hook disable the IOMMU at that point
    and prevent further poking for CX16 later in the boot process, which would
    also fail.
    
    There's a possible corner case when running virtualized, and the underlying
    hypervisor exposing an IOMMU but no CMPXCHG16B support.  In which case
    ignoring the IOMMU is fine, albeit the most natural would be for the
    underlying hypervisor to also expose CMPXCHG16B support if an IOMMU is
    available to the VM.
    
    Note this change only introduces the checks, but doesn't remove the now
    stale checks for CX16 support sprinkled in the IOMMU code.  Further changes
    will take care of that.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2636fcdc15c707d5e097770133f0afb69e8d70c9
    master date: 2025-01-27 13:05:11 +0100
---
 xen/drivers/passthrough/amd/iommu_intr.c    | 13 +++++++++++++
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  6 ++++++
 xen/drivers/passthrough/vtd/intremap.c      | 13 +++++++++++++
 xen/drivers/passthrough/vtd/iommu.c         |  7 +++++++
 4 files changed, 39 insertions(+)

diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index d9eefcd8e4..040927b6d0 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -648,6 +648,19 @@ bool __init cf_check iov_supports_xt(void)
     if ( !iommu_enable || !iommu_intremap )
         return false;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        AMD_IOMMU_ERROR("no CMPXCHG16B support, disabling IOMMU\n");
+        /*
+         * Disable IOMMU support at once: there's no reason to check for CX16
+         * yet again when attempting to initialize IOMMU DMA remapping
+         * functionality or interrupt remapping without x2APIC support.
+         */
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+        return false;
+    }
+
     if ( amd_iommu_prepare(true) )
         return false;
 
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 6bc73dc210..40a56008aa 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -305,6 +305,12 @@ static int __init cf_check iov_detect(void)
     if ( !iommu_enable && !iommu_intremap )
         return 0;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        AMD_IOMMU_ERROR("no CMPXCHG16B support, disabling IOMMU\n");
+        return -ENODEV;
+    }
+
     if ( (init_done ? amd_iommu_init_late()
                     : amd_iommu_init(false)) != 0 )
     {
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index c504852eb8..233db5cb64 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -150,6 +150,19 @@ bool __init cf_check intel_iommu_supports_eim(void)
     if ( !iommu_qinval || !iommu_intremap || list_empty(&acpi_drhd_units) )
         return false;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        printk(XENLOG_ERR VTDPREFIX "no CMPXCHG16B support, disabling IOMMU\n");
+        /*
+         * Disable IOMMU support at once: there's no reason to check for CX16
+         * yet again when attempting to initialize IOMMU DMA remapping
+         * functionality or interrupt remapping without x2APIC support.
+         */
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+        return false;
+    }
+
     /* We MUST have a DRHD unit for each IOAPIC. */
     for ( apic = 0; apic < nr_ioapics; apic++ )
         if ( !ioapic_to_drhd(IO_APIC_ID(apic)) )
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 9ed616e211..a6f0071fe9 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2631,6 +2631,13 @@ static int __init cf_check vtd_setup(void)
     int ret;
     bool reg_inval_supported = true;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        printk(XENLOG_ERR VTDPREFIX "no CMPXCHG16B support, disabling IOMMU\n");
+        ret = -ENODEV;
+        goto error;
+    }
+
     if ( list_empty(&acpi_drhd_units) )
     {
         ret = -ENODEV;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:44:56 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:44:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890382.1299426 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Ua-0007dI-Jn; Mon, 17 Feb 2025 12:44:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890382.1299426; Mon, 17 Feb 2025 12:44: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 1tk0Ua-0007dA-H4; Mon, 17 Feb 2025 12:44:56 +0000
Received: by outflank-mailman (input) for mailman id 890382;
 Mon, 17 Feb 2025 12:44: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 1tk0UZ-0007d2-NI
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:44: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 1tk0UZ-006otu-2z
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:44:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0UZ-00BLoQ-28
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:44: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=aHoDDqIvbxgm2i+9z1UgvZCMsh+CVIBgQlcVG371/Gk=; b=UsEbjDiAA9nac5iSIn8UEI7jK6
	/AUmhCAq2oueUoFChfvAizseDRa35fhyhUh/LCpAecuW/k1B2wHwYqNsIQE7AiCf2GqZzOxw1BoLB
	GHascWrPFjlbBo8O4FYkRUtwC4+2eI5MGkrPtqIji7rYj/TYseMeS5g+bQgGruiz0Dd4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86emul: further correct 64-bit mode zero count repeated string insn handling
Message-Id: <E1tk0UZ-00BLoQ-28@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:44:55 +0000

commit 01651b31a77fa710fabffe9c3f9ca323083d2d15
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:30:21 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:30:21 2025 +0100

    x86emul: further correct 64-bit mode zero count repeated string insn handling
    
    In an entirely different context I came across Linux commit 428e3d08574b
    ("KVM: x86: Fix zero iterations REP-string"), which points out that
    we're still doing things wrong: For one, there's no zero-extension at
    all on AMD. And then while RCX is zero-extended from 32 bits uniformly
    for all string instructions on newer hardware, RSI/RDI are only for MOVS
    and STOS on the systems I have access to. (On an old family 0xf system
    I've further found that for REP LODS even RCX is not zero-extended.)
    
    While touching the lines anyway, replace two casts in get_rep_prefix().
    
    Fixes: 79e996a89f69 ("x86emul: correct 64-bit mode repeated string insn handling with zero count")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 5310a042c4e3135c471446c8253ad13250539957
    master date: 2025-01-27 15:23:19 +0100
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index f2436473b9..af0a308814 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -513,7 +513,7 @@ static inline void put_loop_count(
         regs->r(cx) = ad_bytes == 4 ? (uint32_t)count : count;
 }
 
-#define get_rep_prefix(using_si, using_di) ({                           \
+#define get_rep_prefix(extend_si, extend_di) ({                         \
     unsigned long max_reps = 1;                                         \
     if ( rep_prefix() )                                                 \
         max_reps = get_loop_count(&_regs, ad_bytes);                    \
@@ -521,14 +521,14 @@ static inline void put_loop_count(
     {                                                                   \
         /*                                                              \
          * Skip the instruction if no repetitions are required, but     \
-         * zero extend involved registers first when using 32-bit       \
+         * zero extend relevant registers first when using 32-bit       \
          * addressing in 64-bit mode.                                   \
          */                                                             \
-        if ( mode_64bit() && ad_bytes == 4 )                            \
+        if ( !amd_like(ctxt) && mode_64bit() && ad_bytes == 4 )         \
         {                                                               \
             _regs.r(cx) = 0;                                            \
-            if ( using_si ) _regs.r(si) = (uint32_t)_regs.r(si);        \
-            if ( using_di ) _regs.r(di) = (uint32_t)_regs.r(di);        \
+            if ( extend_si ) _regs.r(si) = _regs.esi;                   \
+            if ( extend_di ) _regs.r(di) = _regs.edi;                   \
         }                                                               \
         goto complete_insn;                                             \
     }                                                                   \
@@ -1815,7 +1815,7 @@ x86_emulate(
         dst.bytes = !(b & 1) ? 1 : (op_bytes == 8) ? 4 : op_bytes;
         if ( (rc = ioport_access_check(port, dst.bytes, ctxt, ops)) != 0 )
             goto done;
-        nr_reps = get_rep_prefix(false, true);
+        nr_reps = get_rep_prefix(false, false /* don't extend RSI/RDI */);
         dst.mem.off = truncate_ea_and_reps(_regs.r(di), nr_reps, dst.bytes);
         dst.mem.seg = x86_seg_es;
         /* Try the presumably most efficient approach first. */
@@ -1857,7 +1857,7 @@ x86_emulate(
         dst.bytes = !(b & 1) ? 1 : (op_bytes == 8) ? 4 : op_bytes;
         if ( (rc = ioport_access_check(port, dst.bytes, ctxt, ops)) != 0 )
             goto done;
-        nr_reps = get_rep_prefix(true, false);
+        nr_reps = get_rep_prefix(false, false /* don't extend RSI/RDI */);
         ea.mem.off = truncate_ea_and_reps(_regs.r(si), nr_reps, dst.bytes);
         /* Try the presumably most efficient approach first. */
         if ( !ops->rep_outs )
@@ -2194,7 +2194,7 @@ x86_emulate(
     case 0xa6 ... 0xa7: /* cmps */ {
         unsigned long next_eip = _regs.r(ip);
 
-        get_rep_prefix(true, true);
+        get_rep_prefix(false, false /* don't extend RSI/RDI */);
         src.bytes = dst.bytes = (d & ByteOp) ? 1 : op_bytes;
         if ( (rc = read_ulong(ea.mem.seg, truncate_ea(_regs.r(si)),
                               &dst.val, dst.bytes, ctxt, ops)) ||
@@ -2236,7 +2236,7 @@ x86_emulate(
     }
 
     case 0xac ... 0xad: /* lods */
-        get_rep_prefix(true, false);
+        get_rep_prefix(false, false /* don't extend RSI/RDI */);
         if ( (rc = read_ulong(ea.mem.seg, truncate_ea(_regs.r(si)),
                               &dst.val, dst.bytes, ctxt, ops)) != 0 )
             goto done;
@@ -2247,7 +2247,7 @@ x86_emulate(
     case 0xae ... 0xaf: /* scas */ {
         unsigned long next_eip = _regs.r(ip);
 
-        get_rep_prefix(false, true);
+        get_rep_prefix(false, false /* don't extend RSI/RDI */);
         if ( (rc = read_ulong(x86_seg_es, truncate_ea(_regs.r(di)),
                               &dst.val, src.bytes, ctxt, ops)) != 0 )
             goto done;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:45:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:45:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890383.1299429 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Uk-0007g0-LG; Mon, 17 Feb 2025 12:45:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890383.1299429; Mon, 17 Feb 2025 12:45: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 1tk0Uk-0007fs-IU; Mon, 17 Feb 2025 12:45:06 +0000
Received: by outflank-mailman (input) for mailman id 890383;
 Mon, 17 Feb 2025 12:45: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 1tk0Uj-0007fm-Q0
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:45: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 1tk0Uk-006our-02
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:45:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Uj-00BLqL-2O
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:45: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=AORWSOVK/m0wgi7+M9XSlx1pLFHTHe5PRL1DiunykcE=; b=vSpOmmpJGjG3bNzLwImSOj+Pqg
	B0LYkpz74dEJTrlTd750G/rFRsXVc5+NyCKcQhojdOTtFgpg5F6oHmUfU975hgX1wMJOr6I2HpR8q
	kZAzYRe0lk0BMy437FfzsWa6WBXldRvouKjGQTcn5vAoolt7Dsyfscz6LWkF3WUAsuEo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/PV: further harden guest memory accesses against speculative abuse
Message-Id: <E1tk0Uj-00BLqL-2O@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:45:05 +0000

commit 2ade095820b4c82be3bf1923b056679e9bca89b8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:30:38 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:30:38 2025 +0100

    x86/PV: further harden guest memory accesses against speculative abuse
    
    The original implementation has two issues: For one it doesn't preserve
    non-canonical-ness of inputs in the range 0x8000000000000000 through
    0x80007fffffffffff. Bogus guest pointers in that range would not cause a
    (#GP) fault upon access, when they should.
    
    And then there is an AMD-specific aspect, where only the low 48 bits of
    an address are used for speculative execution; the architecturally
    mandated #GP for non-canonical addresses would be raised at a later
    execution stage. Therefore to prevent Xen controlled data to make it
    into any of the caches in a guest controllable manner, we need to
    additionally ensure that for non-canonical inputs bit 47 would be clear.
    
    See the code comment for how addressing both is being achieved.
    
    Fixes: 4dc181599142 ("x86/PV: harden guest memory accesses against speculative abuse")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8306d773b03acec6062c0547ac05e3dd4a6960f6
    master date: 2025-01-27 15:23:59 +0100
---
 xen/arch/x86/include/asm/asm-defns.h | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/include/asm/asm-defns.h b/xen/arch/x86/include/asm/asm-defns.h
index d55dd3bbc3..32d6b44910 100644
--- a/xen/arch/x86/include/asm/asm-defns.h
+++ b/xen/arch/x86/include/asm/asm-defns.h
@@ -1,3 +1,5 @@
+#include <asm/page-bits.h>
+
 #ifndef HAVE_AS_CLAC_STAC
 .macro clac
     .byte 0x0f, 0x01, 0xca
@@ -65,17 +67,36 @@
 .macro guest_access_mask_ptr ptr:req, scratch1:req, scratch2:req
 #if defined(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS)
     /*
-     * Here we want
-     *
-     * ptr &= ~0ull >> (ptr < HYPERVISOR_VIRT_END);
-     *
+     * Here we want to adjust \ptr such that
+     * - if it's within Xen range, it becomes non-canonical,
+     * - otherwise if it's (non-)canonical on input, it retains that property,
+     * - if the result is non-canonical, bit 47 is clear (to avoid
+     *   potentially populating the cache with Xen data on AMD-like hardware),
      * but guaranteed without any conditional branches (hence in assembly).
+     *
+     * To achieve this we determine which bit to forcibly clear: Either bit 47
+     * (in case the address is below HYPERVISOR_VIRT_END) or bit 63.  Further
+     * we determine whether for forcably set bit 63: In case we first cleared
+     * it, we'll merely restore the original address.  In case we ended up
+     * clearing bit 47 (i.e. the address was either non-canonical or within Xen
+     * range), setting the bit will yield a guaranteed non-canonical address.
+     * If we didn't clear a bit, we also won't set one: The address was in the
+     * low half of address space in that case with bit 47 already clear.  The
+     * address can thus be left unchanged, whether canonical or not.
      */
     mov $(HYPERVISOR_VIRT_END - 1), \scratch1
-    mov $~0, \scratch2
+    mov $(VADDR_BITS - 1), \scratch2
     cmp \ptr, \scratch1
+    /*
+     * Not needed: The value we have in \scratch1 will be truncated to 6 bits,
+     * thus yielding the value we need.
+    mov $63, \scratch1
+     */
+    cmovnb \scratch2, \scratch1
+    xor \scratch2, \scratch2
+    btr \scratch1, \ptr
     rcr $1, \scratch2
-    and \scratch2, \ptr
+    or \scratch2, \ptr
 #elif defined(CONFIG_DEBUG) && defined(CONFIG_PV)
     xor $~\@, \scratch1
     xor $~\@, \scratch2
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:45:16 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:45:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890384.1299433 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Uu-0007ia-Mr; Mon, 17 Feb 2025 12:45:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890384.1299433; Mon, 17 Feb 2025 12:45: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 1tk0Uu-0007iT-K7; Mon, 17 Feb 2025 12:45:16 +0000
Received: by outflank-mailman (input) for mailman id 890384;
 Mon, 17 Feb 2025 12:45: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 1tk0Ut-0007iJ-Ub
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:45:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Uu-006ov9-0J
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:45:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Ut-00BLsE-2g
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:45:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KwzKOYpgb7uRxwVToiUm3GpIA3OGoCH7gDrkYtrHsp4=; b=TC1ovCIOzchgRb6itkDqxq1FXq
	2i19eNCDcfS6pYowe7Yas0lwzE6nx4mAQHkTlurESpz05n+T12dz/2+yesiTxutsjaCkWENmfKuvB
	bATe4zrvq7MfeBTiePRLgUu/wvaRv/rcvuMnzsl3aUA7uDDGrfCHYOJjMzic8Q74Zlzs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/intel: Fix PERF_GLOBAL fixup when virtualised
Message-Id: <E1tk0Ut-00BLsE-2g@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:45:15 +0000

commit 5a66ba0572b2b987a6a1d0c5b4752315556c8d28
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 17 13:31:06 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:31:06 2025 +0100

    x86/intel: Fix PERF_GLOBAL fixup when virtualised
    
    Logic using performance counters needs to look at
    MSR_MISC_ENABLE.PERF_AVAILABLE before touching any other resources.
    
    When virtualised under ESX, Xen dies with a #GP fault trying to read
    MSR_CORE_PERF_GLOBAL_CTRL.
    
    Factor this logic out into a separate function (it's already too squashed to
    the RHS), and insert a check of MSR_MISC_ENABLE.PERF_AVAILABLE.
    
    This also avoids setting X86_FEATURE_ARCH_PERFMON if MSR_MISC_ENABLE says that
    PERF is unavailable, although oprofile (the only consumer of this flag)
    cross-checks too.
    
    Fixes: 6bdb965178bb ("x86/intel: ensure Global Performance Counter Control is setup correctly")
    Reported-by: Jonathan Katz <jonathan.katz@aptar.com>
    Link: https://xcp-ng.org/forum/topic/10286/nesting-xcp-ng-on-esx-8
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Tested-by: Jonathan Katz <jonathan.katz@aptar.com>
    master commit: dd05d265b8abda4cc7206b29cd71b77fb46658bf
    master date: 2025-01-28 11:19:45 +0000
---
 xen/arch/x86/cpu/intel.c | 64 ++++++++++++++++++++++++++++--------------------
 1 file changed, 37 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index 0dc7c27601..31f68cd6bd 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -535,39 +535,49 @@ static void intel_log_freq(const struct cpuinfo_x86 *c)
     printk("%u MHz\n", (factor * max_ratio + 50) / 100);
 }
 
+static void init_intel_perf(struct cpuinfo_x86 *c)
+{
+    uint64_t val;
+    unsigned int eax, ver, nr_cnt;
+
+    if ( c->cpuid_level <= 9 ||
+         ({  rdmsrl(MSR_IA32_MISC_ENABLE, val);
+             !(val & MSR_IA32_MISC_ENABLE_PERF_AVAIL); }) )
+        return;
+
+    eax = cpuid_eax(10);
+    ver = eax & 0xff;
+    nr_cnt = (eax >> 8) & 0xff;
+
+    if ( ver && nr_cnt > 1 && nr_cnt <= 32 )
+    {
+        unsigned int cnt_mask = (1UL << nr_cnt) - 1;
+
+        /*
+         * On (some?) Sapphire/Emerald Rapids platforms each package-BSP
+         * starts with all the enable bits for the general-purpose PMCs
+         * cleared.  Adjust so counters can be enabled from EVNTSEL.
+         */
+        rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, val);
+
+        if ( (val & cnt_mask) != cnt_mask )
+        {
+            printk("FIRMWARE BUG: CPU%u invalid PERF_GLOBAL_CTRL: %#"PRIx64" adjusting to %#"PRIx64"\n",
+                   smp_processor_id(), val, val | cnt_mask);
+            wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, val | cnt_mask);
+        }
+
+        __set_bit(X86_FEATURE_ARCH_PERFMON, c->x86_capability);
+    }
+}
+
 static void cf_check init_intel(struct cpuinfo_x86 *c)
 {
 	/* Detect the extended topology information if available */
 	detect_extended_topology(c);
 
 	init_intel_cacheinfo(c);
-	if (c->cpuid_level > 9) {
-		unsigned eax = cpuid_eax(10);
-		unsigned int cnt = (eax >> 8) & 0xff;
-
-		/* Check for version and the number of counters */
-		if ((eax & 0xff) && (cnt > 1) && (cnt <= 32)) {
-			uint64_t global_ctrl;
-			unsigned int cnt_mask = (1UL << cnt) - 1;
-
-			/*
-			 * On (some?) Sapphire/Emerald Rapids platforms each
-			 * package-BSP starts with all the enable bits for the
-			 * general-purpose PMCs cleared.  Adjust so counters
-			 * can be enabled from EVNTSEL.
-			 */
-			rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, global_ctrl);
-			if ((global_ctrl & cnt_mask) != cnt_mask) {
-				printk("CPU%u: invalid PERF_GLOBAL_CTRL: %#"
-				       PRIx64 " adjusting to %#" PRIx64 "\n",
-				       smp_processor_id(), global_ctrl,
-				       global_ctrl | cnt_mask);
-				wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL,
-				       global_ctrl | cnt_mask);
-			}
-			__set_bit(X86_FEATURE_ARCH_PERFMON, c->x86_capability);
-		}
-	}
+	init_intel_perf(c);
 
 	if ( !cpu_has(c, X86_FEATURE_XTOPOLOGY) )
 	{
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:45:26 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:45:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890385.1299437 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0V4-0007ky-O6; Mon, 17 Feb 2025 12:45:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890385.1299437; Mon, 17 Feb 2025 12:45: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 1tk0V4-0007kq-Ld; Mon, 17 Feb 2025 12:45:26 +0000
Received: by outflank-mailman (input) for mailman id 890385;
 Mon, 17 Feb 2025 12:45:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tk0V3-0007kk-VY
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:45: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 1tk0V4-006ovR-0a
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:45:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0V3-00BLvZ-2x
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:45:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zfyCD8tkgQFZkjrjnHNulZVnlpdNWIz+/y14VhDkaPY=; b=liKuK92PpOqy+D3zqb8I8B7bFA
	9prr/fkrOjKO15cmMLxzB+/8pqWqYDiue0tBTi9zGGh3zg2XPGjL34uiyxZxOiHJmae4lq6h/6Ufm
	0WgB+HPStnhwfRNhNkiWgh8wndbAUtYM3sNjrM45l2lHWXYvkyEsbSc4ALpXbqR+X/+g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] radix-tree: purge node allocation override hooks
Message-Id: <E1tk0V3-00BLvZ-2x@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:45:25 +0000

commit 9b7b348f204f8b49cb183bb2e55281b7ca02b782
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:31:22 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:31:22 2025 +0100

    radix-tree: purge node allocation override hooks
    
    These were needed by TMEM only, which is long gone. The Linux original
    doesn't have such either. This effectively reverts one of the "Other
    changes" from 8dc6738dbb3c ("Update radix-tree.[ch] from upstream Linux
    to gain RCU awareness").
    
    Positive side effect: Two cf_check go away.
    
    While there also convert xmalloc()+memset() to xzalloc().
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 1275093a96fed45057db241b3aa6e191d9dcf596
    master date: 2025-02-07 09:59:11 +0100
---
 xen/common/radix-tree.c      | 37 ++++++-------------------------------
 xen/include/xen/radix-tree.h | 10 ----------
 2 files changed, 6 insertions(+), 41 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index adc3034222..994a5a3b3d 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -52,12 +52,6 @@ struct rcu_node {
 	struct rcu_head rcu_head;
 };
 
-static struct radix_tree_node *cf_check rcu_node_alloc(void *arg)
-{
-	struct rcu_node *rcu_node = xmalloc(struct rcu_node);
-	return rcu_node ? &rcu_node->node : NULL;
-}
-
 static void cf_check _rcu_node_free(struct rcu_head *head)
 {
 	struct rcu_node *rcu_node =
@@ -65,26 +59,20 @@ static void cf_check _rcu_node_free(struct rcu_head *head)
 	xfree(rcu_node);
 }
 
-static void cf_check rcu_node_free(struct radix_tree_node *node, void *arg)
-{
-	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
-	call_rcu(&rcu_node->rcu_head, _rcu_node_free);
-}
-
 static struct radix_tree_node *radix_tree_node_alloc(
 	struct radix_tree_root *root)
 {
-	struct radix_tree_node *ret;
-	ret = root->node_alloc(root->node_alloc_free_arg);
-	if (ret)
-		memset(ret, 0, sizeof(*ret));
-	return ret;
+	struct rcu_node *rcu_node = xzalloc(struct rcu_node);
+
+	return rcu_node ? &rcu_node->node : NULL;
 }
 
 static void radix_tree_node_free(
 	struct radix_tree_root *root, struct radix_tree_node *node)
 {
-	root->node_free(node, root->node_alloc_free_arg);
+	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
+
+	call_rcu(&rcu_node->rcu_head, _rcu_node_free);
 }
 
 /*
@@ -717,19 +705,6 @@ void radix_tree_destroy(
 void radix_tree_init(struct radix_tree_root *root)
 {
 	memset(root, 0, sizeof(*root));
-	root->node_alloc = rcu_node_alloc;
-	root->node_free = rcu_node_free;
-}
-
-void radix_tree_set_alloc_callbacks(
-	struct radix_tree_root *root,
-	radix_tree_alloc_fn_t *node_alloc,
-	radix_tree_free_fn_t *node_free,
-	void *node_alloc_free_arg)
-{
-	root->node_alloc = node_alloc;
-	root->node_free = node_free;
-	root->node_alloc_free_arg = node_alloc_free_arg;
 }
 
 static __init unsigned long __maxindex(unsigned int height)
diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 58c40312e6..9d5ffae3eb 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -66,11 +66,6 @@ typedef void radix_tree_free_fn_t(struct radix_tree_node *, void *);
 struct radix_tree_root {
 	unsigned int		height;
 	struct radix_tree_node	__rcu *rnode;
-
-	/* Allow to specify custom node alloc/dealloc routines. */
-	radix_tree_alloc_fn_t *node_alloc;
-	radix_tree_free_fn_t *node_free;
-	void *node_alloc_free_arg;
 };
 
 /*
@@ -78,11 +73,6 @@ struct radix_tree_root {
  */
 
 void radix_tree_init(struct radix_tree_root *root);
-void radix_tree_set_alloc_callbacks(
-	struct radix_tree_root *root,
-	radix_tree_alloc_fn_t *node_alloc,
-	radix_tree_free_fn_t *node_free,
-	void *node_alloc_free_arg);
 
 void radix_tree_destroy(
 	struct radix_tree_root *root,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:45:36 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:45:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890386.1299441 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0VE-0007nQ-Po; Mon, 17 Feb 2025 12:45:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890386.1299441; Mon, 17 Feb 2025 12:45: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 1tk0VE-0007nJ-N9; Mon, 17 Feb 2025 12:45:36 +0000
Received: by outflank-mailman (input) for mailman id 890386;
 Mon, 17 Feb 2025 12:45:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tk0VE-0007n4-21
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:45:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0VE-006ovh-0r
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:45:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0VE-00BLxS-00
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:45:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WFoQXQ+XkepfWvwHjiRoRpT9V+intbAVjN8E9/YpY+0=; b=B7Rlue7wUCMrJtQH2KQbb3LCpG
	V5SA8rHoZqQeUqvtc/2KGnD6MHsCJJCfk/gErpg75rsvcxxXzMT9lW1ZDlsmlFSOdM7DML9ncG+BA
	Jil7y+FAYwT7WQJ6oGZ55RjseTJAduZbOlopqvRHj/rAhw0yQq8gv3NeBa+hBEYuW3pU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] radix-tree: introduce RADIX_TREE{,_INIT}()
Message-Id: <E1tk0VE-00BLxS-00@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:45:36 +0000

commit 3013bdc7f773f1394a89885d9df52a1ac006af68
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:31:59 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:31:59 2025 +0100

    radix-tree: introduce RADIX_TREE{,_INIT}()
    
    ... now that static initialization is possible. Use RADIX_TREE() for
    pci_segments and ivrs_maps.
    
    This then fixes an ordering issue on x86: With the call to
    radix_tree_init(), acpi_mmcfg_init()'s invocation of pci_segments_init()
    will zap the possible earlier introduction of segment 0 by
    amd_iommu_detect_one_acpi()'s call to pci_ro_device(), and thus the
    write-protection of the PCI devices representing AMD IOMMUs.
    
    Fixes: 3950f2485bbc ("x86/x2APIC: defer probe until after IOMMU ACPI table parsing")
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 26fe09e34566d701ecaea76b4563bb9934e85861
    master date: 2025-02-07 10:00:04 +0100
---
 xen/common/radix-tree.c                  | 2 +-
 xen/drivers/passthrough/amd/iommu_init.c | 3 +--
 xen/drivers/passthrough/pci.c            | 3 +--
 xen/include/xen/radix-tree.h             | 3 +++
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index 994a5a3b3d..ac4bfbd3f4 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -704,7 +704,7 @@ void radix_tree_destroy(
 
 void radix_tree_init(struct radix_tree_root *root)
 {
-	memset(root, 0, sizeof(*root));
+	*root = (struct radix_tree_root)RADIX_TREE_INIT();
 }
 
 static __init unsigned long __maxindex(unsigned int height)
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 9c01a49435..d672e682f8 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -32,7 +32,7 @@ static DECLARE_SOFTIRQ_TASKLET(amd_iommu_irq_tasklet, do_amd_iommu_irq, NULL);
 unsigned int __read_mostly amd_iommu_acpi_info;
 unsigned int __read_mostly ivrs_bdf_entries;
 u8 __read_mostly ivhd_type;
-static struct radix_tree_root ivrs_maps;
+static RADIX_TREE(ivrs_maps);
 LIST_HEAD_READ_MOSTLY(amd_iommu_head);
 bool iommuv2_enabled;
 
@@ -1406,7 +1406,6 @@ int __init amd_iommu_prepare(bool xt)
         goto error_out;
     ivrs_bdf_entries = rc;
 
-    radix_tree_init(&ivrs_maps);
     for_each_amd_iommu ( iommu )
     {
         rc = amd_iommu_prepare_one(iommu);
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 2a1e7ee89a..0852e4f172 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -68,7 +68,7 @@ bool pcidevs_locked(void)
     return !!spin_is_locked(&_pcidevs_lock);
 }
 
-static struct radix_tree_root pci_segments;
+static RADIX_TREE(pci_segments);
 
 static inline struct pci_seg *get_pseg(u16 seg)
 {
@@ -124,7 +124,6 @@ static int pci_segments_iterate(
 
 void __init pci_segments_init(void)
 {
-    radix_tree_init(&pci_segments);
     if ( !alloc_pseg(0) )
         panic("Could not initialize PCI segment 0\n");
 }
diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 9d5ffae3eb..4077365972 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -72,6 +72,9 @@ struct radix_tree_root {
  *** radix-tree API starts here **
  */
 
+#define RADIX_TREE_INIT() {}
+#define RADIX_TREE(name) struct radix_tree_root name = RADIX_TREE_INIT()
+
 void radix_tree_init(struct radix_tree_root *root);
 
 void radix_tree_destroy(
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:45:46 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:45:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890387.1299446 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0VO-0007qR-TN; Mon, 17 Feb 2025 12:45:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890387.1299446; Mon, 17 Feb 2025 12:45: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 1tk0VO-0007qJ-Q3; Mon, 17 Feb 2025 12:45:46 +0000
Received: by outflank-mailman (input) for mailman id 890387;
 Mon, 17 Feb 2025 12:45:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tk0VO-0007qD-4e
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:45:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0VO-006ovz-17
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:45:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0VO-00BM17-0H
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:45:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vx5vDQq9JaY6VJ3A7Z1ewRsIG8EzCVntrsB3JKb13RA=; b=3dMGJsO7BJ5JGwkc58hPYalvoA
	cfEJSnt6857XPg4VksApHUIRwPBhm+TDyE2enlh3AzlL3R9lf0Y72mLouOuOkHLqVB70ch+M1Fn9c
	dfw/NRdhXSqsYMv/ezYi/lwKDlKk/iAWshsDENFxv7/o7uqza0D1rgKsOGpe/EAqL2cI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/shutdown: offline APs with interrupts disabled on all CPUs
Message-Id: <E1tk0VO-00BM17-0H@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:45:46 +0000

commit 79116ff8bbd4e93cee8a8a6515061e3c803b397b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:32:17 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:32:17 2025 +0100

    x86/shutdown: offline APs with interrupts disabled on all CPUs
    
    The current shutdown logic in smp_send_stop() will disable the APs while
    having interrupts enabled on the BSP or possibly other APs. On AMD systems
    this can lead to local APIC errors:
    
    APIC error on CPU0: 00(08), Receive accept error
    
    Such error message can be printed in a loop, thus blocking the system from
    rebooting.  I assume this loop is created by the error being triggered by
    the console interrupt, which is further stirred by the ESR handler
    printing to the console.
    
    Intel SDM states:
    
    "Receive Accept Error.
    
    Set when the local APIC detects that the message it received was not
    accepted by any APIC on the APIC bus, including itself. Used only on P6
    family and Pentium processors."
    
    So the error shouldn't trigger on any Intel CPU supported by Xen.
    
    However AMD doesn't make such claims, and indeed the error is broadcast to
    all local APICs when an interrupt targets a CPU that's already offline.
    
    To prevent the error from stalling the shutdown process perform the
    disabling of APs and the BSP local APIC with interrupts disabled on all
    CPUs in the system, so that by the time interrupts are unmasked on the BSP
    the local APIC is already disabled.  This can still lead to a spurious:
    
    APIC error on CPU0: 00(00)
    
    As a result of an LVT Error getting injected while interrupts are masked on
    the CPU, and the vector only handled after the local APIC is already
    disabled.  ESR reports 0 because as part of disable_local_APIC() the ESR
    register is cleared.
    
    Note the NMI crash path doesn't have such issue, because disabling of APs
    and the caller local APIC is already done in the same contiguous region
    with interrupts disabled.  There's a possible window on the NMI crash path
    (nmi_shootdown_cpus()) where some APs might be disabled (and thus
    interrupts targeting them raising "Receive accept error") before others APs
    have interrupts disabled.  However the shutdown NMI will be handled,
    regardless of whether the AP is processing a local APIC error, and hence
    such interrupts will not cause the shutdown process to get stuck.
    
    Remove the call to fixup_irqs() in smp_send_stop(): it doesn't achieve the
    intended goal of moving all interrupts to the BSP anyway.  The logic in
    fixup_irqs() will move interrupts whose affinity doesn't overlap with the
    passed mask, but the movement of interrupts is done to any CPU set in
    cpu_online_map.  As in the shutdown path fixup_irqs() is called before APs
    are cleared from cpu_online_map this leads to interrupts being shuffled
    around, but not assigned to the BSP exclusively.
    
    The Fixes tag is more of a guess than a certainty; it's possible the
    previous sleep window in fixup_irqs() allowed any in-flight interrupt to be
    delivered before APs went offline.  However fixup_irqs() was still
    incorrectly used, as it didn't (and still doesn't) move all interrupts to
    target the provided cpu mask.
    
    Fixes: e2bb28d62158 ('x86/irq: forward pending interrupts to new destination in fixup_irqs()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1191ce954f64244a3c5f553116184928bcc677e8
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/smp.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 340fcafb46..ed67eff8db 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -343,6 +343,11 @@ void __stop_this_cpu(void)
 
 static void cf_check stop_this_cpu(void *dummy)
 {
+    const bool *stop_aps = dummy;
+
+    while ( !*stop_aps )
+        cpu_relax();
+
     __stop_this_cpu();
     for ( ; ; )
         halt();
@@ -355,16 +360,25 @@ static void cf_check stop_this_cpu(void *dummy)
 void smp_send_stop(void)
 {
     unsigned int cpu = smp_processor_id();
+    bool stop_aps = false;
+
+    /*
+     * Perform AP offlining and disabling of interrupt controllers with all
+     * CPUs on the system having interrupts disabled to prevent interrupt
+     * delivery errors.  On AMD systems "Receive accept error" will be
+     * broadcast to local APICs if interrupts target CPUs that are offline.
+     */
+    if ( num_online_cpus() > 1 )
+        smp_call_function(stop_this_cpu, &stop_aps, 0);
+
+    local_irq_disable();
 
     if ( num_online_cpus() > 1 )
     {
         int timeout = 10;
 
-        local_irq_disable();
-        fixup_irqs(cpumask_of(cpu), 0);
-        local_irq_enable();
-
-        smp_call_function(stop_this_cpu, NULL, 0);
+        /* Signal APs to stop. */
+        stop_aps = true;
 
         /* Wait 10ms for all other CPUs to go offline. */
         while ( (num_online_cpus() > 1) && (timeout-- > 0) )
@@ -373,13 +387,12 @@ void smp_send_stop(void)
 
     if ( cpu_online(cpu) )
     {
-        local_irq_disable();
         disable_IO_APIC();
         hpet_disable();
         __stop_this_cpu();
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
-        local_irq_enable();
     }
+    local_irq_enable();
 }
 
 void smp_send_nmi_allbutself(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:45:56 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:45:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890388.1299449 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0VY-0007sw-Uj; Mon, 17 Feb 2025 12:45:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890388.1299449; Mon, 17 Feb 2025 12:45: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 1tk0VY-0007so-Rv; Mon, 17 Feb 2025 12:45:56 +0000
Received: by outflank-mailman (input) for mailman id 890388;
 Mon, 17 Feb 2025 12:45:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tk0VY-0007sd-7G
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:45:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0VY-006owL-1O
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:45:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0VY-00BM31-0W
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:45:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7H3MW/2kvTn9y4YNgyCgOPaQt9rj1MP4r9wQq18u2U8=; b=6f45nH5HviWgODlbddympmKYbM
	pDuvva/mcTRsebORzRe2Nrq64C/vNbudVJ5jRr92j7xtI5i2GeXhueNwCga9BZxfWZCj6ZhdqmeO3
	a5i4EZpzOL5jLudBP/njjwltzQoyhrkR0oC5F6YFgMqSTPvKSTzt3SKux6IO/1VOh6e4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/smp: perform disabling on interrupts ahead of AP shutdown
Message-Id: <E1tk0VY-00BM31-0W@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:45:56 +0000

commit 8cd8dddda705fdb9a18ae1d426378b7e01e84d92
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:32:40 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:32:40 2025 +0100

    x86/smp: perform disabling on interrupts ahead of AP shutdown
    
    Move the disabling of interrupt sources so it's done ahead of the offlining
    of APs.  This is to prevent AMD systems triggering "Receive accept error"
    when interrupts target CPUs that are no longer online.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: db6daa9bf411260d2c1f5301e4fc786ae4a5cef8
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index ed67eff8db..bf095ea6c6 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -372,6 +372,8 @@ void smp_send_stop(void)
         smp_call_function(stop_this_cpu, &stop_aps, 0);
 
     local_irq_disable();
+    disable_IO_APIC();
+    hpet_disable();
 
     if ( num_online_cpus() > 1 )
     {
@@ -387,8 +389,6 @@ void smp_send_stop(void)
 
     if ( cpu_online(cpu) )
     {
-        disable_IO_APIC();
-        hpet_disable();
         __stop_this_cpu();
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:46:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:46:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890389.1299453 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Vj-0007vt-WE; Mon, 17 Feb 2025 12:46:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890389.1299453; Mon, 17 Feb 2025 12:46:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Vj-0007vl-TZ; Mon, 17 Feb 2025 12:46:07 +0000
Received: by outflank-mailman (input) for mailman id 890389;
 Mon, 17 Feb 2025 12:46:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tk0Vi-0007vZ-A1
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:46:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Vi-006owy-1f
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:46:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Vi-00BM5Q-0p
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:46:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=imX8MdO+uKcBnfA4KkS5yLWfrPSzhRFNdVtv4FG1EIQ=; b=VjhxwNO99ZW+ExSmh/a5p9yJ4G
	f/+UTrTNk8M/HdVhqDlmvGZwYzIb3pGtOtuL0BIX4EEPOy9RJ31hUFhJFi8UwrMnfEIWVfbNFnQWM
	wxm+jxpPXV6dZW86DaFzrOsP3Cf+48JHWNV7fs0rw4jq1cRyd2aZnUMdUR3GXGdF+OsY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/pci: disable MSI(-X) on all devices at shutdown
Message-Id: <E1tk0Vi-00BM5Q-0p@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:46:06 +0000

commit 9f4c92d70e3aff831c34e324dabf209bf7b6ab4e
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:32:52 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:32:52 2025 +0100

    x86/pci: disable MSI(-X) on all devices at shutdown
    
    Attempt to disable MSI(-X) capabilities on all PCI devices know by Xen at
    shutdown.  Doing such disabling should facilitate kexec chained kernel from
    booting more reliably, as device MSI(-X) interrupt generation should be
    quiesced.
    
    Only attempt to disable MSI(-X) on all devices in the crash context if the
    PCI lock is not taken, otherwise the PCI device list could be in an
    inconsistent state.  This requires introducing a new pcidevs_trylock()
    helper to check whether the lock is currently taken.
    
    Disabling MSI(-X) should prevent "Receive accept error" being raised as a
    result of non-disabled interrupts targeting offline CPUs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 7ab6951981231b4c576a3588248c303001272588
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/crash.c           | 10 ++++++++++
 xen/arch/x86/include/asm/msi.h |  1 +
 xen/arch/x86/msi.c             | 18 ++++++++++++++++++
 xen/arch/x86/smp.c             |  1 +
 xen/drivers/passthrough/pci.c  | 42 ++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/pci.h          | 12 ++++++++++++
 6 files changed, 84 insertions(+)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index a789416ca3..22b1121d7a 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -175,6 +175,16 @@ static void nmi_shootdown_cpus(void)
          */
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
 
+        if ( pcidevs_trylock() )
+        {
+            /*
+             * Assume the PCI device list to be in a consistent state if the
+             * lock is not held when the crash happened.
+             */
+            pci_disable_msi_all();
+            pcidevs_unlock();
+        }
+
         disable_IO_APIC();
         hpet_disable();
     }
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index a53ade95c9..5f5b499c82 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -85,6 +85,7 @@ extern int pci_enable_msi(struct msi_info *msi, struct msi_desc **desc);
 extern void pci_disable_msi(struct msi_desc *desc);
 extern int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off);
 extern void pci_cleanup_msi(struct pci_dev *pdev);
+extern void pci_disable_msi_all(void);
 extern int setup_msi_irq(struct irq_desc *, struct msi_desc *);
 extern int __setup_msi_irq(struct irq_desc *, struct msi_desc *,
                            const struct hw_interrupt_type *);
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 3eaeffd1e0..850995730c 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1193,6 +1193,24 @@ void pci_cleanup_msi(struct pci_dev *pdev)
     msi_free_irqs(pdev);
 }
 
+static int cf_check disable_msi(struct pci_dev *pdev, void *arg)
+{
+    msi_set_enable(pdev, 0);
+    msix_set_enable(pdev, 0);
+
+    return 0;
+}
+
+/* Disable MSI and/or MSI-X on all devices known by Xen. */
+void pci_disable_msi_all(void)
+{
+    int rc = pci_iterate_devices(disable_msi, NULL);
+
+    if ( rc )
+        printk(XENLOG_ERR
+               "Failed to disable MSI(-X) on some devices: %d\n", rc);
+}
+
 int pci_reset_msix_state(struct pci_dev *pdev)
 {
     unsigned int pos = pci_find_cap_offset(pdev->sbdf, PCI_CAP_ID_MSIX);
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index bf095ea6c6..3b79436b31 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -372,6 +372,7 @@ void smp_send_stop(void)
         smp_call_function(stop_this_cpu, &stop_aps, 0);
 
     local_irq_disable();
+    pci_disable_msi_all();
     disable_IO_APIC();
     hpet_disable();
 
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 0852e4f172..b7afdccf23 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -68,6 +68,11 @@ bool pcidevs_locked(void)
     return !!spin_is_locked(&_pcidevs_lock);
 }
 
+bool pcidevs_trylock_unsafe(void)
+{
+    return spin_trylock_recursive(&_pcidevs_lock);
+}
+
 static RADIX_TREE(pci_segments);
 
 static inline struct pci_seg *get_pseg(u16 seg)
@@ -1691,6 +1696,43 @@ int iommu_do_pci_domctl(
     return ret;
 }
 
+struct segment_iter {
+    int (*handler)(struct pci_dev *pdev, void *arg);
+    void *arg;
+    int rc;
+};
+
+static int cf_check iterate_all(struct pci_seg *pseg, void *arg)
+{
+    struct segment_iter *iter = arg;
+    struct pci_dev *pdev;
+
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+    {
+        int rc = iter->handler(pdev, iter->arg);
+
+        if ( !iter->rc )
+            iter->rc = rc;
+    }
+
+    return 0;
+}
+
+/*
+ * Iterate without locking or preemption over all PCI devices known by Xen.
+ * Can be called with interrupts disabled.
+ */
+int pci_iterate_devices(int (*handler)(struct pci_dev *pdev, void *arg),
+                        void *arg)
+{
+    struct segment_iter iter = {
+        .handler = handler,
+        .arg = arg,
+    };
+
+    return pci_segments_iterate(iterate_all, &iter) ?: iter.rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index a71bed36be..a880aae5eb 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -163,6 +163,11 @@ static always_inline void pcidevs_lock(void)
 }
 void pcidevs_unlock(void);
 bool __must_check pcidevs_locked(void);
+bool pcidevs_trylock_unsafe(void);
+static always_inline bool pcidevs_trylock(void)
+{
+    return lock_evaluate_nospec(pcidevs_trylock_unsafe());
+}
 
 bool pci_known_segment(u16 seg);
 bool pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func);
@@ -185,6 +190,13 @@ struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf);
 struct pci_dev *pci_get_real_pdev(pci_sbdf_t sbdf);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
+/*
+ * Iterate without locking or preemption over all PCI devices known by Xen.
+ * Can be called with interrupts disabled.
+ */
+int pci_iterate_devices(int (*handler)(struct pci_dev *pdev, void *arg),
+                        void *arg);
+
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
 uint16_t pci_conf_read16(pci_sbdf_t sbdf, unsigned int reg);
 uint32_t pci_conf_read32(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:46:18 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:46:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890390.1299457 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Vu-0007yN-1L; Mon, 17 Feb 2025 12:46:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890390.1299457; Mon, 17 Feb 2025 12:46:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0Vt-0007yF-Uz; Mon, 17 Feb 2025 12:46:17 +0000
Received: by outflank-mailman (input) for mailman id 890390;
 Mon, 17 Feb 2025 12:46:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tk0Vs-0007y4-D0
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:46:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Vs-006ox8-1x
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:46:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0Vs-00BM6s-17
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:46:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8xDTId6BGX0yQU9X+TFLMcfvhIOWJcmqUDbosaPDYtc=; b=5B8Uxz2RvaBwM0Ys2DB1mXaWoX
	9UuEBLi0Aau59KHCoy2xFdzeLnQjELJ0FkSmLNRG6H2nOz53i392v0NIQrz0v+4TpVoiqHJKYITj3
	uWWj3XSdNKh4MIkTjC78U5KtfeyoTyzcdF8NqwmE6PlRyDSWB4SlQV6ibtztgHNy1FqQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/iommu: disable interrupts at shutdown
Message-Id: <E1tk0Vs-00BM6s-17@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:46:16 +0000

commit 63866198f57ba33f1040d5c92c7bdf0b925b0ba4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:33:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:33:12 2025 +0100

    x86/iommu: disable interrupts at shutdown
    
    Add a new hook to inhibit interrupt generation by the IOMMU(s).  Note the
    hook is currently only implemented for x86 IOMMUs.  The purpose is to
    disable interrupt generation at shutdown so any kexec chained image finds
    the IOMMU(s) in a quiesced state.
    
    It would also prevent "Receive accept error" being raised as a result of
    non-disabled interrupts targeting offline CPUs.
    
    Note that the iommu_quiesce() call in nmi_shootdown_cpus() is still
    required even when there's a preceding iommu_crash_shutdown() call; the
    later can become a no-op depending on the setting of the "crash-disable"
    command line option.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 819c3cb186a86ef3e04fb5af4d9f9f6de032c3ee
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/crash.c                        |  1 +
 xen/arch/x86/smp.c                          |  1 +
 xen/drivers/passthrough/amd/iommu.h         |  1 +
 xen/drivers/passthrough/amd/iommu_init.c    | 17 +++++++++++++++++
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  1 +
 xen/drivers/passthrough/iommu.c             | 12 ++++++++++++
 xen/drivers/passthrough/vtd/iommu.c         | 19 +++++++++++++++++++
 xen/include/xen/iommu.h                     |  3 +++
 8 files changed, 55 insertions(+)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 22b1121d7a..26057c71d3 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -187,6 +187,7 @@ static void nmi_shootdown_cpus(void)
 
         disable_IO_APIC();
         hpet_disable();
+        iommu_quiesce();
     }
 }
 
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 3b79436b31..1f86ed4f4c 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -375,6 +375,7 @@ void smp_send_stop(void)
     pci_disable_msi_all();
     disable_IO_APIC();
     hpet_disable();
+    iommu_quiesce();
 
     if ( num_online_cpus() > 1 )
     {
diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index d4416ebc43..551bc6c10c 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -340,6 +340,7 @@ extern unsigned long *shared_intremap_inuse;
 void cf_check amd_iommu_resume(void);
 int __must_check cf_check amd_iommu_suspend(void);
 void cf_check amd_iommu_crash_shutdown(void);
+void cf_check amd_iommu_quiesce(void);
 
 /* guest iommu support */
 #ifdef CONFIG_HVM
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index d672e682f8..1388f112d5 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -1606,3 +1606,20 @@ void cf_check amd_iommu_resume(void)
         invalidate_all_domain_pages();
     }
 }
+
+void cf_check amd_iommu_quiesce(void)
+{
+    struct amd_iommu *iommu;
+
+    for_each_amd_iommu ( iommu )
+    {
+        if ( iommu->ctrl.int_cap_xt_en )
+        {
+            iommu->ctrl.int_cap_xt_en = false;
+            writeq(iommu->ctrl.raw,
+                   iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
+        }
+        else
+            amd_iommu_msi_enable(iommu, IOMMU_CONTROL_DISABLED);
+    }
+}
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 40a56008aa..37ba23ac2d 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -784,6 +784,7 @@ static const struct iommu_ops __initconst_cf_clobber _iommu_ops = {
     .crash_shutdown = amd_iommu_crash_shutdown,
     .get_reserved_device_memory = amd_iommu_get_reserved_device_memory,
     .dump_page_tables = amd_dump_page_tables,
+    .quiesce = amd_iommu_quiesce,
 };
 
 static const struct iommu_init_ops __initconstrel _iommu_init_ops = {
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index f9a9f53dbd..46874d6c56 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -658,6 +658,18 @@ void iommu_crash_shutdown(void)
 #endif
 }
 
+void iommu_quiesce(void)
+{
+    const struct iommu_ops *ops;
+
+    if ( !iommu_enabled )
+        return;
+
+    ops = iommu_get_ops();
+    if ( ops->quiesce )
+        iommu_vcall(ops, quiesce);
+}
+
 int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt)
 {
     const struct iommu_ops *ops;
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index a6f0071fe9..5f9906a290 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -3241,6 +3241,24 @@ static int cf_check intel_iommu_quarantine_init(struct pci_dev *pdev,
     return rc;
 }
 
+static void cf_check vtd_quiesce(void)
+{
+    const struct acpi_drhd_unit *drhd;
+
+    for_each_drhd_unit ( drhd )
+    {
+        const struct vtd_iommu *iommu = drhd->iommu;
+        uint32_t sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
+
+        /*
+         * Open code dma_msi_mask() to avoid taking the spinlock which could
+         * deadlock if called from crash context.
+         */
+        sts |= DMA_FECTL_IM;
+        dmar_writel(iommu->reg, DMAR_FECTL_REG, sts);
+    }
+}
+
 static const struct iommu_ops __initconst_cf_clobber vtd_ops = {
     .page_sizes = PAGE_SIZE_4K,
     .init = intel_iommu_domain_init,
@@ -3270,6 +3288,7 @@ static const struct iommu_ops __initconst_cf_clobber vtd_ops = {
     .iotlb_flush = iommu_flush_iotlb,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_page_tables = vtd_dump_page_tables,
+    .quiesce = vtd_quiesce,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 0e747b0bbc..e9296e36ee 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -320,6 +320,8 @@ struct iommu_ops {
      */
     int (*dt_xlate)(device_t *dev, const struct dt_phandle_args *args);
 #endif
+    /* Inhibit all interrupt generation, to be used at shutdown. */
+    void (*quiesce)(void);
 };
 
 /*
@@ -400,6 +402,7 @@ static inline int iommu_do_domctl(struct xen_domctl *domctl, struct domain *d,
 int __must_check iommu_suspend(void);
 void iommu_resume(void);
 void iommu_crash_shutdown(void);
+void iommu_quiesce(void);
 int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt);
 int iommu_quarantine_dev_init(device_t *dev);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 12:46:28 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 12:46:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890391.1299461 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0W4-00080p-3I; Mon, 17 Feb 2025 12:46:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890391.1299461; Mon, 17 Feb 2025 12:46:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0W4-00080g-0B; Mon, 17 Feb 2025 12:46:28 +0000
Received: by outflank-mailman (input) for mailman id 890391;
 Mon, 17 Feb 2025 12:46:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tk0W2-00080Q-Fc
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 12:46:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0W2-006oxS-2E
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:46:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0W2-00BM8q-1N
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 12:46:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=66eRTYx2rfGXshKv0jyMlTmHQ+9CvmvO6XVf0m+1fXA=; b=0RQsBaAlx4M6ibQFl34hs02Ev1
	PKQN+4YEwus3xIKnNp4kEYnvBjR8tmx7YFqE4GeOkiSkssIf1HdAkNQFSoaOrfyFwBXYXSaSzc0Co
	eGZ3KYiyi4e9Yt45bGiV38LJFYRIJbjQsRyOu3J8pNtSxuYpFrYOUq8FWBI4/rM/nDis=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] iommu/amd: atomically update IRTE
Message-Id: <E1tk0W2-00BM8q-1N@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 12:46:26 +0000

commit afce3802a77883d6ad96ca222983329020aca246
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:36:15 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:36:15 2025 +0100

    iommu/amd: atomically update IRTE
    
    Either when using a 32bit Interrupt Remapping Entry or a 128bit one update
    the entry atomically, by using cmpxchg unconditionally as IOMMU depends on
    it.  No longer disable the entry by setting RemapEn = 0 ahead of updating
    it.  As a consequence of not toggling RemapEn ahead of the update the
    Interrupt Remapping Table needs to be flushed after the entry update.
    
    This avoids a window where the IRTE has RemapEn = 0, which can lead to
    IO_PAGE_FAULT if the underlying interrupt source is not masked.
    
    There's no guidance in AMD-Vi specification about how IRTE update should be
    performed as opposed to DTE updating which has specific guidance.  However
    DTE updating claims that reads will always be at least 128bits in size, and
    hence for the purposes here assume that reads and caching of the IRTE
    entries in either 32 or 128 bit format will be done atomically from
    the IOMMU.
    
    Note that as part of introducing a new raw128 field in the IRTE struct, the
    current raw field is renamed to raw64 to explicitly contain the size in the
    field name.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: b953a99da98d63a7c827248abc450d4e8e015ab6
    master date: 2025-01-27 13:05:11 +0100
---
 xen/drivers/passthrough/amd/iommu_intr.c | 75 ++++++++++++++------------------
 1 file changed, 32 insertions(+), 43 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index 040927b6d0..ab53eb36cd 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -39,7 +39,8 @@ union irte32 {
 };
 
 union irte128 {
-    uint64_t raw[2];
+    uint64_t raw64[2];
+    __uint128_t raw128;
     struct {
         bool remap_en:1;
         bool sup_io_pf:1;
@@ -186,7 +187,7 @@ static void free_intremap_entry(const struct amd_iommu *iommu,
 
     if ( iommu->ctrl.ga_en )
     {
-        ACCESS_ONCE(entry.ptr128->raw[0]) = 0;
+        ACCESS_ONCE(entry.ptr128->raw64[0]) = 0;
         /*
          * Low half (containing RemapEn) needs to be cleared first.  Note that
          * strictly speaking smp_wmb() isn't enough, as conceptually it expands
@@ -196,7 +197,7 @@ static void free_intremap_entry(const struct amd_iommu *iommu,
          * variant will do.
          */
         smp_wmb();
-        entry.ptr128->raw[1] = 0;
+        entry.ptr128->raw64[1] = 0;
     }
     else
         ACCESS_ONCE(entry.ptr32->raw) = 0;
@@ -211,7 +212,7 @@ static void update_intremap_entry(const struct amd_iommu *iommu,
 {
     if ( iommu->ctrl.ga_en )
     {
-        union irte128 irte = {
+        const union irte128 irte = {
             .full = {
                 .remap_en = true,
                 .int_type = int_type,
@@ -221,19 +222,26 @@ static void update_intremap_entry(const struct amd_iommu *iommu,
                 .vector = vector,
             },
         };
+        __uint128_t old = entry.ptr128->raw128;
+        __uint128_t res = cmpxchg16b(&entry.ptr128->raw128, &old,
+                                     &irte.raw128);
 
-        ASSERT(!entry.ptr128->full.remap_en);
-        entry.ptr128->raw[1] = irte.raw[1];
         /*
-         * High half needs to be set before low one (containing RemapEn).  See
-         * comment in free_intremap_entry() regarding the choice of barrier.
+         * Hardware does not update the IRTE behind our backs, so the return
+         * value should match "old".
          */
-        smp_wmb();
-        ACCESS_ONCE(entry.ptr128->raw[0]) = irte.raw[0];
+        if ( res != old )
+        {
+            printk(XENLOG_ERR
+                   "unexpected IRTE %016lx_%016lx (expected %016lx_%016lx)\n",
+                   (uint64_t)(res >> 64), (uint64_t)res,
+                   (uint64_t)(old >> 64), (uint64_t)old);
+            ASSERT_UNREACHABLE();
+        }
     }
     else
     {
-        union irte32 irte = {
+        const union irte32 irte = {
             .flds = {
                 .remap_en = true,
                 .int_type = int_type,
@@ -298,21 +306,13 @@ static int update_intremap_entry_from_ioapic(
 
     entry = get_intremap_entry(iommu, req_id, offset);
 
-    /* The RemapEn fields match for all formats. */
-    while ( iommu->enabled && entry.ptr32->flds.remap_en )
-    {
-        entry.ptr32->flds.remap_en = false;
-        spin_unlock(lock);
-
-        amd_iommu_flush_intremap(iommu, req_id);
-
-        spin_lock(lock);
-    }
-
     update_intremap_entry(iommu, entry, vector, delivery_mode, dest_mode, dest);
 
     spin_unlock_irqrestore(lock, flags);
 
+    if ( !fresh )
+        amd_iommu_flush_intremap(iommu, req_id);
+
     set_rte_index(rte, offset);
 
     return 0;
@@ -321,7 +321,7 @@ static int update_intremap_entry_from_ioapic(
 void cf_check amd_iommu_ioapic_update_ire(
     unsigned int apic, unsigned int pin, uint64_t rte)
 {
-    struct IO_APIC_route_entry old_rte, new_rte;
+    struct IO_APIC_route_entry new_rte;
     int seg, bdf, rc;
     struct amd_iommu *iommu;
     unsigned int idx;
@@ -345,14 +345,6 @@ void cf_check amd_iommu_ioapic_update_ire(
         return;
     }
 
-    old_rte = __ioapic_read_entry(apic, pin, true);
-    /* mask the interrupt while we change the intremap table */
-    if ( !old_rte.mask )
-    {
-        old_rte.mask = 1;
-        __ioapic_write_entry(apic, pin, true, old_rte);
-    }
-
     /* Update interrupt remapping entry */
     rc = update_intremap_entry_from_ioapic(
              bdf, iommu, &new_rte,
@@ -424,6 +416,7 @@ static int update_intremap_entry_from_msi_msg(
     uint8_t delivery_mode, vector, dest_mode;
     spinlock_t *lock;
     unsigned int dest, offset, i;
+    bool fresh = false;
 
     req_id = get_dma_requestor_id(iommu->seg, bdf);
     alias_id = get_intremap_requestor_id(iommu->seg, bdf);
@@ -467,26 +460,21 @@ static int update_intremap_entry_from_msi_msg(
             return -ENOSPC;
         }
         *remap_index = offset;
+        fresh = true;
     }
 
     entry = get_intremap_entry(iommu, req_id, offset);
 
-    /* The RemapEn fields match for all formats. */
-    while ( iommu->enabled && entry.ptr32->flds.remap_en )
-    {
-        entry.ptr32->flds.remap_en = false;
-        spin_unlock(lock);
+    update_intremap_entry(iommu, entry, vector, delivery_mode, dest_mode, dest);
+    spin_unlock_irqrestore(lock, flags);
 
+    if ( !fresh )
+    {
         amd_iommu_flush_intremap(iommu, req_id);
         if ( alias_id != req_id )
             amd_iommu_flush_intremap(iommu, alias_id);
-
-        spin_lock(lock);
     }
 
-    update_intremap_entry(iommu, entry, vector, delivery_mode, dest_mode, dest);
-    spin_unlock_irqrestore(lock, flags);
-
     *data = (msg->data & ~(INTREMAP_MAX_ENTRIES - 1)) | offset;
 
     /*
@@ -734,7 +722,7 @@ static void dump_intremap_table(const struct amd_iommu *iommu,
     for ( count = 0; count < nr; count++ )
     {
         if ( iommu->ctrl.ga_en
-             ? !tbl.ptr128[count].raw[0] && !tbl.ptr128[count].raw[1]
+             ? !tbl.ptr128[count].raw64[0] && !tbl.ptr128[count].raw64[1]
              : !tbl.ptr32[count].raw )
                 continue;
 
@@ -747,7 +735,8 @@ static void dump_intremap_table(const struct amd_iommu *iommu,
 
         if ( iommu->ctrl.ga_en )
             printk("    IRTE[%03x] %016lx_%016lx\n",
-                   count, tbl.ptr128[count].raw[1], tbl.ptr128[count].raw[0]);
+                   count, tbl.ptr128[count].raw64[1],
+                   tbl.ptr128[count].raw64[0]);
         else
             printk("    IRTE[%03x] %08x\n", count, tbl.ptr32[count].raw);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:11:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890405.1299475 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0ts-0003oq-5b; Mon, 17 Feb 2025 13:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890405.1299475; Mon, 17 Feb 2025 13: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 1tk0ts-0003og-2r; Mon, 17 Feb 2025 13:11:04 +0000
Received: by outflank-mailman (input) for mailman id 890405;
 Mon, 17 Feb 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 1tk0tq-0003oS-8A
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0tq-006pWg-0u
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0tp-00BSAg-3B
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=R24hXp8zMBzS+MI89W3UWQ645DrzI5EiO9t+5HKIkeg=; b=w0C+FwvXzlOuW0AdUKwKVWvetP
	nDpBCJCbQf7Z1nGRoMACPmyFp4X424umaHcbYTFwnvbAX1jGm9qbb2mlBqI8cwT1orRUHJywd7l4t
	gojwyzR68HnZxig3LWVN2/yTzTSDeCUoQu1ZLcTKcGRIvCAz8gXTAYKvlG0gc4GTR1q4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/HVM: reduce recursion in linear_{read,write}()
Message-Id: <E1tk0tp-00BSAg-3B@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:11:01 +0000

commit 41d38d270e18ded067b1800b76c2e0e16844d233
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:17:45 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:17:45 2025 +0100

    x86/HVM: reduce recursion in linear_{read,write}()
    
    Let's make explicit what the compiler may or may not do on our behalf:
    The 2nd of the recursive invocations each can fall through rather than
    re-invoking the function. This will save us from adding yet another
    parameter (or more) to the function, just for the recursive invocations.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 18053054b7583810dd356efc8d7018bbc8720f36
    master date: 2024-09-09 13:40:47 +0200
---
 xen/arch/x86/hvm/emulate.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 02e378365b..9e62b2f184 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1147,7 +1147,7 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned int offset = addr & ~PAGE_MASK;
-    int rc = HVMTRANS_bad_gfn_to_mfn;
+    int rc;
 
     if ( offset + bytes > PAGE_SIZE )
     {
@@ -1155,12 +1155,16 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
 
         /* Split the access at the page boundary. */
         rc = linear_read(addr, part1, p_data, pfec, hvmemul_ctxt);
-        if ( rc == X86EMUL_OKAY )
-            rc = linear_read(addr + part1, bytes - part1, p_data + part1,
-                             pfec, hvmemul_ctxt);
-        return rc;
+        if ( rc != X86EMUL_OKAY )
+            return rc;
+
+        addr += part1;
+        bytes -= part1;
+        p_data += part1;
     }
 
+    rc = HVMTRANS_bad_gfn_to_mfn;
+
     /*
      * If there is an MMIO cache entry for the access then we must be re-issuing
      * an access that was previously handled as MMIO. Thus it is imperative that
@@ -1202,7 +1206,7 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned int offset = addr & ~PAGE_MASK;
-    int rc = HVMTRANS_bad_gfn_to_mfn;
+    int rc;
 
     if ( offset + bytes > PAGE_SIZE )
     {
@@ -1210,12 +1214,16 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 
         /* Split the access at the page boundary. */
         rc = linear_write(addr, part1, p_data, pfec, hvmemul_ctxt);
-        if ( rc == X86EMUL_OKAY )
-            rc = linear_write(addr + part1, bytes - part1, p_data + part1,
-                              pfec, hvmemul_ctxt);
-        return rc;
+        if ( rc != X86EMUL_OKAY )
+            return rc;
+
+        addr += part1;
+        bytes -= part1;
+        p_data += part1;
     }
 
+    rc = HVMTRANS_bad_gfn_to_mfn;
+
     /*
      * If there is an MMIO cache entry for the access then we must be re-issuing
      * an access that was previously handled as MMIO. Thus it is imperative that
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890407.1299489 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0u1-00044H-D5; Mon, 17 Feb 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 890407.1299489; Mon, 17 Feb 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 1tk0u1-00044A-AL; Mon, 17 Feb 2025 13:11:13 +0000
Received: by outflank-mailman (input) for mailman id 890407;
 Mon, 17 Feb 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 1tk0u0-0003rY-9E
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0u0-006pX7-1a
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0u0-00BSCf-0O
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=yfdJxFWA17B+OZMGdQ8dUZUdGiegiimYZN2/AIbetUc=; b=alyRVmGHebRv9XpgGY5E7B8vFk
	FDHo7y1PVrKRWKLmJRtLnok1m8r5eh8LJBNveXhQyNVPfohIQrhM+ir3vahnXGdTIOUfk+0bAm9FH
	1p783Yg2gqNXKWXm4Sduqm8mEW6S7I4R+NNwoXtwQs/pEAopvsDGp/OgsFtFMoUgGTLg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/HVM: correct MMIO emulation cache bounds check
Message-Id: <E1tk0u0-00BSCf-0O@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:11:12 +0000

commit 15f83e27444768c60671d7b8c3fdc597c4fca563
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:18:15 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:18:15 2025 +0100

    x86/HVM: correct MMIO emulation cache bounds check
    
    To avoid overrunning the internal buffer we need to take the offset into
    the buffer into account.
    
    Fixes: d95da91fb497 ("x86/HVM: grow MMIO cache data size to 64 bytes")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: e5339bb689dfa79a914c6c96e1d82d61e1ae3161
    master date: 2025-01-23 11:14:48 +0100
---
 xen/arch/x86/hvm/emulate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 9e62b2f184..10737533ba 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -936,7 +936,7 @@ static int hvmemul_phys_mmio_access(
     }
 
     /* Accesses must not overflow the cache's buffer. */
-    if ( size > sizeof(cache->buffer) )
+    if ( offset + size > sizeof(cache->buffer) )
     {
         ASSERT_UNREACHABLE();
         return X86EMUL_UNHANDLEABLE;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890409.1299492 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0uB-00049x-Eh; Mon, 17 Feb 2025 13:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890409.1299492; Mon, 17 Feb 2025 13: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 1tk0uB-00049q-Bv; Mon, 17 Feb 2025 13:11:23 +0000
Received: by outflank-mailman (input) for mailman id 890409;
 Mon, 17 Feb 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 1tk0uA-00049E-DD
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0uA-006pXF-1z
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0uA-00BSGd-12
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=bwblT8eKt6CsGRT+3Mcsdu/kH+TwdKtWonRwTML5pz8=; b=W+jRTWV7NokPhPmR4D6ZaIc7d+
	6G5q183dfVQDkUQv3dM9rgHEwlLdbjvG4v9XEZVPlO3vNFPc4PZzeubDoQBiYs+k+yHH5YvbpBryT
	twjOVSB1KRwqBOKEUPRoy8vgUpKdXpnNIWKeU53e+2AVB30wDQ9bblUoldB/fyIXRb4Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/HVM: allocate emulation cache entries dynamically
Message-Id: <E1tk0uA-00BSGd-12@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:11:22 +0000

commit dcac022fd932a844d1d9a22fe231cef939921945
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:19:04 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:19:04 2025 +0100

    x86/HVM: allocate emulation cache entries dynamically
    
    Both caches may need higher capacity, and the upper bound will need to
    be determined dynamically based on CPUID policy (for AMX'es TILELOAD /
    TILESTORE at least).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 23d60dbb0493b2f9ec1d89be5341eec2ee9dab32
    master date: 2025-01-24 10:15:29 +0100
---
 xen/arch/x86/hvm/emulate.c             | 51 ++++++++++++++++++++++++++--------
 xen/arch/x86/include/asm/hvm/emulate.h |  4 +++
 xen/arch/x86/include/asm/hvm/vcpu.h    | 13 +--------
 3 files changed, 44 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 10737533ba..5c84aff1dc 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -26,6 +26,18 @@
 #include <asm/iocap.h>
 #include <asm/vm_event.h>
 
+/*
+ * We may read or write up to m512 or up to a tile row as a number of
+ * device-model transactions.
+ */
+struct hvm_mmio_cache {
+    unsigned long gla;
+    unsigned int size;     /* Amount of buffer[] actually used. */
+    unsigned int space:31; /* Allocated size of buffer[]. */
+    unsigned int dir:1;
+    uint8_t buffer[] __aligned(sizeof(long));
+};
+
 struct hvmemul_cache
 {
     /* The cache is disabled as long as num_ents > max_ents. */
@@ -936,7 +948,7 @@ static int hvmemul_phys_mmio_access(
     }
 
     /* Accesses must not overflow the cache's buffer. */
-    if ( offset + size > sizeof(cache->buffer) )
+    if ( offset + size > cache->space )
     {
         ASSERT_UNREACHABLE();
         return X86EMUL_UNHANDLEABLE;
@@ -1012,7 +1024,7 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
 
     for ( i = 0; i < hvio->mmio_cache_count; i ++ )
     {
-        cache = &hvio->mmio_cache[i];
+        cache = hvio->mmio_cache[i];
 
         if ( gla == cache->gla &&
              dir == cache->dir )
@@ -1028,10 +1040,11 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
 
     ++hvio->mmio_cache_count;
 
-    cache = &hvio->mmio_cache[i];
-    memset(cache, 0, sizeof (*cache));
+    cache = hvio->mmio_cache[i];
+    memset(cache->buffer, 0, cache->space);
 
     cache->gla = gla;
+    cache->size = 0;
     cache->dir = dir;
 
     return cache;
@@ -2977,16 +2990,21 @@ void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
 int hvmemul_cache_init(struct vcpu *v)
 {
     /*
-     * No insn can access more than 16 independent linear addresses (AVX512F
-     * scatters/gathers being the worst). Each such linear range can span a
-     * page boundary, i.e. may require two page walks. Account for each insn
-     * byte individually, for simplicity.
+     * AVX512F scatter/gather insns can access up to 16 independent linear
+     * addresses, up to 8 bytes size. Each such linear range can span a page
+     * boundary, i.e. may require two page walks.
+     */
+    unsigned int nents = 16 * 2 * (CONFIG_PAGING_LEVELS + 1);
+    unsigned int i, max_bytes = 64;
+    struct hvmemul_cache *cache;
+
+    /*
+     * Account for each insn byte individually, both for simplicity and to
+     * leave some slack space.
      */
-    const unsigned int nents = (CONFIG_PAGING_LEVELS + 1) *
-                               (MAX_INST_LEN + 16 * 2);
-    struct hvmemul_cache *cache = xmalloc_flex_struct(struct hvmemul_cache,
-                                                      ents, nents);
+    nents += MAX_INST_LEN * (CONFIG_PAGING_LEVELS + 1);
 
+    cache = xmalloc_flex_struct(struct hvmemul_cache, ents, nents);
     if ( !cache )
         return -ENOMEM;
 
@@ -2996,6 +3014,15 @@ int hvmemul_cache_init(struct vcpu *v)
 
     v->arch.hvm.hvm_io.cache = cache;
 
+    for ( i = 0; i < ARRAY_SIZE(v->arch.hvm.hvm_io.mmio_cache); ++i )
+    {
+        v->arch.hvm.hvm_io.mmio_cache[i] =
+            xmalloc_flex_struct(struct hvm_mmio_cache, buffer, max_bytes);
+        if ( !v->arch.hvm.hvm_io.mmio_cache[i] )
+            return -ENOMEM;
+        v->arch.hvm.hvm_io.mmio_cache[i]->space = max_bytes;
+    }
+
     return 0;
 }
 
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index 29d679442e..2e1eedefa7 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -119,6 +119,10 @@ int hvmemul_do_pio_buffer(uint16_t port,
 int __must_check hvmemul_cache_init(struct vcpu *v);
 static inline void hvmemul_cache_destroy(struct vcpu *v)
 {
+    unsigned int i;
+
+    for ( i = 0; i < ARRAY_SIZE(v->arch.hvm.hvm_io.mmio_cache); ++i )
+        XFREE(v->arch.hvm.hvm_io.mmio_cache[i]);
     XFREE(v->arch.hvm.hvm_io.cache);
 }
 bool hvmemul_read_cache(const struct vcpu *v, paddr_t gpa,
diff --git a/xen/arch/x86/include/asm/hvm/vcpu.h b/xen/arch/x86/include/asm/hvm/vcpu.h
index 64c7a6fede..ddf9f8b831 100644
--- a/xen/arch/x86/include/asm/hvm/vcpu.h
+++ b/xen/arch/x86/include/asm/hvm/vcpu.h
@@ -22,17 +22,6 @@ struct hvm_vcpu_asid {
     uint32_t asid;
 };
 
-/*
- * We may read or write up to m512 as a number of device-model
- * transactions.
- */
-struct hvm_mmio_cache {
-    unsigned long gla;
-    unsigned int size;
-    uint8_t dir;
-    uint8_t buffer[64] __aligned(sizeof(long));
-};
-
 struct hvm_vcpu_io {
     /*
      * HVM emulation:
@@ -48,7 +37,7 @@ struct hvm_vcpu_io {
      * We may need to handle up to 3 distinct memory accesses per
      * instruction.
      */
-    struct hvm_mmio_cache mmio_cache[3];
+    struct hvm_mmio_cache *mmio_cache[3];
     unsigned int mmio_cache_count;
 
     /* For retries we shouldn't re-fetch the instruction. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890412.1299497 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0uL-0004II-GD; Mon, 17 Feb 2025 13:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890412.1299497; Mon, 17 Feb 2025 13: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 1tk0uL-0004IA-DJ; Mon, 17 Feb 2025 13:11:33 +0000
Received: by outflank-mailman (input) for mailman id 890412;
 Mon, 17 Feb 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 1tk0uK-0004Hw-Go
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0uK-006pXM-2K
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0uK-00BSIj-1P
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=Nn7Nruusn9stPNC3qRzb+V2amK3sUGRYh6/WmZkpv3E=; b=wR77GEzSUnW3TeBTMAlIqag+t5
	xdUH1fRBA4fznvj4QknejAWy8ZA2hllvZmgk6qXkFJl07j5nX7Ffw73KSzM+aWeLTmREnRcipptFM
	qiZJ3wzVzuE7/ZWKeqSek9ODZVA9KwRHfLLXOWgfPgNDVc1+QtcnQj0trzH0s2eugJ+s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/HVM: correct read/write split at page boundaries
Message-Id: <E1tk0uK-00BSIj-1P@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:11:32 +0000

commit e990bf3de5fafd1414c0091c1066ce1463b01c1d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:19:51 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:19:51 2025 +0100

    x86/HVM: correct read/write split at page boundaries
    
    The MMIO cache is intended to have one entry used per independent memory
    access that an insn does. This, in particular, is supposed to be
    ignoring any page boundary crossing. Therefore when looking up a cache
    entry, the access'es starting (linear) address is relevant, not the one
    possibly advanced past a page boundary.
    
    In order for the same offset-into-buffer variable to be usable in
    hvmemul_phys_mmio_access() for both the caller's buffer and the cache
    entry's it is further necessary to have the un-adjusted caller buffer
    passed into there.
    
    Fixes: 2d527ba310dc ("x86/hvm: split all linear reads and writes at page boundary")
    Reported-by: Manuel Andreas <manuel.andreas@tum.de>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 672894a11fe06e664a0ebfb600baf5dbb897b9e4
    master date: 2025-01-24 10:15:56 +0100
---
 xen/arch/x86/hvm/emulate.c | 92 ++++++++++++++++++++++++++++++----------------
 1 file changed, 61 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 5c84aff1dc..fb4de6ee0a 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -31,8 +31,9 @@
  * device-model transactions.
  */
 struct hvm_mmio_cache {
-    unsigned long gla;
-    unsigned int size;     /* Amount of buffer[] actually used. */
+    unsigned long gla;     /* Start of original access (e.g. insn operand). */
+    unsigned int skip;     /* Offset to start of MMIO */
+    unsigned int size;     /* Amount of buffer[] actually used, incl @skip. */
     unsigned int space:31; /* Allocated size of buffer[]. */
     unsigned int dir:1;
     uint8_t buffer[] __aligned(sizeof(long));
@@ -954,6 +955,13 @@ static int hvmemul_phys_mmio_access(
         return X86EMUL_UNHANDLEABLE;
     }
 
+    /* Accesses must not be to the unused leading space. */
+    if ( offset < cache->skip )
+    {
+        ASSERT_UNREACHABLE();
+        return X86EMUL_UNHANDLEABLE;
+    }
+
     /*
      * hvmemul_do_io() cannot handle non-power-of-2 accesses or
      * accesses larger than sizeof(long), so choose the highest power
@@ -1011,13 +1019,15 @@ static int hvmemul_phys_mmio_access(
 
 /*
  * Multi-cycle MMIO handling is based upon the assumption that emulation
- * of the same instruction will not access the same MMIO region more
- * than once. Hence we can deal with re-emulation (for secondary or
- * subsequent cycles) by looking up the result or previous I/O in a
- * cache indexed by linear MMIO address.
+ * of the same instruction will not access the exact same MMIO region
+ * more than once in exactly the same way (if it does, the accesses will
+ * be "folded"). Hence we can deal with re-emulation (for secondary or
+ * subsequent cycles) by looking up the result of previous I/O in a cache
+ * indexed by linear address and access type.
  */
 static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
-    struct hvm_vcpu_io *hvio, unsigned long gla, uint8_t dir, bool create)
+    struct hvm_vcpu_io *hvio, unsigned long gla, uint8_t dir,
+    unsigned int skip)
 {
     unsigned int i;
     struct hvm_mmio_cache *cache;
@@ -1031,7 +1041,11 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
             return cache;
     }
 
-    if ( !create )
+    /*
+     * Bail if a new entry shouldn't be allocated, relying on ->space having
+     * the same value for all entries.
+     */
+    if ( skip >= hvio->mmio_cache[0]->space )
         return NULL;
 
     i = hvio->mmio_cache_count;
@@ -1044,7 +1058,8 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
     memset(cache->buffer, 0, cache->space);
 
     cache->gla = gla;
-    cache->size = 0;
+    cache->skip = skip;
+    cache->size = skip;
     cache->dir = dir;
 
     return cache;
@@ -1065,12 +1080,14 @@ static void latch_linear_to_phys(struct hvm_vcpu_io *hvio, unsigned long gla,
 
 static int hvmemul_linear_mmio_access(
     unsigned long gla, unsigned int size, uint8_t dir, void *buffer,
-    uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt, bool known_gpfn)
+    uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt,
+    unsigned long start_gla, bool known_gpfn)
 {
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned long offset = gla & ~PAGE_MASK;
-    struct hvm_mmio_cache *cache = hvmemul_find_mmio_cache(hvio, gla, dir, true);
-    unsigned int chunk, buffer_offset = 0;
+    unsigned int chunk, buffer_offset = gla - start_gla;
+    struct hvm_mmio_cache *cache = hvmemul_find_mmio_cache(hvio, start_gla,
+                                                           dir, buffer_offset);
     paddr_t gpa;
     unsigned long one_rep = 1;
     int rc;
@@ -1118,19 +1135,19 @@ static int hvmemul_linear_mmio_access(
 static inline int hvmemul_linear_mmio_read(
     unsigned long gla, unsigned int size, void *buffer,
     uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt,
-    bool translate)
+    unsigned long start_gla, bool translate)
 {
-    return hvmemul_linear_mmio_access(gla, size, IOREQ_READ, buffer,
-                                      pfec, hvmemul_ctxt, translate);
+    return hvmemul_linear_mmio_access(gla, size, IOREQ_READ, buffer, pfec,
+                                      hvmemul_ctxt, start_gla, translate);
 }
 
 static inline int hvmemul_linear_mmio_write(
     unsigned long gla, unsigned int size, void *buffer,
     uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt,
-    bool translate)
+    unsigned long start_gla, bool translate)
 {
-    return hvmemul_linear_mmio_access(gla, size, IOREQ_WRITE, buffer,
-                                      pfec, hvmemul_ctxt, translate);
+    return hvmemul_linear_mmio_access(gla, size, IOREQ_WRITE, buffer, pfec,
+                                      hvmemul_ctxt, start_gla, translate);
 }
 
 static bool known_gla(unsigned long addr, unsigned int bytes, uint32_t pfec)
@@ -1159,7 +1176,10 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
 {
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
+    void *buffer = p_data;
+    unsigned long start = addr;
     unsigned int offset = addr & ~PAGE_MASK;
+    const struct hvm_mmio_cache *cache;
     int rc;
 
     if ( offset + bytes > PAGE_SIZE )
@@ -1183,8 +1203,17 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
      * an access that was previously handled as MMIO. Thus it is imperative that
      * we handle this access in the same way to guarantee completion and hence
      * clean up any interim state.
+     *
+     * Care must be taken, however, to correctly deal with crossing RAM/MMIO or
+     * MMIO/RAM boundaries. While we want to use a single cache entry (tagged
+     * by the starting linear address), we need to continue issuing (i.e. also
+     * upon replay) the RAM access for anything that's ahead of or past MMIO,
+     * i.e. in RAM.
      */
-    if ( !hvmemul_find_mmio_cache(hvio, addr, IOREQ_READ, false) )
+    cache = hvmemul_find_mmio_cache(hvio, start, IOREQ_READ, ~0);
+    if ( !cache ||
+         addr + bytes <= start + cache->skip ||
+         addr >= start + cache->size )
         rc = hvm_copy_from_guest_linear(p_data, addr, bytes, pfec, &pfinfo);
 
     switch ( rc )
@@ -1200,8 +1229,8 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
         if ( pfec & PFEC_insn_fetch )
             return X86EMUL_UNHANDLEABLE;
 
-        return hvmemul_linear_mmio_read(addr, bytes, p_data, pfec,
-                                        hvmemul_ctxt,
+        return hvmemul_linear_mmio_read(addr, bytes, buffer, pfec,
+                                        hvmemul_ctxt, start,
                                         known_gla(addr, bytes, pfec));
 
     case HVMTRANS_gfn_paged_out:
@@ -1218,7 +1247,10 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 {
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
+    void *buffer = p_data;
+    unsigned long start = addr;
     unsigned int offset = addr & ~PAGE_MASK;
+    const struct hvm_mmio_cache *cache;
     int rc;
 
     if ( offset + bytes > PAGE_SIZE )
@@ -1237,13 +1269,11 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 
     rc = HVMTRANS_bad_gfn_to_mfn;
 
-    /*
-     * If there is an MMIO cache entry for the access then we must be re-issuing
-     * an access that was previously handled as MMIO. Thus it is imperative that
-     * we handle this access in the same way to guarantee completion and hence
-     * clean up any interim state.
-     */
-    if ( !hvmemul_find_mmio_cache(hvio, addr, IOREQ_WRITE, false) )
+    /* See commentary in linear_read(). */
+    cache = hvmemul_find_mmio_cache(hvio, start, IOREQ_WRITE, ~0);
+    if ( !cache ||
+         addr + bytes <= start + cache->skip ||
+         addr >= start + cache->size )
         rc = hvm_copy_to_guest_linear(addr, p_data, bytes, pfec, &pfinfo);
 
     switch ( rc )
@@ -1256,8 +1286,8 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
         return X86EMUL_EXCEPTION;
 
     case HVMTRANS_bad_gfn_to_mfn:
-        return hvmemul_linear_mmio_write(addr, bytes, p_data, pfec,
-                                         hvmemul_ctxt,
+        return hvmemul_linear_mmio_write(addr, bytes, buffer, pfec,
+                                         hvmemul_ctxt, start,
                                          known_gla(addr, bytes, pfec));
 
     case HVMTRANS_gfn_paged_out:
@@ -1644,7 +1674,7 @@ static int cf_check hvmemul_cmpxchg(
     {
         /* 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,
+                                         hvmemul_ctxt, addr,
                                          hvio->mmio_access.write_access &&
                                          hvio->mmio_gla == (addr & PAGE_MASK));
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:11:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890416.1299501 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0uV-0004PJ-HW; Mon, 17 Feb 2025 13:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890416.1299501; Mon, 17 Feb 2025 13: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 1tk0uV-0004PB-Ex; Mon, 17 Feb 2025 13:11:43 +0000
Received: by outflank-mailman (input) for mailman id 890416;
 Mon, 17 Feb 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 1tk0uU-0004Oy-KE
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0uU-006pXQ-2g
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0uU-00BSMZ-1m
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=zk6VbIq8UGhX0OfOCZxoyzsCi9nHtkpihtbPfJBSGyo=; b=Kge58MfTDTGre5g4pvnpc9n4j3
	Sn9J5FMLdaTR1rD/wLnemeoahqJwsQkToXmY5ZRpnfvAS5rWsFwjXAz66B32Pxj7LNZpZiUsxHJC1
	W1UyOjxXWWozYD+/b4dG2U0cnyh7BzvGW2+BysDt3CJIZTiAzk3THyeRs33cCL0p2JbA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/iommu: check for CMPXCHG16B when enabling IOMMU
Message-Id: <E1tk0uU-00BSMZ-1m@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:11:42 +0000

commit 49c3324f3737fbdfdbfeab7a682f3c4665a732ce
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Mon Feb 17 13:20:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:20:14 2025 +0100

    x86/iommu: check for CMPXCHG16B when enabling IOMMU
    
    All hardware with VT-d/AMD-Vi has CMPXCHG16B support. Check this at
    initialisation time, and otherwise refuse to use the IOMMU.
    
    If the local APICs support x2APIC mode the IOMMU support for interrupt
    remapping will be checked earlier using a specific helper.  If no support
    for CX16 is detected by that earlier hook disable the IOMMU at that point
    and prevent further poking for CX16 later in the boot process, which would
    also fail.
    
    There's a possible corner case when running virtualized, and the underlying
    hypervisor exposing an IOMMU but no CMPXCHG16B support.  In which case
    ignoring the IOMMU is fine, albeit the most natural would be for the
    underlying hypervisor to also expose CMPXCHG16B support if an IOMMU is
    available to the VM.
    
    Note this change only introduces the checks, but doesn't remove the now
    stale checks for CX16 support sprinkled in the IOMMU code.  Further changes
    will take care of that.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2636fcdc15c707d5e097770133f0afb69e8d70c9
    master date: 2025-01-27 13:05:11 +0100
---
 xen/drivers/passthrough/amd/iommu_intr.c    | 13 +++++++++++++
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  6 ++++++
 xen/drivers/passthrough/vtd/intremap.c      | 13 +++++++++++++
 xen/drivers/passthrough/vtd/iommu.c         |  7 +++++++
 4 files changed, 39 insertions(+)

diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index 7fc796dec2..f07fd9e3d9 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -649,6 +649,19 @@ bool __init cf_check iov_supports_xt(void)
     if ( !iommu_enable || !iommu_intremap )
         return false;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        AMD_IOMMU_ERROR("no CMPXCHG16B support, disabling IOMMU\n");
+        /*
+         * Disable IOMMU support at once: there's no reason to check for CX16
+         * yet again when attempting to initialize IOMMU DMA remapping
+         * functionality or interrupt remapping without x2APIC support.
+         */
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+        return false;
+    }
+
     if ( amd_iommu_prepare(true) )
         return false;
 
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 73dcc4a2dd..f96f59440b 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -309,6 +309,12 @@ static int __init cf_check iov_detect(void)
     if ( !iommu_enable && !iommu_intremap )
         return 0;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        AMD_IOMMU_ERROR("no CMPXCHG16B support, disabling IOMMU\n");
+        return -ENODEV;
+    }
+
     if ( (init_done ? amd_iommu_init_late()
                     : amd_iommu_init(false)) != 0 )
     {
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index c504852eb8..233db5cb64 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -150,6 +150,19 @@ bool __init cf_check intel_iommu_supports_eim(void)
     if ( !iommu_qinval || !iommu_intremap || list_empty(&acpi_drhd_units) )
         return false;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        printk(XENLOG_ERR VTDPREFIX "no CMPXCHG16B support, disabling IOMMU\n");
+        /*
+         * Disable IOMMU support at once: there's no reason to check for CX16
+         * yet again when attempting to initialize IOMMU DMA remapping
+         * functionality or interrupt remapping without x2APIC support.
+         */
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+        return false;
+    }
+
     /* We MUST have a DRHD unit for each IOAPIC. */
     for ( apic = 0; apic < nr_ioapics; apic++ )
         if ( !ioapic_to_drhd(IO_APIC_ID(apic)) )
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index e13be244c1..ab38bbc8a5 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2630,6 +2630,13 @@ static int __init cf_check vtd_setup(void)
     int ret;
     bool reg_inval_supported = true;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        printk(XENLOG_ERR VTDPREFIX "no CMPXCHG16B support, disabling IOMMU\n");
+        ret = -ENODEV;
+        goto error;
+    }
+
     if ( list_empty(&acpi_drhd_units) )
     {
         ret = -ENODEV;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:11:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890417.1299505 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0uf-0004Uj-Ks; Mon, 17 Feb 2025 13:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890417.1299505; Mon, 17 Feb 2025 13: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 1tk0uf-0004Ub-ID; Mon, 17 Feb 2025 13:11:53 +0000
Received: by outflank-mailman (input) for mailman id 890417;
 Mon, 17 Feb 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 1tk0ue-0004UT-PO
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0ue-006pXU-39
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0ue-00BSOf-26
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=PZ/3RNooFK4Pw+lloCy2AKZ4SD/M8/P2QJkka/w2+kc=; b=WZO22MZmhWpnxn/dX497ExM9R+
	msNmruaz/l5+oX5DhhMp8LKJMgZQpV8A/UBwA5av/lklGw0ZfkFlbUp9sOc/iNc2lO0XhqDRENHz2
	k+Yebxo5JJyMfn8mjMr+Vh92bdB0qjsM3laXygAAD0Q26+7PAZogvVzN/fEeRjyqr47c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] iommu/amd: atomically update IRTE
Message-Id: <E1tk0ue-00BSOf-26@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:11:52 +0000

commit 457b9e11fa131f3a9f376aed3e00f0d16d6ea7c7
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:20:38 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:20:38 2025 +0100

    iommu/amd: atomically update IRTE
    
    Either when using a 32bit Interrupt Remapping Entry or a 128bit one update
    the entry atomically, by using cmpxchg unconditionally as IOMMU depends on
    it.  No longer disable the entry by setting RemapEn = 0 ahead of updating
    it.  As a consequence of not toggling RemapEn ahead of the update the
    Interrupt Remapping Table needs to be flushed after the entry update.
    
    This avoids a window where the IRTE has RemapEn = 0, which can lead to
    IO_PAGE_FAULT if the underlying interrupt source is not masked.
    
    There's no guidance in AMD-Vi specification about how IRTE update should be
    performed as opposed to DTE updating which has specific guidance.  However
    DTE updating claims that reads will always be at least 128bits in size, and
    hence for the purposes here assume that reads and caching of the IRTE
    entries in either 32 or 128 bit format will be done atomically from
    the IOMMU.
    
    Note that as part of introducing a new raw128 field in the IRTE struct, the
    current raw field is renamed to raw64 to explicitly contain the size in the
    field name.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: b953a99da98d63a7c827248abc450d4e8e015ab6
    master date: 2025-01-27 13:05:11 +0100
---
 xen/drivers/passthrough/amd/iommu_intr.c | 75 ++++++++++++++------------------
 1 file changed, 32 insertions(+), 43 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index f07fd9e3d9..c0273059cb 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -39,7 +39,8 @@ union irte32 {
 };
 
 union irte128 {
-    uint64_t raw[2];
+    uint64_t raw64[2];
+    __uint128_t raw128;
     struct {
         bool remap_en:1;
         bool sup_io_pf:1;
@@ -187,7 +188,7 @@ static void free_intremap_entry(const struct amd_iommu *iommu,
 
     if ( iommu->ctrl.ga_en )
     {
-        ACCESS_ONCE(entry.ptr128->raw[0]) = 0;
+        ACCESS_ONCE(entry.ptr128->raw64[0]) = 0;
         /*
          * Low half (containing RemapEn) needs to be cleared first.  Note that
          * strictly speaking smp_wmb() isn't enough, as conceptually it expands
@@ -197,7 +198,7 @@ static void free_intremap_entry(const struct amd_iommu *iommu,
          * variant will do.
          */
         smp_wmb();
-        entry.ptr128->raw[1] = 0;
+        entry.ptr128->raw64[1] = 0;
     }
     else
         ACCESS_ONCE(entry.ptr32->raw) = 0;
@@ -212,7 +213,7 @@ static void update_intremap_entry(const struct amd_iommu *iommu,
 {
     if ( iommu->ctrl.ga_en )
     {
-        union irte128 irte = {
+        const union irte128 irte = {
             .full = {
                 .remap_en = true,
                 .int_type = int_type,
@@ -222,19 +223,26 @@ static void update_intremap_entry(const struct amd_iommu *iommu,
                 .vector = vector,
             },
         };
+        __uint128_t old = entry.ptr128->raw128;
+        __uint128_t res = cmpxchg16b(&entry.ptr128->raw128, &old,
+                                     &irte.raw128);
 
-        ASSERT(!entry.ptr128->full.remap_en);
-        entry.ptr128->raw[1] = irte.raw[1];
         /*
-         * High half needs to be set before low one (containing RemapEn).  See
-         * comment in free_intremap_entry() regarding the choice of barrier.
+         * Hardware does not update the IRTE behind our backs, so the return
+         * value should match "old".
          */
-        smp_wmb();
-        ACCESS_ONCE(entry.ptr128->raw[0]) = irte.raw[0];
+        if ( res != old )
+        {
+            printk(XENLOG_ERR
+                   "unexpected IRTE %016lx_%016lx (expected %016lx_%016lx)\n",
+                   (uint64_t)(res >> 64), (uint64_t)res,
+                   (uint64_t)(old >> 64), (uint64_t)old);
+            ASSERT_UNREACHABLE();
+        }
     }
     else
     {
-        union irte32 irte = {
+        const union irte32 irte = {
             .flds = {
                 .remap_en = true,
                 .int_type = int_type,
@@ -299,21 +307,13 @@ static int update_intremap_entry_from_ioapic(
 
     entry = get_intremap_entry(iommu, req_id, offset);
 
-    /* The RemapEn fields match for all formats. */
-    while ( iommu->enabled && entry.ptr32->flds.remap_en )
-    {
-        entry.ptr32->flds.remap_en = false;
-        spin_unlock(lock);
-
-        amd_iommu_flush_intremap(iommu, req_id);
-
-        spin_lock(lock);
-    }
-
     update_intremap_entry(iommu, entry, vector, delivery_mode, dest_mode, dest);
 
     spin_unlock_irqrestore(lock, flags);
 
+    if ( !fresh )
+        amd_iommu_flush_intremap(iommu, req_id);
+
     set_rte_index(rte, offset);
 
     return 0;
@@ -322,7 +322,7 @@ static int update_intremap_entry_from_ioapic(
 void cf_check amd_iommu_ioapic_update_ire(
     unsigned int apic, unsigned int pin, uint64_t rte)
 {
-    struct IO_APIC_route_entry old_rte, new_rte;
+    struct IO_APIC_route_entry new_rte;
     int seg, bdf, rc;
     struct amd_iommu *iommu;
     unsigned int idx;
@@ -346,14 +346,6 @@ void cf_check amd_iommu_ioapic_update_ire(
         return;
     }
 
-    old_rte = __ioapic_read_entry(apic, pin, true);
-    /* mask the interrupt while we change the intremap table */
-    if ( !old_rte.mask )
-    {
-        old_rte.mask = 1;
-        __ioapic_write_entry(apic, pin, true, old_rte);
-    }
-
     /* Update interrupt remapping entry */
     rc = update_intremap_entry_from_ioapic(
              bdf, iommu, &new_rte,
@@ -425,6 +417,7 @@ static int update_intremap_entry_from_msi_msg(
     uint8_t delivery_mode, vector, dest_mode;
     spinlock_t *lock;
     unsigned int dest, offset, i;
+    bool fresh = false;
 
     req_id = get_dma_requestor_id(iommu->seg, bdf);
     alias_id = get_intremap_requestor_id(iommu->seg, bdf);
@@ -468,26 +461,21 @@ static int update_intremap_entry_from_msi_msg(
             return -ENOSPC;
         }
         *remap_index = offset;
+        fresh = true;
     }
 
     entry = get_intremap_entry(iommu, req_id, offset);
 
-    /* The RemapEn fields match for all formats. */
-    while ( iommu->enabled && entry.ptr32->flds.remap_en )
-    {
-        entry.ptr32->flds.remap_en = false;
-        spin_unlock(lock);
+    update_intremap_entry(iommu, entry, vector, delivery_mode, dest_mode, dest);
+    spin_unlock_irqrestore(lock, flags);
 
+    if ( !fresh )
+    {
         amd_iommu_flush_intremap(iommu, req_id);
         if ( alias_id != req_id )
             amd_iommu_flush_intremap(iommu, alias_id);
-
-        spin_lock(lock);
     }
 
-    update_intremap_entry(iommu, entry, vector, delivery_mode, dest_mode, dest);
-    spin_unlock_irqrestore(lock, flags);
-
     *data = (msg->data & ~(INTREMAP_MAX_ENTRIES - 1)) | offset;
 
     /*
@@ -735,7 +723,7 @@ static void dump_intremap_table(const struct amd_iommu *iommu,
     for ( count = 0; count < nr; count++ )
     {
         if ( iommu->ctrl.ga_en
-             ? !tbl.ptr128[count].raw[0] && !tbl.ptr128[count].raw[1]
+             ? !tbl.ptr128[count].raw64[0] && !tbl.ptr128[count].raw64[1]
              : !tbl.ptr32[count].raw )
                 continue;
 
@@ -748,7 +736,8 @@ static void dump_intremap_table(const struct amd_iommu *iommu,
 
         if ( iommu->ctrl.ga_en )
             printk("    IRTE[%03x] %016lx_%016lx\n",
-                   count, tbl.ptr128[count].raw[1], tbl.ptr128[count].raw[0]);
+                   count, tbl.ptr128[count].raw64[1],
+                   tbl.ptr128[count].raw64[0]);
         else
             printk("    IRTE[%03x] %08x\n", count, tbl.ptr32[count].raw);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:12:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890421.1299508 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0up-0004ZM-MR; Mon, 17 Feb 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 890421.1299508; Mon, 17 Feb 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 1tk0up-0004ZE-Jk; Mon, 17 Feb 2025 13:12:03 +0000
Received: by outflank-mailman (input) for mailman id 890421;
 Mon, 17 Feb 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 1tk0uo-0004Z8-S1
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0up-006paF-0E
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0uo-00BSR7-2c
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=XmdsQDGicJyB1tmlbyu8sRZy5GfXb9z2HARdLn8GOoI=; b=eCtvjLInrEXYq71LKVCd976Hoz
	FayNIKG/xsu5CPVglyOzF6EAX12NUa9diHezdDuc/+32kd2P7I7U9kVYXlsFLSTL/d192mALW+5PA
	qtKKIB3D5aQ6ifUE9ErrgyyculLrHqyHyeWts6GyotPVqc1jgCynziYJF754GXM3mlVg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86emul: further correct 64-bit mode zero count repeated string insn handling
Message-Id: <E1tk0uo-00BSR7-2c@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:12:02 +0000

commit b7b0ce5e11203bb81f99b1f05956cd766f55e802
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:21:00 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:21:00 2025 +0100

    x86emul: further correct 64-bit mode zero count repeated string insn handling
    
    In an entirely different context I came across Linux commit 428e3d08574b
    ("KVM: x86: Fix zero iterations REP-string"), which points out that
    we're still doing things wrong: For one, there's no zero-extension at
    all on AMD. And then while RCX is zero-extended from 32 bits uniformly
    for all string instructions on newer hardware, RSI/RDI are only for MOVS
    and STOS on the systems I have access to. (On an old family 0xf system
    I've further found that for REP LODS even RCX is not zero-extended.)
    
    While touching the lines anyway, replace two casts in get_rep_prefix().
    
    Fixes: 79e996a89f69 ("x86emul: correct 64-bit mode repeated string insn handling with zero count")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 5310a042c4e3135c471446c8253ad13250539957
    master date: 2025-01-27 15:23:19 +0100
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 31475208d1..3d837f7e9e 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -513,7 +513,7 @@ static inline void put_loop_count(
         regs->r(cx) = ad_bytes == 4 ? (uint32_t)count : count;
 }
 
-#define get_rep_prefix(using_si, using_di) ({                           \
+#define get_rep_prefix(extend_si, extend_di) ({                         \
     unsigned long max_reps = 1;                                         \
     if ( rep_prefix() )                                                 \
         max_reps = get_loop_count(&_regs, ad_bytes);                    \
@@ -521,14 +521,14 @@ static inline void put_loop_count(
     {                                                                   \
         /*                                                              \
          * Skip the instruction if no repetitions are required, but     \
-         * zero extend involved registers first when using 32-bit       \
+         * zero extend relevant registers first when using 32-bit       \
          * addressing in 64-bit mode.                                   \
          */                                                             \
-        if ( mode_64bit() && ad_bytes == 4 )                            \
+        if ( !amd_like(ctxt) && mode_64bit() && ad_bytes == 4 )         \
         {                                                               \
             _regs.r(cx) = 0;                                            \
-            if ( using_si ) _regs.r(si) = (uint32_t)_regs.r(si);        \
-            if ( using_di ) _regs.r(di) = (uint32_t)_regs.r(di);        \
+            if ( extend_si ) _regs.r(si) = _regs.esi;                   \
+            if ( extend_di ) _regs.r(di) = _regs.edi;                   \
         }                                                               \
         goto complete_insn;                                             \
     }                                                                   \
@@ -1815,7 +1815,7 @@ x86_emulate(
         dst.bytes = !(b & 1) ? 1 : (op_bytes == 8) ? 4 : op_bytes;
         if ( (rc = ioport_access_check(port, dst.bytes, ctxt, ops)) != 0 )
             goto done;
-        nr_reps = get_rep_prefix(false, true);
+        nr_reps = get_rep_prefix(false, false /* don't extend RSI/RDI */);
         dst.mem.off = truncate_ea_and_reps(_regs.r(di), nr_reps, dst.bytes);
         dst.mem.seg = x86_seg_es;
         /* Try the presumably most efficient approach first. */
@@ -1857,7 +1857,7 @@ x86_emulate(
         dst.bytes = !(b & 1) ? 1 : (op_bytes == 8) ? 4 : op_bytes;
         if ( (rc = ioport_access_check(port, dst.bytes, ctxt, ops)) != 0 )
             goto done;
-        nr_reps = get_rep_prefix(true, false);
+        nr_reps = get_rep_prefix(false, false /* don't extend RSI/RDI */);
         ea.mem.off = truncate_ea_and_reps(_regs.r(si), nr_reps, dst.bytes);
         /* Try the presumably most efficient approach first. */
         if ( !ops->rep_outs )
@@ -2194,7 +2194,7 @@ x86_emulate(
     case 0xa6 ... 0xa7: /* cmps */ {
         unsigned long next_eip = _regs.r(ip);
 
-        get_rep_prefix(true, true);
+        get_rep_prefix(false, false /* don't extend RSI/RDI */);
         src.bytes = dst.bytes = (d & ByteOp) ? 1 : op_bytes;
         if ( (rc = read_ulong(ea.mem.seg, truncate_ea(_regs.r(si)),
                               &dst.val, dst.bytes, ctxt, ops)) ||
@@ -2236,7 +2236,7 @@ x86_emulate(
     }
 
     case 0xac ... 0xad: /* lods */
-        get_rep_prefix(true, false);
+        get_rep_prefix(false, false /* don't extend RSI/RDI */);
         if ( (rc = read_ulong(ea.mem.seg, truncate_ea(_regs.r(si)),
                               &dst.val, dst.bytes, ctxt, ops)) != 0 )
             goto done;
@@ -2247,7 +2247,7 @@ x86_emulate(
     case 0xae ... 0xaf: /* scas */ {
         unsigned long next_eip = _regs.r(ip);
 
-        get_rep_prefix(false, true);
+        get_rep_prefix(false, false /* don't extend RSI/RDI */);
         if ( (rc = read_ulong(x86_seg_es, truncate_ea(_regs.r(di)),
                               &dst.val, src.bytes, ctxt, ops)) != 0 )
             goto done;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:12:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:12:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890422.1299512 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0uz-0004cV-Nc; Mon, 17 Feb 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 890422.1299512; Mon, 17 Feb 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 1tk0uz-0004cM-LC; Mon, 17 Feb 2025 13:12:13 +0000
Received: by outflank-mailman (input) for mailman id 890422;
 Mon, 17 Feb 2025 13: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 1tk0uy-0004cC-Ud
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0uz-006pab-0V
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0uy-00BSSp-2s
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=zEgSDIL7cw1lUYq0YM2IrMoKKKW3wOTfX+K4x8t9ecw=; b=wcghYZyCKz+DhKTr2JyhIFott0
	orXQr5y9guACb6ttH8Zl92b1xbPZeSpF8/EpC+dFNnhRKGXYOx5yI75CY6uGbpuEluGQOXLO27EC/
	plfj2l/5Gai9j0SdZmtSOGWxzOJ6N161mJwG76mj27jc3T3jPYKBsszt711g6kgizhOw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/PV: further harden guest memory accesses against speculative abuse
Message-Id: <E1tk0uy-00BSSp-2s@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:12:12 +0000

commit 125270d49dcc42c1249e0fb99abb8d33c9a8b439
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:21:30 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:21:30 2025 +0100

    x86/PV: further harden guest memory accesses against speculative abuse
    
    The original implementation has two issues: For one it doesn't preserve
    non-canonical-ness of inputs in the range 0x8000000000000000 through
    0x80007fffffffffff. Bogus guest pointers in that range would not cause a
    (#GP) fault upon access, when they should.
    
    And then there is an AMD-specific aspect, where only the low 48 bits of
    an address are used for speculative execution; the architecturally
    mandated #GP for non-canonical addresses would be raised at a later
    execution stage. Therefore to prevent Xen controlled data to make it
    into any of the caches in a guest controllable manner, we need to
    additionally ensure that for non-canonical inputs bit 47 would be clear.
    
    See the code comment for how addressing both is being achieved.
    
    Fixes: 4dc181599142 ("x86/PV: harden guest memory accesses against speculative abuse")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8306d773b03acec6062c0547ac05e3dd4a6960f6
    master date: 2025-01-27 15:23:59 +0100
---
 xen/arch/x86/include/asm/asm-defns.h | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/include/asm/asm-defns.h b/xen/arch/x86/include/asm/asm-defns.h
index d55dd3bbc3..32d6b44910 100644
--- a/xen/arch/x86/include/asm/asm-defns.h
+++ b/xen/arch/x86/include/asm/asm-defns.h
@@ -1,3 +1,5 @@
+#include <asm/page-bits.h>
+
 #ifndef HAVE_AS_CLAC_STAC
 .macro clac
     .byte 0x0f, 0x01, 0xca
@@ -65,17 +67,36 @@
 .macro guest_access_mask_ptr ptr:req, scratch1:req, scratch2:req
 #if defined(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS)
     /*
-     * Here we want
-     *
-     * ptr &= ~0ull >> (ptr < HYPERVISOR_VIRT_END);
-     *
+     * Here we want to adjust \ptr such that
+     * - if it's within Xen range, it becomes non-canonical,
+     * - otherwise if it's (non-)canonical on input, it retains that property,
+     * - if the result is non-canonical, bit 47 is clear (to avoid
+     *   potentially populating the cache with Xen data on AMD-like hardware),
      * but guaranteed without any conditional branches (hence in assembly).
+     *
+     * To achieve this we determine which bit to forcibly clear: Either bit 47
+     * (in case the address is below HYPERVISOR_VIRT_END) or bit 63.  Further
+     * we determine whether for forcably set bit 63: In case we first cleared
+     * it, we'll merely restore the original address.  In case we ended up
+     * clearing bit 47 (i.e. the address was either non-canonical or within Xen
+     * range), setting the bit will yield a guaranteed non-canonical address.
+     * If we didn't clear a bit, we also won't set one: The address was in the
+     * low half of address space in that case with bit 47 already clear.  The
+     * address can thus be left unchanged, whether canonical or not.
      */
     mov $(HYPERVISOR_VIRT_END - 1), \scratch1
-    mov $~0, \scratch2
+    mov $(VADDR_BITS - 1), \scratch2
     cmp \ptr, \scratch1
+    /*
+     * Not needed: The value we have in \scratch1 will be truncated to 6 bits,
+     * thus yielding the value we need.
+    mov $63, \scratch1
+     */
+    cmovnb \scratch2, \scratch1
+    xor \scratch2, \scratch2
+    btr \scratch1, \ptr
     rcr $1, \scratch2
-    and \scratch2, \ptr
+    or \scratch2, \ptr
 #elif defined(CONFIG_DEBUG) && defined(CONFIG_PV)
     xor $~\@, \scratch1
     xor $~\@, \scratch2
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:12:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:12:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890423.1299517 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0v9-0004fZ-PF; Mon, 17 Feb 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 890423.1299517; Mon, 17 Feb 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 1tk0v9-0004fR-Mc; Mon, 17 Feb 2025 13:12:23 +0000
Received: by outflank-mailman (input) for mailman id 890423;
 Mon, 17 Feb 2025 13: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 1tk0v9-0004fB-0v
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 13: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 1tk0v9-006paj-0l
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0v8-00BSVZ-38
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=0H2jdr7VwWKkOUluCFW6wqlVk/c/Ia/c043VA4lZL6A=; b=XYca7YDd62um9Qf3tJkOuBnMm3
	37MVu7ez1HDP2kX6xw9u/vtGvWlij+1GIbVNEB0Z52dGBGKBAZNGtQxZwyLr9amVkPtB4QMLrQhs4
	BZjxThcqkcvRsufuM75HsLvuTH2SIejvznjpARUOYCwW65v8ZZ3zua3Kx9lnXA7/k6pc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/intel: Fix PERF_GLOBAL fixup when virtualised
Message-Id: <E1tk0v8-00BSVZ-38@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:12:22 +0000

commit c4d4fc58b6f7f10655958e2fb07c702f4fdb0b0b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 17 13:21:50 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:21:50 2025 +0100

    x86/intel: Fix PERF_GLOBAL fixup when virtualised
    
    Logic using performance counters needs to look at
    MSR_MISC_ENABLE.PERF_AVAILABLE before touching any other resources.
    
    When virtualised under ESX, Xen dies with a #GP fault trying to read
    MSR_CORE_PERF_GLOBAL_CTRL.
    
    Factor this logic out into a separate function (it's already too squashed to
    the RHS), and insert a check of MSR_MISC_ENABLE.PERF_AVAILABLE.
    
    This also avoids setting X86_FEATURE_ARCH_PERFMON if MSR_MISC_ENABLE says that
    PERF is unavailable, although oprofile (the only consumer of this flag)
    cross-checks too.
    
    Fixes: 6bdb965178bb ("x86/intel: ensure Global Performance Counter Control is setup correctly")
    Reported-by: Jonathan Katz <jonathan.katz@aptar.com>
    Link: https://xcp-ng.org/forum/topic/10286/nesting-xcp-ng-on-esx-8
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Tested-by: Jonathan Katz <jonathan.katz@aptar.com>
    master commit: dd05d265b8abda4cc7206b29cd71b77fb46658bf
    master date: 2025-01-28 11:19:45 +0000
---
 xen/arch/x86/cpu/intel.c | 64 ++++++++++++++++++++++++++++--------------------
 1 file changed, 37 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index af56e57bd8..bb9c6220de 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -535,39 +535,49 @@ static void intel_log_freq(const struct cpuinfo_x86 *c)
     printk("%u MHz\n", (factor * max_ratio + 50) / 100);
 }
 
+static void init_intel_perf(struct cpuinfo_x86 *c)
+{
+    uint64_t val;
+    unsigned int eax, ver, nr_cnt;
+
+    if ( c->cpuid_level <= 9 ||
+         ({  rdmsrl(MSR_IA32_MISC_ENABLE, val);
+             !(val & MSR_IA32_MISC_ENABLE_PERF_AVAIL); }) )
+        return;
+
+    eax = cpuid_eax(10);
+    ver = eax & 0xff;
+    nr_cnt = (eax >> 8) & 0xff;
+
+    if ( ver && nr_cnt > 1 && nr_cnt <= 32 )
+    {
+        unsigned int cnt_mask = (1UL << nr_cnt) - 1;
+
+        /*
+         * On (some?) Sapphire/Emerald Rapids platforms each package-BSP
+         * starts with all the enable bits for the general-purpose PMCs
+         * cleared.  Adjust so counters can be enabled from EVNTSEL.
+         */
+        rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, val);
+
+        if ( (val & cnt_mask) != cnt_mask )
+        {
+            printk("FIRMWARE BUG: CPU%u invalid PERF_GLOBAL_CTRL: %#"PRIx64" adjusting to %#"PRIx64"\n",
+                   smp_processor_id(), val, val | cnt_mask);
+            wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, val | cnt_mask);
+        }
+
+        __set_bit(X86_FEATURE_ARCH_PERFMON, c->x86_capability);
+    }
+}
+
 static void cf_check init_intel(struct cpuinfo_x86 *c)
 {
 	/* Detect the extended topology information if available */
 	detect_extended_topology(c);
 
 	init_intel_cacheinfo(c);
-	if (c->cpuid_level > 9) {
-		unsigned eax = cpuid_eax(10);
-		unsigned int cnt = (eax >> 8) & 0xff;
-
-		/* Check for version and the number of counters */
-		if ((eax & 0xff) && (cnt > 1) && (cnt <= 32)) {
-			uint64_t global_ctrl;
-			unsigned int cnt_mask = (1UL << cnt) - 1;
-
-			/*
-			 * On (some?) Sapphire/Emerald Rapids platforms each
-			 * package-BSP starts with all the enable bits for the
-			 * general-purpose PMCs cleared.  Adjust so counters
-			 * can be enabled from EVNTSEL.
-			 */
-			rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, global_ctrl);
-			if ((global_ctrl & cnt_mask) != cnt_mask) {
-				printk("CPU%u: invalid PERF_GLOBAL_CTRL: %#"
-				       PRIx64 " adjusting to %#" PRIx64 "\n",
-				       smp_processor_id(), global_ctrl,
-				       global_ctrl | cnt_mask);
-				wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL,
-				       global_ctrl | cnt_mask);
-			}
-			__set_bit(X86_FEATURE_ARCH_PERFMON, c->x86_capability);
-		}
-	}
+	init_intel_perf(c);
 
 	if ( !cpu_has(c, X86_FEATURE_XTOPOLOGY) )
 	{
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:12:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:12:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890424.1299520 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0vJ-0004iT-QS; Mon, 17 Feb 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 890424.1299520; Mon, 17 Feb 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 1tk0vJ-0004iM-O1; Mon, 17 Feb 2025 13:12:33 +0000
Received: by outflank-mailman (input) for mailman id 890424;
 Mon, 17 Feb 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 1tk0vJ-0004i7-4R
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 13: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 1tk0vJ-006pb0-16
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0vJ-00BSYM-0B
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13: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=GNEh4GgruOnlJ2GIV00DAyFzPLwuL2OWz54OyDf5TLQ=; b=Pz7A75UnoeMPj7tD7YOktYAvPr
	B10/7+2+ye25NAT0cMAbrtQSHdC/AHBCQeIZhjvYfU8JlHyh6zUhopCiQjyASZXWfsBFCnmrpsk3K
	gOsIZIeWINAdZktNw4w1sm3oyfrLVWbWNpabARnBa1phR/eHWaJDOQKlPpR+ARwyLrpM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] radix-tree: purge node allocation override hooks
Message-Id: <E1tk0vJ-00BSYM-0B@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:12:33 +0000

commit ebc8b4a4508a0b84c3f3b31324f688dabb210093
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:22:24 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:22:24 2025 +0100

    radix-tree: purge node allocation override hooks
    
    These were needed by TMEM only, which is long gone. The Linux original
    doesn't have such either. This effectively reverts one of the "Other
    changes" from 8dc6738dbb3c ("Update radix-tree.[ch] from upstream Linux
    to gain RCU awareness").
    
    Positive side effect: Two cf_check go away.
    
    While there also convert xmalloc()+memset() to xzalloc().
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 1275093a96fed45057db241b3aa6e191d9dcf596
    master date: 2025-02-07 09:59:11 +0100
---
 xen/common/radix-tree.c      | 37 ++++++-------------------------------
 xen/include/xen/radix-tree.h | 10 ----------
 2 files changed, 6 insertions(+), 41 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index adc3034222..994a5a3b3d 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -52,12 +52,6 @@ struct rcu_node {
 	struct rcu_head rcu_head;
 };
 
-static struct radix_tree_node *cf_check rcu_node_alloc(void *arg)
-{
-	struct rcu_node *rcu_node = xmalloc(struct rcu_node);
-	return rcu_node ? &rcu_node->node : NULL;
-}
-
 static void cf_check _rcu_node_free(struct rcu_head *head)
 {
 	struct rcu_node *rcu_node =
@@ -65,26 +59,20 @@ static void cf_check _rcu_node_free(struct rcu_head *head)
 	xfree(rcu_node);
 }
 
-static void cf_check rcu_node_free(struct radix_tree_node *node, void *arg)
-{
-	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
-	call_rcu(&rcu_node->rcu_head, _rcu_node_free);
-}
-
 static struct radix_tree_node *radix_tree_node_alloc(
 	struct radix_tree_root *root)
 {
-	struct radix_tree_node *ret;
-	ret = root->node_alloc(root->node_alloc_free_arg);
-	if (ret)
-		memset(ret, 0, sizeof(*ret));
-	return ret;
+	struct rcu_node *rcu_node = xzalloc(struct rcu_node);
+
+	return rcu_node ? &rcu_node->node : NULL;
 }
 
 static void radix_tree_node_free(
 	struct radix_tree_root *root, struct radix_tree_node *node)
 {
-	root->node_free(node, root->node_alloc_free_arg);
+	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
+
+	call_rcu(&rcu_node->rcu_head, _rcu_node_free);
 }
 
 /*
@@ -717,19 +705,6 @@ void radix_tree_destroy(
 void radix_tree_init(struct radix_tree_root *root)
 {
 	memset(root, 0, sizeof(*root));
-	root->node_alloc = rcu_node_alloc;
-	root->node_free = rcu_node_free;
-}
-
-void radix_tree_set_alloc_callbacks(
-	struct radix_tree_root *root,
-	radix_tree_alloc_fn_t *node_alloc,
-	radix_tree_free_fn_t *node_free,
-	void *node_alloc_free_arg)
-{
-	root->node_alloc = node_alloc;
-	root->node_free = node_free;
-	root->node_alloc_free_arg = node_alloc_free_arg;
 }
 
 static __init unsigned long __maxindex(unsigned int height)
diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 58c40312e6..9d5ffae3eb 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -66,11 +66,6 @@ typedef void radix_tree_free_fn_t(struct radix_tree_node *, void *);
 struct radix_tree_root {
 	unsigned int		height;
 	struct radix_tree_node	__rcu *rnode;
-
-	/* Allow to specify custom node alloc/dealloc routines. */
-	radix_tree_alloc_fn_t *node_alloc;
-	radix_tree_free_fn_t *node_free;
-	void *node_alloc_free_arg;
 };
 
 /*
@@ -78,11 +73,6 @@ struct radix_tree_root {
  */
 
 void radix_tree_init(struct radix_tree_root *root);
-void radix_tree_set_alloc_callbacks(
-	struct radix_tree_root *root,
-	radix_tree_alloc_fn_t *node_alloc,
-	radix_tree_free_fn_t *node_free,
-	void *node_alloc_free_arg);
 
 void radix_tree_destroy(
 	struct radix_tree_root *root,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:12:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:12:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890425.1299525 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0vT-0004lY-TV; Mon, 17 Feb 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 890425.1299525; Mon, 17 Feb 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 1tk0vT-0004lO-Ql; Mon, 17 Feb 2025 13:12:43 +0000
Received: by outflank-mailman (input) for mailman id 890425;
 Mon, 17 Feb 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 1tk0vT-0004lH-7s
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0vT-006pb8-1S
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0vT-00BSdH-0X
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=l/urb0F0o2aKNUj+sbwxWGmEZAmkQNKoQWtKm9Gy1g0=; b=Rxc7z/IO7hDfYyKwqdhAcv8Z7P
	TYtQrtD9N+GTZVabFD4W/cBgHd4dPHWUhvQvjMQqEvfzQkHEO783SKJZ30ziA8OloSxypBdT+C5u3
	KYZ+1LBol0TzW66tunWLzjEnDz0K/jJqfkgGkU9uYf95S0xunaK+04E/8Y78UsKyA24o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] radix-tree: introduce RADIX_TREE{,_INIT}()
Message-Id: <E1tk0vT-00BSdH-0X@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:12:43 +0000

commit 46e3e9d7398303a12714cacf1e56c6da505cffec
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:23:00 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:23:00 2025 +0100

    radix-tree: introduce RADIX_TREE{,_INIT}()
    
    ... now that static initialization is possible. Use RADIX_TREE() for
    pci_segments and ivrs_maps.
    
    This then fixes an ordering issue on x86: With the call to
    radix_tree_init(), acpi_mmcfg_init()'s invocation of pci_segments_init()
    will zap the possible earlier introduction of segment 0 by
    amd_iommu_detect_one_acpi()'s call to pci_ro_device(), and thus the
    write-protection of the PCI devices representing AMD IOMMUs.
    
    Fixes: 3950f2485bbc ("x86/x2APIC: defer probe until after IOMMU ACPI table parsing")
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 26fe09e34566d701ecaea76b4563bb9934e85861
    master date: 2025-02-07 10:00:04 +0100
---
 xen/common/radix-tree.c                  | 2 +-
 xen/drivers/passthrough/amd/iommu_init.c | 3 +--
 xen/drivers/passthrough/pci.c            | 3 +--
 xen/include/xen/radix-tree.h             | 3 +++
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index 994a5a3b3d..ac4bfbd3f4 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -704,7 +704,7 @@ void radix_tree_destroy(
 
 void radix_tree_init(struct radix_tree_root *root)
 {
-	memset(root, 0, sizeof(*root));
+	*root = (struct radix_tree_root)RADIX_TREE_INIT();
 }
 
 static __init unsigned long __maxindex(unsigned int height)
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 6c0dc2d5cb..b546c28667 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -31,7 +31,7 @@ static struct tasklet amd_iommu_irq_tasklet;
 unsigned int __read_mostly amd_iommu_acpi_info;
 unsigned int __read_mostly ivrs_bdf_entries;
 u8 __read_mostly ivhd_type;
-static struct radix_tree_root ivrs_maps;
+static RADIX_TREE(ivrs_maps);
 LIST_HEAD_READ_MOSTLY(amd_iommu_head);
 bool iommuv2_enabled;
 
@@ -1410,7 +1410,6 @@ int __init amd_iommu_prepare(bool xt)
         goto error_out;
     ivrs_bdf_entries = rc;
 
-    radix_tree_init(&ivrs_maps);
     for_each_amd_iommu ( iommu )
     {
         rc = amd_iommu_prepare_one(iommu);
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index ae620b3007..c7ee835b8a 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -68,7 +68,7 @@ bool pcidevs_locked(void)
     return rspin_is_locked(&_pcidevs_lock);
 }
 
-static struct radix_tree_root pci_segments;
+static RADIX_TREE(pci_segments);
 
 static inline struct pci_seg *get_pseg(u16 seg)
 {
@@ -124,7 +124,6 @@ static int pci_segments_iterate(
 
 void __init pci_segments_init(void)
 {
-    radix_tree_init(&pci_segments);
     if ( !alloc_pseg(0) )
         panic("Could not initialize PCI segment 0\n");
 }
diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 9d5ffae3eb..4077365972 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -72,6 +72,9 @@ struct radix_tree_root {
  *** radix-tree API starts here **
  */
 
+#define RADIX_TREE_INIT() {}
+#define RADIX_TREE(name) struct radix_tree_root name = RADIX_TREE_INIT()
+
 void radix_tree_init(struct radix_tree_root *root);
 
 void radix_tree_destroy(
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:12:55 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:12:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890426.1299528 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0ve-0004oB-Un; Mon, 17 Feb 2025 13:12:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890426.1299528; Mon, 17 Feb 2025 13: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 1tk0ve-0004o3-SJ; Mon, 17 Feb 2025 13:12:54 +0000
Received: by outflank-mailman (input) for mailman id 890426;
 Mon, 17 Feb 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 1tk0vd-0004no-BO
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0vd-006pbC-1l
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0vd-00BSf7-0r
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=TMh8HFRJC5lw4Bld4VT/AxgpfGBRPQdut15r6zVj7Hk=; b=aB+0kqb/x2eEoWp4A7UUQHR6ld
	sgRPofdLTEOIcsO1YIy4IR8RlBQHaChtK3Gij17FI4NNzCp5d70ItVxZiHX2LDOgjPRsi/DU5C6dn
	c26SS8XYdgr7j2BGb5wC5JykccIpUbBLDMh/0I/9QyTQJq1BjDCCtp2F85KlVBLJv33w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/shutdown: offline APs with interrupts disabled on all CPUs
Message-Id: <E1tk0vd-00BSf7-0r@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:12:53 +0000

commit e801a86d5eb2ed62c30c35f1d39cdccdf8d860e8
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:23:27 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:23:27 2025 +0100

    x86/shutdown: offline APs with interrupts disabled on all CPUs
    
    The current shutdown logic in smp_send_stop() will disable the APs while
    having interrupts enabled on the BSP or possibly other APs. On AMD systems
    this can lead to local APIC errors:
    
    APIC error on CPU0: 00(08), Receive accept error
    
    Such error message can be printed in a loop, thus blocking the system from
    rebooting.  I assume this loop is created by the error being triggered by
    the console interrupt, which is further stirred by the ESR handler
    printing to the console.
    
    Intel SDM states:
    
    "Receive Accept Error.
    
    Set when the local APIC detects that the message it received was not
    accepted by any APIC on the APIC bus, including itself. Used only on P6
    family and Pentium processors."
    
    So the error shouldn't trigger on any Intel CPU supported by Xen.
    
    However AMD doesn't make such claims, and indeed the error is broadcast to
    all local APICs when an interrupt targets a CPU that's already offline.
    
    To prevent the error from stalling the shutdown process perform the
    disabling of APs and the BSP local APIC with interrupts disabled on all
    CPUs in the system, so that by the time interrupts are unmasked on the BSP
    the local APIC is already disabled.  This can still lead to a spurious:
    
    APIC error on CPU0: 00(00)
    
    As a result of an LVT Error getting injected while interrupts are masked on
    the CPU, and the vector only handled after the local APIC is already
    disabled.  ESR reports 0 because as part of disable_local_APIC() the ESR
    register is cleared.
    
    Note the NMI crash path doesn't have such issue, because disabling of APs
    and the caller local APIC is already done in the same contiguous region
    with interrupts disabled.  There's a possible window on the NMI crash path
    (nmi_shootdown_cpus()) where some APs might be disabled (and thus
    interrupts targeting them raising "Receive accept error") before others APs
    have interrupts disabled.  However the shutdown NMI will be handled,
    regardless of whether the AP is processing a local APIC error, and hence
    such interrupts will not cause the shutdown process to get stuck.
    
    Remove the call to fixup_irqs() in smp_send_stop(): it doesn't achieve the
    intended goal of moving all interrupts to the BSP anyway.  The logic in
    fixup_irqs() will move interrupts whose affinity doesn't overlap with the
    passed mask, but the movement of interrupts is done to any CPU set in
    cpu_online_map.  As in the shutdown path fixup_irqs() is called before APs
    are cleared from cpu_online_map this leads to interrupts being shuffled
    around, but not assigned to the BSP exclusively.
    
    The Fixes tag is more of a guess than a certainty; it's possible the
    previous sleep window in fixup_irqs() allowed any in-flight interrupt to be
    delivered before APs went offline.  However fixup_irqs() was still
    incorrectly used, as it didn't (and still doesn't) move all interrupts to
    target the provided cpu mask.
    
    Fixes: e2bb28d62158 ('x86/irq: forward pending interrupts to new destination in fixup_irqs()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1191ce954f64244a3c5f553116184928bcc677e8
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/smp.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 04c6a05723..bd92496d3d 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -343,6 +343,11 @@ void __stop_this_cpu(void)
 
 static void cf_check stop_this_cpu(void *dummy)
 {
+    const bool *stop_aps = dummy;
+
+    while ( !*stop_aps )
+        cpu_relax();
+
     __stop_this_cpu();
     for ( ; ; )
         halt();
@@ -355,16 +360,25 @@ static void cf_check stop_this_cpu(void *dummy)
 void smp_send_stop(void)
 {
     unsigned int cpu = smp_processor_id();
+    bool stop_aps = false;
+
+    /*
+     * Perform AP offlining and disabling of interrupt controllers with all
+     * CPUs on the system having interrupts disabled to prevent interrupt
+     * delivery errors.  On AMD systems "Receive accept error" will be
+     * broadcast to local APICs if interrupts target CPUs that are offline.
+     */
+    if ( num_online_cpus() > 1 )
+        smp_call_function(stop_this_cpu, &stop_aps, 0);
+
+    local_irq_disable();
 
     if ( num_online_cpus() > 1 )
     {
         int timeout = 10;
 
-        local_irq_disable();
-        fixup_irqs(cpumask_of(cpu), 0);
-        local_irq_enable();
-
-        smp_call_function(stop_this_cpu, NULL, 0);
+        /* Signal APs to stop. */
+        stop_aps = true;
 
         /* Wait 10ms for all other CPUs to go offline. */
         while ( (num_online_cpus() > 1) && (timeout-- > 0) )
@@ -373,13 +387,12 @@ void smp_send_stop(void)
 
     if ( cpu_online(cpu) )
     {
-        local_irq_disable();
         disable_IO_APIC();
         hpet_disable();
         __stop_this_cpu();
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
-        local_irq_enable();
     }
+    local_irq_enable();
 }
 
 void smp_send_nmi_allbutself(void)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:13:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:13:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890427.1299532 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0vp-0004rD-07; Mon, 17 Feb 2025 13:13:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890427.1299532; Mon, 17 Feb 2025 13: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 1tk0vo-0004r5-Tq; Mon, 17 Feb 2025 13:13:04 +0000
Received: by outflank-mailman (input) for mailman id 890427;
 Mon, 17 Feb 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 1tk0vn-0004qn-DY
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0vn-006pbU-21
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0vn-00BSgs-1A
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=BHZsh1vLKiOtUHzf2BIb3nslaG//6696txmdQj6W3CQ=; b=UtY+bogGLtohtPVnZDRaCVo4iO
	U5I2IW1S4jRqtSWxPHLI4QEPV/tO9U0YUzDfbZfPdjtsxymmqlG+hSf68SifRyEKjGi09uraaqMtx
	mdHiah+tkNpfK1C60WU+NNGC0TIdan4sNgu77v4DGsmw47xmgKHChR031v50UMX66Jjc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/smp: perform disabling on interrupts ahead of AP shutdown
Message-Id: <E1tk0vn-00BSgs-1A@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:13:03 +0000

commit 30aadc8dbc9ac1abf88bfeb370d1c27c5ea9d1e6
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:23:50 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:23:50 2025 +0100

    x86/smp: perform disabling on interrupts ahead of AP shutdown
    
    Move the disabling of interrupt sources so it's done ahead of the offlining
    of APs.  This is to prevent AMD systems triggering "Receive accept error"
    when interrupts target CPUs that are no longer online.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: db6daa9bf411260d2c1f5301e4fc786ae4a5cef8
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index bd92496d3d..eb134ecac8 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -372,6 +372,8 @@ void smp_send_stop(void)
         smp_call_function(stop_this_cpu, &stop_aps, 0);
 
     local_irq_disable();
+    disable_IO_APIC();
+    hpet_disable();
 
     if ( num_online_cpus() > 1 )
     {
@@ -387,8 +389,6 @@ void smp_send_stop(void)
 
     if ( cpu_online(cpu) )
     {
-        disable_IO_APIC();
-        hpet_disable();
         __stop_this_cpu();
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:13:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:13:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890428.1299537 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0vz-0004tv-1g; Mon, 17 Feb 2025 13:13:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890428.1299537; Mon, 17 Feb 2025 13:13: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 1tk0vy-0004tn-VE; Mon, 17 Feb 2025 13:13:14 +0000
Received: by outflank-mailman (input) for mailman id 890428;
 Mon, 17 Feb 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 1tk0vx-0004tW-Gw
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0vx-006pbt-2M
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0vx-00BSim-1S
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=ojm0f6ot0j6FKp57/hZ36+rO1rCuajhYc9j5MTWEdHg=; b=GkBnS04tHarvCWOkE0UOyqg3tu
	9DPp7bDwNWEMnT7foan5cSNUyk8DjftBtdSfAiMdWa/U+NIxgYxRuybVfWNXaUEpvEHlEcht7J2Uo
	Y7MzQhpIezp58F8KXJGK95PpQiycJgQiz4VdFFFvfh4m1At0jFXBrXAejAbJ+3sgzbfE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/pci: disable MSI(-X) on all devices at shutdown
Message-Id: <E1tk0vx-00BSim-1S@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:13:13 +0000

commit eae35da8f4c420f5f6752d4c0291be5ba4d22f5a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:24:03 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:24:03 2025 +0100

    x86/pci: disable MSI(-X) on all devices at shutdown
    
    Attempt to disable MSI(-X) capabilities on all PCI devices know by Xen at
    shutdown.  Doing such disabling should facilitate kexec chained kernel from
    booting more reliably, as device MSI(-X) interrupt generation should be
    quiesced.
    
    Only attempt to disable MSI(-X) on all devices in the crash context if the
    PCI lock is not taken, otherwise the PCI device list could be in an
    inconsistent state.  This requires introducing a new pcidevs_trylock()
    helper to check whether the lock is currently taken.
    
    Disabling MSI(-X) should prevent "Receive accept error" being raised as a
    result of non-disabled interrupts targeting offline CPUs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 7ab6951981231b4c576a3588248c303001272588
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/crash.c           | 10 ++++++++++
 xen/arch/x86/include/asm/msi.h |  1 +
 xen/arch/x86/msi.c             | 18 ++++++++++++++++++
 xen/arch/x86/smp.c             |  1 +
 xen/drivers/passthrough/pci.c  | 42 ++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/pci.h          | 12 ++++++++++++
 6 files changed, 84 insertions(+)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index a789416ca3..22b1121d7a 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -175,6 +175,16 @@ static void nmi_shootdown_cpus(void)
          */
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
 
+        if ( pcidevs_trylock() )
+        {
+            /*
+             * Assume the PCI device list to be in a consistent state if the
+             * lock is not held when the crash happened.
+             */
+            pci_disable_msi_all();
+            pcidevs_unlock();
+        }
+
         disable_IO_APIC();
         hpet_disable();
     }
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 748bc3cd6d..503c9447f6 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -86,6 +86,7 @@ extern int pci_enable_msi(struct pci_dev *pdev, struct msi_info *msi,
 extern void pci_disable_msi(struct msi_desc *msi_desc);
 extern int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off);
 extern void pci_cleanup_msi(struct pci_dev *pdev);
+extern void pci_disable_msi_all(void);
 extern int setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc);
 extern int __setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc,
                            hw_irq_controller *handler);
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 0d11448234..0c099215c7 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1245,6 +1245,24 @@ void pci_cleanup_msi(struct pci_dev *pdev)
     msi_free_irqs(pdev);
 }
 
+static int cf_check disable_msi(struct pci_dev *pdev, void *arg)
+{
+    msi_set_enable(pdev, 0);
+    msix_set_enable(pdev, 0);
+
+    return 0;
+}
+
+/* Disable MSI and/or MSI-X on all devices known by Xen. */
+void pci_disable_msi_all(void)
+{
+    int rc = pci_iterate_devices(disable_msi, NULL);
+
+    if ( rc )
+        printk(XENLOG_ERR
+               "Failed to disable MSI(-X) on some devices: %d\n", rc);
+}
+
 int pci_reset_msix_state(struct pci_dev *pdev)
 {
     unsigned int pos = pci_find_cap_offset(pdev->sbdf, PCI_CAP_ID_MSIX);
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index eb134ecac8..92341b7ee7 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -372,6 +372,7 @@ void smp_send_stop(void)
         smp_call_function(stop_this_cpu, &stop_aps, 0);
 
     local_irq_disable();
+    pci_disable_msi_all();
     disable_IO_APIC();
     hpet_disable();
 
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index c7ee835b8a..f4c8c505af 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -68,6 +68,11 @@ bool pcidevs_locked(void)
     return rspin_is_locked(&_pcidevs_lock);
 }
 
+bool pcidevs_trylock_unsafe(void)
+{
+    return _rspin_trylock(&_pcidevs_lock);
+}
+
 static RADIX_TREE(pci_segments);
 
 static inline struct pci_seg *get_pseg(u16 seg)
@@ -1816,6 +1821,43 @@ int iommu_do_pci_domctl(
     return ret;
 }
 
+struct segment_iter {
+    int (*handler)(struct pci_dev *pdev, void *arg);
+    void *arg;
+    int rc;
+};
+
+static int cf_check iterate_all(struct pci_seg *pseg, void *arg)
+{
+    struct segment_iter *iter = arg;
+    struct pci_dev *pdev;
+
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+    {
+        int rc = iter->handler(pdev, iter->arg);
+
+        if ( !iter->rc )
+            iter->rc = rc;
+    }
+
+    return 0;
+}
+
+/*
+ * Iterate without locking or preemption over all PCI devices known by Xen.
+ * Can be called with interrupts disabled.
+ */
+int pci_iterate_devices(int (*handler)(struct pci_dev *pdev, void *arg),
+                        void *arg)
+{
+    struct segment_iter iter = {
+        .handler = handler,
+        .arg = arg,
+    };
+
+    return pci_segments_iterate(iterate_all, &iter) ?: iter.rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 82e1221c9c..06f98c7c80 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -187,6 +187,11 @@ static always_inline void pcidevs_lock(void)
 }
 void pcidevs_unlock(void);
 bool __must_check pcidevs_locked(void);
+bool pcidevs_trylock_unsafe(void);
+static always_inline bool pcidevs_trylock(void)
+{
+    return lock_evaluate_nospec(pcidevs_trylock_unsafe());
+}
 
 #ifndef NDEBUG
 /*
@@ -223,6 +228,13 @@ struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf);
 struct pci_dev *pci_get_real_pdev(pci_sbdf_t sbdf);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
+/*
+ * Iterate without locking or preemption over all PCI devices known by Xen.
+ * Can be called with interrupts disabled.
+ */
+int pci_iterate_devices(int (*handler)(struct pci_dev *pdev, void *arg),
+                        void *arg);
+
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
 uint16_t pci_conf_read16(pci_sbdf_t sbdf, unsigned int reg);
 uint32_t pci_conf_read32(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:13:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:13:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890429.1299540 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk0w9-0004wg-3K; Mon, 17 Feb 2025 13:13:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890429.1299540; Mon, 17 Feb 2025 13:13: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 1tk0w9-0004wX-0O; Mon, 17 Feb 2025 13:13:25 +0000
Received: by outflank-mailman (input) for mailman id 890429;
 Mon, 17 Feb 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 1tk0w7-0004wO-Kj
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk0w7-006pbx-2j
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk0w7-00BSkc-1o
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=LbGMa4dHMpjVC0kIRjXbS+3Dm446gpXwn9/aei+jwZM=; b=mrANFvPz7kuOPUjsgJg6wEmOeV
	kVbNviuIRBmM+CnSf6UU7j5NBFU0v3YWQR6ywlpx1LS3HEh52XXA09P8HT5QW20uMfbt+/hMJS5+F
	1T+WmyeOJkJxdFjQK9qlqsiXahhuWvVoP8uIxPegVz4eCQKjzTa2xctuluM5PG/XrwKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/iommu: disable interrupts at shutdown
Message-Id: <E1tk0w7-00BSkc-1o@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:13:23 +0000

commit 93302bb88855c5f308f1e67ac2cd84271aa2d73a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:24:23 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:24:23 2025 +0100

    x86/iommu: disable interrupts at shutdown
    
    Add a new hook to inhibit interrupt generation by the IOMMU(s).  Note the
    hook is currently only implemented for x86 IOMMUs.  The purpose is to
    disable interrupt generation at shutdown so any kexec chained image finds
    the IOMMU(s) in a quiesced state.
    
    It would also prevent "Receive accept error" being raised as a result of
    non-disabled interrupts targeting offline CPUs.
    
    Note that the iommu_quiesce() call in nmi_shootdown_cpus() is still
    required even when there's a preceding iommu_crash_shutdown() call; the
    later can become a no-op depending on the setting of the "crash-disable"
    command line option.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 819c3cb186a86ef3e04fb5af4d9f9f6de032c3ee
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/crash.c                        |  1 +
 xen/arch/x86/smp.c                          |  1 +
 xen/drivers/passthrough/amd/iommu.h         |  1 +
 xen/drivers/passthrough/amd/iommu_init.c    | 17 +++++++++++++++++
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  1 +
 xen/drivers/passthrough/iommu.c             | 12 ++++++++++++
 xen/drivers/passthrough/vtd/iommu.c         | 19 +++++++++++++++++++
 xen/include/xen/iommu.h                     |  3 +++
 8 files changed, 55 insertions(+)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 22b1121d7a..26057c71d3 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -187,6 +187,7 @@ static void nmi_shootdown_cpus(void)
 
         disable_IO_APIC();
         hpet_disable();
+        iommu_quiesce();
     }
 }
 
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 92341b7ee7..2cf36cb96c 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -375,6 +375,7 @@ void smp_send_stop(void)
     pci_disable_msi_all();
     disable_IO_APIC();
     hpet_disable();
+    iommu_quiesce();
 
     if ( num_online_cpus() > 1 )
     {
diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index 8d6f63d87f..9934316351 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -292,6 +292,7 @@ extern unsigned long *shared_intremap_inuse;
 void cf_check amd_iommu_resume(void);
 int __must_check cf_check amd_iommu_suspend(void);
 void cf_check amd_iommu_crash_shutdown(void);
+void cf_check amd_iommu_quiesce(void);
 
 static inline u32 get_field_from_reg_u32(u32 reg_value, u32 mask, u32 shift)
 {
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index b546c28667..d899f58a38 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -1610,3 +1610,20 @@ void cf_check amd_iommu_resume(void)
         invalidate_all_domain_pages();
     }
 }
+
+void cf_check amd_iommu_quiesce(void)
+{
+    struct amd_iommu *iommu;
+
+    for_each_amd_iommu ( iommu )
+    {
+        if ( iommu->ctrl.int_cap_xt_en )
+        {
+            iommu->ctrl.int_cap_xt_en = false;
+            writeq(iommu->ctrl.raw,
+                   iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
+        }
+        else
+            amd_iommu_msi_enable(iommu, IOMMU_CONTROL_DISABLED);
+    }
+}
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index f96f59440b..d00697edb3 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -791,6 +791,7 @@ static const struct iommu_ops __initconst_cf_clobber _iommu_ops = {
     .crash_shutdown = amd_iommu_crash_shutdown,
     .get_reserved_device_memory = amd_iommu_get_reserved_device_memory,
     .dump_page_tables = amd_dump_page_tables,
+    .quiesce = amd_iommu_quiesce,
 };
 
 static const struct iommu_init_ops __initconstrel _iommu_init_ops = {
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 50bfd62553..1a3180708c 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -662,6 +662,18 @@ void iommu_crash_shutdown(void)
 #endif
 }
 
+void iommu_quiesce(void)
+{
+    const struct iommu_ops *ops;
+
+    if ( !iommu_enabled )
+        return;
+
+    ops = iommu_get_ops();
+    if ( ops->quiesce )
+        iommu_vcall(ops, quiesce);
+}
+
 int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt)
 {
     const struct iommu_ops *ops;
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index ab38bbc8a5..f28de36458 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -3247,6 +3247,24 @@ static int cf_check intel_iommu_quarantine_init(struct pci_dev *pdev,
     return rc;
 }
 
+static void cf_check vtd_quiesce(void)
+{
+    const struct acpi_drhd_unit *drhd;
+
+    for_each_drhd_unit ( drhd )
+    {
+        const struct vtd_iommu *iommu = drhd->iommu;
+        uint32_t sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
+
+        /*
+         * Open code dma_msi_mask() to avoid taking the spinlock which could
+         * deadlock if called from crash context.
+         */
+        sts |= DMA_FECTL_IM;
+        dmar_writel(iommu->reg, DMAR_FECTL_REG, sts);
+    }
+}
+
 static const struct iommu_ops __initconst_cf_clobber vtd_ops = {
     .page_sizes = PAGE_SIZE_4K,
     .init = intel_iommu_domain_init,
@@ -3276,6 +3294,7 @@ static const struct iommu_ops __initconst_cf_clobber vtd_ops = {
     .iotlb_flush = iommu_flush_iotlb,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_page_tables = vtd_dump_page_tables,
+    .quiesce = vtd_quiesce,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 442ae5322d..04f195be04 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -314,6 +314,8 @@ struct iommu_ops {
      */
     int (*dt_xlate)(device_t *dev, const struct dt_phandle_args *args);
 #endif
+    /* Inhibit all interrupt generation, to be used at shutdown. */
+    void (*quiesce)(void);
 };
 
 /*
@@ -404,6 +406,7 @@ static inline int iommu_do_domctl(struct xen_domctl *domctl, struct domain *d,
 int __must_check iommu_suspend(void);
 void iommu_resume(void);
 void iommu_crash_shutdown(void);
+void iommu_quiesce(void);
 int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt);
 int iommu_quarantine_dev_init(device_t *dev);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890470.1299584 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1aR-0003eQ-S4; Mon, 17 Feb 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 890470.1299584; Mon, 17 Feb 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 1tk1aR-0003eI-PY; Mon, 17 Feb 2025 13:55:03 +0000
Received: by outflank-mailman (input) for mailman id 890470;
 Mon, 17 Feb 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 1tk1aQ-0003eC-Jh
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk1aQ-006qOZ-1Y
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1aQ-00Bbi8-0Q
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=BzcGJvSqtcr88uUXYqSaJU7u97AQSWGJx5RbjenuUrY=; b=5W+YnGDJ/9CUckTZKUZFVBoyu0
	ErxUNXp4Fzp0jAWx8/Mdj39QC57FVtIq9nrOY/W3ItITQgVYVjxMB7msn9FaULOjCYHjHDEC+9hGb
	wKdTyRjGLTOTYrvkd+ilgzDkMZagtFOH1Eno7ifIyJfjg++TD0Zh+PskK1av+KPQasPg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/HVM: reduce recursion in linear_{read,write}()
Message-Id: <E1tk1aQ-00Bbi8-0Q@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:55:02 +0000

commit da7790b8f259bc71135d561666d7a8256bf6b163
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:27:22 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:27:22 2025 +0100

    x86/HVM: reduce recursion in linear_{read,write}()
    
    Let's make explicit what the compiler may or may not do on our behalf:
    The 2nd of the recursive invocations each can fall through rather than
    re-invoking the function. This will save us from adding yet another
    parameter (or more) to the function, just for the recursive invocations.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 18053054b7583810dd356efc8d7018bbc8720f36
    master date: 2024-09-09 13:40:47 +0200
---
 xen/arch/x86/hvm/emulate.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 865aa08bbc..5742383139 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1148,7 +1148,7 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned int offset = addr & ~PAGE_MASK;
-    int rc = HVMTRANS_bad_gfn_to_mfn;
+    int rc;
 
     if ( offset + bytes > PAGE_SIZE )
     {
@@ -1156,12 +1156,16 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
 
         /* Split the access at the page boundary. */
         rc = linear_read(addr, part1, p_data, pfec, hvmemul_ctxt);
-        if ( rc == X86EMUL_OKAY )
-            rc = linear_read(addr + part1, bytes - part1, p_data + part1,
-                             pfec, hvmemul_ctxt);
-        return rc;
+        if ( rc != X86EMUL_OKAY )
+            return rc;
+
+        addr += part1;
+        bytes -= part1;
+        p_data += part1;
     }
 
+    rc = HVMTRANS_bad_gfn_to_mfn;
+
     /*
      * If there is an MMIO cache entry for the access then we must be re-issuing
      * an access that was previously handled as MMIO. Thus it is imperative that
@@ -1203,7 +1207,7 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned int offset = addr & ~PAGE_MASK;
-    int rc = HVMTRANS_bad_gfn_to_mfn;
+    int rc;
 
     if ( offset + bytes > PAGE_SIZE )
     {
@@ -1211,12 +1215,16 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 
         /* Split the access at the page boundary. */
         rc = linear_write(addr, part1, p_data, pfec, hvmemul_ctxt);
-        if ( rc == X86EMUL_OKAY )
-            rc = linear_write(addr + part1, bytes - part1, p_data + part1,
-                              pfec, hvmemul_ctxt);
-        return rc;
+        if ( rc != X86EMUL_OKAY )
+            return rc;
+
+        addr += part1;
+        bytes -= part1;
+        p_data += part1;
     }
 
+    rc = HVMTRANS_bad_gfn_to_mfn;
+
     /*
      * If there is an MMIO cache entry for the access then we must be re-issuing
      * an access that was previously handled as MMIO. Thus it is imperative that
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:55:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890471.1299589 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1ab-0003gP-Td; Mon, 17 Feb 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 890471.1299589; Mon, 17 Feb 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 1tk1ab-0003gI-Qz; Mon, 17 Feb 2025 13:55:13 +0000
Received: by outflank-mailman (input) for mailman id 890471;
 Mon, 17 Feb 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 1tk1aa-0003g4-Eb
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk1aa-006qOw-27
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1aa-00Bbka-0z
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=TmikBqpHcgqDu93cfnVNdO5BzJ/6NOUshWR7kGuWvz4=; b=4ODC+npeZd7o3gE1L5xdTATc4c
	/ArT6Dsfao1gPuh1tDu/zNu60jQw6M+oYEuOwH9Jd/ZXOUhDVTmvSrivp49sRxEo2wIS91PpxxQME
	i++HK2eUQUWgCs/0BsDpQHydS4+1lfkJxNQGf5H55G2jUo4+sEXETY4rcpamM9T6t/Fc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/HVM: correct MMIO emulation cache bounds check
Message-Id: <E1tk1aa-00Bbka-0z@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:55:12 +0000

commit 0d2799a557b4e08ab4eb2dada46afeb6e6f56c1f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:28:13 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:28:13 2025 +0100

    x86/HVM: correct MMIO emulation cache bounds check
    
    To avoid overrunning the internal buffer we need to take the offset into
    the buffer into account.
    
    Fixes: d95da91fb497 ("x86/HVM: grow MMIO cache data size to 64 bytes")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: e5339bb689dfa79a914c6c96e1d82d61e1ae3161
    master date: 2025-01-23 11:14:48 +0100
---
 xen/arch/x86/hvm/emulate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 5742383139..cebd4a5161 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -937,7 +937,7 @@ static int hvmemul_phys_mmio_access(
     }
 
     /* Accesses must not overflow the cache's buffer. */
-    if ( size > sizeof(cache->buffer) )
+    if ( offset + size > sizeof(cache->buffer) )
     {
         ASSERT_UNREACHABLE();
         return X86EMUL_UNHANDLEABLE;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:55:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890473.1299593 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1al-0003ki-VF; Mon, 17 Feb 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 890473.1299593; Mon, 17 Feb 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 1tk1al-0003kb-Se; Mon, 17 Feb 2025 13:55:23 +0000
Received: by outflank-mailman (input) for mailman id 890473;
 Mon, 17 Feb 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 1tk1ak-0003kR-IX
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk1ak-006qP2-2U
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1ak-00BblY-1Y
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=NPSmMCY9pI0DY1obo0SzJfR2yX8wqensAETLRJh1bdE=; b=45Ydi5TiMICfox+49PhDq+fXGU
	vdA+1eyOZke7Rc80BPGxRt2UWSYou3763YNOYlBI2Wse5b/gS2MA4h5DCvsfhUGqHEx/RkZ7gw6/+
	4y+ewHCpm5s9DUxlnmLkJIKTpxak+jlsohU/XnyuRfeuStmH/dT1D5DhQjyshWMoXtEE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/HVM: allocate emulation cache entries dynamically
Message-Id: <E1tk1ak-00BblY-1Y@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:55:22 +0000

commit 115d878f09c056f7f002dfa509429d7235c40641
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:28:28 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:28:28 2025 +0100

    x86/HVM: allocate emulation cache entries dynamically
    
    Both caches may need higher capacity, and the upper bound will need to
    be determined dynamically based on CPUID policy (for AMX'es TILELOAD /
    TILESTORE at least).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 23d60dbb0493b2f9ec1d89be5341eec2ee9dab32
    master date: 2025-01-24 10:15:29 +0100
---
 xen/arch/x86/hvm/emulate.c             | 51 ++++++++++++++++++++++++++--------
 xen/arch/x86/include/asm/hvm/emulate.h |  4 +++
 xen/arch/x86/include/asm/hvm/vcpu.h    | 13 +--------
 3 files changed, 44 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index cebd4a5161..852d754056 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -27,6 +27,18 @@
 #include <asm/iocap.h>
 #include <asm/vm_event.h>
 
+/*
+ * We may read or write up to m512 or up to a tile row as a number of
+ * device-model transactions.
+ */
+struct hvm_mmio_cache {
+    unsigned long gla;
+    unsigned int size;     /* Amount of buffer[] actually used. */
+    unsigned int space:31; /* Allocated size of buffer[]. */
+    unsigned int dir:1;
+    uint8_t buffer[] __aligned(sizeof(long));
+};
+
 struct hvmemul_cache
 {
     /* The cache is disabled as long as num_ents > max_ents. */
@@ -937,7 +949,7 @@ static int hvmemul_phys_mmio_access(
     }
 
     /* Accesses must not overflow the cache's buffer. */
-    if ( offset + size > sizeof(cache->buffer) )
+    if ( offset + size > cache->space )
     {
         ASSERT_UNREACHABLE();
         return X86EMUL_UNHANDLEABLE;
@@ -1013,7 +1025,7 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
 
     for ( i = 0; i < hvio->mmio_cache_count; i ++ )
     {
-        cache = &hvio->mmio_cache[i];
+        cache = hvio->mmio_cache[i];
 
         if ( gla == cache->gla &&
              dir == cache->dir )
@@ -1029,10 +1041,11 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
 
     ++hvio->mmio_cache_count;
 
-    cache = &hvio->mmio_cache[i];
-    memset(cache, 0, sizeof (*cache));
+    cache = hvio->mmio_cache[i];
+    memset(cache->buffer, 0, cache->space);
 
     cache->gla = gla;
+    cache->size = 0;
     cache->dir = dir;
 
     return cache;
@@ -2978,16 +2991,21 @@ void hvm_dump_emulation_state(const char *loglvl, const char *prefix,
 int hvmemul_cache_init(struct vcpu *v)
 {
     /*
-     * No insn can access more than 16 independent linear addresses (AVX512F
-     * scatters/gathers being the worst). Each such linear range can span a
-     * page boundary, i.e. may require two page walks. Account for each insn
-     * byte individually, for simplicity.
+     * AVX512F scatter/gather insns can access up to 16 independent linear
+     * addresses, up to 8 bytes size. Each such linear range can span a page
+     * boundary, i.e. may require two page walks.
+     */
+    unsigned int nents = 16 * 2 * (CONFIG_PAGING_LEVELS + 1);
+    unsigned int i, max_bytes = 64;
+    struct hvmemul_cache *cache;
+
+    /*
+     * Account for each insn byte individually, both for simplicity and to
+     * leave some slack space.
      */
-    const unsigned int nents = (CONFIG_PAGING_LEVELS + 1) *
-                               (MAX_INST_LEN + 16 * 2);
-    struct hvmemul_cache *cache = xmalloc_flex_struct(struct hvmemul_cache,
-                                                      ents, nents);
+    nents += MAX_INST_LEN * (CONFIG_PAGING_LEVELS + 1);
 
+    cache = xmalloc_flex_struct(struct hvmemul_cache, ents, nents);
     if ( !cache )
         return -ENOMEM;
 
@@ -2997,6 +3015,15 @@ int hvmemul_cache_init(struct vcpu *v)
 
     v->arch.hvm.hvm_io.cache = cache;
 
+    for ( i = 0; i < ARRAY_SIZE(v->arch.hvm.hvm_io.mmio_cache); ++i )
+    {
+        v->arch.hvm.hvm_io.mmio_cache[i] =
+            xmalloc_flex_struct(struct hvm_mmio_cache, buffer, max_bytes);
+        if ( !v->arch.hvm.hvm_io.mmio_cache[i] )
+            return -ENOMEM;
+        v->arch.hvm.hvm_io.mmio_cache[i]->space = max_bytes;
+    }
+
     return 0;
 }
 
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h b/xen/arch/x86/include/asm/hvm/emulate.h
index 398d0db078..be24592084 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -119,6 +119,10 @@ int hvmemul_do_pio_buffer(uint16_t port,
 int __must_check hvmemul_cache_init(struct vcpu *v);
 static inline void hvmemul_cache_destroy(struct vcpu *v)
 {
+    unsigned int i;
+
+    for ( i = 0; i < ARRAY_SIZE(v->arch.hvm.hvm_io.mmio_cache); ++i )
+        XFREE(v->arch.hvm.hvm_io.mmio_cache[i]);
     XFREE(v->arch.hvm.hvm_io.cache);
 }
 bool hvmemul_read_cache(const struct vcpu *v, paddr_t gpa,
diff --git a/xen/arch/x86/include/asm/hvm/vcpu.h b/xen/arch/x86/include/asm/hvm/vcpu.h
index c9ef2b325b..3985994298 100644
--- a/xen/arch/x86/include/asm/hvm/vcpu.h
+++ b/xen/arch/x86/include/asm/hvm/vcpu.h
@@ -22,17 +22,6 @@ struct hvm_vcpu_asid {
     uint32_t asid;
 };
 
-/*
- * We may read or write up to m512 as a number of device-model
- * transactions.
- */
-struct hvm_mmio_cache {
-    unsigned long gla;
-    unsigned int size;
-    uint8_t dir;
-    uint8_t buffer[64] __aligned(sizeof(long));
-};
-
 struct hvm_vcpu_io {
     /*
      * HVM emulation:
@@ -48,7 +37,7 @@ struct hvm_vcpu_io {
      * We may need to handle up to 3 distinct memory accesses per
      * instruction.
      */
-    struct hvm_mmio_cache mmio_cache[3];
+    struct hvm_mmio_cache *mmio_cache[3];
     unsigned int mmio_cache_count;
 
     /* For retries we shouldn't re-fetch the instruction. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:55:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890474.1299597 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1aw-0003nE-0l; Mon, 17 Feb 2025 13:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890474.1299597; Mon, 17 Feb 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 1tk1av-0003n6-UB; Mon, 17 Feb 2025 13:55:33 +0000
Received: by outflank-mailman (input) for mailman id 890474;
 Mon, 17 Feb 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 1tk1au-0003my-Lp
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk1au-006qP6-2p
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1au-00Bbny-1v
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=rxhVYRPUmS4ABgCVJEWqokLeyxif41/nBp55XgJ39DM=; b=1gUwGodt+ybnU1DXGL+T1XZH7m
	lod66HAtfbL5PdwCctUGNFpiKocBvl7AZo4j6W/B09yd9I5bjtXvbEqZIZRCe2pJ81ylAjsbq2xzy
	vqjJZsfAR/EqwCN180Fs1qTzzvQbGS9qfe7mS4qCBF3s0g+6bnsI3U2JmTH3h6PUBT6I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/HVM: correct read/write split at page boundaries
Message-Id: <E1tk1au-00Bbny-1v@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:55:32 +0000

commit 58580992d381d55089b3628a8c08a5f92994e4bf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:29:05 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:29:05 2025 +0100

    x86/HVM: correct read/write split at page boundaries
    
    The MMIO cache is intended to have one entry used per independent memory
    access that an insn does. This, in particular, is supposed to be
    ignoring any page boundary crossing. Therefore when looking up a cache
    entry, the access'es starting (linear) address is relevant, not the one
    possibly advanced past a page boundary.
    
    In order for the same offset-into-buffer variable to be usable in
    hvmemul_phys_mmio_access() for both the caller's buffer and the cache
    entry's it is further necessary to have the un-adjusted caller buffer
    passed into there.
    
    Fixes: 2d527ba310dc ("x86/hvm: split all linear reads and writes at page boundary")
    Reported-by: Manuel Andreas <manuel.andreas@tum.de>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 672894a11fe06e664a0ebfb600baf5dbb897b9e4
    master date: 2025-01-24 10:15:56 +0100
---
 xen/arch/x86/hvm/emulate.c | 92 ++++++++++++++++++++++++++++++----------------
 1 file changed, 61 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 852d754056..a447c7270e 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -32,8 +32,9 @@
  * device-model transactions.
  */
 struct hvm_mmio_cache {
-    unsigned long gla;
-    unsigned int size;     /* Amount of buffer[] actually used. */
+    unsigned long gla;     /* Start of original access (e.g. insn operand). */
+    unsigned int skip;     /* Offset to start of MMIO */
+    unsigned int size;     /* Amount of buffer[] actually used, incl @skip. */
     unsigned int space:31; /* Allocated size of buffer[]. */
     unsigned int dir:1;
     uint8_t buffer[] __aligned(sizeof(long));
@@ -955,6 +956,13 @@ static int hvmemul_phys_mmio_access(
         return X86EMUL_UNHANDLEABLE;
     }
 
+    /* Accesses must not be to the unused leading space. */
+    if ( offset < cache->skip )
+    {
+        ASSERT_UNREACHABLE();
+        return X86EMUL_UNHANDLEABLE;
+    }
+
     /*
      * hvmemul_do_io() cannot handle non-power-of-2 accesses or
      * accesses larger than sizeof(long), so choose the highest power
@@ -1012,13 +1020,15 @@ static int hvmemul_phys_mmio_access(
 
 /*
  * Multi-cycle MMIO handling is based upon the assumption that emulation
- * of the same instruction will not access the same MMIO region more
- * than once. Hence we can deal with re-emulation (for secondary or
- * subsequent cycles) by looking up the result or previous I/O in a
- * cache indexed by linear MMIO address.
+ * of the same instruction will not access the exact same MMIO region
+ * more than once in exactly the same way (if it does, the accesses will
+ * be "folded"). Hence we can deal with re-emulation (for secondary or
+ * subsequent cycles) by looking up the result of previous I/O in a cache
+ * indexed by linear address and access type.
  */
 static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
-    struct hvm_vcpu_io *hvio, unsigned long gla, uint8_t dir, bool create)
+    struct hvm_vcpu_io *hvio, unsigned long gla, uint8_t dir,
+    unsigned int skip)
 {
     unsigned int i;
     struct hvm_mmio_cache *cache;
@@ -1032,7 +1042,11 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
             return cache;
     }
 
-    if ( !create )
+    /*
+     * Bail if a new entry shouldn't be allocated, relying on ->space having
+     * the same value for all entries.
+     */
+    if ( skip >= hvio->mmio_cache[0]->space )
         return NULL;
 
     i = hvio->mmio_cache_count;
@@ -1045,7 +1059,8 @@ static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
     memset(cache->buffer, 0, cache->space);
 
     cache->gla = gla;
-    cache->size = 0;
+    cache->skip = skip;
+    cache->size = skip;
     cache->dir = dir;
 
     return cache;
@@ -1066,12 +1081,14 @@ static void latch_linear_to_phys(struct hvm_vcpu_io *hvio, unsigned long gla,
 
 static int hvmemul_linear_mmio_access(
     unsigned long gla, unsigned int size, uint8_t dir, void *buffer,
-    uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt, bool_t known_gpfn)
+    uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt,
+    unsigned long start_gla, bool known_gpfn)
 {
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned long offset = gla & ~PAGE_MASK;
-    struct hvm_mmio_cache *cache = hvmemul_find_mmio_cache(hvio, gla, dir, true);
-    unsigned int chunk, buffer_offset = 0;
+    unsigned int chunk, buffer_offset = gla - start_gla;
+    struct hvm_mmio_cache *cache = hvmemul_find_mmio_cache(hvio, start_gla,
+                                                           dir, buffer_offset);
     paddr_t gpa;
     unsigned long one_rep = 1;
     int rc;
@@ -1119,19 +1136,19 @@ static int hvmemul_linear_mmio_access(
 static inline int hvmemul_linear_mmio_read(
     unsigned long gla, unsigned int size, void *buffer,
     uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt,
-    bool_t translate)
+    unsigned long start_gla, bool translate)
 {
-    return hvmemul_linear_mmio_access(gla, size, IOREQ_READ, buffer,
-                                      pfec, hvmemul_ctxt, translate);
+    return hvmemul_linear_mmio_access(gla, size, IOREQ_READ, buffer, pfec,
+                                      hvmemul_ctxt, start_gla, translate);
 }
 
 static inline int hvmemul_linear_mmio_write(
     unsigned long gla, unsigned int size, void *buffer,
     uint32_t pfec, struct hvm_emulate_ctxt *hvmemul_ctxt,
-    bool_t translate)
+    unsigned long start_gla, bool translate)
 {
-    return hvmemul_linear_mmio_access(gla, size, IOREQ_WRITE, buffer,
-                                      pfec, hvmemul_ctxt, translate);
+    return hvmemul_linear_mmio_access(gla, size, IOREQ_WRITE, buffer, pfec,
+                                      hvmemul_ctxt, start_gla, translate);
 }
 
 static bool known_gla(unsigned long addr, unsigned int bytes, uint32_t pfec)
@@ -1160,7 +1177,10 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
 {
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
+    void *buffer = p_data;
+    unsigned long start = addr;
     unsigned int offset = addr & ~PAGE_MASK;
+    const struct hvm_mmio_cache *cache;
     int rc;
 
     if ( offset + bytes > PAGE_SIZE )
@@ -1184,8 +1204,17 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
      * an access that was previously handled as MMIO. Thus it is imperative that
      * we handle this access in the same way to guarantee completion and hence
      * clean up any interim state.
+     *
+     * Care must be taken, however, to correctly deal with crossing RAM/MMIO or
+     * MMIO/RAM boundaries. While we want to use a single cache entry (tagged
+     * by the starting linear address), we need to continue issuing (i.e. also
+     * upon replay) the RAM access for anything that's ahead of or past MMIO,
+     * i.e. in RAM.
      */
-    if ( !hvmemul_find_mmio_cache(hvio, addr, IOREQ_READ, false) )
+    cache = hvmemul_find_mmio_cache(hvio, start, IOREQ_READ, ~0);
+    if ( !cache ||
+         addr + bytes <= start + cache->skip ||
+         addr >= start + cache->size )
         rc = hvm_copy_from_guest_linear(p_data, addr, bytes, pfec, &pfinfo);
 
     switch ( rc )
@@ -1201,8 +1230,8 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
         if ( pfec & PFEC_insn_fetch )
             return X86EMUL_UNHANDLEABLE;
 
-        return hvmemul_linear_mmio_read(addr, bytes, p_data, pfec,
-                                        hvmemul_ctxt,
+        return hvmemul_linear_mmio_read(addr, bytes, buffer, pfec,
+                                        hvmemul_ctxt, start,
                                         known_gla(addr, bytes, pfec));
 
     case HVMTRANS_gfn_paged_out:
@@ -1219,7 +1248,10 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 {
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
+    void *buffer = p_data;
+    unsigned long start = addr;
     unsigned int offset = addr & ~PAGE_MASK;
+    const struct hvm_mmio_cache *cache;
     int rc;
 
     if ( offset + bytes > PAGE_SIZE )
@@ -1238,13 +1270,11 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 
     rc = HVMTRANS_bad_gfn_to_mfn;
 
-    /*
-     * If there is an MMIO cache entry for the access then we must be re-issuing
-     * an access that was previously handled as MMIO. Thus it is imperative that
-     * we handle this access in the same way to guarantee completion and hence
-     * clean up any interim state.
-     */
-    if ( !hvmemul_find_mmio_cache(hvio, addr, IOREQ_WRITE, false) )
+    /* See commentary in linear_read(). */
+    cache = hvmemul_find_mmio_cache(hvio, start, IOREQ_WRITE, ~0);
+    if ( !cache ||
+         addr + bytes <= start + cache->skip ||
+         addr >= start + cache->size )
         rc = hvm_copy_to_guest_linear(addr, p_data, bytes, pfec, &pfinfo);
 
     switch ( rc )
@@ -1257,8 +1287,8 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
         return X86EMUL_EXCEPTION;
 
     case HVMTRANS_bad_gfn_to_mfn:
-        return hvmemul_linear_mmio_write(addr, bytes, p_data, pfec,
-                                         hvmemul_ctxt,
+        return hvmemul_linear_mmio_write(addr, bytes, buffer, pfec,
+                                         hvmemul_ctxt, start,
                                          known_gla(addr, bytes, pfec));
 
     case HVMTRANS_gfn_paged_out:
@@ -1645,7 +1675,7 @@ static int cf_check hvmemul_cmpxchg(
     {
         /* 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,
+                                         hvmemul_ctxt, addr,
                                          hvio->mmio_access.write_access &&
                                          hvio->mmio_gla == (addr & PAGE_MASK));
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:55:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890475.1299600 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1b6-0003ps-2K; Mon, 17 Feb 2025 13:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890475.1299600; Mon, 17 Feb 2025 13: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 1tk1b5-0003pk-Vh; Mon, 17 Feb 2025 13:55:43 +0000
Received: by outflank-mailman (input) for mailman id 890475;
 Mon, 17 Feb 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 1tk1b4-0003pZ-Oe
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk1b4-006qPE-38
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1b4-00Bbob-2H
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=QJLZfjRtr95XZ6c8q+NB+RNo9rG9u1FBua8zmj18vIM=; b=fjSBI7AwnGXsBKJfQNZzpgD3kK
	WU3/LtVD80+CG7dh2Cj59UMtVqm8XrbAuIOYF4aJreN5XR1TCqYF7XmRD156hWSBXE0zHD5ZFzBP+
	Nm9ZxrNtFMeylOsUQ81bXOrb9DJ705uvpB87mPX83eTs24ULajamePHJzGTKGlcwDbDI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/iommu: check for CMPXCHG16B when enabling IOMMU
Message-Id: <E1tk1b4-00Bbob-2H@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:55:42 +0000

commit 413945d3eeebba66b2613d24192f53f73117717c
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Mon Feb 17 13:29:27 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:29:27 2025 +0100

    x86/iommu: check for CMPXCHG16B when enabling IOMMU
    
    All hardware with VT-d/AMD-Vi has CMPXCHG16B support. Check this at
    initialisation time, and otherwise refuse to use the IOMMU.
    
    If the local APICs support x2APIC mode the IOMMU support for interrupt
    remapping will be checked earlier using a specific helper.  If no support
    for CX16 is detected by that earlier hook disable the IOMMU at that point
    and prevent further poking for CX16 later in the boot process, which would
    also fail.
    
    There's a possible corner case when running virtualized, and the underlying
    hypervisor exposing an IOMMU but no CMPXCHG16B support.  In which case
    ignoring the IOMMU is fine, albeit the most natural would be for the
    underlying hypervisor to also expose CMPXCHG16B support if an IOMMU is
    available to the VM.
    
    Note this change only introduces the checks, but doesn't remove the now
    stale checks for CX16 support sprinkled in the IOMMU code.  Further changes
    will take care of that.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2636fcdc15c707d5e097770133f0afb69e8d70c9
    master date: 2025-01-27 13:05:11 +0100
---
 xen/drivers/passthrough/amd/iommu_intr.c    | 13 +++++++++++++
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  6 ++++++
 xen/drivers/passthrough/vtd/intremap.c      | 13 +++++++++++++
 xen/drivers/passthrough/vtd/iommu.c         |  7 +++++++
 4 files changed, 39 insertions(+)

diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index d9eefcd8e4..040927b6d0 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -648,6 +648,19 @@ bool __init cf_check iov_supports_xt(void)
     if ( !iommu_enable || !iommu_intremap )
         return false;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        AMD_IOMMU_ERROR("no CMPXCHG16B support, disabling IOMMU\n");
+        /*
+         * Disable IOMMU support at once: there's no reason to check for CX16
+         * yet again when attempting to initialize IOMMU DMA remapping
+         * functionality or interrupt remapping without x2APIC support.
+         */
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+        return false;
+    }
+
     if ( amd_iommu_prepare(true) )
         return false;
 
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 6bc73dc210..40a56008aa 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -305,6 +305,12 @@ static int __init cf_check iov_detect(void)
     if ( !iommu_enable && !iommu_intremap )
         return 0;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        AMD_IOMMU_ERROR("no CMPXCHG16B support, disabling IOMMU\n");
+        return -ENODEV;
+    }
+
     if ( (init_done ? amd_iommu_init_late()
                     : amd_iommu_init(false)) != 0 )
     {
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index c504852eb8..233db5cb64 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -150,6 +150,19 @@ bool __init cf_check intel_iommu_supports_eim(void)
     if ( !iommu_qinval || !iommu_intremap || list_empty(&acpi_drhd_units) )
         return false;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        printk(XENLOG_ERR VTDPREFIX "no CMPXCHG16B support, disabling IOMMU\n");
+        /*
+         * Disable IOMMU support at once: there's no reason to check for CX16
+         * yet again when attempting to initialize IOMMU DMA remapping
+         * functionality or interrupt remapping without x2APIC support.
+         */
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+        return false;
+    }
+
     /* We MUST have a DRHD unit for each IOAPIC. */
     for ( apic = 0; apic < nr_ioapics; apic++ )
         if ( !ioapic_to_drhd(IO_APIC_ID(apic)) )
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 9ed616e211..a6f0071fe9 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2631,6 +2631,13 @@ static int __init cf_check vtd_setup(void)
     int ret;
     bool reg_inval_supported = true;
 
+    if ( unlikely(!cpu_has_cx16) )
+    {
+        printk(XENLOG_ERR VTDPREFIX "no CMPXCHG16B support, disabling IOMMU\n");
+        ret = -ENODEV;
+        goto error;
+    }
+
     if ( list_empty(&acpi_drhd_units) )
     {
         ret = -ENODEV;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:55:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890476.1299605 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1bG-0003st-5H; Mon, 17 Feb 2025 13:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890476.1299605; Mon, 17 Feb 2025 13: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 1tk1bG-0003sl-2a; Mon, 17 Feb 2025 13:55:54 +0000
Received: by outflank-mailman (input) for mailman id 890476;
 Mon, 17 Feb 2025 13: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 1tk1bE-0003sb-S9
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 13: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 1tk1bF-006qPI-0F
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1bE-00BbpI-2a
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13: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=8cWl7nAqvkZ2XDpBO1ub1tGZhqPbU8IU9NFETdCEdhQ=; b=NZd09oPuII2yTsLF79Wuj3Wcb9
	k+JIfry+Toks/3gbMPnOlqxEBe+ADiupTHV9etlnE0JmOcm0k9rMSzCuUdir3TEYI/sSy1vbzXldx
	N+yHYjoKxgBnlRdQo9LZjfkSp9xx9pOf4k3W2CdMkxobniHWsKDdtaas+niojhULwrxE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86emul: further correct 64-bit mode zero count repeated string insn handling
Message-Id: <E1tk1bE-00BbpI-2a@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:55:52 +0000

commit 01651b31a77fa710fabffe9c3f9ca323083d2d15
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:30:21 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:30:21 2025 +0100

    x86emul: further correct 64-bit mode zero count repeated string insn handling
    
    In an entirely different context I came across Linux commit 428e3d08574b
    ("KVM: x86: Fix zero iterations REP-string"), which points out that
    we're still doing things wrong: For one, there's no zero-extension at
    all on AMD. And then while RCX is zero-extended from 32 bits uniformly
    for all string instructions on newer hardware, RSI/RDI are only for MOVS
    and STOS on the systems I have access to. (On an old family 0xf system
    I've further found that for REP LODS even RCX is not zero-extended.)
    
    While touching the lines anyway, replace two casts in get_rep_prefix().
    
    Fixes: 79e996a89f69 ("x86emul: correct 64-bit mode repeated string insn handling with zero count")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 5310a042c4e3135c471446c8253ad13250539957
    master date: 2025-01-27 15:23:19 +0100
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index f2436473b9..af0a308814 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -513,7 +513,7 @@ static inline void put_loop_count(
         regs->r(cx) = ad_bytes == 4 ? (uint32_t)count : count;
 }
 
-#define get_rep_prefix(using_si, using_di) ({                           \
+#define get_rep_prefix(extend_si, extend_di) ({                         \
     unsigned long max_reps = 1;                                         \
     if ( rep_prefix() )                                                 \
         max_reps = get_loop_count(&_regs, ad_bytes);                    \
@@ -521,14 +521,14 @@ static inline void put_loop_count(
     {                                                                   \
         /*                                                              \
          * Skip the instruction if no repetitions are required, but     \
-         * zero extend involved registers first when using 32-bit       \
+         * zero extend relevant registers first when using 32-bit       \
          * addressing in 64-bit mode.                                   \
          */                                                             \
-        if ( mode_64bit() && ad_bytes == 4 )                            \
+        if ( !amd_like(ctxt) && mode_64bit() && ad_bytes == 4 )         \
         {                                                               \
             _regs.r(cx) = 0;                                            \
-            if ( using_si ) _regs.r(si) = (uint32_t)_regs.r(si);        \
-            if ( using_di ) _regs.r(di) = (uint32_t)_regs.r(di);        \
+            if ( extend_si ) _regs.r(si) = _regs.esi;                   \
+            if ( extend_di ) _regs.r(di) = _regs.edi;                   \
         }                                                               \
         goto complete_insn;                                             \
     }                                                                   \
@@ -1815,7 +1815,7 @@ x86_emulate(
         dst.bytes = !(b & 1) ? 1 : (op_bytes == 8) ? 4 : op_bytes;
         if ( (rc = ioport_access_check(port, dst.bytes, ctxt, ops)) != 0 )
             goto done;
-        nr_reps = get_rep_prefix(false, true);
+        nr_reps = get_rep_prefix(false, false /* don't extend RSI/RDI */);
         dst.mem.off = truncate_ea_and_reps(_regs.r(di), nr_reps, dst.bytes);
         dst.mem.seg = x86_seg_es;
         /* Try the presumably most efficient approach first. */
@@ -1857,7 +1857,7 @@ x86_emulate(
         dst.bytes = !(b & 1) ? 1 : (op_bytes == 8) ? 4 : op_bytes;
         if ( (rc = ioport_access_check(port, dst.bytes, ctxt, ops)) != 0 )
             goto done;
-        nr_reps = get_rep_prefix(true, false);
+        nr_reps = get_rep_prefix(false, false /* don't extend RSI/RDI */);
         ea.mem.off = truncate_ea_and_reps(_regs.r(si), nr_reps, dst.bytes);
         /* Try the presumably most efficient approach first. */
         if ( !ops->rep_outs )
@@ -2194,7 +2194,7 @@ x86_emulate(
     case 0xa6 ... 0xa7: /* cmps */ {
         unsigned long next_eip = _regs.r(ip);
 
-        get_rep_prefix(true, true);
+        get_rep_prefix(false, false /* don't extend RSI/RDI */);
         src.bytes = dst.bytes = (d & ByteOp) ? 1 : op_bytes;
         if ( (rc = read_ulong(ea.mem.seg, truncate_ea(_regs.r(si)),
                               &dst.val, dst.bytes, ctxt, ops)) ||
@@ -2236,7 +2236,7 @@ x86_emulate(
     }
 
     case 0xac ... 0xad: /* lods */
-        get_rep_prefix(true, false);
+        get_rep_prefix(false, false /* don't extend RSI/RDI */);
         if ( (rc = read_ulong(ea.mem.seg, truncate_ea(_regs.r(si)),
                               &dst.val, dst.bytes, ctxt, ops)) != 0 )
             goto done;
@@ -2247,7 +2247,7 @@ x86_emulate(
     case 0xae ... 0xaf: /* scas */ {
         unsigned long next_eip = _regs.r(ip);
 
-        get_rep_prefix(false, true);
+        get_rep_prefix(false, false /* don't extend RSI/RDI */);
         if ( (rc = read_ulong(x86_seg_es, truncate_ea(_regs.r(di)),
                               &dst.val, src.bytes, ctxt, ops)) != 0 )
             goto done;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:56:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890478.1299618 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1bQ-0004Ck-GW; Mon, 17 Feb 2025 13:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890478.1299618; Mon, 17 Feb 2025 13: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 1tk1bQ-0004Cc-Dv; Mon, 17 Feb 2025 13:56:04 +0000
Received: by outflank-mailman (input) for mailman id 890478;
 Mon, 17 Feb 2025 13: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 1tk1bO-0004Bo-Uk
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 13: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 1tk1bP-006qPf-0W
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1bO-00Bbqf-2t
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13: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=Z3gtwJABgu6vOHovW1PotOf8u8MTRhfXBdEv8XT2Ys8=; b=y7PloJIq7eBk6w1A+1nfUU4CGy
	uUrjkL4q3MzBFI+m0RaK6hseaAsE4HeBqVh0T9ouQgOmE6r2TYZZCANJYxko7sfUAT//l1jEJ8fuD
	7b6WZ5oKb3yr6UPvUOwg6BIN1wIjywDhFMB8eJzp8rpo+AYWwMTP7d2iNbRGHjk9rLpM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/PV: further harden guest memory accesses against speculative abuse
Message-Id: <E1tk1bO-00Bbqf-2t@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:56:02 +0000

commit 2ade095820b4c82be3bf1923b056679e9bca89b8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:30:38 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:30:38 2025 +0100

    x86/PV: further harden guest memory accesses against speculative abuse
    
    The original implementation has two issues: For one it doesn't preserve
    non-canonical-ness of inputs in the range 0x8000000000000000 through
    0x80007fffffffffff. Bogus guest pointers in that range would not cause a
    (#GP) fault upon access, when they should.
    
    And then there is an AMD-specific aspect, where only the low 48 bits of
    an address are used for speculative execution; the architecturally
    mandated #GP for non-canonical addresses would be raised at a later
    execution stage. Therefore to prevent Xen controlled data to make it
    into any of the caches in a guest controllable manner, we need to
    additionally ensure that for non-canonical inputs bit 47 would be clear.
    
    See the code comment for how addressing both is being achieved.
    
    Fixes: 4dc181599142 ("x86/PV: harden guest memory accesses against speculative abuse")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8306d773b03acec6062c0547ac05e3dd4a6960f6
    master date: 2025-01-27 15:23:59 +0100
---
 xen/arch/x86/include/asm/asm-defns.h | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/include/asm/asm-defns.h b/xen/arch/x86/include/asm/asm-defns.h
index d55dd3bbc3..32d6b44910 100644
--- a/xen/arch/x86/include/asm/asm-defns.h
+++ b/xen/arch/x86/include/asm/asm-defns.h
@@ -1,3 +1,5 @@
+#include <asm/page-bits.h>
+
 #ifndef HAVE_AS_CLAC_STAC
 .macro clac
     .byte 0x0f, 0x01, 0xca
@@ -65,17 +67,36 @@
 .macro guest_access_mask_ptr ptr:req, scratch1:req, scratch2:req
 #if defined(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS)
     /*
-     * Here we want
-     *
-     * ptr &= ~0ull >> (ptr < HYPERVISOR_VIRT_END);
-     *
+     * Here we want to adjust \ptr such that
+     * - if it's within Xen range, it becomes non-canonical,
+     * - otherwise if it's (non-)canonical on input, it retains that property,
+     * - if the result is non-canonical, bit 47 is clear (to avoid
+     *   potentially populating the cache with Xen data on AMD-like hardware),
      * but guaranteed without any conditional branches (hence in assembly).
+     *
+     * To achieve this we determine which bit to forcibly clear: Either bit 47
+     * (in case the address is below HYPERVISOR_VIRT_END) or bit 63.  Further
+     * we determine whether for forcably set bit 63: In case we first cleared
+     * it, we'll merely restore the original address.  In case we ended up
+     * clearing bit 47 (i.e. the address was either non-canonical or within Xen
+     * range), setting the bit will yield a guaranteed non-canonical address.
+     * If we didn't clear a bit, we also won't set one: The address was in the
+     * low half of address space in that case with bit 47 already clear.  The
+     * address can thus be left unchanged, whether canonical or not.
      */
     mov $(HYPERVISOR_VIRT_END - 1), \scratch1
-    mov $~0, \scratch2
+    mov $(VADDR_BITS - 1), \scratch2
     cmp \ptr, \scratch1
+    /*
+     * Not needed: The value we have in \scratch1 will be truncated to 6 bits,
+     * thus yielding the value we need.
+    mov $63, \scratch1
+     */
+    cmovnb \scratch2, \scratch1
+    xor \scratch2, \scratch2
+    btr \scratch1, \ptr
     rcr $1, \scratch2
-    and \scratch2, \ptr
+    or \scratch2, \ptr
 #elif defined(CONFIG_DEBUG) && defined(CONFIG_PV)
     xor $~\@, \scratch1
     xor $~\@, \scratch2
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:56:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890481.1299624 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1ba-0004Jr-IG; Mon, 17 Feb 2025 13:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890481.1299624; Mon, 17 Feb 2025 13: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 1tk1ba-0004Jj-FI; Mon, 17 Feb 2025 13:56:14 +0000
Received: by outflank-mailman (input) for mailman id 890481;
 Mon, 17 Feb 2025 13: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 1tk1bZ-0004JH-1e
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 13: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 1tk1bZ-006qPz-0p
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1bY-00BbrK-3A
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13: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=A6sLUmsqn9SWXXY8goldF2h9hsfCr4E8lPHFi6ywGtY=; b=MuvUTlwLMYhC50dWqgxadq+XpX
	pU+5yBPtVuL21uJSIhjGfRUf3G7bfGmnQuJqj8deiDf/HppOqZwGVlNRNPD28zOOq++DBOFNXYLiW
	iNbKZmED8ZOma2fDrattH2gyhPviByg32wzan18BALawNm8P+/9EENWHKlg9R/l5SoMI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/intel: Fix PERF_GLOBAL fixup when virtualised
Message-Id: <E1tk1bY-00BbrK-3A@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:56:12 +0000

commit 5a66ba0572b2b987a6a1d0c5b4752315556c8d28
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 17 13:31:06 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:31:06 2025 +0100

    x86/intel: Fix PERF_GLOBAL fixup when virtualised
    
    Logic using performance counters needs to look at
    MSR_MISC_ENABLE.PERF_AVAILABLE before touching any other resources.
    
    When virtualised under ESX, Xen dies with a #GP fault trying to read
    MSR_CORE_PERF_GLOBAL_CTRL.
    
    Factor this logic out into a separate function (it's already too squashed to
    the RHS), and insert a check of MSR_MISC_ENABLE.PERF_AVAILABLE.
    
    This also avoids setting X86_FEATURE_ARCH_PERFMON if MSR_MISC_ENABLE says that
    PERF is unavailable, although oprofile (the only consumer of this flag)
    cross-checks too.
    
    Fixes: 6bdb965178bb ("x86/intel: ensure Global Performance Counter Control is setup correctly")
    Reported-by: Jonathan Katz <jonathan.katz@aptar.com>
    Link: https://xcp-ng.org/forum/topic/10286/nesting-xcp-ng-on-esx-8
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Tested-by: Jonathan Katz <jonathan.katz@aptar.com>
    master commit: dd05d265b8abda4cc7206b29cd71b77fb46658bf
    master date: 2025-01-28 11:19:45 +0000
---
 xen/arch/x86/cpu/intel.c | 64 ++++++++++++++++++++++++++++--------------------
 1 file changed, 37 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index 0dc7c27601..31f68cd6bd 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -535,39 +535,49 @@ static void intel_log_freq(const struct cpuinfo_x86 *c)
     printk("%u MHz\n", (factor * max_ratio + 50) / 100);
 }
 
+static void init_intel_perf(struct cpuinfo_x86 *c)
+{
+    uint64_t val;
+    unsigned int eax, ver, nr_cnt;
+
+    if ( c->cpuid_level <= 9 ||
+         ({  rdmsrl(MSR_IA32_MISC_ENABLE, val);
+             !(val & MSR_IA32_MISC_ENABLE_PERF_AVAIL); }) )
+        return;
+
+    eax = cpuid_eax(10);
+    ver = eax & 0xff;
+    nr_cnt = (eax >> 8) & 0xff;
+
+    if ( ver && nr_cnt > 1 && nr_cnt <= 32 )
+    {
+        unsigned int cnt_mask = (1UL << nr_cnt) - 1;
+
+        /*
+         * On (some?) Sapphire/Emerald Rapids platforms each package-BSP
+         * starts with all the enable bits for the general-purpose PMCs
+         * cleared.  Adjust so counters can be enabled from EVNTSEL.
+         */
+        rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, val);
+
+        if ( (val & cnt_mask) != cnt_mask )
+        {
+            printk("FIRMWARE BUG: CPU%u invalid PERF_GLOBAL_CTRL: %#"PRIx64" adjusting to %#"PRIx64"\n",
+                   smp_processor_id(), val, val | cnt_mask);
+            wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, val | cnt_mask);
+        }
+
+        __set_bit(X86_FEATURE_ARCH_PERFMON, c->x86_capability);
+    }
+}
+
 static void cf_check init_intel(struct cpuinfo_x86 *c)
 {
 	/* Detect the extended topology information if available */
 	detect_extended_topology(c);
 
 	init_intel_cacheinfo(c);
-	if (c->cpuid_level > 9) {
-		unsigned eax = cpuid_eax(10);
-		unsigned int cnt = (eax >> 8) & 0xff;
-
-		/* Check for version and the number of counters */
-		if ((eax & 0xff) && (cnt > 1) && (cnt <= 32)) {
-			uint64_t global_ctrl;
-			unsigned int cnt_mask = (1UL << cnt) - 1;
-
-			/*
-			 * On (some?) Sapphire/Emerald Rapids platforms each
-			 * package-BSP starts with all the enable bits for the
-			 * general-purpose PMCs cleared.  Adjust so counters
-			 * can be enabled from EVNTSEL.
-			 */
-			rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, global_ctrl);
-			if ((global_ctrl & cnt_mask) != cnt_mask) {
-				printk("CPU%u: invalid PERF_GLOBAL_CTRL: %#"
-				       PRIx64 " adjusting to %#" PRIx64 "\n",
-				       smp_processor_id(), global_ctrl,
-				       global_ctrl | cnt_mask);
-				wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL,
-				       global_ctrl | cnt_mask);
-			}
-			__set_bit(X86_FEATURE_ARCH_PERFMON, c->x86_capability);
-		}
-	}
+	init_intel_perf(c);
 
 	if ( !cpu_has(c, X86_FEATURE_XTOPOLOGY) )
 	{
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:56:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890488.1299627 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1bk-0004WA-JG; Mon, 17 Feb 2025 13:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890488.1299627; Mon, 17 Feb 2025 13: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 1tk1bk-0004W2-Gi; Mon, 17 Feb 2025 13:56:24 +0000
Received: by outflank-mailman (input) for mailman id 890488;
 Mon, 17 Feb 2025 13: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 1tk1bj-0004Vi-5E
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 13: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 1tk1bj-006qQ3-1C
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1bj-00BbtZ-0F
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13: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=qPblPvC6NVDEcF+pvbKtXjMRKOptRXzH0BlDYkg3R+o=; b=jnFt7XmY00SBytcZCA0YH8dO8a
	YF4hlzH+cqt1/R46LzsZhdfU8QggA2TQgs+VDHwctbzNfjDVFQ8+VElw4LXsfx/lpW7DqKH89IfJ5
	0W/n3CQAi32DFUH9Lqp9I1ojFEfr8ANtJTFCtuaRp5AhOfBWZqU7PtuoRSUtuLaa8dms=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] radix-tree: purge node allocation override hooks
Message-Id: <E1tk1bj-00BbtZ-0F@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:56:23 +0000

commit 9b7b348f204f8b49cb183bb2e55281b7ca02b782
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:31:22 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:31:22 2025 +0100

    radix-tree: purge node allocation override hooks
    
    These were needed by TMEM only, which is long gone. The Linux original
    doesn't have such either. This effectively reverts one of the "Other
    changes" from 8dc6738dbb3c ("Update radix-tree.[ch] from upstream Linux
    to gain RCU awareness").
    
    Positive side effect: Two cf_check go away.
    
    While there also convert xmalloc()+memset() to xzalloc().
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 1275093a96fed45057db241b3aa6e191d9dcf596
    master date: 2025-02-07 09:59:11 +0100
---
 xen/common/radix-tree.c      | 37 ++++++-------------------------------
 xen/include/xen/radix-tree.h | 10 ----------
 2 files changed, 6 insertions(+), 41 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index adc3034222..994a5a3b3d 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -52,12 +52,6 @@ struct rcu_node {
 	struct rcu_head rcu_head;
 };
 
-static struct radix_tree_node *cf_check rcu_node_alloc(void *arg)
-{
-	struct rcu_node *rcu_node = xmalloc(struct rcu_node);
-	return rcu_node ? &rcu_node->node : NULL;
-}
-
 static void cf_check _rcu_node_free(struct rcu_head *head)
 {
 	struct rcu_node *rcu_node =
@@ -65,26 +59,20 @@ static void cf_check _rcu_node_free(struct rcu_head *head)
 	xfree(rcu_node);
 }
 
-static void cf_check rcu_node_free(struct radix_tree_node *node, void *arg)
-{
-	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
-	call_rcu(&rcu_node->rcu_head, _rcu_node_free);
-}
-
 static struct radix_tree_node *radix_tree_node_alloc(
 	struct radix_tree_root *root)
 {
-	struct radix_tree_node *ret;
-	ret = root->node_alloc(root->node_alloc_free_arg);
-	if (ret)
-		memset(ret, 0, sizeof(*ret));
-	return ret;
+	struct rcu_node *rcu_node = xzalloc(struct rcu_node);
+
+	return rcu_node ? &rcu_node->node : NULL;
 }
 
 static void radix_tree_node_free(
 	struct radix_tree_root *root, struct radix_tree_node *node)
 {
-	root->node_free(node, root->node_alloc_free_arg);
+	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
+
+	call_rcu(&rcu_node->rcu_head, _rcu_node_free);
 }
 
 /*
@@ -717,19 +705,6 @@ void radix_tree_destroy(
 void radix_tree_init(struct radix_tree_root *root)
 {
 	memset(root, 0, sizeof(*root));
-	root->node_alloc = rcu_node_alloc;
-	root->node_free = rcu_node_free;
-}
-
-void radix_tree_set_alloc_callbacks(
-	struct radix_tree_root *root,
-	radix_tree_alloc_fn_t *node_alloc,
-	radix_tree_free_fn_t *node_free,
-	void *node_alloc_free_arg)
-{
-	root->node_alloc = node_alloc;
-	root->node_free = node_free;
-	root->node_alloc_free_arg = node_alloc_free_arg;
 }
 
 static __init unsigned long __maxindex(unsigned int height)
diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 58c40312e6..9d5ffae3eb 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -66,11 +66,6 @@ typedef void radix_tree_free_fn_t(struct radix_tree_node *, void *);
 struct radix_tree_root {
 	unsigned int		height;
 	struct radix_tree_node	__rcu *rnode;
-
-	/* Allow to specify custom node alloc/dealloc routines. */
-	radix_tree_alloc_fn_t *node_alloc;
-	radix_tree_free_fn_t *node_free;
-	void *node_alloc_free_arg;
 };
 
 /*
@@ -78,11 +73,6 @@ struct radix_tree_root {
  */
 
 void radix_tree_init(struct radix_tree_root *root);
-void radix_tree_set_alloc_callbacks(
-	struct radix_tree_root *root,
-	radix_tree_alloc_fn_t *node_alloc,
-	radix_tree_free_fn_t *node_free,
-	void *node_alloc_free_arg);
 
 void radix_tree_destroy(
 	struct radix_tree_root *root,
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:56:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890490.1299630 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1bu-0004ZV-Ko; Mon, 17 Feb 2025 13:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890490.1299630; Mon, 17 Feb 2025 13: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 1tk1bu-0004ZN-I8; Mon, 17 Feb 2025 13:56:34 +0000
Received: by outflank-mailman (input) for mailman id 890490;
 Mon, 17 Feb 2025 13: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 1tk1bt-0004Z6-8C
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 13: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 1tk1bt-006qQA-1U
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:56:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1bt-00BbuI-0c
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13: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=owqRp8KcYYAN25W2xqTkx4NqZ5sCXXfmmqBSh+3mpmI=; b=VFqXO1u4sm76jqj1+9bHh+qxfH
	jQj8XL4SVV5+sdy/OMBnj5QXBJGpIxbHWqVLy+UTJOtJlcMDNDbKBkA67UNnuGxPvN4htdnv1889U
	zIHnAoHcPTzZPbFvMWp9LxThCyiK7PpK0F6+9Qz0dn875EWqFcCc+W0rDXCud+wOGKIM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] radix-tree: introduce RADIX_TREE{,_INIT}()
Message-Id: <E1tk1bt-00BbuI-0c@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:56:33 +0000

commit 3013bdc7f773f1394a89885d9df52a1ac006af68
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 17 13:31:59 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:31:59 2025 +0100

    radix-tree: introduce RADIX_TREE{,_INIT}()
    
    ... now that static initialization is possible. Use RADIX_TREE() for
    pci_segments and ivrs_maps.
    
    This then fixes an ordering issue on x86: With the call to
    radix_tree_init(), acpi_mmcfg_init()'s invocation of pci_segments_init()
    will zap the possible earlier introduction of segment 0 by
    amd_iommu_detect_one_acpi()'s call to pci_ro_device(), and thus the
    write-protection of the PCI devices representing AMD IOMMUs.
    
    Fixes: 3950f2485bbc ("x86/x2APIC: defer probe until after IOMMU ACPI table parsing")
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 26fe09e34566d701ecaea76b4563bb9934e85861
    master date: 2025-02-07 10:00:04 +0100
---
 xen/common/radix-tree.c                  | 2 +-
 xen/drivers/passthrough/amd/iommu_init.c | 3 +--
 xen/drivers/passthrough/pci.c            | 3 +--
 xen/include/xen/radix-tree.h             | 3 +++
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index 994a5a3b3d..ac4bfbd3f4 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -704,7 +704,7 @@ void radix_tree_destroy(
 
 void radix_tree_init(struct radix_tree_root *root)
 {
-	memset(root, 0, sizeof(*root));
+	*root = (struct radix_tree_root)RADIX_TREE_INIT();
 }
 
 static __init unsigned long __maxindex(unsigned int height)
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 9c01a49435..d672e682f8 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -32,7 +32,7 @@ static DECLARE_SOFTIRQ_TASKLET(amd_iommu_irq_tasklet, do_amd_iommu_irq, NULL);
 unsigned int __read_mostly amd_iommu_acpi_info;
 unsigned int __read_mostly ivrs_bdf_entries;
 u8 __read_mostly ivhd_type;
-static struct radix_tree_root ivrs_maps;
+static RADIX_TREE(ivrs_maps);
 LIST_HEAD_READ_MOSTLY(amd_iommu_head);
 bool iommuv2_enabled;
 
@@ -1406,7 +1406,6 @@ int __init amd_iommu_prepare(bool xt)
         goto error_out;
     ivrs_bdf_entries = rc;
 
-    radix_tree_init(&ivrs_maps);
     for_each_amd_iommu ( iommu )
     {
         rc = amd_iommu_prepare_one(iommu);
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 2a1e7ee89a..0852e4f172 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -68,7 +68,7 @@ bool pcidevs_locked(void)
     return !!spin_is_locked(&_pcidevs_lock);
 }
 
-static struct radix_tree_root pci_segments;
+static RADIX_TREE(pci_segments);
 
 static inline struct pci_seg *get_pseg(u16 seg)
 {
@@ -124,7 +124,6 @@ static int pci_segments_iterate(
 
 void __init pci_segments_init(void)
 {
-    radix_tree_init(&pci_segments);
     if ( !alloc_pseg(0) )
         panic("Could not initialize PCI segment 0\n");
 }
diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 9d5ffae3eb..4077365972 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -72,6 +72,9 @@ struct radix_tree_root {
  *** radix-tree API starts here **
  */
 
+#define RADIX_TREE_INIT() {}
+#define RADIX_TREE(name) struct radix_tree_root name = RADIX_TREE_INIT()
+
 void radix_tree_init(struct radix_tree_root *root);
 
 void radix_tree_destroy(
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:56:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:56:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890492.1299634 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1c3-0004eJ-N9; Mon, 17 Feb 2025 13:56:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890492.1299634; Mon, 17 Feb 2025 13: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 1tk1c3-0004eC-Km; Mon, 17 Feb 2025 13:56:43 +0000
Received: by outflank-mailman (input) for mailman id 890492;
 Mon, 17 Feb 2025 13: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 1tk1c3-0004e4-BY
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 13: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 1tk1c3-006qQJ-1p
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:56:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1c3-00BbvD-0t
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13: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=D9fPnSYEAKchp73jZ5alzv+I/CW2FNmwPQ6f/nHEvNk=; b=zUMtS4VlmHnpGwD3+8spQbRqGa
	z+AAAl0/kTFjfrCZzQrCtUlDwjCUoBPC4IkqZek7hPuPh95Br6DUgNNw9CdU+0KcXo2jcKiSr4LNs
	taOYOjXRcuHIn7b0I+Pjq2YKcL7t5Gfd1mVTJJzZkZweQP0cT3Z1Oi7hH5spmcm/6KNA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/shutdown: offline APs with interrupts disabled on all CPUs
Message-Id: <E1tk1c3-00BbvD-0t@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:56:43 +0000

commit 79116ff8bbd4e93cee8a8a6515061e3c803b397b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:32:17 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:32:17 2025 +0100

    x86/shutdown: offline APs with interrupts disabled on all CPUs
    
    The current shutdown logic in smp_send_stop() will disable the APs while
    having interrupts enabled on the BSP or possibly other APs. On AMD systems
    this can lead to local APIC errors:
    
    APIC error on CPU0: 00(08), Receive accept error
    
    Such error message can be printed in a loop, thus blocking the system from
    rebooting.  I assume this loop is created by the error being triggered by
    the console interrupt, which is further stirred by the ESR handler
    printing to the console.
    
    Intel SDM states:
    
    "Receive Accept Error.
    
    Set when the local APIC detects that the message it received was not
    accepted by any APIC on the APIC bus, including itself. Used only on P6
    family and Pentium processors."
    
    So the error shouldn't trigger on any Intel CPU supported by Xen.
    
    However AMD doesn't make such claims, and indeed the error is broadcast to
    all local APICs when an interrupt targets a CPU that's already offline.
    
    To prevent the error from stalling the shutdown process perform the
    disabling of APs and the BSP local APIC with interrupts disabled on all
    CPUs in the system, so that by the time interrupts are unmasked on the BSP
    the local APIC is already disabled.  This can still lead to a spurious:
    
    APIC error on CPU0: 00(00)
    
    As a result of an LVT Error getting injected while interrupts are masked on
    the CPU, and the vector only handled after the local APIC is already
    disabled.  ESR reports 0 because as part of disable_local_APIC() the ESR
    register is cleared.
    
    Note the NMI crash path doesn't have such issue, because disabling of APs
    and the caller local APIC is already done in the same contiguous region
    with interrupts disabled.  There's a possible window on the NMI crash path
    (nmi_shootdown_cpus()) where some APs might be disabled (and thus
    interrupts targeting them raising "Receive accept error") before others APs
    have interrupts disabled.  However the shutdown NMI will be handled,
    regardless of whether the AP is processing a local APIC error, and hence
    such interrupts will not cause the shutdown process to get stuck.
    
    Remove the call to fixup_irqs() in smp_send_stop(): it doesn't achieve the
    intended goal of moving all interrupts to the BSP anyway.  The logic in
    fixup_irqs() will move interrupts whose affinity doesn't overlap with the
    passed mask, but the movement of interrupts is done to any CPU set in
    cpu_online_map.  As in the shutdown path fixup_irqs() is called before APs
    are cleared from cpu_online_map this leads to interrupts being shuffled
    around, but not assigned to the BSP exclusively.
    
    The Fixes tag is more of a guess than a certainty; it's possible the
    previous sleep window in fixup_irqs() allowed any in-flight interrupt to be
    delivered before APs went offline.  However fixup_irqs() was still
    incorrectly used, as it didn't (and still doesn't) move all interrupts to
    target the provided cpu mask.
    
    Fixes: e2bb28d62158 ('x86/irq: forward pending interrupts to new destination in fixup_irqs()')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1191ce954f64244a3c5f553116184928bcc677e8
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/smp.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 340fcafb46..ed67eff8db 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -343,6 +343,11 @@ void __stop_this_cpu(void)
 
 static void cf_check stop_this_cpu(void *dummy)
 {
+    const bool *stop_aps = dummy;
+
+    while ( !*stop_aps )
+        cpu_relax();
+
     __stop_this_cpu();
     for ( ; ; )
         halt();
@@ -355,16 +360,25 @@ static void cf_check stop_this_cpu(void *dummy)
 void smp_send_stop(void)
 {
     unsigned int cpu = smp_processor_id();
+    bool stop_aps = false;
+
+    /*
+     * Perform AP offlining and disabling of interrupt controllers with all
+     * CPUs on the system having interrupts disabled to prevent interrupt
+     * delivery errors.  On AMD systems "Receive accept error" will be
+     * broadcast to local APICs if interrupts target CPUs that are offline.
+     */
+    if ( num_online_cpus() > 1 )
+        smp_call_function(stop_this_cpu, &stop_aps, 0);
+
+    local_irq_disable();
 
     if ( num_online_cpus() > 1 )
     {
         int timeout = 10;
 
-        local_irq_disable();
-        fixup_irqs(cpumask_of(cpu), 0);
-        local_irq_enable();
-
-        smp_call_function(stop_this_cpu, NULL, 0);
+        /* Signal APs to stop. */
+        stop_aps = true;
 
         /* Wait 10ms for all other CPUs to go offline. */
         while ( (num_online_cpus() > 1) && (timeout-- > 0) )
@@ -373,13 +387,12 @@ void smp_send_stop(void)
 
     if ( cpu_online(cpu) )
     {
-        local_irq_disable();
         disable_IO_APIC();
         hpet_disable();
         __stop_this_cpu();
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
-        local_irq_enable();
     }
+    local_irq_enable();
 }
 
 void smp_send_nmi_allbutself(void)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:56:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:56:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890493.1299639 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1cD-0004is-P9; Mon, 17 Feb 2025 13:56:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890493.1299639; Mon, 17 Feb 2025 13: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 1tk1cD-0004ik-MS; Mon, 17 Feb 2025 13:56:53 +0000
Received: by outflank-mailman (input) for mailman id 890493;
 Mon, 17 Feb 2025 13: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 1tk1cD-0004ie-E9
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 13: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 1tk1cD-006qQX-25
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:56:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1cD-00BbwN-1F
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13: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=FxD7Pq4Y8Ri1MMDn67gm51USW5oKfScN/y2b7n2CJt8=; b=sbqBMfPD3UxdgJ4VqpRQdM0yg2
	HM5wCDReAE8eYotG5h9r5O7QCg/wI3WjKh0nW7e9Cc6s+tP2aVGYdD9Uo2gs8rd1WA9Gp7DpKQ3Un
	WnvbFtAmpSCS7H1QHXTqtHXnFhUN5k1A8Y7nbqkN4k+H4H+Ar8k2DaH3zQVSeO/FsS1Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/smp: perform disabling on interrupts ahead of AP shutdown
Message-Id: <E1tk1cD-00BbwN-1F@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:56:53 +0000

commit 8cd8dddda705fdb9a18ae1d426378b7e01e84d92
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:32:40 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:32:40 2025 +0100

    x86/smp: perform disabling on interrupts ahead of AP shutdown
    
    Move the disabling of interrupt sources so it's done ahead of the offlining
    of APs.  This is to prevent AMD systems triggering "Receive accept error"
    when interrupts target CPUs that are no longer online.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: db6daa9bf411260d2c1f5301e4fc786ae4a5cef8
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/smp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index ed67eff8db..bf095ea6c6 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -372,6 +372,8 @@ void smp_send_stop(void)
         smp_call_function(stop_this_cpu, &stop_aps, 0);
 
     local_irq_disable();
+    disable_IO_APIC();
+    hpet_disable();
 
     if ( num_online_cpus() > 1 )
     {
@@ -387,8 +389,6 @@ void smp_send_stop(void)
 
     if ( cpu_online(cpu) )
     {
-        disable_IO_APIC();
-        hpet_disable();
         __stop_this_cpu();
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:57:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:57:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890495.1299642 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1cO-0004lv-QN; Mon, 17 Feb 2025 13:57:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890495.1299642; Mon, 17 Feb 2025 13: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 1tk1cO-0004ln-Nt; Mon, 17 Feb 2025 13:57:04 +0000
Received: by outflank-mailman (input) for mailman id 890495;
 Mon, 17 Feb 2025 13: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 1tk1cN-0004ld-Hn
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 13: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 1tk1cN-006qQy-2R
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:57:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1cN-00BbxC-1W
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13: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=IykiYToDygcgXgHmRjk25X2JBKcxmEmSVwetewgv/nk=; b=ONDsa50hxkEG7oSg17c5jpoR5O
	gr09/XjCG49aD7D8i3m8elyFgX0x0apIHWCYeJr6aO2oiZZS1QeSK1L6FfDQqyBFz1AIh239jWlAo
	K40A/lQLIFtDLyKPdMM5dUGFIDEe4/I04NIzpOAEfURYMp5gP9Lpy4es3/rzuWCf1hyI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/pci: disable MSI(-X) on all devices at shutdown
Message-Id: <E1tk1cN-00BbxC-1W@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:57:03 +0000

commit 9f4c92d70e3aff831c34e324dabf209bf7b6ab4e
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:32:52 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:32:52 2025 +0100

    x86/pci: disable MSI(-X) on all devices at shutdown
    
    Attempt to disable MSI(-X) capabilities on all PCI devices know by Xen at
    shutdown.  Doing such disabling should facilitate kexec chained kernel from
    booting more reliably, as device MSI(-X) interrupt generation should be
    quiesced.
    
    Only attempt to disable MSI(-X) on all devices in the crash context if the
    PCI lock is not taken, otherwise the PCI device list could be in an
    inconsistent state.  This requires introducing a new pcidevs_trylock()
    helper to check whether the lock is currently taken.
    
    Disabling MSI(-X) should prevent "Receive accept error" being raised as a
    result of non-disabled interrupts targeting offline CPUs.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 7ab6951981231b4c576a3588248c303001272588
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/crash.c           | 10 ++++++++++
 xen/arch/x86/include/asm/msi.h |  1 +
 xen/arch/x86/msi.c             | 18 ++++++++++++++++++
 xen/arch/x86/smp.c             |  1 +
 xen/drivers/passthrough/pci.c  | 42 ++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/pci.h          | 12 ++++++++++++
 6 files changed, 84 insertions(+)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index a789416ca3..22b1121d7a 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -175,6 +175,16 @@ static void nmi_shootdown_cpus(void)
          */
         x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
 
+        if ( pcidevs_trylock() )
+        {
+            /*
+             * Assume the PCI device list to be in a consistent state if the
+             * lock is not held when the crash happened.
+             */
+            pci_disable_msi_all();
+            pcidevs_unlock();
+        }
+
         disable_IO_APIC();
         hpet_disable();
     }
diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index a53ade95c9..5f5b499c82 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -85,6 +85,7 @@ extern int pci_enable_msi(struct msi_info *msi, struct msi_desc **desc);
 extern void pci_disable_msi(struct msi_desc *desc);
 extern int pci_prepare_msix(u16 seg, u8 bus, u8 devfn, bool off);
 extern void pci_cleanup_msi(struct pci_dev *pdev);
+extern void pci_disable_msi_all(void);
 extern int setup_msi_irq(struct irq_desc *, struct msi_desc *);
 extern int __setup_msi_irq(struct irq_desc *, struct msi_desc *,
                            const struct hw_interrupt_type *);
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 3eaeffd1e0..850995730c 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -1193,6 +1193,24 @@ void pci_cleanup_msi(struct pci_dev *pdev)
     msi_free_irqs(pdev);
 }
 
+static int cf_check disable_msi(struct pci_dev *pdev, void *arg)
+{
+    msi_set_enable(pdev, 0);
+    msix_set_enable(pdev, 0);
+
+    return 0;
+}
+
+/* Disable MSI and/or MSI-X on all devices known by Xen. */
+void pci_disable_msi_all(void)
+{
+    int rc = pci_iterate_devices(disable_msi, NULL);
+
+    if ( rc )
+        printk(XENLOG_ERR
+               "Failed to disable MSI(-X) on some devices: %d\n", rc);
+}
+
 int pci_reset_msix_state(struct pci_dev *pdev)
 {
     unsigned int pos = pci_find_cap_offset(pdev->sbdf, PCI_CAP_ID_MSIX);
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index bf095ea6c6..3b79436b31 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -372,6 +372,7 @@ void smp_send_stop(void)
         smp_call_function(stop_this_cpu, &stop_aps, 0);
 
     local_irq_disable();
+    pci_disable_msi_all();
     disable_IO_APIC();
     hpet_disable();
 
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 0852e4f172..b7afdccf23 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -68,6 +68,11 @@ bool pcidevs_locked(void)
     return !!spin_is_locked(&_pcidevs_lock);
 }
 
+bool pcidevs_trylock_unsafe(void)
+{
+    return spin_trylock_recursive(&_pcidevs_lock);
+}
+
 static RADIX_TREE(pci_segments);
 
 static inline struct pci_seg *get_pseg(u16 seg)
@@ -1691,6 +1696,43 @@ int iommu_do_pci_domctl(
     return ret;
 }
 
+struct segment_iter {
+    int (*handler)(struct pci_dev *pdev, void *arg);
+    void *arg;
+    int rc;
+};
+
+static int cf_check iterate_all(struct pci_seg *pseg, void *arg)
+{
+    struct segment_iter *iter = arg;
+    struct pci_dev *pdev;
+
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+    {
+        int rc = iter->handler(pdev, iter->arg);
+
+        if ( !iter->rc )
+            iter->rc = rc;
+    }
+
+    return 0;
+}
+
+/*
+ * Iterate without locking or preemption over all PCI devices known by Xen.
+ * Can be called with interrupts disabled.
+ */
+int pci_iterate_devices(int (*handler)(struct pci_dev *pdev, void *arg),
+                        void *arg)
+{
+    struct segment_iter iter = {
+        .handler = handler,
+        .arg = arg,
+    };
+
+    return pci_segments_iterate(iterate_all, &iter) ?: iter.rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index a71bed36be..a880aae5eb 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -163,6 +163,11 @@ static always_inline void pcidevs_lock(void)
 }
 void pcidevs_unlock(void);
 bool __must_check pcidevs_locked(void);
+bool pcidevs_trylock_unsafe(void);
+static always_inline bool pcidevs_trylock(void)
+{
+    return lock_evaluate_nospec(pcidevs_trylock_unsafe());
+}
 
 bool pci_known_segment(u16 seg);
 bool pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func);
@@ -185,6 +190,13 @@ struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf);
 struct pci_dev *pci_get_real_pdev(pci_sbdf_t sbdf);
 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
 
+/*
+ * Iterate without locking or preemption over all PCI devices known by Xen.
+ * Can be called with interrupts disabled.
+ */
+int pci_iterate_devices(int (*handler)(struct pci_dev *pdev, void *arg),
+                        void *arg);
+
 uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
 uint16_t pci_conf_read16(pci_sbdf_t sbdf, unsigned int reg);
 uint32_t pci_conf_read32(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 13:57:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 13:57:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890496.1299647 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk1cY-0004of-Rz; Mon, 17 Feb 2025 13:57:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 890496.1299647; Mon, 17 Feb 2025 13: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 1tk1cY-0004oX-PM; Mon, 17 Feb 2025 13:57:14 +0000
Received: by outflank-mailman (input) for mailman id 890496;
 Mon, 17 Feb 2025 13: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 1tk1cX-0004oK-Ko
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 2025 13: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 1tk1cX-006qRQ-2j
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13:57:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk1cX-00Bbxr-1t
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 13: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=VOLklWZzp7quXW0QPYdX4tvk+S+Kd1ra1RTgHBXaaP8=; b=TmQGRtrQd0XSw45WSDsF4N6bzf
	yPNehKuZEoL61QH9JgwManypM8gCVVYlkl2JbmsYg3arUIkfHRC8C+0A5IN7aMscVghzIWO2K+KQH
	Ti+cbKueYpXBD0HmmIPyALt7qZ7xEdsMOuVSHih9ixvkct3zIAWeefZLabErgN6IeaEA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/iommu: disable interrupts at shutdown
Message-Id: <E1tk1cX-00Bbxr-1t@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 13:57:13 +0000

commit 63866198f57ba33f1040d5c92c7bdf0b925b0ba4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:33:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:33:12 2025 +0100

    x86/iommu: disable interrupts at shutdown
    
    Add a new hook to inhibit interrupt generation by the IOMMU(s).  Note the
    hook is currently only implemented for x86 IOMMUs.  The purpose is to
    disable interrupt generation at shutdown so any kexec chained image finds
    the IOMMU(s) in a quiesced state.
    
    It would also prevent "Receive accept error" being raised as a result of
    non-disabled interrupts targeting offline CPUs.
    
    Note that the iommu_quiesce() call in nmi_shootdown_cpus() is still
    required even when there's a preceding iommu_crash_shutdown() call; the
    later can become a no-op depending on the setting of the "crash-disable"
    command line option.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 819c3cb186a86ef3e04fb5af4d9f9f6de032c3ee
    master date: 2025-02-12 15:56:07 +0100
---
 xen/arch/x86/crash.c                        |  1 +
 xen/arch/x86/smp.c                          |  1 +
 xen/drivers/passthrough/amd/iommu.h         |  1 +
 xen/drivers/passthrough/amd/iommu_init.c    | 17 +++++++++++++++++
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  1 +
 xen/drivers/passthrough/iommu.c             | 12 ++++++++++++
 xen/drivers/passthrough/vtd/iommu.c         | 19 +++++++++++++++++++
 xen/include/xen/iommu.h                     |  3 +++
 8 files changed, 55 insertions(+)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 22b1121d7a..26057c71d3 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -187,6 +187,7 @@ static void nmi_shootdown_cpus(void)
 
         disable_IO_APIC();
         hpet_disable();
+        iommu_quiesce();
     }
 }
 
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 3b79436b31..1f86ed4f4c 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -375,6 +375,7 @@ void smp_send_stop(void)
     pci_disable_msi_all();
     disable_IO_APIC();
     hpet_disable();
+    iommu_quiesce();
 
     if ( num_online_cpus() > 1 )
     {
diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index d4416ebc43..551bc6c10c 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -340,6 +340,7 @@ extern unsigned long *shared_intremap_inuse;
 void cf_check amd_iommu_resume(void);
 int __must_check cf_check amd_iommu_suspend(void);
 void cf_check amd_iommu_crash_shutdown(void);
+void cf_check amd_iommu_quiesce(void);
 
 /* guest iommu support */
 #ifdef CONFIG_HVM
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index d672e682f8..1388f112d5 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -1606,3 +1606,20 @@ void cf_check amd_iommu_resume(void)
         invalidate_all_domain_pages();
     }
 }
+
+void cf_check amd_iommu_quiesce(void)
+{
+    struct amd_iommu *iommu;
+
+    for_each_amd_iommu ( iommu )
+    {
+        if ( iommu->ctrl.int_cap_xt_en )
+        {
+            iommu->ctrl.int_cap_xt_en = false;
+            writeq(iommu->ctrl.raw,
+                   iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
+        }
+        else
+            amd_iommu_msi_enable(iommu, IOMMU_CONTROL_DISABLED);
+    }
+}
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 40a56008aa..37ba23ac2d 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -784,6 +784,7 @@ static const struct iommu_ops __initconst_cf_clobber _iommu_ops = {
     .crash_shutdown = amd_iommu_crash_shutdown,
     .get_reserved_device_memory = amd_iommu_get_reserved_device_memory,
     .dump_page_tables = amd_dump_page_tables,
+    .quiesce = amd_iommu_quiesce,
 };
 
 static const struct iommu_init_ops __initconstrel _iommu_init_ops = {
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index f9a9f53dbd..46874d6c56 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -658,6 +658,18 @@ void iommu_crash_shutdown(void)
 #endif
 }
 
+void iommu_quiesce(void)
+{
+    const struct iommu_ops *ops;
+
+    if ( !iommu_enabled )
+        return;
+
+    ops = iommu_get_ops();
+    if ( ops->quiesce )
+        iommu_vcall(ops, quiesce);
+}
+
 int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt)
 {
     const struct iommu_ops *ops;
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index a6f0071fe9..5f9906a290 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -3241,6 +3241,24 @@ static int cf_check intel_iommu_quarantine_init(struct pci_dev *pdev,
     return rc;
 }
 
+static void cf_check vtd_quiesce(void)
+{
+    const struct acpi_drhd_unit *drhd;
+
+    for_each_drhd_unit ( drhd )
+    {
+        const struct vtd_iommu *iommu = drhd->iommu;
+        uint32_t sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
+
+        /*
+         * Open code dma_msi_mask() to avoid taking the spinlock which could
+         * deadlock if called from crash context.
+         */
+        sts |= DMA_FECTL_IM;
+        dmar_writel(iommu->reg, DMAR_FECTL_REG, sts);
+    }
+}
+
 static const struct iommu_ops __initconst_cf_clobber vtd_ops = {
     .page_sizes = PAGE_SIZE_4K,
     .init = intel_iommu_domain_init,
@@ -3270,6 +3288,7 @@ static const struct iommu_ops __initconst_cf_clobber vtd_ops = {
     .iotlb_flush = iommu_flush_iotlb,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_page_tables = vtd_dump_page_tables,
+    .quiesce = vtd_quiesce,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 0e747b0bbc..e9296e36ee 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -320,6 +320,8 @@ struct iommu_ops {
      */
     int (*dt_xlate)(device_t *dev, const struct dt_phandle_args *args);
 #endif
+    /* Inhibit all interrupt generation, to be used at shutdown. */
+    void (*quiesce)(void);
 };
 
 /*
@@ -400,6 +402,7 @@ static inline int iommu_do_domctl(struct xen_domctl *domctl, struct domain *d,
 int __must_check iommu_suspend(void);
 void iommu_resume(void);
 void iommu_crash_shutdown(void);
+void iommu_quiesce(void);
 int iommu_get_reserved_device_memory(iommu_grdm_t *func, void *ctxt);
 int iommu_quarantine_dev_init(device_t *dev);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Feb 17 14:44:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 17 Feb 2025 14:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.890562.1299705 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tk2Lr-0005jc-9H; Mon, 17 Feb 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 890562.1299705; Mon, 17 Feb 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 1tk2Lr-0005jU-6N; Mon, 17 Feb 2025 14:44:03 +0000
Received: by outflank-mailman (input) for mailman id 890562;
 Mon, 17 Feb 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 1tk2Lq-0005jO-5T
 for xen-changelog@lists.xenproject.org; Mon, 17 Feb 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 1tk2Lq-006rW8-0s
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 2025 14:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tk2Lp-00Bkrb-39
 for xen-changelog@lists.xenproject.org;
 Mon, 17 Feb 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=8hkB9F8C12d5aUll5YHX4L5A2fpk/HMnarA5pAL+ObA=; b=peOAf9/31P5MWVwPKgRENtDq9M
	VNvYsfIDBhN5QcqcO/oXQEkYnxQzXcUyPYZCSmzdDy/OrocZZP8GgJJJeXrhjQkIdpO4mGcWfZtUI
	tN4pCurPeDd8oFMjLU7Tz2p9Yl6YIgw238KoSLPh4qSZcmDm/rNbQLAfagrH0w0L7hk8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] iommu/amd: atomically update IRTE
Message-Id: <E1tk2Lp-00Bkrb-39@xenbits.xenproject.org>
Date: Mon, 17 Feb 2025 14:44:01 +0000

commit afce3802a77883d6ad96ca222983329020aca246
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Feb 17 13:36:15 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 17 13:36:15 2025 +0100

    iommu/amd: atomically update IRTE
    
    Either when using a 32bit Interrupt Remapping Entry or a 128bit one update
    the entry atomically, by using cmpxchg unconditionally as IOMMU depends on
    it.  No longer disable the entry by setting RemapEn = 0 ahead of updating
    it.  As a consequence of not toggling RemapEn ahead of the update the
    Interrupt Remapping Table needs to be flushed after the entry update.
    
    This avoids a window where the IRTE has RemapEn = 0, which can lead to
    IO_PAGE_FAULT if the underlying interrupt source is not masked.
    
    There's no guidance in AMD-Vi specification about how IRTE update should be
    performed as opposed to DTE updating which has specific guidance.  However
    DTE updating claims that reads will always be at least 128bits in size, and
    hence for the purposes here assume that reads and caching of the IRTE
    entries in either 32 or 128 bit format will be done atomically from
    the IOMMU.
    
    Note that as part of introducing a new raw128 field in the IRTE struct, the
    current raw field is renamed to raw64 to explicitly contain the size in the
    field name.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: b953a99da98d63a7c827248abc450d4e8e015ab6
    master date: 2025-01-27 13:05:11 +0100
---
 xen/drivers/passthrough/amd/iommu_intr.c | 75 ++++++++++++++------------------
 1 file changed, 32 insertions(+), 43 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index 040927b6d0..ab53eb36cd 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -39,7 +39,8 @@ union irte32 {
 };
 
 union irte128 {
-    uint64_t raw[2];
+    uint64_t raw64[2];
+    __uint128_t raw128;
     struct {
         bool remap_en:1;
         bool sup_io_pf:1;
@@ -186,7 +187,7 @@ static void free_intremap_entry(const struct amd_iommu *iommu,
 
     if ( iommu->ctrl.ga_en )
     {
-        ACCESS_ONCE(entry.ptr128->raw[0]) = 0;
+        ACCESS_ONCE(entry.ptr128->raw64[0]) = 0;
         /*
          * Low half (containing RemapEn) needs to be cleared first.  Note that
          * strictly speaking smp_wmb() isn't enough, as conceptually it expands
@@ -196,7 +197,7 @@ static void free_intremap_entry(const struct amd_iommu *iommu,
          * variant will do.
          */
         smp_wmb();
-        entry.ptr128->raw[1] = 0;
+        entry.ptr128->raw64[1] = 0;
     }
     else
         ACCESS_ONCE(entry.ptr32->raw) = 0;
@@ -211,7 +212,7 @@ static void update_intremap_entry(const struct amd_iommu *iommu,
 {
     if ( iommu->ctrl.ga_en )
     {
-        union irte128 irte = {
+        const union irte128 irte = {
             .full = {
                 .remap_en = true,
                 .int_type = int_type,
@@ -221,19 +222,26 @@ static void update_intremap_entry(const struct amd_iommu *iommu,
                 .vector = vector,
             },
         };
+        __uint128_t old = entry.ptr128->raw128;
+        __uint128_t res = cmpxchg16b(&entry.ptr128->raw128, &old,
+                                     &irte.raw128);
 
-        ASSERT(!entry.ptr128->full.remap_en);
-        entry.ptr128->raw[1] = irte.raw[1];
         /*
-         * High half needs to be set before low one (containing RemapEn).  See
-         * comment in free_intremap_entry() regarding the choice of barrier.
+         * Hardware does not update the IRTE behind our backs, so the return
+         * value should match "old".
          */
-        smp_wmb();
-        ACCESS_ONCE(entry.ptr128->raw[0]) = irte.raw[0];
+        if ( res != old )
+        {
+            printk(XENLOG_ERR
+                   "unexpected IRTE %016lx_%016lx (expected %016lx_%016lx)\n",
+                   (uint64_t)(res >> 64), (uint64_t)res,
+                   (uint64_t)(old >> 64), (uint64_t)old);
+            ASSERT_UNREACHABLE();
+        }
     }
     else
     {
-        union irte32 irte = {
+        const union irte32 irte = {
             .flds = {
                 .remap_en = true,
                 .int_type = int_type,
@@ -298,21 +306,13 @@ static int update_intremap_entry_from_ioapic(
 
     entry = get_intremap_entry(iommu, req_id, offset);
 
-    /* The RemapEn fields match for all formats. */
-    while ( iommu->enabled && entry.ptr32->flds.remap_en )
-    {
-        entry.ptr32->flds.remap_en = false;
-        spin_unlock(lock);
-
-        amd_iommu_flush_intremap(iommu, req_id);
-
-        spin_lock(lock);
-    }
-
     update_intremap_entry(iommu, entry, vector, delivery_mode, dest_mode, dest);
 
     spin_unlock_irqrestore(lock, flags);
 
+    if ( !fresh )
+        amd_iommu_flush_intremap(iommu, req_id);
+
     set_rte_index(rte, offset);
 
     return 0;
@@ -321,7 +321,7 @@ static int update_intremap_entry_from_ioapic(
 void cf_check amd_iommu_ioapic_update_ire(
     unsigned int apic, unsigned int pin, uint64_t rte)
 {
-    struct IO_APIC_route_entry old_rte, new_rte;
+    struct IO_APIC_route_entry new_rte;
     int seg, bdf, rc;
     struct amd_iommu *iommu;
     unsigned int idx;
@@ -345,14 +345,6 @@ void cf_check amd_iommu_ioapic_update_ire(
         return;
     }
 
-    old_rte = __ioapic_read_entry(apic, pin, true);
-    /* mask the interrupt while we change the intremap table */
-    if ( !old_rte.mask )
-    {
-        old_rte.mask = 1;
-        __ioapic_write_entry(apic, pin, true, old_rte);
-    }
-
     /* Update interrupt remapping entry */
     rc = update_intremap_entry_from_ioapic(
              bdf, iommu, &new_rte,
@@ -424,6 +416,7 @@ static int update_intremap_entry_from_msi_msg(
     uint8_t delivery_mode, vector, dest_mode;
     spinlock_t *lock;
     unsigned int dest, offset, i;
+    bool fresh = false;
 
     req_id = get_dma_requestor_id(iommu->seg, bdf);
     alias_id = get_intremap_requestor_id(iommu->seg, bdf);
@@ -467,26 +460,21 @@ static int update_intremap_entry_from_msi_msg(
             return -ENOSPC;
         }
         *remap_index = offset;
+        fresh = true;
     }
 
     entry = get_intremap_entry(iommu, req_id, offset);
 
-    /* The RemapEn fields match for all formats. */
-    while ( iommu->enabled && entry.ptr32->flds.remap_en )
-    {
-        entry.ptr32->flds.remap_en = false;
-        spin_unlock(lock);
+    update_intremap_entry(iommu, entry, vector, delivery_mode, dest_mode, dest);
+    spin_unlock_irqrestore(lock, flags);
 
+    if ( !fresh )
+    {
         amd_iommu_flush_intremap(iommu, req_id);
         if ( alias_id != req_id )
             amd_iommu_flush_intremap(iommu, alias_id);
-
-        spin_lock(lock);
     }
 
-    update_intremap_entry(iommu, entry, vector, delivery_mode, dest_mode, dest);
-    spin_unlock_irqrestore(lock, flags);
-
     *data = (msg->data & ~(INTREMAP_MAX_ENTRIES - 1)) | offset;
 
     /*
@@ -734,7 +722,7 @@ static void dump_intremap_table(const struct amd_iommu *iommu,
     for ( count = 0; count < nr; count++ )
     {
         if ( iommu->ctrl.ga_en
-             ? !tbl.ptr128[count].raw[0] && !tbl.ptr128[count].raw[1]
+             ? !tbl.ptr128[count].raw64[0] && !tbl.ptr128[count].raw64[1]
              : !tbl.ptr32[count].raw )
                 continue;
 
@@ -747,7 +735,8 @@ static void dump_intremap_table(const struct amd_iommu *iommu,
 
         if ( iommu->ctrl.ga_en )
             printk("    IRTE[%03x] %016lx_%016lx\n",
-                   count, tbl.ptr128[count].raw[1], tbl.ptr128[count].raw[0]);
+                   count, tbl.ptr128[count].raw64[1],
+                   tbl.ptr128[count].raw64[0]);
         else
             printk("    IRTE[%03x] %08x\n", count, tbl.ptr32[count].raw);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Feb 18 14:22:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Feb 2025 14:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.891454.1300488 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tkOUA-0000mD-PF; Tue, 18 Feb 2025 14:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 891454.1300488; Tue, 18 Feb 2025 14:22: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 1tkOUA-0000m5-MR; Tue, 18 Feb 2025 14:22:06 +0000
Received: by outflank-mailman (input) for mailman id 891454;
 Tue, 18 Feb 2025 14:22: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 1tkOU9-0000lz-4n
 for xen-changelog@lists.xenproject.org; Tue, 18 Feb 2025 14:22: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 1tkOU9-008ko2-0E
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Feb 2025 14:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tkOU8-00EB3a-2U
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Feb 2025 14:22: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=Ty7tOzRpPLR3aKbgWBLxYTivxZW6Uge1edfT9Ixz+fM=; b=1SDL0oUaJRmBPvCCRxDhf4OA9y
	gTgzZeRTLuqMBgk4UUepY3Qk2qZJAwBsEUJ6et1Xbs7FZ1sh1jAN6vJXcFx1tcObJIzbPdbJw+Ylh
	7uF+Dp18hMB5RvVP0iBSccdC2DmWVxIY/Y+JuAo4NS2x7kaHccyPRVDuOboMAV3shpH4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/console: Fix truncation of panic() messages
Message-Id: <E1tkOU8-00EB3a-2U@xenbits.xenproject.org>
Date: Tue, 18 Feb 2025 14:22:04 +0000

commit 81f8b1dd9407e4a3d9dc058b7fbbc591168649ad
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 22 12:13:24 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 18 14:15:58 2025 +0000

    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>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 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 7da8c5296f..2926c97df9 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -962,11 +962,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);
 }
 
@@ -1268,23 +1274,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 81b722ea3e..130f96791f 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -60,6 +60,8 @@ debugtrace_printk(const char *fmt, ...) {}
 
 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


From xen-changelog-bounces@lists.xenproject.org Tue Feb 18 15:11:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Feb 2025 15:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.891892.1300902 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tkPFW-0005Wn-DV; Tue, 18 Feb 2025 15:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 891892.1300902; Tue, 18 Feb 2025 15: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 1tkPFW-0005Wf-Al; Tue, 18 Feb 2025 15:11:02 +0000
Received: by outflank-mailman (input) for mailman id 891892;
 Tue, 18 Feb 2025 15: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 1tkPFV-0005WZ-NE
 for xen-changelog@lists.xenproject.org; Tue, 18 Feb 2025 15: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 1tkPFV-008ls4-1t
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Feb 2025 15:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tkPFV-00EFzY-0x
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Feb 2025 15: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=lr1U562WrYK9B+3NONf5ZurhhknRphHs9ad8aBCpvoc=; b=4a1XC3jqrfDpFZ55Wp+P09Wk5X
	i+wv3v+0mtp0nwizyNx4q3ol9vl4kd2vz+Xk7Ml2crno2sG000bclC0i/mBCtDi52C5gbk3N2ikK2
	bb7UWJRhpsfl11RJQ4ILPkG5tU8LuOENUDiqVhhElpaZl3YmIzi5TsskQ77sslEI/qtE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/console: Fix truncation of panic() messages
Message-Id: <E1tkPFV-00EFzY-0x@xenbits.xenproject.org>
Date: Tue, 18 Feb 2025 15:11:01 +0000

commit 81f8b1dd9407e4a3d9dc058b7fbbc591168649ad
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 22 12:13:24 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 18 14:15:58 2025 +0000

    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>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 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 7da8c5296f..2926c97df9 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -962,11 +962,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);
 }
 
@@ -1268,23 +1274,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 81b722ea3e..130f96791f 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -60,6 +60,8 @@ debugtrace_printk(const char *fmt, ...) {}
 
 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#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 18 20:44:15 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Feb 2025 20:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.892258.1301247 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tkURr-0004XO-3d; Tue, 18 Feb 2025 20:44:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 892258.1301247; Tue, 18 Feb 2025 20:44:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tkURr-0004XG-0O; Tue, 18 Feb 2025 20:44:07 +0000
Received: by outflank-mailman (input) for mailman id 892258;
 Tue, 18 Feb 2025 20:44: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 1tkURp-0004XA-Ff
 for xen-changelog@lists.xenproject.org; Tue, 18 Feb 2025 20:44: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 1tkURp-008tT0-11
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Feb 2025 20:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tkURp-00FIxq-00
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Feb 2025 20:44: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=EMbVKoApPFVpENtjjUXyxWi/6R4wwAh+gqVzcjb20B8=; b=fdvV9SUrnneo76niygzE8Uyxo/
	/pffH4DHipk/huAXeo9eOSoKcE6o+i0istRXuad2NPuv2+qlOxNCG0dWR2QAyg8AQ4ivrsXn1DevN
	+ruzgnbQ+MLqSRs3ejeEJRWRKuHoeLkrwknaBANsYA4GHP2EF26DjgqGIW6gUsPwFcAQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/memory: Make resource_max_frames() to return 0 on unknown type
Message-Id: <E1tkURp-00FIxq-00@xenbits.xenproject.org>
Date: Tue, 18 Feb 2025 20:44:05 +0000

commit 9b8708290002f0a4d0b363e0c66ce945f6b520bd
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Tue Feb 18 00:34:02 2025 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 18 14:47:34 2025 +0000

    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>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 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 a6f2f6d1b3..8ca4e1a842 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1157,7 +1157,7 @@ static unsigned int resource_max_frames(const struct domain *d,
         return d->vmtrace_size >> PAGE_SHIFT;
 
     default:
-        return -EOPNOTSUPP;
+        return 0;
     }
 }
 
@@ -1240,6 +1240,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


From xen-changelog-bounces@lists.xenproject.org Tue Feb 18 21:22:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 18 Feb 2025 21:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.892260.1301250 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tkV2Z-0002OX-L3; Tue, 18 Feb 2025 21:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 892260.1301250; Tue, 18 Feb 2025 21: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 1tkV2Z-0002OP-IP; Tue, 18 Feb 2025 21:22:03 +0000
Received: by outflank-mailman (input) for mailman id 892260;
 Tue, 18 Feb 2025 21: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 1tkV2Y-0002OJ-C7
 for xen-changelog@lists.xenproject.org; Tue, 18 Feb 2025 21: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 1tkV2Y-008uG3-15
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Feb 2025 21:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tkV2Y-00FS38-00
 for xen-changelog@lists.xenproject.org;
 Tue, 18 Feb 2025 21: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=m2XyTwBpQXlS8qVuz1pogrHtFdvADLXIv3fBZEEdYUg=; b=jrXWXvfD2fpYSvEAEZcofGKqCN
	/qO592+i3JSVfoYn1M35LJb4Ho9hfLAvghGUiXg2bNsLlNWZYetMeWcZYZbRFxRD9WiIDhntnC5AA
	g0eAegZ7WRGPLOXxo2cKfkMHigD+3+LcEXwfGzavZ+QYe73mciR4zC8tL6gvOkRI7FU4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/memory: Make resource_max_frames() to return 0 on unknown type
Message-Id: <E1tkV2Y-00FS38-00@xenbits.xenproject.org>
Date: Tue, 18 Feb 2025 21:22:02 +0000

commit 9b8708290002f0a4d0b363e0c66ce945f6b520bd
Author:     Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
AuthorDate: Tue Feb 18 00:34:02 2025 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 18 14:47:34 2025 +0000

    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>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 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 a6f2f6d1b3..8ca4e1a842 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1157,7 +1157,7 @@ static unsigned int resource_max_frames(const struct domain *d,
         return d->vmtrace_size >> PAGE_SHIFT;
 
     default:
-        return -EOPNOTSUPP;
+        return 0;
     }
 }
 
@@ -1240,6 +1240,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#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 19 12:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Feb 2025 12:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.892883.1301823 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tkjbW-0006A2-Iq; Wed, 19 Feb 2025 12:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 892883.1301823; Wed, 19 Feb 2025 12:55: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 1tkjbW-00069u-GL; Wed, 19 Feb 2025 12:55:06 +0000
Received: by outflank-mailman (input) for mailman id 892883;
 Wed, 19 Feb 2025 12:55: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 1tkjbV-00069m-Co
 for xen-changelog@lists.xenproject.org; Wed, 19 Feb 2025 12:55: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 1tkjbV-00AcgZ-0z
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Feb 2025 12:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tkjbV-002PPB-03
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Feb 2025 12:55: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=DMzZgSOw9kBvc3titR83HBUz+Pq8hGVUaUkXlzvv+Wg=; b=WstQ0DNc9o1iYJkHPvOpEENObw
	g2DBOsiLnb4JLGEQf5VTLBr8+oUkoyug37Sqit6ci5hXomiLzl2Ho1SkDrzQk/Y88wHtFkKp4O7yl
	TVJaysefK/EsJNn/k7l2I+DFHqTinS7Cyn4xcc8x0t8zJQxCxb/2LtKBvV9tHYX5oUSs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/svm: Separate STI and VMRUN instructions in svm_asm_do_resume()
Message-Id: <E1tkjbV-002PPB-03@xenbits.xenproject.org>
Date: Wed, 19 Feb 2025 12:55:05 +0000

commit c989ff614f6bad48b3bd4b32694f711b31c7b2d6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 17 15:51:51 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 19 12:45:48 2025 +0000

    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>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 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


From xen-changelog-bounces@lists.xenproject.org Wed Feb 19 13:33:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 19 Feb 2025 13:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.892932.1301868 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tkkCF-0006BF-8o; Wed, 19 Feb 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 892932.1301868; Wed, 19 Feb 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 1tkkCF-0006B7-64; Wed, 19 Feb 2025 13:33:03 +0000
Received: by outflank-mailman (input) for mailman id 892932;
 Wed, 19 Feb 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 1tkkCE-0006B1-0t
 for xen-changelog@lists.xenproject.org; Wed, 19 Feb 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 1tkkCD-00AdSU-3A
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Feb 2025 13:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tkkCD-002X4m-2C
 for xen-changelog@lists.xenproject.org;
 Wed, 19 Feb 2025 13: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=CltH6meIr9GjkpTLe0bQlSTRGhy46v09lPWJz9R7wMc=; b=gzjx4/CI+15/CGRre+yvpMqEZY
	LlOJdx36zaodMi+v+nSj7saMyCyqdRMbRO4H3GG0MdsaLrrM0dA2G9QGzsf3O4t3gOb4D9t1DK07F
	baYifMSzYKLR0dwPQNhcwRZkYSqJi/3em9Uihr+sAr0ciDBnzomwPgBKTlwI5FZIJBbI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: Separate STI and VMRUN instructions in svm_asm_do_resume()
Message-Id: <E1tkkCD-002X4m-2C@xenbits.xenproject.org>
Date: Wed, 19 Feb 2025 13:33:01 +0000

commit c989ff614f6bad48b3bd4b32694f711b31c7b2d6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 17 15:51:51 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 19 12:45:48 2025 +0000

    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>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 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#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 20 12:55:16 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Feb 2025 12:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.893845.1302687 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tl654-0000c8-Ni; Thu, 20 Feb 2025 12:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 893845.1302687; Thu, 20 Feb 2025 12:55: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 1tl654-0000c0-LF; Thu, 20 Feb 2025 12:55:06 +0000
Received: by outflank-mailman (input) for mailman id 893845;
 Thu, 20 Feb 2025 12:55: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 1tl653-0000bu-0J
 for xen-changelog@lists.xenproject.org; Thu, 20 Feb 2025 12:55: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 1tl653-00CWVa-0M
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 12:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tl652-007eFK-2Z
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 12:55: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=A33868lEHGtZ2O9/LijR9m/3yhbehjQgk3ra46C9A/o=; b=Lc8l+hOg1grz36LV9ugXG+4HvK
	E46tG2QCbuxBxCenJJs44aiRuxiZFSFuEBNPC2292OenigAVavfOPPcs3lim5VBASroMzmZgJvfXe
	YOXCKlQvD7QOrx3Aj+EA0Rxc5sBGAeLgUNU5MzohOuGMy577tcbD8WDsxNBd8zSLYWm0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/MCE-telem: adjust cookie definition
Message-Id: <E1tl652-007eFK-2Z@xenbits.xenproject.org>
Date: Thu, 20 Feb 2025 12:55:04 +0000

commit 75fc9e692c602c528f82894a7a71ed0a3b46a51a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 20 13:50:19 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 20 13:50:19 2025 +0100

    x86/MCE-telem: adjust cookie definition
    
    struct mctelem_ent is opaque outside of mcetelem.c; the cookie
    abstraction exists - afaict - just to achieve this opaqueness. Then it
    is irrelevant though which kind of pointer mctelem_cookie_t resolves to.
    IOW we can as well use struct mctelem_ent there, allowing to remove the
    casts from COOKIE2MCTE() and MCTE2COOKIE(). Their removal addresses
    Misra C:2012 rule 11.2 ("Conversions shall not be performed between a
    pointer to an incomplete type and any other type") violations.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-By: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/cpu/mcheck/mctelem.c | 4 ++--
 xen/arch/x86/cpu/mcheck/mctelem.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mctelem.c b/xen/arch/x86/cpu/mcheck/mctelem.c
index 123e4102ad..ddd4c4cb7b 100644
--- a/xen/arch/x86/cpu/mcheck/mctelem.c
+++ b/xen/arch/x86/cpu/mcheck/mctelem.c
@@ -64,8 +64,8 @@ struct mctelem_ent {
 
 #define MC_NENT (MC_URGENT_NENT + MC_NONURGENT_NENT)
 
-#define	COOKIE2MCTE(c)		((struct mctelem_ent *)(c))
-#define	MCTE2COOKIE(tep)	((mctelem_cookie_t)(tep))
+#define	COOKIE2MCTE(c)		(c)
+#define	MCTE2COOKIE(tep)	(tep)
 
 static struct mc_telem_ctl {
 	/* Linked lists that thread the array members together.
diff --git a/xen/arch/x86/cpu/mcheck/mctelem.h b/xen/arch/x86/cpu/mcheck/mctelem.h
index f4c5ff848d..31d02d9f88 100644
--- a/xen/arch/x86/cpu/mcheck/mctelem.h
+++ b/xen/arch/x86/cpu/mcheck/mctelem.h
@@ -52,7 +52,7 @@
  * the element from the processing list.
  */
 
-typedef struct mctelem_cookie *mctelem_cookie_t;
+typedef struct mctelem_ent *mctelem_cookie_t;
 
 typedef enum mctelem_class {
     MC_URGENT,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 20 13:44:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Feb 2025 13:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.893912.1302750 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tl6qR-00027a-GZ; Thu, 20 Feb 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 893912.1302750; Thu, 20 Feb 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 1tl6qR-00027S-E0; Thu, 20 Feb 2025 13:44:03 +0000
Received: by outflank-mailman (input) for mailman id 893912;
 Thu, 20 Feb 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 1tl6qQ-00027K-04
 for xen-changelog@lists.xenproject.org; Thu, 20 Feb 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 1tl6qP-00CXV7-37
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 13:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tl6qP-007qYy-22
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 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=BlbcPam7nR+lgpN6kucazBVzUHHsqYk/gAsN1X28uJg=; b=C5heOb+SpdsZYQo9gzpB32W7MV
	kVbSENaFn8rao7318Pkzpjnzxj3GiaVeBJXzc2/VkWD5bnfuiHVJ1XaIUqE/QzmwsAI3TTf/h7Co5
	dr1cvAD8JVlB/YxajEFi3uI9O6AS7Mn+6iZujyKwZVe/uFNQmv1OMhk6cmpzsR97p3NM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/MCE-telem: adjust cookie definition
Message-Id: <E1tl6qP-007qYy-22@xenbits.xenproject.org>
Date: Thu, 20 Feb 2025 13:44:01 +0000

commit 75fc9e692c602c528f82894a7a71ed0a3b46a51a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 20 13:50:19 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 20 13:50:19 2025 +0100

    x86/MCE-telem: adjust cookie definition
    
    struct mctelem_ent is opaque outside of mcetelem.c; the cookie
    abstraction exists - afaict - just to achieve this opaqueness. Then it
    is irrelevant though which kind of pointer mctelem_cookie_t resolves to.
    IOW we can as well use struct mctelem_ent there, allowing to remove the
    casts from COOKIE2MCTE() and MCTE2COOKIE(). Their removal addresses
    Misra C:2012 rule 11.2 ("Conversions shall not be performed between a
    pointer to an incomplete type and any other type") violations.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-By: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 xen/arch/x86/cpu/mcheck/mctelem.c | 4 ++--
 xen/arch/x86/cpu/mcheck/mctelem.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mctelem.c b/xen/arch/x86/cpu/mcheck/mctelem.c
index 123e4102ad..ddd4c4cb7b 100644
--- a/xen/arch/x86/cpu/mcheck/mctelem.c
+++ b/xen/arch/x86/cpu/mcheck/mctelem.c
@@ -64,8 +64,8 @@ struct mctelem_ent {
 
 #define MC_NENT (MC_URGENT_NENT + MC_NONURGENT_NENT)
 
-#define	COOKIE2MCTE(c)		((struct mctelem_ent *)(c))
-#define	MCTE2COOKIE(tep)	((mctelem_cookie_t)(tep))
+#define	COOKIE2MCTE(c)		(c)
+#define	MCTE2COOKIE(tep)	(tep)
 
 static struct mc_telem_ctl {
 	/* Linked lists that thread the array members together.
diff --git a/xen/arch/x86/cpu/mcheck/mctelem.h b/xen/arch/x86/cpu/mcheck/mctelem.h
index f4c5ff848d..31d02d9f88 100644
--- a/xen/arch/x86/cpu/mcheck/mctelem.h
+++ b/xen/arch/x86/cpu/mcheck/mctelem.h
@@ -52,7 +52,7 @@
  * the element from the processing list.
  */
 
-typedef struct mctelem_cookie *mctelem_cookie_t;
+typedef struct mctelem_ent *mctelem_cookie_t;
 
 typedef enum mctelem_class {
     MC_URGENT,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 20 15:55:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Feb 2025 15:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.893949.1302775 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tl8tH-00020B-5U; Thu, 20 Feb 2025 15:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 893949.1302775; Thu, 20 Feb 2025 15:55:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tl8tH-000203-2r; Thu, 20 Feb 2025 15:55:07 +0000
Received: by outflank-mailman (input) for mailman id 893949;
 Thu, 20 Feb 2025 15:55: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 1tl8tF-0001zv-K7
 for xen-changelog@lists.xenproject.org; Thu, 20 Feb 2025 15:55: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 1tl8tF-00Ca9o-2K
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 15:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tl8tF-008JfE-1M
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 15:55: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=CfK3iRiLE9WsflNNA6laHuHzhAAq5ZMkrvSRArazBaI=; b=FYMY79YJGMvqjVSES/duVywLUk
	hyQvOKX9XVc4aj/eG7np69N5z9+rgsZAa4+E+yXlCrl0VgMj9lb/hevwDrvNaAcEr6GJZhH20AgkH
	WEK+4pmJWcDU+THt5ObIv4gEjeA4vWBt26BeifaSYmcUXMUMPxcV+gOpBtIqpF2zhWTE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Mark MISRA Rule 11.2 as clean
Message-Id: <E1tl8tF-008JfE-1M@xenbits.xenproject.org>
Date: Thu, 20 Feb 2025 15:55:05 +0000

commit 8b17c28ef64ac63f20684be9afeabb5b2ee03692
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 20 12:53:54 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 20 15:47:03 2025 +0000

    CI: Mark MISRA Rule 11.2 as clean
    
    Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index 491625e84c..66698b4bff 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -58,6 +58,7 @@ MC3A2.R9.2||
 MC3A2.R9.3||
 MC3A2.R9.4||
 MC3A2.R10.2||
+MC3A2.R11.2||
 MC3A2.R11.6||
 MC3A2.R11.7||
 MC3A2.R11.9||
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 20 15:55:18 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Feb 2025 15:55:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.893950.1302778 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tl8tR-00022N-6l; Thu, 20 Feb 2025 15:55:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 893950.1302778; Thu, 20 Feb 2025 15:55:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tl8tR-00022H-4G; Thu, 20 Feb 2025 15:55:17 +0000
Received: by outflank-mailman (input) for mailman id 893950;
 Thu, 20 Feb 2025 15:55: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 1tl8tP-00021w-LO
 for xen-changelog@lists.xenproject.org; Thu, 20 Feb 2025 15:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tl8tP-00CaA8-2h
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 15:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tl8tP-008Ji0-1k
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 15:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bvIASKyoToJlS6zRCk5CmLW7xPDlSpiXw7B6R7r90Kc=; b=LzpX76WGhsVEl/fc18dDP1LTkf
	5qoDMElhrwlvdMeaUqcEUafLLke8Vpz2PjlgTn4KEiUy30sJB4VDlyRsWeeBw5DTCUlPz5aNY8kpb
	IQZ9isg9XCmfs+Vo1jvtWPLn+O2q+RKvsJoFd2VfVqxfyQiIm3BqmJZ0u7g4ty8relCw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Update Xen to 4.20.0-rc5
Message-Id: <E1tl8tP-008Ji0-1k@xenbits.xenproject.org>
Date: Thu, 20 Feb 2025 15:55:15 +0000

commit d5b15616b930255ff9a22adcbbe2e4d1231d9ac4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 20 15:47:30 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 20 15:47:30 2025 +0000

    Update Xen to 4.20.0-rc5
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 65b460e2b4..4e37fff925 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 ?= -rc$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .0-rc5$(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


From xen-changelog-bounces@lists.xenproject.org Thu Feb 20 16:44:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Feb 2025 16:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.893996.1302814 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tl9ed-00026z-3F; Thu, 20 Feb 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 893996.1302814; Thu, 20 Feb 2025 16: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 1tl9ed-00026p-0J; Thu, 20 Feb 2025 16:44:03 +0000
Received: by outflank-mailman (input) for mailman id 893996;
 Thu, 20 Feb 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 1tl9ec-00026j-8H
 for xen-changelog@lists.xenproject.org; Thu, 20 Feb 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 1tl9ec-00CbcP-0d
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 16:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tl9eb-008Y0Q-2o
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 16: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=xyzHtCFdmipjsTIW92fcKImxDpa6bK5vPaOe3av/K6U=; b=uLYvdWtLIxyJQA4R8YmBuUErs3
	yZ9ptZ/6v2P4mU1rHOQ9VPYH6QsT4VkjQUxeTigjO3REY7xEqSF6bSgOuwuXujkvqb2XMZCPgh4OZ
	qmTSbYa4uq95WvQRo5cD3bs4Bqa/kugwxdfo8wN8FOGK/A0IB4oCBbaZ0oOt/hur0cJA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Mark MISRA Rule 11.2 as clean
Message-Id: <E1tl9eb-008Y0Q-2o@xenbits.xenproject.org>
Date: Thu, 20 Feb 2025 16:44:01 +0000

commit 8b17c28ef64ac63f20684be9afeabb5b2ee03692
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 20 12:53:54 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 20 15:47:03 2025 +0000

    CI: Mark MISRA Rule 11.2 as clean
    
    Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index 491625e84c..66698b4bff 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -58,6 +58,7 @@ MC3A2.R9.2||
 MC3A2.R9.3||
 MC3A2.R9.4||
 MC3A2.R10.2||
+MC3A2.R11.2||
 MC3A2.R11.6||
 MC3A2.R11.7||
 MC3A2.R11.9||
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 20 16:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Feb 2025 16:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.893997.1302817 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tl9en-00028c-4I; Thu, 20 Feb 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 893997.1302817; Thu, 20 Feb 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 1tl9en-00028U-1f; Thu, 20 Feb 2025 16:44:13 +0000
Received: by outflank-mailman (input) for mailman id 893997;
 Thu, 20 Feb 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 1tl9em-00028I-3T
 for xen-changelog@lists.xenproject.org; Thu, 20 Feb 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 1tl9em-00Cbcn-10
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 16:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tl9em-008Y1P-03
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 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=DwRChI4nzbfWmog+tJDHCpcoNeOwagpJSXoZ67kh+fQ=; b=2QzeIEwitMn1kKXx4tX/nrZm65
	Cf7XVgBheOn+YSvVrGkrfyRYRodQ4ce0h75XeQ4qrlb5onV38hDb6wC6ZBzSlIvP4xK5bte/BFLMq
	cF+lbG0d2qlJPPJm38aYSTX0f54tU0PhqSkKhV8RrJSjylzww3WrDX+X5GpymvHZO8eY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Update Xen to 4.20.0-rc5
Message-Id: <E1tl9em-008Y1P-03@xenbits.xenproject.org>
Date: Thu, 20 Feb 2025 16:44:12 +0000

commit d5b15616b930255ff9a22adcbbe2e4d1231d9ac4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 20 15:47:30 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 20 15:47:30 2025 +0000

    Update Xen to 4.20.0-rc5
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 65b460e2b4..4e37fff925 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 ?= -rc$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .0-rc5$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 20 21:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Feb 2025 21:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894172.1302961 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlEVe-0006xa-9e; Thu, 20 Feb 2025 21:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894172.1302961; Thu, 20 Feb 2025 21:55: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 1tlEVe-0006xQ-6j; Thu, 20 Feb 2025 21:55:06 +0000
Received: by outflank-mailman (input) for mailman id 894172;
 Thu, 20 Feb 2025 21:55: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 1tlEVd-0006ww-Bh
 for xen-changelog@lists.xenproject.org; Thu, 20 Feb 2025 21:55: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 1tlEVd-00ChjM-0o
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 21:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlEVc-009uIK-31
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 21:55: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=a5AscEVIlS+lFG7K/zPMUrlSU8Jc2Yd8D77Tz6H5uUk=; b=X7o7rq7tNrsTS1T7iSLp2PXmAO
	B6xVKv3eNdx7+RYyOFop7rqL2fFvba1jNN3wqQYQOabpVWmi+N2B98aIksc0+HO1rO9xjDuxUaW+Q
	0PfZxwX+rNH+FRrguz81W4dUpk5OyWkOR6CwFwNHTWvdXq2d362aQ/8QpVE+zWTL34MA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/x86: resolve the last 3 MISRA R16.6 violations
Message-Id: <E1tlEVc-009uIK-31@xenbits.xenproject.org>
Date: Thu, 20 Feb 2025 21:55:04 +0000

commit 37d6d8daba4698b2254629022ed0884fca49b4e1
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Thu Feb 20 13:32:46 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Feb 20 13:32:46 2025 -0800

    xen/x86: resolve the last 3 MISRA R16.6 violations
    
    MISRA R16.6 states that "Every switch statement shall have at least two
    switch-clauses". There are only 3 violations left on x86 (zero on ARM).
    
    One of them is only a violation depending on the kconfig configuration.
    So deviate it instead with a SAF comment.
    
    Two of them are deliberate to enable future additions. Deviate them as
    such.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 docs/misra/safe.json   | 16 ++++++++++++++++
 xen/arch/x86/hvm/hvm.c |  2 ++
 xen/arch/x86/traps.c   |  1 +
 3 files changed, 19 insertions(+)

diff --git a/docs/misra/safe.json b/docs/misra/safe.json
index b8a4f878ea..3d68b59169 100644
--- a/docs/misra/safe.json
+++ b/docs/misra/safe.json
@@ -92,6 +92,22 @@
         },
         {
             "id": "SAF-11-safe",
+            "analyser": {
+                "eclair": "MC3A2.R16.6"
+            },
+            "name": "Rule 16.6: single clause due to kconfig",
+            "text": "A switch statement with a single switch clause because other switch clauses are disabled in a given kconfig is safe."
+        },
+        {
+            "id": "SAF-12-safe",
+            "analyser": {
+                "eclair": "MC3A2.R16.6"
+            },
+            "name": "Rule 16.6: single clause due to future expansion",
+            "text": "A switch statement with a single switch clause to purposely enable future additions of new cases is safe."
+        },
+        {
+            "id": "SAF-13-safe",
             "analyser": {},
             "name": "Sentinel",
             "text": "Next ID to be used"
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 39e39ce4ce..0f0630769b 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3797,6 +3797,7 @@ uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
 {
     ASSERT(v == current || !vcpu_runnable(v));
 
+    /* SAF-12-safe */
     switch ( reg )
     {
     default:
@@ -3808,6 +3809,7 @@ void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
     ASSERT(v == current || !vcpu_runnable(v));
 
+    /* SAF-12-safe */
     switch ( reg )
     {
     default:
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 87b30ce4df..dca11a613d 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -436,6 +436,7 @@ unsigned long get_stack_trace_bottom(unsigned long sp)
 
 static unsigned long get_shstk_bottom(unsigned long sp)
 {
+    /* SAF-11-safe */
     switch ( get_stack_page(sp) )
     {
 #ifdef CONFIG_XEN_SHSTK
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 20 22:44:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 20 Feb 2025 22:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894192.1302975 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlFH1-0005EQ-SI; Thu, 20 Feb 2025 22:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894192.1302975; Thu, 20 Feb 2025 22: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 1tlFH1-0005EI-PV; Thu, 20 Feb 2025 22:44:03 +0000
Received: by outflank-mailman (input) for mailman id 894192;
 Thu, 20 Feb 2025 22: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 1tlFH0-0005EC-8B
 for xen-changelog@lists.xenproject.org; Thu, 20 Feb 2025 22: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 1tlFH0-00Cid4-0q
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 22:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlFGz-00A5JH-2t
 for xen-changelog@lists.xenproject.org;
 Thu, 20 Feb 2025 22: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=EkvzEPIhBdZJv2evQ5ObNSheEwIWgeOZvPHaxxklSbw=; b=yzV1vP7XoJzuR6grWGUsZCOp6A
	V4tLBS/QUJD2TeyEdvfqfXaFzMDtkuQoKoQVQaaKyqX+epOdaoZx/sHyPCzs5m1bwlqFZ4w/xf3ZI
	XaFucJoHXFHkUwe3w9V1QLhpIawOoz4Bv+1FrrKrlLQFqcMgYxwoNiqSwMnIPaIEGqWg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: resolve the last 3 MISRA R16.6 violations
Message-Id: <E1tlFGz-00A5JH-2t@xenbits.xenproject.org>
Date: Thu, 20 Feb 2025 22:44:01 +0000

commit 37d6d8daba4698b2254629022ed0884fca49b4e1
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Thu Feb 20 13:32:46 2025 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Feb 20 13:32:46 2025 -0800

    xen/x86: resolve the last 3 MISRA R16.6 violations
    
    MISRA R16.6 states that "Every switch statement shall have at least two
    switch-clauses". There are only 3 violations left on x86 (zero on ARM).
    
    One of them is only a violation depending on the kconfig configuration.
    So deviate it instead with a SAF comment.
    
    Two of them are deliberate to enable future additions. Deviate them as
    such.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 docs/misra/safe.json   | 16 ++++++++++++++++
 xen/arch/x86/hvm/hvm.c |  2 ++
 xen/arch/x86/traps.c   |  1 +
 3 files changed, 19 insertions(+)

diff --git a/docs/misra/safe.json b/docs/misra/safe.json
index b8a4f878ea..3d68b59169 100644
--- a/docs/misra/safe.json
+++ b/docs/misra/safe.json
@@ -92,6 +92,22 @@
         },
         {
             "id": "SAF-11-safe",
+            "analyser": {
+                "eclair": "MC3A2.R16.6"
+            },
+            "name": "Rule 16.6: single clause due to kconfig",
+            "text": "A switch statement with a single switch clause because other switch clauses are disabled in a given kconfig is safe."
+        },
+        {
+            "id": "SAF-12-safe",
+            "analyser": {
+                "eclair": "MC3A2.R16.6"
+            },
+            "name": "Rule 16.6: single clause due to future expansion",
+            "text": "A switch statement with a single switch clause to purposely enable future additions of new cases is safe."
+        },
+        {
+            "id": "SAF-13-safe",
             "analyser": {},
             "name": "Sentinel",
             "text": "Next ID to be used"
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 39e39ce4ce..0f0630769b 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3797,6 +3797,7 @@ uint64_t hvm_get_reg(struct vcpu *v, unsigned int reg)
 {
     ASSERT(v == current || !vcpu_runnable(v));
 
+    /* SAF-12-safe */
     switch ( reg )
     {
     default:
@@ -3808,6 +3809,7 @@ void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
     ASSERT(v == current || !vcpu_runnable(v));
 
+    /* SAF-12-safe */
     switch ( reg )
     {
     default:
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 87b30ce4df..dca11a613d 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -436,6 +436,7 @@ unsigned long get_stack_trace_bottom(unsigned long sp)
 
 static unsigned long get_shstk_bottom(unsigned long sp)
 {
+    /* SAF-11-safe */
     switch ( get_stack_page(sp) )
     {
 #ifdef CONFIG_XEN_SHSTK
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 21 13:44:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Feb 2025 13:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894483.1303178 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlTK2-0007ZF-L4; Fri, 21 Feb 2025 13:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894483.1303178; Fri, 21 Feb 2025 13:44: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 1tlTK2-0007Z7-IV; Fri, 21 Feb 2025 13:44:06 +0000
Received: by outflank-mailman (input) for mailman id 894483;
 Fri, 21 Feb 2025 13:44: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 1tlTK0-0007Z1-Lp
 for xen-changelog@lists.xenproject.org; Fri, 21 Feb 2025 13:44: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 1tlTK0-00EPWQ-2D
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 13:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlTK0-00EW1x-1A
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 13:44: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=h5yOIhQJfYavDAMerMqK4XvZbXtTJfTjacHesNrCi+o=; b=3gfOA7fCiJ9D85Y940HAXcY8Uy
	STT8nbYh4aTUqCBTUIQyuV99rT8xBfg8Xwjf3AaD5g6uAV05QRRAPpbBx1PmN/7P9SeaG/ZTL77TU
	gr35OQrO+LGpyMvdwm6tMYshBa8a2wcp5oc+g0HfQtQchRtjqcxBUYOSNkarxcv/EGRg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] eclair: mark R16.6 as clean
Message-Id: <E1tlTK0-00EW1x-1A@xenbits.xenproject.org>
Date: Fri, 21 Feb 2025 13:44:04 +0000

commit 599f4f54fd7eb49a1609acfdf3d7f4e95d18239b
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Thu Feb 20 13:54:45 2025 -0800
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 21 13:35:44 2025 +0000

    eclair: mark R16.6 as clean
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index 66698b4bff..1d078d8905 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -69,6 +69,7 @@ MC3A2.R14.3||
 MC3A2.R14.4||
 MC3A2.R16.2||
 MC3A2.R16.3||
+MC3A2.R16.6||
 MC3A2.R16.7||
 MC3A2.R17.1||
 MC3A2.R17.3||
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 21 14:55:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Feb 2025 14:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894505.1303203 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlUQg-00005R-S8; Fri, 21 Feb 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 894505.1303203; Fri, 21 Feb 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 1tlUQg-00005J-PV; Fri, 21 Feb 2025 14:55:02 +0000
Received: by outflank-mailman (input) for mailman id 894505;
 Fri, 21 Feb 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 1tlUQg-00005D-1k
 for xen-changelog@lists.xenproject.org; Fri, 21 Feb 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 1tlUQg-00ERJq-0O
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 14:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlUQf-00EnhZ-2R
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 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=PAgy4jBAyo+/tzqecih+apB4LXZmyKm2R5ou/kB+J18=; b=CDbqpNVxtHoTKb+5HME4meAhKT
	TMSyqLYMKkktLPYadc8z30HqE61ITrR9d78thLle/tNE2LEye3kHs57jfF6veMYEh1dZvp0NCpqxm
	6dptNKORiOZnZmHeeVqpODyh/I7FdW31zPWeJzfOMa+L2cX3Sehj3ss2ViYFHcyQjCSA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] eclair: mark R16.6 as clean
Message-Id: <E1tlUQf-00EnhZ-2R@xenbits.xenproject.org>
Date: Fri, 21 Feb 2025 14:55:01 +0000

commit 599f4f54fd7eb49a1609acfdf3d7f4e95d18239b
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Thu Feb 20 13:54:45 2025 -0800
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 21 13:35:44 2025 +0000

    eclair: mark R16.6 as clean
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index 66698b4bff..1d078d8905 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -69,6 +69,7 @@ MC3A2.R14.3||
 MC3A2.R14.4||
 MC3A2.R16.2||
 MC3A2.R16.3||
+MC3A2.R16.6||
 MC3A2.R16.7||
 MC3A2.R17.1||
 MC3A2.R17.3||
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 21 15:55:16 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Feb 2025 15:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894523.1303217 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlVMp-0007j2-5g; Fri, 21 Feb 2025 15:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894523.1303217; Fri, 21 Feb 2025 15:55:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlVMp-0007iu-33; Fri, 21 Feb 2025 15:55:07 +0000
Received: by outflank-mailman (input) for mailman id 894523;
 Fri, 21 Feb 2025 15:55: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 1tlVMn-0007iL-PU
 for xen-changelog@lists.xenproject.org; Fri, 21 Feb 2025 15:55: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 1tlVMn-00ESQW-2Y
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 15:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlVMn-00F4NM-1c
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 15:55: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=w0wPp5+JGRDISKyHgj34Jsu7JLgyFL6hqv5dC7nOzOE=; b=bkbXuSOBzyRmg9VbQifLwMPvqx
	nubabIu7aJmNJn8d5060g7gagINmxzPITerX8Xw+nroYuiWZC9UhddYMqNzHAqhGugILUSqFVH8cx
	L30QFM4osNPRl9He2xulgoB4TgckkGUhMwlRKlkQ+xkl0elLBOOurKcAiJFNmTwWF6W0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Update Xen to 4.21
Message-Id: <E1tlVMn-00F4NM-1c@xenbits.xenproject.org>
Date: Fri, 21 Feb 2025 15:55:05 +0000

commit dbe60f244ce60cd1feee1c25f43de30dd15cdd9f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 14:41:41 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 21 14:55:13 2025 +0000

    Update Xen to 4.21
    
    Xen 4.20 has branched.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 README       | 16 ++++++++--------
 SUPPORT.md   |  2 +-
 xen/Makefile |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/README b/README
index 373885523c..72f6b0fcde 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
-#####################################################
-__  __            _  _    ____   ___
-\ \/ /___ _ __   | || |  |___ \ / _ \       _ __ ___
- \  // _ \ '_ \  | || |_   __) | | | |_____| '__/ __|
- /  \  __/ | | | |__   _| / __/| |_| |_____| | | (__
-/_/\_\___|_| |_|    |_|(_)_____|\___/      |_|  \___|
-
-#####################################################
+############################################################
+__  __                                _        _     _
+\ \/ /___ _ __        _   _ _ __  ___| |_ __ _| |__ | | ___
+ \  // _ \ '_ \ _____| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
+ /  \  __/ | | |_____| |_| | | | \__ \ || (_| | |_) | |  __/
+/_/\_\___|_| |_|      \__,_|_| |_|___/\__\__,_|_.__/|_|\___|
+
+############################################################
 
 https://www.xen.org/
 
diff --git a/SUPPORT.md b/SUPPORT.md
index 2bc5bd81ee..e1f4769bd8 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,7 +9,7 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.20-rc
+    Xen-Version: 4.21-unstable
     Initial-Release: n/a
     Supported-Until: TBD
     Security-Support-Until: Unreleased - not yet security-supported
diff --git a/xen/Makefile b/xen/Makefile
index 4e37fff925..93532653ee 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -5,8 +5,8 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # This is the correct place to edit the build version.
 # 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_SUBVERSION    = 21
+export XEN_EXTRAVERSION ?= -unstable$(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


From xen-changelog-bounces@lists.xenproject.org Fri Feb 21 15:55:17 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Feb 2025 15:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894524.1303221 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlVMz-0007ka-7J; Fri, 21 Feb 2025 15:55:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894524.1303221; Fri, 21 Feb 2025 15:55:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlVMz-0007kS-4R; Fri, 21 Feb 2025 15:55:17 +0000
Received: by outflank-mailman (input) for mailman id 894524;
 Fri, 21 Feb 2025 15:55: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 1tlVMx-0007k8-NL
 for xen-changelog@lists.xenproject.org; Fri, 21 Feb 2025 15:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlVMx-00ESQa-2z
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 15:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlVMx-00F4Pt-23
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 15:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fhcvQvmQZqHmpjF1ViCFC/bE/XqqDY10qNSKBlWH+hY=; b=JALE8xQwMN+Ch160MXGuZm2iHZ
	xJgCcEeaLnuQFcVa7Wy4E04sA/AcxpxVjTg6GIluo7X+vfjvsyNw5+SNc2wQxtWOAcqlnQWxpBkP8
	CdD74f/m96bS9AMMlh51F0fmyk0cJNpxqRCml8xl91pU2RtWJsjWFkgEnEG9xw6ZfvfQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Rerun ./autogen.sh for 4.21
Message-Id: <E1tlVMx-00F4Pt-23@xenbits.xenproject.org>
Date: Fri, 21 Feb 2025 15:55:15 +0000

commit b28c8c8c591f0061300006d8d1b9e42a1cadc337
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 14:52:10 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 21 14:55:13 2025 +0000

    Rerun ./autogen.sh for 4.21
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 configure         | 18 +++++++++---------
 docs/configure    | 18 +++++++++---------
 stubdom/configure | 18 +++++++++---------
 tools/configure   | 18 +++++++++---------
 4 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/configure b/configure
index 2d7b20aa50..52ccc139a6 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for Xen Hypervisor 4.20.
+# Generated by GNU Autoconf 2.71 for Xen Hypervisor 4.21.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -610,8 +610,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.20'
-PACKAGE_STRING='Xen Hypervisor 4.20'
+PACKAGE_VERSION='4.21'
+PACKAGE_STRING='Xen Hypervisor 4.21'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1262,7 +1262,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor 4.20 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor 4.21 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1328,7 +1328,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor 4.20:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor 4.21:";;
    esac
   cat <<\_ACEOF
 
@@ -1428,7 +1428,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor configure 4.20
+Xen Hypervisor configure 4.21
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1465,7 +1465,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor $as_me 4.20, which was
+It was created by Xen Hypervisor $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3000,7 +3000,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor $as_me 4.20, which was
+This file was extended by Xen Hypervisor $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -3056,7 +3056,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-Xen Hypervisor config.status 4.20
+Xen Hypervisor config.status 4.21
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
diff --git a/docs/configure b/docs/configure
index 7c8e0771d6..ed9bb1c452 100755
--- a/docs/configure
+++ b/docs/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for Xen Hypervisor Documentation 4.20.
+# Generated by GNU Autoconf 2.71 for Xen Hypervisor Documentation 4.21.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -610,8 +610,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Documentation'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.20'
-PACKAGE_STRING='Xen Hypervisor Documentation 4.20'
+PACKAGE_VERSION='4.21'
+PACKAGE_STRING='Xen Hypervisor Documentation 4.21'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1252,7 +1252,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Documentation 4.20 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Documentation 4.21 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1314,7 +1314,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.20:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.21:";;
    esac
   cat <<\_ACEOF
 
@@ -1416,7 +1416,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Documentation configure 4.20
+Xen Hypervisor Documentation configure 4.21
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1453,7 +1453,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Documentation $as_me 4.20, which was
+It was created by Xen Hypervisor Documentation $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -2896,7 +2896,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Documentation $as_me 4.20, which was
+This file was extended by Xen Hypervisor Documentation $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2952,7 +2952,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-Xen Hypervisor Documentation config.status 4.20
+Xen Hypervisor Documentation config.status 4.21
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
diff --git a/stubdom/configure b/stubdom/configure
index 197d3399a5..08cacf764c 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for Xen Hypervisor Stub Domains 4.20.
+# Generated by GNU Autoconf 2.71 for Xen Hypervisor Stub Domains 4.21.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -610,8 +610,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Stub Domains'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.20'
-PACKAGE_STRING='Xen Hypervisor Stub Domains 4.20'
+PACKAGE_VERSION='4.21'
+PACKAGE_STRING='Xen Hypervisor Stub Domains 4.21'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1289,7 +1289,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Stub Domains 4.20 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Stub Domains 4.21 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1355,7 +1355,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.20:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.21:";;
    esac
   cat <<\_ACEOF
 
@@ -1467,7 +1467,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Stub Domains configure 4.20
+Xen Hypervisor Stub Domains configure 4.21
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1543,7 +1543,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Stub Domains $as_me 4.20, which was
+It was created by Xen Hypervisor Stub Domains $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -4924,7 +4924,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Stub Domains $as_me 4.20, which was
+This file was extended by Xen Hypervisor Stub Domains $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4980,7 +4980,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-Xen Hypervisor Stub Domains config.status 4.20
+Xen Hypervisor Stub Domains config.status 4.21
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
diff --git a/tools/configure b/tools/configure
index 7f98303fdd..e1f6ea6bf5 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for Xen Hypervisor Tools 4.20.
+# Generated by GNU Autoconf 2.71 for Xen Hypervisor Tools 4.21.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -610,8 +610,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Tools'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.20'
-PACKAGE_STRING='Xen Hypervisor Tools 4.20'
+PACKAGE_VERSION='4.21'
+PACKAGE_STRING='Xen Hypervisor Tools 4.21'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1432,7 +1432,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Tools 4.20 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Tools 4.21 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1498,7 +1498,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.20:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.21:";;
    esac
   cat <<\_ACEOF
 
@@ -1704,7 +1704,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Tools configure 4.20
+Xen Hypervisor Tools configure 4.21
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1974,7 +1974,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Tools $as_me 4.20, which was
+It was created by Xen Hypervisor Tools $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -10927,7 +10927,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Tools $as_me 4.20, which was
+This file was extended by Xen Hypervisor Tools $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -10992,7 +10992,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-Xen Hypervisor Tools config.status 4.20
+Xen Hypervisor Tools config.status 4.21
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 21 15:55:27 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Feb 2025 15:55:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894525.1303225 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlVN9-0007n6-8h; Fri, 21 Feb 2025 15:55:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894525.1303225; Fri, 21 Feb 2025 15:55:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlVN9-0007my-5s; Fri, 21 Feb 2025 15:55:27 +0000
Received: by outflank-mailman (input) for mailman id 894525;
 Fri, 21 Feb 2025 15:55: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 1tlVN7-0007mi-Rh
 for xen-changelog@lists.xenproject.org; Fri, 21 Feb 2025 15:55: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 1tlVN8-00ESQe-02
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 15:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlVN7-00F4Rs-2O
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 15:55:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RM/kv25rsaVN4mlbTQVDboLS8rYxMBnl7k+TTNYuZcs=; b=nwZBw/l8+HiuNdDxEnpJyDYUZj
	Q6/M26WV4OP3cFJofC1iJj/5U+TiL11wcAF1mHExPVEypRBtoI0VEI6VF+1u5aCdrcFf2fWqzkbWj
	9X+CzLvkoNfBsJQWA7IqgyUUuEcuZTfUumdIcn/fpjAwKew6VVqxZ85gWGRPAoHi5b0E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Config.mk: Switch QEMU back to master
Message-Id: <E1tlVN7-00F4Rs-2O@xenbits.xenproject.org>
Date: Fri, 21 Feb 2025 15:55:25 +0000

commit a5571b2d7d925e6dd0f518ad08711565ed381205
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 14:33:33 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 21 14:55:13 2025 +0000

    Config.mk: Switch QEMU back to master
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 1eb6ed04fe..9188fc9053 100644
--- a/Config.mk
+++ b/Config.mk
@@ -229,7 +229,7 @@ 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 ?= master
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
 MINIOS_UPSTREAM_REVISION ?= 6d5159e8410be16a47433bac1627e63f8adc7cd9
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 21 15:55:37 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Feb 2025 15:55:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894526.1303229 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlVNJ-0007pq-Ac; Fri, 21 Feb 2025 15:55:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894526.1303229; Fri, 21 Feb 2025 15:55:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlVNJ-0007pg-7R; Fri, 21 Feb 2025 15:55:37 +0000
Received: by outflank-mailman (input) for mailman id 894526;
 Fri, 21 Feb 2025 15:55: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 1tlVNH-0007pY-TC
 for xen-changelog@lists.xenproject.org; Fri, 21 Feb 2025 15:55: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 1tlVNI-00ESQz-0M
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 15:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlVNH-00F4Ua-2f
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 15:55: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=RY/w3QbE1BDRTdKfwzA/Lcdb18b454jUk8LsxgSuT1o=; b=lCU1QN3jb11teicps7mJdusESi
	PGmPoLB9PdUGL8mHf3VPZko2hQzd7koI1Okqqa9/5RtnFsBNkmvUhsk1xCP0XTb1gGuXq703jw4tL
	yZrZ/f//GXi3EtmlESBLtyB2+q7lfylg1bgDWVQOCo0ueF/uCoBlflGHna9l5cBZloYQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Start a new 4.21 section
Message-Id: <E1tlVNH-00F4Ua-2f@xenbits.xenproject.org>
Date: Fri, 21 Feb 2025 15:55:35 +0000

commit e16acd80674002cbc6b51626e826bd6f9f624a63
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 14:53:57 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 21 14:55:13 2025 +0000

    CHANGELOG.md: Start a new 4.21 section
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 CHANGELOG.md | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1de1d1eca1..1979166820 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,14 @@ 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.21.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
+
+### Changed
+
+### Added
+
+### Removed
+
 ## [4.20.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
 ### Changed
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 21 18:11:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Feb 2025 18:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894549.1303253 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlXUN-00083a-Uj; Fri, 21 Feb 2025 18:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894549.1303253; Fri, 21 Feb 2025 18: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 1tlXUN-00083S-SB; Fri, 21 Feb 2025 18:11:03 +0000
Received: by outflank-mailman (input) for mailman id 894549;
 Fri, 21 Feb 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 1tlXUM-00083G-HZ
 for xen-changelog@lists.xenproject.org; Fri, 21 Feb 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 1tlXUM-00EW3m-1a
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 18:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlXUM-00FkS2-0b
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 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=9n48s9fL5UlF+1kmmA2PPKo70SifuHiN7tq4eocGuIk=; b=Ho6LwSZU74JlfSRye296WkzaY4
	wQoorN8CbT1f5GsfrjgV46eN2p/eX/ZzMIni07LRB5DYQbu9G0ANEKpBvLwOwPQZsglUT4Z4kq9O5
	sXYOjwXWXi/GhwPYrG25GQLBH0is121Ja87pJySAm7hiQrBAg7xdbSqZjWb9bI9P5Fks=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Update Xen to 4.21
Message-Id: <E1tlXUM-00FkS2-0b@xenbits.xenproject.org>
Date: Fri, 21 Feb 2025 18:11:02 +0000

commit dbe60f244ce60cd1feee1c25f43de30dd15cdd9f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 14:41:41 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 21 14:55:13 2025 +0000

    Update Xen to 4.21
    
    Xen 4.20 has branched.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 README       | 16 ++++++++--------
 SUPPORT.md   |  2 +-
 xen/Makefile |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/README b/README
index 373885523c..72f6b0fcde 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
-#####################################################
-__  __            _  _    ____   ___
-\ \/ /___ _ __   | || |  |___ \ / _ \       _ __ ___
- \  // _ \ '_ \  | || |_   __) | | | |_____| '__/ __|
- /  \  __/ | | | |__   _| / __/| |_| |_____| | | (__
-/_/\_\___|_| |_|    |_|(_)_____|\___/      |_|  \___|
-
-#####################################################
+############################################################
+__  __                                _        _     _
+\ \/ /___ _ __        _   _ _ __  ___| |_ __ _| |__ | | ___
+ \  // _ \ '_ \ _____| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
+ /  \  __/ | | |_____| |_| | | | \__ \ || (_| | |_) | |  __/
+/_/\_\___|_| |_|      \__,_|_| |_|___/\__\__,_|_.__/|_|\___|
+
+############################################################
 
 https://www.xen.org/
 
diff --git a/SUPPORT.md b/SUPPORT.md
index 2bc5bd81ee..e1f4769bd8 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,7 +9,7 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.20-rc
+    Xen-Version: 4.21-unstable
     Initial-Release: n/a
     Supported-Until: TBD
     Security-Support-Until: Unreleased - not yet security-supported
diff --git a/xen/Makefile b/xen/Makefile
index 4e37fff925..93532653ee 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -5,8 +5,8 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # This is the correct place to edit the build version.
 # 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_SUBVERSION    = 21
+export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 21 18:11:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Feb 2025 18:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894550.1303256 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlXUX-00085S-W3; Fri, 21 Feb 2025 18:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894550.1303256; Fri, 21 Feb 2025 18: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 1tlXUX-00085L-Tb; Fri, 21 Feb 2025 18:11:13 +0000
Received: by outflank-mailman (input) for mailman id 894550;
 Fri, 21 Feb 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 1tlXUW-000858-GI
 for xen-changelog@lists.xenproject.org; Fri, 21 Feb 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 1tlXUW-00EW3s-26
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 18:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlXUW-00FkUC-16
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 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=Maaz2SOiuhnC6Cocb/xMmF4ZmCkjS8VhGJthtaJ8tIg=; b=Gu5qJX3chagU65S0WdNh7ByTfF
	dcZTXfCsE21eu4WYSGLv25Y0fkZqTTChydENSrXjT+/szmSx/HAbuSB0vUN8ohJGQVil+iG48bZSK
	XFIk9DFMHRhz4n1HRd9niXJWZyeqUzjGvYqIRIN/y1JErV/29+Sag//1+QuRFudp6N9U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Rerun ./autogen.sh for 4.21
Message-Id: <E1tlXUW-00FkUC-16@xenbits.xenproject.org>
Date: Fri, 21 Feb 2025 18:11:12 +0000

commit b28c8c8c591f0061300006d8d1b9e42a1cadc337
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 14:52:10 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 21 14:55:13 2025 +0000

    Rerun ./autogen.sh for 4.21
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 configure         | 18 +++++++++---------
 docs/configure    | 18 +++++++++---------
 stubdom/configure | 18 +++++++++---------
 tools/configure   | 18 +++++++++---------
 4 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/configure b/configure
index 2d7b20aa50..52ccc139a6 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for Xen Hypervisor 4.20.
+# Generated by GNU Autoconf 2.71 for Xen Hypervisor 4.21.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -610,8 +610,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.20'
-PACKAGE_STRING='Xen Hypervisor 4.20'
+PACKAGE_VERSION='4.21'
+PACKAGE_STRING='Xen Hypervisor 4.21'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1262,7 +1262,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor 4.20 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor 4.21 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1328,7 +1328,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor 4.20:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor 4.21:";;
    esac
   cat <<\_ACEOF
 
@@ -1428,7 +1428,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor configure 4.20
+Xen Hypervisor configure 4.21
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1465,7 +1465,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor $as_me 4.20, which was
+It was created by Xen Hypervisor $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3000,7 +3000,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor $as_me 4.20, which was
+This file was extended by Xen Hypervisor $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -3056,7 +3056,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-Xen Hypervisor config.status 4.20
+Xen Hypervisor config.status 4.21
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
diff --git a/docs/configure b/docs/configure
index 7c8e0771d6..ed9bb1c452 100755
--- a/docs/configure
+++ b/docs/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for Xen Hypervisor Documentation 4.20.
+# Generated by GNU Autoconf 2.71 for Xen Hypervisor Documentation 4.21.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -610,8 +610,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Documentation'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.20'
-PACKAGE_STRING='Xen Hypervisor Documentation 4.20'
+PACKAGE_VERSION='4.21'
+PACKAGE_STRING='Xen Hypervisor Documentation 4.21'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1252,7 +1252,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Documentation 4.20 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Documentation 4.21 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1314,7 +1314,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.20:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.21:";;
    esac
   cat <<\_ACEOF
 
@@ -1416,7 +1416,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Documentation configure 4.20
+Xen Hypervisor Documentation configure 4.21
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1453,7 +1453,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Documentation $as_me 4.20, which was
+It was created by Xen Hypervisor Documentation $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -2896,7 +2896,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Documentation $as_me 4.20, which was
+This file was extended by Xen Hypervisor Documentation $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2952,7 +2952,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-Xen Hypervisor Documentation config.status 4.20
+Xen Hypervisor Documentation config.status 4.21
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
diff --git a/stubdom/configure b/stubdom/configure
index 197d3399a5..08cacf764c 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for Xen Hypervisor Stub Domains 4.20.
+# Generated by GNU Autoconf 2.71 for Xen Hypervisor Stub Domains 4.21.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -610,8 +610,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Stub Domains'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.20'
-PACKAGE_STRING='Xen Hypervisor Stub Domains 4.20'
+PACKAGE_VERSION='4.21'
+PACKAGE_STRING='Xen Hypervisor Stub Domains 4.21'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1289,7 +1289,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Stub Domains 4.20 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Stub Domains 4.21 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1355,7 +1355,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.20:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.21:";;
    esac
   cat <<\_ACEOF
 
@@ -1467,7 +1467,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Stub Domains configure 4.20
+Xen Hypervisor Stub Domains configure 4.21
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1543,7 +1543,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Stub Domains $as_me 4.20, which was
+It was created by Xen Hypervisor Stub Domains $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -4924,7 +4924,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Stub Domains $as_me 4.20, which was
+This file was extended by Xen Hypervisor Stub Domains $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4980,7 +4980,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-Xen Hypervisor Stub Domains config.status 4.20
+Xen Hypervisor Stub Domains config.status 4.21
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
diff --git a/tools/configure b/tools/configure
index 7f98303fdd..e1f6ea6bf5 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for Xen Hypervisor Tools 4.20.
+# Generated by GNU Autoconf 2.71 for Xen Hypervisor Tools 4.21.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -610,8 +610,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Tools'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.20'
-PACKAGE_STRING='Xen Hypervisor Tools 4.20'
+PACKAGE_VERSION='4.21'
+PACKAGE_STRING='Xen Hypervisor Tools 4.21'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1432,7 +1432,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Tools 4.20 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Tools 4.21 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1498,7 +1498,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.20:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.21:";;
    esac
   cat <<\_ACEOF
 
@@ -1704,7 +1704,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Tools configure 4.20
+Xen Hypervisor Tools configure 4.21
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1974,7 +1974,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Tools $as_me 4.20, which was
+It was created by Xen Hypervisor Tools $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -10927,7 +10927,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Tools $as_me 4.20, which was
+This file was extended by Xen Hypervisor Tools $as_me 4.21, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -10992,7 +10992,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-Xen Hypervisor Tools config.status 4.20
+Xen Hypervisor Tools config.status 4.21
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 21 18:11:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Feb 2025 18:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894551.1303260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlXUi-000889-1M; Fri, 21 Feb 2025 18:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894551.1303260; Fri, 21 Feb 2025 18: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 1tlXUh-000881-V9; Fri, 21 Feb 2025 18:11:23 +0000
Received: by outflank-mailman (input) for mailman id 894551;
 Fri, 21 Feb 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 1tlXUg-00087t-IW
 for xen-changelog@lists.xenproject.org; Fri, 21 Feb 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 1tlXUg-00EW3x-2W
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 18:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlXUg-00FkWw-1W
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 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=0rSiHgnmfm5Z9sloU2aSSoZYSXP9N9kgFFDTsiLiOqc=; b=cwBV2U3HLWHn/GtvBagFIEA0sv
	MCE0Y2O2Uww6m7bErif5mcwztXJfKnIn7l0517vIpsqJy1XSA+ghJiQqji90w7vh7kF2nz+nf6VIq
	A0b6t5e36U+kDTrTDiYyyZIE10pLLvr55DaU1Q+gthykbdLhfvy8fEzSY+j3BM4YRJGA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Config.mk: Switch QEMU back to master
Message-Id: <E1tlXUg-00FkWw-1W@xenbits.xenproject.org>
Date: Fri, 21 Feb 2025 18:11:22 +0000

commit a5571b2d7d925e6dd0f518ad08711565ed381205
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 14:33:33 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 21 14:55:13 2025 +0000

    Config.mk: Switch QEMU back to master
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 1eb6ed04fe..9188fc9053 100644
--- a/Config.mk
+++ b/Config.mk
@@ -229,7 +229,7 @@ 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 ?= master
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
 MINIOS_UPSTREAM_REVISION ?= 6d5159e8410be16a47433bac1627e63f8adc7cd9
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 21 18:11:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Feb 2025 18:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894552.1303264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlXUs-0008AF-2s; Fri, 21 Feb 2025 18:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894552.1303264; Fri, 21 Feb 2025 18: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 1tlXUs-0008A7-0J; Fri, 21 Feb 2025 18:11:34 +0000
Received: by outflank-mailman (input) for mailman id 894552;
 Fri, 21 Feb 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 1tlXUq-00089z-Nv
 for xen-changelog@lists.xenproject.org; Fri, 21 Feb 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 1tlXUq-00EW4K-2q
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 18:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlXUq-00FkZB-1v
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 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=QbjpSzF4pVQIQjPsFlSgOdN7iH1q1tyo+gqIPidFoew=; b=43oH3TFFvSGnjL31bEbW7IPIXa
	gJ3Gb6io82Jr6qNeF9z2B7s4ni1UPSQjHgYJW1td1qhMqql0yMqQ1+XXgFS57WNqOT8NmOzm0Fgwl
	0vlJz2vfB7UgX5oxU/fEpgDqH7gcse9fvrSgZx+uo9ZoQs+qesFs7MlkHRUpxlJRy2VQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Start a new 4.21 section
Message-Id: <E1tlXUq-00FkZB-1v@xenbits.xenproject.org>
Date: Fri, 21 Feb 2025 18:11:32 +0000

commit e16acd80674002cbc6b51626e826bd6f9f624a63
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 14:53:57 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 21 14:55:13 2025 +0000

    CHANGELOG.md: Start a new 4.21 section
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 CHANGELOG.md | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1de1d1eca1..1979166820 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,14 @@ 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.21.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
+
+### Changed
+
+### Added
+
+### Removed
+
 ## [4.20.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
 ### Changed
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 21 21:44:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Feb 2025 21:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894668.1303379 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlaoV-0005fl-0T; Fri, 21 Feb 2025 21:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894668.1303379; Fri, 21 Feb 2025 21: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 1tlaoU-0005fd-U2; Fri, 21 Feb 2025 21:44:02 +0000
Received: by outflank-mailman (input) for mailman id 894668;
 Fri, 21 Feb 2025 21: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 1tlaoT-0005fX-TA
 for xen-changelog@lists.xenproject.org; Fri, 21 Feb 2025 21: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 1tlaoT-00EabJ-37
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 21:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlaoT-00Gd8p-24
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 21: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=Ar0E4tWHAvmsVSg4brbg2vg7zbRqlwXgCYfiADwthh4=; b=OqeRQy4lxnUp+jJaezOY97gMR6
	5R/2ZZvor2Vo9gFdMFiFehnxeRviir+giX0g01GkIxGo6hQ66dfvxoVwQ7Ms4SoK6ySof3fuwoI+l
	clghwr+OnT58TEMbh7zS8bw2MhUMRU5Ds+PwJUAQ+gD43MdUwQZdNl2dgULa6GzmZgu8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] Switch to release builds by default
Message-Id: <E1tlaoT-00Gd8p-24@xenbits.xenproject.org>
Date: Fri, 21 Feb 2025 21:44:01 +0000

commit ac8198c532f4e39659d5e520f634b27e96a2b494
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 14:58:54 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 21 14:58:54 2025 +0000

    Switch to release builds by default
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/Rules.mk    | 2 +-
 xen/Kconfig.debug | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 6bd636709f..d0d77a4d7a 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -25,7 +25,7 @@ CFLAGS_xeninclude = -I$(XEN_INCLUDE)
 XENSTORE_XENSTORED ?= y
 
 # A debug build of tools?
-debug ?= y
+debug ?= n
 debug_symbols ?= $(debug)
 
 XEN_GOCODE_URL    = golang.xenproject.org
diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index c4a8d86912..778db6f4e9 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -3,7 +3,7 @@ menu "Debugging Options"
 
 config DEBUG
 	bool "Developer Checks"
-	default y
+	default n
 	help
 	  If you say Y here this will enable developer checks such as asserts
 	  and extra printks. This option is intended for development purposes
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Fri Feb 21 21:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 21 Feb 2025 21:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.894669.1303382 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tlaof-0005hc-1g; Fri, 21 Feb 2025 21:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 894669.1303382; Fri, 21 Feb 2025 21: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 1tlaoe-0005hV-VT; Fri, 21 Feb 2025 21:44:12 +0000
Received: by outflank-mailman (input) for mailman id 894669;
 Fri, 21 Feb 2025 21: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 1tlaoe-0005hL-85
 for xen-changelog@lists.xenproject.org; Fri, 21 Feb 2025 21: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 1tlaoe-00Eado-1S
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 21:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tlaoe-00GdK1-0B
 for xen-changelog@lists.xenproject.org;
 Fri, 21 Feb 2025 21: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=PHAvzEYryIsEMHijQxI3cHJ3q2+J2h7i0vXAIIrYQG8=; b=Kh6LvXrQVcUmnneFMJG99qBYXe
	/DiqWvJWR/Xv9Cdq5A4MfMUXbSxCVL/FtZ6CrGVHazA6nnyxS68KRFhmyURgnqe4iG14p3b4hSfpg
	GcIia2yCdecONKIWqdFzu1ZjN6v5JZwjwXZpL1IxdkNUIpG5/ZaU7kci5EZqXsNrpQok=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] Switch to release builds by default
Message-Id: <E1tlaoe-00GdK1-0B@xenbits.xenproject.org>
Date: Fri, 21 Feb 2025 21:44:12 +0000

commit ac8198c532f4e39659d5e520f634b27e96a2b494
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 21 14:58:54 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 21 14:58:54 2025 +0000

    Switch to release builds by default
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/Rules.mk    | 2 +-
 xen/Kconfig.debug | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index 6bd636709f..d0d77a4d7a 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -25,7 +25,7 @@ CFLAGS_xeninclude = -I$(XEN_INCLUDE)
 XENSTORE_XENSTORED ?= y
 
 # A debug build of tools?
-debug ?= y
+debug ?= n
 debug_symbols ?= $(debug)
 
 XEN_GOCODE_URL    = golang.xenproject.org
diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index c4a8d86912..778db6f4e9 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -3,7 +3,7 @@ menu "Debugging Options"
 
 config DEBUG
 	bool "Developer Checks"
-	default y
+	default n
 	help
 	  If you say Y here this will enable developer checks such as asserts
 	  and extra printks. This option is intended for development purposes
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 07:55:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 07:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895448.1304047 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmpmR-0004BU-VS; Tue, 25 Feb 2025 07:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895448.1304047; Tue, 25 Feb 2025 07: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 1tmpmR-0004BM-Sx; Tue, 25 Feb 2025 07:55:03 +0000
Received: by outflank-mailman (input) for mailman id 895448;
 Tue, 25 Feb 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 1tmpmQ-0004BG-Px
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 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 1tmpmQ-004OJ2-2W
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmpmQ-001XN2-1V
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 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=aucaD4+MBhT5mh+08NKiPFN+8nfy31EUDDZAumiZZuA=; b=kmf52IOl0qenoENS5gQKGEYX3B
	VHgxUrORmTIKZ2TczRudOKroT6Mwuih46/Y7aYW3+z5ReWcnwmFxyC/E+xUNX4k8Ybn3vgHapTneO
	Npgk1+rQ5C5SXOATWadqe7ppFlI2N9yQ1RLsuIds69ujoyccZntUVu6ms7/T+ap+SoLk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ioreq: allow arch_vcpu_ioreq_completion() to signal an error
Message-Id: <E1tmpmQ-001XN2-1V@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 07:55:02 +0000

commit b7056d684ccf9b04b601be490beaafc8a5d98665
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Tue Feb 25 08:41:07 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:41:07 2025 +0100

    ioreq: allow arch_vcpu_ioreq_completion() to signal an error
    
    Return false from arch_vcpu_ioreq_completion() when completion is not handled.
    According to coding-best-practices.pandoc an error should be propagated to
    caller, if caller is expecting to handle it, which seems to the case for
    callers of arch_vcpu_ioreq_completion().
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/ioreq.c | 2 +-
 xen/include/xen/ioreq.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index d6491df8e7..ec709e5f47 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -47,7 +47,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion completion)
 
     default:
         ASSERT_UNREACHABLE();
-        break;
+        return false;
     }
 
     return true;
diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h
index 4f3c6b598d..e86f0869fa 100644
--- a/xen/include/xen/ioreq.h
+++ b/xen/include/xen/ioreq.h
@@ -118,7 +118,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion completion);
 static inline bool arch_vcpu_ioreq_completion(enum vio_completion completion)
 {
     ASSERT_UNREACHABLE();
-    return true;
+    return false;
 }
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 07:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 07:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895449.1304051 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmpmc-0004D3-0v; Tue, 25 Feb 2025 07:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895449.1304051; Tue, 25 Feb 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 1tmpmb-0004Cw-UX; Tue, 25 Feb 2025 07:55:13 +0000
Received: by outflank-mailman (input) for mailman id 895449;
 Tue, 25 Feb 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 1tmpma-0004Cj-Lq
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 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 1tmpma-004OJ8-2p
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmpma-001XQT-1y
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 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=Cz3w6oAeq4kScENtPWHMcSIHRQoILIZSZ6YtvTh1lfY=; b=dfeYhO2SL8kvKfoGTzSJ9blS3Q
	OU8Gyynzy2ZdtQh3O0tfIs4Hw8B4SH/XmbAcbCcGJJ35dShxlPD56TuRBNMY+tOoDd6XQ6vwQObPM
	ww1DebQ9NRkcX/qnaKP4RsW642FA/W6bDmyf6qRSF/rBd2UcHl7KC4xhjUEzjayaSjUk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/x86: add CPPC feature flag for AMD processors
Message-Id: <E1tmpma-001XQT-1y@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 07:55:12 +0000

commit 01bdc6d2d285738767991658754de123a3d07ff8
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Tue Feb 25 08:41:41 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:41:41 2025 +0100

    xen/x86: add CPPC feature flag for AMD processors
    
    Add Collaborative Processor Performance Control feature flag for
    AMD processors.
    
    amd-cppc is the AMD CPU performance scaling driver that
    introduces a new CPU frequency control mechanism on modern AMD
    APU and CPU series.
    There are two types of hardware implementations: "Full MSR Support"
    and "Shared Memory Support".
    
    Right now, xen will only implement "Full MSR Support", and this new
    feature flag indicates whether processor has this feature or not.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/cpufeature.h       | 1 +
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index 3a06b6f297..6935703e71 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -170,6 +170,7 @@ static inline bool boot_cpu_has(unsigned int feat)
 #define cpu_has_amd_ssbd        boot_cpu_has(X86_FEATURE_AMD_SSBD)
 #define cpu_has_virt_ssbd       boot_cpu_has(X86_FEATURE_VIRT_SSBD)
 #define cpu_has_ssb_no          boot_cpu_has(X86_FEATURE_SSB_NO)
+#define cpu_has_cppc            boot_cpu_has(X86_FEATURE_CPPC)
 #define cpu_has_auto_ibrs       boot_cpu_has(X86_FEATURE_AUTO_IBRS)
 
 /* CPUID level 0x00000007:0.edx */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 16207e3817..cc6e984a88 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -265,6 +265,7 @@ XEN_CPUFEATURE(AMD_PPIN,      8*32+23) /*   Protected Processor Inventory Number
 XEN_CPUFEATURE(AMD_SSBD,      8*32+24) /*S  MSR_SPEC_CTRL.SSBD available */
 XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*!  MSR_VIRT_SPEC_CTRL.SSBD */
 XEN_CPUFEATURE(SSB_NO,        8*32+26) /*A  Hardware not vulnerable to SSB */
+XEN_CPUFEATURE(CPPC,          8*32+27) /*   Collaborative Processor Performance Control */
 XEN_CPUFEATURE(PSFD,          8*32+28) /*S  MSR_SPEC_CTRL.PSFD */
 XEN_CPUFEATURE(BTC_NO,        8*32+29) /*A  Hardware not vulnerable to Branch Type Confusion */
 XEN_CPUFEATURE(IBPB_RET,      8*32+30) /*A  IBPB clears RSB/RAS too. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 07:55:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 07:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895450.1304055 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmpmm-0004Fl-2V; Tue, 25 Feb 2025 07:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895450.1304055; Tue, 25 Feb 2025 07: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 1tmpml-0004Fb-Vx; Tue, 25 Feb 2025 07:55:23 +0000
Received: by outflank-mailman (input) for mailman id 895450;
 Tue, 25 Feb 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 1tmpmk-0004FL-Pg
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 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 1tmpmk-004OJC-3D
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmpmk-001XSK-2G
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 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=9hruykC0lGMHW4DhLphGvpEFeYBF/X808LexBLZWops=; b=CPQa7R0pw7DJnaV+ethQjkpYLi
	4Cf3JcMAMl+Dc6z0Cq+zELmF1mvpe0mcpQ6JdXwEWANnNUj2vY4yRQxqBH+5wwBkHg8U3hnFMK89z
	b+Ygegp2ua7G0qD2SzKzzIj9xu5o48JVWilKE1nGcINl+upZ+ftN86OMXYgPt2x+HiaI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/console: introduce is_console_printable()
Message-Id: <E1tmpmk-001XSK-2G@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 07:55:22 +0000

commit 8743258747e2cc8b9bdbfb92542bb18bd3bdf1f6
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Tue Feb 25 08:42:37 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:42:37 2025 +0100

    xen/console: introduce is_console_printable()
    
    Add is_console_printable() to implement a common check for printable characters
    in the UART emulation and guest logging code.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/vuart.c       | 5 ++---
 xen/arch/x86/hvm/hvm.c     | 5 ++---
 xen/drivers/char/console.c | 3 +--
 xen/include/xen/console.h  | 6 ++++++
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/vuart.c b/xen/arch/arm/vuart.c
index d5ba483f1e..bd2f425214 100644
--- a/xen/arch/arm/vuart.c
+++ b/xen/arch/arm/vuart.c
@@ -24,7 +24,7 @@
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <xen/errno.h>
-#include <xen/ctype.h>
+#include <xen/console.h>
 #include <xen/serial.h>
 #include <asm/mmio.h>
 #include <xen/perfc.h>
@@ -79,8 +79,7 @@ static void vuart_print_char(struct vcpu *v, char c)
     struct domain *d = v->domain;
     struct vuart *uart = &d->arch.vuart;
 
-    /* Accept only printable characters, newline, and horizontal tab. */
-    if ( !isprint(c) && (c != '\n') && (c != '\t') )
+    if ( !is_console_printable(c) )
         return ;
 
     spin_lock(&uart->lock);
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 0f0630769b..4851e2e150 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -7,7 +7,6 @@
  * Copyright (c) 2008, Citrix Systems, Inc.
  */
 
-#include <xen/ctype.h>
 #include <xen/init.h>
 #include <xen/ioreq.h>
 #include <xen/lib.h>
@@ -30,6 +29,7 @@
 #include <xen/vpci.h>
 #include <xen/nospec.h>
 #include <xen/vm_event.h>
+#include <xen/console.h>
 #include <asm/shadow.h>
 #include <asm/hap.h>
 #include <asm/current.h>
@@ -561,8 +561,7 @@ static int cf_check hvm_print_line(
     if ( dir != IOREQ_WRITE )
         return X86EMUL_UNHANDLEABLE;
 
-    /* Accept only printable characters, newline, and horizontal tab. */
-    if ( !isprint(c) && (c != '\n') && (c != '\t') )
+    if ( !is_console_printable(c) )
         return X86EMUL_OKAY;
 
     spin_lock(&cd->pbuf_lock);
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 2926c97df9..7adf4e11fc 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -24,7 +24,6 @@
 #include <xen/shutdown.h>
 #include <xen/video.h>
 #include <xen/kexec.h>
-#include <xen/ctype.h>
 #include <xen/warning.h>
 #include <asm/div64.h>
 #include <xen/hypercall.h> /* for do_console_io */
@@ -674,7 +673,7 @@ static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer,
                 c = *kin++;
                 if ( c == '\n' )
                     break;
-                if ( isprint(c) || c == '\t' )
+                if ( is_console_printable(c) )
                     *kout++ = c;
             } while ( --kcount > 0 );
 
diff --git a/xen/include/xen/console.h b/xen/include/xen/console.h
index 6dfbade3ec..c4650231be 100644
--- a/xen/include/xen/console.h
+++ b/xen/include/xen/console.h
@@ -8,6 +8,7 @@
 #define __CONSOLE_H__
 
 #include <xen/inttypes.h>
+#include <xen/ctype.h>
 #include <public/xen.h>
 
 struct xen_sysctl_readconsole;
@@ -50,4 +51,9 @@ void console_serial_puts(const char *s, size_t nr);
 
 extern int8_t opt_console_xen;
 
+static inline bool is_console_printable(unsigned char c)
+{
+    return isprint(c) || c == '\n' || c == '\t';
+}
+
 #endif /* __CONSOLE_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 07:55:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 07:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895451.1304059 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmpmw-0004JP-4G; Tue, 25 Feb 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 895451.1304059; Tue, 25 Feb 2025 07: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 1tmpmw-0004JH-17; Tue, 25 Feb 2025 07:55:34 +0000
Received: by outflank-mailman (input) for mailman id 895451;
 Tue, 25 Feb 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 1tmpmu-0004J9-T3
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 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 1tmpmv-004OJG-0L
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmpmu-001XUI-2d
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 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=PRT7rMQX16TtJmteLuF+uxtBvRWcV/xiRVpREhbp3/I=; b=yNhGMGaHchNzB/RJzBpWppwxeW
	+tEjmHBwEJJqwWBpaYD/r1cWK9Ef+FVi1X5UQ0UG89HguDwcB361KP4+16b6/xHHgKIF8quXe9qbU
	3ZRqXz9CNq5UpCVdoLlNs98jCzx6Pu2nDNzSY0mmUtS8YTxJByMfD4bHTR7WKEdSv44w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: drop open-coding of REX.W prefixes
Message-Id: <E1tmpmu-001XUI-2d@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 07:55:32 +0000

commit 5a33ea2800c12f5d82191933df1c1e311d423619
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 25 08:43:07 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:43:07 2025 +0100

    x86emul: drop open-coding of REX.W prefixes
    
    Along the lines of 0e3642514719 ("x86: drop REX64_PREFIX"), move to well
    formed FXSAVEQ / FXRSTORQ here as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/blk.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/blk.c b/xen/arch/x86/x86_emulate/blk.c
index 08a05f8453..494e6c1e3b 100644
--- a/xen/arch/x86/x86_emulate/blk.c
+++ b/xen/arch/x86/x86_emulate/blk.c
@@ -259,16 +259,7 @@ int x86_emul_blk(
         if ( s->op_bytes < sizeof(*fxsr) )
         {
             if ( s->rex_prefix & REX_W )
-            {
-                /*
-                 * The only way to force fxsaveq on a wide range of gas
-                 * versions. On older versions the rex64 prefix works only if
-                 * we force an addressing mode that doesn't require extended
-                 * registers.
-                 */
-                asm volatile ( ".byte 0x48; fxsave (%1)"
-                               : "=m" (*fxsr) : "R" (fxsr) );
-            }
+                asm volatile ( "fxsaveq %0" : "=m" (*fxsr) );
             else
                 asm volatile ( "fxsave %0" : "=m" (*fxsr) );
         }
@@ -285,11 +276,7 @@ int x86_emul_blk(
         generate_exception_if(fxsr->mxcsr & ~mxcsr_mask, X86_EXC_GP, 0);
 
         if ( s->rex_prefix & REX_W )
-        {
-            /* See above for why operand/constraints are this way. */
-            asm volatile ( ".byte 0x48; fxrstor (%1)"
-                           :: "m" (*fxsr), "R" (fxsr) );
-        }
+            asm volatile ( "fxrstorq %0" :: "m" (*fxsr) );
         else
             asm volatile ( "fxrstor %0" :: "m" (*fxsr) );
         break;
@@ -310,11 +297,7 @@ int x86_emul_blk(
             fxsr = ptr;
 
         if ( s->rex_prefix & REX_W )
-        {
-            /* See above for why operand/constraints are this way. */
-            asm volatile ( ".byte 0x48; fxsave (%1)"
-                           : "=m" (*fxsr) : "R" (fxsr) );
-        }
+            asm volatile ( "fxsaveq %0" : "=m" (*fxsr) );
         else
             asm volatile ( "fxsave %0" : "=m" (*fxsr) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 07:55:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 07:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895452.1304062 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmpn6-0004Rr-52; Tue, 25 Feb 2025 07:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895452.1304062; Tue, 25 Feb 2025 07: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 1tmpn6-0004Rk-2Y; Tue, 25 Feb 2025 07:55:44 +0000
Received: by outflank-mailman (input) for mailman id 895452;
 Tue, 25 Feb 2025 07: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 1tmpn5-0004Rc-0S
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 07: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 1tmpn5-004OJK-0h
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmpn4-001XXj-31
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07: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=2FKj7NMlj+QMj0krDCboVAerv4p9TNwlordFdvpwNWQ=; b=LBipUFwzi7VCjrS79NbZd35leo
	tFge2SAC5FyYWNA3X11oNMgilN7UkZ9FA9V6RfW4z2aEhvRvO47fYqsZfMxdSw47H6JBEMst9mPHa
	GP4RdcKgFEV/ZtsZttg9FefG4FBUGTDdqO5svblXUcg/0BM3iUXnsYjQMnfFoN7KYw58=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: don't run with CR4.VMXE set when VMX could not be enabled
Message-Id: <E1tmpn4-001XXj-31@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 07:55:42 +0000

commit 04f5be6e1d3a6ea3f45b56c2af88c50cacd108a5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 25 08:44:32 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:44:32 2025 +0100

    VMX: don't run with CR4.VMXE set when VMX could not be enabled
    
    While generally benign, doing so is still at best misleading.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmx.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index eee1d4b47a..3728d2cd0d 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2987,14 +2987,18 @@ static bool __init has_if_pschange_mc(void)
 
 const struct hvm_function_table * __init start_vmx(void)
 {
-    set_in_cr4(X86_CR4_VMXE);
+    write_cr4(read_cr4() | X86_CR4_VMXE);
 
     if ( vmx_vmcs_init() )
     {
+        write_cr4(read_cr4() & ~X86_CR4_VMXE);
         printk("VMX: failed to initialise.\n");
         return NULL;
     }
 
+    /* Arrange for APs to have CR4.VMXE set early on. */
+    set_in_cr4(X86_CR4_VMXE);
+
     vmx_function_table.caps.singlestep = cpu_has_monitor_trap_flag;
 
     if ( cpu_has_vmx_dt_exiting )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 07:55:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 07:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895453.1304067 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmpnG-0004Yd-6W; Tue, 25 Feb 2025 07:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895453.1304067; Tue, 25 Feb 2025 07: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 1tmpnG-0004YV-42; Tue, 25 Feb 2025 07:55:54 +0000
Received: by outflank-mailman (input) for mailman id 895453;
 Tue, 25 Feb 2025 07: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 1tmpnF-0004YM-3m
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 07: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 1tmpnF-004OJh-12
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmpnF-001XZe-07
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07: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=MwJ5AaKx0rNbQFHRg0FSQcLOKa3kka5CVo1pfwT9A1M=; b=1lovDmKV6kzN/86l/kRPRJAOgQ
	J/iaTT1n2Ti4ornFy58ZPDhQEFIuSShyVxEdDp36mscZYX0KWYnlXef/IX4CU66ZJb+o+TIRRpuHj
	nnk/w+/t4Cgx0zRvJ2j8KuJM82VNC8zsgLbpSe6p6n6KZ1U+vg1jAFV2JY/QSJE/0MCg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] radix-tree: don't left-shift negative values
Message-Id: <E1tmpnF-001XZe-07@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 07:55:53 +0000

commit 61ee1a8151fc55113d50064e0cc825a55b83160c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 25 08:45:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:45:14 2025 +0100

    radix-tree: don't left-shift negative values
    
    Any (signed) integer is okay to pass into radix_tree_int_to_ptr(), yet
    left shifting negative values is UB. Use an unsigned intermediate type,
    reducing the impact to implementation defined behavior (for the
    unsigned->signed conversion).
    
    Also please Misra C:2012 rule 7.3 by dropping the lower case numeric 'l'
    tag.
    
    No difference in generated code, at least on x86.
    
    Fixes: b004883e29bb ("Simplify and build-fix (for some gcc versions) radix_tree_int_to_ptr()")
    Reported-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/xen/radix-tree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 4077365972..634737eaf5 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -172,7 +172,7 @@ static inline void radix_tree_replace_slot(void **pslot, void *item)
  */
 static inline void *radix_tree_int_to_ptr(int val)
 {
-    long _ptr = ((long)val << 2) | 0x2l;
+    long _ptr = ((unsigned long)val << 2) | 2;
     ASSERT((_ptr >> 2) == val);
     return (void *)_ptr;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 07:56:04 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 07:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895454.1304071 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmpnQ-0004be-7t; Tue, 25 Feb 2025 07:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895454.1304071; Tue, 25 Feb 2025 07: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 1tmpnQ-0004bW-5N; Tue, 25 Feb 2025 07:56:04 +0000
Received: by outflank-mailman (input) for mailman id 895454;
 Tue, 25 Feb 2025 07: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 1tmpnP-0004bO-7e
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 07: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 1tmpnP-004OJy-1Q
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmpnP-001Xct-0T
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07: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=r2g5SfykWjIsRvKRw+S79o7+FWnq7dJfPIa37357gB8=; b=Ujrro3Ldb5MvzPC4CWMm822/Pm
	4cVT/kd/fvLZMGIKU5i1aMoX8kz4SihzREZeyqn7r2wdL+H5CZCV+XF8cEVP8UebREDMq+SFU6gcX
	F9h+odIbiJ+sQcmcIaO2DjvhtnDhGsOLK62WbA2vC03F8NApnTjIopZcyfiTIcU+Ry74=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PV: don't half-open-code SIF_PM_MASK
Message-Id: <E1tmpnP-001Xct-0T@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 07:56:03 +0000

commit 20ae01c041f8f28f6adfdfbfcd9f008c4f6255d6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 25 08:45:46 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:45:46 2025 +0100

    x86/PV: don't half-open-code SIF_PM_MASK
    
    Avoid using the same literal number (8) in two distinct places, by using
    MASK_INTR() to avoid opencoding the literal 8.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/pv/dom0_build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index f54d1da5c6..96e28c7b6a 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -886,7 +886,7 @@ static int __init dom0_construct(struct boot_info *bi, struct domain *d)
         si->flags    = SIF_PRIVILEGED | SIF_INITDOMAIN;
     if ( !vinitrd_start && initrd_len )
         si->flags   |= SIF_MOD_START_PFN;
-    si->flags       |= (xen_processor_pmbits << 8) & SIF_PM_MASK;
+    si->flags       |= MASK_INSR(xen_processor_pmbits, SIF_PM_MASK);
     si->pt_base      = vpt_start;
     si->nr_pt_frames = nr_pt_pages;
     si->mfn_list     = vphysmap_start;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 07:56:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 07:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895455.1304074 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmpna-0004eQ-9g; Tue, 25 Feb 2025 07:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895455.1304074; Tue, 25 Feb 2025 07: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 1tmpna-0004eI-6i; Tue, 25 Feb 2025 07:56:14 +0000
Received: by outflank-mailman (input) for mailman id 895455;
 Tue, 25 Feb 2025 07: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 1tmpnZ-0004e9-CJ
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 07: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 1tmpnZ-004OK2-1t
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmpnZ-001Xhk-0r
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07: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=g93QqCGF1IPsRx7UMhYB1GMJA+FhxPtlL/6k/cSNSiI=; b=djNyPRQVQ2Zw7lhMgcojJTd/An
	5jwVvP6IP/s/EUAvoR0COusPz1tVgfvzF9fitiXv8czokdDKvxZrbpEIB7xKx7f2Go4uFafUEbxPW
	b2HiT5OCvdekktykm0x7wK3XVP1DNv3r2QqrQdqXrFaZR9KsIi0TRRIefMOuSmKHK4Do=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: implement software page table walking
Message-Id: <E1tmpnZ-001Xhk-0r@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 07:56:13 +0000

commit 44d21a1935abd00c67fd76f7a7c6b6e2e87121cc
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Feb 25 08:46:32 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:46:32 2025 +0100

    xen/riscv: implement software page table walking
    
    RISC-V doesn't have hardware feature to ask MMU to translate
    virtual address to physical address ( like Arm has, for example ),
    so software page table walking is implemented.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/page.h |  2 ++
 xen/arch/riscv/pt.c               | 60 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index 7a6174a109..0439a1a9ee 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -208,6 +208,8 @@ static inline pte_t pte_from_mfn(mfn_t mfn, unsigned int flags)
     return (pte_t){ .pte = pte };
 }
 
+pte_t pt_walk(vaddr_t va, unsigned int *pte_level);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* ASM__RISCV__PAGE_H */
diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c
index a703e0f1bd..9c1f8f6b55 100644
--- a/xen/arch/riscv/pt.c
+++ b/xen/arch/riscv/pt.c
@@ -185,6 +185,66 @@ static int pt_next_level(bool alloc_tbl, pte_t **table, unsigned int offset)
     return XEN_TABLE_NORMAL;
 }
 
+/*
+ * _pt_walk() performs software page table walking and returns the pte_t of
+ * a leaf node or the leaf-most not-present pte_t if no leaf node is found
+ * for further analysis.
+ *
+ * _pt_walk() can optionally return the level of the found pte. Pass NULL
+ * for `pte_level` if this information isn't needed.
+ *
+ * Note: unmapping of final `table` should be done by a caller.
+ */
+static pte_t *_pt_walk(vaddr_t va, unsigned int *pte_level)
+{
+    const mfn_t root = get_root_page();
+    unsigned int level;
+    pte_t *table;
+
+    DECLARE_OFFSETS(offsets, va);
+
+    table = map_table(root);
+
+    /*
+     * Find `table` of an entry which corresponds to `va` by iterating for each
+     * page level and checking if the entry points to a next page table or
+     * to a page.
+     *
+     * Two cases are possible:
+     * - ret == XEN_TABLE_SUPER_PAGE means that the entry was found;
+     *   (Despite the name) XEN_TABLE_SUPER_PAGE also covers 4K mappings. If
+     *   pt_next_level() is called for page table level 0, it results in the
+     *   entry being a pointer to a leaf node, thereby returning
+     *   XEN_TABLE_SUPER_PAGE, despite of the fact this leaf covers 4k mapping.
+     * - ret == XEN_TABLE_MAP_NONE means that requested `va` wasn't actually
+     *   mapped.
+     */
+    for ( level = HYP_PT_ROOT_LEVEL; ; --level )
+    {
+        int ret = pt_next_level(false, &table, offsets[level]);
+
+        if ( ret == XEN_TABLE_MAP_NONE || ret == XEN_TABLE_SUPER_PAGE )
+            break;
+
+        ASSERT(level);
+    }
+
+    if ( pte_level )
+        *pte_level = level;
+
+    return table + offsets[level];
+}
+
+pte_t pt_walk(vaddr_t va, unsigned int *pte_level)
+{
+    pte_t *ptep = _pt_walk(va, pte_level);
+    pte_t pte = *ptep;
+
+    unmap_table(ptep);
+
+    return pte;
+}
+
 /* Update an entry at the level @target. */
 static int pt_update_entry(mfn_t root, vaddr_t virt,
                            mfn_t mfn, unsigned int target,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 07:56:25 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 07:56:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895456.1304078 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmpnl-0004hV-Bn; Tue, 25 Feb 2025 07:56:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895456.1304078; Tue, 25 Feb 2025 07:56: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 1tmpnl-0004hO-9M; Tue, 25 Feb 2025 07:56:25 +0000
Received: by outflank-mailman (input) for mailman id 895456;
 Tue, 25 Feb 2025 07: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 1tmpnj-0004hE-FH
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 07: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 1tmpnj-004OK8-2B
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmpnj-001Xjc-1K
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 07: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=7ahYzcpZU+JeA953c8wc3rDQrs9JmtPTkm7ncgZ5fyU=; b=ivgP2KV1CgeLJZSQCIieJDP9bS
	PC2cBdzpbNPx7WboFawOvHxkLMApf9vDaMf1aRRPkTSz1fYa3Kifro5ektdQJgSYkveiRALxupj1c
	JgjK3pTP1gfGbdJpJG1ZNaF4mIxshbnghR9Jlm41FYDDxVy/As8+CQlp2sH4PMFsRRh8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: update defintion of vmap_to_mfn()
Message-Id: <E1tmpnj-001Xjc-1K@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 07:56:23 +0000

commit 814d24a572242246bf767710c83d2a26ae6f43b9
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Feb 25 08:47:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:47:12 2025 +0100

    xen/riscv: update defintion of vmap_to_mfn()
    
    vmap_to_mfn() uses virt_to_maddr(), which is designed to work with VA from
    either the direct map region or Xen's linkage region (XEN_VIRT_START).
    An assertion will occur if it is used with other regions, in particular for
    the VMAP region.
    
    Since RISC-V lacks a hardware feature to request the MMU to translate a VA to
    a PA (as Arm does, for example), software page table walking (pt_walk()) is
    used for the VMAP region to obtain the mfn from pte_t.
    
    To avoid introduce a circular dependency between asm/mm.h and asm/page.h by
    including each other, the static inline function  _vmap_to_mfn() is introduced
    in asm/page.h, as it uses struct pte_t and pte_is_mapping() from asm/page.h.
    _vmap_to_mfn() is then reused in the definition of vmap_to_mfn() macro in
    asm/mm.h.
    
    Fixes: 7db8d2bd9b ("xen/riscv: add minimal stuff to mm.h to build full Xen")
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/mm.h   | 2 +-
 xen/arch/riscv/include/asm/page.h | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 292aa48fc1..4035cd400a 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -23,7 +23,7 @@ extern vaddr_t directmap_virt_start;
 #define gaddr_to_gfn(ga)    _gfn(paddr_to_pfn(ga))
 #define mfn_to_maddr(mfn)   pfn_to_paddr(mfn_x(mfn))
 #define maddr_to_mfn(ma)    _mfn(paddr_to_pfn(ma))
-#define vmap_to_mfn(va)     maddr_to_mfn(virt_to_maddr((vaddr_t)(va)))
+#define vmap_to_mfn(va)     _vmap_to_mfn((vaddr_t)(va))
 #define vmap_to_page(va)    mfn_to_page(vmap_to_mfn(va))
 
 static inline void *maddr_to_virt(paddr_t ma)
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index 0439a1a9ee..bf8988f657 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -210,6 +210,15 @@ static inline pte_t pte_from_mfn(mfn_t mfn, unsigned int flags)
 
 pte_t pt_walk(vaddr_t va, unsigned int *pte_level);
 
+static inline mfn_t _vmap_to_mfn(vaddr_t va)
+{
+    pte_t entry = pt_walk(va, NULL);
+
+    BUG_ON(!pte_is_mapping(entry));
+
+    return mfn_from_pte(entry);
+}
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* ASM__RISCV__PAGE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 08:44:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 08:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895510.1304133 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmqXr-0006DM-TI; Tue, 25 Feb 2025 08:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895510.1304133; Tue, 25 Feb 2025 08: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 1tmqXr-0006DE-QW; Tue, 25 Feb 2025 08:44:03 +0000
Received: by outflank-mailman (input) for mailman id 895510;
 Tue, 25 Feb 2025 08: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 1tmqXq-0006Cm-4V
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 08: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 1tmqXq-004QNf-0f
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmqXp-001l57-2y
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08: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=vVsRJSZ9eGVXp37/v9kpyh1JU+41uhMLB4OKwGy4nQQ=; b=f6qydecTRRkrw9onC3mF+XV6Le
	16l1XZz4vYcghkt8VDn91SYm8mC0vOVvOaPetfqVCs3rPjGoMMZKqyQFyVWj7dHz+6OvPdCVnnqK3
	bXo2V0XS4rooTtQifCOShfcyrfY5zjWXFxqJyzO3NR96JfjYQsLmqrvbDGB7yTYltUTc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ioreq: allow arch_vcpu_ioreq_completion() to signal an error
Message-Id: <E1tmqXp-001l57-2y@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 08:44:01 +0000

commit b7056d684ccf9b04b601be490beaafc8a5d98665
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Tue Feb 25 08:41:07 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:41:07 2025 +0100

    ioreq: allow arch_vcpu_ioreq_completion() to signal an error
    
    Return false from arch_vcpu_ioreq_completion() when completion is not handled.
    According to coding-best-practices.pandoc an error should be propagated to
    caller, if caller is expecting to handle it, which seems to the case for
    callers of arch_vcpu_ioreq_completion().
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/ioreq.c | 2 +-
 xen/include/xen/ioreq.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index d6491df8e7..ec709e5f47 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -47,7 +47,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion completion)
 
     default:
         ASSERT_UNREACHABLE();
-        break;
+        return false;
     }
 
     return true;
diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h
index 4f3c6b598d..e86f0869fa 100644
--- a/xen/include/xen/ioreq.h
+++ b/xen/include/xen/ioreq.h
@@ -118,7 +118,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion completion);
 static inline bool arch_vcpu_ioreq_completion(enum vio_completion completion)
 {
     ASSERT_UNREACHABLE();
-    return true;
+    return false;
 }
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 08:44:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 08:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895511.1304137 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmqY1-0006FT-Uh; Tue, 25 Feb 2025 08:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895511.1304137; Tue, 25 Feb 2025 08: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 1tmqY1-0006FL-Ru; Tue, 25 Feb 2025 08:44:13 +0000
Received: by outflank-mailman (input) for mailman id 895511;
 Tue, 25 Feb 2025 08: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 1tmqY0-0006Ey-4D
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 08: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 1tmqY0-004QNx-14
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmqY0-001l99-06
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08: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=TsC3fUVuaqlaZYXztdTxlsQTErtKIWp4VUHVqlmXrhU=; b=KXAXQzQAFjG1+wvLLftHzVLKed
	kNWAVo0y6vUuKJrWgnfml+Z24thaFVMoeD2nnYt+7gcc/B/agn6UL/FYoNNThw07h75zH9luocBAE
	rHltZjD/jx9hLve9nBbPXLPt6qtUPAYivNEJyy94p6vOf2PH/vls1QVzBZsAXGlx658U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: add CPPC feature flag for AMD processors
Message-Id: <E1tmqY0-001l99-06@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 08:44:12 +0000

commit 01bdc6d2d285738767991658754de123a3d07ff8
Author:     Penny Zheng <Penny.Zheng@amd.com>
AuthorDate: Tue Feb 25 08:41:41 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:41:41 2025 +0100

    xen/x86: add CPPC feature flag for AMD processors
    
    Add Collaborative Processor Performance Control feature flag for
    AMD processors.
    
    amd-cppc is the AMD CPU performance scaling driver that
    introduces a new CPU frequency control mechanism on modern AMD
    APU and CPU series.
    There are two types of hardware implementations: "Full MSR Support"
    and "Shared Memory Support".
    
    Right now, xen will only implement "Full MSR Support", and this new
    feature flag indicates whether processor has this feature or not.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/cpufeature.h       | 1 +
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index 3a06b6f297..6935703e71 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -170,6 +170,7 @@ static inline bool boot_cpu_has(unsigned int feat)
 #define cpu_has_amd_ssbd        boot_cpu_has(X86_FEATURE_AMD_SSBD)
 #define cpu_has_virt_ssbd       boot_cpu_has(X86_FEATURE_VIRT_SSBD)
 #define cpu_has_ssb_no          boot_cpu_has(X86_FEATURE_SSB_NO)
+#define cpu_has_cppc            boot_cpu_has(X86_FEATURE_CPPC)
 #define cpu_has_auto_ibrs       boot_cpu_has(X86_FEATURE_AUTO_IBRS)
 
 /* CPUID level 0x00000007:0.edx */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 16207e3817..cc6e984a88 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -265,6 +265,7 @@ XEN_CPUFEATURE(AMD_PPIN,      8*32+23) /*   Protected Processor Inventory Number
 XEN_CPUFEATURE(AMD_SSBD,      8*32+24) /*S  MSR_SPEC_CTRL.SSBD available */
 XEN_CPUFEATURE(VIRT_SSBD,     8*32+25) /*!  MSR_VIRT_SPEC_CTRL.SSBD */
 XEN_CPUFEATURE(SSB_NO,        8*32+26) /*A  Hardware not vulnerable to SSB */
+XEN_CPUFEATURE(CPPC,          8*32+27) /*   Collaborative Processor Performance Control */
 XEN_CPUFEATURE(PSFD,          8*32+28) /*S  MSR_SPEC_CTRL.PSFD */
 XEN_CPUFEATURE(BTC_NO,        8*32+29) /*A  Hardware not vulnerable to Branch Type Confusion */
 XEN_CPUFEATURE(IBPB_RET,      8*32+30) /*A  IBPB clears RSB/RAS too. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 08:44:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 08:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895512.1304141 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmqYB-0006IG-W4; Tue, 25 Feb 2025 08:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895512.1304141; Tue, 25 Feb 2025 08: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 1tmqYB-0006I8-TL; Tue, 25 Feb 2025 08:44:23 +0000
Received: by outflank-mailman (input) for mailman id 895512;
 Tue, 25 Feb 2025 08: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 1tmqYA-0006Hz-7w
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 08: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 1tmqYA-004QOF-1S
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmqYA-001lF8-0W
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08: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=GIf9uV7o17GVU7WBv4uqnmuGd40kFmvVV08SMFOsFS0=; b=xCJWDqK1A7ppDNwO+ScDWndgvQ
	WElGjIt6MoN4ZjLuyNkzseeJ9SezG11pBBIZZHT6OS4uMDdwHuzhIZ8Nepui/YzEDStBhKgP7cVqK
	1LpgY8OigNDVi5N5yhjLigVTwQdbs/MEosGxlbWdSOcb16txZrdhCdd/C+RYI/thAbXw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/console: introduce is_console_printable()
Message-Id: <E1tmqYA-001lF8-0W@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 08:44:22 +0000

commit 8743258747e2cc8b9bdbfb92542bb18bd3bdf1f6
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Tue Feb 25 08:42:37 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:42:37 2025 +0100

    xen/console: introduce is_console_printable()
    
    Add is_console_printable() to implement a common check for printable characters
    in the UART emulation and guest logging code.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/vuart.c       | 5 ++---
 xen/arch/x86/hvm/hvm.c     | 5 ++---
 xen/drivers/char/console.c | 3 +--
 xen/include/xen/console.h  | 6 ++++++
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/vuart.c b/xen/arch/arm/vuart.c
index d5ba483f1e..bd2f425214 100644
--- a/xen/arch/arm/vuart.c
+++ b/xen/arch/arm/vuart.c
@@ -24,7 +24,7 @@
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <xen/errno.h>
-#include <xen/ctype.h>
+#include <xen/console.h>
 #include <xen/serial.h>
 #include <asm/mmio.h>
 #include <xen/perfc.h>
@@ -79,8 +79,7 @@ static void vuart_print_char(struct vcpu *v, char c)
     struct domain *d = v->domain;
     struct vuart *uart = &d->arch.vuart;
 
-    /* Accept only printable characters, newline, and horizontal tab. */
-    if ( !isprint(c) && (c != '\n') && (c != '\t') )
+    if ( !is_console_printable(c) )
         return ;
 
     spin_lock(&uart->lock);
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 0f0630769b..4851e2e150 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -7,7 +7,6 @@
  * Copyright (c) 2008, Citrix Systems, Inc.
  */
 
-#include <xen/ctype.h>
 #include <xen/init.h>
 #include <xen/ioreq.h>
 #include <xen/lib.h>
@@ -30,6 +29,7 @@
 #include <xen/vpci.h>
 #include <xen/nospec.h>
 #include <xen/vm_event.h>
+#include <xen/console.h>
 #include <asm/shadow.h>
 #include <asm/hap.h>
 #include <asm/current.h>
@@ -561,8 +561,7 @@ static int cf_check hvm_print_line(
     if ( dir != IOREQ_WRITE )
         return X86EMUL_UNHANDLEABLE;
 
-    /* Accept only printable characters, newline, and horizontal tab. */
-    if ( !isprint(c) && (c != '\n') && (c != '\t') )
+    if ( !is_console_printable(c) )
         return X86EMUL_OKAY;
 
     spin_lock(&cd->pbuf_lock);
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 2926c97df9..7adf4e11fc 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -24,7 +24,6 @@
 #include <xen/shutdown.h>
 #include <xen/video.h>
 #include <xen/kexec.h>
-#include <xen/ctype.h>
 #include <xen/warning.h>
 #include <asm/div64.h>
 #include <xen/hypercall.h> /* for do_console_io */
@@ -674,7 +673,7 @@ static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer,
                 c = *kin++;
                 if ( c == '\n' )
                     break;
-                if ( isprint(c) || c == '\t' )
+                if ( is_console_printable(c) )
                     *kout++ = c;
             } while ( --kcount > 0 );
 
diff --git a/xen/include/xen/console.h b/xen/include/xen/console.h
index 6dfbade3ec..c4650231be 100644
--- a/xen/include/xen/console.h
+++ b/xen/include/xen/console.h
@@ -8,6 +8,7 @@
 #define __CONSOLE_H__
 
 #include <xen/inttypes.h>
+#include <xen/ctype.h>
 #include <public/xen.h>
 
 struct xen_sysctl_readconsole;
@@ -50,4 +51,9 @@ void console_serial_puts(const char *s, size_t nr);
 
 extern int8_t opt_console_xen;
 
+static inline bool is_console_printable(unsigned char c)
+{
+    return isprint(c) || c == '\n' || c == '\t';
+}
+
 #endif /* __CONSOLE_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 08:44:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 08:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895513.1304146 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmqYM-0006Kx-1p; Tue, 25 Feb 2025 08:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895513.1304146; Tue, 25 Feb 2025 08: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 1tmqYL-0006Kp-Ug; Tue, 25 Feb 2025 08:44:33 +0000
Received: by outflank-mailman (input) for mailman id 895513;
 Tue, 25 Feb 2025 08: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 1tmqYK-0006Kc-Bi
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 08: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 1tmqYK-004QOV-1p
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmqYK-001lH3-0r
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08: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=qnCMoyqeWcHWA8cNFN4eL+wfQ3T5BR0D4evvUuPBXP8=; b=h/7OhPArzJAl+PgFMgqBkBq1m4
	XZ0STW5IOoYDeFKAmuupq2To5NyaRTREA8+fArtXvWWUAxOaeAarDhAyLO3jyCzVjSNekIbeFuyeo
	seWqNe582igb918ZADiqAbu0pC/CCTap6ZwCcM8+n28qoP5y4s1Louj9r4NQDC9vdv3U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: drop open-coding of REX.W prefixes
Message-Id: <E1tmqYK-001lH3-0r@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 08:44:32 +0000

commit 5a33ea2800c12f5d82191933df1c1e311d423619
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 25 08:43:07 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:43:07 2025 +0100

    x86emul: drop open-coding of REX.W prefixes
    
    Along the lines of 0e3642514719 ("x86: drop REX64_PREFIX"), move to well
    formed FXSAVEQ / FXRSTORQ here as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/blk.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/blk.c b/xen/arch/x86/x86_emulate/blk.c
index 08a05f8453..494e6c1e3b 100644
--- a/xen/arch/x86/x86_emulate/blk.c
+++ b/xen/arch/x86/x86_emulate/blk.c
@@ -259,16 +259,7 @@ int x86_emul_blk(
         if ( s->op_bytes < sizeof(*fxsr) )
         {
             if ( s->rex_prefix & REX_W )
-            {
-                /*
-                 * The only way to force fxsaveq on a wide range of gas
-                 * versions. On older versions the rex64 prefix works only if
-                 * we force an addressing mode that doesn't require extended
-                 * registers.
-                 */
-                asm volatile ( ".byte 0x48; fxsave (%1)"
-                               : "=m" (*fxsr) : "R" (fxsr) );
-            }
+                asm volatile ( "fxsaveq %0" : "=m" (*fxsr) );
             else
                 asm volatile ( "fxsave %0" : "=m" (*fxsr) );
         }
@@ -285,11 +276,7 @@ int x86_emul_blk(
         generate_exception_if(fxsr->mxcsr & ~mxcsr_mask, X86_EXC_GP, 0);
 
         if ( s->rex_prefix & REX_W )
-        {
-            /* See above for why operand/constraints are this way. */
-            asm volatile ( ".byte 0x48; fxrstor (%1)"
-                           :: "m" (*fxsr), "R" (fxsr) );
-        }
+            asm volatile ( "fxrstorq %0" :: "m" (*fxsr) );
         else
             asm volatile ( "fxrstor %0" :: "m" (*fxsr) );
         break;
@@ -310,11 +297,7 @@ int x86_emul_blk(
             fxsr = ptr;
 
         if ( s->rex_prefix & REX_W )
-        {
-            /* See above for why operand/constraints are this way. */
-            asm volatile ( ".byte 0x48; fxsave (%1)"
-                           : "=m" (*fxsr) : "R" (fxsr) );
-        }
+            asm volatile ( "fxsaveq %0" : "=m" (*fxsr) );
         else
             asm volatile ( "fxsave %0" : "=m" (*fxsr) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 08:44:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 08:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895514.1304150 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmqYW-0006Nd-2e; Tue, 25 Feb 2025 08:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895514.1304150; Tue, 25 Feb 2025 08: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 1tmqYV-0006NV-W2; Tue, 25 Feb 2025 08:44:43 +0000
Received: by outflank-mailman (input) for mailman id 895514;
 Tue, 25 Feb 2025 08: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 1tmqYU-0006NJ-FP
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 08: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 1tmqYU-004QOm-2C
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmqYU-001lJW-1G
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08: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=Tb6WH5VqKYVcbkO5DKZXx3N3b6eG3X8ioZ2eqp+CJZ0=; b=YDQzw18f1uFV/7i/rvnvAr58U2
	ecYSZm3sKhEt3ltWnrR8omkxVnMFQDGConee2IUAi3GXC1fScQvVxShS+c7KSi1UdqQAAu3avuiVw
	XCiGMCDhevbUxu3f41WhxwPx3NbJsg1etMBT4TwPg0AwFSulxSDGe7OnGRh2YQi/8IJc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: don't run with CR4.VMXE set when VMX could not be enabled
Message-Id: <E1tmqYU-001lJW-1G@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 08:44:42 +0000

commit 04f5be6e1d3a6ea3f45b56c2af88c50cacd108a5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 25 08:44:32 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:44:32 2025 +0100

    VMX: don't run with CR4.VMXE set when VMX could not be enabled
    
    While generally benign, doing so is still at best misleading.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vmx/vmx.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index eee1d4b47a..3728d2cd0d 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2987,14 +2987,18 @@ static bool __init has_if_pschange_mc(void)
 
 const struct hvm_function_table * __init start_vmx(void)
 {
-    set_in_cr4(X86_CR4_VMXE);
+    write_cr4(read_cr4() | X86_CR4_VMXE);
 
     if ( vmx_vmcs_init() )
     {
+        write_cr4(read_cr4() & ~X86_CR4_VMXE);
         printk("VMX: failed to initialise.\n");
         return NULL;
     }
 
+    /* Arrange for APs to have CR4.VMXE set early on. */
+    set_in_cr4(X86_CR4_VMXE);
+
     vmx_function_table.caps.singlestep = cpu_has_monitor_trap_flag;
 
     if ( cpu_has_vmx_dt_exiting )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 08:44:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 08:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895515.1304153 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmqYf-0006QA-3h; Tue, 25 Feb 2025 08:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895515.1304153; Tue, 25 Feb 2025 08: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 1tmqYf-0006Q2-16; Tue, 25 Feb 2025 08:44:53 +0000
Received: by outflank-mailman (input) for mailman id 895515;
 Tue, 25 Feb 2025 08: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 1tmqYe-0006Pw-JB
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 08: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 1tmqYe-004QPI-2X
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmqYe-001lLp-1c
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08: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=Xh6ySsa9NgQoZl/UC1BggesnkOsAJ129z+QdbzaxA00=; b=a8kbcGiRwL67ePKJgheg4YUlBk
	HMiagCklEHegtaOxJc5/A+c0wcZ+gHHharHgQHYLHXnwB33FCQlfs2DqLsI70xfJU9E1yt+Ziscog
	KhIfiGgei0GU4b2MQ8I2ynWG0MKvJjcY7d3mISs6IEk+GzAGlmkx4ZTeis4zk9HBceWE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] radix-tree: don't left-shift negative values
Message-Id: <E1tmqYe-001lLp-1c@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 08:44:52 +0000

commit 61ee1a8151fc55113d50064e0cc825a55b83160c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 25 08:45:14 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:45:14 2025 +0100

    radix-tree: don't left-shift negative values
    
    Any (signed) integer is okay to pass into radix_tree_int_to_ptr(), yet
    left shifting negative values is UB. Use an unsigned intermediate type,
    reducing the impact to implementation defined behavior (for the
    unsigned->signed conversion).
    
    Also please Misra C:2012 rule 7.3 by dropping the lower case numeric 'l'
    tag.
    
    No difference in generated code, at least on x86.
    
    Fixes: b004883e29bb ("Simplify and build-fix (for some gcc versions) radix_tree_int_to_ptr()")
    Reported-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/xen/radix-tree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/xen/radix-tree.h b/xen/include/xen/radix-tree.h
index 4077365972..634737eaf5 100644
--- a/xen/include/xen/radix-tree.h
+++ b/xen/include/xen/radix-tree.h
@@ -172,7 +172,7 @@ static inline void radix_tree_replace_slot(void **pslot, void *item)
  */
 static inline void *radix_tree_int_to_ptr(int val)
 {
-    long _ptr = ((long)val << 2) | 0x2l;
+    long _ptr = ((unsigned long)val << 2) | 2;
     ASSERT((_ptr >> 2) == val);
     return (void *)_ptr;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 08:45:03 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 08:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895516.1304157 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmqYp-0006Ta-6K; Tue, 25 Feb 2025 08:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895516.1304157; Tue, 25 Feb 2025 08: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 1tmqYp-0006TI-3j; Tue, 25 Feb 2025 08:45:03 +0000
Received: by outflank-mailman (input) for mailman id 895516;
 Tue, 25 Feb 2025 08: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 1tmqYo-0006T4-LR
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 08: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 1tmqYo-004QPw-2o
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmqYo-001lPt-1x
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08: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=PCvpv8q9LT0BOSaF1fN4JxWoOEpVDyHfatfSmEH2Bgs=; b=umyJmWThjzYo12hur2rmf57qbq
	tIsR4BRehXuqeDjRU9fvEYKvcuWVPnR0aYnRt2rMkmTBSIOi5AWYeHoUQEX2BgqKgxuhNRkzMmrXu
	S9nkbSepnDd5zPNOd+v2R7NFaA7iRhSDjDF8QmJ2aFNoQtqnu6kIJ7LdlTnvyMqimhb8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PV: don't half-open-code SIF_PM_MASK
Message-Id: <E1tmqYo-001lPt-1x@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 08:45:02 +0000

commit 20ae01c041f8f28f6adfdfbfcd9f008c4f6255d6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 25 08:45:46 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:45:46 2025 +0100

    x86/PV: don't half-open-code SIF_PM_MASK
    
    Avoid using the same literal number (8) in two distinct places, by using
    MASK_INTR() to avoid opencoding the literal 8.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/pv/dom0_build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index f54d1da5c6..96e28c7b6a 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -886,7 +886,7 @@ static int __init dom0_construct(struct boot_info *bi, struct domain *d)
         si->flags    = SIF_PRIVILEGED | SIF_INITDOMAIN;
     if ( !vinitrd_start && initrd_len )
         si->flags   |= SIF_MOD_START_PFN;
-    si->flags       |= (xen_processor_pmbits << 8) & SIF_PM_MASK;
+    si->flags       |= MASK_INSR(xen_processor_pmbits, SIF_PM_MASK);
     si->pt_base      = vpt_start;
     si->nr_pt_frames = nr_pt_pages;
     si->mfn_list     = vphysmap_start;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 08:45:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 08:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895517.1304162 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmqYz-0006WC-88; Tue, 25 Feb 2025 08:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895517.1304162; Tue, 25 Feb 2025 08: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 1tmqYz-0006W1-58; Tue, 25 Feb 2025 08:45:13 +0000
Received: by outflank-mailman (input) for mailman id 895517;
 Tue, 25 Feb 2025 08: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 1tmqYy-0006Vv-O7
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 08: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 1tmqYy-004QQC-34
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmqYy-001lSx-2F
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08: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=+FbVU4E0K7LB9lYtMpcATctjOLuZf41/EDl86mNvp8Y=; b=PNpYqpO61eZOFZaJ+VZN48dJeT
	uzOWYt6wZKjEvgZoJ7TGSLhaS4/mlt6fjdZ/xhs3QjgPXXc80NgzhTDQaiTvj7Gp3bWsP6dM0GQSu
	wSaLKz9PyATXoQpj4L24D9ogIS4eNZpcyU8M+95P3uUQi7QPVlmBvcDPOQPpZjPwz3LM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: implement software page table walking
Message-Id: <E1tmqYy-001lSx-2F@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 08:45:12 +0000

commit 44d21a1935abd00c67fd76f7a7c6b6e2e87121cc
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Feb 25 08:46:32 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:46:32 2025 +0100

    xen/riscv: implement software page table walking
    
    RISC-V doesn't have hardware feature to ask MMU to translate
    virtual address to physical address ( like Arm has, for example ),
    so software page table walking is implemented.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/page.h |  2 ++
 xen/arch/riscv/pt.c               | 60 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index 7a6174a109..0439a1a9ee 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -208,6 +208,8 @@ static inline pte_t pte_from_mfn(mfn_t mfn, unsigned int flags)
     return (pte_t){ .pte = pte };
 }
 
+pte_t pt_walk(vaddr_t va, unsigned int *pte_level);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* ASM__RISCV__PAGE_H */
diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c
index a703e0f1bd..9c1f8f6b55 100644
--- a/xen/arch/riscv/pt.c
+++ b/xen/arch/riscv/pt.c
@@ -185,6 +185,66 @@ static int pt_next_level(bool alloc_tbl, pte_t **table, unsigned int offset)
     return XEN_TABLE_NORMAL;
 }
 
+/*
+ * _pt_walk() performs software page table walking and returns the pte_t of
+ * a leaf node or the leaf-most not-present pte_t if no leaf node is found
+ * for further analysis.
+ *
+ * _pt_walk() can optionally return the level of the found pte. Pass NULL
+ * for `pte_level` if this information isn't needed.
+ *
+ * Note: unmapping of final `table` should be done by a caller.
+ */
+static pte_t *_pt_walk(vaddr_t va, unsigned int *pte_level)
+{
+    const mfn_t root = get_root_page();
+    unsigned int level;
+    pte_t *table;
+
+    DECLARE_OFFSETS(offsets, va);
+
+    table = map_table(root);
+
+    /*
+     * Find `table` of an entry which corresponds to `va` by iterating for each
+     * page level and checking if the entry points to a next page table or
+     * to a page.
+     *
+     * Two cases are possible:
+     * - ret == XEN_TABLE_SUPER_PAGE means that the entry was found;
+     *   (Despite the name) XEN_TABLE_SUPER_PAGE also covers 4K mappings. If
+     *   pt_next_level() is called for page table level 0, it results in the
+     *   entry being a pointer to a leaf node, thereby returning
+     *   XEN_TABLE_SUPER_PAGE, despite of the fact this leaf covers 4k mapping.
+     * - ret == XEN_TABLE_MAP_NONE means that requested `va` wasn't actually
+     *   mapped.
+     */
+    for ( level = HYP_PT_ROOT_LEVEL; ; --level )
+    {
+        int ret = pt_next_level(false, &table, offsets[level]);
+
+        if ( ret == XEN_TABLE_MAP_NONE || ret == XEN_TABLE_SUPER_PAGE )
+            break;
+
+        ASSERT(level);
+    }
+
+    if ( pte_level )
+        *pte_level = level;
+
+    return table + offsets[level];
+}
+
+pte_t pt_walk(vaddr_t va, unsigned int *pte_level)
+{
+    pte_t *ptep = _pt_walk(va, pte_level);
+    pte_t pte = *ptep;
+
+    unmap_table(ptep);
+
+    return pte;
+}
+
 /* Update an entry at the level @target. */
 static int pt_update_entry(mfn_t root, vaddr_t virt,
                            mfn_t mfn, unsigned int target,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 08:45:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 08:45:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895518.1304165 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmqZ9-0006YW-9B; Tue, 25 Feb 2025 08:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895518.1304165; Tue, 25 Feb 2025 08: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 1tmqZ9-0006YN-6Z; Tue, 25 Feb 2025 08:45:23 +0000
Received: by outflank-mailman (input) for mailman id 895518;
 Tue, 25 Feb 2025 08: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 1tmqZ8-0006YH-Rh
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 08: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 1tmqZ9-004QQR-0C
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmqZ8-001lUt-2W
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08: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=axH0gor46/PP9u4ENdYKwXG69YXe/SWK9X5ptjBoVhk=; b=O0xdMr0E1hHqlVsaHvBX1cqOYC
	2EUopN0zpo+cbICAlK5k1BdhK8LMljT7kTtHAhBWQ6sPjt0MN/QRdp2mvWJ3QHONq56M1kImQu5eq
	743CxCBduqXK/MJqhuE9TCPZSFBBLRvsHwHwzYmMnVYxlACBr/Aw9xOfGoXTrWjvsX1k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: update defintion of vmap_to_mfn()
Message-Id: <E1tmqZ8-001lUt-2W@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 08:45:22 +0000

commit 814d24a572242246bf767710c83d2a26ae6f43b9
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Feb 25 08:47:12 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 25 08:47:12 2025 +0100

    xen/riscv: update defintion of vmap_to_mfn()
    
    vmap_to_mfn() uses virt_to_maddr(), which is designed to work with VA from
    either the direct map region or Xen's linkage region (XEN_VIRT_START).
    An assertion will occur if it is used with other regions, in particular for
    the VMAP region.
    
    Since RISC-V lacks a hardware feature to request the MMU to translate a VA to
    a PA (as Arm does, for example), software page table walking (pt_walk()) is
    used for the VMAP region to obtain the mfn from pte_t.
    
    To avoid introduce a circular dependency between asm/mm.h and asm/page.h by
    including each other, the static inline function  _vmap_to_mfn() is introduced
    in asm/page.h, as it uses struct pte_t and pte_is_mapping() from asm/page.h.
    _vmap_to_mfn() is then reused in the definition of vmap_to_mfn() macro in
    asm/mm.h.
    
    Fixes: 7db8d2bd9b ("xen/riscv: add minimal stuff to mm.h to build full Xen")
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/mm.h   | 2 +-
 xen/arch/riscv/include/asm/page.h | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 292aa48fc1..4035cd400a 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -23,7 +23,7 @@ extern vaddr_t directmap_virt_start;
 #define gaddr_to_gfn(ga)    _gfn(paddr_to_pfn(ga))
 #define mfn_to_maddr(mfn)   pfn_to_paddr(mfn_x(mfn))
 #define maddr_to_mfn(ma)    _mfn(paddr_to_pfn(ma))
-#define vmap_to_mfn(va)     maddr_to_mfn(virt_to_maddr((vaddr_t)(va)))
+#define vmap_to_mfn(va)     _vmap_to_mfn((vaddr_t)(va))
 #define vmap_to_page(va)    mfn_to_page(vmap_to_mfn(va))
 
 static inline void *maddr_to_virt(paddr_t ma)
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index 0439a1a9ee..bf8988f657 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -210,6 +210,15 @@ static inline pte_t pte_from_mfn(mfn_t mfn, unsigned int flags)
 
 pte_t pt_walk(vaddr_t va, unsigned int *pte_level);
 
+static inline mfn_t _vmap_to_mfn(vaddr_t va)
+{
+    pte_t entry = pt_walk(va, NULL);
+
+    BUG_ON(!pte_is_mapping(entry));
+
+    return mfn_from_pte(entry);
+}
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* ASM__RISCV__PAGE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 08:45:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 08:45:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895519.1304170 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmqZK-0006bW-B0; Tue, 25 Feb 2025 08:45:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895519.1304170; Tue, 25 Feb 2025 08: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 1tmqZK-0006bM-83; Tue, 25 Feb 2025 08:45:34 +0000
Received: by outflank-mailman (input) for mailman id 895519;
 Tue, 25 Feb 2025 08: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 1tmqZJ-0006bF-74
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 08: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 1tmqZJ-004QQj-1N
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08:45:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmqZJ-001laF-0X
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 08: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=Ur1IAsP31VFkRYU1Bbj8tg7US+GySTV1EYem3WBaMMU=; b=lSU61Ov1gHreamJbrw83d6GJjO
	lmF+UF/gXugRnnb6WKMuyyzS0V8AinOMjHnA1+JzavAlUowjHPgyeTVKOoJcRJYOI4bCTfPQvKxJH
	2/eDNE0GGP9xMjKF+jWN6R91atkDlpPbzNTX34woQQpOYtg4lJm892t3IG+HEgwlb5kQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ucode: Add option to scan microcode by default
Message-Id: <E1tmqZJ-001laF-0X@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 08:45:33 +0000

commit 70c933d44f71bcbd1651bba6a8e5a7799d232023
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Mon Feb 17 17:50:11 2025 +0000
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Tue Feb 25 09:28:38 2025 +0100

    x86/ucode: Add option to scan microcode by default
    
    A lot of systems automatically add microcode to the initramfs so it can
    be useful as a vendor policy to always scan for microcode. Add a Kconfig
    option to allow setting the default behaviour.
    
    The default behaviour is unchanged since the new option defaults to
    "no".
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 docs/misc/xen-command-line.pandoc |  5 +++--
 xen/arch/x86/Kconfig              | 10 ++++++++++
 xen/arch/x86/cpu/microcode/core.c |  2 +-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 9bbd00baef..0c6225391d 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2724,7 +2724,7 @@ performance.
 > `= List of [ <integer> | scan=<bool>, nmi=<bool> ]`
 
     Applicability: x86
-    Default: `nmi`
+    Default: `scan` is selectable via Kconfig, `nmi=true`
 
 Controls for CPU microcode loading. For early loading, this parameter can
 specify how and where to find the microcode update blob. For late loading,
@@ -2747,7 +2747,8 @@ microcode in the cpio name space must be:
   - on Intel: kernel/x86/microcode/GenuineIntel.bin
   - on AMD  : kernel/x86/microcode/AuthenticAMD.bin
 When using xen.efi, the `ucode=<filename>` config file setting takes
-precedence over `scan`.
+precedence over `scan`. The default value for `scan` is set with
+`CONFIG_UCODE_SCAN_DEFAULT`.
 
 'nmi' determines late loading is performed in NMI handler or just in
 stop_machine context. In NMI handler, even NMIs are blocked, which is
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 9cdd04721a..6e41bc0fb4 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -383,6 +383,16 @@ config ALTP2M
 
 	  If unsure, stay with defaults.
 
+config UCODE_SCAN_DEFAULT
+	bool "Scan for microcode by default"
+	help
+	  During boot, Xen can scan the multiboot images for a CPIO archive
+	  containing CPU microcode to be loaded, which is Linux's mechanism for
+	  early microcode loading.
+
+	  Enable if you have a Linux-based dom0 with microcode attached to the
+	  initramfs.
+
 endmenu
 
 source "common/Kconfig"
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 87283cff1d..de00c22b4b 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -100,7 +100,7 @@ static struct microcode_patch *microcode_cache;
  * location we require that they are not both active together.
  */
 static int __initdata opt_mod_idx;
-static bool __initdata opt_scan;
+static bool __initdata opt_scan = IS_ENABLED(CONFIG_UCODE_SCAN_DEFAULT);
 
 /*
  * Used by the EFI path only, when xen.cfg identifies an explicit microcode
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 10:11:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 10:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895601.1304252 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmru4-0000J3-1s; Tue, 25 Feb 2025 10:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895601.1304252; Tue, 25 Feb 2025 10: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 1tmru3-0000Iu-VG; Tue, 25 Feb 2025 10:11:03 +0000
Received: by outflank-mailman (input) for mailman id 895601;
 Tue, 25 Feb 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 1tmru2-0000Ic-2k
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 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 1tmru2-004UYJ-0I
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 10:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmru1-002Af9-2U
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 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=HutyRmQ9CkOR969Yr03zecnDdFd4wzIwmMwzJmjnij4=; b=fwTjDMTXmxgsjKht8qxEukXWaK
	li4JGkx0KnFigu7MnkU5hSyb0+3vJJvgxii5TEEoW/HgskuFjcHxtqvS8h+GVRq0Ibpb/B4MecvYP
	ElwclQ+HUDpQ18zcl3r/02pciL+Q5Eei39wBpdeih5CvK1n9Q67bH/S+toK1z1cjsMSQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: Add option to scan microcode by default
Message-Id: <E1tmru1-002Af9-2U@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 10:11:01 +0000

commit 70c933d44f71bcbd1651bba6a8e5a7799d232023
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Mon Feb 17 17:50:11 2025 +0000
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Tue Feb 25 09:28:38 2025 +0100

    x86/ucode: Add option to scan microcode by default
    
    A lot of systems automatically add microcode to the initramfs so it can
    be useful as a vendor policy to always scan for microcode. Add a Kconfig
    option to allow setting the default behaviour.
    
    The default behaviour is unchanged since the new option defaults to
    "no".
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 docs/misc/xen-command-line.pandoc |  5 +++--
 xen/arch/x86/Kconfig              | 10 ++++++++++
 xen/arch/x86/cpu/microcode/core.c |  2 +-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 9bbd00baef..0c6225391d 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2724,7 +2724,7 @@ performance.
 > `= List of [ <integer> | scan=<bool>, nmi=<bool> ]`
 
     Applicability: x86
-    Default: `nmi`
+    Default: `scan` is selectable via Kconfig, `nmi=true`
 
 Controls for CPU microcode loading. For early loading, this parameter can
 specify how and where to find the microcode update blob. For late loading,
@@ -2747,7 +2747,8 @@ microcode in the cpio name space must be:
   - on Intel: kernel/x86/microcode/GenuineIntel.bin
   - on AMD  : kernel/x86/microcode/AuthenticAMD.bin
 When using xen.efi, the `ucode=<filename>` config file setting takes
-precedence over `scan`.
+precedence over `scan`. The default value for `scan` is set with
+`CONFIG_UCODE_SCAN_DEFAULT`.
 
 'nmi' determines late loading is performed in NMI handler or just in
 stop_machine context. In NMI handler, even NMIs are blocked, which is
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 9cdd04721a..6e41bc0fb4 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -383,6 +383,16 @@ config ALTP2M
 
 	  If unsure, stay with defaults.
 
+config UCODE_SCAN_DEFAULT
+	bool "Scan for microcode by default"
+	help
+	  During boot, Xen can scan the multiboot images for a CPIO archive
+	  containing CPU microcode to be loaded, which is Linux's mechanism for
+	  early microcode loading.
+
+	  Enable if you have a Linux-based dom0 with microcode attached to the
+	  initramfs.
+
 endmenu
 
 source "common/Kconfig"
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 87283cff1d..de00c22b4b 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -100,7 +100,7 @@ static struct microcode_patch *microcode_cache;
  * location we require that they are not both active together.
  */
 static int __initdata opt_mod_idx;
-static bool __initdata opt_scan;
+static bool __initdata opt_scan = IS_ENABLED(CONFIG_UCODE_SCAN_DEFAULT);
 
 /*
  * Used by the EFI path only, when xen.cfg identifies an explicit microcode
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 15:11:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 15:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895864.1304506 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmwaN-0002ia-Gl; Tue, 25 Feb 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 895864.1304506; Tue, 25 Feb 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 1tmwaN-0002iS-EC; Tue, 25 Feb 2025 15:11:03 +0000
Received: by outflank-mailman (input) for mailman id 895864;
 Tue, 25 Feb 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 1tmwaM-0002iG-6b
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 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 1tmwaM-004h7O-0w
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 15:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmwaL-003W3Z-3A
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 15: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=7cfsGKAXrg/Dsg8LCFM8lOFhOKFnfnk5Jl9s0Yjvmdw=; b=s8JvobHwHdOAW1/zq3wpDCQhHq
	ZUaW2r1foraoN+9l+1QLS9q1uvze+xP7AtMDRQpDlBJh8O5dCaqtp4zEO0fF2smh1aiSMCrDbLFkS
	3I+0NWhkTN2A7+eEnJ2eWPOXAwFW1/9NxaM5b3X9VAg5DV7c717UcRqBvx3n9nNpYTFc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/msi: Change __msi_set_enable() to take pci_sbdf_t
Message-Id: <E1tmwaL-003W3Z-3A@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 15:11:01 +0000

commit 250d87dc3ff9ebcb77da65e2999ace6b378862d7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sun Feb 2 13:48:40 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 25 13:30:55 2025 +0000

    x86/msi: Change __msi_set_enable() to take pci_sbdf_t
    
    This removes the unnecessary work of splitting a 32-bit number across
    4 registers, and recombining later.  Bloat-o-meter reports:
    
      add/remove: 0/0 grow/shrink: 0/9 up/down: 0/-295 (-295)
      Function                                     old     new   delta
      enable_iommu                                1748    1732     -16
      iommu_msi_unmask                              98      81     -17
      iommu_msi_mask                               100      83     -17
      disable_iommu                                286     269     -17
      __msi_set_enable                              81      50     -31
      __pci_disable_msi                            178     146     -32
      pci_cleanup_msi                              268     229     -39
      pci_enable_msi                              1063    1019     -44
      pci_restore_msi_state                       1116    1034     -82
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/msi.h           |  2 +-
 xen/arch/x86/msi.c                       | 14 ++++----------
 xen/drivers/passthrough/amd/iommu_init.c |  5 +++--
 3 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 7f9e531f73..378b85ee94 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -238,7 +238,7 @@ struct arch_msix {
 void early_msi_init(void);
 void msi_compose_msg(unsigned vector, const cpumask_t *cpu_mask,
                      struct msi_msg *msg);
-void __msi_set_enable(u16 seg, u8 bus, u8 slot, u8 func, int pos, int enable);
+void __msi_set_enable(pci_sbdf_t sbdf, int pos, int enable);
 void cf_check mask_msi_irq(struct irq_desc *desc);
 void cf_check unmask_msi_irq(struct irq_desc *desc);
 void guest_mask_msi_irq(struct irq_desc *desc, bool mask);
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index c9fe942c46..bf5b71822e 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -267,28 +267,22 @@ void cf_check set_msi_affinity(struct irq_desc *desc, const cpumask_t *mask)
     write_msi_msg(msi_desc, &msg);
 }
 
-void __msi_set_enable(u16 seg, u8 bus, u8 slot, u8 func, int pos, int enable)
+void __msi_set_enable(pci_sbdf_t sbdf, int pos, int enable)
 {
-    uint16_t control = pci_conf_read16(PCI_SBDF(seg, bus, slot, func),
-                                       pos + PCI_MSI_FLAGS);
+    uint16_t control = pci_conf_read16(sbdf, pos + PCI_MSI_FLAGS);
 
     control &= ~PCI_MSI_FLAGS_ENABLE;
     if ( enable )
         control |= PCI_MSI_FLAGS_ENABLE;
-    pci_conf_write16(PCI_SBDF(seg, bus, slot, func),
-                     pos + PCI_MSI_FLAGS, control);
+    pci_conf_write16(sbdf, pos + PCI_MSI_FLAGS, control);
 }
 
 static void msi_set_enable(struct pci_dev *dev, int enable)
 {
     unsigned int pos = dev->msi_pos;
-    u16 seg = dev->seg;
-    u8 bus = dev->bus;
-    u8 slot = PCI_SLOT(dev->devfn);
-    u8 func = PCI_FUNC(dev->devfn);
 
     if ( pos )
-        __msi_set_enable(seg, bus, slot, func, pos, enable);
+        __msi_set_enable(dev->sbdf, pos, enable);
 }
 
 static void msix_set_enable(struct pci_dev *dev, int enable)
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 934adc5abe..bb25b55c85 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -409,8 +409,9 @@ static void iommu_reset_log(struct amd_iommu *iommu,
 
 static void amd_iommu_msi_enable(struct amd_iommu *iommu, int flag)
 {
-    __msi_set_enable(iommu->seg, PCI_BUS(iommu->bdf), PCI_SLOT(iommu->bdf),
-                     PCI_FUNC(iommu->bdf), iommu->msi.msi_attrib.pos, flag);
+    pci_sbdf_t sbdf = { .seg = iommu->seg, .bdf = iommu->bdf };
+
+    __msi_set_enable(sbdf, iommu->msi.msi_attrib.pos, flag);
 }
 
 static void cf_check iommu_msi_unmask(struct irq_desc *desc)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 15:11:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 15:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895865.1304511 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmwaW-0002mk-IB; Tue, 25 Feb 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 895865.1304511; Tue, 25 Feb 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 1tmwaW-0002mc-Fb; Tue, 25 Feb 2025 15:11:12 +0000
Received: by outflank-mailman (input) for mailman id 895865;
 Tue, 25 Feb 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 1tmwaW-0002mS-5t
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 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 1tmwaW-004h7V-1E
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 15:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmwaW-003W5d-0M
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 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=pki/RmYBBPoLA9IFzsKL/unmCnlF9PCx7ZCn3G9G91M=; b=eRUv4IwM3M0G9gfPBtgD2DWsm9
	YTCwvWxs3MhkUhMTow7qAeCQFG93opnitjfVH5GMm9M2r6znLCVulp5P43CpzXdnteB/ay9thxm7a
	akuVj28GGrYcve0ZRUjxL0ogEDpg9bTCXbLhPKS82RiEN7v4Nb4YGMwlP9bjfLLP5cWE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/console: Optimise the parameter order of vprintk_common()
Message-Id: <E1tmwaW-003W5d-0M@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 15:11:12 +0000

commit 654bfa421f72efa9f9600063cb26ca9326cd264d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 23 03:27:07 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 25 13:30:55 2025 +0000

    xen/console: Optimise the parameter order of vprintk_common()
    
    For ABIs which pass parameters by register (all cases that we compile Xen
    for), inserting new arguments on the left hand side involves shuffling all
    other parameters along by one register whereas appending a new argument
    doesn't involve shuffling of existing registers.
    
    Reorder vprintk_common()'s prefix parameter to being last.  This is a marginal
    improvement on all architectures:
    
      Function                              old     new   delta
      vprintk                                18      12      -6  x86
      vprintk                                32      24      -8  arm32
      vprintk                                52      48      -4  arm64
      vprintk                                52      48      -4  riscv64
      vprintk                                80      72      -8  ppc64
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-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 7adf4e11fc..b6a8c71928 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -909,7 +909,7 @@ static void printk_start_of_line(const char *prefix)
     __putstr(tstr);
 }
 
-static void vprintk_common(const char *prefix, const char *fmt, va_list args)
+static void vprintk_common(const char *fmt, va_list args, const char *prefix)
 {
     struct vps {
         bool continued, do_print;
@@ -963,7 +963,7 @@ static void vprintk_common(const char *prefix, const char *fmt, va_list args)
 
 void vprintk(const char *fmt, va_list args)
 {
-    vprintk_common("(XEN) ", fmt, args);
+    vprintk_common(fmt, args, "(XEN) ");
 }
 
 void printk(const char *fmt, ...)
@@ -983,7 +983,7 @@ void guest_printk(const struct domain *d, const char *fmt, ...)
     snprintf(prefix, sizeof(prefix), "(d%d) ", d->domain_id);
 
     va_start(args, fmt);
-    vprintk_common(prefix, fmt, args);
+    vprintk_common(fmt, args, prefix);
     va_end(args);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 15:11:22 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 15:11:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895866.1304515 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmwag-0002rq-JX; Tue, 25 Feb 2025 15:11:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895866.1304515; Tue, 25 Feb 2025 15: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 1tmwag-0002ri-H0; Tue, 25 Feb 2025 15:11:22 +0000
Received: by outflank-mailman (input) for mailman id 895866;
 Tue, 25 Feb 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 1tmwag-0002rZ-9l
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 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 1tmwag-004h7a-1d
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 15:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmwag-003W7n-0e
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 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=Zx4K2820mgH4PNALCAj+XL8UuxcMw9BNOEtbCeRMAF8=; b=cc/diA2r47vmZSJODyBEYZSFJ3
	kAXWTAH7siWvKZlXILWMan/nIkApgcDqRdlhBTbvCZf18jVZWVXbEJ/5N127gXPujnQU8aqtG3xWa
	AcxDv7MerRy4ShnWB/U4WgerLw+UujxqJj0i6C4AtO5RhpbtEGglkZtPCF/+Rc+CwRQY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/ACPI: Drop local acpi_os_{v,}printf() and use plain {v,}printk()
Message-Id: <E1tmwag-003W7n-0e@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 15:11:22 +0000

commit a38b4d64fc36004c522d96b01998693f249b6cb0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 17 19:13:01 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 25 13:30:55 2025 +0000

    xen/ACPI: Drop local acpi_os_{v,}printf() and use plain {v,}printk()
    
    Now that Xen has a real vprintk(), there's no need to opencode it locally with
    vsnprintf().  Redirect the debug routines to the real {v,}printk() and drop
    the local acpi_os_{v,}printf() implementations.
    
    Amongst other things, this removes one arbitrary limit on message size, as
    well as removing a 512 byte static buffer that ought to have been in
    __initdata given that is private to an __init function.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/acpi/osl.c      | 17 -----------------
 xen/include/acpi/acpiosxf.h |  5 ++---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c
index ab80d6b2a9..7f233bab42 100644
--- a/xen/drivers/acpi/osl.c
+++ b/xen/drivers/acpi/osl.c
@@ -45,23 +45,6 @@ ACPI_MODULE_NAME("osl")
 #include CONFIG_ACPI_CUSTOM_DSDT_FILE
 #endif
 
-void __init acpi_os_printf(const char *fmt, ...)
-{
-	va_list args;
-	va_start(args, fmt);
-	acpi_os_vprintf(fmt, args);
-	va_end(args);
-}
-
-void __init acpi_os_vprintf(const char *fmt, va_list args)
-{
-	static char buffer[512];
-
-	vsnprintf(buffer, sizeof(buffer), fmt, args);
-
-	printk("%s", buffer);
-}
-
 acpi_physical_address __initdata rsdp_hint;
 
 acpi_physical_address __init acpi_os_get_root_pointer(void)
diff --git a/xen/include/acpi/acpiosxf.h b/xen/include/acpi/acpiosxf.h
index de83ea38c4..2da318962f 100644
--- a/xen/include/acpi/acpiosxf.h
+++ b/xen/include/acpi/acpiosxf.h
@@ -82,8 +82,7 @@ acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width);
 /*
  * Debug print routines
  */
-void ACPI_INTERNAL_VAR_XFACE acpi_os_printf(const char *format, ...);
-
-void acpi_os_vprintf(const char *format, va_list args);
+#define acpi_os_printf printk
+#define acpi_os_vprintf vprintk
 
 #endif				/* __ACPIOSXF_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 15:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 15:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895867.1304518 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmwar-0002wQ-LC; Tue, 25 Feb 2025 15:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895867.1304518; Tue, 25 Feb 2025 15: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 1tmwar-0002wJ-IS; Tue, 25 Feb 2025 15:11:33 +0000
Received: by outflank-mailman (input) for mailman id 895867;
 Tue, 25 Feb 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 1tmwaq-0002wC-DJ
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 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 1tmwaq-004h7j-1y
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 15:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmwaq-003WAQ-14
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 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=k2+VU0/aSTEh5wUqntqld3JsjvKtA4MwRT0ciXYkPEk=; b=ebItn8GiwvhJbW9iubHcJ91rRS
	EgsXqcIBgREYz5w5X5BjjPI2MZ934QLSXd1hOC+Wpb4ilOxLtUyrfWCr41CIVo4A76/NlKDqKCcg0
	I+PF8Wy3swVv5HTlk69OMFA+k3VrHPmZxX6XKa4Eo5rdxppgQAfkffBLl2UUJyRUQ1uQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Fix oxenstored build warning
Message-Id: <E1tmwaq-003WAQ-14@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 15:11:32 +0000

commit c11772277fe5f1b0874141a24554c2e3da2d9a6e
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Fri Feb 14 15:24:27 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 25 13:30:55 2025 +0000

    tools/ocaml: Fix oxenstored build warning
    
    OCaml, in preparation for a renaming of the error string associated with
    conversion failure in 'int_of_string' functions, started to issue this
    warning:
    
      File "process.ml", line 440, characters 13-28:
      440 |   | (Failure "int_of_string")    -> reply_error "EINVAL"
                         ^^^^^^^^^^^^^^^
      Warning 52 [fragile-literal-pattern]: Code should not depend on the actual values of
      this constructor's arguments. They are only for information
      and may change in future versions. (See manual section 11.5)
    
    Deal with this at the source, and instead create our own stable
    ConversionFailure exception that's raised on the None case in
    'int_of_string_opt'.
    
    'c_int_of_string' is safe and does not raise such exceptions.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/xenstored/Makefile     |  1 +
 tools/ocaml/xenstored/perms.ml     |  2 +-
 tools/ocaml/xenstored/poll.ml      |  2 +-
 tools/ocaml/xenstored/process.ml   | 18 +++++++++---------
 tools/ocaml/xenstored/utils.ml     | 10 ++++++++--
 tools/ocaml/xenstored/xenstored.ml | 16 ++++++++--------
 6 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/tools/ocaml/xenstored/Makefile b/tools/ocaml/xenstored/Makefile
index 5e8210a906..c333394a34 100644
--- a/tools/ocaml/xenstored/Makefile
+++ b/tools/ocaml/xenstored/Makefile
@@ -54,6 +54,7 @@ OBJS = paths \
 	history \
 	parse_arg \
 	process \
+	poll \
 	xenstored
 
 INTF = symbol.cmi trie.cmi syslog.cmi systemd.cmi poll.cmi
diff --git a/tools/ocaml/xenstored/perms.ml b/tools/ocaml/xenstored/perms.ml
index 14f8e334fe..2c4ee9e617 100644
--- a/tools/ocaml/xenstored/perms.ml
+++ b/tools/ocaml/xenstored/perms.ml
@@ -70,7 +70,7 @@ struct
 
   let perm_of_string s =
     let ty = permty_of_char s.[0]
-    and id = int_of_string (String.sub s 1 (String.length s - 1)) in
+    and id = Utils.int_of_string_exn (String.sub s 1 (String.length s - 1)) in
     (id, ty)
 
   let of_strings ls =
diff --git a/tools/ocaml/xenstored/poll.ml b/tools/ocaml/xenstored/poll.ml
index fefaa6e74c..f8571e4590 100644
--- a/tools/ocaml/xenstored/poll.ml
+++ b/tools/ocaml/xenstored/poll.ml
@@ -30,7 +30,7 @@ external set_fd_limit: int -> unit = "stub_set_fd_limit"
 let get_sys_fs_nr_open () =
   try
     let ch = open_in "/proc/sys/fs/nr_open" in
-    let v = int_of_string (input_line ch) in
+    let v = Utils.int_of_string_exn (input_line ch) in
     close_in_noerr ch; v
   with _ -> 1024 * 1024
 
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 432d66321c..0c9c460a99 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -229,7 +229,7 @@ let do_debug con t _domains cons data =
       Logging.xb_op ~tid:0 ~ty:Xenbus.Xb.Op.Debug ~con:"=======>" msg;
       None
     | "quota" :: domid :: _ ->
-      let domid = int_of_string domid in
+      let domid = Utils.int_of_string_exn domid in
       let quota = (Store.get_quota t.Transaction.store) in
       Some (Quota.to_string quota domid ^ "\000")
     | "watches" :: _ ->
@@ -242,7 +242,7 @@ let do_debug con t _domains cons data =
       History.trim ();
       Some "trimmed"
     | "txn" :: domid :: _ ->
-      let domid = int_of_string domid in
+      let domid = Utils.int_of_string_exn domid in
       let con = Connections.find_domain cons domid in
       let b = Buffer.create 128 in
       let () = con.transactions |> Hashtbl.iter @@ fun id tx ->
@@ -253,7 +253,7 @@ let do_debug con t _domains cons data =
       in
       Some (Buffer.contents b)
     | "xenbus" :: domid :: _ ->
-      let domid = int_of_string domid in
+      let domid = Utils.int_of_string_exn domid in
       let con = Connections.find_domain cons domid in
       let s = Printf.sprintf "xenbus: %s; overflow queue length: %d, can_input: %b, has_more_input: %b, has_old_output: %b, has_new_output: %b, has_more_work: %b. pending: %s"
           (Xenbus.Xb.debug con.xb)
@@ -267,7 +267,7 @@ let do_debug con t _domains cons data =
       in
       Some s
     | "mfn" :: domid :: _ ->
-      let domid = int_of_string domid in
+      let domid = Utils.int_of_string_exn domid in
       let con = Connections.find_domain cons domid in
       may (fun dom -> Printf.sprintf "%nd\000" (Domain.get_mfn dom)) (Connection.get_domain con)
     | _ -> None
@@ -340,7 +340,7 @@ let do_isintroduced con _t domains _cons data =
   then raise Define.Permission_denied;
   let domid =
     match (split None '\000' data) with
-    | domid :: _ -> int_of_string domid
+    | domid :: _ -> Utils.int_of_string_exn domid
     | _          -> raise Invalid_Cmd_Args
   in
   if domid = Define.domid_self || Domains.exist domains domid then "T\000" else "F\000"
@@ -437,7 +437,7 @@ let input_handle_error ~cons ~doms ~fct ~con ~t ~req =
   | Quota.Limit_reached          -> reply_error "EQUOTA"
   | Quota.Data_too_big           -> reply_error "E2BIG"
   | Quota.Transaction_opened     -> reply_error "EQUOTA"
-  | (Failure "int_of_string")    -> reply_error "EINVAL"
+  | Utils.ConversionFailed s     -> reply_error "EINVAL"
   | Define.Unknown_operation     -> reply_error "ENOSYS"
 
 let write_access_log ~ty ~tid ~con ~data =
@@ -578,7 +578,7 @@ let do_introduce con t domains cons data =
   let (domid, mfn, remote_port) =
     match (split None '\000' data) with
     | domid :: mfn :: remote_port :: _ ->
-      int_of_string domid, Nativeint.of_string mfn, int_of_string remote_port
+      Utils.int_of_string_exn domid, Nativeint.of_string mfn, Utils.int_of_string_exn remote_port
     | _                         -> raise Invalid_Cmd_Args;
   in
   let dom =
@@ -604,7 +604,7 @@ let do_release con t domains cons data =
   then raise Define.Permission_denied;
   let domid =
     match (split None '\000' data) with
-    | [domid;""] -> int_of_string domid
+    | [domid;""] -> Utils.int_of_string_exn domid
     | _          -> raise Invalid_Cmd_Args
   in
   let fire_spec_watches = Domains.exist domains domid in
@@ -620,7 +620,7 @@ let do_resume con _t domains _cons data =
   then raise Define.Permission_denied;
   let domid =
     match (split None '\000' data) with
-    | domid :: _ -> int_of_string domid
+    | domid :: _ -> Utils.int_of_string_exn domid
     | _          -> raise Invalid_Cmd_Args
   in
   if Domains.exist domains domid
diff --git a/tools/ocaml/xenstored/utils.ml b/tools/ocaml/xenstored/utils.ml
index 48d84ef7d3..7a556bce75 100644
--- a/tools/ocaml/xenstored/utils.ml
+++ b/tools/ocaml/xenstored/utils.ml
@@ -53,8 +53,14 @@ let hexify s =
     ) s;
   Bytes.unsafe_to_string hs
 
+exception ConversionFailed of string
+let int_of_string_exn s =
+  match int_of_string_opt s with
+  | Some x -> x
+  | None -> raise (ConversionFailed s)
+
 let unhexify hs =
-  let char_of_hexseq seq0 seq1 = Char.chr (int_of_string (sprintf "0x%c%c" seq0 seq1)) in
+  let char_of_hexseq seq0 seq1 = Char.chr (int_of_string_exn (sprintf "0x%c%c" seq0 seq1)) in
   let b = Bytes.create (String.length hs / 2) in
   for i = 0 to Bytes.length b - 1
   do
@@ -86,7 +92,7 @@ let read_file_single_integer filename =
   let buf = Bytes.make 20 '\000' in
   let sz = Unix.read fd buf 0 20 in
   Unix.close fd;
-  int_of_string (Bytes.sub_string buf 0 sz)
+  int_of_string_exn (Bytes.sub_string buf 0 sz)
 
 (* @path may be guest data and needs its length validating.  @connection_path
  * is generated locally in xenstored and always of the form "/local/domain/$N/" *)
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 1aaa3e995e..84dee622ea 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -167,20 +167,20 @@ module DB = struct
                					   e.g. a RO socket from a previous version: ignore it *)
             global_f ~rw
           | "evtchn-dev" :: fd :: domexc_port :: [] ->
-            evtchn_f ~fd:(int_of_string fd)
-              ~domexc_port:(int_of_string domexc_port)
+            evtchn_f ~fd:(Utils.int_of_string_exn fd)
+              ~domexc_port:(Utils.int_of_string_exn domexc_port)
           | "socket" :: fd :: [] ->
-            socket_f ~fd:(int_of_string fd)
+            socket_f ~fd:(Utils.int_of_string_exn fd)
           | "dom" :: domid :: mfn :: remote_port :: rest ->
             let local_port = match rest with
               | [] -> None (* backward compat: old version didn't have it *)
-              | local_port :: _ -> Some (int_of_string local_port) in
+              | local_port :: _ -> Some (Utils.int_of_string_exn local_port) in
             domain_f ?local_port
-              ~remote_port:(int_of_string remote_port)
-              (int_of_string domid)
+              ~remote_port:(Utils.int_of_string_exn remote_port)
+              (Utils.int_of_string_exn domid)
               (Nativeint.of_string mfn)
           | "watch" :: domid :: path :: token :: [] ->
-            watch_f (int_of_string domid)
+            watch_f (Utils.int_of_string_exn domid)
               (unhexify path) (unhexify token)
           | "store" :: path :: perms :: value :: [] ->
             store_f (getpath path)
@@ -214,7 +214,7 @@ module DB = struct
     in
     let global_f ~rw =
       let get_listen_sock sockfd =
-        let fd = sockfd |> int_of_string |> Utils.FD.of_int in
+        let fd = sockfd |> Utils.int_of_string_exn |> Utils.FD.of_int in
         Unix.listen fd 1;
         Some fd
       in
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 15:11:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 15:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895868.1304522 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmwb1-00035Q-N3; Tue, 25 Feb 2025 15:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895868.1304522; Tue, 25 Feb 2025 15: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 1tmwb1-00035K-KB; Tue, 25 Feb 2025 15:11:43 +0000
Received: by outflank-mailman (input) for mailman id 895868;
 Tue, 25 Feb 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 1tmwb0-000323-H5
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 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 1tmwb0-004h7q-2M
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 15:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmwb0-003WCU-1O
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 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=O6s9Jpxt9lTlGDgF8hWHi59osyKVpjlivNryGiPDPb8=; b=nZDnNgsNkqoaW4ugc8bzoCaD80
	nMaO4JpwUStDzUQPmFvjjXV+HvyfDBkhTeIP9hitikap/MaRKPEKu057tYg/IBdcvDz6wEvQ7qQFG
	OXbfNbGtWlK/tnJwwv3ECH5sTtQ2ZvPyfTg9BC9wGin27ttYYAE/FnuVsX+KOXEZh1gQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] scripts: Fix git-checkout.sh to work with non-master branches (take 2)
Message-Id: <E1tmwb0-003WCU-1O@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 15:11:42 +0000

commit 01fb23dd71006d87e874f310e9c50f31582f274e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 31 13:35:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 25 13:30:55 2025 +0000

    scripts: Fix git-checkout.sh to work with non-master branches (take 2)
    
    First, rename $TAG to $COMMITTISH.  We already pass tags, branches (well, only
    master) and full SHAs into this script.
    
    Xen uses master for QEMU_UPSTREAM_REVISION, and has done for other trees too
    in the path.  Apparently we've never specified a different branch, because the
    git-clone rune only pulls in the master branch; it does not pull in diverging
    branches.
    
    Fix this by performing an explicit fetch of the $COMMITTISH, then checking out
    the dummy branch from the FETCH_HEAD.
    
    Suggested-by: Jason Andryuk <jason.andryuk@amd.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 scripts/git-checkout.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/git-checkout.sh b/scripts/git-checkout.sh
index fd4425ac4e..56a60193a7 100755
--- a/scripts/git-checkout.sh
+++ b/scripts/git-checkout.sh
@@ -1,12 +1,12 @@
 #!/bin/sh
 
 if test $# -lt 3; then
-	echo "Usage: $0 <tree> <tag> <dir>"
+	echo "Usage: $0 <tree> <committish> <dir>"
 	exit 1
 fi
 
 TREE=$1
-TAG=$2
+COMMITTISH=$2
 DIR=$3
 
 set -e
@@ -15,10 +15,11 @@ if test \! -d $DIR-remote; then
 	rm -rf $DIR-remote $DIR-remote.tmp
 	mkdir -p $DIR-remote.tmp; rmdir $DIR-remote.tmp
 	$GIT clone $TREE $DIR-remote.tmp
-	if test "$TAG" ; then
+	if test "$COMMITTISH" ; then
 		cd $DIR-remote.tmp
+		$GIT fetch origin "$COMMITTISH"
 		$GIT branch -D dummy >/dev/null 2>&1 ||:
-		$GIT checkout -b dummy $TAG
+		$GIT checkout -b dummy FETCH_HEAD
 		cd -
 	fi
 	mv $DIR-remote.tmp $DIR-remote
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 15:11:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 15:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895869.1304527 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmwbB-0003E2-Pi; Tue, 25 Feb 2025 15:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895869.1304527; Tue, 25 Feb 2025 15: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 1tmwbB-0003Du-N4; Tue, 25 Feb 2025 15:11:53 +0000
Received: by outflank-mailman (input) for mailman id 895869;
 Tue, 25 Feb 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 1tmwbA-0003Dm-KL
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 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 1tmwbA-004h8H-2g
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 15:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmwbA-003WEv-1l
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 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=b/sQw/5r/N+CX++4sZtFAsEfyn16Wt0lCdvfYRNmfRU=; b=B+T9nU0t2kCvBJTZwjagss8JWW
	uflIjmdvSvkhA9QJCw8lD5zk7Goka7HR5PwKrFjqvVONpt3B4RWjY9KWayFal5LoinHR2WMTEElLn
	W8fpH8iJtGdnp3q+FF+HsIcAmG1tmnTomJUD+vU88eVBBkTFyHX0/oms5tufYq1TTtjs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CirrusCI: Use shallow clone
Message-Id: <E1tmwbA-003WEv-1l@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 15:11:52 +0000

commit 96970b46e5e84fa2666f76f5b0972b826a3ffba4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 24 15:36:11 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 25 13:30:55 2025 +0000

    CirrusCI: Use shallow clone
    
    This reduces the Clone step from ~50s to ~3s.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 .cirrus.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index 7216729b69..e2949d99d7 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -13,6 +13,7 @@ freebsd_template: &FREEBSD_ENV
   environment:
     APPEND_LIB: /usr/local/lib
     APPEND_INCLUDES: /usr/local/include
+    CIRRUS_CLONE_DEPTH: 1
 
 freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
   << : *FREEBSD_ENV
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 16:11:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 16:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895883.1304540 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmxWS-0003mQ-5Q; Tue, 25 Feb 2025 16:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895883.1304540; Tue, 25 Feb 2025 16: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 1tmxWS-0003mI-2X; Tue, 25 Feb 2025 16:11:04 +0000
Received: by outflank-mailman (input) for mailman id 895883;
 Tue, 25 Feb 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 1tmxWQ-0003m6-I3
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 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 1tmxWQ-004in3-1A
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 16:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmxWQ-003nxN-0A
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 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=45aaZrp+85vX+C7hH0snjMoK9XrrpBWHZSFztUE5Q+8=; b=xDiqzKNXEMGjYEHkj/+D8nocsO
	DqlALF97nDNDNDJsmJ/oySpOTJQ49Unj2Wot5pzoVuY02EbsAHf8ExYTZUm1kJO8GnQVbppfcS0SC
	v0XRFZSBC4gGcpQyPoRz5Z+gRx2a3kceg5HL8aVmq1VECcSJReYYgR6uWF9/ZIPvTR7c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/msi: Change __msi_set_enable() to take pci_sbdf_t
Message-Id: <E1tmxWQ-003nxN-0A@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 16:11:02 +0000

commit 250d87dc3ff9ebcb77da65e2999ace6b378862d7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sun Feb 2 13:48:40 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 25 13:30:55 2025 +0000

    x86/msi: Change __msi_set_enable() to take pci_sbdf_t
    
    This removes the unnecessary work of splitting a 32-bit number across
    4 registers, and recombining later.  Bloat-o-meter reports:
    
      add/remove: 0/0 grow/shrink: 0/9 up/down: 0/-295 (-295)
      Function                                     old     new   delta
      enable_iommu                                1748    1732     -16
      iommu_msi_unmask                              98      81     -17
      iommu_msi_mask                               100      83     -17
      disable_iommu                                286     269     -17
      __msi_set_enable                              81      50     -31
      __pci_disable_msi                            178     146     -32
      pci_cleanup_msi                              268     229     -39
      pci_enable_msi                              1063    1019     -44
      pci_restore_msi_state                       1116    1034     -82
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/msi.h           |  2 +-
 xen/arch/x86/msi.c                       | 14 ++++----------
 xen/drivers/passthrough/amd/iommu_init.c |  5 +++--
 3 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 7f9e531f73..378b85ee94 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -238,7 +238,7 @@ struct arch_msix {
 void early_msi_init(void);
 void msi_compose_msg(unsigned vector, const cpumask_t *cpu_mask,
                      struct msi_msg *msg);
-void __msi_set_enable(u16 seg, u8 bus, u8 slot, u8 func, int pos, int enable);
+void __msi_set_enable(pci_sbdf_t sbdf, int pos, int enable);
 void cf_check mask_msi_irq(struct irq_desc *desc);
 void cf_check unmask_msi_irq(struct irq_desc *desc);
 void guest_mask_msi_irq(struct irq_desc *desc, bool mask);
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index c9fe942c46..bf5b71822e 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -267,28 +267,22 @@ void cf_check set_msi_affinity(struct irq_desc *desc, const cpumask_t *mask)
     write_msi_msg(msi_desc, &msg);
 }
 
-void __msi_set_enable(u16 seg, u8 bus, u8 slot, u8 func, int pos, int enable)
+void __msi_set_enable(pci_sbdf_t sbdf, int pos, int enable)
 {
-    uint16_t control = pci_conf_read16(PCI_SBDF(seg, bus, slot, func),
-                                       pos + PCI_MSI_FLAGS);
+    uint16_t control = pci_conf_read16(sbdf, pos + PCI_MSI_FLAGS);
 
     control &= ~PCI_MSI_FLAGS_ENABLE;
     if ( enable )
         control |= PCI_MSI_FLAGS_ENABLE;
-    pci_conf_write16(PCI_SBDF(seg, bus, slot, func),
-                     pos + PCI_MSI_FLAGS, control);
+    pci_conf_write16(sbdf, pos + PCI_MSI_FLAGS, control);
 }
 
 static void msi_set_enable(struct pci_dev *dev, int enable)
 {
     unsigned int pos = dev->msi_pos;
-    u16 seg = dev->seg;
-    u8 bus = dev->bus;
-    u8 slot = PCI_SLOT(dev->devfn);
-    u8 func = PCI_FUNC(dev->devfn);
 
     if ( pos )
-        __msi_set_enable(seg, bus, slot, func, pos, enable);
+        __msi_set_enable(dev->sbdf, pos, enable);
 }
 
 static void msix_set_enable(struct pci_dev *dev, int enable)
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 934adc5abe..bb25b55c85 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -409,8 +409,9 @@ static void iommu_reset_log(struct amd_iommu *iommu,
 
 static void amd_iommu_msi_enable(struct amd_iommu *iommu, int flag)
 {
-    __msi_set_enable(iommu->seg, PCI_BUS(iommu->bdf), PCI_SLOT(iommu->bdf),
-                     PCI_FUNC(iommu->bdf), iommu->msi.msi_attrib.pos, flag);
+    pci_sbdf_t sbdf = { .seg = iommu->seg, .bdf = iommu->bdf };
+
+    __msi_set_enable(sbdf, iommu->msi.msi_attrib.pos, flag);
 }
 
 static void cf_check iommu_msi_unmask(struct irq_desc *desc)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 16:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 16:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895884.1304544 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmxWb-0003oA-6l; Tue, 25 Feb 2025 16:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895884.1304544; Tue, 25 Feb 2025 16: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 1tmxWb-0003o2-44; Tue, 25 Feb 2025 16:11:13 +0000
Received: by outflank-mailman (input) for mailman id 895884;
 Tue, 25 Feb 2025 16: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 1tmxWa-0003nu-9T
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 16: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 1tmxWa-004inA-1W
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 16:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmxWa-003nzQ-0b
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 16: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=84BIL58YmRtr743JS8ONj7aeqom9hqpIG2/+Wd0gViM=; b=jhS8iZxdqgc6P9c0jj3EuK5l65
	FUOFRjfjpE7uzd4TmE7z2UBGa8mRFY/3tlQ4kSifEItwhSCwCznRd0m4ByP9SAr2f+daBR9Um4ww3
	Q+VafA7mbaliCw0c+r30j/10LdqqiFhP4docYWv53jZHBXGBq74wLaN9ey9GpAO/k76U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/console: Optimise the parameter order of vprintk_common()
Message-Id: <E1tmxWa-003nzQ-0b@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 16:11:12 +0000

commit 654bfa421f72efa9f9600063cb26ca9326cd264d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 23 03:27:07 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 25 13:30:55 2025 +0000

    xen/console: Optimise the parameter order of vprintk_common()
    
    For ABIs which pass parameters by register (all cases that we compile Xen
    for), inserting new arguments on the left hand side involves shuffling all
    other parameters along by one register whereas appending a new argument
    doesn't involve shuffling of existing registers.
    
    Reorder vprintk_common()'s prefix parameter to being last.  This is a marginal
    improvement on all architectures:
    
      Function                              old     new   delta
      vprintk                                18      12      -6  x86
      vprintk                                32      24      -8  arm32
      vprintk                                52      48      -4  arm64
      vprintk                                52      48      -4  riscv64
      vprintk                                80      72      -8  ppc64
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-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 7adf4e11fc..b6a8c71928 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -909,7 +909,7 @@ static void printk_start_of_line(const char *prefix)
     __putstr(tstr);
 }
 
-static void vprintk_common(const char *prefix, const char *fmt, va_list args)
+static void vprintk_common(const char *fmt, va_list args, const char *prefix)
 {
     struct vps {
         bool continued, do_print;
@@ -963,7 +963,7 @@ static void vprintk_common(const char *prefix, const char *fmt, va_list args)
 
 void vprintk(const char *fmt, va_list args)
 {
-    vprintk_common("(XEN) ", fmt, args);
+    vprintk_common(fmt, args, "(XEN) ");
 }
 
 void printk(const char *fmt, ...)
@@ -983,7 +983,7 @@ void guest_printk(const struct domain *d, const char *fmt, ...)
     snprintf(prefix, sizeof(prefix), "(d%d) ", d->domain_id);
 
     va_start(args, fmt);
-    vprintk_common(prefix, fmt, args);
+    vprintk_common(fmt, args, prefix);
     va_end(args);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 16:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 16:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895885.1304549 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmxWl-0003qT-83; Tue, 25 Feb 2025 16:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895885.1304549; Tue, 25 Feb 2025 16: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 1tmxWl-0003qM-5W; Tue, 25 Feb 2025 16:11:23 +0000
Received: by outflank-mailman (input) for mailman id 895885;
 Tue, 25 Feb 2025 16: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 1tmxWk-0003qC-Cp
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 16: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 1tmxWk-004inE-1v
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 16:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmxWk-003o1m-0w
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 16: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=1MaorhoD8GFTezY5WR1tgrXm3G72pR3920yfE7XBiM0=; b=S3OyBPZM3Ik/9x/7haqEk3qMvM
	on9RJJ/6MWX2aEAp5c/vcDxGPalX1fF1oUOG6Cr4/ih6PnCm6ynpsB5MwwJdwmQoLT048Ulep4H8W
	hCSPwse87glpCSHpI/8T6+AgMbUWfF1akqXZZRNXmQbWaAYO2cYCnFi5+mlFkJndQpy4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/ACPI: Drop local acpi_os_{v,}printf() and use plain {v,}printk()
Message-Id: <E1tmxWk-003o1m-0w@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 16:11:22 +0000

commit a38b4d64fc36004c522d96b01998693f249b6cb0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 17 19:13:01 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 25 13:30:55 2025 +0000

    xen/ACPI: Drop local acpi_os_{v,}printf() and use plain {v,}printk()
    
    Now that Xen has a real vprintk(), there's no need to opencode it locally with
    vsnprintf().  Redirect the debug routines to the real {v,}printk() and drop
    the local acpi_os_{v,}printf() implementations.
    
    Amongst other things, this removes one arbitrary limit on message size, as
    well as removing a 512 byte static buffer that ought to have been in
    __initdata given that is private to an __init function.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/acpi/osl.c      | 17 -----------------
 xen/include/acpi/acpiosxf.h |  5 ++---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c
index ab80d6b2a9..7f233bab42 100644
--- a/xen/drivers/acpi/osl.c
+++ b/xen/drivers/acpi/osl.c
@@ -45,23 +45,6 @@ ACPI_MODULE_NAME("osl")
 #include CONFIG_ACPI_CUSTOM_DSDT_FILE
 #endif
 
-void __init acpi_os_printf(const char *fmt, ...)
-{
-	va_list args;
-	va_start(args, fmt);
-	acpi_os_vprintf(fmt, args);
-	va_end(args);
-}
-
-void __init acpi_os_vprintf(const char *fmt, va_list args)
-{
-	static char buffer[512];
-
-	vsnprintf(buffer, sizeof(buffer), fmt, args);
-
-	printk("%s", buffer);
-}
-
 acpi_physical_address __initdata rsdp_hint;
 
 acpi_physical_address __init acpi_os_get_root_pointer(void)
diff --git a/xen/include/acpi/acpiosxf.h b/xen/include/acpi/acpiosxf.h
index de83ea38c4..2da318962f 100644
--- a/xen/include/acpi/acpiosxf.h
+++ b/xen/include/acpi/acpiosxf.h
@@ -82,8 +82,7 @@ acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width);
 /*
  * Debug print routines
  */
-void ACPI_INTERNAL_VAR_XFACE acpi_os_printf(const char *format, ...);
-
-void acpi_os_vprintf(const char *format, va_list args);
+#define acpi_os_printf printk
+#define acpi_os_vprintf vprintk
 
 #endif				/* __ACPIOSXF_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 16:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 16:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895886.1304555 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmxWv-0003tG-BA; Tue, 25 Feb 2025 16:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895886.1304555; Tue, 25 Feb 2025 16: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 1tmxWv-0003t8-7E; Tue, 25 Feb 2025 16:11:33 +0000
Received: by outflank-mailman (input) for mailman id 895886;
 Tue, 25 Feb 2025 16: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 1tmxWu-0003t0-Hv
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 16: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 1tmxWu-004inL-2R
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 16:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmxWu-003o3f-1N
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 16: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=M5H1SOyiY0SSA4z3l+y9Y2qtzt/T26bXLeZm9zpmcIk=; b=GqRAETEEaP2I4RuVVJeg6mhIUP
	BkHgnLA+3tPu9l5FwVnKscDBVpt0YiE8Q/oUpg0HzBGWgO5rVU5jWRDBBLd9X0WnYuCZ2fxaauHNK
	AzEQWDJ02o52Fty1TpsWuiaIB9ie6rMykkunJhweRztsTouPqKZ/efaI+cEzCXKE67nM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Fix oxenstored build warning
Message-Id: <E1tmxWu-003o3f-1N@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 16:11:32 +0000

commit c11772277fe5f1b0874141a24554c2e3da2d9a6e
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Fri Feb 14 15:24:27 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 25 13:30:55 2025 +0000

    tools/ocaml: Fix oxenstored build warning
    
    OCaml, in preparation for a renaming of the error string associated with
    conversion failure in 'int_of_string' functions, started to issue this
    warning:
    
      File "process.ml", line 440, characters 13-28:
      440 |   | (Failure "int_of_string")    -> reply_error "EINVAL"
                         ^^^^^^^^^^^^^^^
      Warning 52 [fragile-literal-pattern]: Code should not depend on the actual values of
      this constructor's arguments. They are only for information
      and may change in future versions. (See manual section 11.5)
    
    Deal with this at the source, and instead create our own stable
    ConversionFailure exception that's raised on the None case in
    'int_of_string_opt'.
    
    'c_int_of_string' is safe and does not raise such exceptions.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/xenstored/Makefile     |  1 +
 tools/ocaml/xenstored/perms.ml     |  2 +-
 tools/ocaml/xenstored/poll.ml      |  2 +-
 tools/ocaml/xenstored/process.ml   | 18 +++++++++---------
 tools/ocaml/xenstored/utils.ml     | 10 ++++++++--
 tools/ocaml/xenstored/xenstored.ml | 16 ++++++++--------
 6 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/tools/ocaml/xenstored/Makefile b/tools/ocaml/xenstored/Makefile
index 5e8210a906..c333394a34 100644
--- a/tools/ocaml/xenstored/Makefile
+++ b/tools/ocaml/xenstored/Makefile
@@ -54,6 +54,7 @@ OBJS = paths \
 	history \
 	parse_arg \
 	process \
+	poll \
 	xenstored
 
 INTF = symbol.cmi trie.cmi syslog.cmi systemd.cmi poll.cmi
diff --git a/tools/ocaml/xenstored/perms.ml b/tools/ocaml/xenstored/perms.ml
index 14f8e334fe..2c4ee9e617 100644
--- a/tools/ocaml/xenstored/perms.ml
+++ b/tools/ocaml/xenstored/perms.ml
@@ -70,7 +70,7 @@ struct
 
   let perm_of_string s =
     let ty = permty_of_char s.[0]
-    and id = int_of_string (String.sub s 1 (String.length s - 1)) in
+    and id = Utils.int_of_string_exn (String.sub s 1 (String.length s - 1)) in
     (id, ty)
 
   let of_strings ls =
diff --git a/tools/ocaml/xenstored/poll.ml b/tools/ocaml/xenstored/poll.ml
index fefaa6e74c..f8571e4590 100644
--- a/tools/ocaml/xenstored/poll.ml
+++ b/tools/ocaml/xenstored/poll.ml
@@ -30,7 +30,7 @@ external set_fd_limit: int -> unit = "stub_set_fd_limit"
 let get_sys_fs_nr_open () =
   try
     let ch = open_in "/proc/sys/fs/nr_open" in
-    let v = int_of_string (input_line ch) in
+    let v = Utils.int_of_string_exn (input_line ch) in
     close_in_noerr ch; v
   with _ -> 1024 * 1024
 
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 432d66321c..0c9c460a99 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -229,7 +229,7 @@ let do_debug con t _domains cons data =
       Logging.xb_op ~tid:0 ~ty:Xenbus.Xb.Op.Debug ~con:"=======>" msg;
       None
     | "quota" :: domid :: _ ->
-      let domid = int_of_string domid in
+      let domid = Utils.int_of_string_exn domid in
       let quota = (Store.get_quota t.Transaction.store) in
       Some (Quota.to_string quota domid ^ "\000")
     | "watches" :: _ ->
@@ -242,7 +242,7 @@ let do_debug con t _domains cons data =
       History.trim ();
       Some "trimmed"
     | "txn" :: domid :: _ ->
-      let domid = int_of_string domid in
+      let domid = Utils.int_of_string_exn domid in
       let con = Connections.find_domain cons domid in
       let b = Buffer.create 128 in
       let () = con.transactions |> Hashtbl.iter @@ fun id tx ->
@@ -253,7 +253,7 @@ let do_debug con t _domains cons data =
       in
       Some (Buffer.contents b)
     | "xenbus" :: domid :: _ ->
-      let domid = int_of_string domid in
+      let domid = Utils.int_of_string_exn domid in
       let con = Connections.find_domain cons domid in
       let s = Printf.sprintf "xenbus: %s; overflow queue length: %d, can_input: %b, has_more_input: %b, has_old_output: %b, has_new_output: %b, has_more_work: %b. pending: %s"
           (Xenbus.Xb.debug con.xb)
@@ -267,7 +267,7 @@ let do_debug con t _domains cons data =
       in
       Some s
     | "mfn" :: domid :: _ ->
-      let domid = int_of_string domid in
+      let domid = Utils.int_of_string_exn domid in
       let con = Connections.find_domain cons domid in
       may (fun dom -> Printf.sprintf "%nd\000" (Domain.get_mfn dom)) (Connection.get_domain con)
     | _ -> None
@@ -340,7 +340,7 @@ let do_isintroduced con _t domains _cons data =
   then raise Define.Permission_denied;
   let domid =
     match (split None '\000' data) with
-    | domid :: _ -> int_of_string domid
+    | domid :: _ -> Utils.int_of_string_exn domid
     | _          -> raise Invalid_Cmd_Args
   in
   if domid = Define.domid_self || Domains.exist domains domid then "T\000" else "F\000"
@@ -437,7 +437,7 @@ let input_handle_error ~cons ~doms ~fct ~con ~t ~req =
   | Quota.Limit_reached          -> reply_error "EQUOTA"
   | Quota.Data_too_big           -> reply_error "E2BIG"
   | Quota.Transaction_opened     -> reply_error "EQUOTA"
-  | (Failure "int_of_string")    -> reply_error "EINVAL"
+  | Utils.ConversionFailed s     -> reply_error "EINVAL"
   | Define.Unknown_operation     -> reply_error "ENOSYS"
 
 let write_access_log ~ty ~tid ~con ~data =
@@ -578,7 +578,7 @@ let do_introduce con t domains cons data =
   let (domid, mfn, remote_port) =
     match (split None '\000' data) with
     | domid :: mfn :: remote_port :: _ ->
-      int_of_string domid, Nativeint.of_string mfn, int_of_string remote_port
+      Utils.int_of_string_exn domid, Nativeint.of_string mfn, Utils.int_of_string_exn remote_port
     | _                         -> raise Invalid_Cmd_Args;
   in
   let dom =
@@ -604,7 +604,7 @@ let do_release con t domains cons data =
   then raise Define.Permission_denied;
   let domid =
     match (split None '\000' data) with
-    | [domid;""] -> int_of_string domid
+    | [domid;""] -> Utils.int_of_string_exn domid
     | _          -> raise Invalid_Cmd_Args
   in
   let fire_spec_watches = Domains.exist domains domid in
@@ -620,7 +620,7 @@ let do_resume con _t domains _cons data =
   then raise Define.Permission_denied;
   let domid =
     match (split None '\000' data) with
-    | domid :: _ -> int_of_string domid
+    | domid :: _ -> Utils.int_of_string_exn domid
     | _          -> raise Invalid_Cmd_Args
   in
   if Domains.exist domains domid
diff --git a/tools/ocaml/xenstored/utils.ml b/tools/ocaml/xenstored/utils.ml
index 48d84ef7d3..7a556bce75 100644
--- a/tools/ocaml/xenstored/utils.ml
+++ b/tools/ocaml/xenstored/utils.ml
@@ -53,8 +53,14 @@ let hexify s =
     ) s;
   Bytes.unsafe_to_string hs
 
+exception ConversionFailed of string
+let int_of_string_exn s =
+  match int_of_string_opt s with
+  | Some x -> x
+  | None -> raise (ConversionFailed s)
+
 let unhexify hs =
-  let char_of_hexseq seq0 seq1 = Char.chr (int_of_string (sprintf "0x%c%c" seq0 seq1)) in
+  let char_of_hexseq seq0 seq1 = Char.chr (int_of_string_exn (sprintf "0x%c%c" seq0 seq1)) in
   let b = Bytes.create (String.length hs / 2) in
   for i = 0 to Bytes.length b - 1
   do
@@ -86,7 +92,7 @@ let read_file_single_integer filename =
   let buf = Bytes.make 20 '\000' in
   let sz = Unix.read fd buf 0 20 in
   Unix.close fd;
-  int_of_string (Bytes.sub_string buf 0 sz)
+  int_of_string_exn (Bytes.sub_string buf 0 sz)
 
 (* @path may be guest data and needs its length validating.  @connection_path
  * is generated locally in xenstored and always of the form "/local/domain/$N/" *)
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 1aaa3e995e..84dee622ea 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -167,20 +167,20 @@ module DB = struct
                					   e.g. a RO socket from a previous version: ignore it *)
             global_f ~rw
           | "evtchn-dev" :: fd :: domexc_port :: [] ->
-            evtchn_f ~fd:(int_of_string fd)
-              ~domexc_port:(int_of_string domexc_port)
+            evtchn_f ~fd:(Utils.int_of_string_exn fd)
+              ~domexc_port:(Utils.int_of_string_exn domexc_port)
           | "socket" :: fd :: [] ->
-            socket_f ~fd:(int_of_string fd)
+            socket_f ~fd:(Utils.int_of_string_exn fd)
           | "dom" :: domid :: mfn :: remote_port :: rest ->
             let local_port = match rest with
               | [] -> None (* backward compat: old version didn't have it *)
-              | local_port :: _ -> Some (int_of_string local_port) in
+              | local_port :: _ -> Some (Utils.int_of_string_exn local_port) in
             domain_f ?local_port
-              ~remote_port:(int_of_string remote_port)
-              (int_of_string domid)
+              ~remote_port:(Utils.int_of_string_exn remote_port)
+              (Utils.int_of_string_exn domid)
               (Nativeint.of_string mfn)
           | "watch" :: domid :: path :: token :: [] ->
-            watch_f (int_of_string domid)
+            watch_f (Utils.int_of_string_exn domid)
               (unhexify path) (unhexify token)
           | "store" :: path :: perms :: value :: [] ->
             store_f (getpath path)
@@ -214,7 +214,7 @@ module DB = struct
     in
     let global_f ~rw =
       let get_listen_sock sockfd =
-        let fd = sockfd |> int_of_string |> Utils.FD.of_int in
+        let fd = sockfd |> Utils.int_of_string_exn |> Utils.FD.of_int in
         Unix.listen fd 1;
         Some fd
       in
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 16:11:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 16:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895887.1304556 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmxX5-0003vz-BR; Tue, 25 Feb 2025 16:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895887.1304556; Tue, 25 Feb 2025 16: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 1tmxX5-0003vq-8g; Tue, 25 Feb 2025 16:11:43 +0000
Received: by outflank-mailman (input) for mailman id 895887;
 Tue, 25 Feb 2025 16: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 1tmxX4-0003vf-LL
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 16: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 1tmxX4-004inP-2n
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 16:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmxX4-003o55-1r
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 16: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=EhCHj0u6OwPNn6TzvOfw7BuMeStOodG0/2GHk6igMwo=; b=A0kuCM/XNyz+qaKhCvLtT6jf6a
	FvQRmndv5cVzaF3xO69srn6Lyh7Cq/fXesqK8+aFgvE3U4LGQ+Y4NNPuhXraZsuHZBIjG0+sEMs99
	GibyFqQfpJeiHQBC0LmsOGFS0n1z6kM7obynHirx/l5lVwsCMePcuFAcm8WwZR63R1Gw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] scripts: Fix git-checkout.sh to work with non-master branches (take 2)
Message-Id: <E1tmxX4-003o55-1r@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 16:11:42 +0000

commit 01fb23dd71006d87e874f310e9c50f31582f274e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 31 13:35:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 25 13:30:55 2025 +0000

    scripts: Fix git-checkout.sh to work with non-master branches (take 2)
    
    First, rename $TAG to $COMMITTISH.  We already pass tags, branches (well, only
    master) and full SHAs into this script.
    
    Xen uses master for QEMU_UPSTREAM_REVISION, and has done for other trees too
    in the path.  Apparently we've never specified a different branch, because the
    git-clone rune only pulls in the master branch; it does not pull in diverging
    branches.
    
    Fix this by performing an explicit fetch of the $COMMITTISH, then checking out
    the dummy branch from the FETCH_HEAD.
    
    Suggested-by: Jason Andryuk <jason.andryuk@amd.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 scripts/git-checkout.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/git-checkout.sh b/scripts/git-checkout.sh
index fd4425ac4e..56a60193a7 100755
--- a/scripts/git-checkout.sh
+++ b/scripts/git-checkout.sh
@@ -1,12 +1,12 @@
 #!/bin/sh
 
 if test $# -lt 3; then
-	echo "Usage: $0 <tree> <tag> <dir>"
+	echo "Usage: $0 <tree> <committish> <dir>"
 	exit 1
 fi
 
 TREE=$1
-TAG=$2
+COMMITTISH=$2
 DIR=$3
 
 set -e
@@ -15,10 +15,11 @@ if test \! -d $DIR-remote; then
 	rm -rf $DIR-remote $DIR-remote.tmp
 	mkdir -p $DIR-remote.tmp; rmdir $DIR-remote.tmp
 	$GIT clone $TREE $DIR-remote.tmp
-	if test "$TAG" ; then
+	if test "$COMMITTISH" ; then
 		cd $DIR-remote.tmp
+		$GIT fetch origin "$COMMITTISH"
 		$GIT branch -D dummy >/dev/null 2>&1 ||:
-		$GIT checkout -b dummy $TAG
+		$GIT checkout -b dummy FETCH_HEAD
 		cd -
 	fi
 	mv $DIR-remote.tmp $DIR-remote
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 25 16:11:53 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 25 Feb 2025 16:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.895888.1304561 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tmxXF-0003z4-Dy; Tue, 25 Feb 2025 16:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 895888.1304561; Tue, 25 Feb 2025 16: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 1tmxXF-0003yw-BR; Tue, 25 Feb 2025 16:11:53 +0000
Received: by outflank-mailman (input) for mailman id 895888;
 Tue, 25 Feb 2025 16: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 1tmxXE-0003yp-Qu
 for xen-changelog@lists.xenproject.org; Tue, 25 Feb 2025 16: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 1tmxXF-004inZ-04
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 16:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tmxXE-003o6d-2D
 for xen-changelog@lists.xenproject.org;
 Tue, 25 Feb 2025 16: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=5TYbh80B79uqNoognT7GIxn8uk8hSMCa0LxjYmRnP60=; b=FMKZBAZG6ouaP6eXwyaqJ/eNO0
	qdtHH4E4NNIpSrH51BJ0QmwejFK2G7qEHcbYFQHF5obYzGHlWzALFK1QZyIkF8Z16HJdHQgOU9uWU
	eZOy8C4E8HcTJB06xwrLjZkwvCIp0pX+gTCXiVPzhaPaRewRnpnd7iO/s1GLrAOubQcE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CirrusCI: Use shallow clone
Message-Id: <E1tmxXE-003o6d-2D@xenbits.xenproject.org>
Date: Tue, 25 Feb 2025 16:11:52 +0000

commit 96970b46e5e84fa2666f76f5b0972b826a3ffba4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 24 15:36:11 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 25 13:30:55 2025 +0000

    CirrusCI: Use shallow clone
    
    This reduces the Clone step from ~50s to ~3s.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 .cirrus.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index 7216729b69..e2949d99d7 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -13,6 +13,7 @@ freebsd_template: &FREEBSD_ENV
   environment:
     APPEND_LIB: /usr/local/lib
     APPEND_INCLUDES: /usr/local/include
+    CIRRUS_CLONE_DEPTH: 1
 
 freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
   << : *FREEBSD_ENV
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 11:33:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 11:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896418.1305097 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnFey-00018W-5R; Wed, 26 Feb 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 896418.1305097; Wed, 26 Feb 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 1tnFey-00018N-2c; Wed, 26 Feb 2025 11:33:04 +0000
Received: by outflank-mailman (input) for mailman id 896418;
 Wed, 26 Feb 2025 11: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 1tnFew-00018H-UU
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnFew-006VWR-2W
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 11:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnFew-008pwm-1V
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=/WNHUKKE9caMy/mZGC5CLUoRQBJ427YJpw+if5iQiV0=; b=M4BOI1aRIX23BxlD/ZLQdbyFhy
	yCTNrZrFE8TK5JbCVAgK2ktevwumj3FP5khMHgw3vFsEbfAradMjcGbohP5Ea/cL75jOM+2M7VLgX
	QsvKwinlG3YrJ7MPSbGrOl4B4ByfwVBVlKpM47MA0h/taBnUU109ZBZWpW6fZIbpwXpk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/console: print Xen version via keyhandler
Message-Id: <E1tnFew-008pwm-1V@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 11:33:02 +0000

commit 478556f8e30a76f4b0630be8c73fe9d1ec5c282f
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Wed Feb 26 12:17:01 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 26 12:17:01 2025 +0100

    xen/console: print Xen version via keyhandler
    
    Add Xen version printout to 'h' keyhandler output.
    
    That is useful for debugging systems that have been left intact for a long
    time.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/keyhandler.c    |  4 ++++
 xen/common/version.c       | 22 ++++++++++++++++++++--
 xen/drivers/char/console.c |  8 +++-----
 xen/include/xen/lib.h      |  3 +++
 4 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 6ea54838d4..0bb842ec00 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -129,6 +129,10 @@ static void cf_check show_handlers(unsigned char key)
     unsigned int i;
 
     printk("'%c' pressed -> showing installed handlers\n", key);
+
+    print_version();
+    print_build_id();
+
     for ( i = 0; i < ARRAY_SIZE(key_table); i++ )
         if ( key_table[i].fn )
             printk(" key '%c' (ascii '%02x') => %s\n",
diff --git a/xen/common/version.c b/xen/common/version.c
index bc3714b45f..5474b8e385 100644
--- a/xen/common/version.c
+++ b/xen/common/version.c
@@ -94,6 +94,16 @@ const char *xen_build_info(void)
     return build_info;
 }
 
+void print_version(void)
+{
+    printk("Xen version %d.%d%s (%s@%s) (%s) %s %s\n",
+           xen_major_version(), xen_minor_version(), xen_extra_version(),
+           xen_compile_by(), xen_compile_domain(), xen_compiler(),
+           xen_build_info(), xen_compile_date());
+
+    printk("Latest ChangeSet: %s\n", xen_changeset());
+}
+
 static const void *build_id_p __read_mostly;
 static unsigned int build_id_len __read_mostly;
 
@@ -108,6 +118,16 @@ int xen_build_id(const void **p, unsigned int *len)
     return 0;
 }
 
+void print_build_id(void)
+{
+    /*
+     * NB: build_id_len may be 0 if XEN_HAS_BUILD_ID=n.
+     * Do not print empty build-id.
+     */
+    if ( build_id_len )
+        printk("build-id: %*phN\n", build_id_len, build_id_p);
+}
+
 #ifdef BUILD_ID
 /* Defined in linker script. */
 extern const Elf_Note __note_gnu_build_id_start[], __note_gnu_build_id_end[];
@@ -210,8 +230,6 @@ void __init xen_build_init(void)
         }
     }
 #endif /* CONFIG_X86 */
-    if ( !rc )
-        printk(XENLOG_INFO "build-id: %*phN\n", build_id_len, build_id_p);
 }
 #endif /* BUILD_ID */
 /*
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index b6a8c71928..eb09b6d5fd 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1037,14 +1037,12 @@ void __init console_init_preirq(void)
     nrspin_lock(&console_lock);
     __putstr(xen_banner());
     nrspin_unlock(&console_lock);
-    printk("Xen version %d.%d%s (%s@%s) (%s) %s %s\n",
-           xen_major_version(), xen_minor_version(), xen_extra_version(),
-           xen_compile_by(), xen_compile_domain(), xen_compiler(),
-           xen_build_info(), xen_compile_date());
-    printk("Latest ChangeSet: %s\n", xen_changeset());
+
+    print_version();
 
     /* Locate and print the buildid, if applicable. */
     xen_build_init();
+    print_build_id();
 
     if ( opt_sync_console )
     {
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 130f96791f..77122606ed 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -47,6 +47,9 @@ int parse_signed_integer(const char *name, const char *s, const char *e,
  */
 int cmdline_strcmp(const char *frag, const char *name);
 
+void print_version(void);
+void print_build_id(void);
+
 #ifdef CONFIG_DEBUG_TRACE
 extern void debugtrace_dump(void);
 extern void debugtrace_printk(const char *fmt, ...)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 11:33:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 11:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896419.1305102 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnFf8-0001AF-70; Wed, 26 Feb 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 896419.1305102; Wed, 26 Feb 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 1tnFf8-0001A7-4M; Wed, 26 Feb 2025 11:33:14 +0000
Received: by outflank-mailman (input) for mailman id 896419;
 Wed, 26 Feb 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 1tnFf6-00019t-LT
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnFf6-006VWn-2o
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 11:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnFf6-008q20-1w
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=+cLE1RmycsrxduF6jfNtNB7tDiK5KfZVdJOxuSnAgEw=; b=A7nIEeTG9J2Q3Vvyrpf4xjsT0y
	TfSVtph20eRa+/gLVCMTlaVuVH44jwy/ddMVVvGA/1O5P78iCYpPgPAyLaOeegJkah3qIkRX+y8LQ
	saaOfRa96bAVtxS48puP+tMcf4z2qiQXBCi5KDK1LZoUeFKeQjCuNxqpeR/rnsdRMtsw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] radix-tree: drop "root" parameters from radix_tree_node_{alloc,free}()
Message-Id: <E1tnFf6-008q20-1w@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 11:33:12 +0000

commit 4a00faede7f0205a466aa35c29d0eb24961a08d7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 26 12:22:22 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 26 12:22:22 2025 +0100

    radix-tree: drop "root" parameters from radix_tree_node_{alloc,free}()
    
    They aren't used anymore.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/radix-tree.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index a623a9ff66..ca610d36fc 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -60,16 +60,14 @@ static void cf_check _rcu_node_free(struct rcu_head *head)
 	xfree(rcu_node);
 }
 
-static struct radix_tree_node *radix_tree_node_alloc(
-	struct radix_tree_root *root)
+static struct radix_tree_node *radix_tree_node_alloc(void)
 {
 	struct rcu_node *rcu_node = xzalloc(struct rcu_node);
 
 	return rcu_node ? &rcu_node->node : NULL;
 }
 
-static void radix_tree_node_free(
-	struct radix_tree_root *root, struct radix_tree_node *node)
+static void radix_tree_node_free(struct radix_tree_node *node)
 {
 	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
 
@@ -105,7 +103,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index)
 
 	do {
 		unsigned int newheight;
-		if (!(node = radix_tree_node_alloc(root)))
+		if (!(node = radix_tree_node_alloc()))
 			return -ENOMEM;
 
 		/* Increase the height.  */
@@ -156,7 +154,7 @@ int radix_tree_insert(struct radix_tree_root *root,
 	while (height > 0) {
 		if (slot == NULL) {
 			/* Have to add a child node.  */
-			if (!(slot = radix_tree_node_alloc(root)))
+			if (!(slot = radix_tree_node_alloc()))
 				return -ENOMEM;
 			slot->height = height;
 			if (node) {
@@ -575,7 +573,7 @@ static inline void radix_tree_shrink(struct radix_tree_root *root)
 			*((unsigned long *)&to_free->slots[0]) |=
 						RADIX_TREE_INDIRECT_PTR;
 
-		radix_tree_node_free(root, to_free);
+		radix_tree_node_free(to_free);
 	}
 }
 
@@ -640,7 +638,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index)
 		 * last reference to it disappears (set NULL, above).
 		 */
 		if (to_free)
-			radix_tree_node_free(root, to_free);
+			radix_tree_node_free(to_free);
 
 		if (pathp->node->count) {
 			if (pathp->node == indirect_to_ptr(root->rnode))
@@ -656,7 +654,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index)
 	root->height = 0;
 	root->rnode = NULL;
 	if (to_free)
-		radix_tree_node_free(root, to_free);
+		radix_tree_node_free(to_free);
 
 out:
 	return slot;
@@ -683,7 +681,7 @@ radix_tree_node_destroy(
 		}
 	}
 
-	radix_tree_node_free(root, node);
+	radix_tree_node_free(node);
 }
 
 void radix_tree_destroy(
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 11:33:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 11:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896420.1305106 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnFfH-0001DK-8l; Wed, 26 Feb 2025 11:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896420.1305106; Wed, 26 Feb 2025 11: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 1tnFfH-0001DC-5m; Wed, 26 Feb 2025 11:33:23 +0000
Received: by outflank-mailman (input) for mailman id 896420;
 Wed, 26 Feb 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 1tnFfG-0001D6-PN
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnFfG-006VYi-3B
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 11:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnFfG-008q40-2D
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=Zxduk7wpoRf9OeD9pVNe59VDTvOYdw7BaccV44Jb1EM=; b=azf/H1d6NGW5m8wyh/1cYZP/Pq
	nxnvGdW1GaEhHdk1mxezO33oOfswlJU6pB/foFC2eUoFuAIIuMc1sI2dxDSqZQ65TBqiNYgdn8Kuy
	dbgy8YUhdUhCzJnjuyYLR9Olaks4m18N5joGIEu/DKNZnzg0PasJrJLz8DzfQpfLZNX0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/MCE: fail init more gracefully when CPU vendor isn't supported
Message-Id: <E1tnFfG-008q40-2D@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 11:33:22 +0000

commit c3e759967a8ae07a75c133e25f91cf94286197d1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 26 12:23:19 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 26 12:23:19 2025 +0100

    x86/MCE: fail init more gracefully when CPU vendor isn't supported
    
    When mcheck_init() doesn't recognize the CPU vendor, it will undo the
    all-banks allocation, and it will in particular not install the CPU
    notifier. This way APs will pointlessly try to re-establish an
    all-banks allocation, while then falling over NULL pointers due to the
    notifier not having run and hence not having allocated anything for
    them.
    
    Prevent both from happening, and additionally delay writing MCG_CTL
    until no errors can occur anymore in mca_cap_init().
    
    Fixes: 741367e77d6c ("mce: Clean-up mcheck_init handler")
    Fixes: a5e1b534ac6f ("x86: mce cleanup for both Intel and AMD mce logic")
    Fixes: 560cf418c845 ("x86/mcheck: allow varying bank counts per CPU")
    Reported-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mcheck/mce.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 9028ccde54..1c348e557d 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -634,16 +634,13 @@ static void set_poll_bankmask(struct cpuinfo_x86 *c)
 }
 
 /* The perbank ctl/status init is platform specific because of AMD's quirk */
-static int mca_cap_init(void)
+static int mca_cap_init(bool bsp)
 {
     uint64_t msr_content;
     unsigned int nr, cpu = smp_processor_id();
 
     rdmsrl(MSR_IA32_MCG_CAP, msr_content);
 
-    if ( msr_content & MCG_CTL_P ) /* Control register present ? */
-        wrmsrl(MSR_IA32_MCG_CTL, 0xffffffffffffffffULL);
-
     per_cpu(nr_mce_banks, cpu) = nr = MASK_EXTR(msr_content, MCG_CAP_COUNT);
 
     if ( !nr )
@@ -654,8 +651,11 @@ static int mca_cap_init(void)
         return -ENODEV;
     }
 
+    if ( !bsp && !mca_allbanks )
+        return -ENODATA;
+
     /* mcabanks_alloc depends on nr_mce_banks */
-    if ( !mca_allbanks || nr > mca_allbanks->num )
+    if ( bsp || nr > mca_allbanks->num )
     {
         unsigned int i;
         struct mca_banks *all = mcabanks_alloc(nr);
@@ -667,6 +667,9 @@ static int mca_cap_init(void)
         mcabanks_free(xchg(&mca_allbanks, all));
     }
 
+    if ( msr_content & MCG_CTL_P ) /* Control register present ? */
+        wrmsrl(MSR_IA32_MCG_CTL, ~0ULL);
+
     return 0;
 }
 
@@ -751,7 +754,7 @@ void mcheck_init(struct cpuinfo_x86 *c, bool bsp)
     }
 
     /*Hardware Enable */
-    if ( mca_cap_init() )
+    if ( mca_cap_init(bsp) )
         return;
 
     if ( !bsp )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 11:33:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 11:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896421.1305109 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnFfR-0001FW-9p; Wed, 26 Feb 2025 11:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896421.1305109; Wed, 26 Feb 2025 11: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 1tnFfR-0001FP-7M; Wed, 26 Feb 2025 11:33:33 +0000
Received: by outflank-mailman (input) for mailman id 896421;
 Wed, 26 Feb 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 1tnFfQ-0001FJ-Sy
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnFfR-006VZM-0L
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 11:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnFfQ-008q7n-2a
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=v3Pu8EIuesklmfCgxguJssmHK+AOG+5GoJlgshlJF9A=; b=w3aOuRbCrNPbinc3i3cd8BWDpz
	AYo6QYRyDzKCFnl2Xf4gHhCrTcUsjE7LDvYg5EGySZEOWkdsBjewSxwUW2s07X3DdXtg7rblwwULb
	IVnEzkpM4dczehpjQTwbPnct93HtfNpF1BwdSGy8uI00BkeLDM9CbQjsMhg61zyUOUYk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/MCE-telem: drop unnecessary per-CPU field
Message-Id: <E1tnFfQ-008q7n-2a@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 11:33:32 +0000

commit e365749ebad539424afa4a7de06961b8cc87335c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 26 12:23:49 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 26 12:23:49 2025 +0100

    x86/MCE-telem: drop unnecessary per-CPU field
    
    struct mc_telem_cpu_ctl's processing field is used solely in
    mctelem_process_deferred(), where the local variable can as well be used
    directly when retrieving the head of the list to process. This then also
    eliminates the field holding a dangling pointer once the processing of
    the list finished, in particular when the entry is handed to
    mctelem_dismiss().
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/mcheck/mctelem.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mctelem.c b/xen/arch/x86/cpu/mcheck/mctelem.c
index ddd4c4cb7b..94e22b6a26 100644
--- a/xen/arch/x86/cpu/mcheck/mctelem.c
+++ b/xen/arch/x86/cpu/mcheck/mctelem.c
@@ -122,7 +122,6 @@ struct mc_telem_cpu_ctl {
 	 * to guarantee the above mutual exclusivity.
 	 */
 	struct mctelem_ent *pending, *lmce_pending;
-	struct mctelem_ent *processing;
 };
 static DEFINE_PER_CPU(struct mc_telem_cpu_ctl, mctctl);
 
@@ -233,9 +232,7 @@ void mctelem_process_deferred(unsigned int cpu,
 	 * handled by another round of MCE softirq.
 	 */
 	mctelem_xchg_head(lmce ? &ctl->lmce_pending : &ctl->pending,
-			  &this_cpu(mctctl.processing), NULL);
-
-	head = this_cpu(mctctl.processing);
+			  &head, NULL);
 
 	/*
 	 * Then, fix up the list to include prev pointers, to make
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 11:33:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 11:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896422.1305114 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnFfb-0001I1-C5; Wed, 26 Feb 2025 11:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896422.1305114; Wed, 26 Feb 2025 11: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 1tnFfb-0001Ht-8q; Wed, 26 Feb 2025 11:33:43 +0000
Received: by outflank-mailman (input) for mailman id 896422;
 Wed, 26 Feb 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 1tnFfb-0001Hn-15
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 2025 11:33: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 1tnFfb-006VZS-0i
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 11:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnFfa-008q9s-2y
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=zPelwfqlKgH+Ne5nq9qUVmGMlR0gAf2WJy4rjgBnvLM=; b=ooywagG3TgAd8l3qBn0svGRRPe
	ZeE4fmkBHoR6K+Rh2LjnEpzTtaUHGTKT+DI/3u6oIZuPA1TnPm4RIiG8/S9qWSh+i0aDL2+dkQjaD
	IbSrKjIzCF5nVS+MZKXKYGELtkwbEH2V5bjhsFSyLnnBF3uxibn/CoWUFOzyoT+pMOVg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: update mfn calculation in pt_mapping_level()
Message-Id: <E1tnFfa-008q9s-2y@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 11:33:42 +0000

commit 96a86ebcf5add89f24ece8d8c9657a72f2c1ff4f
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Feb 26 12:24:26 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 26 12:24:26 2025 +0100

    xen/riscv: update mfn calculation in pt_mapping_level()
    
    When pt_update() is called with arguments (..., INVALID_MFN, ..., 0 or 1),
    it indicates that a mapping is being destroyed/modifyed.
    
    In the case when modifying or destroying a mapping, it is necessary to
    search until a leaf node is found, instead of searching for a page table
    entry based on the precalculated `level` and `order`(look at pt_update()).
    This is because when `mfn` == INVALID_MFN, the `mask` (in pt_mapping_level())
    will take into account only `vfn`, which could accidentally return an
    incorrect level, leading to the discovery of an incorrect page table entry.
    
    For example, if `vfn` is page table level 1 aligned, but it was mapped as
    page table level 0, then pt_mapping_level() will return `level` = 1, since
    only `vfn` (which is page table level 1 aligned) is taken into account when
    `mfn` == INVALID_MFN (look at pt_mapping_level()).
    
    Have unmap_table() check for NULL, such that individual callers don't need
    to.
    
    Fixes: c2f1ded524 ("xen/riscv: page table handling")
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich<jbeulich@suse.com>
---
 xen/arch/riscv/pt.c | 115 +++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 77 insertions(+), 38 deletions(-)

diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c
index 9c1f8f6b55..857619d48d 100644
--- a/xen/arch/riscv/pt.c
+++ b/xen/arch/riscv/pt.c
@@ -102,6 +102,9 @@ static pte_t *map_table(mfn_t mfn)
 
 static void unmap_table(const pte_t *table)
 {
+    if ( !table )
+        return;
+
     /*
      * During early boot, map_table() will not use map_domain_page()
      * but the PMAP.
@@ -245,14 +248,21 @@ pte_t pt_walk(vaddr_t va, unsigned int *pte_level)
     return pte;
 }
 
-/* Update an entry at the level @target. */
+/*
+ * Update an entry at the level @target.
+ *
+ * If `target` == CONFIG_PAGING_LEVELS, the search will continue until
+ * a leaf node is found.
+ * Otherwise, the page table entry will be searched at the requested
+ * `target` level.
+ * For an example of why this might be needed, see the comment in
+ * pt_update() before pt_update_entry() is called.
+ */
 static int pt_update_entry(mfn_t root, vaddr_t virt,
-                           mfn_t mfn, unsigned int target,
+                           mfn_t mfn, unsigned int *target,
                            unsigned int flags)
 {
     int rc;
-    unsigned int level = HYP_PT_ROOT_LEVEL;
-    pte_t *table;
     /*
      * The intermediate page table shouldn't be allocated when MFN isn't
      * valid and we are not populating page table.
@@ -263,43 +273,50 @@ static int pt_update_entry(mfn_t root, vaddr_t virt,
      * combinations of (mfn, flags).
     */
     bool alloc_tbl = !mfn_eq(mfn, INVALID_MFN) || (flags & PTE_POPULATE);
-    pte_t pte, *entry;
-
-    /* convenience aliases */
-    DECLARE_OFFSETS(offsets, virt);
+    pte_t pte, *ptep = NULL;
 
-    table = map_table(root);
-    for ( ; level > target; level-- )
+    if ( *target == CONFIG_PAGING_LEVELS )
+        ptep = _pt_walk(virt, target);
+    else
     {
-        rc = pt_next_level(alloc_tbl, &table, offsets[level]);
-        if ( rc == XEN_TABLE_MAP_NOMEM )
+        pte_t *table;
+        unsigned int level = HYP_PT_ROOT_LEVEL;
+        /* Convenience aliases */
+        DECLARE_OFFSETS(offsets, virt);
+
+        table = map_table(root);
+        for ( ; level > *target; level-- )
         {
-            rc = -ENOMEM;
-            goto out;
+            rc = pt_next_level(alloc_tbl, &table, offsets[level]);
+            if ( rc == XEN_TABLE_MAP_NOMEM )
+            {
+                rc = -ENOMEM;
+                goto out;
+            }
+
+            if ( rc == XEN_TABLE_MAP_NONE )
+            {
+                rc = 0;
+                goto out;
+            }
+
+            if ( rc != XEN_TABLE_NORMAL )
+                break;
         }
 
-        if ( rc == XEN_TABLE_MAP_NONE )
+        if ( level != *target )
         {
-            rc = 0;
+            dprintk(XENLOG_ERR,
+                    "%s: Shattering superpage is not supported\n", __func__);
+            rc = -EOPNOTSUPP;
             goto out;
         }
 
-        if ( rc != XEN_TABLE_NORMAL )
-            break;
-    }
-
-    if ( level != target )
-    {
-        dprintk(XENLOG_ERR,
-                "%s: Shattering superpage is not supported\n", __func__);
-        rc = -EOPNOTSUPP;
-        goto out;
+        ptep = table + offsets[level];
     }
 
-    entry = table + offsets[level];
-
     rc = -EINVAL;
-    if ( !pt_check_entry(*entry, mfn, flags) )
+    if ( !pt_check_entry(*ptep, mfn, flags) )
         goto out;
 
     /* We are removing the page */
@@ -316,7 +333,7 @@ static int pt_update_entry(mfn_t root, vaddr_t virt,
             pte = pte_from_mfn(mfn, PTE_VALID);
         else /* We are updating the permission => Copy the current pte. */
         {
-            pte = *entry;
+            pte = *ptep;
             pte.pte &= ~PTE_ACCESS_MASK;
         }
 
@@ -324,12 +341,12 @@ static int pt_update_entry(mfn_t root, vaddr_t virt,
         pte.pte |= (flags & PTE_ACCESS_MASK) | PTE_ACCESSED | PTE_DIRTY;
     }
 
-    write_pte(entry, pte);
+    write_pte(ptep, pte);
 
     rc = 0;
 
  out:
-    unmap_table(table);
+    unmap_table(ptep);
 
     return rc;
 }
@@ -422,17 +439,39 @@ static int pt_update(vaddr_t virt, mfn_t mfn,
 
     while ( left )
     {
-        unsigned int order, level;
-
-        level = pt_mapping_level(vfn, mfn, left, flags);
-        order = XEN_PT_LEVEL_ORDER(level);
+        unsigned int order, level = CONFIG_PAGING_LEVELS;
 
-        ASSERT(left >= BIT(order, UL));
+        /*
+         * In the case when modifying or destroying a mapping, it is necessary
+         * to search until a leaf node is found, instead of searching for
+         * a page table entry based on the precalculated `level` and `order`
+         * (look at pt_update()).
+         * This is because when `mfn` == INVALID_MFN, the `mask`(in
+         * pt_mapping_level()) will take into account only `vfn`, which could
+         * accidentally return an incorrect level, leading to the discovery of
+         * an incorrect page table entry.
+         *
+         * For example, if `vfn` is page table level 1 aligned, but it was
+         * mapped as page table level 0, then pt_mapping_level() will return
+         * `level` = 1, since only `vfn` (which is page table level 1 aligned)
+         * is taken into account when `mfn` == INVALID_MFN
+         * (look at pt_mapping_level()).
+         *
+         * To force searching until a leaf node is found is necessary to have
+         * `level` == CONFIG_PAGING_LEVELS.
+         *
+         * For other cases (when a mapping is not being modified or destroyed),
+         * pt_mapping_level() should be used.
+         */
+        if ( !mfn_eq(mfn, INVALID_MFN) || (flags & PTE_POPULATE) )
+            level = pt_mapping_level(vfn, mfn, left, flags);
 
-        rc = pt_update_entry(root, vfn << PAGE_SHIFT, mfn, level, flags);
+        rc = pt_update_entry(root, vfn << PAGE_SHIFT, mfn, &level, flags);
         if ( rc )
             break;
 
+        order = XEN_PT_LEVEL_ORDER(level);
+
         vfn += 1UL << order;
         if ( !mfn_eq(mfn, INVALID_MFN) )
             mfn = mfn_add(mfn, 1UL << order);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 11:33:54 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 11:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896423.1305118 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnFfm-0001LF-FF; Wed, 26 Feb 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 896423.1305118; Wed, 26 Feb 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 1tnFfm-0001L7-CX; Wed, 26 Feb 2025 11:33:54 +0000
Received: by outflank-mailman (input) for mailman id 896423;
 Wed, 26 Feb 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 1tnFfl-0001Ku-3o
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnFfl-006VZX-12
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 11:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnFfl-008qBk-08
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=itjPF7h5W/l/fF3BZu6wiz1efCRpvNmKOD/Hc89rSug=; b=4NDu+iu+67GdANVt66URhh68yt
	zbwARjFsP19XErbDQds8ecLpqItjXiOfTpnrNTk9Lz1ob19lMOaJtkzAhmmaifU68OTS9kPEEVn3J
	lodrFUM/dmTXALtGYzlCXLp4hK9c5VRwws1Pp9oDSeRrxuRPCSikSbXJUpO8WfPu854M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/DM: slightly simplify set_mem_type()
Message-Id: <E1tnFfl-008qBk-08@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 11:33:53 +0000

commit fd110cd4e167817d5dcb13a728108d0de9fd8558
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 26 12:26:23 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 26 12:26:23 2025 +0100

    x86/DM: slightly simplify set_mem_type()
    
    There's no need to access the static array twice per iteration, even
    more so when that's effectively open-coding array_access_nospec().
    Along with renaming the "new type" variable, rename the "old type" one
    as well, to clarify which one is which.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/dm.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index 462691f91d..a1f7a4d30a 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -219,7 +219,8 @@ static int set_mem_type(struct domain *d,
                         struct xen_dm_op_set_mem_type *data)
 {
     xen_pfn_t last_pfn = data->first_pfn + data->nr - 1;
-    unsigned int iter = 0, mem_type;
+    unsigned int iter = 0;
+    p2m_type_t nt;
     int rc = 0;
 
     /* Interface types to internal p2m types */
@@ -239,16 +240,16 @@ static int set_mem_type(struct domain *d,
          unlikely(data->mem_type == HVMMEM_unused) )
         return -EINVAL;
 
-    mem_type = array_index_nospec(data->mem_type, ARRAY_SIZE(memtype));
+    nt = array_access_nospec(memtype, data->mem_type);
 
-    if ( mem_type == HVMMEM_ioreq_server )
+    if ( nt == p2m_ioreq_server )
     {
         unsigned int flags;
 
         if ( !hap_enabled(d) )
             return -EOPNOTSUPP;
 
-        /* Do not change to HVMMEM_ioreq_server if no ioreq server mapped. */
+        /* Do not change to p2m_ioreq_server if no ioreq server mapped. */
         if ( !p2m_get_ioreq_server(d, &flags) )
             return -EINVAL;
     }
@@ -256,22 +257,22 @@ static int set_mem_type(struct domain *d,
     while ( iter < data->nr )
     {
         unsigned long pfn = data->first_pfn + iter;
-        p2m_type_t t;
+        p2m_type_t ot;
 
-        get_gfn_unshare(d, pfn, &t);
-        if ( p2m_is_paging(t) )
+        get_gfn_unshare(d, pfn, &ot);
+        if ( p2m_is_paging(ot) )
         {
             put_gfn(d, pfn);
             p2m_mem_paging_populate(d, _gfn(pfn));
             return -EAGAIN;
         }
 
-        if ( p2m_is_shared(t) )
+        if ( p2m_is_shared(ot) )
             rc = -EAGAIN;
-        else if ( !allow_p2m_type_change(t, memtype[mem_type]) )
+        else if ( !allow_p2m_type_change(ot, nt) )
             rc = -EINVAL;
         else
-            rc = p2m_change_type_one(d, pfn, t, memtype[mem_type]);
+            rc = p2m_change_type_one(d, pfn, ot, nt);
 
         put_gfn(d, pfn);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 12:11:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 12:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896476.1305182 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnGFj-0002kf-CV; Wed, 26 Feb 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 896476.1305182; Wed, 26 Feb 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 1tnGFj-0002kX-9j; Wed, 26 Feb 2025 12:11:03 +0000
Received: by outflank-mailman (input) for mailman id 896476;
 Wed, 26 Feb 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 1tnGFi-0002kL-L1
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnGFi-006WJz-1q
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnGFi-0092eW-0g
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12: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=zZcLcHvv/neVcGL+uP/tihlHQInHbAV9KpBY/Ja8wuI=; b=2lZhH2BUb2bLPy6fqeF4EdH/bm
	1l9g8PewQE8tpn6NpCsdczSqzSO/DeUp2l5WhS/meXkJszTlpZ/+lG2DSxO/s0t0eQFGoARLS3BcQ
	ZEAQS8sq2/tKFLXpUYqoaI9FGRgQ/s7M+pWD5Q/fsdztz9oejPVePDCKq2/7LDMaRPUg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ucode: Rename hypercall-context functions
Message-Id: <E1tnGFi-0092eW-0g@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 12:11:02 +0000

commit 8e9d1173c3237f8ef2800dadb99af5f57d762bb6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 23 19:38:59 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 26 11:58:55 2025 +0000

    x86/ucode: Rename hypercall-context functions
    
    microcode_update{,_helper}() are overly generic names in a file that has
    multiple update routines and helper functions contexts.
    
    Rename microcode_update() to ucode_update_hcall() so it explicitly identifies
    itself as hypercall context, and rename microcode_update_helper() to
    ucode_update_hcall_cont() to make it clear it is in continuation context.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/cpu/microcode/core.c    | 10 +++++-----
 xen/arch/x86/include/asm/microcode.h |  4 ++--
 xen/arch/x86/platform_hypercall.c    |  6 +++---
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index de00c22b4b..9fe86942a3 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -467,7 +467,7 @@ struct ucode_buf {
     char buffer[];
 };
 
-static long cf_check microcode_update_helper(void *data)
+static long cf_check ucode_update_hcall_cont(void *data)
 {
     struct microcode_patch *patch = NULL;
     int ret, result;
@@ -611,8 +611,8 @@ static long cf_check microcode_update_helper(void *data)
     return ret;
 }
 
-int microcode_update(XEN_GUEST_HANDLE(const_void) buf,
-                     unsigned long len, unsigned int flags)
+int ucode_update_hcall(XEN_GUEST_HANDLE(const_void) buf,
+                       unsigned long len, unsigned int flags)
 {
     int ret;
     struct ucode_buf *buffer;
@@ -637,11 +637,11 @@ int microcode_update(XEN_GUEST_HANDLE(const_void) buf,
     buffer->flags = flags;
 
     /*
-     * Always queue microcode_update_helper() on CPU0.  Most of the logic
+     * Always queue ucode_update_hcall_cont() on CPU0.  Most of the logic
      * won't care, but the update of the Raw CPU policy wants to (re)run on
      * the BSP.
      */
-    return continue_hypercall_on_cpu(0, microcode_update_helper, buffer);
+    return continue_hypercall_on_cpu(0, ucode_update_hcall_cont, buffer);
 }
 
 /* Load a cached update to current cpu */
diff --git a/xen/arch/x86/include/asm/microcode.h b/xen/arch/x86/include/asm/microcode.h
index c62c131fd0..7f7ebb3d2a 100644
--- a/xen/arch/x86/include/asm/microcode.h
+++ b/xen/arch/x86/include/asm/microcode.h
@@ -22,8 +22,8 @@ struct cpu_signature {
 DECLARE_PER_CPU(struct cpu_signature, cpu_sig);
 
 void microcode_set_module(unsigned int idx);
-int microcode_update(XEN_GUEST_HANDLE(const_void) buf,
-                     unsigned long len, unsigned int flags);
+int ucode_update_hcall(XEN_GUEST_HANDLE(const_void) buf,
+                       unsigned long len, unsigned int flags);
 int microcode_update_one(void);
 
 struct boot_info;
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index 67f851237d..90abd3197f 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -313,7 +313,7 @@ ret_t do_platform_op(
 
         guest_from_compat_handle(data, op->u.microcode.data);
 
-        ret = microcode_update(data, op->u.microcode.length, 0);
+        ret = ucode_update_hcall(data, op->u.microcode.length, 0);
         break;
     }
 
@@ -323,8 +323,8 @@ ret_t do_platform_op(
 
         guest_from_compat_handle(data, op->u.microcode2.data);
 
-        ret = microcode_update(data, op->u.microcode2.length,
-                               op->u.microcode2.flags);
+        ret = ucode_update_hcall(data, op->u.microcode2.length,
+                                 op->u.microcode2.flags);
         break;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 12:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 12:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896477.1305187 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnGFt-00030q-EK; Wed, 26 Feb 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 896477.1305187; Wed, 26 Feb 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 1tnGFt-00030f-B9; Wed, 26 Feb 2025 12:11:13 +0000
Received: by outflank-mailman (input) for mailman id 896477;
 Wed, 26 Feb 2025 12: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 1tnGFs-0002yJ-Fv
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 2025 12: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 1tnGFs-006WKK-2D
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnGFs-0092iy-1I
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12: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=rTghhTwIvEOYYuNZeHBYGypu+x+3Z8eAgc/Ch2HaoIQ=; b=u6HaJRAzBD2uw6xfKb5rGdAvNV
	rcZmynzWcvNg3hzJttu4bVCrytYdVfp76Wbme1OL6/mL46N86jizF+GY8sv5l+MKi+/dYMtYa1Pg8
	lLu3u6+SbEST41vMzKro14Ye8gM7u6dwsfRu6QFAATsiB8PbKIB9da9lSOMOP+4s6E7M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ucode: Drop the match_reg[] field from AMD's microcode_patch
Message-Id: <E1tnGFs-0092iy-1I@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 12:11:12 +0000

commit 7463a5b63926db1dbbbae5829919d250c1b0f52c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 24 13:47:20 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 26 11:58:55 2025 +0000

    x86/ucode: Drop the match_reg[] field from AMD's microcode_patch
    
    This was true in the K10 days, but even back then the match registers were
    really payload data rather than header data.
    
    But, it's really model specific data, and these days typically part of the
    signature, so is random data for all intents and purposes.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 210736f580..9ee455b007 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -48,7 +48,6 @@ struct microcode_patch {
     uint8_t  sb_rev_id;
     uint8_t  bios_api_rev;
     uint8_t  reserved1[3];
-    uint32_t match_reg[8];
 };
 
 #define UCODE_MAGIC                0x00414d44
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 12:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 12:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896481.1305190 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnGG3-0003a1-FC; Wed, 26 Feb 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 896481.1305190; Wed, 26 Feb 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 1tnGG3-0003Zt-CW; Wed, 26 Feb 2025 12:11:23 +0000
Received: by outflank-mailman (input) for mailman id 896481;
 Wed, 26 Feb 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 1tnGG2-0003XA-JH
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 2025 12: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 1tnGG2-006WKR-2Z
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnGG2-0092lT-1d
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12: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=Sy+7WHu+eN/1PPOqROXYZZ/UVgCTDiSiDSMKGSYMO/0=; b=AJHPTf4nNcLPYr39dQFMvjmdDf
	1GDH8ZJyPFbb9Cwdn+9G/vW6ILRUULv12j6IYYciuzztbfnB4q8+0NV5Elg/4OQDpCNOspIBVU9GF
	T10PvoJUMx77UDG3LESNpBmNrz4T0w4lSVnwDRujsnOQFXmEudv6SBeYJ3VPLv5jWBgw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Move cpuid_hypervisor_leaves() into cpuid.c
Message-Id: <E1tnGG2-0092lT-1d@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 12:11:22 +0000

commit f4a1c59f37914883a873e9eeb1b1f80f18812771
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 31 10:56:00 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 26 12:00:23 2025 +0000

    x86/traps: Move cpuid_hypervisor_leaves() into cpuid.c
    
    It's out of place in traps.c, and only has a single caller.  Make it static
    inside cpuid.c.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpuid.c                 | 136 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/processor.h |   2 -
 xen/arch/x86/traps.c                 | 136 -----------------------------------
 3 files changed, 136 insertions(+), 138 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 2a777436ee..8dc68945f7 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -1,6 +1,8 @@
 #include <xen/sched.h>
 #include <xen/types.h>
+#include <xen/version.h>
 
+#include <public/arch-x86/cpuid.h>
 #include <public/hvm/params.h>
 
 #include <asm/cpu-policy.h>
@@ -32,6 +34,140 @@ bool recheck_cpu_features(unsigned int cpu)
     return okay;
 }
 
+static void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
+                                    uint32_t subleaf, struct cpuid_leaf *res)
+{
+    const struct domain *d = v->domain;
+    const struct cpu_policy *p = d->arch.cpu_policy;
+    uint32_t base = is_viridian_domain(d) ? 0x40000100 : 0x40000000;
+    uint32_t idx  = leaf - base;
+    unsigned int limit = is_viridian_domain(d) ? p->hv2_limit : p->hv_limit;
+
+    if ( limit == 0 )
+        /* Default number of leaves */
+        limit = XEN_CPUID_MAX_NUM_LEAVES;
+    else
+        /* Clamp toolstack value between 2 and MAX_NUM_LEAVES. */
+        limit = min(max(limit, 2u), XEN_CPUID_MAX_NUM_LEAVES + 0u);
+
+    if ( idx > limit )
+        return;
+
+    switch ( idx )
+    {
+    case 0:
+        res->a = base + limit; /* Largest leaf */
+        res->b = XEN_CPUID_SIGNATURE_EBX;
+        res->c = XEN_CPUID_SIGNATURE_ECX;
+        res->d = XEN_CPUID_SIGNATURE_EDX;
+        break;
+
+    case 1:
+        res->a = (xen_major_version() << 16) | xen_minor_version();
+        break;
+
+    case 2:
+        res->a = 1;            /* Number of hypercall-transfer pages */
+                               /* MSR base address */
+        res->b = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
+        if ( is_pv_domain(d) ) /* Features */
+            res->c |= XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD;
+        break;
+
+    case 3: /* Time leaf. */
+        switch ( subleaf )
+        {
+        case 0: /* features */
+            res->a = ((d->arch.vtsc << 0) |
+                      (!!host_tsc_is_safe() << 1) |
+                      (!!boot_cpu_has(X86_FEATURE_RDTSCP) << 2));
+            res->b = d->arch.tsc_mode;
+            res->c = d->arch.tsc_khz;
+            res->d = d->arch.incarnation;
+            break;
+
+        case 1: /* scale and offset */
+        {
+            uint64_t offset;
+
+            if ( !d->arch.vtsc )
+                offset = d->arch.vtsc_offset;
+            else
+                /* offset already applied to value returned by virtual rdtscp */
+                offset = 0;
+            res->a = offset;
+            res->b = offset >> 32;
+            res->c = d->arch.vtsc_to_ns.mul_frac;
+            res->d = d->arch.vtsc_to_ns.shift;
+            break;
+        }
+
+        case 2: /* physical cpu_khz */
+            res->a = cpu_khz;
+            break;
+        }
+        break;
+
+    case 4: /* HVM hypervisor leaf. */
+        if ( !is_hvm_domain(d) || subleaf != 0 )
+            break;
+
+        if ( cpu_has_vmx_apic_reg_virt )
+            res->a |= XEN_HVM_CPUID_APIC_ACCESS_VIRT;
+
+        /*
+         * We want to claim that x2APIC is virtualized if APIC MSR accesses
+         * are not intercepted. When all three of these are true both rdmsr
+         * and wrmsr in the guest will run without VMEXITs (see
+         * vmx_vlapic_msr_changed()).
+         */
+        if ( cpu_has_vmx_virtualize_x2apic_mode &&
+             cpu_has_vmx_apic_reg_virt &&
+             cpu_has_vmx_virtual_intr_delivery )
+            res->a |= XEN_HVM_CPUID_X2APIC_VIRT;
+
+        /*
+         * 1) Xen 4.10 and older was broken WRT grant maps requesting a DMA
+         * mapping, and forgot to honour the guest's request.
+         * 2) 4.11 (and presumably backports) fixed the bug, so the map
+         * hypercall actually did what the guest asked.
+         * 3) To work around the bug, guests must bounce buffer all DMA that
+         * would otherwise use a grant map, because it doesn't know whether the
+         * DMA is originating from an emulated or a real device.
+         * 4) This flag tells guests it is safe not to bounce-buffer all DMA to
+         * work around the bug.
+         */
+        res->a |= XEN_HVM_CPUID_IOMMU_MAPPINGS;
+
+        /* Indicate presence of vcpu id and set it in ebx */
+        res->a |= XEN_HVM_CPUID_VCPU_ID_PRESENT;
+        res->b = v->vcpu_id;
+
+        /* Indicate presence of domain id and set it in ecx */
+        res->a |= XEN_HVM_CPUID_DOMID_PRESENT;
+        res->c = d->domain_id;
+
+        /*
+         * Per-vCPU event channel upcalls are implemented and work
+         * correctly with PIRQs routed over event channels.
+         */
+        res->a |= XEN_HVM_CPUID_UPCALL_VECTOR;
+
+        break;
+
+    case 5: /* PV-specific parameters */
+        if ( is_hvm_domain(d) || subleaf != 0 )
+            break;
+
+        res->b = flsl(get_upper_mfn_bound()) + PAGE_SHIFT;
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+        break;
+    }
+}
+
 void guest_cpuid(const struct vcpu *v, uint32_t leaf,
                  uint32_t subleaf, struct cpuid_leaf *res)
 {
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index d247ef8dd2..4f176bc575 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -472,8 +472,6 @@ struct stubs {
 DECLARE_PER_CPU(struct stubs, stubs);
 unsigned long alloc_stub_page(unsigned int cpu, unsigned long *mfn);
 
-void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
-                             uint32_t subleaf, struct cpuid_leaf *res);
 int guest_rdmsr_xen(const struct vcpu *v, uint32_t idx, uint64_t *val);
 int guest_wrmsr_xen(struct vcpu *v, uint32_t idx, uint64_t val);
 
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index dca11a613d..91af814bad 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -34,7 +34,6 @@
 #include <xen/domain_page.h>
 #include <xen/symbols.h>
 #include <xen/iocap.h>
-#include <xen/version.h>
 #include <xen/kexec.h>
 #include <xen/trace.h>
 #include <xen/paging.h>
@@ -65,7 +64,6 @@
 #include <asm/mc146818rtc.h>
 #include <asm/hpet.h>
 #include <asm/vpmu.h>
-#include <public/arch-x86/cpuid.h>
 #include <public/hvm/params.h>
 #include <asm/cpuid.h>
 #include <xsm/xsm.h>
@@ -1053,140 +1051,6 @@ int guest_wrmsr_xen(struct vcpu *v, uint32_t idx, uint64_t val)
     }
 }
 
-void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
-                             uint32_t subleaf, struct cpuid_leaf *res)
-{
-    const struct domain *d = v->domain;
-    const struct cpu_policy *p = d->arch.cpu_policy;
-    uint32_t base = is_viridian_domain(d) ? 0x40000100 : 0x40000000;
-    uint32_t idx  = leaf - base;
-    unsigned int limit = is_viridian_domain(d) ? p->hv2_limit : p->hv_limit;
-
-    if ( limit == 0 )
-        /* Default number of leaves */
-        limit = XEN_CPUID_MAX_NUM_LEAVES;
-    else
-        /* Clamp toolstack value between 2 and MAX_NUM_LEAVES. */
-        limit = min(max(limit, 2u), XEN_CPUID_MAX_NUM_LEAVES + 0u);
-
-    if ( idx > limit )
-        return;
-
-    switch ( idx )
-    {
-    case 0:
-        res->a = base + limit; /* Largest leaf */
-        res->b = XEN_CPUID_SIGNATURE_EBX;
-        res->c = XEN_CPUID_SIGNATURE_ECX;
-        res->d = XEN_CPUID_SIGNATURE_EDX;
-        break;
-
-    case 1:
-        res->a = (xen_major_version() << 16) | xen_minor_version();
-        break;
-
-    case 2:
-        res->a = 1;            /* Number of hypercall-transfer pages */
-                               /* MSR base address */
-        res->b = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
-        if ( is_pv_domain(d) ) /* Features */
-            res->c |= XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD;
-        break;
-
-    case 3: /* Time leaf. */
-        switch ( subleaf )
-        {
-        case 0: /* features */
-            res->a = ((d->arch.vtsc << 0) |
-                      (!!host_tsc_is_safe() << 1) |
-                      (!!boot_cpu_has(X86_FEATURE_RDTSCP) << 2));
-            res->b = d->arch.tsc_mode;
-            res->c = d->arch.tsc_khz;
-            res->d = d->arch.incarnation;
-            break;
-
-        case 1: /* scale and offset */
-        {
-            uint64_t offset;
-
-            if ( !d->arch.vtsc )
-                offset = d->arch.vtsc_offset;
-            else
-                /* offset already applied to value returned by virtual rdtscp */
-                offset = 0;
-            res->a = offset;
-            res->b = offset >> 32;
-            res->c = d->arch.vtsc_to_ns.mul_frac;
-            res->d = d->arch.vtsc_to_ns.shift;
-            break;
-        }
-
-        case 2: /* physical cpu_khz */
-            res->a = cpu_khz;
-            break;
-        }
-        break;
-
-    case 4: /* HVM hypervisor leaf. */
-        if ( !is_hvm_domain(d) || subleaf != 0 )
-            break;
-
-        if ( cpu_has_vmx_apic_reg_virt )
-            res->a |= XEN_HVM_CPUID_APIC_ACCESS_VIRT;
-
-        /*
-         * We want to claim that x2APIC is virtualized if APIC MSR accesses
-         * are not intercepted. When all three of these are true both rdmsr
-         * and wrmsr in the guest will run without VMEXITs (see
-         * vmx_vlapic_msr_changed()).
-         */
-        if ( cpu_has_vmx_virtualize_x2apic_mode &&
-             cpu_has_vmx_apic_reg_virt &&
-             cpu_has_vmx_virtual_intr_delivery )
-            res->a |= XEN_HVM_CPUID_X2APIC_VIRT;
-
-        /*
-         * 1) Xen 4.10 and older was broken WRT grant maps requesting a DMA
-         * mapping, and forgot to honour the guest's request.
-         * 2) 4.11 (and presumably backports) fixed the bug, so the map
-         * hypercall actually did what the guest asked.
-         * 3) To work around the bug, guests must bounce buffer all DMA that
-         * would otherwise use a grant map, because it doesn't know whether the
-         * DMA is originating from an emulated or a real device.
-         * 4) This flag tells guests it is safe not to bounce-buffer all DMA to
-         * work around the bug.
-         */
-        res->a |= XEN_HVM_CPUID_IOMMU_MAPPINGS;
-
-        /* Indicate presence of vcpu id and set it in ebx */
-        res->a |= XEN_HVM_CPUID_VCPU_ID_PRESENT;
-        res->b = v->vcpu_id;
-
-        /* Indicate presence of domain id and set it in ecx */
-        res->a |= XEN_HVM_CPUID_DOMID_PRESENT;
-        res->c = d->domain_id;
-
-        /*
-         * Per-vCPU event channel upcalls are implemented and work
-         * correctly with PIRQs routed over event channels.
-         */
-        res->a |= XEN_HVM_CPUID_UPCALL_VECTOR;
-
-        break;
-
-    case 5: /* PV-specific parameters */
-        if ( is_hvm_domain(d) || subleaf != 0 )
-            break;
-
-        res->b = flsl(get_upper_mfn_bound()) + PAGE_SHIFT;
-        break;
-
-    default:
-        ASSERT_UNREACHABLE();
-        break;
-    }
-}
-
 void asmlinkage do_invalid_op(struct cpu_user_regs *regs)
 {
     u8 bug_insn[2];
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 12:11:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 12:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896485.1305194 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnGGD-00046x-HP; Wed, 26 Feb 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 896485.1305194; Wed, 26 Feb 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 1tnGGD-00046p-E4; Wed, 26 Feb 2025 12:11:33 +0000
Received: by outflank-mailman (input) for mailman id 896485;
 Wed, 26 Feb 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 1tnGGC-00045U-Mj
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnGGC-006WKY-2w
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnGGC-0092nZ-20
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=MXG9oDvD+uUB8ZZScH3qGorJUMd5fC3L9ZIddFnQC7A=; b=AevDpODKKOGTEbc2+O5AdWjQpI
	dvpTCH21iLIUqkFuVaKbRuqhbeJS27+iR6PVSC1D8LsyWrQ2hKQn1EjlvHbQVzVPzI9ZTK3q2kMiC
	LTxax+ZEPBiPaoOroacWCBJK/5ubdksl942zFvDnj9ZrovJFLQHNClW4ntQ8O48ncMXA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Move guest_{rd,wr}msr_xen() into msr.c
Message-Id: <E1tnGGC-0092nZ-20@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 12:11:32 +0000

commit 07cb3105688391639321a5b4499c58dadf6b685f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 31 11:02:49 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 26 12:00:23 2025 +0000

    x86/traps: Move guest_{rd,wr}msr_xen() into msr.c
    
    They are out of place in traps.c, and only have a single caller each.  Make
    them static inside msr.c.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/processor.h |  3 --
 xen/arch/x86/msr.c                   | 73 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c                 | 73 ------------------------------------
 3 files changed, 73 insertions(+), 76 deletions(-)

diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index 4f176bc575..6bc88b0317 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -472,9 +472,6 @@ struct stubs {
 DECLARE_PER_CPU(struct stubs, stubs);
 unsigned long alloc_stub_page(unsigned int cpu, unsigned long *mfn);
 
-int guest_rdmsr_xen(const struct vcpu *v, uint32_t idx, uint64_t *val);
-int guest_wrmsr_xen(struct vcpu *v, uint32_t idx, uint64_t val);
-
 static inline uint8_t get_cpu_family(uint32_t raw, uint8_t *model,
                                      uint8_t *stepping)
 {
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 289cf10b78..1550fd9ec9 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -18,6 +18,7 @@
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/viridian.h>
 #include <asm/msr.h>
+#include <asm/p2m.h>
 #include <asm/pv/domain.h>
 #include <asm/setup.h>
 #include <asm/xstate.h>
@@ -40,6 +41,78 @@ int init_vcpu_msr_policy(struct vcpu *v)
     return 0;
 }
 
+static int guest_rdmsr_xen(const struct vcpu *v, uint32_t idx, uint64_t *val)
+{
+    const struct domain *d = v->domain;
+    /* Optionally shift out of the way of Viridian architectural MSRs. */
+    uint32_t base = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
+
+    switch ( idx - base )
+    {
+    case 0: /* Write hypercall page MSR.  Read as zero. */
+        *val = 0;
+        return X86EMUL_OKAY;
+    }
+
+    return X86EMUL_EXCEPTION;
+}
+
+static int guest_wrmsr_xen(struct vcpu *v, uint32_t idx, uint64_t val)
+{
+    struct domain *d = v->domain;
+    /* Optionally shift out of the way of Viridian architectural MSRs. */
+    uint32_t base = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
+
+    switch ( idx - base )
+    {
+    case 0: /* Write hypercall page */
+    {
+        void *hypercall_page;
+        unsigned long gmfn = val >> PAGE_SHIFT;
+        unsigned int page_index = val & (PAGE_SIZE - 1);
+        struct page_info *page;
+        p2m_type_t t;
+
+        if ( page_index > 0 )
+        {
+            gdprintk(XENLOG_WARNING,
+                     "wrmsr hypercall page index %#x unsupported\n",
+                     page_index);
+            return X86EMUL_EXCEPTION;
+        }
+
+        page = get_page_from_gfn(d, gmfn, &t, P2M_ALLOC);
+
+        if ( !page || !get_page_type(page, PGT_writable_page) )
+        {
+            if ( page )
+                put_page(page);
+
+            if ( p2m_is_paging(t) )
+            {
+                p2m_mem_paging_populate(d, _gfn(gmfn));
+                return X86EMUL_RETRY;
+            }
+
+            gdprintk(XENLOG_WARNING,
+                     "Bad GMFN %lx (MFN %#"PRI_mfn") to MSR %08x\n",
+                     gmfn, mfn_x(page ? page_to_mfn(page) : INVALID_MFN), base);
+            return X86EMUL_EXCEPTION;
+        }
+
+        hypercall_page = __map_domain_page(page);
+        init_hypercall_page(d, hypercall_page);
+        unmap_domain_page(hypercall_page);
+
+        put_page_and_type(page);
+        return X86EMUL_OKAY;
+    }
+
+    default:
+        return X86EMUL_EXCEPTION;
+    }
+}
+
 int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 {
     const struct vcpu *curr = current;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 91af814bad..be2bc59f03 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -64,7 +64,6 @@
 #include <asm/mc146818rtc.h>
 #include <asm/hpet.h>
 #include <asm/vpmu.h>
-#include <public/hvm/params.h>
 #include <asm/cpuid.h>
 #include <xsm/xsm.h>
 #include <asm/irq-vectors.h>
@@ -979,78 +978,6 @@ void asmlinkage do_trap(struct cpu_user_regs *regs)
     fatal_trap(regs, false);
 }
 
-int guest_rdmsr_xen(const struct vcpu *v, uint32_t idx, uint64_t *val)
-{
-    const struct domain *d = v->domain;
-    /* Optionally shift out of the way of Viridian architectural MSRs. */
-    uint32_t base = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
-
-    switch ( idx - base )
-    {
-    case 0: /* Write hypercall page MSR.  Read as zero. */
-        *val = 0;
-        return X86EMUL_OKAY;
-    }
-
-    return X86EMUL_EXCEPTION;
-}
-
-int guest_wrmsr_xen(struct vcpu *v, uint32_t idx, uint64_t val)
-{
-    struct domain *d = v->domain;
-    /* Optionally shift out of the way of Viridian architectural MSRs. */
-    uint32_t base = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
-
-    switch ( idx - base )
-    {
-    case 0: /* Write hypercall page */
-    {
-        void *hypercall_page;
-        unsigned long gmfn = val >> PAGE_SHIFT;
-        unsigned int page_index = val & (PAGE_SIZE - 1);
-        struct page_info *page;
-        p2m_type_t t;
-
-        if ( page_index > 0 )
-        {
-            gdprintk(XENLOG_WARNING,
-                     "wrmsr hypercall page index %#x unsupported\n",
-                     page_index);
-            return X86EMUL_EXCEPTION;
-        }
-
-        page = get_page_from_gfn(d, gmfn, &t, P2M_ALLOC);
-
-        if ( !page || !get_page_type(page, PGT_writable_page) )
-        {
-            if ( page )
-                put_page(page);
-
-            if ( p2m_is_paging(t) )
-            {
-                p2m_mem_paging_populate(d, _gfn(gmfn));
-                return X86EMUL_RETRY;
-            }
-
-            gdprintk(XENLOG_WARNING,
-                     "Bad GMFN %lx (MFN %#"PRI_mfn") to MSR %08x\n",
-                     gmfn, mfn_x(page ? page_to_mfn(page) : INVALID_MFN), base);
-            return X86EMUL_EXCEPTION;
-        }
-
-        hypercall_page = __map_domain_page(page);
-        init_hypercall_page(d, hypercall_page);
-        unmap_domain_page(hypercall_page);
-
-        put_page_and_type(page);
-        return X86EMUL_OKAY;
-    }
-
-    default:
-        return X86EMUL_EXCEPTION;
-    }
-}
-
 void asmlinkage do_invalid_op(struct cpu_user_regs *regs)
 {
     u8 bug_insn[2];
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 12:11:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 12:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896487.1305198 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnGGN-0004Ff-Jk; Wed, 26 Feb 2025 12:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896487.1305198; Wed, 26 Feb 2025 12: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 1tnGGN-0004FY-Gv; Wed, 26 Feb 2025 12:11:43 +0000
Received: by outflank-mailman (input) for mailman id 896487;
 Wed, 26 Feb 2025 12: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 1tnGGM-0004FO-QF
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 2025 12: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 1tnGGN-006WKc-03
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnGGM-0092t8-2M
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12: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=HIdsh0ZIwm0MT5eFTkQbshYTJ6ZnQVH1Hawy4aRI/gA=; b=gLPwRUIKqqpNZTrq1AaeEmvyig
	rAceanOMxIWgMPox5iKd6hOAmOfdcaFIkfmI6ClgmeBOSlFkd2lsIKyRh+OrvJg3lZHbzKGExVQ7l
	JgrAf0UPx0mraN/9j5CJxiQsz774UPAZZXjPWptgFGB9iZ2BPXHUhGrAcG1LmmEGnH9U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] PPC: Activate UBSAN in testing
Message-Id: <E1tnGGM-0092t8-2M@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 12:11:42 +0000

commit 7cf163879c5add0a4f7f9c987b61f04f8f7051b1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 25 21:27:33 2025 -0600
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 26 12:00:23 2025 +0000

    PPC: Activate UBSAN in testing
    
    Also enable -fno-sanitize=alignment like x86 since support for unaligned
    accesses is guaranteed by the ISA and the existing OPAL setup code
    relies on it.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 automation/gitlab-ci/build.yaml      | 3 +++
 xen/arch/ppc/Kconfig                 | 1 +
 xen/arch/ppc/arch.mk                 | 6 ++++++
 xen/arch/ppc/include/asm/processor.h | 2 ++
 xen/arch/ppc/stubs.c                 | 2 +-
 5 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 35e224366f..6a2e491534 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -352,6 +352,9 @@ debian-12-ppc64le-gcc-debug:
     CONTAINER: debian:12-ppc64le
     KBUILD_DEFCONFIG: ppc64_defconfig
     HYPERVISOR_ONLY: y
+    EXTRA_XEN_CONFIG: |
+      CONFIG_UBSAN=y
+      CONFIG_UBSAN_FATAL=y
 
 debian-12-riscv64-gcc-debug:
   extends: .gcc-riscv64-cross-build-debug
diff --git a/xen/arch/ppc/Kconfig b/xen/arch/ppc/Kconfig
index 6db575a48d..917f5d53a6 100644
--- a/xen/arch/ppc/Kconfig
+++ b/xen/arch/ppc/Kconfig
@@ -2,6 +2,7 @@ config PPC
 	def_bool y
 	select FUNCTION_ALIGNMENT_4B
 	select HAS_DEVICE_TREE
+	select HAS_UBSAN
 	select HAS_VMAP
 
 config PPC64
diff --git a/xen/arch/ppc/arch.mk b/xen/arch/ppc/arch.mk
index 917ad0e6a8..c2ca419242 100644
--- a/xen/arch/ppc/arch.mk
+++ b/xen/arch/ppc/arch.mk
@@ -7,3 +7,9 @@ CFLAGS += -m64 -mlittle-endian -mcpu=$(ppc-march-y)
 CFLAGS += -mstrict-align -mcmodel=medium -mabi=elfv2 -fPIC -mno-altivec -mno-vsx -msoft-float
 
 LDFLAGS += -m elf64lppc
+
+ifeq ($(CONFIG_UBSAN),y)
+# Don't enable alignment sanitisation since Power ISA guarantees hardware
+# support for unaligned accesses.
+$(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
+endif
diff --git a/xen/arch/ppc/include/asm/processor.h b/xen/arch/ppc/include/asm/processor.h
index a01b62b8a4..50161cc32d 100644
--- a/xen/arch/ppc/include/asm/processor.h
+++ b/xen/arch/ppc/include/asm/processor.h
@@ -219,6 +219,8 @@ static inline void noreturn die(void)
  */
 #define cpu_relax() asm volatile ( "or %r1, %r1, %r1; or %r2, %r2, %r2" )
 
+#define dump_execution_state() run_in_exception_handler(show_execution_state)
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_PPC_PROCESSOR_H */
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
index fff82f5cf3..671e71aa0a 100644
--- a/xen/arch/ppc/stubs.c
+++ b/xen/arch/ppc/stubs.c
@@ -47,7 +47,7 @@ void send_timer_event(struct vcpu *v)
 
 void show_execution_state(const struct cpu_user_regs *regs)
 {
-    BUG_ON("unimplemented");
+    printk("TODO: Implement show_execution_state(regs)\n");
 }
 
 void arch_hypercall_tasklet_result(struct vcpu *v, long res)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 12:22:05 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 12:22:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896488.1305202 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnGQN-0005xA-Ad; Wed, 26 Feb 2025 12:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896488.1305202; Wed, 26 Feb 2025 12: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 1tnGQN-0005x2-7y; Wed, 26 Feb 2025 12:22:03 +0000
Received: by outflank-mailman (input) for mailman id 896488;
 Wed, 26 Feb 2025 12: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 1tnGQM-0005vU-0t
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 2025 12: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 1tnGQM-006WXO-0U
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnGQL-0095im-2l
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12: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=mshM47zqPrKJDInjiVCVyLm7sjh4E3rb8BysXmb/24g=; b=g96tbaOIa3FCba6SkP/03ju3Qp
	fMO6vi5016K6jQGBRAPh7MoeeOJK/RiC5YwyZxYlTMLJyfef29fL9cEFBQAKHis6VvCBZIE3njWxe
	tUKfluxzbPokxTl1gL/+xyNB38UnlXQrFN8vbQYiUZaatIkju/wafNoIVkms1q++V0T0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/console: print Xen version via keyhandler
Message-Id: <E1tnGQL-0095im-2l@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 12:22:01 +0000

commit 478556f8e30a76f4b0630be8c73fe9d1ec5c282f
Author:     Denis Mukhin <dmukhin@ford.com>
AuthorDate: Wed Feb 26 12:17:01 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 26 12:17:01 2025 +0100

    xen/console: print Xen version via keyhandler
    
    Add Xen version printout to 'h' keyhandler output.
    
    That is useful for debugging systems that have been left intact for a long
    time.
    
    Signed-off-by: Denis Mukhin <dmukhin@ford.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/keyhandler.c    |  4 ++++
 xen/common/version.c       | 22 ++++++++++++++++++++--
 xen/drivers/char/console.c |  8 +++-----
 xen/include/xen/lib.h      |  3 +++
 4 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 6ea54838d4..0bb842ec00 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -129,6 +129,10 @@ static void cf_check show_handlers(unsigned char key)
     unsigned int i;
 
     printk("'%c' pressed -> showing installed handlers\n", key);
+
+    print_version();
+    print_build_id();
+
     for ( i = 0; i < ARRAY_SIZE(key_table); i++ )
         if ( key_table[i].fn )
             printk(" key '%c' (ascii '%02x') => %s\n",
diff --git a/xen/common/version.c b/xen/common/version.c
index bc3714b45f..5474b8e385 100644
--- a/xen/common/version.c
+++ b/xen/common/version.c
@@ -94,6 +94,16 @@ const char *xen_build_info(void)
     return build_info;
 }
 
+void print_version(void)
+{
+    printk("Xen version %d.%d%s (%s@%s) (%s) %s %s\n",
+           xen_major_version(), xen_minor_version(), xen_extra_version(),
+           xen_compile_by(), xen_compile_domain(), xen_compiler(),
+           xen_build_info(), xen_compile_date());
+
+    printk("Latest ChangeSet: %s\n", xen_changeset());
+}
+
 static const void *build_id_p __read_mostly;
 static unsigned int build_id_len __read_mostly;
 
@@ -108,6 +118,16 @@ int xen_build_id(const void **p, unsigned int *len)
     return 0;
 }
 
+void print_build_id(void)
+{
+    /*
+     * NB: build_id_len may be 0 if XEN_HAS_BUILD_ID=n.
+     * Do not print empty build-id.
+     */
+    if ( build_id_len )
+        printk("build-id: %*phN\n", build_id_len, build_id_p);
+}
+
 #ifdef BUILD_ID
 /* Defined in linker script. */
 extern const Elf_Note __note_gnu_build_id_start[], __note_gnu_build_id_end[];
@@ -210,8 +230,6 @@ void __init xen_build_init(void)
         }
     }
 #endif /* CONFIG_X86 */
-    if ( !rc )
-        printk(XENLOG_INFO "build-id: %*phN\n", build_id_len, build_id_p);
 }
 #endif /* BUILD_ID */
 /*
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index b6a8c71928..eb09b6d5fd 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1037,14 +1037,12 @@ void __init console_init_preirq(void)
     nrspin_lock(&console_lock);
     __putstr(xen_banner());
     nrspin_unlock(&console_lock);
-    printk("Xen version %d.%d%s (%s@%s) (%s) %s %s\n",
-           xen_major_version(), xen_minor_version(), xen_extra_version(),
-           xen_compile_by(), xen_compile_domain(), xen_compiler(),
-           xen_build_info(), xen_compile_date());
-    printk("Latest ChangeSet: %s\n", xen_changeset());
+
+    print_version();
 
     /* Locate and print the buildid, if applicable. */
     xen_build_init();
+    print_build_id();
 
     if ( opt_sync_console )
     {
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 130f96791f..77122606ed 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -47,6 +47,9 @@ int parse_signed_integer(const char *name, const char *s, const char *e,
  */
 int cmdline_strcmp(const char *frag, const char *name);
 
+void print_version(void);
+void print_build_id(void);
+
 #ifdef CONFIG_DEBUG_TRACE
 extern void debugtrace_dump(void);
 extern void debugtrace_printk(const char *fmt, ...)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 12:22:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 12:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896489.1305205 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnGQX-00062C-By; Wed, 26 Feb 2025 12:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896489.1305205; Wed, 26 Feb 2025 12: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 1tnGQX-000625-9L; Wed, 26 Feb 2025 12:22:13 +0000
Received: by outflank-mailman (input) for mailman id 896489;
 Wed, 26 Feb 2025 12: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 1tnGQW-00061w-27
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 2025 12: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 1tnGQW-006WXl-0r
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnGQV-0095kp-38
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12: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=Hvi6YJgLTBoMYSny3o1dn8EoU5y8A3WgjEA00pVmT9I=; b=ZcQeJoujcUYGeWTecFwYzc0/Xh
	ULk590qzNqh4Eq31ZteqNlXc31yNiP9EKxfwkF+82LgSgMoJi6/WJKsPf6jGVMJ96fXFuAzr9YpKn
	FT6O0hW+ssW1b3dC9DhcwrYEROu7mHdi6mo03pAzi9EOefSOonXcQK+C5DKCDUG9l7T8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] radix-tree: drop "root" parameters from radix_tree_node_{alloc,free}()
Message-Id: <E1tnGQV-0095kp-38@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 12:22:11 +0000

commit 4a00faede7f0205a466aa35c29d0eb24961a08d7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 26 12:22:22 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 26 12:22:22 2025 +0100

    radix-tree: drop "root" parameters from radix_tree_node_{alloc,free}()
    
    They aren't used anymore.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/radix-tree.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/xen/common/radix-tree.c b/xen/common/radix-tree.c
index a623a9ff66..ca610d36fc 100644
--- a/xen/common/radix-tree.c
+++ b/xen/common/radix-tree.c
@@ -60,16 +60,14 @@ static void cf_check _rcu_node_free(struct rcu_head *head)
 	xfree(rcu_node);
 }
 
-static struct radix_tree_node *radix_tree_node_alloc(
-	struct radix_tree_root *root)
+static struct radix_tree_node *radix_tree_node_alloc(void)
 {
 	struct rcu_node *rcu_node = xzalloc(struct rcu_node);
 
 	return rcu_node ? &rcu_node->node : NULL;
 }
 
-static void radix_tree_node_free(
-	struct radix_tree_root *root, struct radix_tree_node *node)
+static void radix_tree_node_free(struct radix_tree_node *node)
 {
 	struct rcu_node *rcu_node = container_of(node, struct rcu_node, node);
 
@@ -105,7 +103,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index)
 
 	do {
 		unsigned int newheight;
-		if (!(node = radix_tree_node_alloc(root)))
+		if (!(node = radix_tree_node_alloc()))
 			return -ENOMEM;
 
 		/* Increase the height.  */
@@ -156,7 +154,7 @@ int radix_tree_insert(struct radix_tree_root *root,
 	while (height > 0) {
 		if (slot == NULL) {
 			/* Have to add a child node.  */
-			if (!(slot = radix_tree_node_alloc(root)))
+			if (!(slot = radix_tree_node_alloc()))
 				return -ENOMEM;
 			slot->height = height;
 			if (node) {
@@ -575,7 +573,7 @@ static inline void radix_tree_shrink(struct radix_tree_root *root)
 			*((unsigned long *)&to_free->slots[0]) |=
 						RADIX_TREE_INDIRECT_PTR;
 
-		radix_tree_node_free(root, to_free);
+		radix_tree_node_free(to_free);
 	}
 }
 
@@ -640,7 +638,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index)
 		 * last reference to it disappears (set NULL, above).
 		 */
 		if (to_free)
-			radix_tree_node_free(root, to_free);
+			radix_tree_node_free(to_free);
 
 		if (pathp->node->count) {
 			if (pathp->node == indirect_to_ptr(root->rnode))
@@ -656,7 +654,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index)
 	root->height = 0;
 	root->rnode = NULL;
 	if (to_free)
-		radix_tree_node_free(root, to_free);
+		radix_tree_node_free(to_free);
 
 out:
 	return slot;
@@ -683,7 +681,7 @@ radix_tree_node_destroy(
 		}
 	}
 
-	radix_tree_node_free(root, node);
+	radix_tree_node_free(node);
 }
 
 void radix_tree_destroy(
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 12:22:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 12:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896490.1305210 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnGQh-00064y-DT; Wed, 26 Feb 2025 12:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896490.1305210; Wed, 26 Feb 2025 12: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 1tnGQh-00064q-An; Wed, 26 Feb 2025 12:22:23 +0000
Received: by outflank-mailman (input) for mailman id 896490;
 Wed, 26 Feb 2025 12: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 1tnGQg-00064c-5N
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 2025 12: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 1tnGQg-006WXv-1C
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnGQg-0095mi-0H
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12: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=J0utdhtlenPX+dWDUMB00UtLIFde+fkd2x898HaH3Kw=; b=hkE5iYS4p6Y2yn6zLL1XXCZEQE
	41gzCGm0Yeu3Ubm6gCUM7ZW0R5UYOuLwF/BFgdylfmCHpnJmnYoIyB53rQXqM4e0dsYuDmxC83iGO
	xy0HfRdkX9V0qjMxxq7mZGckOo7yKKzwT9cKoWtnYSKWm2Im0UEW/oezmTOmrZFhQopY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/MCE: fail init more gracefully when CPU vendor isn't supported
Message-Id: <E1tnGQg-0095mi-0H@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 12:22:22 +0000

commit c3e759967a8ae07a75c133e25f91cf94286197d1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 26 12:23:19 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 26 12:23:19 2025 +0100

    x86/MCE: fail init more gracefully when CPU vendor isn't supported
    
    When mcheck_init() doesn't recognize the CPU vendor, it will undo the
    all-banks allocation, and it will in particular not install the CPU
    notifier. This way APs will pointlessly try to re-establish an
    all-banks allocation, while then falling over NULL pointers due to the
    notifier not having run and hence not having allocated anything for
    them.
    
    Prevent both from happening, and additionally delay writing MCG_CTL
    until no errors can occur anymore in mca_cap_init().
    
    Fixes: 741367e77d6c ("mce: Clean-up mcheck_init handler")
    Fixes: a5e1b534ac6f ("x86: mce cleanup for both Intel and AMD mce logic")
    Fixes: 560cf418c845 ("x86/mcheck: allow varying bank counts per CPU")
    Reported-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mcheck/mce.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 9028ccde54..1c348e557d 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -634,16 +634,13 @@ static void set_poll_bankmask(struct cpuinfo_x86 *c)
 }
 
 /* The perbank ctl/status init is platform specific because of AMD's quirk */
-static int mca_cap_init(void)
+static int mca_cap_init(bool bsp)
 {
     uint64_t msr_content;
     unsigned int nr, cpu = smp_processor_id();
 
     rdmsrl(MSR_IA32_MCG_CAP, msr_content);
 
-    if ( msr_content & MCG_CTL_P ) /* Control register present ? */
-        wrmsrl(MSR_IA32_MCG_CTL, 0xffffffffffffffffULL);
-
     per_cpu(nr_mce_banks, cpu) = nr = MASK_EXTR(msr_content, MCG_CAP_COUNT);
 
     if ( !nr )
@@ -654,8 +651,11 @@ static int mca_cap_init(void)
         return -ENODEV;
     }
 
+    if ( !bsp && !mca_allbanks )
+        return -ENODATA;
+
     /* mcabanks_alloc depends on nr_mce_banks */
-    if ( !mca_allbanks || nr > mca_allbanks->num )
+    if ( bsp || nr > mca_allbanks->num )
     {
         unsigned int i;
         struct mca_banks *all = mcabanks_alloc(nr);
@@ -667,6 +667,9 @@ static int mca_cap_init(void)
         mcabanks_free(xchg(&mca_allbanks, all));
     }
 
+    if ( msr_content & MCG_CTL_P ) /* Control register present ? */
+        wrmsrl(MSR_IA32_MCG_CTL, ~0ULL);
+
     return 0;
 }
 
@@ -751,7 +754,7 @@ void mcheck_init(struct cpuinfo_x86 *c, bool bsp)
     }
 
     /*Hardware Enable */
-    if ( mca_cap_init() )
+    if ( mca_cap_init(bsp) )
         return;
 
     if ( !bsp )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 12:22:33 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 12:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896491.1305213 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnGQr-00067U-Ep; Wed, 26 Feb 2025 12:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896491.1305213; Wed, 26 Feb 2025 12: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 1tnGQr-00067M-CD; Wed, 26 Feb 2025 12:22:33 +0000
Received: by outflank-mailman (input) for mailman id 896491;
 Wed, 26 Feb 2025 12: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 1tnGQq-00067B-8M
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 2025 12: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 1tnGQq-006WY4-1V
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnGQq-0095of-0b
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12: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=TUxCZYr99L6lC/0zCrFoBEkqEaSEPG9fVIB3eO99fIg=; b=RrGWLVhS4ZsHGVMj3JzzBsWJp6
	dyw+XnkAm7rEgt2c5/XUgZitqVdKYNOniSmMh9/OWESXhzSq9ZZnJW7A+dsKM/kQujsi98PS7bz64
	DL5MaszaG7wCs55f2DWixyR5aDJhCKtdMS3efkyUYvRp8Zu5yKzIEsaXLU80xBaMxoS0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/MCE-telem: drop unnecessary per-CPU field
Message-Id: <E1tnGQq-0095of-0b@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 12:22:32 +0000

commit e365749ebad539424afa4a7de06961b8cc87335c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 26 12:23:49 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 26 12:23:49 2025 +0100

    x86/MCE-telem: drop unnecessary per-CPU field
    
    struct mc_telem_cpu_ctl's processing field is used solely in
    mctelem_process_deferred(), where the local variable can as well be used
    directly when retrieving the head of the list to process. This then also
    eliminates the field holding a dangling pointer once the processing of
    the list finished, in particular when the entry is handed to
    mctelem_dismiss().
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/mcheck/mctelem.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mctelem.c b/xen/arch/x86/cpu/mcheck/mctelem.c
index ddd4c4cb7b..94e22b6a26 100644
--- a/xen/arch/x86/cpu/mcheck/mctelem.c
+++ b/xen/arch/x86/cpu/mcheck/mctelem.c
@@ -122,7 +122,6 @@ struct mc_telem_cpu_ctl {
 	 * to guarantee the above mutual exclusivity.
 	 */
 	struct mctelem_ent *pending, *lmce_pending;
-	struct mctelem_ent *processing;
 };
 static DEFINE_PER_CPU(struct mc_telem_cpu_ctl, mctctl);
 
@@ -233,9 +232,7 @@ void mctelem_process_deferred(unsigned int cpu,
 	 * handled by another round of MCE softirq.
 	 */
 	mctelem_xchg_head(lmce ? &ctl->lmce_pending : &ctl->pending,
-			  &this_cpu(mctctl.processing), NULL);
-
-	head = this_cpu(mctctl.processing);
+			  &head, NULL);
 
 	/*
 	 * Then, fix up the list to include prev pointers, to make
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 12:22:43 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 12:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896492.1305218 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnGR1-00069x-GG; Wed, 26 Feb 2025 12:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896492.1305218; Wed, 26 Feb 2025 12: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 1tnGR1-00069p-Df; Wed, 26 Feb 2025 12:22:43 +0000
Received: by outflank-mailman (input) for mailman id 896492;
 Wed, 26 Feb 2025 12: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 1tnGR0-00069f-BM
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 2025 12: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 1tnGR0-006WYE-1n
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnGR0-0095sU-0u
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 12: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=H4sLhxKhiZsWeGnDsX5huWblO1Bbwf6+RUUj0a8b/kQ=; b=2Hfqf99IT8DzwftnO9QdaYmk7Q
	vy/VK9y1U84I0yBazzntnbmx4RLnC7ZUQtx7HCkYFV3664EUPQLa8VHunniHLw/esBvEGrs8/S24b
	6UB+6QaUnSdZOmLlMsNMGulVyEHlp/W0WCwp51etnpYXUlitLIG+pwa8dAPhhG2wkovM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: update mfn calculation in pt_mapping_level()
Message-Id: <E1tnGR0-0095sU-0u@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 12:22:42 +0000

commit 96a86ebcf5add89f24ece8d8c9657a72f2c1ff4f
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Feb 26 12:24:26 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 26 12:24:26 2025 +0100

    xen/riscv: update mfn calculation in pt_mapping_level()
    
    When pt_update() is called with arguments (..., INVALID_MFN, ..., 0 or 1),
    it indicates that a mapping is being destroyed/modifyed.
    
    In the case when modifying or destroying a mapping, it is necessary to
    search until a leaf node is found, instead of searching for a page table
    entry based on the precalculated `level` and `order`(look at pt_update()).
    This is because when `mfn` == INVALID_MFN, the `mask` (in pt_mapping_level())
    will take into account only `vfn`, which could accidentally return an
    incorrect level, leading to the discovery of an incorrect page table entry.
    
    For example, if `vfn` is page table level 1 aligned, but it was mapped as
    page table level 0, then pt_mapping_level() will return `level` = 1, since
    only `vfn` (which is page table level 1 aligned) is taken into account when
    `mfn` == INVALID_MFN (look at pt_mapping_level()).
    
    Have unmap_table() check for NULL, such that individual callers don't need
    to.
    
    Fixes: c2f1ded524 ("xen/riscv: page table handling")
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich<jbeulich@suse.com>
---
 xen/arch/riscv/pt.c | 115 +++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 77 insertions(+), 38 deletions(-)

diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c
index 9c1f8f6b55..857619d48d 100644
--- a/xen/arch/riscv/pt.c
+++ b/xen/arch/riscv/pt.c
@@ -102,6 +102,9 @@ static pte_t *map_table(mfn_t mfn)
 
 static void unmap_table(const pte_t *table)
 {
+    if ( !table )
+        return;
+
     /*
      * During early boot, map_table() will not use map_domain_page()
      * but the PMAP.
@@ -245,14 +248,21 @@ pte_t pt_walk(vaddr_t va, unsigned int *pte_level)
     return pte;
 }
 
-/* Update an entry at the level @target. */
+/*
+ * Update an entry at the level @target.
+ *
+ * If `target` == CONFIG_PAGING_LEVELS, the search will continue until
+ * a leaf node is found.
+ * Otherwise, the page table entry will be searched at the requested
+ * `target` level.
+ * For an example of why this might be needed, see the comment in
+ * pt_update() before pt_update_entry() is called.
+ */
 static int pt_update_entry(mfn_t root, vaddr_t virt,
-                           mfn_t mfn, unsigned int target,
+                           mfn_t mfn, unsigned int *target,
                            unsigned int flags)
 {
     int rc;
-    unsigned int level = HYP_PT_ROOT_LEVEL;
-    pte_t *table;
     /*
      * The intermediate page table shouldn't be allocated when MFN isn't
      * valid and we are not populating page table.
@@ -263,43 +273,50 @@ static int pt_update_entry(mfn_t root, vaddr_t virt,
      * combinations of (mfn, flags).
     */
     bool alloc_tbl = !mfn_eq(mfn, INVALID_MFN) || (flags & PTE_POPULATE);
-    pte_t pte, *entry;
-
-    /* convenience aliases */
-    DECLARE_OFFSETS(offsets, virt);
+    pte_t pte, *ptep = NULL;
 
-    table = map_table(root);
-    for ( ; level > target; level-- )
+    if ( *target == CONFIG_PAGING_LEVELS )
+        ptep = _pt_walk(virt, target);
+    else
     {
-        rc = pt_next_level(alloc_tbl, &table, offsets[level]);
-        if ( rc == XEN_TABLE_MAP_NOMEM )
+        pte_t *table;
+        unsigned int level = HYP_PT_ROOT_LEVEL;
+        /* Convenience aliases */
+        DECLARE_OFFSETS(offsets, virt);
+
+        table = map_table(root);
+        for ( ; level > *target; level-- )
         {
-            rc = -ENOMEM;
-            goto out;
+            rc = pt_next_level(alloc_tbl, &table, offsets[level]);
+            if ( rc == XEN_TABLE_MAP_NOMEM )
+            {
+                rc = -ENOMEM;
+                goto out;
+            }
+
+            if ( rc == XEN_TABLE_MAP_NONE )
+            {
+                rc = 0;
+                goto out;
+            }
+
+            if ( rc != XEN_TABLE_NORMAL )
+                break;
         }
 
-        if ( rc == XEN_TABLE_MAP_NONE )
+        if ( level != *target )
         {
-            rc = 0;
+            dprintk(XENLOG_ERR,
+                    "%s: Shattering superpage is not supported\n", __func__);
+            rc = -EOPNOTSUPP;
             goto out;
         }
 
-        if ( rc != XEN_TABLE_NORMAL )
-            break;
-    }
-
-    if ( level != target )
-    {
-        dprintk(XENLOG_ERR,
-                "%s: Shattering superpage is not supported\n", __func__);
-        rc = -EOPNOTSUPP;
-        goto out;
+        ptep = table + offsets[level];
     }
 
-    entry = table + offsets[level];
-
     rc = -EINVAL;
-    if ( !pt_check_entry(*entry, mfn, flags) )
+    if ( !pt_check_entry(*ptep, mfn, flags) )
         goto out;
 
     /* We are removing the page */
@@ -316,7 +333,7 @@ static int pt_update_entry(mfn_t root, vaddr_t virt,
             pte = pte_from_mfn(mfn, PTE_VALID);
         else /* We are updating the permission => Copy the current pte. */
         {
-            pte = *entry;
+            pte = *ptep;
             pte.pte &= ~PTE_ACCESS_MASK;
         }
 
@@ -324,12 +341,12 @@ static int pt_update_entry(mfn_t root, vaddr_t virt,
         pte.pte |= (flags & PTE_ACCESS_MASK) | PTE_ACCESSED | PTE_DIRTY;
     }
 
-    write_pte(entry, pte);
+    write_pte(ptep, pte);
 
     rc = 0;
 
  out:
-    unmap_table(table);
+    unmap_table(ptep);
 
     return rc;
 }
@@ -422,17 +439,39 @@ static int pt_update(vaddr_t virt, mfn_t mfn,
 
     while ( left )
     {
-        unsigned int order, level;
-
-        level = pt_mapping_level(vfn, mfn, left, flags);
-        order = XEN_PT_LEVEL_ORDER(level);
+        unsigned int order, level = CONFIG_PAGING_LEVELS;
 
-        ASSERT(left >= BIT(order, UL));
+        /*
+         * In the case when modifying or destroying a mapping, it is necessary
+         * to search until a leaf node is found, instead of searching for
+         * a page table entry based on the precalculated `level` and `order`
+         * (look at pt_update()).
+         * This is because when `mfn` == INVALID_MFN, the `mask`(in
+         * pt_mapping_level()) will take into account only `vfn`, which could
+         * accidentally return an incorrect level, leading to the discovery of
+         * an incorrect page table entry.
+         *
+         * For example, if `vfn` is page table level 1 aligned, but it was
+         * mapped as page table level 0, then pt_mapping_level() will return
+         * `level` = 1, since only `vfn` (which is page table level 1 aligned)
+         * is taken into account when `mfn` == INVALID_MFN
+         * (look at pt_mapping_level()).
+         *
+         * To force searching until a leaf node is found is necessary to have
+         * `level` == CONFIG_PAGING_LEVELS.
+         *
+         * For other cases (when a mapping is not being modified or destroyed),
+         * pt_mapping_level() should be used.
+         */
+        if ( !mfn_eq(mfn, INVALID_MFN) || (flags & PTE_POPULATE) )
+            level = pt_mapping_level(vfn, mfn, left, flags);
 
-        rc = pt_update_entry(root, vfn << PAGE_SHIFT, mfn, level, flags);
+        rc = pt_update_entry(root, vfn << PAGE_SHIFT, mfn, &level, flags);
         if ( rc )
             break;
 
+        order = XEN_PT_LEVEL_ORDER(level);
+
         vfn += 1UL << order;
         if ( !mfn_eq(mfn, INVALID_MFN) )
             mfn = mfn_add(mfn, 1UL << order);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 13:00:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 13:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896553.1305293 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnH19-0005b2-Ny; Wed, 26 Feb 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 896553.1305293; Wed, 26 Feb 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 1tnH19-0005ag-Kj; Wed, 26 Feb 2025 13:00:03 +0000
Received: by outflank-mailman (input) for mailman id 896553;
 Wed, 26 Feb 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 1tnH18-0005KV-J3
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnH18-006XZj-1T
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 13:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnH18-009GAh-0a
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 13: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=5X3ThsxwILCn1o7AfkI0XEN6Vdm6hkPxobXdYdXUvkw=; b=HUi15gVpwDChVyjL/0cZQC6DUL
	Yr+Ttvwxji1ChUl9RkbPE9sun7CdrqrZBUkKCJqVcB9mWvKdCTwLTvvny+vf/MA5WdDqGx3bgiZGb
	r5uFdhY8QNFW6wcvfMJPcAvgJp+tgOSfnnCmUkaFRTfSxUwcNQH4dukbw6d671tt8aeI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/DM: slightly simplify set_mem_type()
Message-Id: <E1tnH18-009GAh-0a@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 13:00:02 +0000

commit fd110cd4e167817d5dcb13a728108d0de9fd8558
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 26 12:26:23 2025 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 26 12:26:23 2025 +0100

    x86/DM: slightly simplify set_mem_type()
    
    There's no need to access the static array twice per iteration, even
    more so when that's effectively open-coding array_access_nospec().
    Along with renaming the "new type" variable, rename the "old type" one
    as well, to clarify which one is which.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/dm.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index 462691f91d..a1f7a4d30a 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -219,7 +219,8 @@ static int set_mem_type(struct domain *d,
                         struct xen_dm_op_set_mem_type *data)
 {
     xen_pfn_t last_pfn = data->first_pfn + data->nr - 1;
-    unsigned int iter = 0, mem_type;
+    unsigned int iter = 0;
+    p2m_type_t nt;
     int rc = 0;
 
     /* Interface types to internal p2m types */
@@ -239,16 +240,16 @@ static int set_mem_type(struct domain *d,
          unlikely(data->mem_type == HVMMEM_unused) )
         return -EINVAL;
 
-    mem_type = array_index_nospec(data->mem_type, ARRAY_SIZE(memtype));
+    nt = array_access_nospec(memtype, data->mem_type);
 
-    if ( mem_type == HVMMEM_ioreq_server )
+    if ( nt == p2m_ioreq_server )
     {
         unsigned int flags;
 
         if ( !hap_enabled(d) )
             return -EOPNOTSUPP;
 
-        /* Do not change to HVMMEM_ioreq_server if no ioreq server mapped. */
+        /* Do not change to p2m_ioreq_server if no ioreq server mapped. */
         if ( !p2m_get_ioreq_server(d, &flags) )
             return -EINVAL;
     }
@@ -256,22 +257,22 @@ static int set_mem_type(struct domain *d,
     while ( iter < data->nr )
     {
         unsigned long pfn = data->first_pfn + iter;
-        p2m_type_t t;
+        p2m_type_t ot;
 
-        get_gfn_unshare(d, pfn, &t);
-        if ( p2m_is_paging(t) )
+        get_gfn_unshare(d, pfn, &ot);
+        if ( p2m_is_paging(ot) )
         {
             put_gfn(d, pfn);
             p2m_mem_paging_populate(d, _gfn(pfn));
             return -EAGAIN;
         }
 
-        if ( p2m_is_shared(t) )
+        if ( p2m_is_shared(ot) )
             rc = -EAGAIN;
-        else if ( !allow_p2m_type_change(t, memtype[mem_type]) )
+        else if ( !allow_p2m_type_change(ot, nt) )
             rc = -EINVAL;
         else
-            rc = p2m_change_type_one(d, pfn, t, memtype[mem_type]);
+            rc = p2m_change_type_one(d, pfn, ot, nt);
 
         put_gfn(d, pfn);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 13:55:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 13:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896630.1305376 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnHsO-0002Is-7C; Wed, 26 Feb 2025 13:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896630.1305376; Wed, 26 Feb 2025 13: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 1tnHsO-0002Ik-4Y; Wed, 26 Feb 2025 13:55:04 +0000
Received: by outflank-mailman (input) for mailman id 896630;
 Wed, 26 Feb 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 1tnHsM-0002Ie-M5
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnHsM-006Ye5-1r
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 13:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnHsM-009VJd-0q
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=KeBnZBsBWJgGPn2pLYXhgpnQ1DhcXSmiT6gXR3Wn/n8=; b=A+n6EjFU7uENpz8boy+9sNwi4R
	CRbTz/rbEZFo7cPlzPzLT1QhJ0Pqngd4ORowJIvhdJHJ7AaZUKufLVwfZ01MELXIl823AXX6wy1uC
	pSmOKYojavu+OkShtkW5f3rg3Nt7Llq5BfF+vy4vDa4at7lEHkGpqV4sSBgcQIB1GIXc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: Rename hypercall-context functions
Message-Id: <E1tnHsM-009VJd-0q@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 13:55:02 +0000

commit 8e9d1173c3237f8ef2800dadb99af5f57d762bb6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 23 19:38:59 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 26 11:58:55 2025 +0000

    x86/ucode: Rename hypercall-context functions
    
    microcode_update{,_helper}() are overly generic names in a file that has
    multiple update routines and helper functions contexts.
    
    Rename microcode_update() to ucode_update_hcall() so it explicitly identifies
    itself as hypercall context, and rename microcode_update_helper() to
    ucode_update_hcall_cont() to make it clear it is in continuation context.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/cpu/microcode/core.c    | 10 +++++-----
 xen/arch/x86/include/asm/microcode.h |  4 ++--
 xen/arch/x86/platform_hypercall.c    |  6 +++---
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index de00c22b4b..9fe86942a3 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -467,7 +467,7 @@ struct ucode_buf {
     char buffer[];
 };
 
-static long cf_check microcode_update_helper(void *data)
+static long cf_check ucode_update_hcall_cont(void *data)
 {
     struct microcode_patch *patch = NULL;
     int ret, result;
@@ -611,8 +611,8 @@ static long cf_check microcode_update_helper(void *data)
     return ret;
 }
 
-int microcode_update(XEN_GUEST_HANDLE(const_void) buf,
-                     unsigned long len, unsigned int flags)
+int ucode_update_hcall(XEN_GUEST_HANDLE(const_void) buf,
+                       unsigned long len, unsigned int flags)
 {
     int ret;
     struct ucode_buf *buffer;
@@ -637,11 +637,11 @@ int microcode_update(XEN_GUEST_HANDLE(const_void) buf,
     buffer->flags = flags;
 
     /*
-     * Always queue microcode_update_helper() on CPU0.  Most of the logic
+     * Always queue ucode_update_hcall_cont() on CPU0.  Most of the logic
      * won't care, but the update of the Raw CPU policy wants to (re)run on
      * the BSP.
      */
-    return continue_hypercall_on_cpu(0, microcode_update_helper, buffer);
+    return continue_hypercall_on_cpu(0, ucode_update_hcall_cont, buffer);
 }
 
 /* Load a cached update to current cpu */
diff --git a/xen/arch/x86/include/asm/microcode.h b/xen/arch/x86/include/asm/microcode.h
index c62c131fd0..7f7ebb3d2a 100644
--- a/xen/arch/x86/include/asm/microcode.h
+++ b/xen/arch/x86/include/asm/microcode.h
@@ -22,8 +22,8 @@ struct cpu_signature {
 DECLARE_PER_CPU(struct cpu_signature, cpu_sig);
 
 void microcode_set_module(unsigned int idx);
-int microcode_update(XEN_GUEST_HANDLE(const_void) buf,
-                     unsigned long len, unsigned int flags);
+int ucode_update_hcall(XEN_GUEST_HANDLE(const_void) buf,
+                       unsigned long len, unsigned int flags);
 int microcode_update_one(void);
 
 struct boot_info;
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index 67f851237d..90abd3197f 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -313,7 +313,7 @@ ret_t do_platform_op(
 
         guest_from_compat_handle(data, op->u.microcode.data);
 
-        ret = microcode_update(data, op->u.microcode.length, 0);
+        ret = ucode_update_hcall(data, op->u.microcode.length, 0);
         break;
     }
 
@@ -323,8 +323,8 @@ ret_t do_platform_op(
 
         guest_from_compat_handle(data, op->u.microcode2.data);
 
-        ret = microcode_update(data, op->u.microcode2.length,
-                               op->u.microcode2.flags);
+        ret = ucode_update_hcall(data, op->u.microcode2.length,
+                                 op->u.microcode2.flags);
         break;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 13:55:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 13:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896631.1305380 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnHsY-0002KV-9B; Wed, 26 Feb 2025 13:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896631.1305380; Wed, 26 Feb 2025 13: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 1tnHsY-0002KN-5j; Wed, 26 Feb 2025 13:55:14 +0000
Received: by outflank-mailman (input) for mailman id 896631;
 Wed, 26 Feb 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 1tnHsW-0002K8-Fv
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnHsW-006YeP-2F
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 13:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnHsW-009VMg-1H
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=wlGzGN9Y3oDNaALVLdEc3zauYq+wepX2EqHZpB4JpHw=; b=4RKbzhylY4LsBtB5HKu0Bbb778
	AiRuBc911LcrldEz1AoZNSDwwdhsFro7ilF/G/3007r5xvCC0ioIlYHRQKcNj44qlhEveglR+Kbbw
	SWBUgsrFysvm274h3+ksjhYe3tzqwil+TZbjDBdamZOGaFZgVXQ9hjWKBFoMmNAXy6Fc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: Drop the match_reg[] field from AMD's microcode_patch
Message-Id: <E1tnHsW-009VMg-1H@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 13:55:12 +0000

commit 7463a5b63926db1dbbbae5829919d250c1b0f52c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 24 13:47:20 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 26 11:58:55 2025 +0000

    x86/ucode: Drop the match_reg[] field from AMD's microcode_patch
    
    This was true in the K10 days, but even back then the match registers were
    really payload data rather than header data.
    
    But, it's really model specific data, and these days typically part of the
    signature, so is random data for all intents and purposes.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 210736f580..9ee455b007 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -48,7 +48,6 @@ struct microcode_patch {
     uint8_t  sb_rev_id;
     uint8_t  bios_api_rev;
     uint8_t  reserved1[3];
-    uint32_t match_reg[8];
 };
 
 #define UCODE_MAGIC                0x00414d44
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 13:55:24 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 13:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896632.1305383 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnHsi-0002NU-9o; Wed, 26 Feb 2025 13:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896632.1305383; Wed, 26 Feb 2025 13: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 1tnHsi-0002NN-7B; Wed, 26 Feb 2025 13:55:24 +0000
Received: by outflank-mailman (input) for mailman id 896632;
 Wed, 26 Feb 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 1tnHsg-0002NC-Jg
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnHsg-006YeT-2c
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 13:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnHsg-009VQT-1g
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=iJX1TwkTG4GJ9rvAe2zsowyBdAA9ZSkKLfoy9cWVezU=; b=r/LG+B8fWdJlumLC5RGSEtSAPz
	WHd9TCoQm7RmmFcY777lvoOqYhmplh1TiZVb4BJRFTYZNOuL/XQNoaVoDSOvJIZ6eW4yLXTPMJTqv
	KaiRCzviLU+nVy+w6URiW4fkaFpAElGwQ1orYVM/UC2IBPiwg4AeNvDwkFlocWfkBd5Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Move cpuid_hypervisor_leaves() into cpuid.c
Message-Id: <E1tnHsg-009VQT-1g@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 13:55:22 +0000

commit f4a1c59f37914883a873e9eeb1b1f80f18812771
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 31 10:56:00 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 26 12:00:23 2025 +0000

    x86/traps: Move cpuid_hypervisor_leaves() into cpuid.c
    
    It's out of place in traps.c, and only has a single caller.  Make it static
    inside cpuid.c.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpuid.c                 | 136 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/processor.h |   2 -
 xen/arch/x86/traps.c                 | 136 -----------------------------------
 3 files changed, 136 insertions(+), 138 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 2a777436ee..8dc68945f7 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -1,6 +1,8 @@
 #include <xen/sched.h>
 #include <xen/types.h>
+#include <xen/version.h>
 
+#include <public/arch-x86/cpuid.h>
 #include <public/hvm/params.h>
 
 #include <asm/cpu-policy.h>
@@ -32,6 +34,140 @@ bool recheck_cpu_features(unsigned int cpu)
     return okay;
 }
 
+static void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
+                                    uint32_t subleaf, struct cpuid_leaf *res)
+{
+    const struct domain *d = v->domain;
+    const struct cpu_policy *p = d->arch.cpu_policy;
+    uint32_t base = is_viridian_domain(d) ? 0x40000100 : 0x40000000;
+    uint32_t idx  = leaf - base;
+    unsigned int limit = is_viridian_domain(d) ? p->hv2_limit : p->hv_limit;
+
+    if ( limit == 0 )
+        /* Default number of leaves */
+        limit = XEN_CPUID_MAX_NUM_LEAVES;
+    else
+        /* Clamp toolstack value between 2 and MAX_NUM_LEAVES. */
+        limit = min(max(limit, 2u), XEN_CPUID_MAX_NUM_LEAVES + 0u);
+
+    if ( idx > limit )
+        return;
+
+    switch ( idx )
+    {
+    case 0:
+        res->a = base + limit; /* Largest leaf */
+        res->b = XEN_CPUID_SIGNATURE_EBX;
+        res->c = XEN_CPUID_SIGNATURE_ECX;
+        res->d = XEN_CPUID_SIGNATURE_EDX;
+        break;
+
+    case 1:
+        res->a = (xen_major_version() << 16) | xen_minor_version();
+        break;
+
+    case 2:
+        res->a = 1;            /* Number of hypercall-transfer pages */
+                               /* MSR base address */
+        res->b = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
+        if ( is_pv_domain(d) ) /* Features */
+            res->c |= XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD;
+        break;
+
+    case 3: /* Time leaf. */
+        switch ( subleaf )
+        {
+        case 0: /* features */
+            res->a = ((d->arch.vtsc << 0) |
+                      (!!host_tsc_is_safe() << 1) |
+                      (!!boot_cpu_has(X86_FEATURE_RDTSCP) << 2));
+            res->b = d->arch.tsc_mode;
+            res->c = d->arch.tsc_khz;
+            res->d = d->arch.incarnation;
+            break;
+
+        case 1: /* scale and offset */
+        {
+            uint64_t offset;
+
+            if ( !d->arch.vtsc )
+                offset = d->arch.vtsc_offset;
+            else
+                /* offset already applied to value returned by virtual rdtscp */
+                offset = 0;
+            res->a = offset;
+            res->b = offset >> 32;
+            res->c = d->arch.vtsc_to_ns.mul_frac;
+            res->d = d->arch.vtsc_to_ns.shift;
+            break;
+        }
+
+        case 2: /* physical cpu_khz */
+            res->a = cpu_khz;
+            break;
+        }
+        break;
+
+    case 4: /* HVM hypervisor leaf. */
+        if ( !is_hvm_domain(d) || subleaf != 0 )
+            break;
+
+        if ( cpu_has_vmx_apic_reg_virt )
+            res->a |= XEN_HVM_CPUID_APIC_ACCESS_VIRT;
+
+        /*
+         * We want to claim that x2APIC is virtualized if APIC MSR accesses
+         * are not intercepted. When all three of these are true both rdmsr
+         * and wrmsr in the guest will run without VMEXITs (see
+         * vmx_vlapic_msr_changed()).
+         */
+        if ( cpu_has_vmx_virtualize_x2apic_mode &&
+             cpu_has_vmx_apic_reg_virt &&
+             cpu_has_vmx_virtual_intr_delivery )
+            res->a |= XEN_HVM_CPUID_X2APIC_VIRT;
+
+        /*
+         * 1) Xen 4.10 and older was broken WRT grant maps requesting a DMA
+         * mapping, and forgot to honour the guest's request.
+         * 2) 4.11 (and presumably backports) fixed the bug, so the map
+         * hypercall actually did what the guest asked.
+         * 3) To work around the bug, guests must bounce buffer all DMA that
+         * would otherwise use a grant map, because it doesn't know whether the
+         * DMA is originating from an emulated or a real device.
+         * 4) This flag tells guests it is safe not to bounce-buffer all DMA to
+         * work around the bug.
+         */
+        res->a |= XEN_HVM_CPUID_IOMMU_MAPPINGS;
+
+        /* Indicate presence of vcpu id and set it in ebx */
+        res->a |= XEN_HVM_CPUID_VCPU_ID_PRESENT;
+        res->b = v->vcpu_id;
+
+        /* Indicate presence of domain id and set it in ecx */
+        res->a |= XEN_HVM_CPUID_DOMID_PRESENT;
+        res->c = d->domain_id;
+
+        /*
+         * Per-vCPU event channel upcalls are implemented and work
+         * correctly with PIRQs routed over event channels.
+         */
+        res->a |= XEN_HVM_CPUID_UPCALL_VECTOR;
+
+        break;
+
+    case 5: /* PV-specific parameters */
+        if ( is_hvm_domain(d) || subleaf != 0 )
+            break;
+
+        res->b = flsl(get_upper_mfn_bound()) + PAGE_SHIFT;
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+        break;
+    }
+}
+
 void guest_cpuid(const struct vcpu *v, uint32_t leaf,
                  uint32_t subleaf, struct cpuid_leaf *res)
 {
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index d247ef8dd2..4f176bc575 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -472,8 +472,6 @@ struct stubs {
 DECLARE_PER_CPU(struct stubs, stubs);
 unsigned long alloc_stub_page(unsigned int cpu, unsigned long *mfn);
 
-void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
-                             uint32_t subleaf, struct cpuid_leaf *res);
 int guest_rdmsr_xen(const struct vcpu *v, uint32_t idx, uint64_t *val);
 int guest_wrmsr_xen(struct vcpu *v, uint32_t idx, uint64_t val);
 
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index dca11a613d..91af814bad 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -34,7 +34,6 @@
 #include <xen/domain_page.h>
 #include <xen/symbols.h>
 #include <xen/iocap.h>
-#include <xen/version.h>
 #include <xen/kexec.h>
 #include <xen/trace.h>
 #include <xen/paging.h>
@@ -65,7 +64,6 @@
 #include <asm/mc146818rtc.h>
 #include <asm/hpet.h>
 #include <asm/vpmu.h>
-#include <public/arch-x86/cpuid.h>
 #include <public/hvm/params.h>
 #include <asm/cpuid.h>
 #include <xsm/xsm.h>
@@ -1053,140 +1051,6 @@ int guest_wrmsr_xen(struct vcpu *v, uint32_t idx, uint64_t val)
     }
 }
 
-void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
-                             uint32_t subleaf, struct cpuid_leaf *res)
-{
-    const struct domain *d = v->domain;
-    const struct cpu_policy *p = d->arch.cpu_policy;
-    uint32_t base = is_viridian_domain(d) ? 0x40000100 : 0x40000000;
-    uint32_t idx  = leaf - base;
-    unsigned int limit = is_viridian_domain(d) ? p->hv2_limit : p->hv_limit;
-
-    if ( limit == 0 )
-        /* Default number of leaves */
-        limit = XEN_CPUID_MAX_NUM_LEAVES;
-    else
-        /* Clamp toolstack value between 2 and MAX_NUM_LEAVES. */
-        limit = min(max(limit, 2u), XEN_CPUID_MAX_NUM_LEAVES + 0u);
-
-    if ( idx > limit )
-        return;
-
-    switch ( idx )
-    {
-    case 0:
-        res->a = base + limit; /* Largest leaf */
-        res->b = XEN_CPUID_SIGNATURE_EBX;
-        res->c = XEN_CPUID_SIGNATURE_ECX;
-        res->d = XEN_CPUID_SIGNATURE_EDX;
-        break;
-
-    case 1:
-        res->a = (xen_major_version() << 16) | xen_minor_version();
-        break;
-
-    case 2:
-        res->a = 1;            /* Number of hypercall-transfer pages */
-                               /* MSR base address */
-        res->b = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
-        if ( is_pv_domain(d) ) /* Features */
-            res->c |= XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD;
-        break;
-
-    case 3: /* Time leaf. */
-        switch ( subleaf )
-        {
-        case 0: /* features */
-            res->a = ((d->arch.vtsc << 0) |
-                      (!!host_tsc_is_safe() << 1) |
-                      (!!boot_cpu_has(X86_FEATURE_RDTSCP) << 2));
-            res->b = d->arch.tsc_mode;
-            res->c = d->arch.tsc_khz;
-            res->d = d->arch.incarnation;
-            break;
-
-        case 1: /* scale and offset */
-        {
-            uint64_t offset;
-
-            if ( !d->arch.vtsc )
-                offset = d->arch.vtsc_offset;
-            else
-                /* offset already applied to value returned by virtual rdtscp */
-                offset = 0;
-            res->a = offset;
-            res->b = offset >> 32;
-            res->c = d->arch.vtsc_to_ns.mul_frac;
-            res->d = d->arch.vtsc_to_ns.shift;
-            break;
-        }
-
-        case 2: /* physical cpu_khz */
-            res->a = cpu_khz;
-            break;
-        }
-        break;
-
-    case 4: /* HVM hypervisor leaf. */
-        if ( !is_hvm_domain(d) || subleaf != 0 )
-            break;
-
-        if ( cpu_has_vmx_apic_reg_virt )
-            res->a |= XEN_HVM_CPUID_APIC_ACCESS_VIRT;
-
-        /*
-         * We want to claim that x2APIC is virtualized if APIC MSR accesses
-         * are not intercepted. When all three of these are true both rdmsr
-         * and wrmsr in the guest will run without VMEXITs (see
-         * vmx_vlapic_msr_changed()).
-         */
-        if ( cpu_has_vmx_virtualize_x2apic_mode &&
-             cpu_has_vmx_apic_reg_virt &&
-             cpu_has_vmx_virtual_intr_delivery )
-            res->a |= XEN_HVM_CPUID_X2APIC_VIRT;
-
-        /*
-         * 1) Xen 4.10 and older was broken WRT grant maps requesting a DMA
-         * mapping, and forgot to honour the guest's request.
-         * 2) 4.11 (and presumably backports) fixed the bug, so the map
-         * hypercall actually did what the guest asked.
-         * 3) To work around the bug, guests must bounce buffer all DMA that
-         * would otherwise use a grant map, because it doesn't know whether the
-         * DMA is originating from an emulated or a real device.
-         * 4) This flag tells guests it is safe not to bounce-buffer all DMA to
-         * work around the bug.
-         */
-        res->a |= XEN_HVM_CPUID_IOMMU_MAPPINGS;
-
-        /* Indicate presence of vcpu id and set it in ebx */
-        res->a |= XEN_HVM_CPUID_VCPU_ID_PRESENT;
-        res->b = v->vcpu_id;
-
-        /* Indicate presence of domain id and set it in ecx */
-        res->a |= XEN_HVM_CPUID_DOMID_PRESENT;
-        res->c = d->domain_id;
-
-        /*
-         * Per-vCPU event channel upcalls are implemented and work
-         * correctly with PIRQs routed over event channels.
-         */
-        res->a |= XEN_HVM_CPUID_UPCALL_VECTOR;
-
-        break;
-
-    case 5: /* PV-specific parameters */
-        if ( is_hvm_domain(d) || subleaf != 0 )
-            break;
-
-        res->b = flsl(get_upper_mfn_bound()) + PAGE_SHIFT;
-        break;
-
-    default:
-        ASSERT_UNREACHABLE();
-        break;
-    }
-}
-
 void asmlinkage do_invalid_op(struct cpu_user_regs *regs)
 {
     u8 bug_insn[2];
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 13:55:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 13:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896633.1305388 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnHss-0002Q0-Ba; Wed, 26 Feb 2025 13:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896633.1305388; Wed, 26 Feb 2025 13: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 1tnHss-0002Ps-8k; Wed, 26 Feb 2025 13:55:34 +0000
Received: by outflank-mailman (input) for mailman id 896633;
 Wed, 26 Feb 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 1tnHsq-0002Pf-Mp
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnHsq-006Yeb-2w
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 13:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnHsq-009VSz-23
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=Dvc2TKwYdSKkKbW3jGpIojdbA8Ei0UAWFlnZqT4ISsU=; b=PCxPrMwKdBiQipOYY7GPtii6fy
	h66fo8eXxGMdSVP1T9QUyiDrg77ypx07+XAUuD37K9grEaz6Q7GnZpXn23okikoHS/ukDW842F9Bn
	6fuJX2seDoWn7qPhkl5lFIjNKrkn8W2SXK5VRgvkog9AL7Z/UGhEuHr6d8/c2dqBgOXk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Move guest_{rd,wr}msr_xen() into msr.c
Message-Id: <E1tnHsq-009VSz-23@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 13:55:32 +0000

commit 07cb3105688391639321a5b4499c58dadf6b685f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 31 11:02:49 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 26 12:00:23 2025 +0000

    x86/traps: Move guest_{rd,wr}msr_xen() into msr.c
    
    They are out of place in traps.c, and only have a single caller each.  Make
    them static inside msr.c.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/processor.h |  3 --
 xen/arch/x86/msr.c                   | 73 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/traps.c                 | 73 ------------------------------------
 3 files changed, 73 insertions(+), 76 deletions(-)

diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index 4f176bc575..6bc88b0317 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -472,9 +472,6 @@ struct stubs {
 DECLARE_PER_CPU(struct stubs, stubs);
 unsigned long alloc_stub_page(unsigned int cpu, unsigned long *mfn);
 
-int guest_rdmsr_xen(const struct vcpu *v, uint32_t idx, uint64_t *val);
-int guest_wrmsr_xen(struct vcpu *v, uint32_t idx, uint64_t val);
-
 static inline uint8_t get_cpu_family(uint32_t raw, uint8_t *model,
                                      uint8_t *stepping)
 {
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 289cf10b78..1550fd9ec9 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -18,6 +18,7 @@
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/viridian.h>
 #include <asm/msr.h>
+#include <asm/p2m.h>
 #include <asm/pv/domain.h>
 #include <asm/setup.h>
 #include <asm/xstate.h>
@@ -40,6 +41,78 @@ int init_vcpu_msr_policy(struct vcpu *v)
     return 0;
 }
 
+static int guest_rdmsr_xen(const struct vcpu *v, uint32_t idx, uint64_t *val)
+{
+    const struct domain *d = v->domain;
+    /* Optionally shift out of the way of Viridian architectural MSRs. */
+    uint32_t base = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
+
+    switch ( idx - base )
+    {
+    case 0: /* Write hypercall page MSR.  Read as zero. */
+        *val = 0;
+        return X86EMUL_OKAY;
+    }
+
+    return X86EMUL_EXCEPTION;
+}
+
+static int guest_wrmsr_xen(struct vcpu *v, uint32_t idx, uint64_t val)
+{
+    struct domain *d = v->domain;
+    /* Optionally shift out of the way of Viridian architectural MSRs. */
+    uint32_t base = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
+
+    switch ( idx - base )
+    {
+    case 0: /* Write hypercall page */
+    {
+        void *hypercall_page;
+        unsigned long gmfn = val >> PAGE_SHIFT;
+        unsigned int page_index = val & (PAGE_SIZE - 1);
+        struct page_info *page;
+        p2m_type_t t;
+
+        if ( page_index > 0 )
+        {
+            gdprintk(XENLOG_WARNING,
+                     "wrmsr hypercall page index %#x unsupported\n",
+                     page_index);
+            return X86EMUL_EXCEPTION;
+        }
+
+        page = get_page_from_gfn(d, gmfn, &t, P2M_ALLOC);
+
+        if ( !page || !get_page_type(page, PGT_writable_page) )
+        {
+            if ( page )
+                put_page(page);
+
+            if ( p2m_is_paging(t) )
+            {
+                p2m_mem_paging_populate(d, _gfn(gmfn));
+                return X86EMUL_RETRY;
+            }
+
+            gdprintk(XENLOG_WARNING,
+                     "Bad GMFN %lx (MFN %#"PRI_mfn") to MSR %08x\n",
+                     gmfn, mfn_x(page ? page_to_mfn(page) : INVALID_MFN), base);
+            return X86EMUL_EXCEPTION;
+        }
+
+        hypercall_page = __map_domain_page(page);
+        init_hypercall_page(d, hypercall_page);
+        unmap_domain_page(hypercall_page);
+
+        put_page_and_type(page);
+        return X86EMUL_OKAY;
+    }
+
+    default:
+        return X86EMUL_EXCEPTION;
+    }
+}
+
 int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 {
     const struct vcpu *curr = current;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 91af814bad..be2bc59f03 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -64,7 +64,6 @@
 #include <asm/mc146818rtc.h>
 #include <asm/hpet.h>
 #include <asm/vpmu.h>
-#include <public/hvm/params.h>
 #include <asm/cpuid.h>
 #include <xsm/xsm.h>
 #include <asm/irq-vectors.h>
@@ -979,78 +978,6 @@ void asmlinkage do_trap(struct cpu_user_regs *regs)
     fatal_trap(regs, false);
 }
 
-int guest_rdmsr_xen(const struct vcpu *v, uint32_t idx, uint64_t *val)
-{
-    const struct domain *d = v->domain;
-    /* Optionally shift out of the way of Viridian architectural MSRs. */
-    uint32_t base = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
-
-    switch ( idx - base )
-    {
-    case 0: /* Write hypercall page MSR.  Read as zero. */
-        *val = 0;
-        return X86EMUL_OKAY;
-    }
-
-    return X86EMUL_EXCEPTION;
-}
-
-int guest_wrmsr_xen(struct vcpu *v, uint32_t idx, uint64_t val)
-{
-    struct domain *d = v->domain;
-    /* Optionally shift out of the way of Viridian architectural MSRs. */
-    uint32_t base = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
-
-    switch ( idx - base )
-    {
-    case 0: /* Write hypercall page */
-    {
-        void *hypercall_page;
-        unsigned long gmfn = val >> PAGE_SHIFT;
-        unsigned int page_index = val & (PAGE_SIZE - 1);
-        struct page_info *page;
-        p2m_type_t t;
-
-        if ( page_index > 0 )
-        {
-            gdprintk(XENLOG_WARNING,
-                     "wrmsr hypercall page index %#x unsupported\n",
-                     page_index);
-            return X86EMUL_EXCEPTION;
-        }
-
-        page = get_page_from_gfn(d, gmfn, &t, P2M_ALLOC);
-
-        if ( !page || !get_page_type(page, PGT_writable_page) )
-        {
-            if ( page )
-                put_page(page);
-
-            if ( p2m_is_paging(t) )
-            {
-                p2m_mem_paging_populate(d, _gfn(gmfn));
-                return X86EMUL_RETRY;
-            }
-
-            gdprintk(XENLOG_WARNING,
-                     "Bad GMFN %lx (MFN %#"PRI_mfn") to MSR %08x\n",
-                     gmfn, mfn_x(page ? page_to_mfn(page) : INVALID_MFN), base);
-            return X86EMUL_EXCEPTION;
-        }
-
-        hypercall_page = __map_domain_page(page);
-        init_hypercall_page(d, hypercall_page);
-        unmap_domain_page(hypercall_page);
-
-        put_page_and_type(page);
-        return X86EMUL_OKAY;
-    }
-
-    default:
-        return X86EMUL_EXCEPTION;
-    }
-}
-
 void asmlinkage do_invalid_op(struct cpu_user_regs *regs)
 {
     u8 bug_insn[2];
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 13:55:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 13:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896634.1305392 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnHt2-0002TD-ET; Wed, 26 Feb 2025 13:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896634.1305392; Wed, 26 Feb 2025 13: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 1tnHt2-0002T5-Bl; Wed, 26 Feb 2025 13:55:44 +0000
Received: by outflank-mailman (input) for mailman id 896634;
 Wed, 26 Feb 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 1tnHt0-0002Sx-RL
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnHt1-006Yef-07
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 13:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnHt0-009VVK-2N
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=un6rMDuCuKs1iAG+G+bhjUl38YehPT49QD0q979KPm8=; b=k3/JgGtfDIxLzvPfAhEfRAUWwg
	vWas6aseED9YUwEB1T5SxoNONos9lUQOY89KREfWOJmZCbqGh3/zf1hY81sQx35EJDDNnfXScV6XD
	eJj3UiTJ+qn/kiyVJfjCbhaR6uUb7WuMuYVCMF10L0T4/9LqE5aYaTnnscSYMen7ylno=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] PPC: Activate UBSAN in testing
Message-Id: <E1tnHt0-009VVK-2N@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 13:55:42 +0000

commit 7cf163879c5add0a4f7f9c987b61f04f8f7051b1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 25 21:27:33 2025 -0600
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 26 12:00:23 2025 +0000

    PPC: Activate UBSAN in testing
    
    Also enable -fno-sanitize=alignment like x86 since support for unaligned
    accesses is guaranteed by the ISA and the existing OPAL setup code
    relies on it.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 automation/gitlab-ci/build.yaml      | 3 +++
 xen/arch/ppc/Kconfig                 | 1 +
 xen/arch/ppc/arch.mk                 | 6 ++++++
 xen/arch/ppc/include/asm/processor.h | 2 ++
 xen/arch/ppc/stubs.c                 | 2 +-
 5 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 35e224366f..6a2e491534 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -352,6 +352,9 @@ debian-12-ppc64le-gcc-debug:
     CONTAINER: debian:12-ppc64le
     KBUILD_DEFCONFIG: ppc64_defconfig
     HYPERVISOR_ONLY: y
+    EXTRA_XEN_CONFIG: |
+      CONFIG_UBSAN=y
+      CONFIG_UBSAN_FATAL=y
 
 debian-12-riscv64-gcc-debug:
   extends: .gcc-riscv64-cross-build-debug
diff --git a/xen/arch/ppc/Kconfig b/xen/arch/ppc/Kconfig
index 6db575a48d..917f5d53a6 100644
--- a/xen/arch/ppc/Kconfig
+++ b/xen/arch/ppc/Kconfig
@@ -2,6 +2,7 @@ config PPC
 	def_bool y
 	select FUNCTION_ALIGNMENT_4B
 	select HAS_DEVICE_TREE
+	select HAS_UBSAN
 	select HAS_VMAP
 
 config PPC64
diff --git a/xen/arch/ppc/arch.mk b/xen/arch/ppc/arch.mk
index 917ad0e6a8..c2ca419242 100644
--- a/xen/arch/ppc/arch.mk
+++ b/xen/arch/ppc/arch.mk
@@ -7,3 +7,9 @@ CFLAGS += -m64 -mlittle-endian -mcpu=$(ppc-march-y)
 CFLAGS += -mstrict-align -mcmodel=medium -mabi=elfv2 -fPIC -mno-altivec -mno-vsx -msoft-float
 
 LDFLAGS += -m elf64lppc
+
+ifeq ($(CONFIG_UBSAN),y)
+# Don't enable alignment sanitisation since Power ISA guarantees hardware
+# support for unaligned accesses.
+$(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
+endif
diff --git a/xen/arch/ppc/include/asm/processor.h b/xen/arch/ppc/include/asm/processor.h
index a01b62b8a4..50161cc32d 100644
--- a/xen/arch/ppc/include/asm/processor.h
+++ b/xen/arch/ppc/include/asm/processor.h
@@ -219,6 +219,8 @@ static inline void noreturn die(void)
  */
 #define cpu_relax() asm volatile ( "or %r1, %r1, %r1; or %r2, %r2, %r2" )
 
+#define dump_execution_state() run_in_exception_handler(show_execution_state)
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_PPC_PROCESSOR_H */
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
index fff82f5cf3..671e71aa0a 100644
--- a/xen/arch/ppc/stubs.c
+++ b/xen/arch/ppc/stubs.c
@@ -47,7 +47,7 @@ void send_timer_event(struct vcpu *v)
 
 void show_execution_state(const struct cpu_user_regs *regs)
 {
-    BUG_ON("unimplemented");
+    printk("TODO: Implement show_execution_state(regs)\n");
 }
 
 void arch_hypercall_tasklet_result(struct vcpu *v, long res)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 15:00:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 15:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896817.1305565 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnItG-0003yh-VD; Wed, 26 Feb 2025 15:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 896817.1305565; Wed, 26 Feb 2025 15: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 1tnItG-0003yN-SQ; Wed, 26 Feb 2025 15:00:02 +0000
Received: by outflank-mailman (input) for mailman id 896817;
 Wed, 26 Feb 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 1tnItG-0003kH-2A
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnItF-006Zz2-35
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 15:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnItF-009oXF-25
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 15: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=5MMNsLZob9R2iPAXs+QpBZmqYWEOtx0Zx8tbGZt/mMM=; b=cJJhq0MGSY0JFIXLWi85fFsdKR
	k9hZNZ9qfLwQcDuN6XExb1Tgg+Sb63rUE2RA5JK44p40svE/T50KYCyCp0ybxIhwpwr3iXk+kfiIe
	FElT/1VYtFCeFiquXqw+0l9jVK4fxGyF6s/b+RLmLJ0+eUF63UQBdPj2wH10ubqPLdAw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] PPC: Activate UBSAN in testing
Message-Id: <E1tnItF-009oXF-25@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 15:00:01 +0000

commit 48c7aff2f41faff37ce1c023d4b10b2ab03201bd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 25 21:27:33 2025 -0600
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 26 14:54:46 2025 +0000

    PPC: Activate UBSAN in testing
    
    Also enable -fno-sanitize=alignment like x86 since support for unaligned
    accesses is guaranteed by the ISA and the existing OPAL setup code
    relies on it.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    (cherry picked from commit 7cf163879c5add0a4f7f9c987b61f04f8f7051b1)
---
 automation/gitlab-ci/build.yaml      | 3 +++
 xen/arch/ppc/Kconfig                 | 1 +
 xen/arch/ppc/arch.mk                 | 6 ++++++
 xen/arch/ppc/include/asm/processor.h | 2 ++
 xen/arch/ppc/stubs.c                 | 2 +-
 5 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 35e224366f..6a2e491534 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -352,6 +352,9 @@ debian-12-ppc64le-gcc-debug:
     CONTAINER: debian:12-ppc64le
     KBUILD_DEFCONFIG: ppc64_defconfig
     HYPERVISOR_ONLY: y
+    EXTRA_XEN_CONFIG: |
+      CONFIG_UBSAN=y
+      CONFIG_UBSAN_FATAL=y
 
 debian-12-riscv64-gcc-debug:
   extends: .gcc-riscv64-cross-build-debug
diff --git a/xen/arch/ppc/Kconfig b/xen/arch/ppc/Kconfig
index 6db575a48d..917f5d53a6 100644
--- a/xen/arch/ppc/Kconfig
+++ b/xen/arch/ppc/Kconfig
@@ -2,6 +2,7 @@ config PPC
 	def_bool y
 	select FUNCTION_ALIGNMENT_4B
 	select HAS_DEVICE_TREE
+	select HAS_UBSAN
 	select HAS_VMAP
 
 config PPC64
diff --git a/xen/arch/ppc/arch.mk b/xen/arch/ppc/arch.mk
index 917ad0e6a8..c2ca419242 100644
--- a/xen/arch/ppc/arch.mk
+++ b/xen/arch/ppc/arch.mk
@@ -7,3 +7,9 @@ CFLAGS += -m64 -mlittle-endian -mcpu=$(ppc-march-y)
 CFLAGS += -mstrict-align -mcmodel=medium -mabi=elfv2 -fPIC -mno-altivec -mno-vsx -msoft-float
 
 LDFLAGS += -m elf64lppc
+
+ifeq ($(CONFIG_UBSAN),y)
+# Don't enable alignment sanitisation since Power ISA guarantees hardware
+# support for unaligned accesses.
+$(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
+endif
diff --git a/xen/arch/ppc/include/asm/processor.h b/xen/arch/ppc/include/asm/processor.h
index a01b62b8a4..50161cc32d 100644
--- a/xen/arch/ppc/include/asm/processor.h
+++ b/xen/arch/ppc/include/asm/processor.h
@@ -219,6 +219,8 @@ static inline void noreturn die(void)
  */
 #define cpu_relax() asm volatile ( "or %r1, %r1, %r1; or %r2, %r2, %r2" )
 
+#define dump_execution_state() run_in_exception_handler(show_execution_state)
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_PPC_PROCESSOR_H */
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
index fff82f5cf3..671e71aa0a 100644
--- a/xen/arch/ppc/stubs.c
+++ b/xen/arch/ppc/stubs.c
@@ -47,7 +47,7 @@ void send_timer_event(struct vcpu *v)
 
 void show_execution_state(const struct cpu_user_regs *regs)
 {
-    BUG_ON("unimplemented");
+    printk("TODO: Implement show_execution_state(regs)\n");
 }
 
 void arch_hypercall_tasklet_result(struct vcpu *v, long res)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Wed Feb 26 15:44:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 26 Feb 2025 15:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.896887.1305630 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnJZr-0007Fm-GX; Wed, 26 Feb 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 896887.1305630; Wed, 26 Feb 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 1tnJZr-0007Fe-Do; Wed, 26 Feb 2025 15:44:03 +0000
Received: by outflank-mailman (input) for mailman id 896887;
 Wed, 26 Feb 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 1tnJZp-0007FY-Uz
 for xen-changelog@lists.xenproject.org; Wed, 26 Feb 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 1tnJZp-006asz-2a
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 2025 15:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnJZp-00A0Vi-1T
 for xen-changelog@lists.xenproject.org;
 Wed, 26 Feb 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=0Qr9C3C7Bi1Mez0smEmZw6TDoVj8X1/duVzyY128UpE=; b=j/yIRs56CvzgQJ89TR6+SD7qN6
	yTCi0Zg0VLACkfZyf4RuxUdq1v+CcM8uFQ0sNCC1QYVJvuktTFoxAm6lopCom1y/GWyODqro2HtOs
	gRq9Ji+wptacU9l6GiZ9mQWb9R7YLxPMlV3a1saoawO64fNWKMVxBgTg9U05JmN12rjQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] PPC: Activate UBSAN in testing
Message-Id: <E1tnJZp-00A0Vi-1T@xenbits.xenproject.org>
Date: Wed, 26 Feb 2025 15:44:01 +0000

commit 48c7aff2f41faff37ce1c023d4b10b2ab03201bd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 25 21:27:33 2025 -0600
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 26 14:54:46 2025 +0000

    PPC: Activate UBSAN in testing
    
    Also enable -fno-sanitize=alignment like x86 since support for unaligned
    accesses is guaranteed by the ISA and the existing OPAL setup code
    relies on it.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    (cherry picked from commit 7cf163879c5add0a4f7f9c987b61f04f8f7051b1)
---
 automation/gitlab-ci/build.yaml      | 3 +++
 xen/arch/ppc/Kconfig                 | 1 +
 xen/arch/ppc/arch.mk                 | 6 ++++++
 xen/arch/ppc/include/asm/processor.h | 2 ++
 xen/arch/ppc/stubs.c                 | 2 +-
 5 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 35e224366f..6a2e491534 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -352,6 +352,9 @@ debian-12-ppc64le-gcc-debug:
     CONTAINER: debian:12-ppc64le
     KBUILD_DEFCONFIG: ppc64_defconfig
     HYPERVISOR_ONLY: y
+    EXTRA_XEN_CONFIG: |
+      CONFIG_UBSAN=y
+      CONFIG_UBSAN_FATAL=y
 
 debian-12-riscv64-gcc-debug:
   extends: .gcc-riscv64-cross-build-debug
diff --git a/xen/arch/ppc/Kconfig b/xen/arch/ppc/Kconfig
index 6db575a48d..917f5d53a6 100644
--- a/xen/arch/ppc/Kconfig
+++ b/xen/arch/ppc/Kconfig
@@ -2,6 +2,7 @@ config PPC
 	def_bool y
 	select FUNCTION_ALIGNMENT_4B
 	select HAS_DEVICE_TREE
+	select HAS_UBSAN
 	select HAS_VMAP
 
 config PPC64
diff --git a/xen/arch/ppc/arch.mk b/xen/arch/ppc/arch.mk
index 917ad0e6a8..c2ca419242 100644
--- a/xen/arch/ppc/arch.mk
+++ b/xen/arch/ppc/arch.mk
@@ -7,3 +7,9 @@ CFLAGS += -m64 -mlittle-endian -mcpu=$(ppc-march-y)
 CFLAGS += -mstrict-align -mcmodel=medium -mabi=elfv2 -fPIC -mno-altivec -mno-vsx -msoft-float
 
 LDFLAGS += -m elf64lppc
+
+ifeq ($(CONFIG_UBSAN),y)
+# Don't enable alignment sanitisation since Power ISA guarantees hardware
+# support for unaligned accesses.
+$(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
+endif
diff --git a/xen/arch/ppc/include/asm/processor.h b/xen/arch/ppc/include/asm/processor.h
index a01b62b8a4..50161cc32d 100644
--- a/xen/arch/ppc/include/asm/processor.h
+++ b/xen/arch/ppc/include/asm/processor.h
@@ -219,6 +219,8 @@ static inline void noreturn die(void)
  */
 #define cpu_relax() asm volatile ( "or %r1, %r1, %r1; or %r2, %r2, %r2" )
 
+#define dump_execution_state() run_in_exception_handler(show_execution_state)
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_PPC_PROCESSOR_H */
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
index fff82f5cf3..671e71aa0a 100644
--- a/xen/arch/ppc/stubs.c
+++ b/xen/arch/ppc/stubs.c
@@ -47,7 +47,7 @@ void send_timer_event(struct vcpu *v)
 
 void show_execution_state(const struct cpu_user_regs *regs)
 {
-    BUG_ON("unimplemented");
+    printk("TODO: Implement show_execution_state(regs)\n");
 }
 
 void arch_hypercall_tasklet_result(struct vcpu *v, long res)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 13:11:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 13:11:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898082.1306631 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tndfL-0006xU-7J; Thu, 27 Feb 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 898082.1306631; Thu, 27 Feb 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 1tndfL-0006xM-4X; Thu, 27 Feb 2025 13:11:03 +0000
Received: by outflank-mailman (input) for mailman id 898082;
 Thu, 27 Feb 2025 13: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 1tndfJ-0006xA-Ld
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 2025 13: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 1tndfJ-008PtI-2j
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 13:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tndfJ-00CO0o-1m
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 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=QaQ5PJecbYz+wpPPuUni1O8c1B9M2rEaHFG7MixGw/U=; b=gsGdqlzMv/pcJxNidDFdkhtQea
	nrQ0mzsBSueu7AhEMXOKXAAsBp8oo1gSBdPnCOZpxIIIfMV05CDMGx1MIZVhIwKp8XWjMIlkQxYlS
	NbBTs+dbTOiDbja5lfF6BJsKA7J+DYcpYBOrLPsERWfXN+FdcwfZnW4sUMJnRpCO/Vlk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
Message-Id: <E1tndfJ-00CO0o-1m@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 13:11:01 +0000

commit 39bc6af3ba483282ed6bbf94b08aec38c93d39e6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 27 12:58:32 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 12:58:32 2025 +0000

    IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
    
    The function's use from set_msi_source_id() is guaranteed to be in an
    IRQs-off region. While the invocation of that function could be moved
    ahead in msi_msg_to_remap_entry() (doesn't need to be in the IOMMU-
    intremap-locked region), the call tree from map_domain_pirq() holds an
    IRQ descriptor lock. Hence all use sites of the lock need become IRQ-
    safe ones.
    
    In find_upstream_bridge() do a tiny bit of tidying in adjacent code:
    Change a variable's type to unsigned and merge a redundant assignment
    into another variable's initializer.
    
    This is XSA-467 / CVE-2025-1713.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/passthrough/pci.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index e1a09344df..ab25840e20 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -354,20 +354,21 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
     switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) )
     {
         unsigned int cap, sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
             {
                 pseg->bus2bridge[sec_bus].map = 1;
                 pseg->bus2bridge[sec_bus].bus = bus;
                 pseg->bus2bridge[sec_bus].devfn = devfn;
             }
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         case DEV_TYPE_PCIe_ENDPOINT:
@@ -437,16 +438,17 @@ static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
     switch ( pdev->type )
     {
         unsigned int sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
                 pseg->bus2bridge[sec_bus] = pseg->bus2bridge[pdev->bus];
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         default:
@@ -1053,8 +1055,9 @@ enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn)
 int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
 {
     struct pci_seg *pseg = get_pseg(seg);
-    int ret = 0;
-    int cnt = 0;
+    int ret = 1;
+    unsigned long flags;
+    unsigned int cnt = 0;
 
     if ( *bus == 0 )
         return 0;
@@ -1065,8 +1068,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     if ( !pseg->bus2bridge[*bus].map )
         return 0;
 
-    ret = 1;
-    spin_lock(&pseg->bus2bridge_lock);
+    spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
     while ( pseg->bus2bridge[*bus].map )
     {
         *secbus = *bus;
@@ -1080,7 +1082,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     }
 
 out:
-    spin_unlock(&pseg->bus2bridge_lock);
+    spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 13:11:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 13:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898083.1306634 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tndfV-0006z6-8R; Thu, 27 Feb 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 898083.1306634; Thu, 27 Feb 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 1tndfV-0006yy-5t; Thu, 27 Feb 2025 13:11:13 +0000
Received: by outflank-mailman (input) for mailman id 898083;
 Thu, 27 Feb 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 1tndfT-0006yg-VX
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 2025 13: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 1tndfU-008PtX-0a
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 13:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tndfT-00CO28-2s
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 13: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=V1vYtiKZUtBkvjmxZPhZ4+B29PpubuO3uIij6wfN4tA=; b=TynV5jaP035EvgAneu7zEnjdXv
	BVYwVh9EY2XHQQ9O1D5UsCLR14GBC5xMa3jFTG13C7w3LtVee5qBPK8VhTn0S+lP06wyUUBCH7NS4
	UvOMPa0yihtj76kO4bbDEuV9ztTAnYiyg9AnN7+gZiNBOFdzN2yobfIOvx/eWj24AwoM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
Message-Id: <E1tndfT-00CO28-2s@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 13:11:11 +0000

commit c0a7c96182710106bdc8ba79ae2e3ec22cbede8c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 27 12:58:32 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 12:59:50 2025 +0000

    IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
    
    The function's use from set_msi_source_id() is guaranteed to be in an
    IRQs-off region. While the invocation of that function could be moved
    ahead in msi_msg_to_remap_entry() (doesn't need to be in the IOMMU-
    intremap-locked region), the call tree from map_domain_pirq() holds an
    IRQ descriptor lock. Hence all use sites of the lock need become IRQ-
    safe ones.
    
    In find_upstream_bridge() do a tiny bit of tidying in adjacent code:
    Change a variable's type to unsigned and merge a redundant assignment
    into another variable's initializer.
    
    This is XSA-467 / CVE-2025-1713.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 39bc6af3ba483282ed6bbf94b08aec38c93d39e6)
---
 xen/drivers/passthrough/pci.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index e1a09344df..ab25840e20 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -354,20 +354,21 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
     switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) )
     {
         unsigned int cap, sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
             {
                 pseg->bus2bridge[sec_bus].map = 1;
                 pseg->bus2bridge[sec_bus].bus = bus;
                 pseg->bus2bridge[sec_bus].devfn = devfn;
             }
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         case DEV_TYPE_PCIe_ENDPOINT:
@@ -437,16 +438,17 @@ static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
     switch ( pdev->type )
     {
         unsigned int sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
                 pseg->bus2bridge[sec_bus] = pseg->bus2bridge[pdev->bus];
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         default:
@@ -1053,8 +1055,9 @@ enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn)
 int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
 {
     struct pci_seg *pseg = get_pseg(seg);
-    int ret = 0;
-    int cnt = 0;
+    int ret = 1;
+    unsigned long flags;
+    unsigned int cnt = 0;
 
     if ( *bus == 0 )
         return 0;
@@ -1065,8 +1068,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     if ( !pseg->bus2bridge[*bus].map )
         return 0;
 
-    ret = 1;
-    spin_lock(&pseg->bus2bridge_lock);
+    spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
     while ( pseg->bus2bridge[*bus].map )
     {
         *secbus = *bus;
@@ -1080,7 +1082,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     }
 
 out:
-    spin_unlock(&pseg->bus2bridge_lock);
+    spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 13:11:23 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 13:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898084.1306640 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tndff-00071S-B0; Thu, 27 Feb 2025 13:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 898084.1306640; Thu, 27 Feb 2025 13: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 1tndff-00071G-7H; Thu, 27 Feb 2025 13:11:23 +0000
Received: by outflank-mailman (input) for mailman id 898084;
 Thu, 27 Feb 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 1tndfe-000718-8z
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 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 1tndfe-008Ptb-1W
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 13:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tndfe-00CO5W-0b
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 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=bYRdlGctjvt19kyFesvvWa/PQiPuX/Vtuzo9ru3ME0A=; b=10Oa/3CLRrRDBSvl7js+TXZg4V
	nl8siR8pA1kqHKfBxYsYLaa6WVtHN+ZmWioYKho7aW3652qoUtjBTFm2P4JPbJAnfJq8tJZi8P3rR
	+uLwZzlCTN2nGuY1hQrUreLsZBz8uV60+aUikHdaBMQuj4E9WbLorAMezs9LbiFOm/gE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
Message-Id: <E1tndfe-00CO5W-0b@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 13:11:22 +0000

commit f2c5b4b1aa1972b522bfb5207f4b771681ef8fd2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 27 12:58:32 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 12:59:57 2025 +0000

    IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
    
    The function's use from set_msi_source_id() is guaranteed to be in an
    IRQs-off region. While the invocation of that function could be moved
    ahead in msi_msg_to_remap_entry() (doesn't need to be in the IOMMU-
    intremap-locked region), the call tree from map_domain_pirq() holds an
    IRQ descriptor lock. Hence all use sites of the lock need become IRQ-
    safe ones.
    
    In find_upstream_bridge() do a tiny bit of tidying in adjacent code:
    Change a variable's type to unsigned and merge a redundant assignment
    into another variable's initializer.
    
    This is XSA-467 / CVE-2025-1713.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 39bc6af3ba483282ed6bbf94b08aec38c93d39e6)
---
 xen/drivers/passthrough/pci.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index f4c8c505af..4d06e5d3f9 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -351,20 +351,21 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
     switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) )
     {
         unsigned int cap, sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
             {
                 pseg->bus2bridge[sec_bus].map = 1;
                 pseg->bus2bridge[sec_bus].bus = bus;
                 pseg->bus2bridge[sec_bus].devfn = devfn;
             }
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         case DEV_TYPE_PCIe_ENDPOINT:
@@ -434,16 +435,17 @@ static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
     switch ( pdev->type )
     {
         unsigned int sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
                 pseg->bus2bridge[sec_bus] = pseg->bus2bridge[pdev->bus];
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         default:
@@ -1067,8 +1069,9 @@ enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn)
 int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
 {
     struct pci_seg *pseg = get_pseg(seg);
-    int ret = 0;
-    int cnt = 0;
+    int ret = 1;
+    unsigned long flags;
+    unsigned int cnt = 0;
 
     if ( *bus == 0 )
         return 0;
@@ -1079,8 +1082,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     if ( !pseg->bus2bridge[*bus].map )
         return 0;
 
-    ret = 1;
-    spin_lock(&pseg->bus2bridge_lock);
+    spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
     while ( pseg->bus2bridge[*bus].map )
     {
         *secbus = *bus;
@@ -1094,7 +1096,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     }
 
 out:
-    spin_unlock(&pseg->bus2bridge_lock);
+    spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 13:11:34 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 13:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898085.1306644 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tndfq-00074L-Bp; Thu, 27 Feb 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 898085.1306644; Thu, 27 Feb 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 1tndfq-00074D-8i; Thu, 27 Feb 2025 13:11:34 +0000
Received: by outflank-mailman (input) for mailman id 898085;
 Thu, 27 Feb 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 1tndfo-000740-JQ
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 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 1tndfo-008Pty-2b
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 13:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tndfo-00CO7J-1V
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 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=fx73D2MAd+6UcO7f3POSGXtLHMB5boJvPhswZPhEZ6M=; b=if1JSdo6b9WUUHW8081pzMZVdu
	3YMO80V9dcWLisnfRp9F9MIZFyxL8AgI0Ot223n5WaEHJpHRade4ZT1RIkIYOWrruTv/CKfmFSb37
	9C/oSiRWa2wJ3UoVBI/2OcxuqE9pwfqhB5sgxHTIKDifVAAEo5KragB/yBCdHG12iW90=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
Message-Id: <E1tndfo-00CO7J-1V@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 13:11:32 +0000

commit 746df32732dcdb51d3af1a0070d3fdb8f8dd03b1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 27 12:58:32 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 13:00:01 2025 +0000

    IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
    
    The function's use from set_msi_source_id() is guaranteed to be in an
    IRQs-off region. While the invocation of that function could be moved
    ahead in msi_msg_to_remap_entry() (doesn't need to be in the IOMMU-
    intremap-locked region), the call tree from map_domain_pirq() holds an
    IRQ descriptor lock. Hence all use sites of the lock need become IRQ-
    safe ones.
    
    In find_upstream_bridge() do a tiny bit of tidying in adjacent code:
    Change a variable's type to unsigned and merge a redundant assignment
    into another variable's initializer.
    
    This is XSA-467 / CVE-2025-1713.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 39bc6af3ba483282ed6bbf94b08aec38c93d39e6)
---
 xen/drivers/passthrough/pci.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index b7afdccf23..25ea1dc421 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -349,20 +349,21 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
     switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) )
     {
         unsigned int cap, sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
             {
                 pseg->bus2bridge[sec_bus].map = 1;
                 pseg->bus2bridge[sec_bus].bus = bus;
                 pseg->bus2bridge[sec_bus].devfn = devfn;
             }
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         case DEV_TYPE_PCIe_ENDPOINT:
@@ -432,16 +433,17 @@ static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
     switch ( pdev->type )
     {
         unsigned int sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
                 pseg->bus2bridge[sec_bus] = pseg->bus2bridge[pdev->bus];
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         default:
@@ -957,8 +959,9 @@ enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn)
 int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
 {
     struct pci_seg *pseg = get_pseg(seg);
-    int ret = 0;
-    int cnt = 0;
+    int ret = 1;
+    unsigned long flags;
+    unsigned int cnt = 0;
 
     if ( *bus == 0 )
         return 0;
@@ -969,8 +972,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     if ( !pseg->bus2bridge[*bus].map )
         return 0;
 
-    ret = 1;
-    spin_lock(&pseg->bus2bridge_lock);
+    spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
     while ( pseg->bus2bridge[*bus].map )
     {
         *secbus = *bus;
@@ -984,7 +986,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     }
 
 out:
-    spin_unlock(&pseg->bus2bridge_lock);
+    spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 13:11:44 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 13:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898086.1306647 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tndg0-000778-D3; Thu, 27 Feb 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 898086.1306647; Thu, 27 Feb 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 1tndg0-000770-A4; Thu, 27 Feb 2025 13:11:44 +0000
Received: by outflank-mailman (input) for mailman id 898086;
 Thu, 27 Feb 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 1tndfy-00076n-Tf
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 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 1tndfz-008Pu2-0O
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 13:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tndfy-00CO8u-2a
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 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=jah1QTxQBggN8M8rzWysXFTOxszUmsUi4QW9bwDCw/U=; b=fm9HBrwIkBOS+gFl1U1ScOQQxb
	Sw8KhB86rzVPW1M8E3a4IK4l6pmpCjxjNDRvhhHuTRebksLDdm4afMmPYgfajxgi61AemkU6J/FlL
	XbBE5xyyqyp4LUk/JOuD6wBo2ejccIfTWq1RHc0Cfc3yHjnPkm+WbWrPH3vzuWWZuOXE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
Message-Id: <E1tndfy-00CO8u-2a@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 13:11:42 +0000

commit 574e42e3fbf32f3a4e03c1af6e4a1a2dc9628416
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 27 12:58:32 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 13:00:04 2025 +0000

    IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
    
    The function's use from set_msi_source_id() is guaranteed to be in an
    IRQs-off region. While the invocation of that function could be moved
    ahead in msi_msg_to_remap_entry() (doesn't need to be in the IOMMU-
    intremap-locked region), the call tree from map_domain_pirq() holds an
    IRQ descriptor lock. Hence all use sites of the lock need become IRQ-
    safe ones.
    
    In find_upstream_bridge() do a tiny bit of tidying in adjacent code:
    Change a variable's type to unsigned and merge a redundant assignment
    into another variable's initializer.
    
    This is XSA-467 / CVE-2025-1713.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 39bc6af3ba483282ed6bbf94b08aec38c93d39e6)
---
 xen/drivers/passthrough/pci.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 1b3d285166..cfe2934a6e 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -345,20 +345,21 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
     switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) )
     {
         unsigned int cap, sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
             {
                 pseg->bus2bridge[sec_bus].map = 1;
                 pseg->bus2bridge[sec_bus].bus = bus;
                 pseg->bus2bridge[sec_bus].devfn = devfn;
             }
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         case DEV_TYPE_PCIe_ENDPOINT:
@@ -429,16 +430,17 @@ static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
     switch ( pdev->type )
     {
         unsigned int sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
                 pseg->bus2bridge[sec_bus] = pseg->bus2bridge[pdev->bus];
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         default:
@@ -954,8 +956,9 @@ enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn)
 int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
 {
     struct pci_seg *pseg = get_pseg(seg);
-    int ret = 0;
-    int cnt = 0;
+    int ret = 1;
+    unsigned long flags;
+    unsigned int cnt = 0;
 
     if ( *bus == 0 )
         return 0;
@@ -966,8 +969,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     if ( !pseg->bus2bridge[*bus].map )
         return 0;
 
-    ret = 1;
-    spin_lock(&pseg->bus2bridge_lock);
+    spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
     while ( pseg->bus2bridge[*bus].map )
     {
         *secbus = *bus;
@@ -981,7 +983,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     }
 
 out:
-    spin_unlock(&pseg->bus2bridge_lock);
+    spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 13:44:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 13:44:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898105.1306673 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tneBH-0004YK-0T; Thu, 27 Feb 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 898105.1306673; Thu, 27 Feb 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 1tneBG-0004YD-UB; Thu, 27 Feb 2025 13:44:02 +0000
Received: by outflank-mailman (input) for mailman id 898105;
 Thu, 27 Feb 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 1tneBG-0004Y7-Cy
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 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 1tneBG-008QSj-1p
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 13:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tneBG-00CS8Z-0m
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 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=HLkvItsxECBCDkxiJKB3IOTQuLRaw1kbMfrk5VGS1Hs=; b=XJ6sntLvdh236aCkfEhXV//86S
	btgnDuieknOrrDyRSeHoRYjDs59oj4FqaRoKk+q416Xje3MmvlvAK9ioS72rG6tRjes11oW1EK3F8
	Bg6lkXZYCj+T14PnfANhoo8JOWJDbddvuPn+dZhLCdwVXrrFdySA3KIBEFFWHpZd+LtA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
Message-Id: <E1tneBG-00CS8Z-0m@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 13:44:02 +0000

commit 574e42e3fbf32f3a4e03c1af6e4a1a2dc9628416
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 27 12:58:32 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 13:00:04 2025 +0000

    IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
    
    The function's use from set_msi_source_id() is guaranteed to be in an
    IRQs-off region. While the invocation of that function could be moved
    ahead in msi_msg_to_remap_entry() (doesn't need to be in the IOMMU-
    intremap-locked region), the call tree from map_domain_pirq() holds an
    IRQ descriptor lock. Hence all use sites of the lock need become IRQ-
    safe ones.
    
    In find_upstream_bridge() do a tiny bit of tidying in adjacent code:
    Change a variable's type to unsigned and merge a redundant assignment
    into another variable's initializer.
    
    This is XSA-467 / CVE-2025-1713.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 39bc6af3ba483282ed6bbf94b08aec38c93d39e6)
---
 xen/drivers/passthrough/pci.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 1b3d285166..cfe2934a6e 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -345,20 +345,21 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
     switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) )
     {
         unsigned int cap, sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
             {
                 pseg->bus2bridge[sec_bus].map = 1;
                 pseg->bus2bridge[sec_bus].bus = bus;
                 pseg->bus2bridge[sec_bus].devfn = devfn;
             }
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         case DEV_TYPE_PCIe_ENDPOINT:
@@ -429,16 +430,17 @@ static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
     switch ( pdev->type )
     {
         unsigned int sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
                 pseg->bus2bridge[sec_bus] = pseg->bus2bridge[pdev->bus];
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         default:
@@ -954,8 +956,9 @@ enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn)
 int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
 {
     struct pci_seg *pseg = get_pseg(seg);
-    int ret = 0;
-    int cnt = 0;
+    int ret = 1;
+    unsigned long flags;
+    unsigned int cnt = 0;
 
     if ( *bus == 0 )
         return 0;
@@ -966,8 +969,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     if ( !pseg->bus2bridge[*bus].map )
         return 0;
 
-    ret = 1;
-    spin_lock(&pseg->bus2bridge_lock);
+    spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
     while ( pseg->bus2bridge[*bus].map )
     {
         *secbus = *bus;
@@ -981,7 +983,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     }
 
 out:
-    spin_unlock(&pseg->bus2bridge_lock);
+    spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 13:55:06 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 13:55:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898106.1306678 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tneLu-00067m-Pq; Thu, 27 Feb 2025 13:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 898106.1306678; Thu, 27 Feb 2025 13: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 1tneLu-00067e-NC; Thu, 27 Feb 2025 13:55:02 +0000
Received: by outflank-mailman (input) for mailman id 898106;
 Thu, 27 Feb 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 1tneLu-00067Y-7W
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 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 1tneLu-008Qgs-1E
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 13:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tneLu-00CTD0-04
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 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=RNQ5XJVfwMWGgGfiEqey9393D4fg5MgjENb0ALqB9MQ=; b=6iTs28TcpOD4dUJVs4w5wPhEpH
	0ykDuxagdjvezHgHMd3HjZYPVxsljVApbqdAsOV6so6HK+kwaQ9tV+B+0hhbWnIQH5g0LIdczP1Ij
	wjeRjKkk6hHqva143lIoNENdZzfLa4JIH/sBt4uE4rT4/3QXbIsnVtARaJeo9DQW3bzY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
Message-Id: <E1tneLu-00CTD0-04@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 13:55:02 +0000

commit 39bc6af3ba483282ed6bbf94b08aec38c93d39e6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 27 12:58:32 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 12:58:32 2025 +0000

    IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
    
    The function's use from set_msi_source_id() is guaranteed to be in an
    IRQs-off region. While the invocation of that function could be moved
    ahead in msi_msg_to_remap_entry() (doesn't need to be in the IOMMU-
    intremap-locked region), the call tree from map_domain_pirq() holds an
    IRQ descriptor lock. Hence all use sites of the lock need become IRQ-
    safe ones.
    
    In find_upstream_bridge() do a tiny bit of tidying in adjacent code:
    Change a variable's type to unsigned and merge a redundant assignment
    into another variable's initializer.
    
    This is XSA-467 / CVE-2025-1713.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/passthrough/pci.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index e1a09344df..ab25840e20 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -354,20 +354,21 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
     switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) )
     {
         unsigned int cap, sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
             {
                 pseg->bus2bridge[sec_bus].map = 1;
                 pseg->bus2bridge[sec_bus].bus = bus;
                 pseg->bus2bridge[sec_bus].devfn = devfn;
             }
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         case DEV_TYPE_PCIe_ENDPOINT:
@@ -437,16 +438,17 @@ static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
     switch ( pdev->type )
     {
         unsigned int sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
                 pseg->bus2bridge[sec_bus] = pseg->bus2bridge[pdev->bus];
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         default:
@@ -1053,8 +1055,9 @@ enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn)
 int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
 {
     struct pci_seg *pseg = get_pseg(seg);
-    int ret = 0;
-    int cnt = 0;
+    int ret = 1;
+    unsigned long flags;
+    unsigned int cnt = 0;
 
     if ( *bus == 0 )
         return 0;
@@ -1065,8 +1068,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     if ( !pseg->bus2bridge[*bus].map )
         return 0;
 
-    ret = 1;
-    spin_lock(&pseg->bus2bridge_lock);
+    spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
     while ( pseg->bus2bridge[*bus].map )
     {
         *secbus = *bus;
@@ -1080,7 +1082,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     }
 
 out:
-    spin_unlock(&pseg->bus2bridge_lock);
+    spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 14:33:08 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 14:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898152.1306724 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnewh-0005wZ-B1; Thu, 27 Feb 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 898152.1306724; Thu, 27 Feb 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 1tnewh-0005wR-8V; Thu, 27 Feb 2025 14:33:03 +0000
Received: by outflank-mailman (input) for mailman id 898152;
 Thu, 27 Feb 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 1tnewg-0005wL-2C
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 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 1tnewg-008RS6-0m
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 14:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnewf-00CWyy-31
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 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=YTf4sixb3AOvJkjc3+ATA6zipGfK36SXveO8S35osXQ=; b=tGFuYNgdev4B5cd3tYxoq/4Inx
	AdOqvCDpHLte378Cm/emSQ5zWo7/jjwKTu8XrwijAbLA2RAb2nP/dsKnvyS+LuK3KFPVhwoZF6T2O
	+snBXtJlU1mDQlrAaW6oMZJ6c4FtNldXOJbxlOqz1cAqGe6Jei7UgFa1dV4uwoKdAoew=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
Message-Id: <E1tnewf-00CWyy-31@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 14:33:01 +0000

commit 746df32732dcdb51d3af1a0070d3fdb8f8dd03b1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 27 12:58:32 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 13:00:01 2025 +0000

    IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
    
    The function's use from set_msi_source_id() is guaranteed to be in an
    IRQs-off region. While the invocation of that function could be moved
    ahead in msi_msg_to_remap_entry() (doesn't need to be in the IOMMU-
    intremap-locked region), the call tree from map_domain_pirq() holds an
    IRQ descriptor lock. Hence all use sites of the lock need become IRQ-
    safe ones.
    
    In find_upstream_bridge() do a tiny bit of tidying in adjacent code:
    Change a variable's type to unsigned and merge a redundant assignment
    into another variable's initializer.
    
    This is XSA-467 / CVE-2025-1713.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 39bc6af3ba483282ed6bbf94b08aec38c93d39e6)
---
 xen/drivers/passthrough/pci.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index b7afdccf23..25ea1dc421 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -349,20 +349,21 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
     switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) )
     {
         unsigned int cap, sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
             {
                 pseg->bus2bridge[sec_bus].map = 1;
                 pseg->bus2bridge[sec_bus].bus = bus;
                 pseg->bus2bridge[sec_bus].devfn = devfn;
             }
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         case DEV_TYPE_PCIe_ENDPOINT:
@@ -432,16 +433,17 @@ static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
     switch ( pdev->type )
     {
         unsigned int sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
                 pseg->bus2bridge[sec_bus] = pseg->bus2bridge[pdev->bus];
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         default:
@@ -957,8 +959,9 @@ enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn)
 int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
 {
     struct pci_seg *pseg = get_pseg(seg);
-    int ret = 0;
-    int cnt = 0;
+    int ret = 1;
+    unsigned long flags;
+    unsigned int cnt = 0;
 
     if ( *bus == 0 )
         return 0;
@@ -969,8 +972,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     if ( !pseg->bus2bridge[*bus].map )
         return 0;
 
-    ret = 1;
-    spin_lock(&pseg->bus2bridge_lock);
+    spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
     while ( pseg->bus2bridge[*bus].map )
     {
         *secbus = *bus;
@@ -984,7 +986,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     }
 
 out:
-    spin_unlock(&pseg->bus2bridge_lock);
+    spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 15:22:10 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 15:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898243.1306818 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnfi7-00030o-Po; Thu, 27 Feb 2025 15:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 898243.1306818; Thu, 27 Feb 2025 15: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 1tnfi7-00030g-NB; Thu, 27 Feb 2025 15:22:03 +0000
Received: by outflank-mailman (input) for mailman id 898243;
 Thu, 27 Feb 2025 15: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 1tnfi6-00030a-Ax
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 2025 15: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 1tnfi6-008SR6-1a
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 15:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnfi6-00CbnP-0e
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 15: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=BAGGPt9AL10iYIwsFXcSRUPYyY5YyMw+6bZByAeAmrU=; b=cc+LEjcVJqh9fdY5IbMTM6frTc
	OL1gxrJJYFYhqlYiitx2K2JfSmIWeM0x785C1mdQocpqGPxJF8acp38tjXWs052D0oM9fL5iv4KKs
	dfQZMt6Yu26D2KEK0kOhJ7rfjA+0NLf6v7m6NtvDFM/nkX6/dCIl+2EgIYdL+TtoY/ZY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
Message-Id: <E1tnfi6-00CbnP-0e@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 15:22:02 +0000

commit f2c5b4b1aa1972b522bfb5207f4b771681ef8fd2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 27 12:58:32 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 12:59:57 2025 +0000

    IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
    
    The function's use from set_msi_source_id() is guaranteed to be in an
    IRQs-off region. While the invocation of that function could be moved
    ahead in msi_msg_to_remap_entry() (doesn't need to be in the IOMMU-
    intremap-locked region), the call tree from map_domain_pirq() holds an
    IRQ descriptor lock. Hence all use sites of the lock need become IRQ-
    safe ones.
    
    In find_upstream_bridge() do a tiny bit of tidying in adjacent code:
    Change a variable's type to unsigned and merge a redundant assignment
    into another variable's initializer.
    
    This is XSA-467 / CVE-2025-1713.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 39bc6af3ba483282ed6bbf94b08aec38c93d39e6)
---
 xen/drivers/passthrough/pci.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index f4c8c505af..4d06e5d3f9 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -351,20 +351,21 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
     switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) )
     {
         unsigned int cap, sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
             {
                 pseg->bus2bridge[sec_bus].map = 1;
                 pseg->bus2bridge[sec_bus].bus = bus;
                 pseg->bus2bridge[sec_bus].devfn = devfn;
             }
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         case DEV_TYPE_PCIe_ENDPOINT:
@@ -434,16 +435,17 @@ static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
     switch ( pdev->type )
     {
         unsigned int sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
                 pseg->bus2bridge[sec_bus] = pseg->bus2bridge[pdev->bus];
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         default:
@@ -1067,8 +1069,9 @@ enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn)
 int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
 {
     struct pci_seg *pseg = get_pseg(seg);
-    int ret = 0;
-    int cnt = 0;
+    int ret = 1;
+    unsigned long flags;
+    unsigned int cnt = 0;
 
     if ( *bus == 0 )
         return 0;
@@ -1079,8 +1082,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     if ( !pseg->bus2bridge[*bus].map )
         return 0;
 
-    ret = 1;
-    spin_lock(&pseg->bus2bridge_lock);
+    spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
     while ( pseg->bus2bridge[*bus].map )
     {
         *secbus = *bus;
@@ -1094,7 +1096,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     }
 
 out:
-    spin_unlock(&pseg->bus2bridge_lock);
+    spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 21:11:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 21:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898422.1306974 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnl9q-0003yD-NG; Thu, 27 Feb 2025 21:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 898422.1306974; Thu, 27 Feb 2025 21: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 1tnl9q-0003xz-Jq; Thu, 27 Feb 2025 21:11:02 +0000
Received: by outflank-mailman (input) for mailman id 898422;
 Thu, 27 Feb 2025 21: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 1tnl9p-0003xp-PX
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 2025 21: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 1tnl9p-008a1z-34
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 21:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnl9p-00DJSP-29
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 21: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=n4uWZmLv+GWzujG8gWFr4z2xaPuLrwoOeX74qiR8WoQ=; b=0gcyKgm3hdBITnNEmQboC9d9GJ
	nJPHuqLpUYBwwoHpYF71deK9wc1xJKTULnB0Owm0Z26X15ePadqJtfewPq5c80ybAl9ssLIrzSeBD
	S/zLg8cQZYCJrmWuBfO2fqg2gakzPzWj2wmTHGO/0RZbmV7jfyeT/K3llYQhyayu4/Mk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Finalize changes in 4.20 release cycle
Message-Id: <E1tnl9p-00DJSP-29@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 21:11:01 +0000

commit 62698734fbadcb77f2a673d8b31a36dbf3f45fd8
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Feb 27 15:27:52 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 21:01:55 2025 +0000

    CHANGELOG.md: Finalize changes in 4.20 release cycle
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 CHANGELOG.md | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1979166820..111af1fb4c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Fixed blkif protocol specification for sector sizes different than 512b.
  - The dombuilder in libxenguest no longer un-gzips secondary modules, instead
    leaving this to the guest kernel to do in guest context.
+ - Reduce xenstore library dependencies.
+ - On Arm:
+   - Several FF-A support improvements: add indirect messages support, transmit
+     RXTX buffer to the SPMC, fix version negotication and partition information
+     retrieval.
  - On x86:
    - Prefer ACPI reboot over UEFI ResetSystem() run time service call.
    - Prefer CMOS over EFI_GET_TIME as time source.
@@ -25,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
      interrupts instead of logical destination mode.
 
 ### Added
+ - Enable CONFIG_UBSAN (Arm64, x86, PPC, RISC-V) for GitLab CI.
  - On Arm:
    - Experimental support for Armv8-R.
    - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
@@ -34,6 +40,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - On x86:
    - xl suspend/resume subcommands.
    - `wallclock` command line option to select time source.
+   - Support for Intel EPT Paging-Write Feature.
+   - AMD Zen 5 CPU support, including for new hardware mitigations for the
+     SRSO speculative vulnerability.
 
 ### Removed
  - On x86:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 21:11:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 21:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898423.1306977 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnlA0-0003zv-Nm; Thu, 27 Feb 2025 21:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 898423.1306977; Thu, 27 Feb 2025 21: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 1tnlA0-0003zn-LF; Thu, 27 Feb 2025 21:11:12 +0000
Received: by outflank-mailman (input) for mailman id 898423;
 Thu, 27 Feb 2025 21: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 1tnlA0-0003zU-2D
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 2025 21: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 1tnlA0-008a23-0s
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 21:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnl9z-00DJVy-38
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 21: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=GVlzBV15N3Z+FWjImPfwzI8eTTVQQZdO+TfErsTjK7I=; b=SO0aBIltzyqgvDH/yZfinzfGT2
	/0j15youxnXEkiXjzWyCAQBwdeKmdLE9TvrvXtLsGvVJOdBK35H25J/58Q8xECTHcyFWxNskno6F5
	Cs3uTURqHaEKqf2rzQluEaJoAdM9v7KVOPz2KfyQRLnVyVmclSCtWTrBkgqPLNlXsPK8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.20] CHANGELOG.md: Finalize changes in 4.20 release cycle
Message-Id: <E1tnl9z-00DJVy-38@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 21:11:11 +0000

commit 720499db05dae84eb019ba1cd638022ca9fc0036
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Feb 27 15:27:52 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 21:02:08 2025 +0000

    CHANGELOG.md: Finalize changes in 4.20 release cycle
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit d3a7d29d76fe4ca4f58164cbe20a6b2dd4500ab8)
---
 CHANGELOG.md | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1de1d1eca1..c10df7d969 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Fixed blkif protocol specification for sector sizes different than 512b.
  - The dombuilder in libxenguest no longer un-gzips secondary modules, instead
    leaving this to the guest kernel to do in guest context.
+ - Reduce xenstore library dependencies.
+ - On Arm:
+   - Several FF-A support improvements: add indirect messages support, transmit
+     RXTX buffer to the SPMC, fix version negotication and partition information
+     retrieval.
  - On x86:
    - Prefer ACPI reboot over UEFI ResetSystem() run time service call.
    - Prefer CMOS over EFI_GET_TIME as time source.
@@ -17,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
      interrupts instead of logical destination mode.
 
 ### Added
+ - Enable CONFIG_UBSAN (Arm64, x86, PPC, RISC-V) for GitLab CI.
  - On Arm:
    - Experimental support for Armv8-R.
    - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
@@ -26,6 +32,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - On x86:
    - xl suspend/resume subcommands.
    - `wallclock` command line option to select time source.
+   - Support for Intel EPT Paging-Write Feature.
+   - AMD Zen 5 CPU support, including for new hardware mitigations for the
+     SRSO speculative vulnerability.
 
 ### Removed
  - On x86:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 22:00:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 22:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898436.1306991 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnlvH-0002uu-8z; Thu, 27 Feb 2025 22:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 898436.1306991; Thu, 27 Feb 2025 22: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 1tnlvH-0002um-5h; Thu, 27 Feb 2025 22:00:03 +0000
Received: by outflank-mailman (input) for mailman id 898436;
 Thu, 27 Feb 2025 22: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 1tnlvG-0002hh-3v
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 2025 22: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 1tnlvG-008b1u-0i
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 22:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnlvF-00DOLc-2x
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 22: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=jWhC6tYHlDnTvCYdWzfg6xjCmoN4YouOMYHW08G1dXw=; b=TMo3PTlS0VOWKXQjeqdxh2P3Ww
	hhfhM3PUDtHdPHUqWhubqS7E76kV3QJYzsuP9H9VbMPJoPfh+YW3iracXJYNm0rxSyIgqvRAT2LGI
	E6WFpd6UU+EOMFyrOL42VeqGyYMc0Om4VLdocHs/fgpTvSXNPi83gbKk7jSWYL+jWcqg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Finalize changes in 4.20 release cycle
Message-Id: <E1tnlvF-00DOLc-2x@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 22:00:01 +0000

commit 62698734fbadcb77f2a673d8b31a36dbf3f45fd8
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Feb 27 15:27:52 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 21:01:55 2025 +0000

    CHANGELOG.md: Finalize changes in 4.20 release cycle
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 CHANGELOG.md | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1979166820..111af1fb4c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Fixed blkif protocol specification for sector sizes different than 512b.
  - The dombuilder in libxenguest no longer un-gzips secondary modules, instead
    leaving this to the guest kernel to do in guest context.
+ - Reduce xenstore library dependencies.
+ - On Arm:
+   - Several FF-A support improvements: add indirect messages support, transmit
+     RXTX buffer to the SPMC, fix version negotication and partition information
+     retrieval.
  - On x86:
    - Prefer ACPI reboot over UEFI ResetSystem() run time service call.
    - Prefer CMOS over EFI_GET_TIME as time source.
@@ -25,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
      interrupts instead of logical destination mode.
 
 ### Added
+ - Enable CONFIG_UBSAN (Arm64, x86, PPC, RISC-V) for GitLab CI.
  - On Arm:
    - Experimental support for Armv8-R.
    - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
@@ -34,6 +40,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - On x86:
    - xl suspend/resume subcommands.
    - `wallclock` command line option to select time source.
+   - Support for Intel EPT Paging-Write Feature.
+   - AMD Zen 5 CPU support, including for new hardware mitigations for the
+     SRSO speculative vulnerability.
 
 ### Removed
  - On x86:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 22:44:07 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 22:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898437.1306995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnmbr-0002Er-3X; Thu, 27 Feb 2025 22:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 898437.1306995; Thu, 27 Feb 2025 22: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 1tnmbr-0002Ej-0s; Thu, 27 Feb 2025 22:44:03 +0000
Received: by outflank-mailman (input) for mailman id 898437;
 Thu, 27 Feb 2025 22: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 1tnmbq-0002Ed-8F
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 2025 22: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 1tnmbq-008c9m-1R
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 22:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnmbq-00DSo2-0F
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 22: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=kqybBj2cBOrv498D08h9jq6ECAQk7FM3VHjB/wloLzg=; b=oPOHf5X3jEe3g1rYR7m1UMOKKG
	IRwPqITITmQnCQShlCcJDiyXGeiEJqKzwhUpMKDDZZ8iEJjEL5pZiggnG55Yh3isvMBNiXtAEWj8k
	/IxMJ6yLnDfXs1dhZdgGzBi2ALCcJ9AVgLquhi/J9o9LHINnsA9ZTQ14Yhu6Od8CVQA8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
Message-Id: <E1tnmbq-00DSo2-0F@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 22:44:02 +0000

commit c0a7c96182710106bdc8ba79ae2e3ec22cbede8c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 27 12:58:32 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 12:59:50 2025 +0000

    IOMMU/x86: the bus-to-bridge lock needs to be acquired IRQ-safe
    
    The function's use from set_msi_source_id() is guaranteed to be in an
    IRQs-off region. While the invocation of that function could be moved
    ahead in msi_msg_to_remap_entry() (doesn't need to be in the IOMMU-
    intremap-locked region), the call tree from map_domain_pirq() holds an
    IRQ descriptor lock. Hence all use sites of the lock need become IRQ-
    safe ones.
    
    In find_upstream_bridge() do a tiny bit of tidying in adjacent code:
    Change a variable's type to unsigned and merge a redundant assignment
    into another variable's initializer.
    
    This is XSA-467 / CVE-2025-1713.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 39bc6af3ba483282ed6bbf94b08aec38c93d39e6)
---
 xen/drivers/passthrough/pci.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index e1a09344df..ab25840e20 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -354,20 +354,21 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
     switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) )
     {
         unsigned int cap, sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
             {
                 pseg->bus2bridge[sec_bus].map = 1;
                 pseg->bus2bridge[sec_bus].bus = bus;
                 pseg->bus2bridge[sec_bus].devfn = devfn;
             }
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         case DEV_TYPE_PCIe_ENDPOINT:
@@ -437,16 +438,17 @@ static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
     switch ( pdev->type )
     {
         unsigned int sec_bus, sub_bus;
+        unsigned long flags;
 
         case DEV_TYPE_PCIe2PCI_BRIDGE:
         case DEV_TYPE_LEGACY_PCI_BRIDGE:
             sec_bus = pci_conf_read8(pdev->sbdf, PCI_SECONDARY_BUS);
             sub_bus = pci_conf_read8(pdev->sbdf, PCI_SUBORDINATE_BUS);
 
-            spin_lock(&pseg->bus2bridge_lock);
+            spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
             for ( ; sec_bus <= sub_bus; sec_bus++ )
                 pseg->bus2bridge[sec_bus] = pseg->bus2bridge[pdev->bus];
-            spin_unlock(&pseg->bus2bridge_lock);
+            spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
             break;
 
         default:
@@ -1053,8 +1055,9 @@ enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn)
 int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
 {
     struct pci_seg *pseg = get_pseg(seg);
-    int ret = 0;
-    int cnt = 0;
+    int ret = 1;
+    unsigned long flags;
+    unsigned int cnt = 0;
 
     if ( *bus == 0 )
         return 0;
@@ -1065,8 +1068,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     if ( !pseg->bus2bridge[*bus].map )
         return 0;
 
-    ret = 1;
-    spin_lock(&pseg->bus2bridge_lock);
+    spin_lock_irqsave(&pseg->bus2bridge_lock, flags);
     while ( pseg->bus2bridge[*bus].map )
     {
         *secbus = *bus;
@@ -1080,7 +1082,7 @@ int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
     }
 
 out:
-    spin_unlock(&pseg->bus2bridge_lock);
+    spin_unlock_irqrestore(&pseg->bus2bridge_lock, flags);
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Thu Feb 27 22:44:14 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 27 Feb 2025 22:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898438.1307001 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnmc2-0002GX-5h; Thu, 27 Feb 2025 22:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 898438.1307001; Thu, 27 Feb 2025 22:44: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 1tnmc2-0002GN-2S; Thu, 27 Feb 2025 22:44:14 +0000
Received: by outflank-mailman (input) for mailman id 898438;
 Thu, 27 Feb 2025 22: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 1tnmc0-0002G7-Ca
 for xen-changelog@lists.xenproject.org; Thu, 27 Feb 2025 22: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 1tnmc0-008cA1-1r
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 22:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnmc0-00DSoy-0r
 for xen-changelog@lists.xenproject.org;
 Thu, 27 Feb 2025 22: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=J3qOJNQbpuSFSZOF9gjOUeWSPeEN8LWunjEwgtnlrpQ=; b=vF/7B22mNPyVQ5wFOJELFb7vwR
	LRB6LdAPufNicMSb9bB369eIU6YgUlCAm3NjGO3zbit7cayjdRPfqwDLOPxVHt2Qs/jmAp+vW8wc5
	nP0FmmctZHBarPH0fo7xkUk5h7jN49/D/crYO2H2NZCf1TjlZBL8M37Lp68jiPrk8tAo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.20] CHANGELOG.md: Finalize changes in 4.20 release cycle
Message-Id: <E1tnmc0-00DSoy-0r@xenbits.xenproject.org>
Date: Thu, 27 Feb 2025 22:44:12 +0000

commit 720499db05dae84eb019ba1cd638022ca9fc0036
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Feb 27 15:27:52 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 21:02:08 2025 +0000

    CHANGELOG.md: Finalize changes in 4.20 release cycle
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit d3a7d29d76fe4ca4f58164cbe20a6b2dd4500ab8)
---
 CHANGELOG.md | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1de1d1eca1..c10df7d969 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Fixed blkif protocol specification for sector sizes different than 512b.
  - The dombuilder in libxenguest no longer un-gzips secondary modules, instead
    leaving this to the guest kernel to do in guest context.
+ - Reduce xenstore library dependencies.
+ - On Arm:
+   - Several FF-A support improvements: add indirect messages support, transmit
+     RXTX buffer to the SPMC, fix version negotication and partition information
+     retrieval.
  - On x86:
    - Prefer ACPI reboot over UEFI ResetSystem() run time service call.
    - Prefer CMOS over EFI_GET_TIME as time source.
@@ -17,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
      interrupts instead of logical destination mode.
 
 ### Added
+ - Enable CONFIG_UBSAN (Arm64, x86, PPC, RISC-V) for GitLab CI.
  - On Arm:
    - Experimental support for Armv8-R.
    - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
@@ -26,6 +32,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - On x86:
    - xl suspend/resume subcommands.
    - `wallclock` command line option to select time source.
+   - Support for Intel EPT Paging-Write Feature.
+   - AMD Zen 5 CPU support, including for new hardware mitigations for the
+     SRSO speculative vulnerability.
 
 ### Removed
  - On x86:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20


From xen-changelog-bounces@lists.xenproject.org Fri Feb 28 00:44:09 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Feb 2025 00:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898454.1307013 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnoTy-0003t4-K9; Fri, 28 Feb 2025 00:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 898454.1307013; Fri, 28 Feb 2025 00: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 1tnoTy-0003sx-H9; Fri, 28 Feb 2025 00:44:02 +0000
Received: by outflank-mailman (input) for mailman id 898454;
 Fri, 28 Feb 2025 00: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 1tnoTx-0003sr-KS
 for xen-changelog@lists.xenproject.org; Fri, 28 Feb 2025 00: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 1tnoTx-008fCh-2X
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Feb 2025 00:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnoTx-00DgSX-1a
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Feb 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=4eTo68i4PqJjsWzlqup6rMGP1LEKcqvRdkND1PaoBKg=; b=qybC1dM7vZTada5BHYXnkV4WI6
	HZLida1ybN2OvLGt268Cc/GrCj9N3fkcMVYj6VjG6hIze2BUimc2CNfMB18QWoFmbsXv6S8Xy8Bsa
	TkBP8arcM0sLftzNKC++l6Jl3YFUJ7x8X/LLnj5BoK9KEZ4q+uDG3IImuQoismx7wLok=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bsearch: Split out of lib.h into it's own header
Message-Id: <E1tnoTx-00DgSX-1a@xenbits.xenproject.org>
Date: Fri, 28 Feb 2025 00:44:01 +0000

commit 31c0d6fdf421b09327448351eb13bc4f1f40106b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 23 15:11:47 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 23:48:56 2025 +0000

    xen/bsearch: Split out of lib.h into it's own header
    
    There are currently two users, and lib.h is included everywhere.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/io.c             |  1 +
 xen/arch/arm/vgic/vgic-mmio.c |  1 +
 xen/include/xen/bsearch.h     | 50 +++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/lib.h         | 43 -------------------------------------
 xen/lib/bsearch.c             |  2 +-
 5 files changed, 53 insertions(+), 44 deletions(-)

diff --git a/xen/arch/arm/io.c b/xen/arch/arm/io.c
index 96c740d563..653428e16c 100644
--- a/xen/arch/arm/io.c
+++ b/xen/arch/arm/io.c
@@ -7,6 +7,7 @@
  * Copyright (c) 2011 Citrix Systems.
  */
 
+#include <xen/bsearch.h>
 #include <xen/ioreq.h>
 #include <xen/lib.h>
 #include <xen/spinlock.h>
diff --git a/xen/arch/arm/vgic/vgic-mmio.c b/xen/arch/arm/vgic/vgic-mmio.c
index bd4caf7fc3..4ad350c21c 100644
--- a/xen/arch/arm/vgic/vgic-mmio.c
+++ b/xen/arch/arm/vgic/vgic-mmio.c
@@ -13,6 +13,7 @@
  */
 
 #include <xen/bitops.h>
+#include <xen/bsearch.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <asm/new_vgic.h>
diff --git a/xen/include/xen/bsearch.h b/xen/include/xen/bsearch.h
new file mode 100644
index 0000000000..544fe83e2c
--- /dev/null
+++ b/xen/include/xen/bsearch.h
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef XEN_BSEARCH_H
+#define XEN_BSEARCH_H
+
+#include <xen/types.h>
+
+/*
+ * bsearch - binary search an array of elements
+ * @key: pointer to item being searched for
+ * @base: pointer to first element to search
+ * @num: number of elements
+ * @size: size of each element
+ * @cmp: pointer to comparison function
+ *
+ * This function does a binary search on the given array.  The
+ * contents of the array should already be in ascending sorted order
+ * under the provided comparison function.
+ *
+ * Note that the key need not have the same type as the elements in
+ * the array, e.g. key could be a string and the comparison function
+ * could compare the string with the struct's name field.  However, if
+ * the key and elements in the array are of the same type, you can use
+ * the same comparison function for both sort() and bsearch().
+ */
+#ifndef BSEARCH_IMPLEMENTATION
+extern gnu_inline
+#endif
+void *bsearch(const void *key, const void *base, size_t num, size_t size,
+              int (*cmp)(const void *key, const void *elt))
+{
+    size_t start = 0, end = num;
+    int result;
+
+    while ( start < end )
+    {
+        size_t mid = start + (end - start) / 2;
+
+        result = cmp(key, base + mid * size);
+        if ( result < 0 )
+            end = mid;
+        else if ( result > 0 )
+            start = mid + 1;
+        else
+            return (void *)base + mid * size;
+    }
+
+    return NULL;
+}
+
+#endif /* XEN_BSEARCH_H */
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 77122606ed..e63ec5039f 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -162,49 +162,6 @@ void cf_check dump_execstate(const struct cpu_user_regs *regs);
 
 void init_constructors(void);
 
-/*
- * bsearch - binary search an array of elements
- * @key: pointer to item being searched for
- * @base: pointer to first element to search
- * @num: number of elements
- * @size: size of each element
- * @cmp: pointer to comparison function
- *
- * This function does a binary search on the given array.  The
- * contents of the array should already be in ascending sorted order
- * under the provided comparison function.
- *
- * Note that the key need not have the same type as the elements in
- * the array, e.g. key could be a string and the comparison function
- * could compare the string with the struct's name field.  However, if
- * the key and elements in the array are of the same type, you can use
- * the same comparison function for both sort() and bsearch().
- */
-#ifndef BSEARCH_IMPLEMENTATION
-extern gnu_inline
-#endif
-void *bsearch(const void *key, const void *base, size_t num, size_t size,
-              int (*cmp)(const void *key, const void *elt))
-{
-    size_t start = 0, end = num;
-    int result;
-
-    while ( start < end )
-    {
-        size_t mid = start + (end - start) / 2;
-
-        result = cmp(key, base + mid * size);
-        if ( result < 0 )
-            end = mid;
-        else if ( result > 0 )
-            start = mid + 1;
-        else
-            return (void *)base + mid * size;
-    }
-
-    return NULL;
-}
-
 #endif /* __ASSEMBLY__ */
 
 #endif /* __LIB_H__ */
diff --git a/xen/lib/bsearch.c b/xen/lib/bsearch.c
index 149f7feafd..9973117d1d 100644
--- a/xen/lib/bsearch.c
+++ b/xen/lib/bsearch.c
@@ -10,4 +10,4 @@
  */
 
 #define BSEARCH_IMPLEMENTATION
-#include <xen/lib.h>
+#include <xen/bsearch.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 28 11:11:12 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Feb 2025 11:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898631.1307150 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnyGk-0006km-NS; Fri, 28 Feb 2025 11:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 898631.1307150; Fri, 28 Feb 2025 11: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 1tnyGk-0006kc-K6; Fri, 28 Feb 2025 11:11:02 +0000
Received: by outflank-mailman (input) for mailman id 898631;
 Fri, 28 Feb 2025 11: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 1tnyGj-0006kR-KP
 for xen-changelog@lists.xenproject.org; Fri, 28 Feb 2025 11: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 1tnyGj-00AGlA-2J
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Feb 2025 11:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnyGj-00ErRp-1N
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Feb 2025 11: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=qmjAfy3MZhegz7m8YgwjbEM9j4ly42JEIC9xMKBZAKM=; b=X4sg8W3guPNjUxVC3HMZ191X5V
	dSyg/b9KTlaAQnvTf18jGL3qkEcU9mDB7ASpNes7swyX3+xN1k8KoPOkYQPPtN3mtltCvE76OwZXu
	oDSLztcfBKjz7rPyey8pgf4l1VwmdlffLgkIzYM0RdL4dO1fEyjKCBsA3Ttr/x66Gr6Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MISRA: Update path for bsearch devation
Message-Id: <E1tnyGj-00ErRp-1N@xenbits.xenproject.org>
Date: Fri, 28 Feb 2025 11:11:01 +0000

commit e95dc03717b8ae00de2a0b41b88905af6170b210
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 28 09:58:51 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 28 11:03:02 2025 +0000

    MISRA: Update path for bsearch devation
    
    This ought to have been part of the original patch, so as to avoid breaking
    CI.
    
    Fixes: 31c0d6fdf421 ("xen/bsearch: Split out of lib.h into it's own header")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index a28eb0ae76..dfa5f34b39 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -231,7 +231,7 @@ Therefore the absence of prior declarations is safe."
 
 -doc_begin="Given that bsearch and sort are defined with the attribute 'gnu_inline', it's deliberate not to have a prior declaration.
 See Section \"6.33.1 Common Function Attributes\" of \"GCC_MANUAL\" for a full explanation of gnu_inline."
--file_tag+={bsearch_sort, "^xen/include/xen/(sort|lib)\\.h$"}
+-file_tag+={bsearch_sort, "^xen/include/xen/(sort|bsearch)\\.h$"}
 -config=MC3A2.R8.4,reports+={deliberate, "any_area(any_loc(file(bsearch_sort))&&decl(name(bsearch||sort)))"}
 -doc_end
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 28 12:22:11 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Feb 2025 12:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898704.1307204 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnzNT-0005kQ-2g; Fri, 28 Feb 2025 12:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 898704.1307204; Fri, 28 Feb 2025 12: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 1tnzNT-0005kI-00; Fri, 28 Feb 2025 12:22:03 +0000
Received: by outflank-mailman (input) for mailman id 898704;
 Fri, 28 Feb 2025 12: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 1tnzNR-0005kC-PX
 for xen-changelog@lists.xenproject.org; Fri, 28 Feb 2025 12: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 1tnzNR-00AI61-36
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Feb 2025 12:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnzNR-00EzmD-2D
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Feb 2025 12: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=ypj7DoI/Fa1RZ2yojf4KQ2ji7EYPTHS95koym9hypk8=; b=ktua/X1JHf1pGtgQxVphiOXAIu
	YQG81HY7crQ2UR7JWEejKpACNsNyKlzmPDfo4LrIrsXOqDKXmO60WKLcHvDl8NuReUVzbBJqa8zJP
	Te4KaaSeg57EMAut3sSooecQU8kMye0Rz+UFk73MvXpWUpuR23a3cHqgXeReuZRJ/3NM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bsearch: Split out of lib.h into it's own header
Message-Id: <E1tnzNR-00EzmD-2D@xenbits.xenproject.org>
Date: Fri, 28 Feb 2025 12:22:01 +0000

commit 31c0d6fdf421b09327448351eb13bc4f1f40106b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jan 23 15:11:47 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 27 23:48:56 2025 +0000

    xen/bsearch: Split out of lib.h into it's own header
    
    There are currently two users, and lib.h is included everywhere.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/io.c             |  1 +
 xen/arch/arm/vgic/vgic-mmio.c |  1 +
 xen/include/xen/bsearch.h     | 50 +++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/lib.h         | 43 -------------------------------------
 xen/lib/bsearch.c             |  2 +-
 5 files changed, 53 insertions(+), 44 deletions(-)

diff --git a/xen/arch/arm/io.c b/xen/arch/arm/io.c
index 96c740d563..653428e16c 100644
--- a/xen/arch/arm/io.c
+++ b/xen/arch/arm/io.c
@@ -7,6 +7,7 @@
  * Copyright (c) 2011 Citrix Systems.
  */
 
+#include <xen/bsearch.h>
 #include <xen/ioreq.h>
 #include <xen/lib.h>
 #include <xen/spinlock.h>
diff --git a/xen/arch/arm/vgic/vgic-mmio.c b/xen/arch/arm/vgic/vgic-mmio.c
index bd4caf7fc3..4ad350c21c 100644
--- a/xen/arch/arm/vgic/vgic-mmio.c
+++ b/xen/arch/arm/vgic/vgic-mmio.c
@@ -13,6 +13,7 @@
  */
 
 #include <xen/bitops.h>
+#include <xen/bsearch.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <asm/new_vgic.h>
diff --git a/xen/include/xen/bsearch.h b/xen/include/xen/bsearch.h
new file mode 100644
index 0000000000..544fe83e2c
--- /dev/null
+++ b/xen/include/xen/bsearch.h
@@ -0,0 +1,50 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef XEN_BSEARCH_H
+#define XEN_BSEARCH_H
+
+#include <xen/types.h>
+
+/*
+ * bsearch - binary search an array of elements
+ * @key: pointer to item being searched for
+ * @base: pointer to first element to search
+ * @num: number of elements
+ * @size: size of each element
+ * @cmp: pointer to comparison function
+ *
+ * This function does a binary search on the given array.  The
+ * contents of the array should already be in ascending sorted order
+ * under the provided comparison function.
+ *
+ * Note that the key need not have the same type as the elements in
+ * the array, e.g. key could be a string and the comparison function
+ * could compare the string with the struct's name field.  However, if
+ * the key and elements in the array are of the same type, you can use
+ * the same comparison function for both sort() and bsearch().
+ */
+#ifndef BSEARCH_IMPLEMENTATION
+extern gnu_inline
+#endif
+void *bsearch(const void *key, const void *base, size_t num, size_t size,
+              int (*cmp)(const void *key, const void *elt))
+{
+    size_t start = 0, end = num;
+    int result;
+
+    while ( start < end )
+    {
+        size_t mid = start + (end - start) / 2;
+
+        result = cmp(key, base + mid * size);
+        if ( result < 0 )
+            end = mid;
+        else if ( result > 0 )
+            start = mid + 1;
+        else
+            return (void *)base + mid * size;
+    }
+
+    return NULL;
+}
+
+#endif /* XEN_BSEARCH_H */
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 77122606ed..e63ec5039f 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -162,49 +162,6 @@ void cf_check dump_execstate(const struct cpu_user_regs *regs);
 
 void init_constructors(void);
 
-/*
- * bsearch - binary search an array of elements
- * @key: pointer to item being searched for
- * @base: pointer to first element to search
- * @num: number of elements
- * @size: size of each element
- * @cmp: pointer to comparison function
- *
- * This function does a binary search on the given array.  The
- * contents of the array should already be in ascending sorted order
- * under the provided comparison function.
- *
- * Note that the key need not have the same type as the elements in
- * the array, e.g. key could be a string and the comparison function
- * could compare the string with the struct's name field.  However, if
- * the key and elements in the array are of the same type, you can use
- * the same comparison function for both sort() and bsearch().
- */
-#ifndef BSEARCH_IMPLEMENTATION
-extern gnu_inline
-#endif
-void *bsearch(const void *key, const void *base, size_t num, size_t size,
-              int (*cmp)(const void *key, const void *elt))
-{
-    size_t start = 0, end = num;
-    int result;
-
-    while ( start < end )
-    {
-        size_t mid = start + (end - start) / 2;
-
-        result = cmp(key, base + mid * size);
-        if ( result < 0 )
-            end = mid;
-        else if ( result > 0 )
-            start = mid + 1;
-        else
-            return (void *)base + mid * size;
-    }
-
-    return NULL;
-}
-
 #endif /* __ASSEMBLY__ */
 
 #endif /* __LIB_H__ */
diff --git a/xen/lib/bsearch.c b/xen/lib/bsearch.c
index 149f7feafd..9973117d1d 100644
--- a/xen/lib/bsearch.c
+++ b/xen/lib/bsearch.c
@@ -10,4 +10,4 @@
  */
 
 #define BSEARCH_IMPLEMENTATION
-#include <xen/lib.h>
+#include <xen/bsearch.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 28 12:22:13 2025
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 28 Feb 2025 12:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.898705.1307208 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tnzNd-0005mr-40; Fri, 28 Feb 2025 12:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 898705.1307208; Fri, 28 Feb 2025 12: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 1tnzNd-0005mk-1P; Fri, 28 Feb 2025 12:22:13 +0000
Received: by outflank-mailman (input) for mailman id 898705;
 Fri, 28 Feb 2025 12: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 1tnzNb-0005ma-S3
 for xen-changelog@lists.xenproject.org; Fri, 28 Feb 2025 12: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 1tnzNc-00AI6K-0E
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Feb 2025 12:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tnzNb-00EznJ-2W
 for xen-changelog@lists.xenproject.org;
 Fri, 28 Feb 2025 12: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=xouthlmLTa0vzsiNox5BfjITKAPYwZJgarKpLo1J/lE=; b=fkOm4EFomEHIx1riqPgR6j/Pic
	ptZ8GD+aQk3LamubuptmlFPaJywzNxbF2s1hXsCP2nJprGoComHdcj97igI4pfAFd7dqnFOBebr/W
	lN1ZcWzpqIAru+3LFqHlk302V+KwFrYbLlRommlvbdEbCIB0MWzmURQGDpMqqqCnLGZA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MISRA: Update path for bsearch devation
Message-Id: <E1tnzNb-00EznJ-2W@xenbits.xenproject.org>
Date: Fri, 28 Feb 2025 12:22:11 +0000

commit e95dc03717b8ae00de2a0b41b88905af6170b210
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 28 09:58:51 2025 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 28 11:03:02 2025 +0000

    MISRA: Update path for bsearch devation
    
    This ought to have been part of the original patch, so as to avoid breaking
    CI.
    
    Fixes: 31c0d6fdf421 ("xen/bsearch: Split out of lib.h into it's own header")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index a28eb0ae76..dfa5f34b39 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -231,7 +231,7 @@ Therefore the absence of prior declarations is safe."
 
 -doc_begin="Given that bsearch and sort are defined with the attribute 'gnu_inline', it's deliberate not to have a prior declaration.
 See Section \"6.33.1 Common Function Attributes\" of \"GCC_MANUAL\" for a full explanation of gnu_inline."
--file_tag+={bsearch_sort, "^xen/include/xen/(sort|lib)\\.h$"}
+-file_tag+={bsearch_sort, "^xen/include/xen/(sort|bsearch)\\.h$"}
 -config=MC3A2.R8.4,reports+={deliberate, "any_area(any_loc(file(bsearch_sort))&&decl(name(bsearch||sort)))"}
 -doc_end
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


