From xen-changelog-bounces@lists.xenproject.org Fri Dec 02 07:22:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Dec 2022 07:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.451502.709250 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p10N0-0006Wu-LT; Fri, 02 Dec 2022 07:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 451502.709250; Fri, 02 Dec 2022 07:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p10N0-0006Wm-IY; Fri, 02 Dec 2022 07:22:02 +0000
Received: by outflank-mailman (input) for mailman id 451502;
 Fri, 02 Dec 2022 07:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p10Mz-0006Wg-Vv
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 07:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p10Mz-0002eh-V2
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 07:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p10Mz-0003ki-TJ
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H/Lvqh1yt65X4Fd+59usb6/lLAu+W+ad9ugeHJfZIb8=; b=URZtJzVtPI4QHCbYgRx3HZewxX
	eeVZhxv7F9bGxNd0mMheEdxJFCAI0ove/NYU7ixSchl6Z0N1gwVwUpvUa5bnttHm7q/5WhjQwV0CM
	8fED0q89SA1GLmDXIcGbaKao70EIEDiV7eP51CkGnYhkB5KLGwDVVRE8G+2NeV7blmvQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG: Add missing entries for work during the 4.17 release
Message-Id: <E1p10Mz-0003ki-TJ@xenbits.xenproject.org>
Date: Fri, 02 Dec 2022 07:22:01 +0000

commit 991f5037c88469756867e843ca8ea580ae56a39c
Author:     Henry Wang <Henry.Wang@arm.com>
AuthorDate: Thu Nov 24 10:50:39 2022 +0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 1 10:42:03 2022 +0000

    CHANGELOG: Add missing entries for work during the 4.17 release
    
    Signed-off-by: Henry Wang <Henry.Wang@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 CHANGELOG.md | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index adbbb216fa..55dd535e29 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,16 +4,44 @@ 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/)
 
-## [unstable UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
+## [4.17.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging)
 
 ### Changed
  - On x86 "vga=current" can now be used together with GrUB2's gfxpayload setting. Note that
    this requires use of "multiboot2" (and "module2") as the GrUB commands loading Xen.
+ - The "gnttab" option now has a new command line sub-option for disabling the
+   GNTTABOP_transfer functionality.
+ - The x86 MCE command line option info is now updated.
 
 ### Added / support upgraded
+ - Out-of-tree builds for the hypervisor now supported.
+ - The project has officially adopted 4 directives and 24 rules of MISRA-C,
+   added MISRA-C checker build integration, and defined how to document
+   deviations.
  - IOMMU superpage support on x86, affecting PV guests as well as HVM/PVH ones
    when they don't share page tables with the CPU (HAP / EPT / NPT).
- - Support VIRT_SSBD feature for HVM guests on AMD.
+ - Support for VIRT_SSBD and MSR_SPEC_CTRL for HVM guests on AMD.
+ - Improved TSC, CPU, and APIC clock frequency calibration on x86.
+ - Add mwait-idle support for SPR and ADL on x86.
+ - Extend security support for hosts to 12 TiB of memory on x86.
+ - Add command line option to set cpuid parameters for dom0 at boot time on x86.
+ - Improved static configuration options on Arm.
+ - cpupools can be specified at boot using device tree on Arm.
+ - It is possible to use PV drivers with dom0less guests, allowing statically
+   booted dom0less guests with PV devices.
+ - On Arm, p2m structures are now allocated out of a pool of memory set aside at
+   domain creation.
+ - Improved mitigations against Spectre-BHB on Arm.
+ - Support VirtIO-MMIO devices device-tree binding creation in toolstack on Arm.
+ - Allow setting the number of CPUs to activate at runtime from command line
+   option on Arm.
+ - Grant-table support on Arm was improved and hardened by implementing
+   "simplified M2P-like approach for the xenheap pages"
+ - Add Renesas R-Car Gen4 IPMMU-VMSA support on Arm.
+ - Add i.MX lpuart and i.MX8QM support on Arm.
+ - Improved toolstack build system.
+ - Add Xue - console over USB 3 Debug Capability.
+ - gitlab-ci automation: Fixes and improvements together with new tests.
 
 ### Removed / support downgraded
  - dropped support for the (x86-only) "vesa-mtrr" and "vesa-remap" command line options
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 02 07:22:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Dec 2022 07:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.451503.709254 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p10NA-0006ZK-Mz; Fri, 02 Dec 2022 07:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 451503.709254; Fri, 02 Dec 2022 07:22:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p10NA-0006ZC-KB; Fri, 02 Dec 2022 07:22:12 +0000
Received: by outflank-mailman (input) for mailman id 451503;
 Fri, 02 Dec 2022 07:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p10NA-0006Z6-37
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 07:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p10NA-0002el-1z
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 07:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p10NA-0003mm-11
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 07:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XYumDCm6A84oRkAS5A96WMSh9fc0ngZRFxZvc3PEC6w=; b=kmoACRjgMdH/kegUIfAzuxIfY5
	XmmGVrRjiLRYrJjlKUDeSbq2FVJS451xgkK3e+kQwyMzvriAIFyv5mM5mUyQBtQ7J0DskOiAVa3by
	h4Gw8xJjzgzwCKQLdlWnzgy0/1mLRd9uSegGFLQRN7e50WvkqwwO7SaW/xmOWkPnrzdc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Changelog: Add __ro_after_init and CET
Message-Id: <E1p10NA-0003mm-11@xenbits.xenproject.org>
Date: Fri, 02 Dec 2022 07:22:12 +0000

commit e5f93e02694f6c871578e8194645e361a2860abb
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Nov 24 10:50:40 2022 +0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 1 10:42:03 2022 +0000

    Changelog: Add __ro_after_init and CET
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Henry Wang <Henry.Wang@arm.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 CHANGELOG.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 55dd535e29..5d686a4258 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
 ### Added / support upgraded
  - Out-of-tree builds for the hypervisor now supported.
+ - __ro_after_init support, for marking data as immutable after boot.
  - The project has officially adopted 4 directives and 24 rules of MISRA-C,
    added MISRA-C checker build integration, and defined how to document
    deviations.
@@ -22,6 +23,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    when they don't share page tables with the CPU (HAP / EPT / NPT).
  - Support for VIRT_SSBD and MSR_SPEC_CTRL for HVM guests on AMD.
  - Improved TSC, CPU, and APIC clock frequency calibration on x86.
+ - Support for Xen using x86 Control Flow Enforcement technology for its own
+   protection. Both Shadow Stacks (ROP protection) and Indirect Branch
+   Tracking (COP/JOP protection).
  - Add mwait-idle support for SPR and ADL on x86.
  - Extend security support for hosts to 12 TiB of memory on x86.
  - Add command line option to set cpuid parameters for dom0 at boot time on x86.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 02 07:22:22 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Dec 2022 07:22:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.451505.709257 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p10NK-0006cD-OB; Fri, 02 Dec 2022 07:22:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 451505.709257; Fri, 02 Dec 2022 07:22:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p10NK-0006c6-Lf; Fri, 02 Dec 2022 07:22:22 +0000
Received: by outflank-mailman (input) for mailman id 451505;
 Fri, 02 Dec 2022 07:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p10NK-0006bv-5h
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 07:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p10NK-0002f5-4w
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 07:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p10NK-0003nB-45
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oun0STo9otX7g6HKP30p+ktxIArhZfTl2I5QMb2kM7M=; b=OKv0gZolqeU3x7nOMu+4csTwsc
	vpwlLcwCrHMnlHf1johX/5PuBS9I/tuwpWsXVIP4p955jQwQjdcsBA3EnmmI9V0z7tCkgTaV8zytN
	8SeTxZcDEnsACe790JQREp4VJ/4A3CjZuGAduc98fQaGGtfenmTMww9BGyE9WqbzSWKg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/misc/arm: Update references to Linux kernel docs
Message-Id: <E1p10NK-0003nB-45@xenbits.xenproject.org>
Date: Fri, 02 Dec 2022 07:22:22 +0000

commit ddcc208ccdd44c688b3265be26237875c16b6258
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Nov 18 12:45:54 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 1 10:43:05 2022 +0000

    docs/misc/arm: Update references to Linux kernel docs
    
    Some time ago, Linux switched the format of docs to ReST and the format
    of device-tree bindings to json-schema.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Release-acked-by: Henry Wang <Henry.Wang@arm.com>
---
 docs/misc/arm/booting.txt     | 8 ++++----
 docs/misc/arm/passthrough.txt | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/docs/misc/arm/booting.txt b/docs/misc/arm/booting.txt
index d3f6ce4755..3e0c03e065 100644
--- a/docs/misc/arm/booting.txt
+++ b/docs/misc/arm/booting.txt
@@ -34,8 +34,8 @@ Xen relies on some settings the firmware has to configure in EL3 before starting
 * The bit SCR_EL3.HCE (resp. SCR.HCE for 32-bit ARM) must be set to 1.
 
 
-[1] linux/Documentation/arm/Booting
-Latest version: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm/Booting
+[1] linux/Documentation/arm/booting.rst
+Latest version: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm/booting.rst
 
-[2] linux/Documentation/arm64/booting.txt
-Latest version: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/booting.txt
+[2] linux/Documentation/arm64/booting.rst
+Latest version: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/booting.rst
diff --git a/docs/misc/arm/passthrough.txt b/docs/misc/arm/passthrough.txt
index 219d1cca57..4f0a024818 100644
--- a/docs/misc/arm/passthrough.txt
+++ b/docs/misc/arm/passthrough.txt
@@ -71,8 +71,8 @@ Please refer to your platform docs for the MMIO ranges and interrupts.
 They can also be calculated from the original device tree (not
 recommended). You can read about the "interrupts" property format in the
 device tree bindings of the interrupt controller of your platform. For
-example, in the case of GICv2 see [arm,gic.txt]; in the case of GICv3
-see [arm,gic-v3.txt] in the Linux repository. For both GICv2 and GICv3
+example, in the case of GICv2 see [arm,gic.yaml]; in the case of GICv3
+see [arm,gic-v3.yaml] in the Linux repository. For both GICv2 and GICv3
 the "interrupts" property format is the same: the first cell is the
 interrupt type, and the second cell is the interrupt number.  Given that
 SPI numbers start from 32, in this example 80 + 32 = 112.
@@ -187,6 +187,6 @@ assign a network card to a dom0-less guest on Xilinx Ultrascale+ MPSoC:
 };
 
 
-[arm,gic.txt]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/interrupt-controller/arm,gic.txt
-[arm,gic-v3.txt]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.txt
+[arm,gic.yaml]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/interrupt-controller/arm,gic.yaml
+[arm,gic-v3.yaml]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml
 [xl.cfg]: https://xenbits.xen.org/docs/unstable/man/xl.cfg.5.html
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 02 14:00:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Dec 2022 14:00:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.451992.709793 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p16aA-0002rn-RA; Fri, 02 Dec 2022 14:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 451992.709793; Fri, 02 Dec 2022 14: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 1p16aA-0002rL-OH; Fri, 02 Dec 2022 14:00:02 +0000
Received: by outflank-mailman (input) for mailman id 451992;
 Fri, 02 Dec 2022 14:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16a9-0002cd-QP
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16a9-0003gN-PI
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16a9-0003q1-Nk
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0lYNdVcYKWJ6C6q/l48ipQNG7z6MP5jbAf2IMjaqRG8=; b=11Ll97SitvEbBX4IFBfUg2+Pq5
	HjLRR8PQbKItz93yRFGwpzYDm1jD2S5RvWV8IpyT+LFj+tJX2CfIcrueVhzEr7D/0DRXRdtEMjGId
	HLOVt/pVB+hID2bZ2ZU1PAB0R9pfzKTS4fyYegX5HG97b2tJlpi90OSH+ZzTSu5kDs2E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] CHANGELOG: Add missing entries for work during the 4.17 release
Message-Id: <E1p16a9-0003q1-Nk@xenbits.xenproject.org>
Date: Fri, 02 Dec 2022 14:00:01 +0000

commit 991f5037c88469756867e843ca8ea580ae56a39c
Author:     Henry Wang <Henry.Wang@arm.com>
AuthorDate: Thu Nov 24 10:50:39 2022 +0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 1 10:42:03 2022 +0000

    CHANGELOG: Add missing entries for work during the 4.17 release
    
    Signed-off-by: Henry Wang <Henry.Wang@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 CHANGELOG.md | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index adbbb216fa..55dd535e29 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,16 +4,44 @@ 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/)
 
-## [unstable UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
+## [4.17.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging)
 
 ### Changed
  - On x86 "vga=current" can now be used together with GrUB2's gfxpayload setting. Note that
    this requires use of "multiboot2" (and "module2") as the GrUB commands loading Xen.
+ - The "gnttab" option now has a new command line sub-option for disabling the
+   GNTTABOP_transfer functionality.
+ - The x86 MCE command line option info is now updated.
 
 ### Added / support upgraded
+ - Out-of-tree builds for the hypervisor now supported.
+ - The project has officially adopted 4 directives and 24 rules of MISRA-C,
+   added MISRA-C checker build integration, and defined how to document
+   deviations.
  - IOMMU superpage support on x86, affecting PV guests as well as HVM/PVH ones
    when they don't share page tables with the CPU (HAP / EPT / NPT).
- - Support VIRT_SSBD feature for HVM guests on AMD.
+ - Support for VIRT_SSBD and MSR_SPEC_CTRL for HVM guests on AMD.
+ - Improved TSC, CPU, and APIC clock frequency calibration on x86.
+ - Add mwait-idle support for SPR and ADL on x86.
+ - Extend security support for hosts to 12 TiB of memory on x86.
+ - Add command line option to set cpuid parameters for dom0 at boot time on x86.
+ - Improved static configuration options on Arm.
+ - cpupools can be specified at boot using device tree on Arm.
+ - It is possible to use PV drivers with dom0less guests, allowing statically
+   booted dom0less guests with PV devices.
+ - On Arm, p2m structures are now allocated out of a pool of memory set aside at
+   domain creation.
+ - Improved mitigations against Spectre-BHB on Arm.
+ - Support VirtIO-MMIO devices device-tree binding creation in toolstack on Arm.
+ - Allow setting the number of CPUs to activate at runtime from command line
+   option on Arm.
+ - Grant-table support on Arm was improved and hardened by implementing
+   "simplified M2P-like approach for the xenheap pages"
+ - Add Renesas R-Car Gen4 IPMMU-VMSA support on Arm.
+ - Add i.MX lpuart and i.MX8QM support on Arm.
+ - Improved toolstack build system.
+ - Add Xue - console over USB 3 Debug Capability.
+ - gitlab-ci automation: Fixes and improvements together with new tests.
 
 ### Removed / support downgraded
  - dropped support for the (x86-only) "vesa-mtrr" and "vesa-remap" command line options
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Dec 02 14:00:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Dec 2022 14:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.451993.709797 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p16aK-0003VY-TG; Fri, 02 Dec 2022 14:00:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 451993.709797; Fri, 02 Dec 2022 14:00:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p16aK-0003VM-Po; Fri, 02 Dec 2022 14:00:12 +0000
Received: by outflank-mailman (input) for mailman id 451993;
 Fri, 02 Dec 2022 14:00:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16aJ-0003UR-T6
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16aJ-0003gd-SI
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16aJ-0003rz-RS
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jCA8xFmObx1lApQC0Tij+7dEh6mNmzzA34zZJbLK9TM=; b=lz8dCOURIAFcdgZX8r4nbCzuI1
	WzYWVuiwFl3tO8iKaqq/CAnYNVbEEtJT7ylj59iM8HyxI5Dwz0E95jSM1wRUU2CSx2R8n6kwMN7WA
	PMO0tolEaRy7zNiOPsh+DwMdiF2Xciz9roaqn+e3kn9f6FVeG3oQZyFVbBdirNbphzs8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] Changelog: Add __ro_after_init and CET
Message-Id: <E1p16aJ-0003rz-RS@xenbits.xenproject.org>
Date: Fri, 02 Dec 2022 14:00:11 +0000

commit e5f93e02694f6c871578e8194645e361a2860abb
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Nov 24 10:50:40 2022 +0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 1 10:42:03 2022 +0000

    Changelog: Add __ro_after_init and CET
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Henry Wang <Henry.Wang@arm.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 CHANGELOG.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 55dd535e29..5d686a4258 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
 ### Added / support upgraded
  - Out-of-tree builds for the hypervisor now supported.
+ - __ro_after_init support, for marking data as immutable after boot.
  - The project has officially adopted 4 directives and 24 rules of MISRA-C,
    added MISRA-C checker build integration, and defined how to document
    deviations.
@@ -22,6 +23,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    when they don't share page tables with the CPU (HAP / EPT / NPT).
  - Support for VIRT_SSBD and MSR_SPEC_CTRL for HVM guests on AMD.
  - Improved TSC, CPU, and APIC clock frequency calibration on x86.
+ - Support for Xen using x86 Control Flow Enforcement technology for its own
+   protection. Both Shadow Stacks (ROP protection) and Indirect Branch
+   Tracking (COP/JOP protection).
  - Add mwait-idle support for SPR and ADL on x86.
  - Extend security support for hosts to 12 TiB of memory on x86.
  - Add command line option to set cpuid parameters for dom0 at boot time on x86.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Dec 02 14:00:22 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Dec 2022 14:00:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.451994.709801 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p16aU-0003aw-UF; Fri, 02 Dec 2022 14:00:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 451994.709801; Fri, 02 Dec 2022 14:00:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p16aU-0003ao-RY; Fri, 02 Dec 2022 14:00:22 +0000
Received: by outflank-mailman (input) for mailman id 451994;
 Fri, 02 Dec 2022 14:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16aU-0003ae-0u
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16aU-0003gw-07
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16aT-0003so-UR
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Xs8RS0UZwoZOnx+rwUVFYBot3mAasIPpUafObWOn6j0=; b=cc7bj2kn6y3uxleMWrVQVtEg4O
	D9SnJn8ej4tAAcMr4vOrF5L63bGI17Miac3UK5mAPOfP+IwiMcdbmI8zY7dLEAhAr9ElzvBjoGot0
	f6zT2UAU/3jnh+OZDCaB+IQIMbDNn/nGNfnsz0XblGHLAxuHXdSkQJKkTwJkD5LsKjWw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] docs/misc/arm: Update references to Linux kernel docs
Message-Id: <E1p16aT-0003so-UR@xenbits.xenproject.org>
Date: Fri, 02 Dec 2022 14:00:21 +0000

commit ddcc208ccdd44c688b3265be26237875c16b6258
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Nov 18 12:45:54 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 1 10:43:05 2022 +0000

    docs/misc/arm: Update references to Linux kernel docs
    
    Some time ago, Linux switched the format of docs to ReST and the format
    of device-tree bindings to json-schema.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Release-acked-by: Henry Wang <Henry.Wang@arm.com>
---
 docs/misc/arm/booting.txt     | 8 ++++----
 docs/misc/arm/passthrough.txt | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/docs/misc/arm/booting.txt b/docs/misc/arm/booting.txt
index d3f6ce4755..3e0c03e065 100644
--- a/docs/misc/arm/booting.txt
+++ b/docs/misc/arm/booting.txt
@@ -34,8 +34,8 @@ Xen relies on some settings the firmware has to configure in EL3 before starting
 * The bit SCR_EL3.HCE (resp. SCR.HCE for 32-bit ARM) must be set to 1.
 
 
-[1] linux/Documentation/arm/Booting
-Latest version: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm/Booting
+[1] linux/Documentation/arm/booting.rst
+Latest version: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm/booting.rst
 
-[2] linux/Documentation/arm64/booting.txt
-Latest version: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/booting.txt
+[2] linux/Documentation/arm64/booting.rst
+Latest version: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/booting.rst
diff --git a/docs/misc/arm/passthrough.txt b/docs/misc/arm/passthrough.txt
index 219d1cca57..4f0a024818 100644
--- a/docs/misc/arm/passthrough.txt
+++ b/docs/misc/arm/passthrough.txt
@@ -71,8 +71,8 @@ Please refer to your platform docs for the MMIO ranges and interrupts.
 They can also be calculated from the original device tree (not
 recommended). You can read about the "interrupts" property format in the
 device tree bindings of the interrupt controller of your platform. For
-example, in the case of GICv2 see [arm,gic.txt]; in the case of GICv3
-see [arm,gic-v3.txt] in the Linux repository. For both GICv2 and GICv3
+example, in the case of GICv2 see [arm,gic.yaml]; in the case of GICv3
+see [arm,gic-v3.yaml] in the Linux repository. For both GICv2 and GICv3
 the "interrupts" property format is the same: the first cell is the
 interrupt type, and the second cell is the interrupt number.  Given that
 SPI numbers start from 32, in this example 80 + 32 = 112.
@@ -187,6 +187,6 @@ assign a network card to a dom0-less guest on Xilinx Ultrascale+ MPSoC:
 };
 
 
-[arm,gic.txt]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/interrupt-controller/arm,gic.txt
-[arm,gic-v3.txt]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.txt
+[arm,gic.yaml]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/interrupt-controller/arm,gic.yaml
+[arm,gic-v3.yaml]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml
 [xl.cfg]: https://xenbits.xen.org/docs/unstable/man/xl.cfg.5.html
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Dec 02 14:00:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Dec 2022 14:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.451998.709805 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p16ae-0003eS-Vi; Fri, 02 Dec 2022 14:00:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 451998.709805; Fri, 02 Dec 2022 14:00:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p16ae-0003eK-T5; Fri, 02 Dec 2022 14:00:32 +0000
Received: by outflank-mailman (input) for mailman id 451998;
 Fri, 02 Dec 2022 14:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16ae-0003e0-84
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16ae-0003hO-3A
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16ae-0003to-2A
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=anSrP36Lh9aeSTz6nFo5uVOKvXsxVSuIqbB9eNQ9lbE=; b=RbYW5bofw3dmXS4vc45jcwGUSm
	tvYpYJMPA/ex/ymId2XhIfWyJ1zGfR4K+S7K4dTzTxp5Swd9x6X/rb7R4BMC/f0x3AxzSPP7IrYDi
	qS1GvhjZURoGDPJDxHD+Z+SnTyVXa6Qg6NC31y32Egr4b6lfcLE/JRQNxfLN8ZhXbEA0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] Config.mk: switch to named tags (for stable branch)
Message-Id: <E1p16ae-0003to-2A@xenbits.xenproject.org>
Date: Fri, 02 Dec 2022 14:00:32 +0000

commit f51079b5d87b39e79fe499ed818d50d856bc9c35
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Dec 1 11:58:50 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 1 11:58:50 2022 +0000

    Config.mk: switch to named tags (for stable branch)
---
 Config.mk | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/Config.mk b/Config.mk
index e0ce593468..7c3c499f80 100644
--- a/Config.mk
+++ b/Config.mk
@@ -229,17 +229,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= b746458e1ce1bec85e58b458386f8b7a0bedfaa6
-MINIOS_UPSTREAM_REVISION ?= 5bcb28aaeba1c2506a82fab0cdad0201cd9b54b3
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.17.0-rc4
+MINIOS_UPSTREAM_REVISION ?= xen-4.17.0-rc4
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= 3d273dd05e51e5a1ffba3d98c7437ee84e8f8764
-# Wed Jul 15 10:01:40 2020 +0100
-# qemu-trad: remove Xen path dependencies
+QEMU_TRADITIONAL_REVISION ?= xen-4.17.0-rc4
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Dec 02 14:00:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Dec 2022 14:00:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.451999.709809 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p16ap-0003h2-0w; Fri, 02 Dec 2022 14:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 451999.709809; Fri, 02 Dec 2022 14: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 1p16ao-0003gv-UZ; Fri, 02 Dec 2022 14:00:42 +0000
Received: by outflank-mailman (input) for mailman id 451999;
 Fri, 02 Dec 2022 14:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16ao-0003gg-6Y
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16ao-0003hc-5o
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16ao-0003uq-5C
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=U1Q1kuLHlHqzCeHLtDXMvPqksPz6roUMxW0etI9IufA=; b=pcqH+5V7Uvd7wDp8NSZsQ1iyMl
	v10op9qVst3MxDL0ffNt7yxWvVM4oYzrnGoS1dYONKuqfgmr0yH2PcGeT1CzW8Rg6e7NVbx5eq1cT
	fr0R83SNMqDjR2DwAG6tfTc9zcSq4Rtv4lVd9euCJ4j6TE00tBqFDUZ8wkeHqxefXDZI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] SUPPORT.md: Set Releases Notes link
Message-Id: <E1p16ao-0003uq-5C@xenbits.xenproject.org>
Date: Fri, 02 Dec 2022 14:00:42 +0000

commit d86fb95cfd070ce77ae646d3f8a96ad452174b2c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Dec 1 13:50:31 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 1 13:53:50 2022 +0000

    SUPPORT.md: Set Releases Notes link
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 SUPPORT.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index ab71464cf6..765dd15685 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,13 +9,13 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.17-rc
+    Xen-Version: 4.17
     Initial-Release: n/a
     Supported-Until: TBD
     Security-Support-Until: Unreleased - not yet security-supported
 
 Release Notes
-: <a href="https://wiki.xenproject.org/wiki/Xen_Project_X.YY_Release_Notes">RN</a>
+: <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.17_Release_Notes">RN</a>
 
 # Feature Support
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Dec 02 14:00:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Dec 2022 14:00:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452003.709824 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p16az-0003zd-Fw; Fri, 02 Dec 2022 14:00:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452003.709824; Fri, 02 Dec 2022 14:00:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p16az-0003zW-Cw; Fri, 02 Dec 2022 14:00:53 +0000
Received: by outflank-mailman (input) for mailman id 452003;
 Fri, 02 Dec 2022 14:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16ay-0003mL-9m
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16ay-0003i4-8k
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16ay-0003vd-7s
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1WaWo+096H8M6nhpVT6iPdH1Cb015Om4us/KJ5K1Qgo=; b=V4ozgEUsBrq8n5rknXSDe1eu5/
	KEwGMZh6hYHQOGC8VfiIua3sYDEGpuhHWkMjjvMLAZ4hmXaZ6bGjrpTF1XBb4g5ABsTYVL00xk38o
	ifcf6W+Z5E8CqoIn79kfJUWDCTZRA7nMJZzTJGlwoxvcOhpPzNp/LRsAqLVsUSVY8MsI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] Turn off debug by default
Message-Id: <E1p16ay-0003vd-7s@xenbits.xenproject.org>
Date: Fri, 02 Dec 2022 14:00:52 +0000

commit 894a7786c8eb20568aa8d425de59e4e3cffd5b40
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Dec 1 13:54:04 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 1 13:54:04 2022 +0000

    Turn off debug by default
    
    Signed-off-by: Julien Grall <jgrall@amazon.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 6e135387bd..a5229bb5ac 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 fad3050d4f..4419030235 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.17


From xen-changelog-bounces@lists.xenproject.org Fri Dec 02 14:01:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Dec 2022 14:01:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452004.709829 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p16b9-00044s-Ir; Fri, 02 Dec 2022 14:01:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452004.709829; Fri, 02 Dec 2022 14:01:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p16b9-00044i-Ek; Fri, 02 Dec 2022 14:01:03 +0000
Received: by outflank-mailman (input) for mailman id 452004;
 Fri, 02 Dec 2022 14:01:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16b8-00044J-CR
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:01:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16b8-0003iX-Bl
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p16b8-0003wr-Aq
 for xen-changelog@lists.xenproject.org; Fri, 02 Dec 2022 14:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=REshZ2hvRlyAtZTHJ3b3a5hA+FrR9Khq1zTm2yJB+nM=; b=x6dElKqMrFrbozw2ZFLTTKBWd0
	vCuc5kurOSwhXo397IY/TdkPq5sqfe1zmKOdv3wJo47IS5p4uw6RcHDWHFgzGlC5Id/gvEZxDiffN
	AGOesvyQAiiLVmHSzm7cIze9CBCFkZpbfK/BR9Qov4CKVRtIkNvR2QyMZgnpnxW7H9eM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/include: fix clean and rework COPYING for installed Xen public header
Message-Id: <E1p16b8-0003wr-Aq@xenbits.xenproject.org>
Date: Fri, 02 Dec 2022 14:01:02 +0000

commit 942f881eb1b4e90cbd2096e88551750092d2eaaa
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Dec 1 16:28:43 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 1 16:28:43 2022 +0100

    tools/include: fix clean and rework COPYING for installed Xen public header
    
    Use actual include directory used to install the public header in
    COPYING file.
    
    Also, move the input file out of "tools/include/xen/" because that
    directory is removed on `make clean`.
    
    We can't used ./configure because $includedir contain another
    variable, so the change is done in Makefile.
    
    Fixes: 4ea75e9a9058 ("Rework COPYING installed in /usr/include/xen/, due to several licences")
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Henry Wang <Henry.Wang@arm.com>
    master commit: 25b55688e1f20ebb1bb15d0e82079e91cd787e5b
    master date: 2022-12-01 16:14:59 +0100
---
 tools/include/.gitignore     |  1 +
 tools/include/Makefile       |  1 +
 tools/include/xen.COPYING.in | 26 ++++++++++++++++++++++++++
 tools/include/xen/.gitignore |  2 --
 tools/include/xen/COPYING    | 26 --------------------------
 5 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/tools/include/.gitignore b/tools/include/.gitignore
new file mode 100644
index 0000000000..be14e3632d
--- /dev/null
+++ b/tools/include/.gitignore
@@ -0,0 +1 @@
+/xen/
diff --git a/tools/include/Makefile b/tools/include/Makefile
index f838171e8c..d69aeb54bf 100644
--- a/tools/include/Makefile
+++ b/tools/include/Makefile
@@ -24,6 +24,7 @@ xen-foreign:
 xen-dir:
 	mkdir -p xen/libelf acpi
 	find xen/ acpi/ -type l -exec rm '{}' +
+	sed -e 's#@includedir@#$(includedir)/xen#g' xen.COPYING.in > xen/COPYING
 	ln -s $(XEN_ROOT)/xen/include/public/*.h xen/
 	ln -s $(XEN_ROOT)/xen/include/public/*/ xen/
 	ln -s ../xen-sys/$(XEN_OS) xen/sys
diff --git a/tools/include/xen.COPYING.in b/tools/include/xen.COPYING.in
new file mode 100644
index 0000000000..25513fe529
--- /dev/null
+++ b/tools/include/xen.COPYING.in
@@ -0,0 +1,26 @@
+XEN NOTICE
+==========
+
+This licence applies to all files within this subdirectory ("@includedir@")
+with the exception of "sys/" which may include headers under different
+licences.
+
+=====================================================================
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/tools/include/xen/.gitignore b/tools/include/xen/.gitignore
deleted file mode 100644
index 0628b2daf1..0000000000
--- a/tools/include/xen/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!COPYING
diff --git a/tools/include/xen/COPYING b/tools/include/xen/COPYING
deleted file mode 100644
index fe3f9b7557..0000000000
--- a/tools/include/xen/COPYING
+++ /dev/null
@@ -1,26 +0,0 @@
-XEN NOTICE
-==========
-
-This licence applies to all files within this subdirectory ("/usr/include/xen")
-with the exception of "sys/" which may include headers under different
-licences.
-
-=====================================================================
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 01:33:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 01:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452345.710166 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1HOp-0006D4-It; Sat, 03 Dec 2022 01:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452345.710166; Sat, 03 Dec 2022 01: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 1p1HOp-0006Cv-Fe; Sat, 03 Dec 2022 01:33:03 +0000
Received: by outflank-mailman (input) for mailman id 452345;
 Sat, 03 Dec 2022 01:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1HOo-0006Cp-3x
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 01:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1HOo-0001TJ-1q
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 01:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1HOo-0003Pu-0n
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9MLhf/mrDzqnvuQWS3NouReo10F1sCguGu623rbj4hQ=; b=n7FgSMdpsm9yFDu5a376ROk4h8
	RJ7aWHyzD580uYDAb/oakJIK7o+KdYMTtTgS3SNmSLhHt5z5KCjjNBufIrdMFk09ZZx5uThxFCd7l
	IK/2DfKb/v6hWKnnjZRitQO3jT6I0p0vqpeLqwc1H1HCISSRolRCYID+ld6fUMSbm0Ms=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/HVM+shim: fix build when !CONFIG_GRANT_TABLE
Message-Id: <E1p1HOo-0003Pu-0n@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 01:33:02 +0000

commit 100c3416b5cab2e06c774f68e1d7410cb0fc52b1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Dec 2 10:42:24 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:42:24 2022 +0100

    x86/HVM+shim: fix build when !CONFIG_GRANT_TABLE
    
    The HVM flavor of the hypercall handlers exists only when GRANT_TABLE is
    enabled, while surrogate shim variants exist only for the purpose of PV.
    (Also scratch out the Arm variant in that case; what exactly is used in
    that cell of the new table row doesn't really matter.)
    
    Fixes: 8523851dbc49 ("xen/x86: call hypercall handlers via generated macro")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Henry Wang <Henry.Wang@arm.com>
    master commit: 133f35f0f0cd0a415e599c20156aaaa5598356c0
    master date: 2022-12-02 10:40:11 +0100
---
 xen/include/hypercall-defs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index 45b6f969d2..1896121074 100644
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -241,8 +241,10 @@ event_channel_op_compat            do       do       -        -        dep
 xen_version                        compat   do       compat   do       do
 console_io                         do       do       do       do       do
 physdev_op_compat                  compat   do       -        -        dep
-#if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM)
+#if defined(CONFIG_GRANT_TABLE)
 grant_table_op                     compat   do       hvm      hvm      do
+#elif defined(CONFIG_PV_SHIM)
+grant_table_op                     compat   do       -        -        -
 #endif
 vm_assist                          do       do       do       do       do
 update_va_mapping_otherdomain      compat   do       -        -        -
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:00:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:00:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452498.710254 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RBb-0001rw-PI; Sat, 03 Dec 2022 12:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452498.710254; Sat, 03 Dec 2022 12: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 1p1RBb-0001rW-Lg; Sat, 03 Dec 2022 12:00:03 +0000
Received: by outflank-mailman (input) for mailman id 452498;
 Sat, 03 Dec 2022 12:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RBa-0001ca-9l
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RBa-00084p-7H
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RBa-0002M3-5l
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=D8XZtj7iyIPNBvsH/fMC4Pp0ZiYLMza9GU27/kx27j0=; b=na6ac+utz1VjXqVK81TZiBq/3a
	kLRQMKgPdHLGB5NpgkPIfV3MR8DdVbDwO2/RelWFFbdjiBDDDeS5aBLs7HrCdWq9T1Y/70RkQnZMV
	FXYX4fjVRaBnhRTbKDcP6HLiDSn67ij0xVd2rrtm3R9/+DOELKXTwbevQxp4VeWtMa9M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "Config.mk pin QEMU_UPSTREAM_REVISION (prep for Xen 4.17 RC1)"
Message-Id: <E1p1RBa-0002M3-5l@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:00:02 +0000

commit 7190edeaaf2768bf14f53ad15af1005fa2c9b19f
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Dec 1 13:56:36 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 1 13:56:36 2022 +0000

    Revert "Config.mk pin QEMU_UPSTREAM_REVISION (prep for Xen 4.17 RC1)"
    
    The branch is unstable again.
    
    This reverts commit b4ddd34d3a199167d48a50c72729be397c50f8cd.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index e0ce593468..69af1e60d4 100644
--- a/Config.mk
+++ b/Config.mk
@@ -229,7 +229,7 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= b746458e1ce1bec85e58b458386f8b7a0bedfaa6
+QEMU_UPSTREAM_REVISION ?= master
 MINIOS_UPSTREAM_REVISION ?= 5bcb28aaeba1c2506a82fab0cdad0201cd9b54b3
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:00:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452499.710259 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RBl-0002HU-RQ; Sat, 03 Dec 2022 12:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452499.710259; Sat, 03 Dec 2022 12: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 1p1RBl-0002HM-ND; Sat, 03 Dec 2022 12:00:13 +0000
Received: by outflank-mailman (input) for mailman id 452499;
 Sat, 03 Dec 2022 12:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RBk-0002G5-Ci
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RBk-000853-BV
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RBk-0002NZ-9i
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1nDThQc3UgBAr7LEW31CHZ1AjhJoIsckUoaYya7hms4=; b=HCQ1PhsRHHIyV+EcsSlPNdTNjW
	r6G2nNIGYz1DE4kJ45L2UVr5HJAz7VUUVmvKhnPUgSdfhELewfjUGymzepdL+ltsTqVMVXT0xG1Zv
	cB1FYz3H07YoyYhCq/FW1EtNuvrwVq6aTcAPyDT87tJQCk1zUDQ92APbXyhvQIR4fQHM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Set version to 4.18; 4.17 has branched
Message-Id: <E1p1RBk-0002NZ-9i@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:00:12 +0000

commit aab534120463b77bc0180ea27a76ae8b60778462
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Dec 1 14:01:22 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 1 14:01:22 2022 +0000

    Set version to 4.18; 4.17 has branched
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 README       | 10 +++++-----
 xen/Makefile |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/README b/README
index 2fdca8861b..755b3d8eaf 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 ###############################################
-__  __            _  _    _ _____
-\ \/ /___ _ __   | || |  / |___  |    _ __ ___
- \  // _ \ '_ \  | || |_ | |  / /____| '__/ __|
- /  \  __/ | | | |__   _|| | / /_____| | | (__
-/_/\_\___|_| |_|    |_|(_)_|/_/      |_|  \___|
+__  __            _  _    _  ___
+\ \/ /___ _ __   | || |  / |( _ )
+ \  // _ \ '_ \  | || |_ | |/ _ \
+ /  \  __/ | | | |__   _|| | (_) |
+/_/\_\___|_| |_|    |_|(_)_|\___/
 
 ###############################################
 
diff --git a/xen/Makefile b/xen/Makefile
index 9d0df5e2c5..e55fb98e11 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    = 17
-export XEN_EXTRAVERSION ?= -rc$(XEN_VENDORVERSION)
+export XEN_SUBVERSION    = 18
+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 Sat Dec 03 12:00:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452501.710261 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RBv-0002Kk-Rv; Sat, 03 Dec 2022 12:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452501.710261; Sat, 03 Dec 2022 12: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 1p1RBv-0002Kb-Ow; Sat, 03 Dec 2022 12:00:23 +0000
Received: by outflank-mailman (input) for mailman id 452501;
 Sat, 03 Dec 2022 12:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RBu-0002KJ-Gb
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RBu-00085O-Ft
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RBu-0002Op-Ef
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+dVFk6deQRtt4pQjKosMi1Pe96ViCccO7oUpPdpd5+s=; b=XdrYlPJytYE3+4jloRfqHI4GsA
	udLipk8HrdQ4OcOH9r/WSzAOVijQK6oAQIHGbDmjtLfZGEnLw01k6qIaSGsZypz7bJfOMek50d72M
	GqFDbOjBR4eRpDehgvU8FKrep+zY0vxoQdJAygAXFWSm7sWzo49b85GCRImP/OnrwX30=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Set version to 4.18; return ./autogen.sh
Message-Id: <E1p1RBu-0002Op-Ef@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:00:22 +0000

commit 72269801cc4336e82ea30f510e016e61924d7972
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Dec 1 14:05:45 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 1 14:05:45 2022 +0000

    Set version to 4.18; return ./autogen.sh
    
    Signed-off-by: Julien Grall <jgrall@amazon.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 b51174f2ef..f5cd3c286b 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.69 for Xen Hypervisor 4.17.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor 4.18.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.17'
-PACKAGE_STRING='Xen Hypervisor 4.17'
+PACKAGE_VERSION='4.18'
+PACKAGE_STRING='Xen Hypervisor 4.18'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1235,7 +1235,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.17 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor 4.18 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1301,7 +1301,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor 4.17:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor 4.18:";;
    esac
   cat <<\_ACEOF
 
@@ -1402,7 +1402,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor configure 4.17
+Xen Hypervisor configure 4.18
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1419,7 +1419,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.17, which was
+It was created by Xen Hypervisor $as_me 4.18, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2909,7 +2909,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.17, which was
+This file was extended by Xen Hypervisor $as_me 4.18, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2963,7 +2963,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor config.status 4.17
+Xen Hypervisor config.status 4.18
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/docs/configure b/docs/configure
index f008ca0565..6f79e1acc6 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.69 for Xen Hypervisor Documentation 4.17.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Documentation 4.18.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Documentation'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.17'
-PACKAGE_STRING='Xen Hypervisor Documentation 4.17'
+PACKAGE_VERSION='4.18'
+PACKAGE_STRING='Xen Hypervisor Documentation 4.18'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1223,7 +1223,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.17 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Documentation 4.18 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1285,7 +1285,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.17:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.18:";;
    esac
   cat <<\_ACEOF
 
@@ -1386,7 +1386,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Documentation configure 4.17
+Xen Hypervisor Documentation configure 4.18
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1403,7 +1403,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.17, which was
+It was created by Xen Hypervisor Documentation $as_me 4.18, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2862,7 +2862,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.17, which was
+This file was extended by Xen Hypervisor Documentation $as_me 4.18, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2916,7 +2916,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Documentation config.status 4.17
+Xen Hypervisor Documentation config.status 4.18
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/stubdom/configure b/stubdom/configure
index 5b265b5369..b8bffceafd 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.69 for Xen Hypervisor Stub Domains 4.17.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Stub Domains 4.18.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Stub Domains'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.17'
-PACKAGE_STRING='Xen Hypervisor Stub Domains 4.17'
+PACKAGE_VERSION='4.18'
+PACKAGE_STRING='Xen Hypervisor Stub Domains 4.18'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1265,7 +1265,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.17 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Stub Domains 4.18 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1331,7 +1331,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.17:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.18:";;
    esac
   cat <<\_ACEOF
 
@@ -1444,7 +1444,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Stub Domains configure 4.17
+Xen Hypervisor Stub Domains configure 4.18
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1499,7 +1499,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.17, which was
+It was created by Xen Hypervisor Stub Domains $as_me 4.18, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -4283,7 +4283,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.17, which was
+This file was extended by Xen Hypervisor Stub Domains $as_me 4.18, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4337,7 +4337,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Stub Domains config.status 4.17
+Xen Hypervisor Stub Domains config.status 4.18
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/tools/configure b/tools/configure
index ffe3f48901..dae377c982 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.69 for Xen Hypervisor Tools 4.17.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Tools 4.18.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Tools'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.17'
-PACKAGE_STRING='Xen Hypervisor Tools 4.17'
+PACKAGE_VERSION='4.18'
+PACKAGE_STRING='Xen Hypervisor Tools 4.18'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1416,7 +1416,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.17 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Tools 4.18 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1482,7 +1482,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.17:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.18:";;
    esac
   cat <<\_ACEOF
 
@@ -1691,7 +1691,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Tools configure 4.17
+Xen Hypervisor Tools configure 4.18
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2106,7 +2106,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.17, which was
+It was created by Xen Hypervisor Tools $as_me 4.18, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -10756,7 +10756,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.17, which was
+This file was extended by Xen Hypervisor Tools $as_me 4.18, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -10819,7 +10819,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Tools config.status 4.17
+Xen Hypervisor Tools config.status 4.18
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:00:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452503.710266 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RC5-0002Oe-T8; Sat, 03 Dec 2022 12:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452503.710266; Sat, 03 Dec 2022 12: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 1p1RC5-0002OW-QV; Sat, 03 Dec 2022 12:00:33 +0000
Received: by outflank-mailman (input) for mailman id 452503;
 Sat, 03 Dec 2022 12:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RC4-0002OB-Ju
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RC4-00085Y-J4
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RC4-0002Pc-IA
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YF68Rb+RN+dNbCj/AiEwGk9Idv8d6CsoonWHD/DlOnk=; b=jLl7p9qwTFgJ0RJ0/cldVEzzSt
	L0zc0Od83vB3Iy+vHNdJhuJrKW4hh8vw7QJEqqtm3AqxrcJ8tvNi+OiH6Bh18BVDbnXPFTYEHAWf0
	GL69Ou5WcyydOCTEh3B/95kirR8Mes3pWTU+FkjeHSDx0Qbz58s0CntIlQPHL+SPv6CM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/include: fix clean and rework COPYING for installed Xen public header
Message-Id: <E1p1RC4-0002Pc-IA@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:00:32 +0000

commit 25b55688e1f20ebb1bb15d0e82079e91cd787e5b
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Dec 1 16:14:59 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 1 16:14:59 2022 +0100

    tools/include: fix clean and rework COPYING for installed Xen public header
    
    Use actual include directory used to install the public header in
    COPYING file.
    
    Also, move the input file out of "tools/include/xen/" because that
    directory is removed on `make clean`.
    
    We can't used ./configure because $includedir contain another
    variable, so the change is done in Makefile.
    
    Fixes: 4ea75e9a9058 ("Rework COPYING installed in /usr/include/xen/, due to several licences")
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/include/.gitignore     |  1 +
 tools/include/Makefile       |  1 +
 tools/include/xen.COPYING.in | 26 ++++++++++++++++++++++++++
 tools/include/xen/.gitignore |  2 --
 tools/include/xen/COPYING    | 26 --------------------------
 5 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/tools/include/.gitignore b/tools/include/.gitignore
new file mode 100644
index 0000000000..be14e3632d
--- /dev/null
+++ b/tools/include/.gitignore
@@ -0,0 +1 @@
+/xen/
diff --git a/tools/include/Makefile b/tools/include/Makefile
index f838171e8c..d69aeb54bf 100644
--- a/tools/include/Makefile
+++ b/tools/include/Makefile
@@ -24,6 +24,7 @@ xen-foreign:
 xen-dir:
 	mkdir -p xen/libelf acpi
 	find xen/ acpi/ -type l -exec rm '{}' +
+	sed -e 's#@includedir@#$(includedir)/xen#g' xen.COPYING.in > xen/COPYING
 	ln -s $(XEN_ROOT)/xen/include/public/*.h xen/
 	ln -s $(XEN_ROOT)/xen/include/public/*/ xen/
 	ln -s ../xen-sys/$(XEN_OS) xen/sys
diff --git a/tools/include/xen.COPYING.in b/tools/include/xen.COPYING.in
new file mode 100644
index 0000000000..25513fe529
--- /dev/null
+++ b/tools/include/xen.COPYING.in
@@ -0,0 +1,26 @@
+XEN NOTICE
+==========
+
+This licence applies to all files within this subdirectory ("@includedir@")
+with the exception of "sys/" which may include headers under different
+licences.
+
+=====================================================================
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/tools/include/xen/.gitignore b/tools/include/xen/.gitignore
deleted file mode 100644
index 0628b2daf1..0000000000
--- a/tools/include/xen/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*
-!COPYING
diff --git a/tools/include/xen/COPYING b/tools/include/xen/COPYING
deleted file mode 100644
index fe3f9b7557..0000000000
--- a/tools/include/xen/COPYING
+++ /dev/null
@@ -1,26 +0,0 @@
-XEN NOTICE
-==========
-
-This licence applies to all files within this subdirectory ("/usr/include/xen")
-with the exception of "sys/" which may include headers under different
-licences.
-
-=====================================================================
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:00:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452508.710271 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RCF-0002Ue-Vb; Sat, 03 Dec 2022 12:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452508.710271; Sat, 03 Dec 2022 12:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RCF-0002UU-Rz; Sat, 03 Dec 2022 12:00:43 +0000
Received: by outflank-mailman (input) for mailman id 452508;
 Sat, 03 Dec 2022 12:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCE-0002UJ-N8
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCE-00085i-MS
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCE-0002QR-LF
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=592ooc7Ge5MTRpuvfEZqocAkX/SPolZIn4+PTtiSzUY=; b=6vjMBs058NsKujzx1LmaNjdkVw
	FW/jn7IBPr94I3arUDJa0rmgAvZGOo2YyN5vsQlQ1b8QCDi+irXVX6457TGXSg5MQqCJ8rI5h62k0
	vs/8V6dGuVp9Mtk8TivbCikaTeV1Gr0ST3Ln3J/XCLB0+ga6lO+bgMkx1kx+X+pm6eOA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/xenctrl: Make domain_getinfolist tail recursive
Message-Id: <E1p1RCE-0002QR-LF@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:00:42 +0000

commit c3b6be714c64aa62b56d0bce96f4b6a10b5c2078
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 1 17:59:16 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/ocaml/xenctrl: Make domain_getinfolist tail recursive
    
    domain_getinfolist() is quadratic with the number of domains, because of the
    behaviour of the underlying hypercall.  xenopsd was further observed to be
    wasting excessive quantites of time manipulating the list of already-obtained
    domains.
    
    Implement a tail recursive `rev_concat` equivalent to `concat |> rev`, and use
    it instead of calling `@` multiple times.
    
    An incidental benefit is that the list of domains will now be in domid order,
    instead of having pairs of 2 domains changing direction every time.
    
    In a scalability testing scenario with ~1000 VMs, a combination of this and
    the subsequent change takes xenopsd's wallclock time in domain_getinfolist()
    down from 88% to 0.02%
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Tested-by: Pau Ruiz Safont <pau.safont@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xc/xenctrl.ml | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index 83e39a8616..85b73a7f6f 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -222,14 +222,25 @@ external domain_shutdown: handle -> domid -> shutdown_reason -> unit
 external _domain_getinfolist: handle -> domid -> int -> domaininfo list
        = "stub_xc_domain_getinfolist"
 
+let rev_append_fold acc e = List.rev_append e acc
+
+(**
+ * [rev_concat lst] is equivalent to [lst |> List.concat |> List.rev]
+ * except it is tail recursive, whereas [List.concat] isn't.
+ * Example:
+ * rev_concat [[10;9;8];[7;6];[5]]] = [5; 6; 7; 8; 9; 10]
+ *)
+let rev_concat lst = List.fold_left rev_append_fold [] lst
+
 let domain_getinfolist handle first_domain =
 	let nb = 2 in
-	let last_domid l = (List.hd l).domid + 1 in
-	let rec __getlist from =
-		let l = _domain_getinfolist handle from nb in
-		(if List.length l = nb then __getlist (last_domid l) else []) @ l
-		in
-	List.rev (__getlist first_domain)
+	let rec __getlist lst from =
+		(* _domain_getinfolist returns domains in reverse order, largest first *)
+		match _domain_getinfolist handle from nb with
+		| [] -> rev_concat lst
+		| (hd :: _) as l -> __getlist (l :: lst) (hd.domid + 1)
+	in
+	__getlist [] first_domain
 
 external domain_getinfo: handle -> domid -> domaininfo= "stub_xc_domain_getinfo"
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:00:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452510.710274 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RCQ-0002Xj-2p; Sat, 03 Dec 2022 12:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452510.710274; Sat, 03 Dec 2022 12:00:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RCQ-0002Xb-08; Sat, 03 Dec 2022 12:00:54 +0000
Received: by outflank-mailman (input) for mailman id 452510;
 Sat, 03 Dec 2022 12:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCO-0002XN-QO
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCO-000868-Pd
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCO-0002RQ-Od
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9BWVsrfX6kJ1XZYzJaLIV0FFJMU4B7ykzBgspgrOyrI=; b=0GpZheR6NnvqdANOaKVkca8hKb
	dmNYWV6IEJWi9Jg3pHWC6QBi92kiu0jWutv1DJSmmFAAkDivuGFSNhUYkhpMS6VjgGayDqjfXZvb2
	diMkepa6VSB/Z9HUWuESCF9UbCR0pufkU30r9GoF+cO4n2EbHoFEt/3LtYqIgc2TmVac=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/xenctrl: Use larger chunksize in domain_getinfolist
Message-Id: <E1p1RCO-0002RQ-Od@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:00:52 +0000

commit 95db09b1b154fb72fad861815ceae1f3fa49fc4e
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 1 17:59:17 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/ocaml/xenctrl: Use larger chunksize in domain_getinfolist
    
    domain_getinfolist() is quadratic with the number of domains, because of the
    behaviour of the underlying hypercall.  Nevertheless, getting domain info in
    blocks of 1024 is far more efficient than blocks of 2.
    
    In a scalability testing scenario with ~1000 VMs, a combination of this and
    the previous change takes xenopsd's wallclock time in domain_getinfolist()
    down from 88% to 0.02%
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Tested-by: Pau Ruiz Safont <pau.safont@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xc/xenctrl.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index 85b73a7f6f..aa650533f7 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -233,7 +233,7 @@ let rev_append_fold acc e = List.rev_append e acc
 let rev_concat lst = List.fold_left rev_append_fold [] lst
 
 let domain_getinfolist handle first_domain =
-	let nb = 2 in
+	let nb = 1024 in
 	let rec __getlist lst from =
 		(* _domain_getinfolist returns domains in reverse order, largest first *)
 		match _domain_getinfolist handle from nb with
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:01:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:01:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452513.710277 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RCb-0002aq-4P; Sat, 03 Dec 2022 12:01:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452513.710277; Sat, 03 Dec 2022 12:01:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RCb-0002ai-1g; Sat, 03 Dec 2022 12:01:05 +0000
Received: by outflank-mailman (input) for mailman id 452513;
 Sat, 03 Dec 2022 12:01:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCY-0002aQ-UC
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCY-00086a-TU
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCY-0002Sa-S0
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KBPnp5BNa5khNlX2ze3JQFtUWacIyBoxjf91N5uQcbM=; b=clTq1JDBDnfSdlmKL2jluU32o7
	+NsnoBFRXSsCsznVUAE9rDX4fX5ZJt4Mcg23lCKqHXa0nptmrzEjHJSIhQ1QPT2EZFSvid3TzgLYC
	cUSSTh9PO+dTgKi66XCLGRvSFSP8jssgbsZJ/A+AGPOOG/daXn8tQuBTxm47Tiv9fNhU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Fix incorrect scope after an if statement
Message-Id: <E1p1RCY-0002Sa-S0@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:01:02 +0000

commit ee36179371fd4215a43fb179be2165f65c1cd1cd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 11 18:50:34 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/oxenstored: Fix incorrect scope after an if statement
    
    A debug statement got inserted into a single-expression if statement.
    
    Insert brackets to give the intended meaning, rather than the actual meaning
    where the "let con = Connections..." is outside and executed unconditionally.
    
    This results in some unnecessary ring checks for domains which otherwise have
    IO credit.
    
    Fixes: 42f0581a91d4 ("tools/oxenstored: Implement live update for socket connections")
    Reported-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/xenstored.ml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index ffd43a4eee..c5dc7a28d0 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -475,7 +475,7 @@ let _ =
 
 	let ring_scan_checker dom =
 		(* no need to scan domains already marked as for processing *)
-		if not (Domain.get_io_credit dom > 0) then
+		if not (Domain.get_io_credit dom > 0) then (
 			debug "Looking up domid %d" (Domain.get_id dom);
 			let con = Connections.find_domain cons (Domain.get_id dom) in
 			if not (Connection.has_more_work con) then (
@@ -490,7 +490,8 @@ let _ =
 					let n = 32 + 2 * (Domains.number domains) in
 					info "found lazy domain %d, credit %d" (Domain.get_id dom) n;
 					Domain.set_io_credit ~n dom
-			) in
+			)
+		) in
 
 	let last_stat_time = ref 0. in
 	let last_scan_time = ref 0. in
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:01:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:01:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452514.710282 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RCk-0002dP-6B; Sat, 03 Dec 2022 12:01:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452514.710282; Sat, 03 Dec 2022 12:01:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RCk-0002dG-38; Sat, 03 Dec 2022 12:01:14 +0000
Received: by outflank-mailman (input) for mailman id 452514;
 Sat, 03 Dec 2022 12:01:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCj-0002d6-18
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCj-00086m-0O
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCi-0002TP-Ve
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GqePaxHxmKylT5KpC4Hx1ijXIOcHmVT7EwfbLE+X+gM=; b=a40eL2As6L3NUD3xOf6B7tGOPJ
	E+Cp/x4lH+DVE+1wN33g+SUHFPLpslH3Vu7tMiVYLbbc2se058bOOjxBsrzcVpTCq+Wd8fgNuGjHw
	cL7uD8tKcz/D7+yxlaWHyvy+RkfhHA2p3Zhsq7gFisafdVyUOLglMuRGw+IWL79hp1Wo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak
Message-Id: <E1p1RCi-0002TP-Ve@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:01:12 +0000

commit 22d5affdf0cecfa6faae46fbaec68b8018835220
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Jan 18 15:04:48 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak
    
    There is no binding for xenevtchn_close().  In principle, this is a resource
    leak, but the typical usage is as a singleton that lives for the lifetime of
    the program.
    
    Ocaml 5 no longer permits storing a naked C pointer in an Ocaml value.
    
    Therefore, use a Custom block.  This allows us to use the finaliser callback
    to call xenevtchn_close(), if the Ocaml object goes out of scope.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index f889a7a2e4..37f1cc4e14 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -33,7 +33,22 @@
 #include <caml/fail.h>
 #include <caml/signals.h>
 
-#define _H(__h) ((xenevtchn_handle *)(__h))
+#define _H(__h) (*((xenevtchn_handle **)Data_custom_val(__h)))
+
+static void stub_evtchn_finalize(value v)
+{
+	xenevtchn_close(_H(v));
+}
+
+static struct custom_operations xenevtchn_ops = {
+	.identifier  = "xenevtchn",
+	.finalize    = stub_evtchn_finalize,
+	.compare     = custom_compare_default,     /* Can't compare     */
+	.hash        = custom_hash_default,        /* Can't hash        */
+	.serialize   = custom_serialize_default,   /* Can't serialize   */
+	.deserialize = custom_deserialize_default, /* Can't deserialize */
+	.compare_ext = custom_compare_ext_default, /* Can't compare     */
+};
 
 CAMLprim value stub_eventchn_init(void)
 {
@@ -48,7 +63,9 @@ CAMLprim value stub_eventchn_init(void)
 	if (xce == NULL)
 		caml_failwith("open failed");
 
-	result = (value)xce;
+	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
+	_H(result) = xce;
+
 	CAMLreturn(result);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:01:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:01:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452516.710286 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RCu-0002g7-7O; Sat, 03 Dec 2022 12:01:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452516.710286; Sat, 03 Dec 2022 12:01:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RCu-0002g0-4m; Sat, 03 Dec 2022 12:01:24 +0000
Received: by outflank-mailman (input) for mailman id 452516;
 Sat, 03 Dec 2022 12:01:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCt-0002fp-4O
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCt-00086w-3b
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RCt-0002UG-2j
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NZDCyoDNDcp9H/xCG01QDRm7p/aNBi0vhIfd2duQJBk=; b=AOUWUZDUe1fkb2YNuBTTTc0Uik
	SwYplZ+Xs6IVIxK+g2kq+3+67ZmB5T1DxblAdRLnEhCjE7GyiTYu8oK6wBTUunCUf6+kPxsd7p8kE
	wSgwq/P13e1cgH0UO/3MraOnwpOGw54TwgfnLpP6Uola4dSJuKfDjpo0G3UQh/EYbqoE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/evtchn: Add binding for xenevtchn_fdopen()
Message-Id: <E1p1RCt-0002UG-2j@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:01:23 +0000

commit 7ba68a6c558e1fd811c95cb7215a5cd07a3cc2ea
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Mon Nov 14 13:36:19 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/ocaml/evtchn: Add binding for xenevtchn_fdopen()
    
    For live update, the new oxenstored needs to reconstruct an evtchn object
    around an existing file descriptor.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/eventchn/xeneventchn.ml      |  1 +
 tools/ocaml/libs/eventchn/xeneventchn.mli     |  4 ++++
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 19 +++++++++++++++++++
 3 files changed, 24 insertions(+)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn.ml b/tools/ocaml/libs/eventchn/xeneventchn.ml
index dd00a1f0ea..be4de82f46 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn.ml
+++ b/tools/ocaml/libs/eventchn/xeneventchn.ml
@@ -17,6 +17,7 @@
 type handle
 
 external init: unit -> handle = "stub_eventchn_init"
+external fdopen: Unix.file_descr -> handle = "stub_eventchn_fdopen"
 external fd: handle -> Unix.file_descr = "stub_eventchn_fd"
 
 type t = int
diff --git a/tools/ocaml/libs/eventchn/xeneventchn.mli b/tools/ocaml/libs/eventchn/xeneventchn.mli
index 08c7337643..98b3c86f37 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn.mli
+++ b/tools/ocaml/libs/eventchn/xeneventchn.mli
@@ -47,6 +47,10 @@ val init: unit -> handle
 (** Return an initialised event channel interface. On error it
     will throw a Failure exception. *)
 
+val fdopen: Unix.file_descr -> handle
+(** Return an initialised event channel interface, from an already open evtchn
+    file descriptor.  On error it will throw a Failure exception. *)
+
 val fd: handle -> Unix.file_descr
 (** Return a file descriptor suitable for Unix.select. When
     the descriptor becomes readable, it is safe to call 'pending'.
diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index 37f1cc4e14..7bdf711bc1 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -69,6 +69,25 @@ CAMLprim value stub_eventchn_init(void)
 	CAMLreturn(result);
 }
 
+CAMLprim value stub_eventchn_fdopen(value fdval)
+{
+	CAMLparam1(fdval);
+	CAMLlocal1(result);
+	xenevtchn_handle *xce;
+
+	caml_enter_blocking_section();
+	xce = xenevtchn_fdopen(NULL, Int_val(fdval), 0);
+	caml_leave_blocking_section();
+
+	if (xce == NULL)
+		caml_failwith("evtchn fdopen failed");
+
+	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
+	_H(result) = xce;
+
+	CAMLreturn(result);
+}
+
 CAMLprim value stub_eventchn_fd(value xce)
 {
 	CAMLparam1(xce);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:01:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:01:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452518.710290 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RD4-0002jH-95; Sat, 03 Dec 2022 12:01:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452518.710290; Sat, 03 Dec 2022 12:01:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RD4-0002j9-6J; Sat, 03 Dec 2022 12:01:34 +0000
Received: by outflank-mailman (input) for mailman id 452518;
 Sat, 03 Dec 2022 12:01:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RD3-0002iz-7j
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RD3-000876-6x
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RD3-0002VK-5o
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vysJqY6umGnlVTs1CMcz4KD+2jEND/GsUQFrbzPykU0=; b=cGcFOKnyKd6mGrfedYzDGQQi5l
	czdIoP68Tm2556oQrMgZ8yAvPsdr3jnyBks2xoFi9BfUs7IVVMxD+A672Qg0LMDCcdgU4au8ROHgF
	iM5+g7IT8Q/OfCRGcvS6cRrWOmKt3EGzUteza3OBJ+D84EQBSmxh39oJoN9A0RN1BabQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/evtchn: Extend the init() binding with a cloexec flag
Message-Id: <E1p1RD3-0002VK-5o@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:01:33 +0000

commit 9bafe4a53306e7aa2ce6ffc96f7477c6f329f7a7
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Thu Nov 3 14:50:38 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/ocaml/evtchn: Extend the init() binding with a cloexec flag
    
    For live update, oxenstored wants to clear CLOEXEC on the evtchn handle, so it
    survives the execve() into the new oxenstored.
    
    Have the new interface match how cloexec works in other Ocaml standard
    libraries.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/eventchn/xeneventchn.ml      |  5 ++++-
 tools/ocaml/libs/eventchn/xeneventchn.mli     |  9 ++++++---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 10 +++++++---
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn.ml b/tools/ocaml/libs/eventchn/xeneventchn.ml
index be4de82f46..c16fdd4674 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn.ml
+++ b/tools/ocaml/libs/eventchn/xeneventchn.ml
@@ -16,7 +16,10 @@
 
 type handle
 
-external init: unit -> handle = "stub_eventchn_init"
+external _init: bool -> handle = "stub_eventchn_init"
+
+let init ?(cloexec=true) () = _init cloexec
+
 external fdopen: Unix.file_descr -> handle = "stub_eventchn_fdopen"
 external fd: handle -> Unix.file_descr = "stub_eventchn_fd"
 
diff --git a/tools/ocaml/libs/eventchn/xeneventchn.mli b/tools/ocaml/libs/eventchn/xeneventchn.mli
index 98b3c86f37..870429b6b5 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn.mli
+++ b/tools/ocaml/libs/eventchn/xeneventchn.mli
@@ -43,9 +43,12 @@ val to_int: t -> int
 
 val of_int: int -> t
 
-val init: unit -> handle
-(** Return an initialised event channel interface. On error it
-    will throw a Failure exception. *)
+val init: ?cloexec:bool -> unit -> handle
+(** [init ?cloexec ()]
+    Return an initialised event channel interface.
+    The default is to close the underlying file descriptor
+    on [execve], which can be overriden with [~cloexec:false].
+    On error it will throw a Failure exception. *)
 
 val fdopen: Unix.file_descr -> handle
 (** Return an initialised event channel interface, from an already open evtchn
diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index 7bdf711bc1..aa8a69cc1e 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -50,14 +50,18 @@ static struct custom_operations xenevtchn_ops = {
 	.compare_ext = custom_compare_ext_default, /* Can't compare     */
 };
 
-CAMLprim value stub_eventchn_init(void)
+CAMLprim value stub_eventchn_init(value cloexec)
 {
-	CAMLparam0();
+	CAMLparam1(cloexec);
 	CAMLlocal1(result);
 	xenevtchn_handle *xce;
+	unsigned int flags = 0;
+
+	if ( !Bool_val(cloexec) )
+		flags |= XENEVTCHN_NO_CLOEXEC;
 
 	caml_enter_blocking_section();
-	xce = xenevtchn_open(NULL, 0);
+	xce = xenevtchn_open(NULL, flags);
 	caml_leave_blocking_section();
 
 	if (xce == NULL)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:01:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:01:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452520.710294 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RDE-0002mE-AV; Sat, 03 Dec 2022 12:01:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452520.710294; Sat, 03 Dec 2022 12:01:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RDE-0002m6-7j; Sat, 03 Dec 2022 12:01:44 +0000
Received: by outflank-mailman (input) for mailman id 452520;
 Sat, 03 Dec 2022 12:01:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDD-0002lw-BH
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDD-00087T-9q
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDD-0002WB-9C
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t3srNBhxbZShEYPiEGkklj1hdTA6kA9XDezMxM6mmlA=; b=M3eadM7EvtnkJm0LjVuxEiDpJJ
	h30l9Gw4KG7UyaIvu4Ui3k3gSM2RzuHA+c0mUkeksTYmTXvYWnfvluxMI/ZSTb0fMiTott6AtNUDs
	nF3Tejw3paf3qAyMBbLliZbTrVV7ido0MPuqpFSLn2JhtXIBjY9vKEKXxV/DNgHM6b2g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Style fixes to Domain
Message-Id: <E1p1RDD-0002WB-9C@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:01:43 +0000

commit b45bfaf359e4821b1bf98a4fcd194d7fd176f167
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 30 14:56:43 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/oxenstored: Style fixes to Domain
    
    This file has some style problems so severe that they interfere with the
    readability of the subsequent bugfix patches.
    
    Fix these issues ahead of time, to make the subsequent changes more readable.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/domain.ml | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index 81cb59b8f1..ab08dcf37f 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -57,17 +57,16 @@ let is_paused_for_conflict dom = dom.conflict_credit <= 0.0
 let is_free_to_conflict = is_dom0
 
 let string_of_port = function
-| None -> "None"
-| Some x -> string_of_int (Xeneventchn.to_int x)
+	| None -> "None"
+	| Some x -> string_of_int (Xeneventchn.to_int x)
 
 let dump d chan =
 	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
 
-let notify dom = match dom.port with
-| None ->
-	warn "domain %d: attempt to notify on unknown port" dom.id
-| Some port ->
-	Event.notify dom.eventchn port
+let notify dom =
+	match dom.port with
+	| None -> warn "domain %d: attempt to notify on unknown port" dom.id
+	| Some port -> Event.notify dom.eventchn port
 
 let bind_interdomain dom =
 	begin match dom.port with
@@ -84,8 +83,7 @@ let close dom =
 	| None -> ()
 	| Some port -> Event.unbind dom.eventchn port
 	end;
-	Xenmmap.unmap dom.interface;
-	()
+	Xenmmap.unmap dom.interface
 
 let make id mfn remote_port interface eventchn = {
 	id = id;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:01:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:01:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452521.710297 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RDO-0002pB-Bz; Sat, 03 Dec 2022 12:01:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452521.710297; Sat, 03 Dec 2022 12:01:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RDO-0002p3-9C; Sat, 03 Dec 2022 12:01:54 +0000
Received: by outflank-mailman (input) for mailman id 452521;
 Sat, 03 Dec 2022 12:01:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDN-0002ov-F8
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDN-00087a-EX
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDN-0002X3-C0
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:01:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nuiQ9HU1pIELIIBdN/la9dqcaCVzAqKWCmZGoXu1+/A=; b=LeHtJO5rNzJ+YmR6hHVdxllt8n
	MiHiPO7QNMBbxUAqh6S8ym1MmXB5DXxx8BqtY+s9hV9dbBuNetacPy1pot1y1EwqB3wJM4+2dLmaU
	HC8NEYfqdN9yHXXmfzQbp4DAJT63Gs2qIrV8XaAwuGqp7MLDU2jVntxUGnCRDxdXCa1o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Bind the DOM_EXC VIRQ in in Event.init()
Message-Id: <E1p1RDN-0002X3-C0@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:01:53 +0000

commit 9804a5db435fe40c8ded8cf36c2d2b2281c56f1d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Nov 29 21:05:43 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/oxenstored: Bind the DOM_EXC VIRQ in in Event.init()
    
    Xenstored always needs to bind the DOM_EXC VIRQ.
    
    Instead of doing it shortly after the call to Event.init(), do it in the
    constructor directly.  This removes the need for the field to be a mutable
    option.
    
    It will also simplify a future change to support live update.  Rename the
    field from virq_port (which could be any VIRQ) to it's proper name.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/event.ml     | 9 ++++++---
 tools/ocaml/xenstored/xenstored.ml | 4 +---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/ocaml/xenstored/event.ml b/tools/ocaml/xenstored/event.ml
index ccca90b6fc..a3be296374 100644
--- a/tools/ocaml/xenstored/event.ml
+++ b/tools/ocaml/xenstored/event.ml
@@ -17,12 +17,15 @@
 (**************** high level binding ****************)
 type t = {
 	handle: Xeneventchn.handle;
-	mutable virq_port: Xeneventchn.t option;
+	domexc: Xeneventchn.t;
 }
 
-let init () = { handle = Xeneventchn.init (); virq_port = None; }
+let init () =
+	let handle = Xeneventchn.init () in
+	let domexc = Xeneventchn.bind_dom_exc_virq handle in
+	{ handle; domexc }
+
 let fd eventchn = Xeneventchn.fd eventchn.handle
-let bind_dom_exc_virq eventchn = eventchn.virq_port <- Some (Xeneventchn.bind_dom_exc_virq eventchn.handle)
 let bind_interdomain eventchn domid port = Xeneventchn.bind_interdomain eventchn.handle domid port
 let unbind eventchn port = Xeneventchn.unbind eventchn.handle port
 let notify eventchn port = Xeneventchn.notify eventchn.handle port
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index c5dc7a28d0..55071b49ec 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -397,7 +397,6 @@ let _ =
 	if cf.restart && Sys.file_exists Disk.xs_daemon_database then (
 		let rwro = DB.from_file store domains cons Disk.xs_daemon_database in
 		info "Live reload: database loaded";
-		Event.bind_dom_exc_virq eventchn;
 		Process.LiveUpdate.completed ();
 		rwro
 	) else (
@@ -413,7 +412,6 @@ let _ =
 
 		if cf.domain_init then (
 			Connections.add_domain cons (Domains.create0 domains);
-			Event.bind_dom_exc_virq eventchn
 		);
 		rw_sock
 	) in
@@ -451,7 +449,7 @@ let _ =
 			let port = Event.pending eventchn in
 			debug "pending port %d" (Xeneventchn.to_int port);
 			finally (fun () ->
-				if Some port = eventchn.Event.virq_port then (
+				if port = eventchn.Event.domexc then (
 					let (notify, deaddom) = Domains.cleanup domains in
 					List.iter (Store.reset_permissions store) deaddom;
 					List.iter (Connections.del_domain cons) deaddom;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:02:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:02:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452522.710302 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RDY-0002sG-Fv; Sat, 03 Dec 2022 12:02:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452522.710302; Sat, 03 Dec 2022 12:02:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RDY-0002s8-Ck; Sat, 03 Dec 2022 12:02:04 +0000
Received: by outflank-mailman (input) for mailman id 452522;
 Sat, 03 Dec 2022 12:02:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDX-0002s1-IQ
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDX-00087r-Hd
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDX-0002Xj-Gs
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uU8kHcdEQQGzjFHdEIUPzg/nkxbWl36ohDG6hqLrWag=; b=mJmB6ATjNElEzBwFf4qkWw4+ab
	6A1T5yW7C7y7CyFkAMa2T1csJ+7jq8YodaHJM+bi/BdygskK4Nkh3m2nD7tX0fPnPjoi4AS7Rugxc
	uixMuMfLJjOiFkuMzEVrzuBEfsEpKSm8uNuEJh/Edxc2pYYrwiIaLsINnoTXriXKphl0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Rename some 'port' variables to 'remote_port'
Message-Id: <E1p1RDX-0002Xj-Gs@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:02:03 +0000

commit 31fbee749a75621039ca601eaee7222050a7dd83
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 30 03:17:28 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/oxenstored: Rename some 'port' variables to 'remote_port'
    
    This will make the logic clearer when we plumb local_port through these
    functions.
    
    While doing this, rearrange the construct in Domains.create0 to separate the
    remote port handling from the interface handling.  (The interface logic is
    dubious in several ways, but not altered by this cleanup.)
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/domains.ml   | 26 ++++++++++++--------------
 tools/ocaml/xenstored/process.ml   | 12 ++++++------
 tools/ocaml/xenstored/xenstored.ml |  8 ++++----
 3 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index 17fe2fa257..26018ac0dd 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -122,9 +122,9 @@ let cleanup doms =
 let resume _doms _domid =
 	()
 
-let create doms domid mfn port =
+let create doms domid mfn remote_port =
 	let interface = Xenctrl.map_foreign_range xc domid (Xenmmap.getpagesize()) mfn in
-	let dom = Domain.make domid mfn port interface doms.eventchn in
+	let dom = Domain.make domid mfn remote_port interface doms.eventchn in
 	Hashtbl.add doms.table domid dom;
 	Domain.bind_interdomain dom;
 	dom
@@ -133,18 +133,16 @@ let xenstored_kva = ref ""
 let xenstored_port = ref ""
 
 let create0 doms =
-	let port, interface =
-		(
-			let port = Utils.read_file_single_integer !xenstored_port
-			and fd = Unix.openfile !xenstored_kva
-					       [ Unix.O_RDWR ] 0o600 in
-			let interface = Xenmmap.mmap fd Xenmmap.RDWR Xenmmap.SHARED
-						  (Xenmmap.getpagesize()) 0 in
-			Unix.close fd;
-			port, interface
-		)
-		in
-	let dom = Domain.make 0 Nativeint.zero port interface doms.eventchn in
+	let remote_port = Utils.read_file_single_integer !xenstored_port in
+
+	let interface =
+		let fd = Unix.openfile !xenstored_kva [ Unix.O_RDWR ] 0o600 in
+		let interface = Xenmmap.mmap fd Xenmmap.RDWR Xenmmap.SHARED (Xenmmap.getpagesize()) 0 in
+		Unix.close fd;
+		interface
+	in
+
+	let dom = Domain.make 0 Nativeint.zero remote_port interface doms.eventchn in
 	Hashtbl.add doms.table 0 dom;
 	Domain.bind_interdomain dom;
 	Domain.notify dom;
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 72a79e9328..b2973aca2a 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -558,10 +558,10 @@ let do_transaction_end con t domains cons data =
 let do_introduce con t domains cons data =
 	if not (Connection.is_dom0 con)
 	then raise Define.Permission_denied;
-	let (domid, mfn, port) =
+	let (domid, mfn, remote_port) =
 		match (split None '\000' data) with
-		| domid :: mfn :: port :: _ ->
-			int_of_string domid, Nativeint.of_string mfn, int_of_string port
+		| domid :: mfn :: remote_port :: _ ->
+			int_of_string domid, Nativeint.of_string mfn, int_of_string remote_port
 		| _                         -> raise Invalid_Cmd_Args;
 		in
 	let dom =
@@ -569,18 +569,18 @@ let do_introduce con t domains cons data =
 			let edom = Domains.find domains domid in
 			if (Domain.get_mfn edom) = mfn && (Connections.find_domain cons domid) != con then begin
 				(* Use XS_INTRODUCE for recreating the xenbus event-channel. *)
-				edom.remote_port <- port;
+				edom.remote_port <- remote_port;
 				Domain.bind_interdomain edom;
 			end;
 			edom
 		else try
-			let ndom = Domains.create domains domid mfn port in
+			let ndom = Domains.create domains domid mfn remote_port in
 			Connections.add_domain cons ndom;
 			Connections.fire_spec_watches (Transaction.get_root t) cons Store.Path.introduce_domain;
 			ndom
 		with _ -> raise Invalid_Cmd_Args
 	in
-	if (Domain.get_remote_port dom) <> port || (Domain.get_mfn dom) <> mfn then
+	if (Domain.get_remote_port dom) <> remote_port || (Domain.get_mfn dom) <> mfn then
 		raise Domain_not_match
 
 let do_release con t domains cons data =
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 55071b49ec..1f11f576b5 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -167,10 +167,10 @@ let from_channel_f chan global_f socket_f domain_f watch_f store_f =
 					global_f ~rw
 				| "socket" :: fd :: [] ->
 					socket_f ~fd:(int_of_string fd)
-				| "dom" :: domid :: mfn :: port :: []->
+				| "dom" :: domid :: mfn :: remote_port :: []->
 					domain_f (int_of_string domid)
 					         (Nativeint.of_string mfn)
-					         (int_of_string port)
+					         (int_of_string remote_port)
 				| "watch" :: domid :: path :: token :: [] ->
 					watch_f (int_of_string domid)
 					        (unhexify path) (unhexify token)
@@ -209,10 +209,10 @@ let from_channel store cons doms chan =
 		else
 			warn "Ignoring invalid socket FD %d" fd
 	in
-	let domain_f domid mfn port =
+	let domain_f domid mfn remote_port =
 		let ndom =
 			if domid > 0 then
-				Domains.create doms domid mfn port
+				Domains.create doms domid mfn remote_port
 			else
 				Domains.create0 doms
 			in
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:02:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:02:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452523.710307 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RDi-0002v3-HF; Sat, 03 Dec 2022 12:02:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452523.710307; Sat, 03 Dec 2022 12:02:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RDi-0002uw-EJ; Sat, 03 Dec 2022 12:02:14 +0000
Received: by outflank-mailman (input) for mailman id 452523;
 Sat, 03 Dec 2022 12:02:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDh-0002un-Lj
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDh-000882-Kz
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDh-0002Zh-Jq
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YZ+SOuTdRyrKUyhmfUy6t8k2vjpTecPgWWTeV0FuN+U=; b=EmeP26PxJuVsLvKz//x6REiLQK
	7S8AiOYlZBOv8sgMsCqoJomWUpulSMTCrXR9xkwWzJFZF80SxGtTzWb1kf+GTK8JegdF18mXrRexe
	Rj9I6U9GgCDb2NIHODUyjAfEK2//Ai9Tx4p0L7VNbuW4s29ZuY7CNmlpA0Ar0ISWfCcY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Implement Domain.rebind_evtchn
Message-Id: <E1p1RDh-0002Zh-Jq@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:02:13 +0000

commit aecdc28d9538ca2a1028ef9bc6550cb171dbbed4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 30 11:55:58 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/oxenstored: Implement Domain.rebind_evtchn
    
    Generally speaking, the event channel local/remote port is fixed for the
    lifetime of the associated domain object.  The exception to this is a
    secondary XS_INTRODUCE (defined to re-bind to a new event channel) which pokes
    around at the domain object's internal state.
    
    We need to refactor the evtchn handling to support live update, so start by
    moving the relevant manipulation into Domain.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/domain.ml  | 12 ++++++++++++
 tools/ocaml/xenstored/process.ml |  3 +--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index ab08dcf37f..d59a9401e2 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -63,6 +63,18 @@ let string_of_port = function
 let dump d chan =
 	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
 
+let rebind_evtchn d remote_port =
+	begin match d.port with
+	| None -> ()
+	| Some p -> Event.unbind d.eventchn p
+	end;
+	let local = Event.bind_interdomain d.eventchn d.id remote_port in
+	debug "domain %d rebind (l %s, r %d) => (l %d, r %d)"
+	      d.id (string_of_port d.port) d.remote_port
+	      (Xeneventchn.to_int local) remote_port;
+	d.remote_port <- remote_port;
+	d.port <- Some (local)
+
 let notify dom =
 	match dom.port with
 	| None -> warn "domain %d: attempt to notify on unknown port" dom.id
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index b2973aca2a..1c80e7198d 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -569,8 +569,7 @@ let do_introduce con t domains cons data =
 			let edom = Domains.find domains domid in
 			if (Domain.get_mfn edom) = mfn && (Connections.find_domain cons domid) != con then begin
 				(* Use XS_INTRODUCE for recreating the xenbus event-channel. *)
-				edom.remote_port <- remote_port;
-				Domain.bind_interdomain edom;
+				Domain.rebind_evtchn edom remote_port;
 			end;
 			edom
 		else try
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:02:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:02:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452524.710312 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RDs-0002y7-JF; Sat, 03 Dec 2022 12:02:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452524.710312; Sat, 03 Dec 2022 12:02:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RDs-0002xx-Fr; Sat, 03 Dec 2022 12:02:24 +0000
Received: by outflank-mailman (input) for mailman id 452524;
 Sat, 03 Dec 2022 12:02:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDr-0002xn-Ot
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDr-00088C-OA
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RDr-0002aE-NC
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xoiqE69GDq2BUmnYUX7E/Jg7Ni3D2qWVVxPbu2iqqa0=; b=qzZAh8hRiWDwgEQXK95kIP359T
	LcUVXnNQaO0wbIDjH5nPLibxjqiPDsCsSAaB3/vNW0PMJxQBI/8orPRyT1FDjN5h/Bn+n/UGR/udb
	t0Ulvsj479wObFy6cBp/qy36/igUSHjiWiL0BkC9jZs/2+9X51bnCie719UoVXyP5S2M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Rework Domain evtchn handling to use port_pair
Message-Id: <E1p1RDr-0002aE-NC@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:02:23 +0000

commit df2db174b36eba67c218763ef621c67912202fc6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 30 11:59:34 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/oxenstored: Rework Domain evtchn handling to use port_pair
    
    Inter-domain event channels are always a pair of local and remote ports.
    Right now the handling is asymmetric, caused by the fact that the evtchn is
    bound after the associated Domain object is constructed.
    
    First, move binding of the event channel into the Domain.make() constructor.
    This means the local port no longer needs to be an option.  It also removes
    the final callers of Domain.bind_interdomain.
    
    Next, introduce a new port_pair type to encapsulate the fact that these two
    should be updated together, and replace the previous port and remote_port
    fields.  This refactoring also changes the Domain.get_port interface (removing
    an option) so take the opportunity to name it get_local_port instead.
    
    Also, this fixes a use-after-free risk with Domain.close.  Once the evtchn has
    been unbound, the same local port number can be reused for a different
    purpose, so explicitly invalidate the ports to prevent their accidental misuse
    in the future.
    
    This also cleans up some of the debugging, to always print a port pair.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/connections.ml |  9 +----
 tools/ocaml/xenstored/domain.ml      | 75 ++++++++++++++++++------------------
 tools/ocaml/xenstored/domains.ml     |  2 -
 3 files changed, 39 insertions(+), 47 deletions(-)

diff --git a/tools/ocaml/xenstored/connections.ml b/tools/ocaml/xenstored/connections.ml
index 7d68c583b4..a80ae0bed2 100644
--- a/tools/ocaml/xenstored/connections.ml
+++ b/tools/ocaml/xenstored/connections.ml
@@ -48,9 +48,7 @@ let add_domain cons dom =
 	let xbcon = Xenbus.Xb.open_mmap ~capacity (Domain.get_interface dom) (fun () -> Domain.notify dom) in
 	let con = Connection.create xbcon (Some dom) in
 	Hashtbl.add cons.domains (Domain.get_id dom) con;
-	match Domain.get_port dom with
-	| Some p -> Hashtbl.add cons.ports p con;
-	| None -> ()
+	Hashtbl.add cons.ports (Domain.get_local_port dom) con
 
 let select ?(only_if = (fun _ -> true)) cons =
 	Hashtbl.fold (fun _ con (ins, outs) ->
@@ -97,10 +95,7 @@ let del_domain cons id =
 		let con = find_domain cons id in
 		Hashtbl.remove cons.domains id;
 		(match Connection.get_domain con with
-		 | Some d ->
-		   (match Domain.get_port d with
-		    | Some p -> Hashtbl.remove cons.ports p
-		    | None -> ())
+		 | Some d -> Hashtbl.remove cons.ports (Domain.get_local_port d)
 		 | None -> ());
 		del_watches cons con;
 		Connection.close con
diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index d59a9401e2..481e10794d 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -19,14 +19,31 @@ open Printf
 let debug fmt = Logging.debug "domain" fmt
 let warn  fmt = Logging.warn  "domain" fmt
 
+(* A bound inter-domain event channel port pair.  The remote port, and the
+   local port it is bound to. *)
+type port_pair =
+{
+	local: Xeneventchn.t;
+	remote: int;
+}
+
+(* Sentinal port_pair with both set to EVTCHN_INVALID *)
+let invalid_ports =
+{
+	local = Xeneventchn.of_int 0;
+	remote = 0
+}
+
+let string_of_port_pair p =
+	sprintf "(l %d, r %d)" (Xeneventchn.to_int p.local) p.remote
+
 type t =
 {
 	id: Xenctrl.domid;
 	mfn: nativeint;
 	interface: Xenmmap.mmap_interface;
 	eventchn: Event.t;
-	mutable remote_port: int;
-	mutable port: Xeneventchn.t option;
+	mutable ports: port_pair;
 	mutable bad_client: bool;
 	mutable io_credit: int; (* the rounds of ring process left to do, default is 0,
 	                           usually set to 1 when there is work detected, could
@@ -41,8 +58,8 @@ let is_dom0 d = d.id = 0
 let get_id domain = domain.id
 let get_interface d = d.interface
 let get_mfn d = d.mfn
-let get_remote_port d = d.remote_port
-let get_port d = d.port
+let get_remote_port d = d.ports.remote
+let get_local_port d = d.ports.local
 
 let is_bad_domain domain = domain.bad_client
 let mark_as_bad domain = domain.bad_client <- true
@@ -56,54 +73,36 @@ let is_paused_for_conflict dom = dom.conflict_credit <= 0.0
 
 let is_free_to_conflict = is_dom0
 
-let string_of_port = function
-	| None -> "None"
-	| Some x -> string_of_int (Xeneventchn.to_int x)
-
 let dump d chan =
-	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
+	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.ports.remote
 
 let rebind_evtchn d remote_port =
-	begin match d.port with
-	| None -> ()
-	| Some p -> Event.unbind d.eventchn p
-	end;
+	Event.unbind d.eventchn d.ports.local;
 	let local = Event.bind_interdomain d.eventchn d.id remote_port in
-	debug "domain %d rebind (l %s, r %d) => (l %d, r %d)"
-	      d.id (string_of_port d.port) d.remote_port
-	      (Xeneventchn.to_int local) remote_port;
-	d.remote_port <- remote_port;
-	d.port <- Some (local)
+	let new_ports = { local; remote = remote_port } in
+	debug "domain %d rebind %s => %s"
+	      d.id (string_of_port_pair d.ports) (string_of_port_pair new_ports);
+	d.ports <- new_ports
 
 let notify dom =
-	match dom.port with
-	| None -> warn "domain %d: attempt to notify on unknown port" dom.id
-	| Some port -> Event.notify dom.eventchn port
-
-let bind_interdomain dom =
-	begin match dom.port with
-	| None -> ()
-	| Some port -> Event.unbind dom.eventchn port
-	end;
-	dom.port <- Some (Event.bind_interdomain dom.eventchn dom.id dom.remote_port);
-	debug "bound domain %d remote port %d to local port %s" dom.id dom.remote_port (string_of_port dom.port)
-
+	Event.notify dom.eventchn dom.ports.local
 
 let close dom =
-	debug "domain %d unbound port %s" dom.id (string_of_port dom.port);
-	begin match dom.port with
-	| None -> ()
-	| Some port -> Event.unbind dom.eventchn port
-	end;
+	debug "domain %d unbind %s" dom.id (string_of_port_pair dom.ports);
+	Event.unbind dom.eventchn dom.ports.local;
+	dom.ports <- invalid_ports;
 	Xenmmap.unmap dom.interface
 
-let make id mfn remote_port interface eventchn = {
+let make id mfn remote_port interface eventchn =
+	let local = Event.bind_interdomain eventchn id remote_port in
+	let ports = { local; remote = remote_port } in
+	debug "domain %d bind %s" id (string_of_port_pair ports);
+{
 	id = id;
 	mfn = mfn;
-	remote_port = remote_port;
+	ports;
 	interface = interface;
 	eventchn = eventchn;
-	port = None;
 	bad_client = false;
 	io_credit = 0;
 	conflict_credit = !Define.conflict_burst_limit;
diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index 26018ac0dd..2ab0c5f4d8 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -126,7 +126,6 @@ let create doms domid mfn remote_port =
 	let interface = Xenctrl.map_foreign_range xc domid (Xenmmap.getpagesize()) mfn in
 	let dom = Domain.make domid mfn remote_port interface doms.eventchn in
 	Hashtbl.add doms.table domid dom;
-	Domain.bind_interdomain dom;
 	dom
 
 let xenstored_kva = ref ""
@@ -144,7 +143,6 @@ let create0 doms =
 
 	let dom = Domain.make 0 Nativeint.zero remote_port interface doms.eventchn in
 	Hashtbl.add doms.table 0 dom;
-	Domain.bind_interdomain dom;
 	Domain.notify dom;
 	dom
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:02:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:02:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452525.710314 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RE2-0003BF-KW; Sat, 03 Dec 2022 12:02:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452525.710314; Sat, 03 Dec 2022 12:02: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 1p1RE2-0003B7-HX; Sat, 03 Dec 2022 12:02:34 +0000
Received: by outflank-mailman (input) for mailman id 452525;
 Sat, 03 Dec 2022 12:02:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RE1-0003Aw-Rm
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RE1-00088G-R7
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RE1-0002af-QV
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RxJYEfKKTsvBD10Ux1F1lJi6lw60ZQW64ihY88oCNYI=; b=H/rxbajiur3eZ40VtKifa/qkjF
	AJjFq/VJyDOQrGy1bGMM2qecaAx5e2KqXCi2tak03l7D7GZSytPxt6d0BczP3byLNhBqhqi3CISvO
	6lyuq2A8+FasoGOmmt8UGPgWXEZYIxBhrwNqWcHKtcYNQzXPNBnWQzRIfIsMy6P+I6iE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Keep /dev/xen/evtchn open across live update
Message-Id: <E1p1RE1-0002af-QV@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:02:33 +0000

commit 9b224c25293a53fcbe32da68052d861dda71a6f4
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Thu Nov 3 15:31:39 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/oxenstored: Keep /dev/xen/evtchn open across live update
    
    Closing the evtchn handle will unbind and free all local ports.  The new
    xenstored would need to rebind all evtchns, which is work that we don't want
    or need to be doing during the critical handover period.
    
    However, it turns out that the Windows PV drivers also rebind their local port
    too across suspend/resume, leaving (o)xenstored with a stale idea of the
    remote port to use.  In this case, reusing the established connection is the
    only robust option.
    
    Therefore:
     * Have oxenstored open /dev/xen/evtchn without CLOEXEC at start of day.
     * Extend the handover information with the evtchn fd, domexc virq local port,
       and the local port number for each domain connection.
     * Have (the new) oxenstored recover the open handle using Xeneventchn.fdopen,
       and use the provided local ports rather than trying to rebind them.
    
    When this new information isn't present (i.e. live updating from an oxenstored
    prior to this change), the best-effort status quo will have to do.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/domain.ml    | 13 ++++--
 tools/ocaml/xenstored/domains.ml   |  9 ++--
 tools/ocaml/xenstored/event.ml     | 20 +++++++--
 tools/ocaml/xenstored/process.ml   |  2 +-
 tools/ocaml/xenstored/xenstored.ml | 85 +++++++++++++++++++++++++-------------
 5 files changed, 90 insertions(+), 39 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index 481e10794d..5c15752a37 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -74,7 +74,8 @@ let is_paused_for_conflict dom = dom.conflict_credit <= 0.0
 let is_free_to_conflict = is_dom0
 
 let dump d chan =
-	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.ports.remote
+	fprintf chan "dom,%d,%nd,%d,%d\n"
+		d.id d.mfn d.ports.remote (Xeneventchn.to_int d.ports.local)
 
 let rebind_evtchn d remote_port =
 	Event.unbind d.eventchn d.ports.local;
@@ -93,8 +94,14 @@ let close dom =
 	dom.ports <- invalid_ports;
 	Xenmmap.unmap dom.interface
 
-let make id mfn remote_port interface eventchn =
-	let local = Event.bind_interdomain eventchn id remote_port in
+(* On clean start, local_port will be None, and we must bind the remote port
+   given.  On Live Update, the event channel is already bound, and both the
+   local and remote port numbers come from the transfer record. *)
+let make ?local_port ~remote_port id mfn interface eventchn =
+	let local = match local_port with
+		| None -> Event.bind_interdomain eventchn id remote_port
+		| Some p -> Xeneventchn.of_int p
+	in
 	let ports = { local; remote = remote_port } in
 	debug "domain %d bind %s" id (string_of_port_pair ports);
 {
diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index 2ab0c5f4d8..b6c075c838 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -56,6 +56,7 @@ let exist doms id = Hashtbl.mem doms.table id
 let find doms id = Hashtbl.find doms.table id
 let number doms = Hashtbl.length doms.table
 let iter doms fct = Hashtbl.iter (fun _ b -> fct b) doms.table
+let eventchn doms = doms.eventchn
 
 let rec is_empty_queue q =
 	Queue.is_empty q ||
@@ -122,16 +123,16 @@ let cleanup doms =
 let resume _doms _domid =
 	()
 
-let create doms domid mfn remote_port =
+let create doms ?local_port ~remote_port domid mfn =
 	let interface = Xenctrl.map_foreign_range xc domid (Xenmmap.getpagesize()) mfn in
-	let dom = Domain.make domid mfn remote_port interface doms.eventchn in
+	let dom = Domain.make ?local_port ~remote_port domid mfn interface doms.eventchn in
 	Hashtbl.add doms.table domid dom;
 	dom
 
 let xenstored_kva = ref ""
 let xenstored_port = ref ""
 
-let create0 doms =
+let create0 ?local_port doms =
 	let remote_port = Utils.read_file_single_integer !xenstored_port in
 
 	let interface =
@@ -141,7 +142,7 @@ let create0 doms =
 		interface
 	in
 
-	let dom = Domain.make 0 Nativeint.zero remote_port interface doms.eventchn in
+	let dom = Domain.make ?local_port ~remote_port 0 Nativeint.zero interface doms.eventchn in
 	Hashtbl.add doms.table 0 dom;
 	Domain.notify dom;
 	dom
diff --git a/tools/ocaml/xenstored/event.ml b/tools/ocaml/xenstored/event.ml
index a3be296374..629dc6041b 100644
--- a/tools/ocaml/xenstored/event.ml
+++ b/tools/ocaml/xenstored/event.ml
@@ -20,9 +20,18 @@ type t = {
 	domexc: Xeneventchn.t;
 }
 
-let init () =
-	let handle = Xeneventchn.init () in
-	let domexc = Xeneventchn.bind_dom_exc_virq handle in
+(* On clean start, both parameters will be None, and we must open the evtchn
+   handle and bind the DOM_EXC VIRQ.  On Live Update, the fd is preserved
+   across exec(), and the DOM_EXC VIRQ still bound. *)
+let init ?fd ?domexc_port () =
+	let handle = match fd with
+		| None -> Xeneventchn.init ~cloexec:false ()
+		| Some fd -> fd |> Utils.FD.of_int |> Xeneventchn.fdopen
+	in
+	let domexc = match domexc_port with
+		| None -> Xeneventchn.bind_dom_exc_virq handle
+		| Some p -> Xeneventchn.of_int p
+	in
 	{ handle; domexc }
 
 let fd eventchn = Xeneventchn.fd eventchn.handle
@@ -31,3 +40,8 @@ let unbind eventchn port = Xeneventchn.unbind eventchn.handle port
 let notify eventchn port = Xeneventchn.notify eventchn.handle port
 let pending eventchn = Xeneventchn.pending eventchn.handle
 let unmask eventchn port = Xeneventchn.unmask eventchn.handle port
+
+let dump e chan =
+	Printf.fprintf chan "evtchn-dev,%d,%d\n"
+		       (Utils.FD.to_int @@ Xeneventchn.fd e.handle)
+		       (Xeneventchn.to_int e.domexc)
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 1c80e7198d..02bd0f7d80 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -573,7 +573,7 @@ let do_introduce con t domains cons data =
 			end;
 			edom
 		else try
-			let ndom = Domains.create domains domid mfn remote_port in
+			let ndom = Domains.create ~remote_port domains domid mfn in
 			Connections.add_domain cons ndom;
 			Connections.fire_spec_watches (Transaction.get_root t) cons Store.Path.introduce_domain;
 			ndom
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 1f11f576b5..f526f4fb23 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -144,7 +144,7 @@ exception Bad_format of string
 
 let dump_format_header = "$xenstored-dump-format"
 
-let from_channel_f chan global_f socket_f domain_f watch_f store_f =
+let from_channel_f chan global_f evtchn_f socket_f domain_f watch_f store_f =
 	let unhexify s = Utils.unhexify s in
 	let getpath s =
 		let u = Utils.unhexify s in
@@ -165,12 +165,19 @@ let from_channel_f chan global_f socket_f domain_f watch_f store_f =
 					(* there might be more parameters here,
 					   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)
 				| "socket" :: fd :: [] ->
 					socket_f ~fd:(int_of_string fd)
-				| "dom" :: domid :: mfn :: remote_port :: []->
-					domain_f (int_of_string domid)
-					         (Nativeint.of_string mfn)
-					         (int_of_string remote_port)
+				| "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
+					domain_f ?local_port
+						 ~remote_port:(int_of_string remote_port)
+						 (int_of_string domid)
+						 (Nativeint.of_string mfn)
 				| "watch" :: domid :: path :: token :: [] ->
 					watch_f (int_of_string domid)
 					        (unhexify path) (unhexify token)
@@ -189,10 +196,21 @@ let from_channel_f chan global_f socket_f domain_f watch_f store_f =
 	done;
 	info "Completed loading xenstore dump"
 
-let from_channel store cons doms chan =
+let from_channel store cons domains_init chan =
 	(* don't let the permission get on our way, full perm ! *)
 	let op = Store.get_ops store Perms.Connection.full_rights in
 	let rwro = ref (None) in
+	let doms = ref (None) in
+
+	let require_doms () =
+		match !doms with
+		| None ->
+			warn "No event channel file descriptor available in dump!";
+		        let domains = domains_init @@ Event.init () in
+		        doms := Some domains;
+		        domains
+		| Some d -> d
+	in
 	let global_f ~rw =
 		let get_listen_sock sockfd =
 			let fd = sockfd |> int_of_string |> Utils.FD.of_int in
@@ -201,6 +219,10 @@ let from_channel store cons doms chan =
 		in
 		rwro := get_listen_sock rw
 	in
+	let evtchn_f ~fd ~domexc_port =
+		let evtchn = Event.init ~fd ~domexc_port () in
+		doms := Some(domains_init evtchn)
+	in
 	let socket_f ~fd =
 		let ufd = Utils.FD.of_int fd in
 		let is_valid = try (Unix.fstat ufd).Unix.st_kind = Unix.S_SOCK with _ -> false in
@@ -209,12 +231,13 @@ let from_channel store cons doms chan =
 		else
 			warn "Ignoring invalid socket FD %d" fd
 	in
-	let domain_f domid mfn remote_port =
+	let domain_f ?local_port ~remote_port domid mfn =
+		let doms = require_doms () in
 		let ndom =
 			if domid > 0 then
-				Domains.create doms domid mfn remote_port
+				Domains.create ?local_port ~remote_port doms domid mfn
 			else
-				Domains.create0 doms
+				Domains.create0 ?local_port doms
 			in
 		Connections.add_domain cons ndom;
 		in
@@ -229,8 +252,8 @@ let from_channel store cons doms chan =
 		op.Store.write path value;
 		op.Store.setperms path perms
 		in
-	from_channel_f chan global_f socket_f domain_f watch_f store_f;
-	!rwro
+	from_channel_f chan global_f evtchn_f socket_f domain_f watch_f store_f;
+	!rwro, require_doms ()
 
 let from_file store cons doms file =
 	info "Loading xenstore dump from %s" file;
@@ -238,7 +261,7 @@ let from_file store cons doms file =
 	finally (fun () -> from_channel store doms cons channel)
 	        (fun () -> close_in channel)
 
-let to_channel store cons rw chan =
+let to_channel store cons (rw, evtchn) chan =
 	let hexify s = Utils.hexify s in
 
 	fprintf chan "%s\n" dump_format_header;
@@ -248,6 +271,9 @@ let to_channel store cons rw chan =
 		Utils.FD.to_int fd in
 	fprintf chan "global,%d\n" (fdopt rw);
 
+	(* dump evtchn device info *)
+	Event.dump evtchn chan;
+
 	(* dump connections related to domains: domid, mfn, eventchn port/ sockets, and watches *)
 	Connections.iter cons (fun con -> Connection.dump con chan);
 
@@ -367,7 +393,6 @@ let _ =
 	| None         -> () end;
 
 	let store = Store.create () in
-	let eventchn = Event.init () in
 	let next_frequent_ops = ref 0. in
 	let advance_next_frequent_ops () =
 		next_frequent_ops := (Unix.gettimeofday () +. !Define.conflict_max_history_seconds)
@@ -375,16 +400,8 @@ let _ =
 	let delay_next_frequent_ops_by duration =
 		next_frequent_ops := !next_frequent_ops +. duration
 	in
-	let domains = Domains.init eventchn advance_next_frequent_ops in
+	let domains_init eventchn = Domains.init eventchn advance_next_frequent_ops in
 
-	(* For things that need to be done periodically but more often
-	 * than the periodic_ops function *)
-	let frequent_ops () =
-		if Unix.gettimeofday () > !next_frequent_ops then (
-			History.trim ();
-			Domains.incr_conflict_credit domains;
-			advance_next_frequent_ops ()
-		) in
 	let cons = Connections.create () in
 
 	let quit = ref false in
@@ -393,14 +410,15 @@ let _ =
 	List.iter (fun path ->
 		Store.write store Perms.Connection.full_rights path "") Store.Path.specials;
 
-	let rw_sock =
+	let rw_sock, domains =
 	if cf.restart && Sys.file_exists Disk.xs_daemon_database then (
-		let rwro = DB.from_file store domains cons Disk.xs_daemon_database in
+		let rw, domains = DB.from_file store domains_init cons Disk.xs_daemon_database in
 		info "Live reload: database loaded";
 		Process.LiveUpdate.completed ();
-		rwro
+		rw, domains
 	) else (
 		info "No live reload: regular startup";
+		let domains = domains_init @@ Event.init () in
 		if !Disk.enable then (
 			info "reading store from disk";
 			Disk.read store
@@ -413,9 +431,18 @@ let _ =
 		if cf.domain_init then (
 			Connections.add_domain cons (Domains.create0 domains);
 		);
-		rw_sock
+		rw_sock, domains
 	) in
 
+	(* For things that need to be done periodically but more often
+	 * than the periodic_ops function *)
+	let frequent_ops () =
+		if Unix.gettimeofday () > !next_frequent_ops then (
+			History.trim ();
+			Domains.incr_conflict_credit domains;
+			advance_next_frequent_ops ()
+		) in
+
 	(* required for xenstore-control to detect availability of live-update *)
 	let tool_path = Store.Path.of_string "/tool" in
 	if not (Store.path_exists store tool_path) then
@@ -430,8 +457,10 @@ let _ =
 	Sys.set_signal Sys.sigusr1 (Sys.Signal_handle (fun _ -> sigusr1_handler store));
 	Sys.set_signal Sys.sigpipe Sys.Signal_ignore;
 
+	let eventchn = Domains.eventchn domains in
+
 	if cf.activate_access_log then begin
-		let post_rotate () = DB.to_file store cons (None) Disk.xs_daemon_database in
+		let post_rotate () = DB.to_file store cons (None, eventchn) Disk.xs_daemon_database in
 		Logging.init_access_log post_rotate
 	end;
 
@@ -593,7 +622,7 @@ let _ =
 			live_update := Process.LiveUpdate.should_run cons;
 			if !live_update || !quit then begin
 				(* don't initiate live update if saving state fails *)
-				DB.to_file store cons (rw_sock) Disk.xs_daemon_database;
+				DB.to_file store cons (rw_sock, eventchn) Disk.xs_daemon_database;
 				quit := true;
 			end
 		with exc ->
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:02:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:02:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452527.710319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1REC-0003PE-OJ; Sat, 03 Dec 2022 12:02:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452527.710319; Sat, 03 Dec 2022 12:02: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 1p1REC-0003P6-Kc; Sat, 03 Dec 2022 12:02:44 +0000
Received: by outflank-mailman (input) for mailman id 452527;
 Sat, 03 Dec 2022 12:02:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REC-0003P0-1h
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REC-00088g-16
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REB-0002b4-TI
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yaE8eKVIPNnL+UksZ6XA47PmOUhOixOaUHGgl45sQqI=; b=EvBxKCfBNAD8E7WZ9Nc+RIdglL
	s4n0N/VkoB67kH9Ib3CA1xAxtlGPBmSR5g7Vo3AVoJ0GASAZoIbn1HmD+00WV2ty1srQcqrRNQuXY
	RyqtE0HOUvU5RmRY8PUbq3dbefVC+AaVauhy0mwSh5xNVGwGmwUs4gLUtV1wy2QN3G24=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Log live update issues at warning level
Message-Id: <E1p1REB-0002b4-TI@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:02:43 +0000

commit 3f02e0a70fe9f8143454b742563433958d4a87f8
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 8 08:57:47 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/oxenstored: Log live update issues at warning level
    
    During live update, oxenstored tries a best effort approach to recover as many
    domains and information as possible even if it encounters errors restoring
    some domains.
    
    However, logging about misunderstood input is more severe than simply info.
    Log it at warning instead.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/xenstored.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index f526f4fb23..35b8cbd43f 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -186,9 +186,9 @@ let from_channel_f chan global_f evtchn_f socket_f domain_f watch_f store_f =
 					        (Perms.Node.of_string (unhexify perms ^ "\000"))
 					        (unhexify value)
 				| _ ->
-					info "restoring: ignoring unknown line: %s" line
+					warn "restoring: ignoring unknown line: %s" line
 			with exn ->
-				info "restoring: ignoring unknown line: %s (exception: %s)"
+				warn "restoring: ignoring unknown line: %s (exception: %s)"
 				     line (Printexc.to_string exn);
 				()
 		with End_of_file ->
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:02:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:02:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452528.710322 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1REM-0003SV-Ox; Sat, 03 Dec 2022 12:02:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452528.710322; Sat, 03 Dec 2022 12:02: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 1p1REM-0003SN-M7; Sat, 03 Dec 2022 12:02:54 +0000
Received: by outflank-mailman (input) for mailman id 452528;
 Sat, 03 Dec 2022 12:02:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REM-0003SD-4Y
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REM-00088k-3w
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REM-0002bT-3K
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:02:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lAXG3B2ObwaSKfbo9Oll7qbE7JKCSfzUOFUj0iByGqc=; b=BEEZCS5HvOIRQDENX7vDEWJtm0
	boNq7k8jxq6I4JTiZoGflpTb80xbGVNywMDiZXB0BGm14eFZTH/r6xTV2tJZ4Zanff69A2g6GxFz3
	3PoyiEe6geY8VV83RmWv4Lr9a9SpoQn08nMHBEGhgTHXeJ4WHaRvBX2Vz9mrt81O1Ock=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Set uncaught exception handler
Message-Id: <E1p1REM-0002bT-3K@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:02:54 +0000

commit ee7815f49faf743e960dac9e72809eb66393bc6d
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Mon Nov 7 17:41:36 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/oxenstored: Set uncaught exception handler
    
    Unhandled exceptions go to stderr by default, but this doesn't typically work
    for oxenstored because:
     * daemonize reopens stderr as /dev/null
     * systemd redirects stderr to /dev/null too
    
    Debugging an unhandled exception requires reproducing the issue locally when
    using --no-fork, and is not conducive to figuring out what went wrong on a
    remote system.
    
    Install a custom handler which also tries to render the backtrace to the
    configured syslog facility, and DAEMON|ERR otherwise.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/logging.ml   | 29 +++++++++++++++++++++++++++++
 tools/ocaml/xenstored/xenstored.ml |  3 ++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml
index 39c3036155..255051437d 100644
--- a/tools/ocaml/xenstored/logging.ml
+++ b/tools/ocaml/xenstored/logging.ml
@@ -342,3 +342,32 @@ let xb_answer ~tid ~con ~ty data =
 let watch_not_fired ~con perms path =
 	let data = Printf.sprintf "EPERM perms=[%s] path=%s" perms path in
 	access_logging ~tid:0 ~con ~data Watch_not_fired ~level:Info
+
+let msg_of exn bt =
+	Printf.sprintf "Fatal exception: %s\n%s\n" (Printexc.to_string exn)
+		(Printexc.raw_backtrace_to_string bt)
+
+let fallback_exception_handler exn bt =
+	(* stderr goes to /dev/null, so use the logger where possible,
+	   but always print to stderr too, in case everything else fails,
+	   e.g. this can be used to debug with --no-fork
+
+	   this function should try not to raise exceptions, but if it does
+	   the ocaml runtime should still print the exception, both the original,
+	   and the one from this function, but to stderr this time
+	 *)
+	let msg = msg_of exn bt in
+	prerr_endline msg;
+	(* See Printexc.set_uncaught_exception_handler, need to flush,
+	   so has to call stop and flush *)
+	match !xenstored_logger with
+	| Some l -> error "xenstored-fallback" "%s" msg; l.stop ()
+	| None ->
+		(* Too early, no logger set yet.
+		   We normally try to use the configured logger so we don't flood syslog
+		   during development for example, or if the user has a file set
+		 *)
+		try Syslog.log Syslog.Daemon Syslog.Err msg
+		with e ->
+			let bt = Printexc.get_raw_backtrace () in
+			prerr_endline @@ msg_of e bt
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 35b8cbd43f..4d5851c5cb 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -355,7 +355,8 @@ let tweak_gc () =
 	Gc.set { (Gc.get ()) with Gc.max_overhead = !Define.gc_max_overhead }
 
 
-let _ =
+let () =
+	Printexc.set_uncaught_exception_handler Logging.fallback_exception_handler;
 	let cf = do_argv in
 	let pidfile =
 		if Sys.file_exists (config_filename cf) then
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:03:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:03:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452529.710326 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1REX-0003Ux-QR; Sat, 03 Dec 2022 12:03:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452529.710326; Sat, 03 Dec 2022 12:03:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1REX-0003Up-Ni; Sat, 03 Dec 2022 12:03:05 +0000
Received: by outflank-mailman (input) for mailman id 452529;
 Sat, 03 Dec 2022 12:03:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REW-0003Uh-7P
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REW-000899-6h
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REW-0002c3-5x
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oDICYRSAAjTRsjlt/RXZqgsBknZsWV8j81N6SM/V3/8=; b=OwA7NGXIri19p1SwsISzbjqCsR
	xwHS9mdd/JwCbP3QWJZX5PuYGZVSKa/uCaeYMv59VWIgvDakrKkkO72qWeTc6ZCG+YgbHlK40pNJe
	VpkEG3rYBJsZ5CgxVLQA6ezWxBBejnY5WnB/OMedke1ruOYF5TaBjtkgvwBtm6kJ0VO8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored/syslog: Avoid potential NULL dereference
Message-Id: <E1p1REW-0002c3-5x@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:03:04 +0000

commit acd3fb6d65905f8a185dcb9fe6a330a591b96203
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 8 14:24:19 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/oxenstored/syslog: Avoid potential NULL dereference
    
    strdup() may return NULL.  Check for this before passing to syslog().
    
    Drop const from c_msg.  It is bogus, as demonstrated by the need to cast to
    void * in order to free the memory.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/syslog_stubs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/syslog_stubs.c b/tools/ocaml/xenstored/syslog_stubs.c
index 875d48ad57..e16c3a9491 100644
--- a/tools/ocaml/xenstored/syslog_stubs.c
+++ b/tools/ocaml/xenstored/syslog_stubs.c
@@ -14,6 +14,7 @@
 
 #include <syslog.h>
 #include <string.h>
+#include <caml/fail.h>
 #include <caml/mlvalues.h>
 #include <caml/memory.h>
 #include <caml/alloc.h>
@@ -35,14 +36,16 @@ static int __syslog_facility_table[] = {
 value stub_syslog(value facility, value level, value msg)
 {
 	CAMLparam3(facility, level, msg);
-	const char *c_msg = strdup(String_val(msg));
+	char *c_msg = strdup(String_val(msg));
 	int c_facility = __syslog_facility_table[Int_val(facility)]
 	               | __syslog_level_table[Int_val(level)];
 
+	if ( !c_msg )
+		caml_raise_out_of_memory();
 	caml_enter_blocking_section();
 	syslog(c_facility, "%s", c_msg);
 	caml_leave_blocking_section();
 
-	free((void*)c_msg);
+	free(c_msg);
 	CAMLreturn(Val_unit);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:03:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:03:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452533.710341 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1REh-0003os-4F; Sat, 03 Dec 2022 12:03:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452533.710341; Sat, 03 Dec 2022 12:03:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1REh-0003oj-1W; Sat, 03 Dec 2022 12:03:15 +0000
Received: by outflank-mailman (input) for mailman id 452533;
 Sat, 03 Dec 2022 12:03:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REg-0003oS-AS
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REg-00089O-9h
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REg-0002cS-91
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v1b7vC/Yi83664Lps3t/IIFr+bG0YYzd4ZnrE0/WSf8=; b=PTvMYXRvYqQIaLyA6B6VCrq6qD
	20+oT6X2ukxmGRZs2TpvLtXHyBABcurbJbYFczm0UC75Nr/lmvd0Nbp4q/EYVEWTtykzQChIuOxU7
	HN78r8DPWgsHkG07XhGyefYqV0Y+J4pEdX2aZDcgfJFBZKYzvTAQBnkPZ5htcpT0AH0U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/xenctrl: OCaml 5 support, fix use-after-free
Message-Id: <E1p1REg-0002cS-91@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:03:14 +0000

commit 8b3c06a3e545204515e50733669ad6f5c7bddfd8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 23 22:14:31 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 1 16:07:17 2022 +0000

    tools/ocaml/xenctrl: OCaml 5 support, fix use-after-free
    
    The binding for xc_interface_close() free the underlying handle while leaving
    the Ocaml object still in scope and usable.  This would make it easy to suffer
    a use-after-free, if it weren't for the fact that the typical usage is as a
    singleton that lives for the lifetime of the program.
    
    Ocaml 5 no longer permits storing a naked C pointer in an Ocaml value.
    
    Therefore, use a Custom block.  This allows us to use the finaliser callback
    to call xc_interface_close(), if the Ocaml object goes out of scope.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xc/xenctrl.ml      |  3 +--
 tools/ocaml/libs/xc/xenctrl.mli     |  1 -
 tools/ocaml/libs/xc/xenctrl_stubs.c | 43 ++++++++++++++++++++++---------------
 3 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index aa650533f7..4b74e31c75 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -175,7 +175,6 @@ exception Error of string
 type handle
 
 external interface_open: unit -> handle = "stub_xc_interface_open"
-external interface_close: handle -> unit = "stub_xc_interface_close"
 
 let handle = ref None
 
@@ -183,7 +182,7 @@ let get_handle () = !handle
 
 let close_handle () =
 	match !handle with
-	| Some h -> handle := None; interface_close h
+	| Some h -> handle := None
 	| None -> ()
 
 let with_intf f =
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index 5bf5f5dfea..ddfe84dc22 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -146,7 +146,6 @@ type shutdown_reason = Poweroff | Reboot | Suspend | Crash | Watchdog | Soft_res
 exception Error of string
 type handle
 external interface_open : unit -> handle = "stub_xc_interface_open"
-external interface_close : handle -> unit = "stub_xc_interface_close"
 
 (** [with_intf f] runs [f] with a global handle that is opened on demand
  * and kept open. Conceptually, a client should use either
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index f37848ae0b..4e12040854 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -37,13 +37,28 @@
 
 #include "mmap_stubs.h"
 
-#define _H(__h) ((xc_interface *)(__h))
+#define _H(__h) (*((xc_interface **)Data_custom_val(__h)))
 #define _D(__d) ((uint32_t)Int_val(__d))
 
 #ifndef Val_none
 #define Val_none (Val_int(0))
 #endif
 
+static void stub_xenctrl_finalize(value v)
+{
+	xc_interface_close(_H(v));
+}
+
+static struct custom_operations xenctrl_ops = {
+	.identifier  = "xenctrl",
+	.finalize    = stub_xenctrl_finalize,
+	.compare     = custom_compare_default,     /* Can't compare     */
+	.hash        = custom_hash_default,        /* Can't hash        */
+	.serialize   = custom_serialize_default,   /* Can't serialize   */
+	.deserialize = custom_deserialize_default, /* Can't deserialize */
+	.compare_ext = custom_compare_ext_default, /* Can't compare     */
+};
+
 #define string_of_option_array(array, index) \
 	((Field(array, index) == Val_none) ? NULL : String_val(Field(Field(array, index), 0)))
 
@@ -70,26 +85,20 @@ static void Noreturn failwith_xc(xc_interface *xch)
 CAMLprim value stub_xc_interface_open(void)
 {
 	CAMLparam0();
-        xc_interface *xch;
-
-	/* Don't assert XC_OPENFLAG_NON_REENTRANT because these bindings
-	 * do not prevent re-entrancy to libxc */
-        xch = xc_interface_open(NULL, NULL, 0);
-        if (xch == NULL)
-		failwith_xc(NULL);
-        CAMLreturn((value)xch);
-}
-
-
-CAMLprim value stub_xc_interface_close(value xch)
-{
-	CAMLparam1(xch);
+	CAMLlocal1(result);
+	xc_interface *xch;
 
 	caml_enter_blocking_section();
-	xc_interface_close(_H(xch));
+	xch = xc_interface_open(NULL, NULL, 0);
 	caml_leave_blocking_section();
 
-	CAMLreturn(Val_unit);
+	if ( !xch )
+		failwith_xc(xch);
+
+	result = caml_alloc_custom(&xenctrl_ops, sizeof(xch), 0, 1);
+	_H(result) = xch;
+
+	CAMLreturn(result);
 }
 
 static void domain_handle_of_uuid_string(xen_domain_handle_t h,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:03:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:03:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452535.710345 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1REr-0003uK-60; Sat, 03 Dec 2022 12:03:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452535.710345; Sat, 03 Dec 2022 12:03:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1REr-0003u9-36; Sat, 03 Dec 2022 12:03:25 +0000
Received: by outflank-mailman (input) for mailman id 452535;
 Sat, 03 Dec 2022 12:03:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REq-0003tl-DF
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REq-00089e-Cb
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1REq-0002ct-Bu
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q2YkquHhi2Scfq1QjfhoonYMojMAx9PueegeC2QPMUg=; b=ugxLr90wIniWx8LURFAH+7l+Yb
	4zg2/BEUmv+gkTBBh58P7wrZtVokUmgC3p5en2LOWPWrnYCIo396bGJUK1mU3gW7k5eeCQy8BkzyH
	Bemem+JddEwTHhnD6xhK6sKYVSfz2lgHMH178yoC0l1Yg7Blof88CaGAcdQQbA8KsAGM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add randconfig build jobs for arm64 alpine container
Message-Id: <E1p1REq-0002ct-Bu@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:03:24 +0000

commit 5b7fdf2f3822b78d528d5607142bc1b650ec0ef6
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 27 11:47:19 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Dec 1 17:02:46 2022 -0800

    automation: Add randconfig build jobs for arm64 alpine container
    
    For arm64 we perform builds using debian and alpine containers.
    We are missing the randconfig build jobs for the latter, so add them.
    This way for each container we have 4 fundamental build jobs:
    - defconfig non-debug/debug
    - randconfig non-debug/debug
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 automation/gitlab-ci/build.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 716ee0b1e4..14328c1895 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -568,6 +568,18 @@ alpine-3.12-gcc-debug-arm64:
   variables:
     CONTAINER: alpine:3.12-arm64v8
 
+alpine-3.12-gcc-arm64-randconfig:
+  extends: .gcc-arm64-build
+  variables:
+    CONTAINER: alpine:3.12-arm64v8
+    RANDCONFIG: y
+
+alpine-3.12-gcc-debug-arm64-randconfig:
+  extends: .gcc-arm64-build-debug
+  variables:
+    CONTAINER: alpine:3.12-arm64v8
+    RANDCONFIG: y
+
 alpine-3.12-gcc-arm64-staticmem:
   extends: .gcc-arm64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:03:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:03:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452539.710349 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RF2-00044c-7L; Sat, 03 Dec 2022 12:03:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452539.710349; Sat, 03 Dec 2022 12:03: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 1p1RF2-00044U-4d; Sat, 03 Dec 2022 12:03:36 +0000
Received: by outflank-mailman (input) for mailman id 452539;
 Sat, 03 Dec 2022 12:03:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RF0-000441-GM
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RF0-00089i-Fi
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RF0-0002dQ-Et
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SKECEf8PgmHD/FcobkDKufwo5WwaCcoKkTiK7cJWe+c=; b=ZIseOiOYFAz2nhn48k4kPZei+b
	HJ5iZuOl071MTioP/7qYaaREm7Xx/XZnFlSSvTh6YxbIlz0WDSbSTxznKHvxYjrftUTxjF8h7aolH
	ImBgadzGUSOMOc45V8Fp85UjDOagmOThu8PgqiZurmxO11R4sivj/B6JNfypPAGR9nb0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: qemu-smoke-arm64.sh: Increase RAM size
Message-Id: <E1p1RF0-0002dQ-Et@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:03:34 +0000

commit a0030a83e82a1fb03d6e3b7692678812d5971608
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 27 11:47:20 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Dec 1 17:02:46 2022 -0800

    automation: qemu-smoke-arm64.sh: Increase RAM size
    
    In the follow-up patch we will add new jobs using debug Xen builds.
    Because the debug builds take more space and we might end up in
    a situation when there is not enough free space (especially during
    a static memory test that reserves some region in the middle), increase
    RAM size for QEMU from 1GB to 2GB.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 automation/scripts/qemu-smoke-arm64.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/automation/scripts/qemu-smoke-arm64.sh b/automation/scripts/qemu-smoke-arm64.sh
index 5b566072f7..933209e2e0 100755
--- a/automation/scripts/qemu-smoke-arm64.sh
+++ b/automation/scripts/qemu-smoke-arm64.sh
@@ -52,7 +52,7 @@ curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
 ./binaries/qemu-system-aarch64 \
    -machine virtualization=true \
    -cpu cortex-a57 -machine type=virt \
-   -m 1024 -smp 2 -display none \
+   -m 2048 -smp 2 -display none \
    -machine dumpdtb=binaries/virt-gicv2.dtb
 
 # XXX disable pl061 to avoid Linux crash
@@ -117,7 +117,7 @@ cd ..
 
 # ImageBuilder
 echo 'MEMORY_START="0x40000000"
-MEMORY_END="0x80000000"
+MEMORY_END="0xC0000000"
 
 DEVICE_TREE="virt-gicv2.dtb"
 XEN="xen"
@@ -158,7 +158,7 @@ timeout -k 1 240 \
 ./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
-    -m 1024 -monitor none -serial stdio \
+    -m 2048 -monitor none -serial stdio \
     -smp 2 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:03:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:03:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452542.710354 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RFC-00048C-9m; Sat, 03 Dec 2022 12:03:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452542.710354; Sat, 03 Dec 2022 12:03:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RFC-000484-69; Sat, 03 Dec 2022 12:03:46 +0000
Received: by outflank-mailman (input) for mailman id 452542;
 Sat, 03 Dec 2022 12:03:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFA-00047o-Jf
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFA-0008A5-J2
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFA-0002dp-Hv
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Lcsa59UAN3mlzYeVmQ74WH7eNPbpaP/9mrENSHdJjCk=; b=PgVPdFiKXJKC2d626DTRzXy45i
	ESqzbT6AT4vRtIgV0N5xNDrfFkr5rkragXnKwGuGddgtrjrp0byljAm+eJe1pz5Oq/fkGqjgPPg2C
	xktv47c7O88Tg+p/tybkNYcrgT845fvXn9BjHGY3F8wIYGOqEsdUcGlvRIFQAF9g7A8g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add debug versions of Arm tests
Message-Id: <E1p1RFA-0002dp-Hv@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:03:44 +0000

commit 673f21c6ca9074f4bef12b80a038888dc1874e10
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 27 11:47:21 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Dec 1 17:02:46 2022 -0800

    automation: Add debug versions of Arm tests
    
    At the moment, all the tests are executed on non-debug Xen builds.
    To improve the coverage (e.g. we might catch some asserts), add new
    test jobs using debug Xen builds.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 automation/gitlab-ci/build.yaml | 16 +++++++
 automation/gitlab-ci/test.yaml  | 93 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 109 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 14328c1895..93d9ff69a9 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -589,6 +589,15 @@ alpine-3.12-gcc-arm64-staticmem:
       CONFIG_UNSUPPORTED=y
       CONFIG_STATIC_MEMORY=y
 
+alpine-3.12-gcc-debug-arm64-staticmem:
+  extends: .gcc-arm64-build-debug
+  variables:
+    CONTAINER: alpine:3.12-arm64v8
+    EXTRA_XEN_CONFIG: |
+      CONFIG_EXPERT=y
+      CONFIG_UNSUPPORTED=y
+      CONFIG_STATIC_MEMORY=y
+
 alpine-3.12-gcc-arm64-boot-cpupools:
   extends: .gcc-arm64-build
   variables:
@@ -599,6 +608,13 @@ alpine-3.12-gcc-arm64-boot-cpupools:
       CONFIG_SCHED_NULL=y
       CONFIG_BOOT_TIME_CPUPOOLS=y
 
+alpine-3.12-gcc-debug-arm64-boot-cpupools:
+  extends: .gcc-arm64-build-debug
+  variables:
+    CONTAINER: alpine:3.12-arm64v8
+    EXTRA_XEN_CONFIG: |
+      CONFIG_BOOT_TIME_CPUPOOLS=y
+
 ## Test artifacts common
 
 .test-jobs-artifact-common:
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 4f96e6e322..1b51030c61 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -44,6 +44,25 @@ qemu-alpine-arm64-gcc:
   tags:
     - arm64
 
+qemu-alpine-arm64-gcc-debug:
+  extends: .test-jobs-common
+  variables:
+    CONTAINER: debian:unstable-arm64v8
+  script:
+    - ./automation/scripts/qemu-alpine-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
+  needs:
+    - alpine-3.12-gcc-debug-arm64
+    - alpine-3.12-arm64-rootfs-export
+    - kernel-5.19-arm64-export
+    - qemu-system-aarch64-6.0.0-arm64-export
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+    when: always
+  tags:
+    - arm64
+
 qemu-alpine-x86_64-gcc:
   extends: .test-jobs-common
   variables:
@@ -81,6 +100,25 @@ qemu-smoke-arm64-gcc:
   tags:
     - arm64
 
+qemu-smoke-arm64-gcc-debug:
+  extends: .test-jobs-common
+  variables:
+    CONTAINER: debian:unstable-arm64v8
+  script:
+    - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
+  needs:
+    - alpine-3.12-gcc-debug-arm64
+    - alpine-3.12-arm64-rootfs-export
+    - kernel-5.19-arm64-export
+    - qemu-system-aarch64-6.0.0-arm64-export
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+    when: always
+  tags:
+    - arm64
+
 qemu-smoke-arm64-gcc-staticmem:
   extends: .test-jobs-common
   variables:
@@ -100,6 +138,25 @@ qemu-smoke-arm64-gcc-staticmem:
   tags:
     - arm64
 
+qemu-smoke-arm64-gcc-debug-staticmem:
+  extends: .test-jobs-common
+  variables:
+    CONTAINER: debian:unstable-arm64v8
+  script:
+    - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
+  needs:
+    - alpine-3.12-gcc-debug-arm64-staticmem
+    - alpine-3.12-arm64-rootfs-export
+    - kernel-5.19-arm64-export
+    - qemu-system-aarch64-6.0.0-arm64-export
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+    when: always
+  tags:
+    - arm64
+
 qemu-smoke-arm64-gcc-boot-cpupools:
   extends: .test-jobs-common
   variables:
@@ -119,6 +176,25 @@ qemu-smoke-arm64-gcc-boot-cpupools:
   tags:
     - arm64
 
+qemu-smoke-arm64-gcc-debug-boot-cpupools:
+  extends: .test-jobs-common
+  variables:
+    CONTAINER: debian:unstable-arm64v8
+  script:
+    - ./automation/scripts/qemu-smoke-arm64.sh boot-cpupools 2>&1 | tee qemu-smoke-arm64.log
+  needs:
+    - alpine-3.12-gcc-debug-arm64-boot-cpupools
+    - alpine-3.12-arm64-rootfs-export
+    - kernel-5.19-arm64-export
+    - qemu-system-aarch64-6.0.0-arm64-export
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+    when: always
+  tags:
+    - arm64
+
 qemu-smoke-arm32-gcc:
   extends: .test-jobs-common
   variables:
@@ -136,6 +212,23 @@ qemu-smoke-arm32-gcc:
   tags:
     - arm64
 
+qemu-smoke-arm32-gcc-debug:
+  extends: .test-jobs-common
+  variables:
+    CONTAINER: debian:unstable-arm64v8
+  script:
+    - ./automation/scripts/qemu-smoke-arm32.sh 2>&1 | tee qemu-smoke-arm32.log
+  needs:
+    - debian-unstable-gcc-arm32-debug
+    - qemu-system-aarch64-6.0.0-arm32-export
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+    when: always
+  tags:
+    - arm64
+
 qemu-smoke-x86-64-gcc:
   extends: .test-jobs-common
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:03:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:03:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452545.710356 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RFM-0004FP-CF; Sat, 03 Dec 2022 12:03:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452545.710356; Sat, 03 Dec 2022 12:03:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RFM-0004FH-9g; Sat, 03 Dec 2022 12:03:56 +0000
Received: by outflank-mailman (input) for mailman id 452545;
 Sat, 03 Dec 2022 12:03:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFK-0004Ex-MY
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFK-0008A9-Lx
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFK-0002eI-LE
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:03:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ioqp7rK/qjRvrT4CVhOEv56Tb1I8IPp5yF7UbugzeWE=; b=EL0kAnXTNiyyHTmqwT9qJDGjlz
	/Ho2UuMLZ0+A6+YTIMwwhY8yHMu3N6XwEn4xBr8mGFpSqoMlLDc0I4vLH+n9OnTDVsw5nOiMGAHnS
	vgX13eBQKjANhJLeyMc93Xh3BkSFvvvBYLJruDPiSc0hJD4P24+y9ssa486+fcM0sa00=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add Arm containers to containerize script
Message-Id: <E1p1RFK-0002eI-LE@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:03:54 +0000

commit a143142682c9f083fbb63c2d62c3f8410ba40ba7
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 27 11:47:22 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Dec 1 17:02:46 2022 -0800

    automation: Add Arm containers to containerize script
    
    Script automation/scripts/containerize makes it easy to build Xen within
    predefined containers from gitlab container registry. This script is
    currently missing the helpers to select Arm containers, so populate the
    necessary entries.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/containerize | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 9d4beca4fa..0f4645c4cc 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -25,6 +25,7 @@ die() {
 BASE="registry.gitlab.com/xen-project/xen"
 case "_${CONTAINER}" in
     _alpine) CONTAINER="${BASE}/alpine:3.12" ;;
+    _alpine-arm64v8) CONTAINER="${BASE}/alpine:3.12-arm64v8" ;;
     _archlinux|_arch) CONTAINER="${BASE}/archlinux:current" ;;
     _riscv64) CONTAINER="${BASE}/archlinux:riscv64" ;;
     _centos7) CONTAINER="${BASE}/centos:7" ;;
@@ -35,6 +36,8 @@ case "_${CONTAINER}" in
     _stretch|_) CONTAINER="${BASE}/debian:stretch" ;;
     _buster-gcc-ibt) CONTAINER="${BASE}/debian:buster-gcc-ibt" ;;
     _unstable|_) CONTAINER="${BASE}/debian:unstable" ;;
+    _unstable-arm32-gcc) CONTAINER="${BASE}/debian:unstable-arm32-gcc" ;;
+    _unstable-arm64v8) CONTAINER="${BASE}/debian:unstable-arm64v8" ;;
     _trusty) CONTAINER="${BASE}/ubuntu:trusty" ;;
     _xenial) CONTAINER="${BASE}/ubuntu:xenial" ;;
     _opensuse-leap|_leap) CONTAINER="${BASE}/suse:opensuse-leap" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:04:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:04:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452546.710362 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RFW-0004N0-F0; Sat, 03 Dec 2022 12:04:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452546.710362; Sat, 03 Dec 2022 12:04: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 1p1RFW-0004Ms-BB; Sat, 03 Dec 2022 12:04:06 +0000
Received: by outflank-mailman (input) for mailman id 452546;
 Sat, 03 Dec 2022 12:04:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFU-0004Me-PT
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFU-0008Ab-Oj
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFU-0002f1-O0
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ATbzDeIFY7XBrsY8GbDYrv3YRslmDhxrn9Z7fclSP1Q=; b=J0Ry4fmgolYvN/9NZSEzz0t6hU
	C+Tg9bjDaJPbKtQhm+CXcjZpTF5LCgn7QTiISJjEcWm2oQd9XAz3eyXarfaNPCsYoENTZOAdLh5DQ
	lx1aioCE4vXs6IBEZItONqX8K1AUTu3rur2QgCmYkMnGKI4gVgOOR364w2MUaAvSgiiU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: qemu-smoke-arm32.sh: Modify script to use ImageBuilder
Message-Id: <E1p1RFU-0002f1-O0@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:04:04 +0000

commit 93f1431264d8fee3d0ddd00dbecc137c390e5c6d
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 27 11:47:23 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Dec 1 17:02:46 2022 -0800

    automation: qemu-smoke-arm32.sh: Modify script to use ImageBuilder
    
    Take an example from arm64 qemu test scripts and use ImageBuilder
    to generate u-boot script automatically. Calculating the addresses
    manually is quite error prone and also we will be able to benefit
    from using ImageBuilder when adding domUs to this test in the future.
    
    Install and use u-boot from the debian package.
    Modify the script so that binaries are loaded from u-boot via tftp.
    Remove dtuart=/pl011@9000000 because stdout-path in QEMU dtb is always
    set to pl011 node path.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/qemu-smoke-arm32.sh | 57 ++++++++++++++++------------------
 1 file changed, 27 insertions(+), 30 deletions(-)

diff --git a/automation/scripts/qemu-smoke-arm32.sh b/automation/scripts/qemu-smoke-arm32.sh
index c8ae0bfb9b..ef19b988c2 100755
--- a/automation/scripts/qemu-smoke-arm32.sh
+++ b/automation/scripts/qemu-smoke-arm32.sh
@@ -4,7 +4,9 @@ set -ex
 
 export DEBIAN_FRONTEND=noninteractive
 apt-get -qy update
-apt-get -qy install --no-install-recommends device-tree-compiler \
+apt-get -qy install --no-install-recommends u-boot-qemu \
+                                            u-boot-tools \
+                                            device-tree-compiler \
                                             curl \
                                             cpio
 
@@ -20,10 +22,6 @@ tar xvzf ../initrd.tar.gz
 find . | cpio -H newc -o | gzip > ../initrd.gz
 cd ..
 
-kernel=`stat -L --printf="%s" vmlinuz`
-initrd=`stat -L --printf="%s" initrd.gz`
-
-# For Xen, we need a couple of more node. Dump the DT from QEMU and add them
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
 curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
 ./qemu-system-arm \
@@ -36,31 +34,31 @@ curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
    -display none \
    -machine dumpdtb=virt.dtb
 
-dtc -I dtb -O dts virt.dtb > virt.dts
+# ImageBuilder
+echo 'MEMORY_START="0x40000000"
+MEMORY_END="0x80000000"
+
+DEVICE_TREE="virt.dtb"
+XEN="xen"
+DOM0_KERNEL="vmlinuz"
+DOM0_RAMDISK="initrd.gz"
+DOM0_CMD="console=hvc0 earlyprintk clk_ignore_unused root=/dev/ram0 rdinit=/bin/sh"
+XEN_CMD="console=dtuart dom0_mem=512M bootscrub=0"
+
+NUM_DOMUS=0
+
+LOAD_CMD="tftpb"
+BOOT_CMD="bootm"
+UBOOT_SOURCE="boot.source"
+UBOOT_SCRIPT="boot.scr"' > config
 
-cat >> virt.dts << EOF
-/ {
-	chosen {
-		#address-cells = <0x2>;
-		#size-cells = <0x2>;
-		stdout-path = "/pl011@9000000";
-        xen,xen-bootargs = "console=dtuart dtuart=/pl011@9000000 dom0_mem=512M bootscrub=0";
-		xen,dom0-bootargs = "console=tty0 console=hvc0 earlyprintk clk_ignore_unused root=/dev/ram0 rdinit=/bin/sh";
-		dom0 {
-			compatible = "xen,linux-zimage", "xen,multiboot-module";
-			reg = <0x0 0x1000000 0x0 $kernel>;
-		};
-        dom0-ramdisk {
-			compatible = "xen,linux-initrd", "xen,multiboot-module";
-			reg = <0x0 0x3200000 0x0 $initrd>;
-		};
-	};
-};
-EOF
-dtc -I dts -O dtb virt.dts > virt.dtb
+rm -rf imagebuilder
+git clone https://gitlab.com/ViryaOS/imagebuilder
+bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f smoke.serial
 set +e
+echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
 timeout -k 1 240 \
 ./qemu-system-arm \
    -machine virt \
@@ -70,11 +68,10 @@ timeout -k 1 240 \
    -serial stdio \
    -monitor none \
    -display none \
-   -dtb virt.dtb \
    -no-reboot \
-   -kernel ./xen \
-   -device loader,file=./vmlinuz,addr=0x1000000 \
-   -device loader,file=./initrd.gz,addr=0x3200000 |& tee smoke.serial
+   -device virtio-net-pci,netdev=n0 \
+   -netdev user,id=n0,tftp=./ \
+   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& tee smoke.serial
 
 set -e
 (grep -q "^/ #" smoke.serial) || exit 1
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:04:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:04:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452547.710365 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RFg-0004QR-FK; Sat, 03 Dec 2022 12:04:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452547.710365; Sat, 03 Dec 2022 12:04: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 1p1RFg-0004QK-Cn; Sat, 03 Dec 2022 12:04:16 +0000
Received: by outflank-mailman (input) for mailman id 452547;
 Sat, 03 Dec 2022 12:04:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFe-0004Q5-SU
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFe-0008Af-Rp
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFe-0002fs-RA
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SwFbtdTCMNlKFwvUI3SYihPYYpHTexGe1O6lwkjEC3E=; b=gMZS/K0vKUnii4rB68/2pdFUmF
	tCMEOWoirOg0hE9bY/8oC7LrW5KtPKOzzGtYjLcvjgudAH5HCZG+fzUhOL80m0TE22tvUkYxqED1x
	RQWKnejwju4a3KhPuL4Ja3oLb2YmnD2DSt4KlMdT48RTJ0T3eY9eTy9s4zfO2QJQ3b2c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: qemu-alpine-arm64: Cleanup and fixes
Message-Id: <E1p1RFe-0002fs-RA@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:04:14 +0000

commit ed02c506848f06fc8ed0a693116618ce8c1c5478
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 27 11:47:24 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Dec 1 17:02:46 2022 -0800

    automation: qemu-alpine-arm64: Cleanup and fixes
    
    Perform the following cleanup:
    - rename the device tree from virt-gicv3 to virt-gicv2 as the GIC version
      used in this test is v2,
    - use fdtput to perform modifications on the dtb,
    - use DEBIAN_FRONTEND=noninteractive to prevent interactive prompt being
      stuck waiting for answer other than "yes",
    - fix the number of cpus in the device tree because currently we generate
      it with a single cpu and try to run QEMU with two,
    - fix the memory size we pass when generating QEMU device tree as it does
      not match the memory size with what we run QEMU.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/scripts/qemu-alpine-arm64.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/automation/scripts/qemu-alpine-arm64.sh b/automation/scripts/qemu-alpine-arm64.sh
index f4ac2d856f..9004c537e3 100755
--- a/automation/scripts/qemu-alpine-arm64.sh
+++ b/automation/scripts/qemu-alpine-arm64.sh
@@ -2,6 +2,7 @@
 
 set -ex
 
+export DEBIAN_FRONTEND=noninteractive
 apt-get -qy update
 apt-get -qy install --no-install-recommends u-boot-qemu \
                                             u-boot-tools \
@@ -73,18 +74,17 @@ curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
 ./binaries/qemu-system-aarch64 \
    -machine virtualization=true \
    -cpu cortex-a57 -machine type=virt \
-   -m 1024 -display none \
-   -machine dumpdtb=binaries/virt-gicv3.dtb
+   -m 2048 -smp 2 -display none \
+   -machine dumpdtb=binaries/virt-gicv2.dtb
+
 # XXX disable pl061 to avoid Linux crash
-dtc -I dtb -O dts binaries/virt-gicv3.dtb > binaries/virt-gicv3.dts
-sed 's/compatible = "arm,pl061.*/status = "disabled";/g' binaries/virt-gicv3.dts > binaries/virt-gicv3-edited.dts
-dtc -I dts -O dtb binaries/virt-gicv3-edited.dts > binaries/virt-gicv3.dtb
+fdtput binaries/virt-gicv2.dtb -p -t s /pl061@9030000 status disabled
 
 # ImageBuilder
 echo 'MEMORY_START="0x40000000"
-MEMORY_END="0x80000000"
+MEMORY_END="0xC0000000"
 
-DEVICE_TREE="virt-gicv3.dtb"
+DEVICE_TREE="virt-gicv2.dtb"
 XEN="xen"
 DOM0_KERNEL="Image"
 DOM0_RAMDISK="xen-rootfs.cpio.gz"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:04:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:04:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452548.710368 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RFq-0004Tc-HB; Sat, 03 Dec 2022 12:04:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452548.710368; Sat, 03 Dec 2022 12:04: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 1p1RFq-0004TU-EN; Sat, 03 Dec 2022 12:04:26 +0000
Received: by outflank-mailman (input) for mailman id 452548;
 Sat, 03 Dec 2022 12:04:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFo-0004TH-VN
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFo-0008Aj-Ui
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFo-0002gf-U6
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=14fLt7Q0WvSu+KEsBxgSVipW1ggQ9lsrphCOHWw6fSU=; b=X6U9bpY81C2r6YC2JaxFsc2dO/
	glzBPzoDfoIHETANltB3KKsePOTi7Mjz5vsFB9qdvx+K5yiUc4ynf02BNOEdIOMRdCmIvuecseXH9
	ewQP7HdTe+klRK0HFblJCKvlW0PJ5hW733pvQRPbYEiQtXp5xoajON0RtbtgnSe+TQcI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Rename qemu-smoke-arm64.sh to qemu-smoke-dom0less-arm64.sh
Message-Id: <E1p1RFo-0002gf-U6@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:04:24 +0000

commit 50f8e191e6092e4f1716ac5c3dc3b1fa211419c0
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 27 11:47:25 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Dec 1 17:02:46 2022 -0800

    automation: Rename qemu-smoke-arm64.sh to qemu-smoke-dom0less-arm64.sh
    
    Testing arm64 is done using the qemu-alpine-arm64.sh and
    qemu-smoke-arm64.sh scripts. These scripts are executed with exactly
    the same artifacts (container, rootfs, kernel, qemu) and the only
    difference is that the former is used to perform dom0 based testing
    and the latter - dom0less based testing.
    
    Because the current naming is quite ambiguous, rename qemu-smoke-arm64.sh
    script to qemu-smoke-dom0less-arm64.sh to reflect its usage.
    
    qemu-alpine-arm64.sh will be renamed in the follow-up patch.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml                  |  24 ++--
 automation/scripts/qemu-smoke-arm64.sh          | 170 ------------------------
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 170 ++++++++++++++++++++++++
 3 files changed, 182 insertions(+), 182 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 1b51030c61..f620622671 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -81,12 +81,12 @@ qemu-alpine-x86_64-gcc:
   tags:
     - x86_64
 
-qemu-smoke-arm64-gcc:
+qemu-smoke-dom0less-arm64-gcc:
   extends: .test-jobs-common
   variables:
     CONTAINER: debian:unstable-arm64v8
   script:
-    - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - alpine-3.12-gcc-arm64
     - alpine-3.12-arm64-rootfs-export
@@ -100,12 +100,12 @@ qemu-smoke-arm64-gcc:
   tags:
     - arm64
 
-qemu-smoke-arm64-gcc-debug:
+qemu-smoke-dom0less-arm64-gcc-debug:
   extends: .test-jobs-common
   variables:
     CONTAINER: debian:unstable-arm64v8
   script:
-    - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - alpine-3.12-gcc-debug-arm64
     - alpine-3.12-arm64-rootfs-export
@@ -119,12 +119,12 @@ qemu-smoke-arm64-gcc-debug:
   tags:
     - arm64
 
-qemu-smoke-arm64-gcc-staticmem:
+qemu-smoke-dom0less-arm64-gcc-staticmem:
   extends: .test-jobs-common
   variables:
     CONTAINER: debian:unstable-arm64v8
   script:
-    - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - alpine-3.12-gcc-arm64-staticmem
     - alpine-3.12-arm64-rootfs-export
@@ -138,12 +138,12 @@ qemu-smoke-arm64-gcc-staticmem:
   tags:
     - arm64
 
-qemu-smoke-arm64-gcc-debug-staticmem:
+qemu-smoke-dom0less-arm64-gcc-debug-staticmem:
   extends: .test-jobs-common
   variables:
     CONTAINER: debian:unstable-arm64v8
   script:
-    - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - alpine-3.12-gcc-debug-arm64-staticmem
     - alpine-3.12-arm64-rootfs-export
@@ -157,12 +157,12 @@ qemu-smoke-arm64-gcc-debug-staticmem:
   tags:
     - arm64
 
-qemu-smoke-arm64-gcc-boot-cpupools:
+qemu-smoke-dom0less-arm64-gcc-boot-cpupools:
   extends: .test-jobs-common
   variables:
     CONTAINER: debian:unstable-arm64v8
   script:
-    - ./automation/scripts/qemu-smoke-arm64.sh boot-cpupools 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh boot-cpupools 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - alpine-3.12-gcc-arm64-boot-cpupools
     - alpine-3.12-arm64-rootfs-export
@@ -176,12 +176,12 @@ qemu-smoke-arm64-gcc-boot-cpupools:
   tags:
     - arm64
 
-qemu-smoke-arm64-gcc-debug-boot-cpupools:
+qemu-smoke-dom0less-arm64-gcc-debug-boot-cpupools:
   extends: .test-jobs-common
   variables:
     CONTAINER: debian:unstable-arm64v8
   script:
-    - ./automation/scripts/qemu-smoke-arm64.sh boot-cpupools 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh boot-cpupools 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - alpine-3.12-gcc-debug-arm64-boot-cpupools
     - alpine-3.12-arm64-rootfs-export
diff --git a/automation/scripts/qemu-smoke-arm64.sh b/automation/scripts/qemu-smoke-arm64.sh
deleted file mode 100755
index 933209e2e0..0000000000
--- a/automation/scripts/qemu-smoke-arm64.sh
+++ /dev/null
@@ -1,170 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-test_variant=$1
-
-if [ -z "${test_variant}" ]; then
-    passed="ping test passed"
-    domU_check="
-until ifconfig eth0 192.168.0.2 &> /dev/null && ping -c 10 192.168.0.1; do
-    sleep 30
-done
-echo \"${passed}\"
-"
-fi
-
-if [[ "${test_variant}" == "static-mem" ]]; then
-    # Memory range that is statically allocated to DOM1
-    domu_base="50000000"
-    domu_size="10000000"
-    passed="${test_variant} test passed"
-    domU_check="
-current=\$(hexdump -e '16/1 \"%02x\"' /proc/device-tree/memory@${domu_base}/reg 2>/dev/null)
-expected=$(printf \"%016x%016x\" 0x${domu_base} 0x${domu_size})
-if [[ \"\${expected}\" == \"\${current}\" ]]; then
-	echo \"${passed}\"
-fi
-"
-fi
-
-if [[ "${test_variant}" == "boot-cpupools" ]]; then
-    # Check if domU0 (id=1) is assigned to Pool-1 with null scheduler
-    passed="${test_variant} test passed"
-    dom0_check="
-if xl list -c 1 | grep -q Pool-1 && xl cpupool-list Pool-1 | grep -q Pool-1; then
-    echo ${passed}
-fi
-"
-fi
-
-export DEBIAN_FRONTEND=noninteractive
-apt-get -qy update
-apt-get -qy install --no-install-recommends u-boot-qemu \
-                                            u-boot-tools \
-                                            device-tree-compiler \
-                                            busybox-static \
-                                            cpio \
-                                            curl
-
-# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
-curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
-./binaries/qemu-system-aarch64 \
-   -machine virtualization=true \
-   -cpu cortex-a57 -machine type=virt \
-   -m 2048 -smp 2 -display none \
-   -machine dumpdtb=binaries/virt-gicv2.dtb
-
-# XXX disable pl061 to avoid Linux crash
-fdtput binaries/virt-gicv2.dtb -p -t s /pl061@9030000 status disabled
-
-# Busybox
-mkdir -p initrd
-mkdir -p initrd/bin
-mkdir -p initrd/sbin
-mkdir -p initrd/etc
-mkdir -p initrd/dev
-mkdir -p initrd/proc
-mkdir -p initrd/sys
-mkdir -p initrd/lib
-mkdir -p initrd/var
-mkdir -p initrd/mnt
-cp /bin/busybox initrd/bin/busybox
-initrd/bin/busybox --install initrd/bin
-echo "#!/bin/sh
-
-mount -t proc proc /proc
-mount -t sysfs sysfs /sys
-mount -t devtmpfs devtmpfs /dev
-${domU_check}
-/bin/sh" > initrd/init
-chmod +x initrd/init
-cd initrd
-find . | cpio --create --format='newc' | gzip > ../binaries/initrd
-cd ..
-
-# DOM0 rootfs
-mkdir -p rootfs
-cd rootfs
-tar xzf ../binaries/initrd.tar.gz
-mkdir proc
-mkdir run
-mkdir srv
-mkdir sys
-rm var/run
-cp -ar ../binaries/dist/install/* .
-
-echo "#!/bin/bash
-
-export LD_LIBRARY_PATH=/usr/local/lib
-bash /etc/init.d/xencommons start
-
-/usr/local/lib/xen/bin/init-dom0less
-
-brctl addbr xenbr0
-brctl addif xenbr0 eth0
-ifconfig eth0 up
-ifconfig xenbr0 up
-ifconfig xenbr0 192.168.0.1
-
-xl network-attach 1 type=vif
-${dom0_check}
-" > etc/local.d/xen.start
-chmod +x etc/local.d/xen.start
-echo "rc_verbose=yes" >> etc/rc.conf
-find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
-cd ..
-
-# ImageBuilder
-echo 'MEMORY_START="0x40000000"
-MEMORY_END="0xC0000000"
-
-DEVICE_TREE="virt-gicv2.dtb"
-XEN="xen"
-DOM0_KERNEL="Image"
-DOM0_RAMDISK="dom0-rootfs.cpio.gz"
-XEN_CMD="console=dtuart dom0_mem=512M"
-
-NUM_DOMUS=1
-DOMU_KERNEL[0]="Image"
-DOMU_RAMDISK[0]="initrd"
-DOMU_MEM[0]="256"
-
-LOAD_CMD="tftpb"
-UBOOT_SOURCE="boot.source"
-UBOOT_SCRIPT="boot.scr"' > binaries/config
-
-if [[ "${test_variant}" == "static-mem" ]]; then
-    echo -e "\nDOMU_STATIC_MEM[0]=\"0x${domu_base} 0x${domu_size}\"" >> binaries/config
-fi
-
-if [[ "${test_variant}" == "boot-cpupools" ]]; then
-    echo '
-CPUPOOL[0]="cpu@1 null"
-DOMU_CPUPOOL[0]=0
-NUM_CPUPOOLS=1' >> binaries/config
-fi
-
-rm -rf imagebuilder
-git clone https://gitlab.com/ViryaOS/imagebuilder
-bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/config
-
-
-# Run the test
-rm -f smoke.serial
-set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./binaries/qemu-system-aarch64 \
-    -machine virtualization=true \
-    -cpu cortex-a57 -machine type=virt \
-    -m 2048 -monitor none -serial stdio \
-    -smp 2 \
-    -no-reboot \
-    -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
-
-set -e
-(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
-exit 0
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
new file mode 100755
index 0000000000..933209e2e0
--- /dev/null
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -0,0 +1,170 @@
+#!/bin/bash
+
+set -ex
+
+test_variant=$1
+
+if [ -z "${test_variant}" ]; then
+    passed="ping test passed"
+    domU_check="
+until ifconfig eth0 192.168.0.2 &> /dev/null && ping -c 10 192.168.0.1; do
+    sleep 30
+done
+echo \"${passed}\"
+"
+fi
+
+if [[ "${test_variant}" == "static-mem" ]]; then
+    # Memory range that is statically allocated to DOM1
+    domu_base="50000000"
+    domu_size="10000000"
+    passed="${test_variant} test passed"
+    domU_check="
+current=\$(hexdump -e '16/1 \"%02x\"' /proc/device-tree/memory@${domu_base}/reg 2>/dev/null)
+expected=$(printf \"%016x%016x\" 0x${domu_base} 0x${domu_size})
+if [[ \"\${expected}\" == \"\${current}\" ]]; then
+	echo \"${passed}\"
+fi
+"
+fi
+
+if [[ "${test_variant}" == "boot-cpupools" ]]; then
+    # Check if domU0 (id=1) is assigned to Pool-1 with null scheduler
+    passed="${test_variant} test passed"
+    dom0_check="
+if xl list -c 1 | grep -q Pool-1 && xl cpupool-list Pool-1 | grep -q Pool-1; then
+    echo ${passed}
+fi
+"
+fi
+
+export DEBIAN_FRONTEND=noninteractive
+apt-get -qy update
+apt-get -qy install --no-install-recommends u-boot-qemu \
+                                            u-boot-tools \
+                                            device-tree-compiler \
+                                            busybox-static \
+                                            cpio \
+                                            curl
+
+# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
+curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
+./binaries/qemu-system-aarch64 \
+   -machine virtualization=true \
+   -cpu cortex-a57 -machine type=virt \
+   -m 2048 -smp 2 -display none \
+   -machine dumpdtb=binaries/virt-gicv2.dtb
+
+# XXX disable pl061 to avoid Linux crash
+fdtput binaries/virt-gicv2.dtb -p -t s /pl061@9030000 status disabled
+
+# Busybox
+mkdir -p initrd
+mkdir -p initrd/bin
+mkdir -p initrd/sbin
+mkdir -p initrd/etc
+mkdir -p initrd/dev
+mkdir -p initrd/proc
+mkdir -p initrd/sys
+mkdir -p initrd/lib
+mkdir -p initrd/var
+mkdir -p initrd/mnt
+cp /bin/busybox initrd/bin/busybox
+initrd/bin/busybox --install initrd/bin
+echo "#!/bin/sh
+
+mount -t proc proc /proc
+mount -t sysfs sysfs /sys
+mount -t devtmpfs devtmpfs /dev
+${domU_check}
+/bin/sh" > initrd/init
+chmod +x initrd/init
+cd initrd
+find . | cpio --create --format='newc' | gzip > ../binaries/initrd
+cd ..
+
+# DOM0 rootfs
+mkdir -p rootfs
+cd rootfs
+tar xzf ../binaries/initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../binaries/dist/install/* .
+
+echo "#!/bin/bash
+
+export LD_LIBRARY_PATH=/usr/local/lib
+bash /etc/init.d/xencommons start
+
+/usr/local/lib/xen/bin/init-dom0less
+
+brctl addbr xenbr0
+brctl addif xenbr0 eth0
+ifconfig eth0 up
+ifconfig xenbr0 up
+ifconfig xenbr0 192.168.0.1
+
+xl network-attach 1 type=vif
+${dom0_check}
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
+cd ..
+
+# ImageBuilder
+echo 'MEMORY_START="0x40000000"
+MEMORY_END="0xC0000000"
+
+DEVICE_TREE="virt-gicv2.dtb"
+XEN="xen"
+DOM0_KERNEL="Image"
+DOM0_RAMDISK="dom0-rootfs.cpio.gz"
+XEN_CMD="console=dtuart dom0_mem=512M"
+
+NUM_DOMUS=1
+DOMU_KERNEL[0]="Image"
+DOMU_RAMDISK[0]="initrd"
+DOMU_MEM[0]="256"
+
+LOAD_CMD="tftpb"
+UBOOT_SOURCE="boot.source"
+UBOOT_SCRIPT="boot.scr"' > binaries/config
+
+if [[ "${test_variant}" == "static-mem" ]]; then
+    echo -e "\nDOMU_STATIC_MEM[0]=\"0x${domu_base} 0x${domu_size}\"" >> binaries/config
+fi
+
+if [[ "${test_variant}" == "boot-cpupools" ]]; then
+    echo '
+CPUPOOL[0]="cpu@1 null"
+DOMU_CPUPOOL[0]=0
+NUM_CPUPOOLS=1' >> binaries/config
+fi
+
+rm -rf imagebuilder
+git clone https://gitlab.com/ViryaOS/imagebuilder
+bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/config
+
+
+# Run the test
+rm -f smoke.serial
+set +e
+echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
+timeout -k 1 240 \
+./binaries/qemu-system-aarch64 \
+    -machine virtualization=true \
+    -cpu cortex-a57 -machine type=virt \
+    -m 2048 -monitor none -serial stdio \
+    -smp 2 \
+    -no-reboot \
+    -device virtio-net-pci,netdev=n0 \
+    -netdev user,id=n0,tftp=binaries \
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+
+set -e
+(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
+exit 0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:04:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:04:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452549.710373 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RG0-0004Ws-Kj; Sat, 03 Dec 2022 12:04:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452549.710373; Sat, 03 Dec 2022 12:04: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 1p1RG0-0004Wl-IC; Sat, 03 Dec 2022 12:04:36 +0000
Received: by outflank-mailman (input) for mailman id 452549;
 Sat, 03 Dec 2022 12:04:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFz-0004WT-21
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFz-0008An-1N
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RFz-0002hU-0c
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q/MQqlmrsw/Y8QjT2XcIJKRJHlrOcPFHMyA/tyF03bs=; b=H9bjE/kNvL3hcj7t9Wh0WMjv2R
	5j78bq0yGE+h4LY1R2+2FNTL9fb65xR83ua++ViKdmP6qsxqJf2egrqJz1pCPeX+E5ruWmuxcz1Wb
	JvBUQT3byG/T/gN4soXsyzUUjF+SDfbmMqNkx+3dFGnjQez8bloVtiP16/T86Jle1iaE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Rename qemu-alpine-arm64.sh to qemu-smoke-dom0-arm64.sh
Message-Id: <E1p1RFz-0002hU-0c@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:04:35 +0000

commit e0a39883475c2505c5a6a78bb3717e3d3d038fab
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 27 11:47:26 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Dec 1 17:02:46 2022 -0800

    automation: Rename qemu-alpine-arm64.sh to qemu-smoke-dom0-arm64.sh
    
    qemu-alpine-arm64.sh script is used to perform dom0 based testing.
    Rename this script to qemu-smoke-dom0-arm64.sh to reflect its usage.
    Also rename the corresponding test jobs.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml              |   8 +-
 automation/scripts/qemu-alpine-arm64.sh     | 120 ----------------------------
 automation/scripts/qemu-smoke-dom0-arm64.sh | 120 ++++++++++++++++++++++++++++
 3 files changed, 124 insertions(+), 124 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index f620622671..3b147c88ab 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -25,12 +25,12 @@ build-each-commit-gcc:
   tags:
     - x86_64
 
-qemu-alpine-arm64-gcc:
+qemu-smoke-dom0-arm64-gcc:
   extends: .test-jobs-common
   variables:
     CONTAINER: debian:unstable-arm64v8
   script:
-    - ./automation/scripts/qemu-alpine-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - alpine-3.12-gcc-arm64
     - alpine-3.12-arm64-rootfs-export
@@ -44,12 +44,12 @@ qemu-alpine-arm64-gcc:
   tags:
     - arm64
 
-qemu-alpine-arm64-gcc-debug:
+qemu-smoke-dom0-arm64-gcc-debug:
   extends: .test-jobs-common
   variables:
     CONTAINER: debian:unstable-arm64v8
   script:
-    - ./automation/scripts/qemu-alpine-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - alpine-3.12-gcc-debug-arm64
     - alpine-3.12-arm64-rootfs-export
diff --git a/automation/scripts/qemu-alpine-arm64.sh b/automation/scripts/qemu-alpine-arm64.sh
deleted file mode 100755
index 9004c537e3..0000000000
--- a/automation/scripts/qemu-alpine-arm64.sh
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-export DEBIAN_FRONTEND=noninteractive
-apt-get -qy update
-apt-get -qy install --no-install-recommends u-boot-qemu \
-                                            u-boot-tools \
-                                            device-tree-compiler \
-                                            cpio \
-                                            curl \
-                                            busybox-static
-
-# DomU Busybox
-cd binaries
-mkdir -p initrd
-mkdir -p initrd/bin
-mkdir -p initrd/sbin
-mkdir -p initrd/etc
-mkdir -p initrd/dev
-mkdir -p initrd/proc
-mkdir -p initrd/sys
-mkdir -p initrd/lib
-mkdir -p initrd/var
-mkdir -p initrd/mnt
-cp /bin/busybox initrd/bin/busybox
-initrd/bin/busybox --install initrd/bin
-echo "#!/bin/sh
-
-mount -t proc proc /proc
-mount -t sysfs sysfs /sys
-mount -t devtmpfs devtmpfs /dev
-/bin/sh" > initrd/init
-chmod +x initrd/init
-cd initrd
-find . | cpio --create --format='newc' | gzip > ../initrd.cpio.gz
-cd ..
-
-mkdir -p rootfs
-cd rootfs
-tar xvzf ../initrd.tar.gz
-mkdir proc
-mkdir run
-mkdir srv
-mkdir sys
-rm var/run
-cp -ar ../dist/install/* .
-mv ../initrd.cpio.gz ./root
-cp ../Image ./root
-echo "name=\"test\"
-memory=512
-vcpus=1
-kernel=\"/root/Image\"
-ramdisk=\"/root/initrd.cpio.gz\"
-extra=\"console=hvc0 root=/dev/ram0 rdinit=/bin/sh\"
-" > root/test.cfg
-echo "#!/bin/bash
-
-export LD_LIBRARY_PATH=/usr/local/lib
-bash /etc/init.d/xencommons start
-
-xl list
-
-xl create -c /root/test.cfg
-
-" > etc/local.d/xen.start
-chmod +x etc/local.d/xen.start
-echo "rc_verbose=yes" >> etc/rc.conf
-find . |cpio -H newc -o|gzip > ../xen-rootfs.cpio.gz
-cd ../..
-
-# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
-curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
-./binaries/qemu-system-aarch64 \
-   -machine virtualization=true \
-   -cpu cortex-a57 -machine type=virt \
-   -m 2048 -smp 2 -display none \
-   -machine dumpdtb=binaries/virt-gicv2.dtb
-
-# XXX disable pl061 to avoid Linux crash
-fdtput binaries/virt-gicv2.dtb -p -t s /pl061@9030000 status disabled
-
-# ImageBuilder
-echo 'MEMORY_START="0x40000000"
-MEMORY_END="0xC0000000"
-
-DEVICE_TREE="virt-gicv2.dtb"
-XEN="xen"
-DOM0_KERNEL="Image"
-DOM0_RAMDISK="xen-rootfs.cpio.gz"
-XEN_CMD="console=dtuart dom0_mem=1024M"
-
-NUM_DOMUS=0
-
-LOAD_CMD="tftpb"
-UBOOT_SOURCE="boot.source"
-UBOOT_SCRIPT="boot.scr"' > binaries/config
-rm -rf imagebuilder
-git clone https://gitlab.com/ViryaOS/imagebuilder
-bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/config
-
-
-# Run the test
-rm -f smoke.serial
-set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./binaries/qemu-system-aarch64 \
-    -machine virtualization=true \
-    -cpu cortex-a57 -machine type=virt \
-    -m 2048 -monitor none -serial stdio \
-    -smp 2 \
-    -no-reboot \
-    -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
-
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
new file mode 100755
index 0000000000..9004c537e3
--- /dev/null
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -0,0 +1,120 @@
+#!/bin/bash
+
+set -ex
+
+export DEBIAN_FRONTEND=noninteractive
+apt-get -qy update
+apt-get -qy install --no-install-recommends u-boot-qemu \
+                                            u-boot-tools \
+                                            device-tree-compiler \
+                                            cpio \
+                                            curl \
+                                            busybox-static
+
+# DomU Busybox
+cd binaries
+mkdir -p initrd
+mkdir -p initrd/bin
+mkdir -p initrd/sbin
+mkdir -p initrd/etc
+mkdir -p initrd/dev
+mkdir -p initrd/proc
+mkdir -p initrd/sys
+mkdir -p initrd/lib
+mkdir -p initrd/var
+mkdir -p initrd/mnt
+cp /bin/busybox initrd/bin/busybox
+initrd/bin/busybox --install initrd/bin
+echo "#!/bin/sh
+
+mount -t proc proc /proc
+mount -t sysfs sysfs /sys
+mount -t devtmpfs devtmpfs /dev
+/bin/sh" > initrd/init
+chmod +x initrd/init
+cd initrd
+find . | cpio --create --format='newc' | gzip > ../initrd.cpio.gz
+cd ..
+
+mkdir -p rootfs
+cd rootfs
+tar xvzf ../initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../dist/install/* .
+mv ../initrd.cpio.gz ./root
+cp ../Image ./root
+echo "name=\"test\"
+memory=512
+vcpus=1
+kernel=\"/root/Image\"
+ramdisk=\"/root/initrd.cpio.gz\"
+extra=\"console=hvc0 root=/dev/ram0 rdinit=/bin/sh\"
+" > root/test.cfg
+echo "#!/bin/bash
+
+export LD_LIBRARY_PATH=/usr/local/lib
+bash /etc/init.d/xencommons start
+
+xl list
+
+xl create -c /root/test.cfg
+
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+find . |cpio -H newc -o|gzip > ../xen-rootfs.cpio.gz
+cd ../..
+
+# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
+curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
+./binaries/qemu-system-aarch64 \
+   -machine virtualization=true \
+   -cpu cortex-a57 -machine type=virt \
+   -m 2048 -smp 2 -display none \
+   -machine dumpdtb=binaries/virt-gicv2.dtb
+
+# XXX disable pl061 to avoid Linux crash
+fdtput binaries/virt-gicv2.dtb -p -t s /pl061@9030000 status disabled
+
+# ImageBuilder
+echo 'MEMORY_START="0x40000000"
+MEMORY_END="0xC0000000"
+
+DEVICE_TREE="virt-gicv2.dtb"
+XEN="xen"
+DOM0_KERNEL="Image"
+DOM0_RAMDISK="xen-rootfs.cpio.gz"
+XEN_CMD="console=dtuart dom0_mem=1024M"
+
+NUM_DOMUS=0
+
+LOAD_CMD="tftpb"
+UBOOT_SOURCE="boot.source"
+UBOOT_SCRIPT="boot.scr"' > binaries/config
+rm -rf imagebuilder
+git clone https://gitlab.com/ViryaOS/imagebuilder
+bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/config
+
+
+# Run the test
+rm -f smoke.serial
+set +e
+echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
+timeout -k 1 720 \
+./binaries/qemu-system-aarch64 \
+    -machine virtualization=true \
+    -cpu cortex-a57 -machine type=virt \
+    -m 2048 -monitor none -serial stdio \
+    -smp 2 \
+    -no-reboot \
+    -device virtio-net-pci,netdev=n0 \
+    -netdev user,id=n0,tftp=binaries \
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+
+set -e
+(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
+exit 0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:04:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:04:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452550.710377 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RGA-0004a8-ML; Sat, 03 Dec 2022 12:04:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452550.710377; Sat, 03 Dec 2022 12:04: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 1p1RGA-0004a3-Ji; Sat, 03 Dec 2022 12:04:46 +0000
Received: by outflank-mailman (input) for mailman id 452550;
 Sat, 03 Dec 2022 12:04:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RG9-0004Zj-4t
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RG9-0008BE-4E
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RG9-0002iI-3a
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dpnslDOc1Ou+JtNROcC0M47g+CosHJDkKe6UVeGmy/o=; b=QgKEqJ0si/SmQElIqJNWPjn6KC
	olg9UGN1oonA0UMojxK5jgZej4b+7awK8OXd+c9vngbznHhf+NuQYJCSTv1oTic5sZv2Z9XpmNohR
	X1IM8uVqUFaTXq+ftBt6UiHLA21OR4kQq6xk3+COOGd+2qv+FvgxZIlYODvxdCMZjtk0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Rename qemu-smoke-arm32.sh to qemu-smoke-dom0-arm32.sh
Message-Id: <E1p1RG9-0002iI-3a@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:04:45 +0000

commit 9b29d5b7eea5873926223d2846527e4e2ce4129f
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 27 11:47:27 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Dec 1 17:02:46 2022 -0800

    automation: Rename qemu-smoke-arm32.sh to qemu-smoke-dom0-arm32.sh
    
    After qemu arm64 test scripts had been renamed to reflect their
    usage, do the same for the qemu arm32 test script. Currently it only
    boots dom0, so we can assume that this script will be used to perform
    dom0 based testing. In the future we will be able to create corresponding
    script qemu-smoke-dom0less-arm32.sh to perform dom0less based testing.
    This is the last step to get rid of ambiguity with regards to naming
    of Arm test scripts.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml              |  8 +--
 automation/scripts/qemu-smoke-arm32.sh      | 78 -----------------------------
 automation/scripts/qemu-smoke-dom0-arm32.sh | 78 +++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 82 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 3b147c88ab..92e0a1f7c5 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -195,12 +195,12 @@ qemu-smoke-dom0less-arm64-gcc-debug-boot-cpupools:
   tags:
     - arm64
 
-qemu-smoke-arm32-gcc:
+qemu-smoke-dom0-arm32-gcc:
   extends: .test-jobs-common
   variables:
     CONTAINER: debian:unstable-arm64v8
   script:
-    - ./automation/scripts/qemu-smoke-arm32.sh 2>&1 | tee qemu-smoke-arm32.log
+    - ./automation/scripts/qemu-smoke-dom0-arm32.sh 2>&1 | tee qemu-smoke-arm32.log
   needs:
     - debian-unstable-gcc-arm32
     - qemu-system-aarch64-6.0.0-arm32-export
@@ -212,12 +212,12 @@ qemu-smoke-arm32-gcc:
   tags:
     - arm64
 
-qemu-smoke-arm32-gcc-debug:
+qemu-smoke-dom0-arm32-gcc-debug:
   extends: .test-jobs-common
   variables:
     CONTAINER: debian:unstable-arm64v8
   script:
-    - ./automation/scripts/qemu-smoke-arm32.sh 2>&1 | tee qemu-smoke-arm32.log
+    - ./automation/scripts/qemu-smoke-dom0-arm32.sh 2>&1 | tee qemu-smoke-arm32.log
   needs:
     - debian-unstable-gcc-arm32-debug
     - qemu-system-aarch64-6.0.0-arm32-export
diff --git a/automation/scripts/qemu-smoke-arm32.sh b/automation/scripts/qemu-smoke-arm32.sh
deleted file mode 100755
index ef19b988c2..0000000000
--- a/automation/scripts/qemu-smoke-arm32.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-export DEBIAN_FRONTEND=noninteractive
-apt-get -qy update
-apt-get -qy install --no-install-recommends u-boot-qemu \
-                                            u-boot-tools \
-                                            device-tree-compiler \
-                                            curl \
-                                            cpio
-
-cd binaries
-# Use the kernel from Debian
-curl --fail --silent --show-error --location --output vmlinuz http://http.us.debian.org/debian/dists/bullseye/main/installer-armhf/current/images/netboot/vmlinuz
-# Use a tiny initrd based on busybox from Alpine Linux
-curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/armhf/alpine-minirootfs-3.15.1-armhf.tar.gz
-
-mkdir rootfs
-cd rootfs
-tar xvzf ../initrd.tar.gz
-find . | cpio -H newc -o | gzip > ../initrd.gz
-cd ..
-
-# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
-curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
-./qemu-system-arm \
-   -machine virt \
-   -machine virtualization=true \
-   -smp 4 \
-   -m 1024 \
-   -serial stdio \
-   -monitor none \
-   -display none \
-   -machine dumpdtb=virt.dtb
-
-# ImageBuilder
-echo 'MEMORY_START="0x40000000"
-MEMORY_END="0x80000000"
-
-DEVICE_TREE="virt.dtb"
-XEN="xen"
-DOM0_KERNEL="vmlinuz"
-DOM0_RAMDISK="initrd.gz"
-DOM0_CMD="console=hvc0 earlyprintk clk_ignore_unused root=/dev/ram0 rdinit=/bin/sh"
-XEN_CMD="console=dtuart dom0_mem=512M bootscrub=0"
-
-NUM_DOMUS=0
-
-LOAD_CMD="tftpb"
-BOOT_CMD="bootm"
-UBOOT_SOURCE="boot.source"
-UBOOT_SCRIPT="boot.scr"' > config
-
-rm -rf imagebuilder
-git clone https://gitlab.com/ViryaOS/imagebuilder
-bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
-
-rm -f smoke.serial
-set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./qemu-system-arm \
-   -machine virt \
-   -machine virtualization=true \
-   -smp 4 \
-   -m 1024 \
-   -serial stdio \
-   -monitor none \
-   -display none \
-   -no-reboot \
-   -device virtio-net-pci,netdev=n0 \
-   -netdev user,id=n0,tftp=./ \
-   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& tee smoke.serial
-
-set -e
-(grep -q "^/ #" smoke.serial) || exit 1
-exit 0
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
new file mode 100755
index 0000000000..ef19b988c2
--- /dev/null
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+set -ex
+
+export DEBIAN_FRONTEND=noninteractive
+apt-get -qy update
+apt-get -qy install --no-install-recommends u-boot-qemu \
+                                            u-boot-tools \
+                                            device-tree-compiler \
+                                            curl \
+                                            cpio
+
+cd binaries
+# Use the kernel from Debian
+curl --fail --silent --show-error --location --output vmlinuz http://http.us.debian.org/debian/dists/bullseye/main/installer-armhf/current/images/netboot/vmlinuz
+# Use a tiny initrd based on busybox from Alpine Linux
+curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/armhf/alpine-minirootfs-3.15.1-armhf.tar.gz
+
+mkdir rootfs
+cd rootfs
+tar xvzf ../initrd.tar.gz
+find . | cpio -H newc -o | gzip > ../initrd.gz
+cd ..
+
+# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
+curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
+./qemu-system-arm \
+   -machine virt \
+   -machine virtualization=true \
+   -smp 4 \
+   -m 1024 \
+   -serial stdio \
+   -monitor none \
+   -display none \
+   -machine dumpdtb=virt.dtb
+
+# ImageBuilder
+echo 'MEMORY_START="0x40000000"
+MEMORY_END="0x80000000"
+
+DEVICE_TREE="virt.dtb"
+XEN="xen"
+DOM0_KERNEL="vmlinuz"
+DOM0_RAMDISK="initrd.gz"
+DOM0_CMD="console=hvc0 earlyprintk clk_ignore_unused root=/dev/ram0 rdinit=/bin/sh"
+XEN_CMD="console=dtuart dom0_mem=512M bootscrub=0"
+
+NUM_DOMUS=0
+
+LOAD_CMD="tftpb"
+BOOT_CMD="bootm"
+UBOOT_SOURCE="boot.source"
+UBOOT_SCRIPT="boot.scr"' > config
+
+rm -rf imagebuilder
+git clone https://gitlab.com/ViryaOS/imagebuilder
+bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
+
+rm -f smoke.serial
+set +e
+echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
+timeout -k 1 240 \
+./qemu-system-arm \
+   -machine virt \
+   -machine virtualization=true \
+   -smp 4 \
+   -m 1024 \
+   -serial stdio \
+   -monitor none \
+   -display none \
+   -no-reboot \
+   -device virtio-net-pci,netdev=n0 \
+   -netdev user,id=n0,tftp=./ \
+   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& tee smoke.serial
+
+set -e
+(grep -q "^/ #" smoke.serial) || exit 1
+exit 0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:04:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:04:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452551.710381 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RGK-0004dE-OV; Sat, 03 Dec 2022 12:04:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452551.710381; Sat, 03 Dec 2022 12:04: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 1p1RGK-0004d7-LT; Sat, 03 Dec 2022 12:04:56 +0000
Received: by outflank-mailman (input) for mailman id 452551;
 Sat, 03 Dec 2022 12:04:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGJ-0004ct-7k
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGJ-0008Cv-75
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGJ-0002jA-6Q
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:04: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M/TQNneOLakWoeTHdnBfe+uvOvB0LcPKKLxCb7SOiqg=; b=g5LG0vFlMbdaWL7G4dJf3k1C93
	fSIGezfU3XDatH4n6VnKVS4u2RZoE2sYVQlZfixprMTxJVk3m5KxlgepUVtUC9vG5MwILghKISnD1
	7tw90plgf9KwvI4TheiQ9L55v0A6X1KFlMeZJTzos+vDwchOoQXVlEDVVivBSmBt9F0w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: test.yaml: Introduce templates to reduce the overhead
Message-Id: <E1p1RGJ-0002jA-6Q@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:04:55 +0000

commit 200fd087143bd65086aca5acbefc15ed1cc1daf9
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Oct 25 11:59:52 2022 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Dec 1 17:02:46 2022 -0800

    automation: test.yaml: Introduce templates to reduce the overhead
    
    At the moment, we define lots of test jobs in test.yaml, that make use
    of the same configuration sections like variables, tags, artifacts.
    Introduce templates (hidden jobs whose names start with a dot) to
    reduce the overhead and simplify the file (more than 100 lines saved).
    This way, the actual jobs can only specify sections that are unique
    to them.
    
    Most of the test jobs specify the same set of prerequisite jobs under
    needs property with just one additional being unique to the job itself.
    Introduce YAML anchors for that purpose, because when using extends, the
    needs property is not being merged (the parent property overwrites the
    child one).
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml | 270 +++++++++++++----------------------------
 1 file changed, 83 insertions(+), 187 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 92e0a1f7c5..c7e0078e04 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -7,35 +7,32 @@
     - /^coverity-tested\/.*/
     - /^stable-.*/
 
-# Test jobs
-build-each-commit-gcc:
+.arm64-test-needs: &arm64-test-needs
+  - alpine-3.12-arm64-rootfs-export
+  - kernel-5.19-arm64-export
+  - qemu-system-aarch64-6.0.0-arm64-export
+
+.arm32-test-needs: &arm32-test-needs
+  - qemu-system-aarch64-6.0.0-arm32-export
+
+.qemu-arm64:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:stretch
-    XEN_TARGET_ARCH: x86_64
-    CC: gcc
-  script:
-    - BASE=${BASE_SHA:-${CI_COMMIT_BEFORE_SHA}} TIP=${TIP_SHA:-${CI_COMMIT_SHA}} ./automation/gitlab-ci/build-each-commit.sh 2>&1 | tee ../build-each-commit-gcc.log
-    - mv ../build-each-commit-gcc.log .
+    CONTAINER: debian:unstable-arm64v8
+    LOGFILE: qemu-smoke-arm64.log
   artifacts:
     paths:
+      - smoke.serial
       - '*.log'
     when: always
-  needs: []
   tags:
-    - x86_64
+    - arm64
 
-qemu-smoke-dom0-arm64-gcc:
+.qemu-arm32:
   extends: .test-jobs-common
   variables:
     CONTAINER: debian:unstable-arm64v8
-  script:
-    - ./automation/scripts/qemu-smoke-dom0-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
-  needs:
-    - alpine-3.12-gcc-arm64
-    - alpine-3.12-arm64-rootfs-export
-    - kernel-5.19-arm64-export
-    - qemu-system-aarch64-6.0.0-arm64-export
+    LOGFILE: qemu-smoke-arm32.log
   artifacts:
     paths:
       - smoke.serial
@@ -44,251 +41,150 @@ qemu-smoke-dom0-arm64-gcc:
   tags:
     - arm64
 
-qemu-smoke-dom0-arm64-gcc-debug:
+.qemu-x86-64:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:unstable-arm64v8
-  script:
-    - ./automation/scripts/qemu-smoke-dom0-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
-  needs:
-    - alpine-3.12-gcc-debug-arm64
-    - alpine-3.12-arm64-rootfs-export
-    - kernel-5.19-arm64-export
-    - qemu-system-aarch64-6.0.0-arm64-export
+    CONTAINER: debian:stretch
+    LOGFILE: qemu-smoke-x86-64.log
   artifacts:
     paths:
       - smoke.serial
       - '*.log'
     when: always
   tags:
-    - arm64
+    - x86_64
 
-qemu-alpine-x86_64-gcc:
+# Test jobs
+build-each-commit-gcc:
   extends: .test-jobs-common
   variables:
     CONTAINER: debian:stretch
+    XEN_TARGET_ARCH: x86_64
+    CC: gcc
   script:
-    - ./automation/scripts/qemu-alpine-x86_64.sh 2>&1 | tee qemu-smoke-x86_64.log
-  needs:
-    - alpine-3.12-gcc
-    - alpine-3.12-rootfs-export
-    - kernel-5.10.74-export
+    - BASE=${BASE_SHA:-${CI_COMMIT_BEFORE_SHA}} TIP=${TIP_SHA:-${CI_COMMIT_SHA}} ./automation/gitlab-ci/build-each-commit.sh 2>&1 | tee ../build-each-commit-gcc.log
+    - mv ../build-each-commit-gcc.log .
   artifacts:
     paths:
-      - smoke.serial
       - '*.log'
     when: always
+  needs: []
   tags:
     - x86_64
 
+qemu-smoke-dom0-arm64-gcc:
+  extends: .qemu-arm64
+  script:
+    - ./automation/scripts/qemu-smoke-dom0-arm64.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm64-test-needs
+    - alpine-3.12-gcc-arm64
+
+qemu-smoke-dom0-arm64-gcc-debug:
+  extends: .qemu-arm64
+  script:
+    - ./automation/scripts/qemu-smoke-dom0-arm64.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm64-test-needs
+    - alpine-3.12-gcc-debug-arm64
+
 qemu-smoke-dom0less-arm64-gcc:
-  extends: .test-jobs-common
-  variables:
-    CONTAINER: debian:unstable-arm64v8
+  extends: .qemu-arm64
   script:
-    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh 2>&1 | tee ${LOGFILE}
   needs:
+    - *arm64-test-needs
     - alpine-3.12-gcc-arm64
-    - alpine-3.12-arm64-rootfs-export
-    - kernel-5.19-arm64-export
-    - qemu-system-aarch64-6.0.0-arm64-export
-  artifacts:
-    paths:
-      - smoke.serial
-      - '*.log'
-    when: always
-  tags:
-    - arm64
 
 qemu-smoke-dom0less-arm64-gcc-debug:
-  extends: .test-jobs-common
-  variables:
-    CONTAINER: debian:unstable-arm64v8
+  extends: .qemu-arm64
   script:
-    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh 2>&1 | tee ${LOGFILE}
   needs:
+    - *arm64-test-needs
     - alpine-3.12-gcc-debug-arm64
-    - alpine-3.12-arm64-rootfs-export
-    - kernel-5.19-arm64-export
-    - qemu-system-aarch64-6.0.0-arm64-export
-  artifacts:
-    paths:
-      - smoke.serial
-      - '*.log'
-    when: always
-  tags:
-    - arm64
 
 qemu-smoke-dom0less-arm64-gcc-staticmem:
-  extends: .test-jobs-common
-  variables:
-    CONTAINER: debian:unstable-arm64v8
+  extends: .qemu-arm64
   script:
-    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh static-mem 2>&1 | tee ${LOGFILE}
   needs:
+    - *arm64-test-needs
     - alpine-3.12-gcc-arm64-staticmem
-    - alpine-3.12-arm64-rootfs-export
-    - kernel-5.19-arm64-export
-    - qemu-system-aarch64-6.0.0-arm64-export
-  artifacts:
-    paths:
-      - smoke.serial
-      - '*.log'
-    when: always
-  tags:
-    - arm64
 
 qemu-smoke-dom0less-arm64-gcc-debug-staticmem:
-  extends: .test-jobs-common
-  variables:
-    CONTAINER: debian:unstable-arm64v8
+  extends: .qemu-arm64
   script:
-    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh static-mem 2>&1 | tee ${LOGFILE}
   needs:
+    - *arm64-test-needs
     - alpine-3.12-gcc-debug-arm64-staticmem
-    - alpine-3.12-arm64-rootfs-export
-    - kernel-5.19-arm64-export
-    - qemu-system-aarch64-6.0.0-arm64-export
-  artifacts:
-    paths:
-      - smoke.serial
-      - '*.log'
-    when: always
-  tags:
-    - arm64
 
 qemu-smoke-dom0less-arm64-gcc-boot-cpupools:
-  extends: .test-jobs-common
-  variables:
-    CONTAINER: debian:unstable-arm64v8
+  extends: .qemu-arm64
   script:
-    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh boot-cpupools 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh boot-cpupools 2>&1 | tee ${LOGFILE}
   needs:
+    - *arm64-test-needs
     - alpine-3.12-gcc-arm64-boot-cpupools
-    - alpine-3.12-arm64-rootfs-export
-    - kernel-5.19-arm64-export
-    - qemu-system-aarch64-6.0.0-arm64-export
-  artifacts:
-    paths:
-      - smoke.serial
-      - '*.log'
-    when: always
-  tags:
-    - arm64
 
 qemu-smoke-dom0less-arm64-gcc-debug-boot-cpupools:
-  extends: .test-jobs-common
-  variables:
-    CONTAINER: debian:unstable-arm64v8
+  extends: .qemu-arm64
   script:
-    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh boot-cpupools 2>&1 | tee qemu-smoke-arm64.log
+    - ./automation/scripts/qemu-smoke-dom0less-arm64.sh boot-cpupools 2>&1 | tee ${LOGFILE}
   needs:
+    - *arm64-test-needs
     - alpine-3.12-gcc-debug-arm64-boot-cpupools
-    - alpine-3.12-arm64-rootfs-export
-    - kernel-5.19-arm64-export
-    - qemu-system-aarch64-6.0.0-arm64-export
-  artifacts:
-    paths:
-      - smoke.serial
-      - '*.log'
-    when: always
-  tags:
-    - arm64
 
 qemu-smoke-dom0-arm32-gcc:
-  extends: .test-jobs-common
-  variables:
-    CONTAINER: debian:unstable-arm64v8
+  extends: .qemu-arm32
   script:
-    - ./automation/scripts/qemu-smoke-dom0-arm32.sh 2>&1 | tee qemu-smoke-arm32.log
+    - ./automation/scripts/qemu-smoke-dom0-arm32.sh 2>&1 | tee ${LOGFILE}
   needs:
+    - *arm32-test-needs
     - debian-unstable-gcc-arm32
-    - qemu-system-aarch64-6.0.0-arm32-export
-  artifacts:
-    paths:
-      - smoke.serial
-      - '*.log'
-    when: always
-  tags:
-    - arm64
 
 qemu-smoke-dom0-arm32-gcc-debug:
-  extends: .test-jobs-common
-  variables:
-    CONTAINER: debian:unstable-arm64v8
+  extends: .qemu-arm32
   script:
-    - ./automation/scripts/qemu-smoke-dom0-arm32.sh 2>&1 | tee qemu-smoke-arm32.log
+    - ./automation/scripts/qemu-smoke-dom0-arm32.sh 2>&1 | tee ${LOGFILE}
   needs:
+    - *arm32-test-needs
     - debian-unstable-gcc-arm32-debug
-    - qemu-system-aarch64-6.0.0-arm32-export
-  artifacts:
-    paths:
-      - smoke.serial
-      - '*.log'
-    when: always
-  tags:
-    - arm64
+
+qemu-alpine-x86_64-gcc:
+  extends: .qemu-x86-64
+  script:
+    - ./automation/scripts/qemu-alpine-x86_64.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - alpine-3.12-gcc
+    - alpine-3.12-rootfs-export
+    - kernel-5.10.74-export
 
 qemu-smoke-x86-64-gcc:
-  extends: .test-jobs-common
-  variables:
-    CONTAINER: debian:stretch
+  extends: .qemu-x86-64
   script:
-    - ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee qemu-smoke-x86-64.log
-  artifacts:
-    paths:
-      - smoke.serial
-      - '*.log'
-    when: always
+    - ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee ${LOGFILE}
   needs:
     - debian-stretch-gcc-debug
-  tags:
-    - x86_64
 
 qemu-smoke-x86-64-clang:
-  extends: .test-jobs-common
-  variables:
-    CONTAINER: debian:stretch
+  extends: .qemu-x86-64
   script:
-    - ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee qemu-smoke-x86-64.log
-  artifacts:
-    paths:
-      - smoke.serial
-      - '*.log'
-    when: always
+    - ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee ${LOGFILE}
   needs:
     - debian-unstable-clang-debug
-  tags:
-    - x86_64
 
 qemu-smoke-x86-64-gcc-pvh:
-  extends: .test-jobs-common
-  variables:
-    CONTAINER: debian:stretch
+  extends: .qemu-x86-64
   script:
-    - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee qemu-smoke-x86-64.log
-  artifacts:
-    paths:
-      - smoke.serial
-      - '*.log'
-    when: always
+    - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
   needs:
     - debian-stretch-gcc-debug
-  tags:
-    - x86_64
 
 qemu-smoke-x86-64-clang-pvh:
-  extends: .test-jobs-common
-  variables:
-    CONTAINER: debian:stretch
+  extends: .qemu-x86-64
   script:
-    - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee qemu-smoke-x86-64.log
-  artifacts:
-    paths:
-      - smoke.serial
-      - '*.log'
-    when: always
+    - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
   needs:
     - debian-unstable-clang-debug
-  tags:
-    - x86_64
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:05:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:05:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452553.710384 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RGU-0004hN-RO; Sat, 03 Dec 2022 12:05:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452553.710384; Sat, 03 Dec 2022 12:05: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 1p1RGU-0004hG-Ok; Sat, 03 Dec 2022 12:05:06 +0000
Received: by outflank-mailman (input) for mailman id 452553;
 Sat, 03 Dec 2022 12:05:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGT-0004go-BS
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGT-0008DI-A6
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGT-0002kD-9E
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oedV4ARsSBNSv0TgW+9TAHkhRDztjNzlUKzZcoym4Do=; b=r5k8QiEyZdOfHY7u9ypEN5wUpm
	CTrUAkAphTqMHOa2O2JaC1NX36+dqo3aRLR1hBiuknqnfTR/NvEJTYyXjsdcLa0N/A2X+6OxfGlA5
	yN99G687Rl4nMq6pl5ffzHXJr+0KtPOVhbtHi8RNzhoftbmjBzic0nfWavej2eAYkieg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Introduce more MISRA C rules to docs/misra/rules.rst
Message-Id: <E1p1RGT-0002kD-9E@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:05:05 +0000

commit 1527066a7eaabcd18533135e81f9064e00b32428
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Mon Nov 28 16:18:24 2022 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Dec 1 17:04:24 2022 -0800

    Introduce more MISRA C rules to docs/misra/rules.rst
    
    Add the new MISRA C rules agreed by the MISRA C working group to
    docs/misra/rules.rst.
    
    Add a comment for Rule 19.1 to explain that Eclair's findings are
    "caution" reports, not violations.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/misra/rules.rst | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 8a659d8d47..dcceab9388 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -77,11 +77,32 @@ existing codebase are work-in-progress.
        behaviour
      -
 
+   * - `Rule 2.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_02_06.c>`_
+     - Advisory
+     - A function should not contain unused label declarations
+     -
+
+   * - `Rule 3.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_03_01.c>`_
+     - Required
+     - The character sequences /* and // shall not be used within a
+       comment
+     -
+
    * - `Rule 3.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_03_02.c>`_
      - Required
      - Line-splicing shall not be used in // comments
      -
 
+   * - `Rule 4.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_04_01.c>`_
+     - Required
+     - Octal and hexadecimal escape sequences shall be terminated
+     -
+
+   * - `Rule 4.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_04_02.c>`_
+     - Advisory
+     - Trigraphs should not be used
+     -
+
    * - `Rule 5.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_05_01_2.c>`_
      - Required
      - External identifiers shall be distinct
@@ -200,6 +221,21 @@ existing codebase are work-in-progress.
        have an explicit return statement with an expression
      -
 
+   * - `Rule 17.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_17_06.c>`_
+     - Mandatory
+     - The declaration of an array parameter shall not contain the
+       static keyword between the [ ]
+     -
+
+   * - `Rule 19.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_19_01.c>`_
+     - Mandatory
+     - An object shall not be assigned or copied to an overlapping
+       object
+     - Be aware that the static analysis tool Eclair might report
+       several findings for Rule 19.1 of type "caution". These are
+       instances where Eclair is unable to verify that the code is valid
+       in regard to Rule 19.1. Caution reports are not violations.
+
    * - `Rule 20.7 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_07.c>`_
      - Required
      - Expressions resulting from the expansion of macro parameters
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:05:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:05:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452555.710390 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RGe-0004mL-TP; Sat, 03 Dec 2022 12:05:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452555.710390; Sat, 03 Dec 2022 12:05: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 1p1RGe-0004mD-QS; Sat, 03 Dec 2022 12:05:16 +0000
Received: by outflank-mailman (input) for mailman id 452555;
 Sat, 03 Dec 2022 12:05:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGd-0004m5-Dw
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGd-0008DM-DG
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGd-0002lD-CP
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MAPpeuLnlVeXuq4l8Lvp1jHITx8q7D9ytzqSX4UwK9w=; b=1cT7DJ7gQHL+ANTmlnjk5a2o15
	XiZMAmyPyMRjV8gT87PDwOxFJs8SleQsIWprXdyKTV1R3UplZXzgNXdB+Yb/nqmletnnUOAt8vX9D
	0RmBfrrur1cC1qslZA3EFkf12CvCYtOlfYmQ6bxKtq1XCuwNxR7ZK1Elkw5b3UTScrTE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] gnttab: no need to translate handle for gnttab_get_status_frames()
Message-Id: <E1p1RGd-0002lD-CP@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:05:15 +0000

commit 432ffda15f80519154d7af0c889816811ee90340
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Dec 2 10:24:31 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:24:31 2022 +0100

    gnttab: no need to translate handle for gnttab_get_status_frames()
    
    Unlike for GNTTABOP_setup_table, native and compat frame lists for
    GNTTABOP_get_status_frames are arrays of the same type (uint64_t). Hence
    there's no need to translate the frame values. This then also renders
    unnecessary the limit_max parameter of gnttab_get_status_frames().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/compat/grant_table.c | 34 +++++++++-------------------------
 xen/common/grant_table.c        | 14 ++------------
 2 files changed, 11 insertions(+), 37 deletions(-)

diff --git a/xen/common/compat/grant_table.c b/xen/common/compat/grant_table.c
index 4705ee5f76..4f6d0b05fb 100644
--- a/xen/common/compat/grant_table.c
+++ b/xen/common/compat/grant_table.c
@@ -271,10 +271,7 @@ int compat_grant_table_op(
             }
             break;
 
-        case GNTTABOP_get_status_frames: {
-            unsigned int max_frame_list_size_in_pages =
-                (COMPAT_ARG_XLAT_SIZE - sizeof(*nat.get_status)) /
-                sizeof(*nat.get_status->frame_list.p);
+        case GNTTABOP_get_status_frames:
             if ( count != 1)
             {
                 rc = -EINVAL;
@@ -289,38 +286,25 @@ int compat_grant_table_op(
             }
 
 #define XLAT_gnttab_get_status_frames_HNDL_frame_list(_d_, _s_) \
-            set_xen_guest_handle((_d_)->frame_list, (uint64_t *)(nat.get_status + 1))
+            guest_from_compat_handle((_d_)->frame_list, (_s_)->frame_list)
             XLAT_gnttab_get_status_frames(nat.get_status, &cmp.get_status);
 #undef XLAT_gnttab_get_status_frames_HNDL_frame_list
 
             rc = gnttab_get_status_frames(
-                guest_handle_cast(nat.uop, gnttab_get_status_frames_t),
-                count, max_frame_list_size_in_pages);
+                guest_handle_cast(nat.uop, gnttab_get_status_frames_t), count);
             if ( rc >= 0 )
             {
-#define XLAT_gnttab_get_status_frames_HNDL_frame_list(_d_, _s_) \
-                do \
-                { \
-                    if ( (_s_)->status == GNTST_okay ) \
-                    { \
-                        for ( i = 0; i < (_s_)->nr_frames; ++i ) \
-                        { \
-                            uint64_t frame = (_s_)->frame_list.p[i]; \
-                            if ( __copy_to_compat_offset((_d_)->frame_list, \
-                                                         i, &frame, 1) ) \
-                                (_s_)->status = GNTST_bad_virt_addr; \
-                        } \
-                    } \
-                } while (0)
-                XLAT_gnttab_get_status_frames(&cmp.get_status, nat.get_status);
-#undef XLAT_gnttab_get_status_frames_HNDL_frame_list
-                if ( unlikely(__copy_to_guest(cmp_uop, &cmp.get_status, 1)) )
+                XEN_GUEST_HANDLE_PARAM(gnttab_get_status_frames_compat_t) get =
+                    guest_handle_cast(cmp_uop,
+                                      gnttab_get_status_frames_compat_t);
+
+                if ( unlikely(__copy_field_to_guest(get, nat.get_status,
+                                                    status)) )
                     rc = -EFAULT;
                 else
                     i = 1;
             }
             break;
-        }
 
         default:
             domain_crash(current->domain);
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index ee7cc496b8..6326bae5aa 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -3257,7 +3257,7 @@ gnttab_set_version(XEN_GUEST_HANDLE_PARAM(gnttab_set_version_t) uop)
 
 static long
 gnttab_get_status_frames(XEN_GUEST_HANDLE_PARAM(gnttab_get_status_frames_t) uop,
-                         unsigned int count, unsigned int limit_max)
+                         unsigned int count)
 {
     gnttab_get_status_frames_t op;
     struct domain *d;
@@ -3307,15 +3307,6 @@ gnttab_get_status_frames(XEN_GUEST_HANDLE_PARAM(gnttab_get_status_frames_t) uop,
         goto unlock;
     }
 
-    if ( unlikely(limit_max < op.nr_frames) )
-    {
-        gdprintk(XENLOG_WARNING,
-                 "nr_status_frames for %pd is too large (%u,%u)\n",
-                 d, op.nr_frames, limit_max);
-        op.status = GNTST_general_error;
-        goto unlock;
-    }
-
     for ( i = 0; i < op.nr_frames; i++ )
     {
         gmfn = gfn_x(gnttab_status_gfn(d, gt, i));
@@ -3683,8 +3674,7 @@ long do_grant_table_op(
 
     case GNTTABOP_get_status_frames:
         rc = gnttab_get_status_frames(
-            guest_handle_cast(uop, gnttab_get_status_frames_t), count,
-                              UINT_MAX);
+            guest_handle_cast(uop, gnttab_get_status_frames_t), count);
         break;
 
     case GNTTABOP_get_version:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:05:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:05:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452558.710394 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RGo-00053w-Vt; Sat, 03 Dec 2022 12:05:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452558.710394; Sat, 03 Dec 2022 12:05: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 1p1RGo-00053o-Rt; Sat, 03 Dec 2022 12:05:26 +0000
Received: by outflank-mailman (input) for mailman id 452558;
 Sat, 03 Dec 2022 12:05:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGn-00053Y-HJ
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGn-0008DS-Ge
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGn-0002m1-Fg
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qcf/2GJoQrywUXPdGiYZPlladrQq6gynaZHMc//z8rs=; b=Qyrwpf32bWiLei10x8+7QTYEFB
	KM1kvPwhbCjcAHXdjo+RJf6K/HEU1bV3MYdktDQRWMPWv3Taj96K2NvIV1DrFGon/Bv9H81g68pa3
	s/2DckgoZMMeQ+QlZTzJKNXWjNVfq8ewfOzBjR1BHepRYDLzAUmE/HBuutv8aThO9c0Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] gnttab: bail from GFN-storing loops early in case of error
Message-Id: <E1p1RGn-0002m1-Fg@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:05:25 +0000

commit 5488cc3a4d7caa75259cdeb5f5b9da227fc12360
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Dec 2 10:25:59 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:25:59 2022 +0100

    gnttab: bail from GFN-storing loops early in case of error
    
    The contents of the output arrays are undefined anyway when the
    operation itself gets marked as failed. There's no value in trying to
    continue after a guest memory access failure.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/compat/grant_table.c | 3 +++
 xen/common/grant_table.c        | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/xen/common/compat/grant_table.c b/xen/common/compat/grant_table.c
index 4f6d0b05fb..744f9b6e3d 100644
--- a/xen/common/compat/grant_table.c
+++ b/xen/common/compat/grant_table.c
@@ -179,7 +179,10 @@ int compat_grant_table_op(
                             unsigned int frame = (_s_)->frame_list.p[i]; \
                             if ( __copy_to_compat_offset((_d_)->frame_list, \
                                                          i, &frame, 1) ) \
+                            { \
                                 (_s_)->status = GNTST_bad_virt_addr; \
+                                break; \
+                            } \
                         } \
                     } \
                 } while (0)
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 6326bae5aa..fa28c3cb7b 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2101,7 +2101,10 @@ gnttab_setup_table(
         BUG_ON(SHARED_M2P(gmfn));
 
         if ( __copy_to_guest_offset(op.frame_list, i, &gmfn, 1) )
+        {
             op.status = GNTST_bad_virt_addr;
+            break;
+        }
     }
 
  unlock:
@@ -3311,7 +3314,10 @@ gnttab_get_status_frames(XEN_GUEST_HANDLE_PARAM(gnttab_get_status_frames_t) uop,
     {
         gmfn = gfn_x(gnttab_status_gfn(d, gt, i));
         if ( __copy_to_guest_offset(op.frame_list, i, &gmfn, 1) )
+        {
             op.status = GNTST_bad_virt_addr;
+            break;
+        }
     }
 
  unlock:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:05:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:05:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452560.710397 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RGz-000574-0Y; Sat, 03 Dec 2022 12:05:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452560.710397; Sat, 03 Dec 2022 12:05: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 1p1RGy-00056s-TS; Sat, 03 Dec 2022 12:05:36 +0000
Received: by outflank-mailman (input) for mailman id 452560;
 Sat, 03 Dec 2022 12:05:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGx-00056X-L4
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGx-0008Dd-Jt
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RGx-0002mo-J2
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s3NfAoYygc0dcAHLuXgmzgEs9D3LG9PA425IrYck0IU=; b=nxLtH9xTPA/Px6y39c043aOj1V
	rd5JaF7iamUMNRh/GDQ4R7uvoRRVGIcta5wQJcKoUjY4IMvxI12kq2pJE3czk5EXYfhXfWCjURrXi
	oRs6cs5SkIw1tB/w5tNZhkRVwBcjH/dttn3ksFVv5tL/4Id88vF+L6/RMIc+JrZVC1pI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/locks: add dynamic lock recursion checks
Message-Id: <E1p1RGx-0002mo-J2@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:05:35 +0000

commit 6b09ca19d9e5270189fea419c2dc27254e405119
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Dec 2 10:26:55 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:26:55 2022 +0100

    xen/locks: add dynamic lock recursion checks
    
    Add checking of lock recursion to the hypervisor. This is done by using
    a percpu data array for storing the address of each taken lock. Any
    attempt to take a lock twice (with the exception of recursive
    spinlocks) will result in a crash. This is especially meant for
    detecting attempts to take a rwlock multiple times as a reader, which
    will only result in a deadlock in case of another cpu trying to get the
    lock as a writer in between.
    
    The additional checks are not performance neutral, so they are enabled
    only in debug builds per default, as the checks are active only with
    CONFIG_DEBUG_LOCKS enabled. The size of the percpu data array can be
    selected via a boot parameter.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc |  12 ++++
 xen/common/rwlock.c               |   6 ++
 xen/common/spinlock.c             | 145 ++++++++++++++++++++++++++++++++++++++
 xen/include/xen/rwlock.h          |  20 ++++++
 xen/include/xen/spinlock.h        |   4 ++
 5 files changed, 187 insertions(+)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 424b12cfb2..b7ee97be76 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1645,6 +1645,18 @@ This option is intended for debugging purposes only.  Enable MSR_DEBUGCTL.LBR
 in hypervisor context to be able to dump the Last Interrupt/Exception To/From
 record with other registers.
 
+### lock-depth-size
+> `= <integer>`
+
+> Default: `lock-depth-size=64`
+
+Specifies the maximum number of nested locks tested for illegal recursions.
+Higher nesting levels still work, but recursion testing is omitted for those
+levels. In case an illegal recursion is detected the system will crash
+immediately. Specifying `0` will disable all testing of illegal lock nesting.
+
+This option is available for hypervisors built with CONFIG_DEBUG_LOCKS only.
+
 ### loglvl
 > `= <level>[/<rate-limited level>]` where level is `none | error | warning | info | debug | all`
 
diff --git a/xen/common/rwlock.c b/xen/common/rwlock.c
index aa15529bbe..18224a4bb5 100644
--- a/xen/common/rwlock.c
+++ b/xen/common/rwlock.c
@@ -54,6 +54,8 @@ void queue_read_lock_slowpath(rwlock_t *lock)
      * Signal the next one in queue to become queue head.
      */
     spin_unlock(&lock->lock);
+
+    lock_enter(&lock->lock.debug);
 }
 
 /*
@@ -100,6 +102,8 @@ void queue_write_lock_slowpath(rwlock_t *lock)
     }
  unlock:
     spin_unlock(&lock->lock);
+
+    lock_enter(&lock->lock.debug);
 }
 
 
@@ -146,4 +150,6 @@ void _percpu_write_lock(percpu_rwlock_t **per_cpudata,
         /* Give the coherency fabric a break. */
         cpu_relax();
     };
+
+    lock_enter(&percpu_rwlock->rwlock.lock.debug);
 }
diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 62c83aaa6a..84996c3fbc 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -1,5 +1,8 @@
+#include <xen/cpu.h>
 #include <xen/lib.h>
 #include <xen/irq.h>
+#include <xen/notifier.h>
+#include <xen/param.h>
 #include <xen/smp.h>
 #include <xen/time.h>
 #include <xen/spinlock.h>
@@ -11,11 +14,77 @@
 
 #ifdef CONFIG_DEBUG_LOCKS
 
+/* Max. number of entries in locks_taken array. */
+static unsigned int __ro_after_init lock_depth_size = 64;
+integer_param("lock-depth-size", lock_depth_size);
+
+/*
+ * Array of addresses of taken locks.
+ * nr_locks_taken is the index after the last entry. As locks tend to be
+ * nested cleanly, when freeing a lock it will probably be the one before
+ * nr_locks_taken, and new entries can be entered at that index. It is fine
+ * for a lock to be released out of order, though.
+ */
+static DEFINE_PER_CPU(const union lock_debug **, locks_taken);
+static DEFINE_PER_CPU(unsigned int, nr_locks_taken);
+static bool __read_mostly max_depth_reached;
+
 static atomic_t spin_debug __read_mostly = ATOMIC_INIT(0);
 
+static int cf_check cpu_lockdebug_callback(struct notifier_block *nfb,
+                                           unsigned long action,
+                                           void *hcpu)
+{
+    unsigned int cpu = (unsigned long)hcpu;
+
+    switch ( action )
+    {
+    case CPU_UP_PREPARE:
+        if ( !per_cpu(locks_taken, cpu) )
+            per_cpu(locks_taken, cpu) = xzalloc_array(const union lock_debug *,
+                                                      lock_depth_size);
+        if ( !per_cpu(locks_taken, cpu) )
+            printk(XENLOG_WARNING
+                   "cpu %u: failed to allocate lock recursion check area\n",
+                   cpu);
+        break;
+
+    case CPU_UP_CANCELED:
+    case CPU_DEAD:
+        XFREE(per_cpu(locks_taken, cpu));
+        break;
+
+    default:
+        break;
+    }
+
+    return 0;
+}
+
+static struct notifier_block cpu_lockdebug_nfb = {
+    .notifier_call = cpu_lockdebug_callback,
+};
+
+static int __init cf_check lockdebug_init(void)
+{
+    if ( lock_depth_size )
+    {
+        register_cpu_notifier(&cpu_lockdebug_nfb);
+        cpu_lockdebug_callback(&cpu_lockdebug_nfb, CPU_UP_PREPARE,
+                               (void *)(unsigned long)smp_processor_id());
+    }
+
+    return 0;
+}
+presmp_initcall(lockdebug_init);
+
 void check_lock(union lock_debug *debug, bool try)
 {
     bool irq_safe = !local_irq_is_enabled();
+    unsigned int cpu = smp_processor_id();
+    const union lock_debug *const *taken = per_cpu(locks_taken, cpu);
+    unsigned int nr_taken = per_cpu(nr_locks_taken, cpu);
+    unsigned int i;
 
     BUILD_BUG_ON(LOCK_DEBUG_PAD_BITS <= 0);
 
@@ -63,6 +132,16 @@ void check_lock(union lock_debug *debug, bool try)
             BUG();
         }
     }
+
+    if ( try )
+        return;
+
+    for ( i = 0; i < nr_taken; i++ )
+        if ( taken[i] == debug )
+        {
+            printk("CHECKLOCK FAILURE: lock at %p taken recursively\n", debug);
+            BUG();
+        }
 }
 
 static void check_barrier(union lock_debug *debug)
@@ -84,15 +163,81 @@ static void check_barrier(union lock_debug *debug)
     BUG_ON(!local_irq_is_enabled() && !debug->irq_safe);
 }
 
+void lock_enter(const union lock_debug *debug)
+{
+    unsigned int cpu = smp_processor_id();
+    const union lock_debug **taken = per_cpu(locks_taken, cpu);
+    unsigned int *nr_taken = &per_cpu(nr_locks_taken, cpu);
+    unsigned long flags;
+
+    if ( !taken )
+        return;
+
+    local_irq_save(flags);
+
+    if ( *nr_taken < lock_depth_size )
+        taken[(*nr_taken)++] = debug;
+    else if ( !max_depth_reached )
+    {
+        max_depth_reached = true;
+        printk("CHECKLOCK max lock depth %u reached!\n", lock_depth_size);
+        WARN();
+    }
+
+    local_irq_restore(flags);
+}
+
+void lock_exit(const union lock_debug *debug)
+{
+    unsigned int cpu = smp_processor_id();
+    const union lock_debug **taken = per_cpu(locks_taken, cpu);
+    unsigned int *nr_taken = &per_cpu(nr_locks_taken, cpu);
+    unsigned int i;
+    unsigned long flags;
+
+    if ( !taken )
+        return;
+
+    local_irq_save(flags);
+
+    for ( i = *nr_taken; i > 0; i-- )
+    {
+        if ( taken[i - 1] == debug )
+        {
+            memmove(taken + i - 1, taken + i,
+                    (*nr_taken - i) * sizeof(*taken));
+            (*nr_taken)--;
+            taken[*nr_taken] = NULL;
+
+            local_irq_restore(flags);
+
+            return;
+        }
+    }
+
+    if ( !max_depth_reached )
+    {
+        printk("CHECKLOCK released lock at %p not recorded!\n", debug);
+        WARN();
+    }
+
+    local_irq_restore(flags);
+}
+
 static void got_lock(union lock_debug *debug)
 {
     debug->cpu = smp_processor_id();
+
+    lock_enter(debug);
 }
 
 static void rel_lock(union lock_debug *debug)
 {
     if ( atomic_read(&spin_debug) > 0 )
         BUG_ON(debug->cpu != smp_processor_id());
+
+    lock_exit(debug);
+
     debug->cpu = SPINLOCK_NO_CPU;
 }
 
diff --git a/xen/include/xen/rwlock.h b/xen/include/xen/rwlock.h
index 0cc9167715..b8d52a5aa9 100644
--- a/xen/include/xen/rwlock.h
+++ b/xen/include/xen/rwlock.h
@@ -66,7 +66,10 @@ static inline int _read_trylock(rwlock_t *lock)
          * arch_lock_acquire_barrier().
          */
         if ( likely(_can_read_lock(cnts)) )
+        {
+            lock_enter(&lock->lock.debug);
             return 1;
+        }
         atomic_sub(_QR_BIAS, &lock->cnts);
     }
     preempt_enable();
@@ -91,6 +94,7 @@ static inline void _read_lock(rwlock_t *lock)
     {
         /* The slow path calls check_lock() via spin_lock(). */
         check_lock(&lock->lock.debug, false);
+        lock_enter(&lock->lock.debug);
         return;
     }
 
@@ -123,6 +127,8 @@ static inline unsigned long _read_lock_irqsave(rwlock_t *lock)
  */
 static inline void _read_unlock(rwlock_t *lock)
 {
+    lock_exit(&lock->lock.debug);
+
     arch_lock_release_barrier();
     /*
      * Atomically decrement the reader count
@@ -170,6 +176,7 @@ static inline void _write_lock(rwlock_t *lock)
     {
         /* The slow path calls check_lock() via spin_lock(). */
         check_lock(&lock->lock.debug, false);
+        lock_enter(&lock->lock.debug);
         return;
     }
 
@@ -215,6 +222,8 @@ static inline int _write_trylock(rwlock_t *lock)
         return 0;
     }
 
+    lock_enter(&lock->lock.debug);
+
     /*
      * atomic_cmpxchg() is a full barrier so no need for an
      * arch_lock_acquire_barrier().
@@ -225,6 +234,9 @@ static inline int _write_trylock(rwlock_t *lock)
 static inline void _write_unlock(rwlock_t *lock)
 {
     ASSERT(_is_write_locked_by_me(atomic_read(&lock->cnts)));
+
+    lock_exit(&lock->lock.debug);
+
     arch_lock_release_barrier();
     atomic_and(~(_QW_CPUMASK | _QW_WMASK), &lock->cnts);
     preempt_enable();
@@ -343,6 +355,8 @@ static inline void _percpu_read_lock(percpu_rwlock_t **per_cpudata,
         /* All other paths have implicit check_lock() calls via read_lock(). */
         check_lock(&percpu_rwlock->rwlock.lock.debug, false);
     }
+
+    lock_enter(&percpu_rwlock->rwlock.lock.debug);
 }
 
 static inline void _percpu_read_unlock(percpu_rwlock_t **per_cpudata,
@@ -353,6 +367,9 @@ static inline void _percpu_read_unlock(percpu_rwlock_t **per_cpudata,
 
     /* Verify the read lock was taken for this lock */
     ASSERT(this_cpu_ptr(per_cpudata) != NULL);
+
+    lock_exit(&percpu_rwlock->rwlock.lock.debug);
+
     /*
      * Detect using a second percpu_rwlock_t simulatenously and fallback
      * to standard read_unlock.
@@ -379,6 +396,9 @@ static inline void _percpu_write_unlock(percpu_rwlock_t **per_cpudata,
 
     ASSERT(percpu_rwlock->writer_activating);
     percpu_rwlock->writer_activating = 0;
+
+    lock_exit(&percpu_rwlock->rwlock.lock.debug);
+
     write_unlock(&percpu_rwlock->rwlock);
 }
 
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index 961891bea4..2fa6ba3654 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -22,12 +22,16 @@ union lock_debug {
 };
 #define _LOCK_DEBUG { LOCK_DEBUG_INITVAL }
 void check_lock(union lock_debug *debug, bool try);
+void lock_enter(const union lock_debug *debug);
+void lock_exit(const union lock_debug *debug);
 void spin_debug_enable(void);
 void spin_debug_disable(void);
 #else
 union lock_debug { };
 #define _LOCK_DEBUG { }
 #define check_lock(l, t) ((void)0)
+#define lock_enter(l) ((void)0)
+#define lock_exit(l) ((void)0)
 #define spin_debug_enable() ((void)0)
 #define spin_debug_disable() ((void)0)
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:05:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:05:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452561.710400 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RH8-0005AU-3o; Sat, 03 Dec 2022 12:05:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452561.710400; Sat, 03 Dec 2022 12:05: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 1p1RH8-0005AN-10; Sat, 03 Dec 2022 12:05:46 +0000
Received: by outflank-mailman (input) for mailman id 452561;
 Sat, 03 Dec 2022 12:05:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RH7-0005AF-Nb
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RH7-0008E6-Mv
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RH7-0002nb-MB
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gyqyvCr5y2vUstpMsXN8gWtvvlpFt6tsTIDUDyOn870=; b=jD8hMZmXrBT0pdG+tY1+ZzqemK
	s1svz/3cbG4qUuQGSgrOGKQyL9e0JxLRnJ4HGrTS+CXk5wjDCBx4s8U3t26AcjvR31zyYdJMrmhOU
	jhcFm4NdEJQPIaTK71Mn64KrEWsAbpGPwh3rHdrZeca2IgtKmZx51YbpsfCfl+01bnck=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: add knownalive_domain_from_domid() helper
Message-Id: <E1p1RH7-0002nb-MB@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:05:45 +0000

commit a87d6f0fbd003353f09d59df65c5fad905de450d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Dec 2 10:27:38 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:27:38 2022 +0100

    xen: add knownalive_domain_from_domid() helper
    
    Add a helper knownalive_domain_from_domid() returning the struct domain
    pointer for a domain give by its domid and which is known not being
    able to be released (its reference count isn't incremented and no
    rcu_lock_domain() is called for it).
    
    In order to simplify coding add an internal helper for doing the lookup
    and call that from the new function and similar functions.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/domain.c     | 53 ++++++++++++++++++++++++++++++-------------------
 xen/include/xen/sched.h |  4 ++++
 2 files changed, 37 insertions(+), 20 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 53f7e734fe..c06d72ad64 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -835,25 +835,32 @@ out:
     return 0;
 }
 
-
-struct domain *get_domain_by_id(domid_t dom)
+/* rcu_read_lock(&domlist_read_lock) must be held. */
+static struct domain *domid_to_domain(domid_t dom)
 {
     struct domain *d;
 
-    rcu_read_lock(&domlist_read_lock);
-
     for ( d = rcu_dereference(domain_hash[DOMAIN_HASH(dom)]);
           d != NULL;
           d = rcu_dereference(d->next_in_hashbucket) )
     {
         if ( d->domain_id == dom )
-        {
-            if ( unlikely(!get_domain(d)) )
-                d = NULL;
-            break;
-        }
+            return d;
     }
 
+    return NULL;
+}
+
+struct domain *get_domain_by_id(domid_t dom)
+{
+    struct domain *d;
+
+    rcu_read_lock(&domlist_read_lock);
+
+    d = domid_to_domain(dom);
+    if ( d && unlikely(!get_domain(d)) )
+        d = NULL;
+
     rcu_read_unlock(&domlist_read_lock);
 
     return d;
@@ -862,20 +869,26 @@ struct domain *get_domain_by_id(domid_t dom)
 
 struct domain *rcu_lock_domain_by_id(domid_t dom)
 {
-    struct domain *d = NULL;
+    struct domain *d;
 
     rcu_read_lock(&domlist_read_lock);
 
-    for ( d = rcu_dereference(domain_hash[DOMAIN_HASH(dom)]);
-          d != NULL;
-          d = rcu_dereference(d->next_in_hashbucket) )
-    {
-        if ( d->domain_id == dom )
-        {
-            rcu_lock_domain(d);
-            break;
-        }
-    }
+    d = domid_to_domain(dom);
+    if ( d )
+        rcu_lock_domain(d);
+
+    rcu_read_unlock(&domlist_read_lock);
+
+    return d;
+}
+
+struct domain *knownalive_domain_from_domid(domid_t dom)
+{
+    struct domain *d;
+
+    rcu_read_lock(&domlist_read_lock);
+
+    d = domid_to_domain(dom);
 
     rcu_read_unlock(&domlist_read_lock);
 
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 072e4846aa..12be794002 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -737,8 +737,12 @@ static inline struct domain *rcu_lock_current_domain(void)
     return /*rcu_lock_domain*/(current->domain);
 }
 
+/* Get struct domain AND increase ref-count of domain. */
 struct domain *get_domain_by_id(domid_t dom);
 
+/* Get struct domain known to have reference held or being RCU-locked. */
+struct domain *knownalive_domain_from_domid(domid_t dom);
+
 struct domain *get_pg_owner(domid_t domid);
 
 static inline void put_pg_owner(struct domain *pg_owner)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:05:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:05:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452562.710405 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RHJ-0005Dd-5U; Sat, 03 Dec 2022 12:05:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452562.710405; Sat, 03 Dec 2022 12:05: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 1p1RHJ-0005DV-2o; Sat, 03 Dec 2022 12:05:57 +0000
Received: by outflank-mailman (input) for mailman id 452562;
 Sat, 03 Dec 2022 12:05:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHH-0005DK-Qf
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHH-0008EA-Pu
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHH-0002oW-PA
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PyBYCVpfcdMWNX308/x+hzNlbQ8GFNr8ASTM4S+MWgc=; b=RWNEb5iqGMn8v8rQkcou8Z0JcG
	rXdqc5f/ydKmIqriso70ked3nnwHenwYVzq4O+jYFCwLwz8l9OYL2uJu+o4Uz0i+C8iVg/4/dS5st
	zAPh0eScVuq96akmqGnZfyA4AzjLPhoOJcpwyv/73lfP7bmegXwjNXlnyXvv/ggUK7JU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/gnttab: reduce size of struct active_grant_entry
Message-Id: <E1p1RHH-0002oW-PA@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:05:55 +0000

commit a2f520314169fdaa47ab19b2ca8fb9d9f1554a36
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Dec 2 10:28:33 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:28:33 2022 +0100

    xen/gnttab: reduce size of struct active_grant_entry
    
    The size of struct active_grant_entry for 64-bit builds is 40 or 48
    bytes today (with or without NDEBUG).
    
    It can easily be reduced by 8 bytes by replacing the trans_domain
    pointer with the domid of the related domain. trans_domain is only ever
    used for transitive grants, which doesn't have any known users.
    
    This reduction will result in less memory usage and (for production
    builds) in faster code, as indexing into the active_grant_entry array
    will be much easier with an entry having a power-of-2 size.
    
    The performance loss when using transitive grants shouldn't really
    matter, given the probability that those aren't in use at all.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/grant_table.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index fa28c3cb7b..b896f9af0e 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -381,13 +381,13 @@ struct active_grant_entry {
 })
 
     domid_t       domid;  /* Domain being granted access.             */
+    domid_t       src_domid; /* Original domain granting access.      */
     unsigned int  start:15; /* For sub-page grants, the start offset
                                in the page.                           */
     bool          is_sub_page:1; /* True if this is a sub-page grant. */
     unsigned int  length:16; /* For sub-page grants, the length of the
                                 grant.                                */
     grant_ref_t   trans_gref;
-    struct domain *trans_domain;
     mfn_t         mfn;    /* Machine frame being granted.             */
 #ifndef NDEBUG
     gfn_t         gfn;    /* Guest's idea of the frame being granted. */
@@ -1095,7 +1095,7 @@ map_grant_ref(
             act->start = 0;
             act->length = PAGE_SIZE;
             act->is_sub_page = false;
-            act->trans_domain = rd;
+            act->src_domid = rd->domain_id;
             act->trans_gref = ref;
         }
     }
@@ -2497,7 +2497,8 @@ release_grant_for_copy(
     else
     {
         status = &status_entry(rgt, gref);
-        td = act->trans_domain;
+        td = (act->src_domid == rd->domain_id)
+             ? rd : knownalive_domain_from_domid(act->src_domid);
         trans_gref = act->trans_gref;
     }
 
@@ -2659,7 +2660,7 @@ acquire_grant_for_copy(
                           !mfn_eq(act->mfn, grant_mfn) ||
                           act->start != trans_page_off ||
                           act->length != trans_length ||
-                          act->trans_domain != td ||
+                          act->src_domid != td->domain_id ||
                           act->trans_gref != trans_gref ||
                           !act->is_sub_page)) )
         {
@@ -2692,7 +2693,7 @@ acquire_grant_for_copy(
             act->domid = ldom;
             act->start = trans_page_off;
             act->length = trans_length;
-            act->trans_domain = td;
+            act->src_domid = td->domain_id;
             act->trans_gref = trans_gref;
             act->mfn = grant_mfn;
             act_set_gfn(act, INVALID_GFN);
@@ -2754,7 +2755,7 @@ acquire_grant_for_copy(
             act->is_sub_page = is_sub_page;
             act->start = trans_page_off;
             act->length = trans_length;
-            act->trans_domain = td;
+            act->src_domid = td->domain_id;
             act->trans_gref = trans_gref;
             act->mfn = grant_mfn;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:06:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:06:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452564.710409 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RHT-0005GX-76; Sat, 03 Dec 2022 12:06:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452564.710409; Sat, 03 Dec 2022 12:06: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 1p1RHT-0005GP-4K; Sat, 03 Dec 2022 12:06:07 +0000
Received: by outflank-mailman (input) for mailman id 452564;
 Sat, 03 Dec 2022 12:06:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHR-0005GB-Tx
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHR-0008EW-Su
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHR-0002pb-S7
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GT5nuhy3A2VzT/nwy56xHz46ocQ+HcluaRErZ3G5CV0=; b=1ctq6Vz66hBRs3wuOASTsOUk4I
	bPFB3okU3JZRSjTumh7M+qdyu6aFQObgvTQRCVRWr+Xr+w+rTjLG8Ky0gO08ZXN3EhO6ChxwMlUt7
	0c7vZH/wcRVPDMLJn1zenNTjaMwNu1JNHFQgag2fbgyFFpyzG0C8HGb0LnWzn1aTb6L4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/sched: try harder to find a runnable unit in rt_schedule()
Message-Id: <E1p1RHR-0002pb-S7@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:06:05 +0000

commit 0f1dec89d324d93fa056334ac384c6845f480fe8
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Dec 2 10:29:19 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:29:19 2022 +0100

    xen/sched: try harder to find a runnable unit in rt_schedule()
    
    Instead of directly falling back to the idle unit in case the top
    unit from the run queue happened to be not runnable, consult the run
    queue again.
    
    Suggested-by: Dario Faggioli <dfaggioli@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
---
 xen/common/sched/rt.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c
index 05988cbd3d..d443cd5831 100644
--- a/xen/common/sched/rt.c
+++ b/xen/common/sched/rt.c
@@ -1101,15 +1101,20 @@ rt_schedule(const struct scheduler *ops, struct sched_unit *currunit,
     }
     else
     {
-        snext = runq_pick(ops, cpumask_of(sched_cpu), cur_cpu);
-
-        if ( snext == NULL )
-            snext = rt_unit(sched_idle_unit(sched_cpu));
-        else if ( !unit_runnable_state(snext->unit) )
+        while ( true )
         {
+            snext = runq_pick(ops, cpumask_of(sched_cpu), cur_cpu);
+
+            if ( snext == NULL )
+            {
+                snext = rt_unit(sched_idle_unit(sched_cpu));
+                break;
+            }
+            if ( unit_runnable_state(snext->unit) )
+                break;
+
             q_remove(snext);
             replq_remove(ops, snext);
-            snext = rt_unit(sched_idle_unit(sched_cpu));
         }
 
         /* if scurr has higher priority and budget, still pick scurr */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:06:17 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:06:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452566.710413 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RHd-0005Jl-8U; Sat, 03 Dec 2022 12:06:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452566.710413; Sat, 03 Dec 2022 12:06: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 1p1RHd-0005Jd-5v; Sat, 03 Dec 2022 12:06:17 +0000
Received: by outflank-mailman (input) for mailman id 452566;
 Sat, 03 Dec 2022 12:06:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHc-0005JI-1j
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHc-0008Ec-12
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHc-0002qS-08
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YbtRSsNU9m6N6UXMERhYFdslLidyhGZN2FbGFaygaso=; b=QgDzAqKTQwyHB9MFsN8xoWyLVU
	5711LgsgbBy2OOd0PSk+8DD587UYjp9uoc1PidhjrimHpjHq/vzHISg9D18+A3uQCDd4mbcrqRk04
	VojD2UPtSMsvAu1qF5m1kL82KDMONVgxTat/vwXVAVnhigXfpAw23koy5RQzyYViIJD8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/notifier: simplify using notifier_[to|from]_errno()
Message-Id: <E1p1RHc-0002qS-08@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:06:16 +0000

commit f0752bc3b895bebe522d98aaa0faf52a7c843766
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Dec 2 10:30:58 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:30:58 2022 +0100

    xen/notifier: simplify using notifier_[to|from]_errno()
    
    Today all users of notifier_from_errno() and notifier_to_errno() are
    Handling the success case the same way, by using
    
      !rc ? NOTIFY_DONE : notifier_from_errno(rc)
    
    or
    
      (notifier_rc == NOTIFY_DONE) ? 0 : notifier_to_errno(notifier_rc);
    
    Simplify the use cases by moving the handling of the success case into
    the functions.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com> # xen/common/sched/
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/cpuerrata.c            | 2 +-
 xen/arch/arm/gic-v3-lpi.c           | 2 +-
 xen/arch/arm/irq.c                  | 2 +-
 xen/arch/arm/percpu.c               | 2 +-
 xen/arch/arm/smpboot.c              | 2 +-
 xen/arch/x86/acpi/cpu_idle.c        | 2 +-
 xen/arch/x86/cpu/mcheck/mce.c       | 2 +-
 xen/arch/x86/cpu/mcheck/mce_intel.c | 2 +-
 xen/arch/x86/cpu/mwait-idle.c       | 2 +-
 xen/arch/x86/genapic/x2apic.c       | 2 +-
 xen/arch/x86/hvm/hvm.c              | 2 +-
 xen/arch/x86/percpu.c               | 2 +-
 xen/arch/x86/psr.c                  | 2 +-
 xen/arch/x86/smpboot.c              | 2 +-
 xen/common/cpu.c                    | 2 +-
 xen/common/sched/core.c             | 2 +-
 xen/common/sched/cpupool.c          | 2 +-
 xen/include/xen/notifier.h          | 4 ++--
 18 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index ae649d16ef..5952111b72 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -724,7 +724,7 @@ static int cpu_errata_callback(struct notifier_block *nfb,
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_errata_nfb = {
diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c
index 61d90eb386..f0b7ef17da 100644
--- a/xen/arch/arm/gic-v3-lpi.c
+++ b/xen/arch/arm/gic-v3-lpi.c
@@ -402,7 +402,7 @@ static int cpu_callback(struct notifier_block *nfb, unsigned long action,
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index fd0c15fffd..00fadbc354 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -148,7 +148,7 @@ static int cpu_callback(struct notifier_block *nfb, unsigned long action,
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/arch/arm/percpu.c b/xen/arch/arm/percpu.c
index 25442c48fe..67eb821ff6 100644
--- a/xen/arch/arm/percpu.c
+++ b/xen/arch/arm/percpu.c
@@ -68,7 +68,7 @@ static int cpu_percpu_callback(
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_percpu_nfb = {
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index f7bda3a18b..bfa988c162 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -562,7 +562,7 @@ static int cpu_smpboot_callback(struct notifier_block *nfb,
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_smpboot_nfb = {
diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 557bc6ef86..427c8c89c5 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -1663,7 +1663,7 @@ static int cf_check cpu_callback(
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index f68e31b643..3e93bdd8da 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -757,7 +757,7 @@ static int cf_check cpu_callback(
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index 28a605a5cb..301533722d 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -951,7 +951,7 @@ static int cf_check cpu_callback(
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index ffdc6fb2fc..9e981e7e26 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -1537,7 +1537,7 @@ static int cf_check mwait_idle_cpu_init(
 		dev = processor_powers[cpu];
 		if (!rc && cpuidle_current_governor->enable)
 			rc = cpuidle_current_governor->enable(dev);
-		return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+		return notifier_from_errno(rc);
 
 	case CPU_ONLINE:
 		if (!dev)
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 7dfc793514..f73390cdb0 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -221,7 +221,7 @@ static int cf_check update_clusterinfo(
         break;
     }
 
-    return !err ? NOTIFY_DONE : notifier_from_errno(err);
+    return notifier_from_errno(err);
 }
 
 static struct notifier_block x2apic_cpu_nfb = {
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index ae4368ec4b..02f5f3b359 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -139,7 +139,7 @@ static int cf_check cpu_callback(
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/arch/x86/percpu.c b/xen/arch/x86/percpu.c
index 46460689b7..288050cdba 100644
--- a/xen/arch/x86/percpu.c
+++ b/xen/arch/x86/percpu.c
@@ -86,7 +86,7 @@ static int cf_check cpu_percpu_callback(
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_percpu_nfb = {
diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index ccb761998f..a1e0af27c5 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -1663,7 +1663,7 @@ static int cf_check cpu_callback(
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index b46fd9ab18..a238aa1f14 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1144,7 +1144,7 @@ static int cf_check cpu_smpboot_callback(
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_smpboot_nfb = {
diff --git a/xen/common/cpu.c b/xen/common/cpu.c
index 778b6820b7..8709db4d29 100644
--- a/xen/common/cpu.c
+++ b/xen/common/cpu.c
@@ -82,7 +82,7 @@ static int cpu_notifier_call_chain(unsigned int cpu, unsigned long action,
 {
     void *hcpu = (void *)(long)cpu;
     int notifier_rc = notifier_call_chain(&cpu_chain, action, hcpu, nb);
-    int ret = (notifier_rc == NOTIFY_DONE) ? 0 : notifier_to_errno(notifier_rc);
+    int ret =  notifier_to_errno(notifier_rc);
 
     BUG_ON(ret && nofail);
 
diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 43132ff6e0..022f548652 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -2903,7 +2903,7 @@ static int cf_check cpu_schedule_callback(
 
     rcu_read_unlock(&sched_res_rculock);
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_schedule_nfb = {
diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c
index bdf6030ab0..2e094b0cfa 100644
--- a/xen/common/sched/cpupool.c
+++ b/xen/common/sched/cpupool.c
@@ -1074,7 +1074,7 @@ static int cf_check cpu_callback(
         break;
     }
 
-    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
+    return notifier_from_errno(rc);
 }
 
 static struct notifier_block cpu_nfb = {
diff --git a/xen/include/xen/notifier.h b/xen/include/xen/notifier.h
index 0921213298..3d6017d4f7 100644
--- a/xen/include/xen/notifier.h
+++ b/xen/include/xen/notifier.h
@@ -58,13 +58,13 @@ int notifier_call_chain(
 /* Encapsulate (negative) errno value. */
 static inline int notifier_from_errno(int err)
 {
-    return NOTIFY_STOP_MASK | -err;
+    return err ? (NOTIFY_STOP_MASK | -err) : NOTIFY_DONE;
 }
 
 /* Restore (negative) errno value from notify return value. */
 static inline int notifier_to_errno(int ret)
 {
-    return -(ret & ~NOTIFY_STOP_MASK);
+    return (ret == NOTIFY_DONE) ? 0 : -(ret & ~NOTIFY_STOP_MASK);
 }
 
 #endif /* __XEN_NOTIFIER_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:06:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:06:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452567.710416 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RHn-0005Me-AM; Sat, 03 Dec 2022 12:06:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452567.710416; Sat, 03 Dec 2022 12:06: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 1p1RHn-0005MX-7a; Sat, 03 Dec 2022 12:06:27 +0000
Received: by outflank-mailman (input) for mailman id 452567;
 Sat, 03 Dec 2022 12:06:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHm-0005MO-4t
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHm-0008En-4F
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHm-0002rQ-3L
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IlBZKYRq0unUp//RL2NfNEOWBFqrssVT+/HFBftlu38=; b=UwcyUwLiGhRxSCjDd17CdhQA+j
	Guzzy2RnXELk7wSLLMa9cjTQ8NGgb2ReBe7EyFEJnFae1nRONoB23M6Uc+xouy6bn06L03eY4bg9T
	04Z0mo5E4F4OmE+li9LvTwc1wOoxDXX0149a/m8hqBSFyl0aE0krTBHr3ccyOz/9aszs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/irq: do not release irq until all cleanup is done
Message-Id: <E1p1RHm-0002rQ-3L@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:06:26 +0000

commit e267d11969a40f0aec33dbf966f5a6490b205f43
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Dec 2 10:32:21 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:32:21 2022 +0100

    x86/irq: do not release irq until all cleanup is done
    
    Current code in _clear_irq_vector() will mark the irq as unused before
    doing the cleanup required when move_in_progress is true.
    
    This can lead to races in create_irq() if the function picks an irq
    desc that's been marked as unused but has move_in_progress set, as the
    call to assign_irq_vector() in that function can then fail with
    -EAGAIN.
    
    Prevent that by only marking irq descs as unused when all the cleanup
    has been done.  While there also use write_atomic() when setting
    IRQ_UNUSED in _clear_irq_vector() and add a barrier in order to
    prevent the setting of IRQ_UNUSED getting reordered by the compiler.
    
    The check for move_in_progress cannot be removed from
    _assign_irq_vector(), as other users (io_apic_set_pci_routing() and
    ioapic_guest_write()) can still pass active irq descs to
    assign_irq_vector().
    
    Note the trace point is not moved and is now set before the irq is
    marked as unused.  This is done so that the CPU mask provided in the
    trace point is the one belonging to the current vector, not the old
    one.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/irq.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index cd0c8a30a8..20150b1c7f 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -220,27 +220,28 @@ static void _clear_irq_vector(struct irq_desc *desc)
         clear_bit(vector, desc->arch.used_vectors);
     }
 
-    desc->arch.used = IRQ_UNUSED;
-
     trace_irq_mask(TRC_HW_IRQ_CLEAR_VECTOR, irq, vector, tmp_mask);
 
-    if ( likely(!desc->arch.move_in_progress) )
-        return;
+    if ( unlikely(desc->arch.move_in_progress) )
+    {
+        /* If we were in motion, also clear desc->arch.old_vector */
+        old_vector = desc->arch.old_vector;
+        cpumask_and(tmp_mask, desc->arch.old_cpu_mask, &cpu_online_map);
 
-    /* If we were in motion, also clear desc->arch.old_vector */
-    old_vector = desc->arch.old_vector;
-    cpumask_and(tmp_mask, desc->arch.old_cpu_mask, &cpu_online_map);
+        for_each_cpu(cpu, tmp_mask)
+        {
+            ASSERT(per_cpu(vector_irq, cpu)[old_vector] == irq);
+            TRACE_3D(TRC_HW_IRQ_MOVE_FINISH, irq, old_vector, cpu);
+            per_cpu(vector_irq, cpu)[old_vector] = ~irq;
+        }
 
-    for_each_cpu(cpu, tmp_mask)
-    {
-        ASSERT(per_cpu(vector_irq, cpu)[old_vector] == irq);
-        TRACE_3D(TRC_HW_IRQ_MOVE_FINISH, irq, old_vector, cpu);
-        per_cpu(vector_irq, cpu)[old_vector] = ~irq;
-    }
+        release_old_vec(desc);
 
-    release_old_vec(desc);
+        desc->arch.move_in_progress = 0;
+    }
 
-    desc->arch.move_in_progress = 0;
+    smp_wmb();
+    write_atomic(&desc->arch.used, IRQ_UNUSED);
 }
 
 void __init clear_irq_vector(int irq)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:06:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:06:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452569.710421 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RHx-0005Q1-EP; Sat, 03 Dec 2022 12:06:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452569.710421; Sat, 03 Dec 2022 12:06: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 1p1RHx-0005Pt-Bd; Sat, 03 Dec 2022 12:06:37 +0000
Received: by outflank-mailman (input) for mailman id 452569;
 Sat, 03 Dec 2022 12:06:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHw-0005Pi-87
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHw-0008Er-7Q
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RHw-0002s8-6a
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Nl/dSUEgyz/Mnbhen/G5JFuBRMqrzxMOb5b2piDPR0Q=; b=ZuheEaagnZSOfHK2rIZbtf08Qw
	PEHJrautuTudeCMxVnUzKIZhlNHS/YBybA5tqlkHKgYiWIyBVY1K+S2scfOlqrAnpOvZQKeDNIVri
	Qfd5Wwv5D8VBaYOVTeSPn8gC8tTWydLvzo4p+Be5BeEaXmRuH1oozcpsi6flWpBEP83w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pvh: do not forward MADT Local APIC NMI structures to dom0
Message-Id: <E1p1RHw-0002s8-6a@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:06:36 +0000

commit b39e6385250ccef9509af0eab9003ad5c1478842
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Dec 2 10:33:40 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:33:40 2022 +0100

    x86/pvh: do not forward MADT Local APIC NMI structures to dom0
    
    Currently Xen will passthrough any Local APIC NMI Structure found in
    the native ACPI MADT table to a PVH dom0.  This is wrong because PVH
    doesn't have access to the physical local APIC, and instead gets an
    emulated local APIC by Xen, that doesn't have the LINT0 or LINT1
    pins wired to anything.  Furthermore the ACPI Processor UIDs used in
    the APIC NMI Structures are likely to not match the ones generated by
    Xen for the Local x2APIC Structures, creating confusion to dom0.
    
    Fix this by removing the logic to passthrough the Local APIC NMI
    Structure for PVH dom0.
    
    Fixes: 1d74282c45 ('x86: setup PVHv2 Dom0 ACPI tables')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/dom0_build.c | 34 +---------------------------------
 1 file changed, 1 insertion(+), 33 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 1864d048a1..3ac6b7b423 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -58,9 +58,6 @@
 static unsigned int __initdata acpi_intr_overrides;
 static struct acpi_madt_interrupt_override __initdata *intsrcovr;
 
-static unsigned int __initdata acpi_nmi_sources;
-static struct acpi_madt_nmi_source __initdata *nmisrc;
-
 static unsigned int __initdata order_stats[MAX_ORDER + 1];
 
 static void __init print_order_stats(const struct domain *d)
@@ -763,25 +760,6 @@ static int __init cf_check acpi_set_intr_ovr(
     return 0;
 }
 
-static int __init cf_check acpi_count_nmi_src(
-    struct acpi_subtable_header *header, const unsigned long end)
-{
-    acpi_nmi_sources++;
-    return 0;
-}
-
-static int __init cf_check acpi_set_nmi_src(
-    struct acpi_subtable_header *header, const unsigned long end)
-{
-    const struct acpi_madt_nmi_source *src =
-        container_of(header, struct acpi_madt_nmi_source, header);
-
-    *nmisrc = *src;
-    nmisrc++;
-
-    return 0;
-}
-
 static int __init pvh_setup_acpi_madt(struct domain *d, paddr_t *addr)
 {
     struct acpi_table_madt *madt;
@@ -797,16 +775,11 @@ static int __init pvh_setup_acpi_madt(struct domain *d, paddr_t *addr)
     acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE,
                           acpi_count_intr_ovr, UINT_MAX);
 
-    /* Count number of NMI sources in the MADT. */
-    acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_count_nmi_src,
-                          UINT_MAX);
-
     max_vcpus = dom0_max_vcpus();
     /* Calculate the size of the crafted MADT. */
     size = sizeof(*madt);
     size += sizeof(*io_apic) * nr_ioapics;
     size += sizeof(*intsrcovr) * acpi_intr_overrides;
-    size += sizeof(*nmisrc) * acpi_nmi_sources;
     size += sizeof(*x2apic) * max_vcpus;
 
     madt = xzalloc_bytes(size);
@@ -862,12 +835,7 @@ static int __init pvh_setup_acpi_madt(struct domain *d, paddr_t *addr)
     acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_set_intr_ovr,
                           acpi_intr_overrides);
 
-    /* Setup NMI sources. */
-    nmisrc = (void *)intsrcovr;
-    acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_set_nmi_src,
-                          acpi_nmi_sources);
-
-    ASSERT(((void *)nmisrc - (void *)madt) == size);
+    ASSERT(((void *)intsrcovr - (void *)madt) == size);
     madt->header.length = size;
     /*
      * Calling acpi_tb_checksum here is a layering violation, but
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:06:47 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:06:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452570.710427 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RI7-0005Sg-Gh; Sat, 03 Dec 2022 12:06:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452570.710427; Sat, 03 Dec 2022 12:06: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 1p1RI7-0005SY-DD; Sat, 03 Dec 2022 12:06:47 +0000
Received: by outflank-mailman (input) for mailman id 452570;
 Sat, 03 Dec 2022 12:06:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RI6-0005SO-B5
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RI6-0008FH-AR
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RI6-0002sw-9h
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2RvyqTQz1D7MfdCzH7OVWwtN3ctviqWs+a2GTIjkoCM=; b=lKbf96R8gkrrb8dks7XU33Kr2d
	IygadXqbA4uV6YuX7u6kZwSx5msze5nAgYXzqoI5eyjgX/VRw+BTINgDKZPSyF8sOQOmxZqFRYvb9
	FwSO3Orzsx7Kk33jgFqDO5mmuCNiWW9UEomcCWLtzTTyVcCxbgmpUr4QCDzHm2NIvY5w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: don't mark external IRQs as pending when vLAPIC is disabled
Message-Id: <E1p1RI6-0002sw-9h@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:06:46 +0000

commit f1d7aac1e3c3cd164e17d41791a575a5c3e87121
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Dec 2 10:35:01 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:35:01 2022 +0100

    x86/HVM: don't mark external IRQs as pending when vLAPIC is disabled
    
    In software-disabled state an LAPIC does not accept any interrupt
    requests and hence no IRR bit would newly become set while in this
    state. As a result it is also wrong for us to mark IO-APIC or MSI
    originating vectors as having a pending request when the vLAPIC is in
    this state. Such interrupts are simply lost.
    
    Introduce (IO-APIC) or re-use (MSI) a local variable to help
    readability.
    
    Fixes: 4fe21ad3712e ("This patch add virtual IOAPIC support for VMX guest")
    Fixes: 85715f4bc7c9 ("MSI 5/6: add MSI support to passthrough HVM domain")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vioapic.c |  9 +++++++--
 xen/arch/x86/hvm/vmsi.c    | 10 ++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index cb7f440160..41e3c4d5e4 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -460,9 +460,14 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
 
     case dest_Fixed:
         for_each_vcpu ( d, v )
-            if ( vlapic_match_dest(vcpu_vlapic(v), NULL, 0, dest, dest_mode) )
-                ioapic_inj_irq(vioapic, vcpu_vlapic(v), vector, trig_mode,
+        {
+            struct vlapic *vlapic = vcpu_vlapic(v);
+
+            if ( vlapic_enabled(vlapic) &&
+                 vlapic_match_dest(vlapic, NULL, 0, dest, dest_mode) )
+                ioapic_inj_irq(vioapic, vlapic, vector, trig_mode,
                                delivery_mode);
+        }
         break;
 
     case dest_NMI:
diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index 75f92885dc..3cd4923060 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -87,10 +87,12 @@ int vmsi_deliver(
 
     case dest_Fixed:
         for_each_vcpu ( d, v )
-            if ( vlapic_match_dest(vcpu_vlapic(v), NULL,
-                                   0, dest, dest_mode) )
-                vmsi_inj_irq(vcpu_vlapic(v), vector,
-                             trig_mode, delivery_mode);
+        {
+            target = vcpu_vlapic(v);
+            if ( vlapic_enabled(target) &&
+                 vlapic_match_dest(target, NULL, 0, dest, dest_mode) )
+                vmsi_inj_irq(target, vector, trig_mode, delivery_mode);
+        }
         break;
 
     default:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:06:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:06:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452573.710429 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RIH-0005Vt-HU; Sat, 03 Dec 2022 12:06:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452573.710429; Sat, 03 Dec 2022 12:06: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 1p1RIH-0005Vl-El; Sat, 03 Dec 2022 12:06:57 +0000
Received: by outflank-mailman (input) for mailman id 452573;
 Sat, 03 Dec 2022 12:06:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIG-0005VS-Dy
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIG-0008FU-DM
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIG-0002tl-Cc
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wU4z2GdMtvLZ+0/V0Cj+1zBN7/I3AEYCoJ22jo3DgRQ=; b=Zeb7Le0MMThpue+/EjVHS0nDij
	B75TdEc4mdBj/8MbLJT0iixDJcLj00rEetRc3zx0dOH7o+ReQEx2qMz2X5W+0DY7flU4Ijd4XgLbw
	Ar+iMVBMdT9Rn4MJ1W6fQmdvF7h2GhMjJAttqLlgnpKo68RWSHISNFuMlrpbwLOynZqc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/Viridian: don't mark IRQ vectors as pending when vLAPIC is disabled
Message-Id: <E1p1RIG-0002tl-Cc@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:06:56 +0000

commit 831419f82913417dee4e5b0f80769c5db590540b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Dec 2 10:35:32 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:35:32 2022 +0100

    x86/Viridian: don't mark IRQ vectors as pending when vLAPIC is disabled
    
    In software-disabled state an LAPIC does not accept any interrupt
    requests and hence no IRR bit would newly become set while in this
    state. As a result it is also wrong for us to mark Viridian IPI or timer
    vectors as having a pending request when the vLAPIC is in this state.
    Such interrupts are simply lost.
    
    Introduce a local variable in send_ipi() to help readability.
    
    Fixes: fda96b7382ea ("viridian: add implementation of the HvSendSyntheticClusterIpi hypercall")
    Fixes: 26fba3c85571 ("viridian: add implementation of synthetic timers")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/viridian/synic.c    | 2 +-
 xen/arch/x86/hvm/viridian/viridian.c | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index e18538c60a..856bb898b8 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -359,7 +359,7 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
     BUILD_BUG_ON(sizeof(payload) > sizeof(msg->u.payload));
     memcpy(msg->u.payload, &payload, sizeof(payload));
 
-    if ( !vs->masked )
+    if ( !vs->masked && vlapic_enabled(vcpu_vlapic(v)) )
         vlapic_set_irq(vcpu_vlapic(v), vs->vector, 0);
 
     return true;
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 25dca93e8b..2937ddd3a8 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -811,7 +811,12 @@ static void send_ipi(struct hypercall_vpmask *vpmask, uint8_t vector)
         cpu_raise_softirq_batch_begin();
 
     for_each_vp ( vpmask, vp )
-        vlapic_set_irq(vcpu_vlapic(currd->vcpu[vp]), vector, 0);
+    {
+        struct vlapic *vlapic = vcpu_vlapic(currd->vcpu[vp]);
+
+        if ( vlapic_enabled(vlapic) )
+            vlapic_set_irq(vlapic, vector, 0);
+    }
 
     if ( nr > 1 )
         cpu_raise_softirq_batch_finish();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:07:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:07:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452575.710432 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RIR-0005YR-Iy; Sat, 03 Dec 2022 12:07:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452575.710432; Sat, 03 Dec 2022 12:07: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 1p1RIR-0005YK-GK; Sat, 03 Dec 2022 12:07:07 +0000
Received: by outflank-mailman (input) for mailman id 452575;
 Sat, 03 Dec 2022 12:07:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIQ-0005YB-H4
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIQ-0008Fr-GN
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIQ-0002uh-Fa
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xzmCiQToCgRgaSouYmJD+ZB1Cre8nNGqq20Ogqk0x2A=; b=mZaVDnqbpNMvXp2tiXHUzTyzSt
	UyOmOEchR4+NjQfW70NVUf4aocxgd0GoQdlJSHgWJCR/AkkzTL9Ut+FFc9yt+SGR35kifYiEA1/YX
	rXOJAJ2Q6vCMXzR09VzcrRdrs1Pgi4mR/2mEC/KdAqDSth6uLDksvyTLzDtyYDSHbUbU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/APIC: make a few interrupt handler functions static
Message-Id: <E1p1RIQ-0002uh-Fa@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:07:06 +0000

commit a93864955e4781ba05e76c95851c6c1d08be80d5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Dec 2 10:39:22 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:39:22 2022 +0100

    x86/APIC: make a few interrupt handler functions static
    
    Four of them are used in apic.c only and hence better wouldn't be
    exposed to other CUs. To avoid the need for forward declarations, move
    apic_intr_init() past the four handlers.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/apic.c            | 38 +++++++++++++++++++-------------------
 xen/arch/x86/include/asm/irq.h |  4 ----
 2 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 47e6e5fe41..f71474d47d 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -127,21 +127,6 @@ void ack_bad_irq(unsigned int irq)
         ack_APIC_irq();
 }
 
-void __init apic_intr_init(void)
-{
-    smp_intr_init();
-
-    /* self generated IPI for local APIC timer */
-    set_direct_apic_vector(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
-
-    /* IPI vectors for APIC spurious and error interrupts */
-    set_direct_apic_vector(SPURIOUS_APIC_VECTOR, spurious_interrupt);
-    set_direct_apic_vector(ERROR_APIC_VECTOR, error_interrupt);
-
-    /* Performance Counters Interrupt */
-    set_direct_apic_vector(PMU_APIC_VECTOR, pmu_apic_interrupt);
-}
-
 /* Using APIC to generate smp_local_timer_interrupt? */
 static bool __read_mostly using_apic_timer;
 
@@ -1363,7 +1348,7 @@ int reprogram_timer(s_time_t timeout)
     return apic_tmict || !timeout;
 }
 
-void cf_check apic_timer_interrupt(struct cpu_user_regs *regs)
+static void cf_check apic_timer_interrupt(struct cpu_user_regs *regs)
 {
     ack_APIC_irq();
     perfc_incr(apic_timer);
@@ -1382,7 +1367,7 @@ void smp_send_state_dump(unsigned int cpu)
 /*
  * Spurious interrupts should _never_ happen with our APIC/SMP architecture.
  */
-void cf_check spurious_interrupt(struct cpu_user_regs *regs)
+static void cf_check spurious_interrupt(struct cpu_user_regs *regs)
 {
     /*
      * Check if this is a vectored interrupt (most likely, as this is probably
@@ -1413,7 +1398,7 @@ void cf_check spurious_interrupt(struct cpu_user_regs *regs)
  * This interrupt should never happen with our APIC/SMP architecture
  */
 
-void cf_check error_interrupt(struct cpu_user_regs *regs)
+static void cf_check error_interrupt(struct cpu_user_regs *regs)
 {
     static const char *const esr_fields[] = {
         "Send CS error",
@@ -1446,12 +1431,27 @@ void cf_check error_interrupt(struct cpu_user_regs *regs)
  * This interrupt handles performance counters interrupt
  */
 
-void cf_check pmu_apic_interrupt(struct cpu_user_regs *regs)
+static void cf_check pmu_interrupt(struct cpu_user_regs *regs)
 {
     ack_APIC_irq();
     vpmu_do_interrupt(regs);
 }
 
+void __init apic_intr_init(void)
+{
+    smp_intr_init();
+
+    /* self generated IPI for local APIC timer */
+    set_direct_apic_vector(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
+
+    /* IPI vectors for APIC spurious and error interrupts */
+    set_direct_apic_vector(SPURIOUS_APIC_VECTOR, spurious_interrupt);
+    set_direct_apic_vector(ERROR_APIC_VECTOR, error_interrupt);
+
+    /* Performance Counters Interrupt */
+    set_direct_apic_vector(PMU_APIC_VECTOR, pmu_interrupt);
+}
+
 /*
  * This initializes the IO-APIC and APIC hardware if this is
  * a UP kernel.
diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index 76e6ed6d60..424b0e1af8 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -96,10 +96,6 @@ static inline struct cpu_user_regs *set_irq_regs(struct cpu_user_regs *new_regs)
 void cf_check event_check_interrupt(struct cpu_user_regs *regs);
 void cf_check invalidate_interrupt(struct cpu_user_regs *regs);
 void cf_check call_function_interrupt(struct cpu_user_regs *regs);
-void cf_check apic_timer_interrupt(struct cpu_user_regs *regs);
-void cf_check error_interrupt(struct cpu_user_regs *regs);
-void cf_check pmu_apic_interrupt(struct cpu_user_regs *regs);
-void cf_check spurious_interrupt(struct cpu_user_regs *regs);
 void cf_check irq_move_cleanup_interrupt(struct cpu_user_regs *regs);
 
 uint8_t alloc_hipriority_vector(void);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:07:17 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:07:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452577.710437 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RIb-0005cQ-KU; Sat, 03 Dec 2022 12:07:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452577.710437; Sat, 03 Dec 2022 12:07: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 1p1RIb-0005cI-Hw; Sat, 03 Dec 2022 12:07:17 +0000
Received: by outflank-mailman (input) for mailman id 452577;
 Sat, 03 Dec 2022 12:07:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIa-0005c8-K2
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIa-0008G2-JM
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIa-0002xC-IW
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q4LUNbfQboaABkJQuURU0oL6hYekCn8Awl/62NkQiLI=; b=y1SwSdiAbgYfswu4F0OUmaGkvp
	+RcXL//45t3cr9JtyBDVtR8Krue29aP3vZtzW6ivdQET63rorQuguvA3R4GRaZfRabD0ER2a3+Uh0
	EhAbYzJiLcKefAHi2LkGXjK9NQQ4/rwoHU85wk4OHFOq21lljnUlJYAYCGWEj48hO2X4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM+shim: fix build when !CONFIG_GRANT_TABLE
Message-Id: <E1p1RIa-0002xC-IW@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:07:16 +0000

commit 133f35f0f0cd0a415e599c20156aaaa5598356c0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Dec 2 10:40:11 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Dec 2 10:40:11 2022 +0100

    x86/HVM+shim: fix build when !CONFIG_GRANT_TABLE
    
    The HVM flavor of the hypercall handlers exists only when GRANT_TABLE is
    enabled, while surrogate shim variants exist only for the purpose of PV.
    (Also scratch out the Arm variant in that case; what exactly is used in
    that cell of the new table row doesn't really matter.)
    
    Fixes: 8523851dbc49 ("xen/x86: call hypercall handlers via generated macro")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/hypercall-defs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index 45b6f969d2..1896121074 100644
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -241,8 +241,10 @@ event_channel_op_compat            do       do       -        -        dep
 xen_version                        compat   do       compat   do       do
 console_io                         do       do       do       do       do
 physdev_op_compat                  compat   do       -        -        dep
-#if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM)
+#if defined(CONFIG_GRANT_TABLE)
 grant_table_op                     compat   do       hvm      hvm      do
+#elif defined(CONFIG_PV_SHIM)
+grant_table_op                     compat   do       -        -        -
 #endif
 vm_assist                          do       do       do       do       do
 update_va_mapping_otherdomain      compat   do       -        -        -
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:07:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:07:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452578.710441 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RIl-0005fF-MA; Sat, 03 Dec 2022 12:07:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452578.710441; Sat, 03 Dec 2022 12:07: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 1p1RIl-0005f7-JP; Sat, 03 Dec 2022 12:07:27 +0000
Received: by outflank-mailman (input) for mailman id 452578;
 Sat, 03 Dec 2022 12:07:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIk-0005f1-N6
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIk-0008GC-MQ
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIk-0002xz-LW
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=govryo+MZ8NHR1BHuudCK5azo78ICBBiYuye5OOu98k=; b=iEmHtnH1ptdtcT36chGZkPJHU3
	zJKQu1oAJk2oYmx3pfauBq2qVPUDrXF8FxzLxLrZcNYPdzx2x61iPbLspHe71/QXaQgvCjm5LjELc
	a35E6xU5gbrsqZS2LielE+sRzCkiIB0vmYr1DphWKJpxVhG/mySYdx0/ksvgQO0l+W+s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Render backtraces more nicely in Syslog
Message-Id: <E1p1RIk-0002xz-LW@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:07:26 +0000

commit d2162d884cba0ff7b2ac0d832f4e044444bda2e1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Dec 1 21:06:25 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 2 13:41:04 2022 +0000

    tools/oxenstored: Render backtraces more nicely in Syslog
    
    fallback_exception_handler feeds a string with embedded newlines directly into
    syslog().  While this is an improvement on getting nothing, syslogd escapes
    all control characters it gets, and emits one (long) log line.
    
    Fix the problem generally in the syslog stub.  As we already have a local copy
    of the string, split it in place and emit one syslog() call per line.
    
    Also tweak Logging.msg_of to avoid putting an extra newline on a string which
    already ends with one.
    
    Fixes: ee7815f49faf ("tools/oxenstored: Set uncaught exception handler")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/logging.ml     |  2 +-
 tools/ocaml/xenstored/syslog_stubs.c | 26 +++++++++++++++++++++++---
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml
index 255051437d..f233bc9a39 100644
--- a/tools/ocaml/xenstored/logging.ml
+++ b/tools/ocaml/xenstored/logging.ml
@@ -344,7 +344,7 @@ let watch_not_fired ~con perms path =
 	access_logging ~tid:0 ~con ~data Watch_not_fired ~level:Info
 
 let msg_of exn bt =
-	Printf.sprintf "Fatal exception: %s\n%s\n" (Printexc.to_string exn)
+	Printf.sprintf "Fatal exception: %s\n%s" (Printexc.to_string exn)
 		(Printexc.raw_backtrace_to_string bt)
 
 let fallback_exception_handler exn bt =
diff --git a/tools/ocaml/xenstored/syslog_stubs.c b/tools/ocaml/xenstored/syslog_stubs.c
index e16c3a9491..760e78ff73 100644
--- a/tools/ocaml/xenstored/syslog_stubs.c
+++ b/tools/ocaml/xenstored/syslog_stubs.c
@@ -37,14 +37,34 @@ value stub_syslog(value facility, value level, value msg)
 {
 	CAMLparam3(facility, level, msg);
 	char *c_msg = strdup(String_val(msg));
+	char *s = c_msg, *ss;
 	int c_facility = __syslog_facility_table[Int_val(facility)]
 	               | __syslog_level_table[Int_val(level)];
 
 	if ( !c_msg )
 		caml_raise_out_of_memory();
-	caml_enter_blocking_section();
-	syslog(c_facility, "%s", c_msg);
-	caml_leave_blocking_section();
+
+	/*
+	 * syslog() doesn't like embedded newlines, and c_msg generally
+	 * contains them.
+	 *
+	 * Split the message in place by converting \n to \0, and issue one
+	 * syslog() call per line, skipping the final iteration if c_msg ends
+	 * with a newline anyway.
+	 */
+	do {
+		ss = strchr(s, '\n');
+		if ( ss )
+			*ss = '\0';
+		else if ( *s == '\0' )
+			break;
+
+		caml_enter_blocking_section();
+		syslog(c_facility, "%s", s);
+		caml_leave_blocking_section();
+
+		s = ss + 1;
+	} while ( ss );
 
 	free(c_msg);
 	CAMLreturn(Val_unit);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:07:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:07:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452581.710446 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RIv-0005ij-Pb; Sat, 03 Dec 2022 12:07:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452581.710446; Sat, 03 Dec 2022 12:07: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 1p1RIv-0005ia-MQ; Sat, 03 Dec 2022 12:07:37 +0000
Received: by outflank-mailman (input) for mailman id 452581;
 Sat, 03 Dec 2022 12:07:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIu-0005iO-QA
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIu-0008GG-PW
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RIu-0002ym-Oj
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QEJnDgCWn0RkH8cpJvkRAyxcVruOWHysWkkuTp3kDKQ=; b=StMQL0q6Ok3Tj/9Y1yK5zsm0Ul
	aMasXk7yNYFbi/Y9ufZ9rQAnL4EtSF+pIhlJ6hDNT65d+yssqTWrTRkRxyYjrW8tpbTt3f+M+fNoc
	DFzTdM4Tskc9nHLMp/qZ6IOjtchIkzIH5Z1gZaNsx2APr8KeQBt/xeOLL3w+8l3hz/gM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/xenctrl: Add binding for xc_evtchn_status
Message-Id: <E1p1RIu-0002ym-Oj@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:07:36 +0000

commit ff95dae53e5e41d9a428143e0cb14b4467c123fd
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Dec 2 10:55:57 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 2 13:41:04 2022 +0000

    tools/ocaml/xenctrl: Add binding for xc_evtchn_status
    
    There is no API or ioctl to query event channel status, it is only
    present in xenctrl.h
    
    The C union is mapped to an OCaml variant exposing just the value from
    the correct union tag.  This causes the xc bindings to now depend on
    evtchn to get a useful API for EVTCHNSTAT_virq.
    
    The information provided here is similar to 'lsevtchn', but rather than
    parsing its output it queries the underlying API directly.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/Makefile           |  2 +-
 tools/ocaml/libs/xc/META.in         |  2 +-
 tools/ocaml/libs/xc/Makefile        |  2 +-
 tools/ocaml/libs/xc/xenctrl.ml      | 15 +++++++++
 tools/ocaml/libs/xc/xenctrl.mli     | 15 +++++++++
 tools/ocaml/libs/xc/xenctrl_stubs.c | 66 +++++++++++++++++++++++++++++++++++++
 6 files changed, 99 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/libs/Makefile b/tools/ocaml/libs/Makefile
index 7e7c27e2d5..5146c52484 100644
--- a/tools/ocaml/libs/Makefile
+++ b/tools/ocaml/libs/Makefile
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 SUBDIRS= \
 	mmap \
 	xentoollog \
-	xc eventchn \
+	eventchn xc \
 	xb xs xl
 
 .PHONY: all
diff --git a/tools/ocaml/libs/xc/META.in b/tools/ocaml/libs/xc/META.in
index 2ff4dcb6bf..6a273936a3 100644
--- a/tools/ocaml/libs/xc/META.in
+++ b/tools/ocaml/libs/xc/META.in
@@ -1,5 +1,5 @@
 version = "@VERSION@"
 description = "Xen Control Interface"
-requires = "unix,xenmmap"
+requires = "unix,xenmmap,xeneventchn"
 archive(byte) = "xenctrl.cma"
 archive(native) = "xenctrl.cmxa"
diff --git a/tools/ocaml/libs/xc/Makefile b/tools/ocaml/libs/xc/Makefile
index 3b76e9ad7b..1d9fecb06e 100644
--- a/tools/ocaml/libs/xc/Makefile
+++ b/tools/ocaml/libs/xc/Makefile
@@ -4,7 +4,7 @@ include $(OCAML_TOPLEVEL)/common.make
 
 CFLAGS += -I../mmap $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
 CFLAGS += $(APPEND_CFLAGS)
-OCAMLINCLUDE += -I ../mmap
+OCAMLINCLUDE += -I ../mmap -I ../eventchn
 
 OBJS = xenctrl
 INTF = xenctrl.cmi
diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index 4b74e31c75..b70ab89caa 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -277,6 +277,21 @@ external evtchn_alloc_unbound: handle -> domid -> domid -> int
        = "stub_xc_evtchn_alloc_unbound"
 external evtchn_reset: handle -> domid -> unit = "stub_xc_evtchn_reset"
 
+(* FIFO has theoretical maximum of 2^28 ports, fits in an int *)
+type evtchn_interdomain = { dom: domid; port: int }
+
+type evtchn_stat =
+  | EVTCHNSTAT_unbound of domid
+  | EVTCHNSTAT_interdomain of evtchn_interdomain
+  | EVTCHNSTAT_pirq of int
+  | EVTCHNSTAT_virq of Xeneventchn.virq_t
+  | EVTCHNSTAT_ipi
+
+type evtchn_status = { vcpu: int; status: evtchn_stat }
+
+external evtchn_status: handle -> domid -> int -> evtchn_status option =
+  "stub_xc_evtchn_status"
+
 external readconsolering: handle -> string = "stub_xc_readconsolering"
 
 external send_debug_keys: handle -> string -> unit = "stub_xc_send_debug_keys"
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index ddfe84dc22..f6a777ede6 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -205,6 +205,21 @@ external shadow_allocation_get : handle -> domid -> int
 external evtchn_alloc_unbound : handle -> domid -> domid -> int
   = "stub_xc_evtchn_alloc_unbound"
 external evtchn_reset : handle -> domid -> unit = "stub_xc_evtchn_reset"
+
+type evtchn_interdomain = { dom: domid; port: int }
+
+type evtchn_stat =
+  | EVTCHNSTAT_unbound of domid
+  | EVTCHNSTAT_interdomain of evtchn_interdomain
+  | EVTCHNSTAT_pirq of int
+  | EVTCHNSTAT_virq of Xeneventchn.virq_t
+  | EVTCHNSTAT_ipi
+
+type evtchn_status = { vcpu: int; status: evtchn_stat }
+
+external evtchn_status: handle -> domid -> int -> evtchn_status option =
+  "stub_xc_evtchn_status"
+
 external readconsolering : handle -> string = "stub_xc_readconsolering"
 external send_debug_keys : handle -> string -> unit = "stub_xc_send_debug_keys"
 external physinfo : handle -> physinfo = "stub_xc_physinfo"
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 4e12040854..9cbf17103d 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -44,6 +44,10 @@
 #define Val_none (Val_int(0))
 #endif
 
+#ifndef Tag_some
+#define Tag_some 0
+#endif
+
 static void stub_xenctrl_finalize(value v)
 {
 	xc_interface_close(_H(v));
@@ -649,6 +653,68 @@ CAMLprim value stub_xc_evtchn_reset(value xch, value domid)
 	CAMLreturn(Val_unit);
 }
 
+CAMLprim value stub_xc_evtchn_status(value xch, value domid, value port)
+{
+	CAMLparam3(xch, domid, port);
+	CAMLlocal4(result, result_status, stat, interdomain);
+	xc_evtchn_status_t status = {
+		.dom = _D(domid),
+		.port = Int_val(port),
+	};
+	int rc;
+
+	caml_enter_blocking_section();
+	rc = xc_evtchn_status(_H(xch), &status);
+	caml_leave_blocking_section();
+
+	if ( rc < 0 )
+		failwith_xc(_H(xch));
+
+	switch ( status.status )
+	{
+	case EVTCHNSTAT_closed:
+		CAMLreturn(Val_none); /* Early exit, no allocations needed */
+
+	case EVTCHNSTAT_unbound:
+		stat = caml_alloc(1, 0); /* 1st non-constant constructor */
+		Store_field(stat, 0, Val_int(status.u.unbound.dom));
+		break;
+
+	case EVTCHNSTAT_interdomain:
+		interdomain = caml_alloc_tuple(2);
+		Store_field(interdomain, 0, Val_int(status.u.interdomain.dom));
+		Store_field(interdomain, 1, Val_int(status.u.interdomain.port));
+		stat = caml_alloc(1, 1); /*  2nd non-constant constructor */
+		Store_field(stat, 0, interdomain);
+		break;
+
+	case EVTCHNSTAT_pirq:
+		stat = caml_alloc(1, 2); /* 3rd non-constant constructor */
+		Store_field(stat, 0, Val_int(status.u.pirq));
+		break;
+
+	case EVTCHNSTAT_virq:
+		stat = caml_alloc(1, 3); /* 4th non-constant constructor */
+		Store_field(stat, 0, Val_int(status.u.virq));
+		break;
+
+	case EVTCHNSTAT_ipi:
+		stat = Val_int(0); /* 1st constant constructor */
+		break;
+
+	default:
+		caml_failwith("Unknown evtchn status");
+	}
+
+	result_status = caml_alloc_tuple(2);
+	Store_field(result_status, 0, Val_int(status.vcpu));
+	Store_field(result_status, 1, stat);
+
+	result = caml_alloc_small(1, Tag_some);
+	Store_field(result, 0, result_status);
+
+	CAMLreturn(result);
+}
 
 CAMLprim value stub_xc_readconsolering(value xch)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 03 12:07:47 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Dec 2022 12:07:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452582.710448 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1RJ5-0005lS-Qj; Sat, 03 Dec 2022 12:07:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452582.710448; Sat, 03 Dec 2022 12:07: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 1p1RJ5-0005lI-Nw; Sat, 03 Dec 2022 12:07:47 +0000
Received: by outflank-mailman (input) for mailman id 452582;
 Sat, 03 Dec 2022 12:07:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RJ4-0005l9-T7
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RJ4-0008Gd-SR
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1RJ4-0002zZ-Rf
 for xen-changelog@lists.xenproject.org; Sat, 03 Dec 2022 12:07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7rtyzorCLMI6usJAzrOrb0ff1CzS6rLVPdibtNfHfds=; b=LClWxThOpzVpdXTi/FXUcg/nfW
	UI4EHdV6M+Xm/otl94NYQLqHr2gdm20TI4SGeb4L5JXT4RpRYSy3aSib6GMhLZD+xvzoICtkQoT0n
	LQ3Sjr2gYx5CWB6+VdCGq3DRGRP8CV0spbHzRqohp7FgORP2MSCwGFXNbNmvPo4PrNpo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/xenctrl: Add hvm_param_{get,set} bindings
Message-Id: <E1p1RJ4-0002zZ-Rf@xenbits.xenproject.org>
Date: Sat, 03 Dec 2022 12:07:46 +0000

commit 10acd21795a9df5c0908c58104e82472c5fa2d17
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Dec 2 10:55:58 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 2 13:41:04 2022 +0000

    tools/ocaml/xenctrl: Add hvm_param_{get,set} bindings
    
    Not to be confused which hvm_get_param, which also exists and has a
    different, more error-prone interface.
    
    This one always returns a 64-bit value, and that is retained in the
    OCaml binding as well, returning 'int64' (and not int, or nativeint
    which might have different sizes).
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xc/xenctrl.ml      | 47 ++++++++++++++++++++++++++++++++++++
 tools/ocaml/libs/xc/xenctrl.mli     | 48 +++++++++++++++++++++++++++++++++++++
 tools/ocaml/libs/xc/xenctrl_stubs.c | 31 ++++++++++++++++++++++++
 3 files changed, 126 insertions(+)

diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index b70ab89caa..9a80ae5e28 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -309,6 +309,53 @@ external map_foreign_range: handle -> domid -> int
                          -> nativeint -> Xenmmap.mmap_interface
        = "stub_map_foreign_range"
 
+type hvm_param =
+  | HVM_PARAM_CALLBACK_IRQ
+  | HVM_PARAM_STORE_PFN
+  | HVM_PARAM_STORE_EVTCHN
+  | HVM_PARAM_UNDEF_3
+  | HVM_PARAM_PAE_ENABLED
+  | HVM_PARAM_IOREQ_PFN
+  | HVM_PARAM_BUFIOREQ_PFN
+  | HVM_PARAM_UNDEF_7
+  | HVM_PARAM_UNDEF_8
+  | HVM_PARAM_VIRIDIAN
+  | HVM_PARAM_TIMER_MODE
+  | HVM_PARAM_HPET_ENABLED
+  | HVM_PARAM_IDENT_PT
+  | HVM_PARAM_UNDEF_13
+  | HVM_PARAM_ACPI_S_STATE
+  | HVM_PARAM_VM86_TSS
+  | HVM_PARAM_VPT_ALIGN
+  | HVM_PARAM_CONSOLE_PFN
+  | HVM_PARAM_CONSOLE_EVTCHN
+  | HVM_PARAM_ACPI_IOPORTS_LOCATION
+  | HVM_PARAM_MEMORY_EVENT_CR0
+  | HVM_PARAM_MEMORY_EVENT_CR3
+  | HVM_PARAM_MEMORY_EVENT_CR4
+  | HVM_PARAM_MEMORY_EVENT_INT3
+  | HVM_PARAM_NESTEDHVM
+  | HVM_PARAM_MEMORY_EVENT_SINGLE_STEP
+  | HVM_PARAM_UNDEF_26
+  | HVM_PARAM_PAGING_RING_PFN
+  | HVM_PARAM_MONITOR_RING_PFN
+  | HVM_PARAM_SHARING_RING_PFN
+  | HVM_PARAM_MEMORY_EVENT_MSR
+  | HVM_PARAM_TRIPLE_FAULT_REASON
+  | HVM_PARAM_IOREQ_SERVER_PFN
+  | HVM_PARAM_NR_IOREQ_SERVER_PAGES
+  | HVM_PARAM_VM_GENERATION_ID_ADDR
+  | HVM_PARAM_ALTP2M
+  | HVM_PARAM_X87_FIP_WIDTH
+  | HVM_PARAM_VM86_TSS_SIZED
+  | HVM_PARAM_MCA_CAP
+
+external hvm_param_get: handle -> domid -> hvm_param -> int64
+  = "stub_xc_hvm_param_get"
+
+external hvm_param_set: handle -> domid -> hvm_param -> int64 -> unit
+  = "stub_xc_hvm_param_set"
+
 external domain_assign_device: handle -> domid -> (int * int * int * int) -> unit
        = "stub_xc_domain_assign_device"
 external domain_deassign_device: handle -> domid -> (int * int * int * int) -> unit
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index f6a777ede6..82def5a17c 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -235,6 +235,54 @@ external map_foreign_range :
   handle -> domid -> int -> nativeint -> Xenmmap.mmap_interface
   = "stub_map_foreign_range"
 
+(* needs to be sorted according to its numeric value, watch out for gaps! *)
+type hvm_param =
+  | HVM_PARAM_CALLBACK_IRQ
+  | HVM_PARAM_STORE_PFN
+  | HVM_PARAM_STORE_EVTCHN
+  | HVM_PARAM_UNDEF_3
+  | HVM_PARAM_PAE_ENABLED
+  | HVM_PARAM_IOREQ_PFN
+  | HVM_PARAM_BUFIOREQ_PFN
+  | HVM_PARAM_UNDEF_7
+  | HVM_PARAM_UNDEF_8
+  | HVM_PARAM_VIRIDIAN
+  | HVM_PARAM_TIMER_MODE
+  | HVM_PARAM_HPET_ENABLED
+  | HVM_PARAM_IDENT_PT
+  | HVM_PARAM_UNDEF_13
+  | HVM_PARAM_ACPI_S_STATE
+  | HVM_PARAM_VM86_TSS
+  | HVM_PARAM_VPT_ALIGN
+  | HVM_PARAM_CONSOLE_PFN
+  | HVM_PARAM_CONSOLE_EVTCHN
+  | HVM_PARAM_ACPI_IOPORTS_LOCATION
+  | HVM_PARAM_MEMORY_EVENT_CR0
+  | HVM_PARAM_MEMORY_EVENT_CR3
+  | HVM_PARAM_MEMORY_EVENT_CR4
+  | HVM_PARAM_MEMORY_EVENT_INT3
+  | HVM_PARAM_NESTEDHVM
+  | HVM_PARAM_MEMORY_EVENT_SINGLE_STEP
+  | HVM_PARAM_UNDEF_26
+  | HVM_PARAM_PAGING_RING_PFN
+  | HVM_PARAM_MONITOR_RING_PFN
+  | HVM_PARAM_SHARING_RING_PFN
+  | HVM_PARAM_MEMORY_EVENT_MSR
+  | HVM_PARAM_TRIPLE_FAULT_REASON
+  | HVM_PARAM_IOREQ_SERVER_PFN
+  | HVM_PARAM_NR_IOREQ_SERVER_PAGES
+  | HVM_PARAM_VM_GENERATION_ID_ADDR
+  | HVM_PARAM_ALTP2M
+  | HVM_PARAM_X87_FIP_WIDTH
+  | HVM_PARAM_VM86_TSS_SIZED
+  | HVM_PARAM_MCA_CAP
+
+external hvm_param_get: handle -> domid -> hvm_param -> int64
+  = "stub_xc_hvm_param_get"
+
+external hvm_param_set: handle -> domid -> hvm_param -> int64 -> unit
+  = "stub_xc_hvm_param_set"
+
 external domain_assign_device: handle -> domid -> (int * int * int * int) -> unit
        = "stub_xc_domain_assign_device"
 external domain_deassign_device: handle -> domid -> (int * int * int * int) -> unit
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 9cbf17103d..2fba9c5e94 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -1185,6 +1185,37 @@ CAMLprim value stub_xc_domain_irq_permission(value xch, value domid,
 	CAMLreturn(Val_unit);
 }
 
+CAMLprim value stub_xc_hvm_param_get(value xch, value domid, value param)
+{
+	CAMLparam3(xch, domid, param);
+	uint64_t val;
+	int ret;
+
+	caml_enter_blocking_section();
+	ret = xc_hvm_param_get(_H(xch), _D(domid), Int_val(param), &val);
+	caml_leave_blocking_section();
+
+	if ( ret )
+		failwith_xc(_H(xch));
+
+	CAMLreturn(caml_copy_int64(val));
+}
+
+CAMLprim value stub_xc_hvm_param_set(value xch, value domid, value param, value val)
+{
+	CAMLparam4(xch, domid, param, val);
+	int ret;
+
+	caml_enter_blocking_section();
+	ret = xc_hvm_param_set(_H(xch), _D(domid), Int_val(param), Int64_val(val));
+	caml_leave_blocking_section();
+
+	if ( ret )
+		failwith_xc(_H(xch));
+
+	CAMLreturn(Val_unit);
+}
+
 static uint32_t encode_sbdf(int domain, int bus, int dev, int func)
 {
 	return  ((uint32_t)domain & 0xffff) << 16 |
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Dec 04 06:22:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 04 Dec 2022 06:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452910.710703 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1iO2-0005t8-Mt; Sun, 04 Dec 2022 06:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452910.710703; Sun, 04 Dec 2022 06:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1iO2-0005t0-JV; Sun, 04 Dec 2022 06:22:02 +0000
Received: by outflank-mailman (input) for mailman id 452910;
 Sun, 04 Dec 2022 06:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1iO2-0005su-1f
 for xen-changelog@lists.xenproject.org; Sun, 04 Dec 2022 06:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1iO2-00077e-0n
 for xen-changelog@lists.xenproject.org; Sun, 04 Dec 2022 06:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1iO1-0008GD-W2
 for xen-changelog@lists.xenproject.org; Sun, 04 Dec 2022 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T4qOm0adQQ2B+ZbQDzSKFwiEEiBUNS1Ayu92uJlWgcE=; b=kd1v22MggniW/e0niChamRzbqC
	ZJtBHPR55ozdmrqmAouFiEjA97P/gNUR5gJqAi+dmFe9gxcHIp+OrJTrmJg5OW1rydOklz7SAGLW1
	yqDi/h1rvx/SqcknBMeS0cZKT+qILGq5XHdpsCyKanoI2uw26YWDhqSmXb9umqEY+Kos=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Arm64: make setup_virt_paging()'s pa_range_info[] static
Message-Id: <E1p1iO1-0008GD-W2@xenbits.xenproject.org>
Date: Sun, 04 Dec 2022 06:22:01 +0000

commit a51a244b9df58a9a8e1431f13a80349caac1ca00
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 29 15:39:05 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Sat Dec 3 18:09:50 2022 +0000

    Arm64: make setup_virt_paging()'s pa_range_info[] static
    
    While not as inefficient as it would be on x86 (due to suitable constant
    loading and register pair storing instructions being available to fill
    some of the fields), having the compiler construct an array of constants
    on the stack still looks odd to me.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/p2m.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 9bc5443d9e..fee830192a 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -2281,12 +2281,12 @@ void __init setup_virt_paging(void)
     val |= VTCR_T0SZ(0x18); /* 40 bit IPA */
     val |= VTCR_SL0(0x1); /* P2M starts at first level */
 #else /* CONFIG_ARM_64 */
-    const struct {
+    static const struct {
         unsigned int pabits; /* Physical Address Size */
         unsigned int t0sz;   /* Desired T0SZ, minimum in comment */
         unsigned int root_order; /* Page order of the root of the p2m */
         unsigned int sl0;    /* Desired SL0, maximum in comment */
-    } pa_range_info[] = {
+    } pa_range_info[] __initconst = {
         /* T0SZ minimum and SL0 maximum from ARM DDI 0487H.a Table D5-6 */
         /*      PA size, t0sz(min), root-order, sl0(max) */
         [0] = { 32,      32/*32*/,  0,          1 },
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Dec 04 06:22:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 04 Dec 2022 06:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.452911.710706 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1iOC-0005va-Ns; Sun, 04 Dec 2022 06:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 452911.710706; Sun, 04 Dec 2022 06:22:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p1iOC-0005vT-LL; Sun, 04 Dec 2022 06:22:12 +0000
Received: by outflank-mailman (input) for mailman id 452911;
 Sun, 04 Dec 2022 06:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1iOC-0005vL-5d
 for xen-changelog@lists.xenproject.org; Sun, 04 Dec 2022 06:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1iOC-00077j-4o
 for xen-changelog@lists.xenproject.org; Sun, 04 Dec 2022 06:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p1iOC-0008IH-38
 for xen-changelog@lists.xenproject.org; Sun, 04 Dec 2022 06:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3jrCV1BuigEEXus47qeTYcE26c6uR8vku1GcoNZi244=; b=wcv+bB8oZrGqU0syuPzu7qH8YU
	/3U9ng4RBXvNIH5+THImI3E9KDY7rwuw7f4mnXUl5ii1dctRsqid9PjtcGpnKOJNVOQFAxnz/V9NG
	z0mh3ouhuaNIeW5r+LicQULaZ1lhL5Va5feuzp3igxzX4LdOlvn4KLgs9vTgVPlC7gvQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Arm/P2M: reduce locking in p2m_{alloc,free}_page()
Message-Id: <E1p1iOC-0008IH-38@xenbits.xenproject.org>
Date: Sun, 04 Dec 2022 06:22:12 +0000

commit 68f551ec5fa9ad96397a62cd463a7ff7e4db72d0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 29 15:39:57 2022 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Sat Dec 3 18:12:11 2022 +0000

    Arm/P2M: reduce locking in p2m_{alloc,free}_page()
    
    It is generally preferable to not hold locks around allocation
    functions. And indeed in the hwdom case there's no point at all to hold
    the paging lock. Reduce the locked regions to the non-hwdom case, while
    at the same time arranging for p2m_alloc_page() to have just a single
    return point.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/p2m.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index fee830192a..08e5ac3def 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -48,7 +48,6 @@ static struct page_info *p2m_alloc_page(struct domain *d)
 {
     struct page_info *pg;
 
-    spin_lock(&d->arch.paging.lock);
     /*
      * For hardware domain, there should be no limit in the number of pages that
      * can be allocated, so that the kernel may take advantage of the extended
@@ -58,34 +57,28 @@ static struct page_info *p2m_alloc_page(struct domain *d)
     {
         pg = alloc_domheap_page(NULL, 0);
         if ( pg == NULL )
-        {
             printk(XENLOG_G_ERR "Failed to allocate P2M pages for hwdom.\n");
-            spin_unlock(&d->arch.paging.lock);
-            return NULL;
-        }
     }
     else
     {
+        spin_lock(&d->arch.paging.lock);
         pg = page_list_remove_head(&d->arch.paging.p2m_freelist);
-        if ( unlikely(!pg) )
-        {
-            spin_unlock(&d->arch.paging.lock);
-            return NULL;
-        }
+        spin_unlock(&d->arch.paging.lock);
     }
-    spin_unlock(&d->arch.paging.lock);
 
     return pg;
 }
 
 static void p2m_free_page(struct domain *d, struct page_info *pg)
 {
-    spin_lock(&d->arch.paging.lock);
     if ( is_hardware_domain(d) )
         free_domheap_page(pg);
     else
+    {
+        spin_lock(&d->arch.paging.lock);
         page_list_add_tail(pg, &d->arch.paging.p2m_freelist);
-    spin_unlock(&d->arch.paging.lock);
+        spin_unlock(&d->arch.paging.lock);
+    }
 }
 
 /* Return the size of the pool, in bytes. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 00:11:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 00:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.454250.711797 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2LY8-0007HY-0L; Tue, 06 Dec 2022 00:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 454250.711797; Tue, 06 Dec 2022 00: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 1p2LY7-0007HP-TB; Tue, 06 Dec 2022 00:11:03 +0000
Received: by outflank-mailman (input) for mailman id 454250;
 Tue, 06 Dec 2022 00:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2LY6-0007HJ-7R
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 00:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2LY6-0007Gc-50
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 00:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2LY6-0001Hl-3m
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=skv6sadC1yU+u0vRKZC5boLPrYzx7NaD1X3zK5ktwHs=; b=C+ZExuAciYEmJVwhJWWRu5YsD2
	B0NTho6kRtqxwEPbApirAh3BYzIEvaph5ujohm1T1ELkFH/ergKqTS/f0B++gezZ1Q3WX+ucBRTC2
	krJivkuELCWi1lVDRaREuVZz6thUUKAVKZDD9KDgl36wWywtSxUqqmoAB5ymzz7zN360=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] process/release-technician-checklist: Explain how the banner in README is generated
Message-Id: <E1p2LY6-0001Hl-3m@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 00:11:02 +0000

commit 15241c92677a027694e609b55a77ae5ba3616104
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Dec 5 11:20:07 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Dec 5 11:20:33 2022 +0000

    process/release-technician-checklist: Explain how the banner in README is generated
    
    Explain how the banner in README is generated and take the opportunity
    to mention what it should look like for RC.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/process/release-technician-checklist.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/docs/process/release-technician-checklist.txt b/docs/process/release-technician-checklist.txt
index 7515da202c..4b061bf5f2 100644
--- a/docs/process/release-technician-checklist.txt
+++ b/docs/process/release-technician-checklist.txt
@@ -48,7 +48,11 @@ t=RELEASE-$r
 
 * consider bumping sonames of shlibs
 
-* change xen-unstable README (should say "Xen 4.5" in releases and on stable branches, "Xen 4.5-unstable" on unstable)
+* change xen-unstable README. The banner (generated using figlet) should say:
+    - "Xen 4.5" in releases and on stable branches
+    - "Xen 4.5-unstable" on unstable
+    - "Xen 4.5-rc" for release candidate
+
 * change xen-unstable Config.mk
 #   QEMU_UPSTREAM_REVISION,
 #   QEMU_TRADITIONAL_REVISION
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 06:44:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 06:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.454434.711965 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2RgR-0005gH-FH; Tue, 06 Dec 2022 06:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 454434.711965; Tue, 06 Dec 2022 06: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 1p2RgR-0005g8-CD; Tue, 06 Dec 2022 06:44:03 +0000
Received: by outflank-mailman (input) for mailman id 454434;
 Tue, 06 Dec 2022 06:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2RgQ-0005g2-9A
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2RgQ-0006mB-6M
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2RgQ-0000It-1O
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6JNuZmSM4FLjbfmkTEPzwvu6NTHK2BTXA0x2qF4EHe0=; b=Nsa40V7DM4R3J5d/UUQMnjFnZF
	kv0weIANnl+Bxi4AuSa5jVDH4tItGQdtMDgHwxzhl9WbBqgwpKu9RPJe4jfV6eopuuOLp7AIyHTa8
	uyOKgXTY8Uqfj9xaTTuKlGxTBoqXyxsy2kwqx0hwQYjNPPXPysb/ROybML8C3giuxXyM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] unify update_runstate_area()
Message-Id: <E1p2RgQ-0000It-1O@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 06:44:02 +0000

commit 32ae027f81aed2812ac4025c403f0b32ecfac7f7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 5 13:37:54 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 5 13:37:54 2022 +0100

    unify update_runstate_area()
    
    x86'es variant is a superset of Arm's, with CONFIG_COMPAT parts already
    properly marked. The only other missing piece is
    update_guest_memory_policy(): For the time being Arm simply gains an
    empty struct and inline function.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain.c             | 32 ---------------------
 xen/arch/arm/include/asm/domain.h |  5 ++++
 xen/arch/x86/domain.c             | 58 ---------------------------------------
 xen/arch/x86/include/asm/domain.h |  1 -
 xen/common/domain.c               | 58 +++++++++++++++++++++++++++++++++++++++
 xen/include/xen/domain.h          |  2 ++
 6 files changed, 65 insertions(+), 91 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 38e22f12af..476f4f29f8 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -281,38 +281,6 @@ static void ctxt_switch_to(struct vcpu *n)
     WRITE_SYSREG(n->arch.mdcr_el2, MDCR_EL2);
 }
 
-/* Update per-VCPU guest runstate shared memory area (if registered). */
-static void update_runstate_area(struct vcpu *v)
-{
-    void __user *guest_handle = NULL;
-    struct vcpu_runstate_info runstate;
-
-    if ( guest_handle_is_null(runstate_guest(v)) )
-        return;
-
-    memcpy(&runstate, &v->runstate, sizeof(runstate));
-
-    if ( VM_ASSIST(v->domain, runstate_update_flag) )
-    {
-        guest_handle = &v->runstate_guest.p->state_entry_time + 1;
-        guest_handle--;
-        runstate.state_entry_time |= XEN_RUNSTATE_UPDATE;
-        __raw_copy_to_guest(guest_handle,
-                            (void *)(&runstate.state_entry_time + 1) - 1, 1);
-        smp_wmb();
-    }
-
-    __copy_to_guest(runstate_guest(v), &runstate, 1);
-
-    if ( guest_handle )
-    {
-        runstate.state_entry_time &= ~XEN_RUNSTATE_UPDATE;
-        smp_wmb();
-        __raw_copy_to_guest(guest_handle,
-                            (void *)(&runstate.state_entry_time + 1) - 1, 1);
-    }
-}
-
 static void schedule_tail(struct vcpu *prev)
 {
     ASSERT(prev != current);
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index 2ce6764322..0e310601e8 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -295,6 +295,11 @@ struct arch_vcpu_io {
     struct instr_details dabt_instr; /* when the instruction is decoded */
 };
 
+struct guest_memory_policy {};
+static inline void update_guest_memory_policy(struct vcpu *v,
+                                              struct guest_memory_policy *gmp)
+{}
+
 #endif /* __ASM_DOMAIN_H__ */
 
 /*
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 5a119eec3a..d7a8237f01 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1831,64 +1831,6 @@ void cf_check paravirt_ctxt_switch_to(struct vcpu *v)
         wrmsr_tsc_aux(v->arch.msrs->tsc_aux);
 }
 
-/* Update per-VCPU guest runstate shared memory area (if registered). */
-bool update_runstate_area(struct vcpu *v)
-{
-    bool rc;
-    struct guest_memory_policy policy = { .nested_guest_mode = false };
-    void __user *guest_handle = NULL;
-    struct vcpu_runstate_info runstate;
-
-    if ( guest_handle_is_null(runstate_guest(v)) )
-        return true;
-
-    update_guest_memory_policy(v, &policy);
-
-    memcpy(&runstate, &v->runstate, sizeof(runstate));
-
-    if ( VM_ASSIST(v->domain, runstate_update_flag) )
-    {
-#ifdef CONFIG_COMPAT
-        guest_handle = has_32bit_shinfo(v->domain)
-            ? &v->runstate_guest.compat.p->state_entry_time + 1
-            : &v->runstate_guest.native.p->state_entry_time + 1;
-#else
-        guest_handle = &v->runstate_guest.p->state_entry_time + 1;
-#endif
-        guest_handle--;
-        runstate.state_entry_time |= XEN_RUNSTATE_UPDATE;
-        __raw_copy_to_guest(guest_handle,
-                            (void *)(&runstate.state_entry_time + 1) - 1, 1);
-        smp_wmb();
-    }
-
-#ifdef CONFIG_COMPAT
-    if ( has_32bit_shinfo(v->domain) )
-    {
-        struct compat_vcpu_runstate_info info;
-
-        XLAT_vcpu_runstate_info(&info, &runstate);
-        __copy_to_guest(v->runstate_guest.compat, &info, 1);
-        rc = true;
-    }
-    else
-#endif
-        rc = __copy_to_guest(runstate_guest(v), &runstate, 1) !=
-             sizeof(runstate);
-
-    if ( guest_handle )
-    {
-        runstate.state_entry_time &= ~XEN_RUNSTATE_UPDATE;
-        smp_wmb();
-        __raw_copy_to_guest(guest_handle,
-                            (void *)(&runstate.state_entry_time + 1) - 1, 1);
-    }
-
-    update_guest_memory_policy(v, &policy);
-
-    return rc;
-}
-
 static void _update_runstate_area(struct vcpu *v)
 {
     if ( !update_runstate_area(v) && is_pv_vcpu(v) &&
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 4e59ca8c4e..43ace233d7 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -681,7 +681,6 @@ void update_guest_memory_policy(struct vcpu *v,
 
 void domain_cpu_policy_changed(struct domain *d);
 
-bool update_runstate_area(struct vcpu *);
 bool update_secondary_system_time(struct vcpu *,
                                   struct vcpu_time_info *);
 
diff --git a/xen/common/domain.c b/xen/common/domain.c
index c06d72ad64..626debbae0 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1592,6 +1592,64 @@ int default_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg)
     return rc;
 }
 
+/* Update per-VCPU guest runstate shared memory area (if registered). */
+bool update_runstate_area(struct vcpu *v)
+{
+    bool rc;
+    struct guest_memory_policy policy = { };
+    void __user *guest_handle = NULL;
+    struct vcpu_runstate_info runstate;
+
+    if ( guest_handle_is_null(runstate_guest(v)) )
+        return true;
+
+    update_guest_memory_policy(v, &policy);
+
+    memcpy(&runstate, &v->runstate, sizeof(runstate));
+
+    if ( VM_ASSIST(v->domain, runstate_update_flag) )
+    {
+#ifdef CONFIG_COMPAT
+        guest_handle = has_32bit_shinfo(v->domain)
+            ? &v->runstate_guest.compat.p->state_entry_time + 1
+            : &v->runstate_guest.native.p->state_entry_time + 1;
+#else
+        guest_handle = &v->runstate_guest.p->state_entry_time + 1;
+#endif
+        guest_handle--;
+        runstate.state_entry_time |= XEN_RUNSTATE_UPDATE;
+        __raw_copy_to_guest(guest_handle,
+                            (void *)(&runstate.state_entry_time + 1) - 1, 1);
+        smp_wmb();
+    }
+
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(v->domain) )
+    {
+        struct compat_vcpu_runstate_info info;
+
+        XLAT_vcpu_runstate_info(&info, &runstate);
+        __copy_to_guest(v->runstate_guest.compat, &info, 1);
+        rc = true;
+    }
+    else
+#endif
+        rc = __copy_to_guest(runstate_guest(v), &runstate, 1) !=
+             sizeof(runstate);
+
+    if ( guest_handle )
+    {
+        runstate.state_entry_time &= ~XEN_RUNSTATE_UPDATE;
+        smp_wmb();
+        __raw_copy_to_guest(guest_handle,
+                            (void *)(&runstate.state_entry_time + 1) - 1, 1);
+    }
+
+    update_guest_memory_policy(v, &policy);
+
+    return rc;
+}
+
 long common_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     long rc = 0;
diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
index 0de9cbc169..26f9c4f6dd 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -101,6 +101,8 @@ int default_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg);
 int arch_get_paging_mempool_size(struct domain *d, uint64_t *size /* bytes */);
 int arch_set_paging_mempool_size(struct domain *d, uint64_t size /* bytes */);
 
+bool update_runstate_area(struct vcpu *);
+
 int domain_relinquish_resources(struct domain *d);
 
 void dump_pageframe_info(struct domain *d);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 06:44:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 06:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.454435.711970 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2Rgb-0005i4-HZ; Tue, 06 Dec 2022 06:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 454435.711970; Tue, 06 Dec 2022 06: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 1p2Rgb-0005hx-Dk; Tue, 06 Dec 2022 06:44:13 +0000
Received: by outflank-mailman (input) for mailman id 454435;
 Tue, 06 Dec 2022 06:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2Rga-0005hl-BM
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2Rga-0006mF-AW
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2Rga-0000JQ-8b
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+bqfzhPznUBuOszm6ALZQwPdunVeY/igLLVPYqaBRCA=; b=i9hCKa7FiY2ln6ZkYUH7S8sHAI
	muhLN8j1uoeGXlZVpW/80mER9m8v78gGlDcR51l0C0WF3YCRbbREjaRQW9J9x6iKztfaCsUzO0+Y7
	4syG/QxbvfHSEyyRUw+6z6F0QaztxrkAmI0NhrAhjVwxuDPs9xlyRv/zwwPfcO6s23DU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CODING_STYLE: explicitly call out label indentation
Message-Id: <E1p2Rga-0000JQ-8b@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 06:44:12 +0000

commit ded355eaa4e20cd3dfd22d51332451b110d8c954
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 5 13:40:23 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 5 13:40:23 2022 +0100

    CODING_STYLE: explicitly call out label indentation
    
    Since the behavior of "diff -p" to use an unindented label as context
    identifier often makes it harder to review patches, make explicit the
    requirement for labels to be indented.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 CODING_STYLE | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CODING_STYLE b/CODING_STYLE
index 5faf274b3a..7d75debcbf 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -47,6 +47,10 @@ void fun(void)
     }
 }
 
+Due to the behavior of GNU diffutils "diff -p", labels should be
+indented by at least one blank.  Non-case labels inside switch() bodies
+are preferred to be indented the same as the block's case labels.
+
 White space
 -----------
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 06:44:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 06:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.454436.711973 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2Rgm-0005km-Hv; Tue, 06 Dec 2022 06:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 454436.711973; Tue, 06 Dec 2022 06:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2Rgm-0005ke-FO; Tue, 06 Dec 2022 06:44:24 +0000
Received: by outflank-mailman (input) for mailman id 454436;
 Tue, 06 Dec 2022 06:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2Rgk-0005kN-EJ
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2Rgk-0006mY-DV
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2Rgk-0000Jv-Cm
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Oeor6/1zY0Li6pAHZm7RQIsDq5nhgH3gYcIhVta0bVU=; b=ed6TrB8DZcWKvWT9Bq1VI35v75
	PC7b4nRrADkLo88K98x9A37+e2vp6bsGc0I3hpX4rFGK46oNgM91NyzG0ibkR1vfH3bosPKi1RYuV
	RVTDJAZ3tDkW3KRGLJ39SyTORUkUnE/44aP94kpYSbkyTOH1Ad5rys9XTDIY8a8ze+18=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CODING_STYLE: list further brace placement exceptions
Message-Id: <E1p2Rgk-0000Jv-Cm@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 06:44:22 +0000

commit e9a78d2dc2343321f7e8b55bcbb16405b0d40cfe
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 5 13:40:43 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 5 13:40:43 2022 +0100

    CODING_STYLE: list further brace placement exceptions
    
    For easy spotting of struct/union/enum definitions we already commonly
    place the opening braces on the initial line of such a definition.
    
    We also often don't place the opening brace of an initializer on a
    separate line.
    
    And finally for compound literals placing the braces on separate lines
    often makes the code more difficult to read, so it should (and in
    practice does) typically go on the same line as well.  The placement of
    the closing brace often depends on how large such a compound literal is.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 CODING_STYLE | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/CODING_STYLE b/CODING_STYLE
index 7d75debcbf..ced3ade5a6 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -80,8 +80,13 @@ Bracing
 -------
 
 Braces ('{' and '}') are usually placed on a line of their own, except
-for the do/while loop.  This is unlike the Linux coding style and
-unlike K&R.  do/while loops are an exception. e.g.:
+for
+- the do/while loop
+- the opening brace in definitions of enum, struct, and union
+- the opening brace in initializers
+- compound literals
+This is unlike the Linux coding style and unlike K&R.  do/while loops
+are one exception. e.g.:
 
 if ( condition )
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 06:44:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 06:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.454437.711977 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2Rgw-0005nE-Jm; Tue, 06 Dec 2022 06:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 454437.711977; Tue, 06 Dec 2022 06: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 1p2Rgw-0005n4-Gq; Tue, 06 Dec 2022 06:44:34 +0000
Received: by outflank-mailman (input) for mailman id 454437;
 Tue, 06 Dec 2022 06:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2Rgu-0005mq-HO
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2Rgu-0006n3-Gi
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2Rgu-0000KQ-Ff
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wBNVHnMVCSlB5IAWxdbSehzslH+SU/cT+BBSRZqucqA=; b=o4L2vFVwp+OCNKxwcwO5g/SYIW
	Zsu9rz365mT/tuBgXtQlJxaqKsdTCxXFKhJOn12P1eGUwgMEA6nbBcC4p2ff47uYtjanh7rHC+9Z5
	4RHpirPmLrXUTWS+TkHG0OfMLxc2tqtUSkD4rlrJnq3bU/1b24gABMLFCCYcOVy+sUbY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] bump default SeaBIOS version to 1.16.1
Message-Id: <E1p2Rgu-0000KQ-Ff@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 06:44:32 +0000

commit 83c822a13f418c6192bab6758ce5dca49d456b91
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 5 13:42:47 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 5 13:42:47 2022 +0100

    bump default SeaBIOS version to 1.16.1
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-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 69af1e60d4..10eb443b17 100644
--- a/Config.mk
+++ b/Config.mk
@@ -232,7 +232,7 @@ OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
 QEMU_UPSTREAM_REVISION ?= master
 MINIOS_UPSTREAM_REVISION ?= 5bcb28aaeba1c2506a82fab0cdad0201cd9b54b3
 
-SEABIOS_UPSTREAM_REVISION ?= rel-1.16.0
+SEABIOS_UPSTREAM_REVISION ?= rel-1.16.1
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 06:44:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 06:44:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.454438.711981 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2Rh6-0005pr-Ky; Tue, 06 Dec 2022 06:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 454438.711981; Tue, 06 Dec 2022 06: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 1p2Rh6-0005pj-IM; Tue, 06 Dec 2022 06:44:44 +0000
Received: by outflank-mailman (input) for mailman id 454438;
 Tue, 06 Dec 2022 06:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2Rh4-0005pZ-Kd
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2Rh4-0006nE-Jt
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2Rh4-0000Kp-Iu
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vbCO17C/3197EOReYbxEcXKEwfhcTDBSK69rn0UP3r4=; b=WmCdtZYyxKfPtzK2HJL1IRy0lC
	IRhxd8jD1DamRPXv3JpG4YCQd+76vjX8Or/lIri4pc2hHurE8MXeihd8PbpR122cRegOP5RjOE7G7
	Q1nb61FHY0rSQioiI/9mOzx1ZoOiCzKwLlwU3op1uxD0mAGcpGUK7ehGaX4DYifmm2kY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/MSR: use latched "current"
Message-Id: <E1p2Rh4-0000Kp-Iu@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 06:44:42 +0000

commit bad55986f1bd45d736ace030f5f0cfc46b80482b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 5 13:43:34 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 5 13:43:34 2022 +0100

    x86/MSR: use latched "current"
    
    There's no need to recalculate / refetch the value from the stack
    (pointer).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/msr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index cf46b18aa6..317b154d24 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -417,7 +417,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
          * out of hardware.
          */
 #ifdef CONFIG_HVM
-        if ( v == current && is_hvm_domain(d) && v->arch.hvm.flag_dr_dirty )
+        if ( v == curr && is_hvm_domain(d) && v->arch.hvm.flag_dr_dirty )
             rdmsrl(msr, *val);
         else
 #endif
@@ -639,7 +639,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         {
             uint64_t xcr0 = get_xcr0();
 
-            if ( v != current ||
+            if ( v != curr ||
                  handle_xsetbv(XCR_XFEATURE_ENABLED_MASK,
                                xcr0 | X86_XCR0_BNDREGS | X86_XCR0_BNDCSR) )
                 goto gp_fault;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 06:44:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 06:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.454439.711985 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2RhG-0005s8-Nk; Tue, 06 Dec 2022 06:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 454439.711985; Tue, 06 Dec 2022 06:44:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2RhG-0005s0-Jl; Tue, 06 Dec 2022 06:44:54 +0000
Received: by outflank-mailman (input) for mailman id 454439;
 Tue, 06 Dec 2022 06:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2RhE-0005ri-Nd
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2RhE-0006ow-Mq
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2RhE-0000LH-M7
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=91X7EbNtptkyAKsAtiIifiZuX4uaVU/FAz2lgz9maBU=; b=UsG19mivaxPXYhbe3dLT2bY8qR
	zdXIBF97Hl0RhQkLbmg3XhEVzF4dudZvxnMzrxF17QzFi4x/lVduwEDpEXotaBTJz4EiS6vS4EKKr
	6fPGC58NEWNIc9YeYQVRtY14qNkFOi/XdDK5OiXAYrZspO9xZ22/8TtALAG/GELV0oH8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: don't calculate page owner twice in p2m_add_page()
Message-Id: <E1p2RhE-0000LH-M7@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 06:44:52 +0000

commit 3ea18e9e263778e0ef5c654d5a0a69c272b476b8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 5 13:44:15 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 5 13:44:15 2022 +0100

    x86/p2m: don't calculate page owner twice in p2m_add_page()
    
    Neither page_get_owner() nor mfn_to_page() are entirely trivial
    operations - don't do the same thing twice in close succession. Instead
    help CSE (when MEM_SHARING=y) by introducing a local variable holding
    the page owner.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index a405ee5fde..c5561fe221 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -691,8 +691,10 @@ p2m_add_page(struct domain *d, gfn_t gfn, mfn_t mfn,
     /* Then, look for m->p mappings for this range and deal with them */
     for ( i = 0; i < (1UL << page_order); i++ )
     {
-        if ( dom_cow &&
-             page_get_owner(mfn_to_page(mfn_add(mfn, i))) == dom_cow )
+        const struct domain *owner =
+            page_get_owner(mfn_to_page(mfn_add(mfn, i)));
+
+        if ( dom_cow && owner == dom_cow )
         {
             /* This is no way to add a shared page to your physmap! */
             gdprintk(XENLOG_ERR, "Adding shared mfn %lx directly to dom%d physmap not allowed.\n",
@@ -700,7 +702,7 @@ p2m_add_page(struct domain *d, gfn_t gfn, mfn_t mfn,
             p2m_unlock(p2m);
             return -EINVAL;
         }
-        if ( page_get_owner(mfn_to_page(mfn_add(mfn, i))) != d )
+        if ( owner != d )
             continue;
         ogfn = mfn_to_gfn(d, mfn_add(mfn, i));
         if ( !gfn_eq(ogfn, _gfn(INVALID_M2P_ENTRY)) &&
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 06:45:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 06:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.454440.711989 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2RhP-0005vX-Q7; Tue, 06 Dec 2022 06:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 454440.711989; Tue, 06 Dec 2022 06: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 1p2RhP-0005vP-NS; Tue, 06 Dec 2022 06:45:03 +0000
Received: by outflank-mailman (input) for mailman id 454440;
 Tue, 06 Dec 2022 06:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2RhO-0005vC-Qi
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2RhO-0006pd-Q0
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2RhO-0000Ly-P3
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CmusNSsZCQdUjE2RtaGQqlICqt1jzcoKa9/VJ2mGnLg=; b=5fWQWtcpM05p+c7YxQYYcBHydB
	Oi2+8nV3WzeZxpx4daB/50JflF2vJ3y9bSxbcwdDZRz/DHwIiDuOPX7sl6cAMU226FS4Trv4ha08Z
	f1UiT9P95VOJhNmEbTtxGMXVWpxZJd6ShLHQJP4mgdkZjnrHNsn77GE91BH21MRsZy7g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] gnttab: don't silently truncate GFNs in compat setup-table handling
Message-Id: <E1p2RhO-0000Ly-P3@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 06:45:02 +0000

commit 1043dfb165cad25b83419b353abe91278b2b4745
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 5 13:44:50 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 5 13:44:50 2022 +0100

    gnttab: don't silently truncate GFNs in compat setup-table handling
    
    Returning back truncated frame numbers is unhelpful: Quite likely
    they're not owned by the domain (if it's PV), or we may misguide the
    guest into writing grant entries into a page that it actually uses for
    other purposes.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/compat/grant_table.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/common/compat/grant_table.c b/xen/common/compat/grant_table.c
index 744f9b6e3d..f8177c84c0 100644
--- a/xen/common/compat/grant_table.c
+++ b/xen/common/compat/grant_table.c
@@ -176,7 +176,12 @@ int compat_grant_table_op(
                     { \
                         for ( i = 0; i < (_s_)->nr_frames; ++i ) \
                         { \
-                            unsigned int frame = (_s_)->frame_list.p[i]; \
+                            compat_pfn_t frame = (_s_)->frame_list.p[i]; \
+                            if ( frame != (_s_)->frame_list.p[i] ) \
+                            { \
+                                (_s_)->status = GNTST_address_too_big; \
+                                break; \
+                            } \
                             if ( __copy_to_compat_offset((_d_)->frame_list, \
                                                          i, &frame, 1) ) \
                             { \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 06:45:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 06:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.454441.711994 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2RhZ-0005zq-Sm; Tue, 06 Dec 2022 06:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 454441.711994; Tue, 06 Dec 2022 06: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 1p2RhZ-0005zi-Ox; Tue, 06 Dec 2022 06:45:13 +0000
Received: by outflank-mailman (input) for mailman id 454441;
 Tue, 06 Dec 2022 06:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2RhY-0005ym-Tq
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2RhY-0006pq-T6
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2RhY-0000Mf-SH
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oJR8lknRGuDbsTXLUTPPdb0uZa41wwU3Hs386xuKUKw=; b=S440KPfymH3pwDQOfK+O99a1dk
	TENHjXilwf4K6dUhGK8ElFkiiBCp4pCSE8NqgHVQAhk1tyl71SYd2qXRatNec44ZLxHPYJsl5D5Uo
	qJuDtWhiVfcWnrqRvJ4nshf6+7zVnx/ZMohXcDaFm+Ya2dZzn0Z5KjXup4JF6hUgQfGI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/page_alloc: relax the BUILD_BUG_ON() in xenheap_max_mfn()
Message-Id: <E1p2RhY-0000Mf-SH@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 06:45:12 +0000

commit 9d67161388d8f611467660300bdf9715b7f110b0
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Dec 5 13:45:25 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 5 13:45:25 2022 +0100

    xen/page_alloc: relax the BUILD_BUG_ON() in xenheap_max_mfn()
    
    In the near future, we are considering to use a common xen/domain heap for
    Arm 32-bit V8-R. In this setup, both PADDR_BITS and BITS_PER_LONG will be
    32. Therefore, the condition PADDR_BITS >= BITS_PER_LONG will become true.
    
    Looking at the commit that introduce the BUILD_BUG_ON (88e3ed61642b
    "x86/NUMA: make init_node_heap() respect Xen heap limit") and the current
    use, it seems this check was mainly to ensure that the shift of xenheap_bits
    is not going to be undefined (>> N for a N-bit type is undefined).
    
    So far, all the shifts are using "xenheap_bits - PAGE_SHIFT". Therefore, the
    existing code should work for 32-bit architecture as long as the result of
    the substraction is below 32.
    
    Therefore relax the BUILD_BUG_ON() to check that (PADDR_BITS - PAGE_SHIFT)
    is not equal of above BITS_PER_LONG.
    
    Note that we would need further precaution if we ended up to use
    'xenheap_bits' alone in shifts.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Signed-off-by: Julien Grall <julien@xen.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 62afb07bc6..c5b8c7444f 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2245,7 +2245,7 @@ void __init xenheap_max_mfn(unsigned long mfn)
 {
     ASSERT(!first_node_initialised);
     ASSERT(!xenheap_bits);
-    BUILD_BUG_ON(PADDR_BITS >= BITS_PER_LONG);
+    BUILD_BUG_ON((PADDR_BITS - PAGE_SHIFT) >= BITS_PER_LONG);
     xenheap_bits = min(flsl(mfn + 1) - 1 + PAGE_SHIFT, PADDR_BITS);
     printk(XENLOG_INFO "Xen heap: %u bits\n", xenheap_bits);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 23:44:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 23:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.455711.713255 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2hbY-0007YM-3t; Tue, 06 Dec 2022 23:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 455711.713255; Tue, 06 Dec 2022 23:44:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2hbY-0007YF-18; Tue, 06 Dec 2022 23:44:04 +0000
Received: by outflank-mailman (input) for mailman id 455711;
 Tue, 06 Dec 2022 23:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2hbW-0007Y9-Eg
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 23:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2hbW-00069s-Do
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 23:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2hbW-0007wl-Cb
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 23:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UmrOs/0LYMz6DOaHPi7uRGC7/rgG82bZi7Yv1t/G7Eg=; b=TJn2WgwQsljrHBFxK7HFfQeI+w
	UwpzdIw6xOKZcyByPzS0oMumywV8B1tlW2gTQq4X57zz3hli1ghriVv8Zbhd7yplzIInUyYk7sWT3
	TQ+8mgFOp4FHsDU0udbP3bcfclHUA48Z1a27qyQl2tZloWGN6U5QAylO0tHjNQEdbxX4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: don't mark evtchn upcall vector as pending when vLAPIC is disabled
Message-Id: <E1p2hbW-0007wl-Cb@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 23:44:02 +0000

commit f5d0279839b58cb622f0995dbf9cff056f03082e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Dec 6 13:51:49 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 6 13:51:49 2022 +0100

    x86/HVM: don't mark evtchn upcall vector as pending when vLAPIC is disabled
    
    Linux'es relatively new use of HVMOP_set_evtchn_upcall_vector has
    exposed a problem with the marking of the respective vector as
    pending: For quite some time Linux has been checking whether any stale
    ISR or IRR bits would still be set while preparing the LAPIC for use.
    This check is now triggering on the upcall vector, as the registration,
    at least for APs, happens before the LAPIC is actually enabled.
    
    In software-disabled state an LAPIC would not accept any interrupt
    requests and hence no IRR bit would newly become set while in this
    state. As a result it is also wrong for us to mark the upcall vector as
    having a pending request when the vLAPIC is in this state.
    
    To compensate for the "enabled" check added to the assertion logic, add
    logic to (conditionally) mark the upcall vector as having a request
    pending at the time the LAPIC is being software-enabled by the guest.
    Note however that, like for the pt_may_unmask_irq() we already have
    there, long term we may need to find a different solution. This will be
    especially relevant in case yet better LAPIC acceleration would
    eliminate notifications of guest writes to this and other registers.
    
    Fixes: 7b5b8ca7dffd ("x86/upcall: inject a spurious event after setting upcall vector")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/arch/x86/hvm/irq.c    | 5 +++--
 xen/arch/x86/hvm/vlapic.c | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 858ab5b248..d93ffe4546 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -321,9 +321,10 @@ void hvm_assert_evtchn_irq(struct vcpu *v)
 
     if ( v->arch.hvm.evtchn_upcall_vector != 0 )
     {
-        uint8_t vector = v->arch.hvm.evtchn_upcall_vector;
+        struct vlapic *vlapic = vcpu_vlapic(v);
 
-        vlapic_set_irq(vcpu_vlapic(v), vector, 0);
+        if ( vlapic_enabled(vlapic) )
+           vlapic_set_irq(vlapic, v->arch.hvm.evtchn_upcall_vector, 0);
     }
     else if ( is_hvm_pv_evtchn_domain(v->domain) )
         vcpu_kick(v);
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 257d3b6851..eb32f12e2d 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -829,6 +829,9 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         {
             vlapic->hw.disabled &= ~VLAPIC_SW_DISABLED;
             pt_may_unmask_irq(vlapic_domain(vlapic), &vlapic->pt);
+            if ( v->arch.hvm.evtchn_upcall_vector &&
+                 vcpu_info(v, evtchn_upcall_pending) )
+                vlapic_set_irq(vlapic, v->arch.hvm.evtchn_upcall_vector, 0);
         }
         break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 23:44:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 23:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.455712.713259 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2hbi-0007aY-5W; Tue, 06 Dec 2022 23:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 455712.713259; Tue, 06 Dec 2022 23: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 1p2hbi-0007aR-2r; Tue, 06 Dec 2022 23:44:14 +0000
Received: by outflank-mailman (input) for mailman id 455712;
 Tue, 06 Dec 2022 23:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2hbg-0007aA-IQ
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 23:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2hbg-00069w-HA
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 23:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2hbg-0007xE-G9
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 23:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T3axak6cevWkbzaEAgN6hoBd/XbdoCQNQj4FTb0b/aA=; b=If89Go5MQwpep4lbe80B74a3rF
	9H3nm6K6a/nlY982MJD4ztgNlC0GoqM4c4gF2aJm6bBNaHCsgVMnaGzH/kTiAts6GjlIC7rH/lNRL
	joKSmc1rcq07wRNvLHGuI8SP9aMr/Xhgf7/s6N9DrdRrrk/o6ERkf9ADgJdDELCedAKo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/platform: introduce hypercall to get initial video console settings
Message-Id: <E1p2hbg-0007xE-G9@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 23:44:12 +0000

commit 4dd160583c798d3a5a451ea74633836891d15354
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Dec 6 13:53:43 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 6 13:53:43 2022 +0100

    x86/platform: introduce hypercall to get initial video console settings
    
    This is required so PVH dom0 can get the initial video console state
    as handled by Xen.  PV dom0 will get this as part of the start_info,
    but it doesn't seem necessary to place such information in the
    HVM start info.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/platform_hypercall.c | 11 +++++++++++
 xen/drivers/video/vga.c           |  2 +-
 xen/include/public/platform.h     |  6 ++++++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index a7341dc3d7..3f0d0389af 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -839,6 +839,17 @@ ret_t do_platform_op(
     }
     break;
 
+    case XENPF_get_dom0_console:
+        if ( !fill_console_start_info(&op->u.dom0_console) )
+        {
+            ret = -ENODEV;
+            break;
+        }
+
+        if ( copy_field_to_guest(u_xenpf_op, op, u.dom0_console) )
+            ret = -EFAULT;
+        break;
+
     default:
         ret = -ENOSYS;
         break;
diff --git a/xen/drivers/video/vga.c b/xen/drivers/video/vga.c
index 29a88e8241..0a03508bee 100644
--- a/xen/drivers/video/vga.c
+++ b/xen/drivers/video/vga.c
@@ -205,7 +205,7 @@ static void cf_check vga_text_puts(const char *s, size_t nr)
     }
 }
 
-int __init fill_console_start_info(struct dom0_vga_console_info *ci)
+int fill_console_start_info(struct dom0_vga_console_info *ci)
 {
     memcpy(ci, &vga_console_info, sizeof(*ci));
     return 1;
diff --git a/xen/include/public/platform.h b/xen/include/public/platform.h
index 5e1494fe9a..14784dfa77 100644
--- a/xen/include/public/platform.h
+++ b/xen/include/public/platform.h
@@ -605,6 +605,11 @@ struct xenpf_symdata {
 typedef struct xenpf_symdata xenpf_symdata_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_symdata_t);
 
+/* Fetch the video console information and mode setup by Xen. */
+#define XENPF_get_dom0_console 64
+typedef struct dom0_vga_console_info xenpf_dom0_console_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_dom0_console_t);
+
 /*
  * ` enum neg_errnoval
  * ` HYPERVISOR_platform_op(const struct xen_platform_op*);
@@ -635,6 +640,7 @@ struct xen_platform_op {
         xenpf_core_parking_t          core_parking;
         xenpf_resource_op_t           resource_op;
         xenpf_symdata_t               symdata;
+        xenpf_dom0_console_t          dom0_console;
         uint8_t                       pad[128];
     } u;
 };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 23:44:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 23:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.455713.713263 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2hbr-0007dY-6r; Tue, 06 Dec 2022 23:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 455713.713263; Tue, 06 Dec 2022 23: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 1p2hbr-0007dQ-4K; Tue, 06 Dec 2022 23:44:23 +0000
Received: by outflank-mailman (input) for mailman id 455713;
 Tue, 06 Dec 2022 23:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2hbq-0007dI-LR
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 23:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2hbq-0006AF-Kc
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 23:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2hbq-0007xm-JX
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 23: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rdoDjMo0Y0qVUPfn0heLL2NxA7M+yUhFKCO9IjgiSac=; b=EYzAlRQBcnyj4uF4dvDT3RK0dQ
	+TN/s//aeIQAI1MtQVjv6xwnXFQdx4JK/ViK/UUB+irNLUsVMPRdHpnIdE+sYt/sNYErnYHpMLvW9
	uKAdGuBRdr1CcHfJ540BzHswKHoUn7v9zVm55l3w5QtkmhESVcJ2Om/0K9OevLBPz7Lc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm/shadow: avoid assuming a specific Xen PAT
Message-Id: <E1p2hbq-0007xm-JX@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 23:44:22 +0000

commit 53ba5e1b48a538c366e4621634b493f4585bcac0
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Dec 6 13:54:33 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 6 13:54:33 2022 +0100

    x86/mm/shadow: avoid assuming a specific Xen PAT
    
    This makes the code easier to understand and more robust if Xen's PAT
    ever changes.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/multi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 2370b30602..4e94fec3d5 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -629,8 +629,8 @@ _sh_propagate(struct vcpu *v,
     else if ( p2mt == p2m_mmio_direct &&
               rangeset_contains_singleton(mmio_ro_ranges, mfn_x(target_mfn)) )
     {
-        sflags &= ~(_PAGE_RW | _PAGE_PAT);
-        sflags |= _PAGE_PCD | _PAGE_PWT;
+        sflags &= ~(_PAGE_RW | PAGE_CACHE_ATTRS);
+        sflags |= _PAGE_UC;
     }
 
     // protect guest page tables
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 06 23:44:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Dec 2022 23:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.455714.713267 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2hc1-0007gF-8V; Tue, 06 Dec 2022 23:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 455714.713267; Tue, 06 Dec 2022 23:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2hc1-0007g7-5m; Tue, 06 Dec 2022 23:44:33 +0000
Received: by outflank-mailman (input) for mailman id 455714;
 Tue, 06 Dec 2022 23:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2hc0-0007fz-PK
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 23:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2hc0-0006AU-OX
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 23:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2hc0-0007yF-Ms
 for xen-changelog@lists.xenproject.org; Tue, 06 Dec 2022 23: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SQRnDdZqfOLVhcQNcreZ2eP6fuRVse/aXVpbEf9Pfqw=; b=IAYbbKXKVoxOb8GpCLxko5N3oh
	rcYzwzsr30zu85i5gnEG+REJxgOgljUhwPIt7qoe0XAemwdt14FbsN0nVSc++9DZhEt6yKG+d9Yzj
	hGG7u8w2vgeFR5oKBLm77SfSejN6dOpJYjuDxb8boKxsy6SkWE3vXkYBb8N9RT6es0Cs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm/shadow: do not open-code PAGE_CACHE_ATTRS
Message-Id: <E1p2hc0-0007yF-Ms@xenbits.xenproject.org>
Date: Tue, 06 Dec 2022 23:44:32 +0000

commit a6da84524ceaf24ff997d03407b93f60c12857f3
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Dec 6 13:55:07 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 6 13:55:07 2022 +0100

    x86/mm/shadow: do not open-code PAGE_CACHE_ATTRS
    
    This makes the code easier to understand.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/shadow/multi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 4e94fec3d5..6bb564b014 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -535,7 +535,7 @@ _sh_propagate(struct vcpu *v,
     if ( guest_nx_enabled(v) )
         pass_thru_flags |= _PAGE_NX_BIT;
     if ( level == 1 && !shadow_mode_refcounts(d) && mmio_mfn )
-        pass_thru_flags |= _PAGE_PAT | _PAGE_PCD | _PAGE_PWT;
+        pass_thru_flags |= PAGE_CACHE_ATTRS;
     sflags = gflags & pass_thru_flags;
 
     /*
@@ -548,7 +548,7 @@ _sh_propagate(struct vcpu *v,
     {
         int type;
 
-        ASSERT(!(sflags & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)));
+        ASSERT(!(sflags & PAGE_CACHE_ATTRS));
 
         /* compute the PAT index for shadow page entry when VT-d is enabled
          * and device assigned.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 07 08:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Dec 2022 08:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456048.713711 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qCl-00030x-B6; Wed, 07 Dec 2022 08:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456048.713711; Wed, 07 Dec 2022 08:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qCl-00030p-89; Wed, 07 Dec 2022 08:55:03 +0000
Received: by outflank-mailman (input) for mailman id 456048;
 Wed, 07 Dec 2022 08:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qCj-00030j-TF
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qCj-0002og-R9
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qCj-00063x-QD
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6zqvOleC+2TzNTx1zOONlueiKPfArOOAeSHuMNcGcM0=; b=M/uHFO1e7GwBysJ8ka5zmbwJT4
	HjbRdZT3P7Ho6OSNuCn2yF0Lub/zbYC2xOqMzeoaHcdGkl70CceyxGF5Hz57RV0G1F8A4Cey1/KHT
	4isNrRr8BJFjxgNPjB3YNoUbQ+3rAaNtC6vWNnGCjE2/PJaluv/HTO3NaHCmHpfhxYF8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Enforce alignment check in debug build for {read, write}_atomic
Message-Id: <E1p2qCj-00063x-QD@xenbits.xenproject.org>
Date: Wed, 07 Dec 2022 08:55:01 +0000

commit 34f8b971b2dd1968fd5b9bf4ce1247dc9d31f6b5
Author:     Ayan Kumar Halder <ayankuma@amd.com>
AuthorDate: Tue Nov 8 09:45:03 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Dec 6 18:19:50 2022 +0000

    xen/arm: Enforce alignment check in debug build for {read, write}_atomic
    
    Xen provides helper to atomically read/write memory (see {read,
    write}_atomic()). Those helpers can only work if the address is aligned
    to the size of the access (see B2.2.1 ARM DDI 08476I.a).
    
    On Arm32, the alignment is already enforced by the processor because
    HSCTLR.A bit is set (it enforce alignment for every access). For Arm64,
    this bit is not set because memcpy()/memset() can use unaligned access
    for performance reason (the implementation is taken from the Cortex
    library).
    
    To avoid any overhead in production build, the alignment will only be
    checked using an ASSERT. Note that it might be possible to do it in
    production build using the acquire/exclusive version of load/store. But
    this is left to a follow-up (if wanted).
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Signed-off-by: Julien Grall <julien@xen.org>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/atomic.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/arm/include/asm/atomic.h b/xen/arch/arm/include/asm/atomic.h
index 1f60c28b1b..64314d59b3 100644
--- a/xen/arch/arm/include/asm/atomic.h
+++ b/xen/arch/arm/include/asm/atomic.h
@@ -78,6 +78,7 @@ static always_inline void read_atomic_size(const volatile void *p,
                                            void *res,
                                            unsigned int size)
 {
+    ASSERT(IS_ALIGNED((vaddr_t)p, size));
     switch ( size )
     {
     case 1:
@@ -102,6 +103,7 @@ static always_inline void write_atomic_size(volatile void *p,
                                             void *val,
                                             unsigned int size)
 {
+    ASSERT(IS_ALIGNED((vaddr_t)p, size));
     switch ( size )
     {
     case 1:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 07 08:55:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Dec 2022 08:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456049.713714 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qCv-00034Z-CT; Wed, 07 Dec 2022 08:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456049.713714; Wed, 07 Dec 2022 08:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qCv-00034S-9g; Wed, 07 Dec 2022 08:55:13 +0000
Received: by outflank-mailman (input) for mailman id 456049;
 Wed, 07 Dec 2022 08:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qCt-00032j-Vh
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qCt-0002os-UQ
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qCt-00064R-TT
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LmmvoV6OcMeKnP+QRgxNI5itpw/vMOChn2oPJ15iS1M=; b=Js/oWcCokrh8dQF4nwWuzycMTn
	IlJQ/coEkQYOOwS/y8SvoIzn0wocgtQHA/3E/Jbg0ufonviy1bTtyYXAhBRmqb4levqH92XzSlKxa
	rbnZaD0mlG42QVkxe5qJsGkThagPycay7zJgE2/tfKpzIYcIOENBg+wb0B2XRzZdWPqg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] GICv3: Emulate GICD_IGRPMODR as RAZ / WI
Message-Id: <E1p2qCt-00064R-TT@xenbits.xenproject.org>
Date: Wed, 07 Dec 2022 08:55:11 +0000

commit 718eb7513ac7c5fb1163e777a04720a829f09278
Author:     Ayan Kumar Halder <ayankuma@amd.com>
AuthorDate: Mon Oct 24 19:25:18 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Dec 6 18:19:50 2022 +0000

    GICv3: Emulate GICD_IGRPMODR as RAZ / WI
    
    Refer GIC v3 specification (Arm IHI 0069H ID020922), IGRPMODR is emulated
    as RAZ / WI for the guests as "GICD_CTLR.ARE_S==0" is true.
    Xen is currently supported to run in non-secure mode, so guests will run in
    non-secure mode only.
    
    Also, if Xen was supposed to run in secure mode with guests, the programming
    of the interrupts (ie whether it belongs to secure/non secure and group 0/1)
    will be done by Xen only. The guests will not be allowed to change this.
    
    Signed-off-by: Ayan Kumar Halder <ayankuma@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/include/asm/gic_v3_defs.h | 2 ++
 xen/arch/arm/vgic-v3.c                 | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/xen/arch/arm/include/asm/gic_v3_defs.h b/xen/arch/arm/include/asm/gic_v3_defs.h
index 34ed5f857d..728e28d5e5 100644
--- a/xen/arch/arm/include/asm/gic_v3_defs.h
+++ b/xen/arch/arm/include/asm/gic_v3_defs.h
@@ -30,6 +30,8 @@
 #define GICD_CLRSPI_NSR              (0x048)
 #define GICD_SETSPI_SR               (0x050)
 #define GICD_CLRSPI_SR               (0x058)
+#define GICD_IGRPMODR                (0xD00)
+#define GICD_IGRPMODRN               (0xD7C)
 #define GICD_IROUTER                 (0x6000)
 #define GICD_IROUTER32               (0x6100)
 #define GICD_IROUTER1019             (0x7FD8)
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 84dc442fc6..015446be17 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -684,6 +684,7 @@ static int __vgic_v3_distr_common_mmio_read(const char *name, struct vcpu *v,
     switch ( reg )
     {
     case VRANGE32(GICD_IGROUPR, GICD_IGROUPRN):
+    case VRANGE32(GICD_IGRPMODR, GICD_IGRPMODRN):
         /* We do not implement security extensions for guests, read zero */
         if ( dabt.size != DABT_WORD ) goto bad_width;
         goto read_as_zero;
@@ -780,6 +781,7 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
     switch ( reg )
     {
     case VRANGE32(GICD_IGROUPR, GICD_IGROUPRN):
+    case VRANGE32(GICD_IGRPMODR, GICD_IGRPMODRN):
         /* We do not implement security extensions for guests, write ignore */
         goto write_ignore_32;
 
@@ -1191,6 +1193,7 @@ static int vgic_v3_distr_mmio_read(struct vcpu *v, mmio_info_t *info,
     case VRANGE32(GICD_ICACTIVER, GICD_ICACTIVERN):
     case VRANGE32(GICD_IPRIORITYR, GICD_IPRIORITYRN):
     case VRANGE32(GICD_ICFGR, GICD_ICFGRN):
+    case VRANGE32(GICD_IGRPMODR, GICD_IGRPMODRN):
         /*
          * Above all register are common with GICR and GICD
          * Manage in common
@@ -1378,6 +1381,7 @@ static int vgic_v3_distr_mmio_write(struct vcpu *v, mmio_info_t *info,
     case VRANGE32(GICD_ICACTIVER, GICD_ICACTIVERN):
     case VRANGE32(GICD_IPRIORITYR, GICD_IPRIORITYRN):
     case VRANGE32(GICD_ICFGR, GICD_ICFGRN):
+    case VRANGE32(GICD_IGRPMODR, GICD_IGRPMODRN):
         /* Above registers are common with GICR and GICD
          * Manage in common */
         return __vgic_v3_distr_common_mmio_write("vGICD", v, info,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 07 08:55:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Dec 2022 08:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456051.713729 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qD5-0003PR-Kz; Wed, 07 Dec 2022 08:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456051.713729; Wed, 07 Dec 2022 08:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qD5-0003PJ-IM; Wed, 07 Dec 2022 08:55:23 +0000
Received: by outflank-mailman (input) for mailman id 456051;
 Wed, 07 Dec 2022 08:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qD4-0003On-26
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qD4-0002pI-1L
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qD4-00064s-0R
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ueXAAlNtb3rzqEnVZlN5thVAF6ibehGNuY1tN7JO7G0=; b=EKDR0wsVyAO3UhHXTMygPw0nE+
	6ghCwN3lNAjzYVUUcja6tcsCczHz3MBTQDRYh5AyKJQDiZoSkdstmrnrN6IPVLRt9kmdoURfroZ4y
	Q/VUEwN1qNs4r6jYQV0Z3RALi4Z0U1dWK4DeHM2Qcx/jRKNTYaD4OTKx5w1mWaTJ4oPU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Fix unreachable panic for vpl011 vIRQ
Message-Id: <E1p2qD4-00064s-0R@xenbits.xenproject.org>
Date: Wed, 07 Dec 2022 08:55:22 +0000

commit 4c2f82d95e89b92825e4f5e4506cb9b55ab257f0
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Nov 23 15:39:13 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Dec 6 18:19:50 2022 +0000

    xen/arm: Fix unreachable panic for vpl011 vIRQ
    
    When creating direct mapped domU, the vIRQ for vpl011 is taken from
    the SERHND_DTUART serial port using serial_irq. This function can return
    -1 (i.e. no interrupt found) in which case we should call a panic.
    However, vpl011_virq is defined as unsigned int which causes the panic
    to be unreachable, because less than zero comparison of an unsigned value
    can never be true. Fix it by defining vpl011_virq as int.
    
    Fixes: 3580c8b2dfc3 ("xen/arm: if direct-map domain use native UART address and IRQ number for vPL011")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/domain_build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index bd30d3798c..71a3243f48 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -3897,7 +3897,7 @@ void __init create_domUs(void)
 
         if ( !dt_property_read_u32(node, "nr_spis", &d_cfg.arch.nr_spis) )
         {
-            unsigned int vpl011_virq = GUEST_VPL011_SPI;
+            int vpl011_virq = GUEST_VPL011_SPI;
 
             d_cfg.arch.nr_spis = gic_number_lines() - 32;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 07 08:55:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Dec 2022 08:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456052.713734 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qDF-0003Yr-OZ; Wed, 07 Dec 2022 08:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456052.713734; Wed, 07 Dec 2022 08:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qDF-0003Yj-LK; Wed, 07 Dec 2022 08:55:33 +0000
Received: by outflank-mailman (input) for mailman id 456052;
 Wed, 07 Dec 2022 08:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDE-0003Ws-56
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDE-0002pT-4O
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDE-00065J-3T
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GvZueSeuEQanBYSdU6bj5zfqczbmPzdadbf3ZHNgM20=; b=ekAi0pF0ZNLcEuXMAVySpvMhFL
	mDzG0TxeOdEgowNwDNeSoptrmJSScgqdp2ALu43YBAZHycN3JqF3r4CQXmDo+bQIvCN011ihEPU/s
	JpCCP6CaAfksn6R3ttvOelvpHZjgni1ZEL3Lre8a2wIwlFptSWeD1oMhfTgnuiwcZrZc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Drop early_uart_init macro from debug-meson.inc
Message-Id: <E1p2qDE-00065J-3T@xenbits.xenproject.org>
Date: Wed, 07 Dec 2022 08:55:32 +0000

commit 2d2fda0223392ef39ea00b8ee80d33ec29ef0eab
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Nov 18 12:46:16 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Dec 6 18:19:50 2022 +0000

    xen/arm: Drop early_uart_init macro from debug-meson.inc
    
    early_uart_init macro is only used if CONFIG_EARLY_UART_INIT is set.
    This config option depends on EARLY_UART_PL011, so there is no point
    in defining it for MESON, especially if it is empty. Remove it and adapt
    the existing comment.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/arm64/debug-meson.inc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/arm64/debug-meson.inc b/xen/arch/arm/arm64/debug-meson.inc
index e1a8fa8ab9..e65e1ccde4 100644
--- a/xen/arch/arm/arm64/debug-meson.inc
+++ b/xen/arch/arm/arm64/debug-meson.inc
@@ -23,9 +23,10 @@
 
 #define AML_UART_TX_FIFO_FULL   21
 
-.macro early_uart_init xb, c
-/* Uart has already been initialized by Firmware, for instance by TF-A */
-.endm
+/*
+ * No need for early_uart_init, as UART has already been initialized
+ * by Firmware, for instance by TF-A.
+ */
 
 /*
  * MESON UART wait UART to be ready to transmit
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 07 08:55:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Dec 2022 08:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456056.713739 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qDP-0003eH-Pi; Wed, 07 Dec 2022 08:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456056.713739; Wed, 07 Dec 2022 08:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qDP-0003e7-Mo; Wed, 07 Dec 2022 08:55:43 +0000
Received: by outflank-mailman (input) for mailman id 456056;
 Wed, 07 Dec 2022 08:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDO-0003dk-7s
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDO-0002pu-7B
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDO-00065q-6T
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JFuxOT7Xro0T0HkEIijEWqTnzu9aJkICBolXNaAlIAE=; b=WH1rEfG5ljOEHn7ZT9/fZlMt9v
	U18nwIDOWD9t5fjUVXrPZoG0u+2p059wU2MqBi+zA7eOrwpeeYZ1O71MGVDRlpCsS0lB9FycxGlCZ
	gTpXFzGaLxDVqS8+I35vViAA4FfVHoF7vxV2WdvtaeBkiPXroMo3vv6VPhDWvqMAAFhw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: debug-pl011.inc: Use macros instead of hardcoded values
Message-Id: <E1p2qDO-00065q-6T@xenbits.xenproject.org>
Date: Wed, 07 Dec 2022 08:55:42 +0000

commit dae2839c5490a8145e2b77dcd99c3b637988bf71
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Nov 18 12:46:17 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Dec 6 18:19:50 2022 +0000

    xen/arm: debug-pl011.inc: Use macros instead of hardcoded values
    
    Make use of the macros defined in asm/pl011-uart.h instead of hardcoding
    the values. Also, take the opportunity to fix the file extension in a
    top-level comment.
    
    No functional change intended.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm64/debug-pl011.inc | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/arm64/debug-pl011.inc b/xen/arch/arm/arm64/debug-pl011.inc
index 1928a2e3ff..d82f2f1de1 100644
--- a/xen/arch/arm/arm64/debug-pl011.inc
+++ b/xen/arch/arm/arm64/debug-pl011.inc
@@ -1,5 +1,5 @@
 /*
- * xen/arch/arm/arm64/debug-pl011.S
+ * xen/arch/arm/arm64/debug-pl011.inc
  *
  * PL011 specific debug code
  *
@@ -16,6 +16,8 @@
  * GNU General Public License for more details.
  */
 
+ #include <asm/pl011-uart.h>
+
 /*
  * PL011 UART initialization
  * xb: register which containts the UART base address
@@ -23,13 +25,13 @@
  */
 .macro early_uart_init xb, c
         mov   x\c, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE % 16)
-        strh  w\c, [\xb, #0x28]      /* -> UARTFBRD (Baud divisor fraction) */
+        strh  w\c, [\xb, #FBRD]      /* -> UARTFBRD (Baud divisor fraction) */
         mov   x\c, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE / 16)
-        strh  w\c, [\xb, #0x24]      /* -> UARTIBRD (Baud divisor integer) */
+        strh  w\c, [\xb, #IBRD]      /* -> UARTIBRD (Baud divisor integer) */
         mov   x\c, #0x60             /* 8n1 */
-        str   w\c, [\xb, #0x2C]      /* -> UARTLCR_H (Line control) */
-        ldr   x\c, =0x00000301       /* RXE | TXE | UARTEN */
-        str   w\c, [\xb, #0x30]      /* -> UARTCR (Control Register) */
+        str   w\c, [\xb, #LCR_H]     /* -> UARTLCR_H (Line control) */
+        ldr   x\c, =(RXE | TXE | UARTEN)
+        str   w\c, [\xb, #CR]        /* -> UARTCR (Control Register) */
 .endm
 
 /*
@@ -39,8 +41,8 @@
  */
 .macro early_uart_ready xb, c
 1:
-        ldrh  w\c, [\xb, #0x18]      /* <- UARTFR (Flag register) */
-        tst   w\c, #0x8              /* Check BUSY bit */
+        ldrh  w\c, [\xb, #FR]        /* <- UARTFR (Flag register) */
+        tst   w\c, #BUSY             /* Check BUSY bit */
         b.ne  1b                     /* Wait for the UART to be ready */
 .endm
 
@@ -50,7 +52,7 @@
  * wt: register which contains the character to transmit
  */
 .macro early_uart_transmit xb, wt
-        strb  \wt, [\xb]             /* -> UARTDR (Data Register) */
+        strb  \wt, [\xb, #DR]        /* -> UARTDR (Data Register) */
 .endm
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 07 08:55:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Dec 2022 08:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456057.713742 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qDZ-0003lJ-Qv; Wed, 07 Dec 2022 08:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456057.713742; Wed, 07 Dec 2022 08:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qDZ-0003lA-OH; Wed, 07 Dec 2022 08:55:53 +0000
Received: by outflank-mailman (input) for mailman id 456057;
 Wed, 07 Dec 2022 08:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDY-0003jm-Ax
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDY-0002py-AF
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDY-00066L-9P
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oBpF4+Za5SDKn4uL/XAO/FQoqpllJVu3d3ZWHublyUg=; b=uGTSizJbeOV/eIu+6lh5S3E/ij
	LKqVnIa8lVmLoArJnJT7jRrjBoyuu3iunWXjxMpp4TOxTHNkhnxJ4Akh3gkDQtGR/MWSAXovBo6Cs
	Yv+lggeesIgtFv1KIoLXNJF8VurcpYcH9RCCyI4H8X5L89vcFkPFhh4Smli1WH/nFAWs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Define WLEN_8 macro and use it in debug-pl011
Message-Id: <E1p2qDY-00066L-9P@xenbits.xenproject.org>
Date: Wed, 07 Dec 2022 08:55:52 +0000

commit 3d0290e528ff04f80d93977ce4b36b57d0afbf0c
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Nov 18 12:46:18 2022 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Dec 6 18:19:50 2022 +0000

    xen/arm: Define WLEN_8 macro and use it in debug-pl011
    
    At the moment, early printk code for pl011 uses a hardcoded value
    for 8n1 LCR configuration. Define and use macro WLEN_8 for that purpose
    (no parity and 1 stop bit are defined as 0).
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/arm32/debug-pl011.inc    | 2 +-
 xen/arch/arm/arm64/debug-pl011.inc    | 2 +-
 xen/arch/arm/include/asm/pl011-uart.h | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/arm32/debug-pl011.inc b/xen/arch/arm/arm32/debug-pl011.inc
index 214f68dc95..c527f1d442 100644
--- a/xen/arch/arm/arm32/debug-pl011.inc
+++ b/xen/arch/arm/arm32/debug-pl011.inc
@@ -29,7 +29,7 @@
         str   \rc, [\rb, #FBRD]     /* -> UARTFBRD (Baud divisor fraction) */
         mov   \rc, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE / 16)
         str   \rc, [\rb, #IBRD]     /* -> UARTIBRD (Baud divisor integer) */
-        mov   \rc, #0x60            /* 8n1 */
+        mov   \rc, #WLEN_8          /* 8n1 */
         str   \rc, [\rb, #LCR_H]     /* -> UARTLCR_H (Line control) */
         ldr   \rc, =(RXE | TXE | UARTEN)      /* RXE | TXE | UARTEN */
         str   \rc, [\rb, #CR]     /* -> UARTCR (Control Register) */
diff --git a/xen/arch/arm/arm64/debug-pl011.inc b/xen/arch/arm/arm64/debug-pl011.inc
index d82f2f1de1..6d60e78c8b 100644
--- a/xen/arch/arm/arm64/debug-pl011.inc
+++ b/xen/arch/arm/arm64/debug-pl011.inc
@@ -28,7 +28,7 @@
         strh  w\c, [\xb, #FBRD]      /* -> UARTFBRD (Baud divisor fraction) */
         mov   x\c, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE / 16)
         strh  w\c, [\xb, #IBRD]      /* -> UARTIBRD (Baud divisor integer) */
-        mov   x\c, #0x60             /* 8n1 */
+        mov   x\c, #WLEN_8           /* 8n1 */
         str   w\c, [\xb, #LCR_H]     /* -> UARTLCR_H (Line control) */
         ldr   x\c, =(RXE | TXE | UARTEN)
         str   w\c, [\xb, #CR]        /* -> UARTCR (Control Register) */
diff --git a/xen/arch/arm/include/asm/pl011-uart.h b/xen/arch/arm/include/asm/pl011-uart.h
index 57e9ec73ac..5bb563ec08 100644
--- a/xen/arch/arm/include/asm/pl011-uart.h
+++ b/xen/arch/arm/include/asm/pl011-uart.h
@@ -55,6 +55,7 @@
 
 /* LCR_H bits */
 #define SPS    (1<<7) /* Stick parity select */
+#define WLEN_8 (_AC(0x3, U) << 5) /* 8 bits word length */
 #define FEN    (1<<4) /* FIFO enable */
 #define STP2   (1<<3) /* Two stop bits select */
 #define EPS    (1<<2) /* Even parity select */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 07 08:56:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Dec 2022 08:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456059.713746 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qDj-0003ox-Sh; Wed, 07 Dec 2022 08:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456059.713746; Wed, 07 Dec 2022 08:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qDj-0003op-Pn; Wed, 07 Dec 2022 08:56:03 +0000
Received: by outflank-mailman (input) for mailman id 456059;
 Wed, 07 Dec 2022 08:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDi-0003oX-Fh
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDi-0002qR-Eq
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDi-00067C-CT
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=k+jlgwN4nQtuQPz2C/9UvbV5hH1mphYxpPEUIir1KRQ=; b=HcJp5/NW1lfF+/tCh7NC8jrN4U
	XpHz/MMFZgLRbgT9oHvxe7eyEtyOjXZgt983vEYfcZW+EyhKileHa8vkixsb3nGuR2uxzuwzg7rFK
	v2+pf3nkaItxXjNgMXzXP6EDh3ClYuBkTQiO79dbFyIEbTIMx9PiJicwWEb8cMyCH4Fw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: arm: Create alloc_virtio_mmio_params()
Message-Id: <E1p2qDi-00067C-CT@xenbits.xenproject.org>
Date: Wed, 07 Dec 2022 08:56:02 +0000

commit bb46e38970775c088b9bd5f6fa8e7996cbb6d21f
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Thu Sep 8 14:22:59 2022 +0530
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Dec 6 18:19:50 2022 +0000

    libxl: arm: Create alloc_virtio_mmio_params()
    
    In order to prepare for adding support for more device types, create a
    separate routine to allocate base and irq for a device as the same code
    will be required for other device types too.
    
    Also move updates to virtio_irq and virtio_enabled out of the disk
    device specific block, as they will depend on other device types too.
    
    Suggested-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_arm.c | 47 +++++++++++++++++++++++++++++++-------------
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index cd84a7c66e..23c76dae88 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -48,6 +48,24 @@ static uint32_t alloc_virtio_mmio_irq(libxl__gc *gc, uint32_t *virtio_mmio_irq)
     return irq;
 }
 
+static int alloc_virtio_mmio_params(libxl__gc *gc, uint64_t *base,
+                                    uint32_t *irq, uint64_t *virtio_mmio_base,
+                                    uint32_t *virtio_mmio_irq)
+{
+    *base = alloc_virtio_mmio_base(gc, virtio_mmio_base);
+    if (!*base)
+        return ERROR_FAIL;
+
+    *irq = alloc_virtio_mmio_irq(gc, virtio_mmio_irq);
+    if (!*irq)
+        return ERROR_FAIL;
+
+    LOG(DEBUG, "Allocate Virtio MMIO params: IRQ %u BASE 0x%"PRIx64, *irq,
+        *base);
+
+    return 0;
+}
+
 static const char *gicv_to_string(libxl_gic_version gic_version)
 {
     switch (gic_version) {
@@ -70,6 +88,7 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
     bool vuart_enabled = false, virtio_enabled = false;
     uint64_t virtio_mmio_base = GUEST_VIRTIO_MMIO_BASE;
     uint32_t virtio_mmio_irq = GUEST_VIRTIO_MMIO_SPI_FIRST;
+    int rc;
 
     /*
      * If pl011 vuart is enabled then increment the nr_spis to allow allocation
@@ -85,20 +104,12 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
         libxl_device_disk *disk = &d_config->disks[i];
 
         if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
-            disk->base = alloc_virtio_mmio_base(gc, &virtio_mmio_base);
-            if (!disk->base)
-                return ERROR_FAIL;
-
-            disk->irq = alloc_virtio_mmio_irq(gc, &virtio_mmio_irq);
-            if (!disk->irq)
-                return ERROR_FAIL;
-
-            if (virtio_irq < disk->irq)
-                virtio_irq = disk->irq;
-            virtio_enabled = true;
+            rc = alloc_virtio_mmio_params(gc, &disk->base, &disk->irq,
+                                          &virtio_mmio_base,
+                                          &virtio_mmio_irq);
 
-            LOG(DEBUG, "Allocate Virtio MMIO params for Vdev %s: IRQ %u BASE 0x%"PRIx64,
-                disk->vdev, disk->irq, disk->base);
+            if (rc)
+                return rc;
         }
     }
 
@@ -107,8 +118,16 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
      * present, make sure that we allocate enough SPIs for them.
      * The resulting "nr_spis" needs to cover the highest possible SPI.
      */
-    if (virtio_enabled)
+    if (virtio_mmio_irq != GUEST_VIRTIO_MMIO_SPI_FIRST) {
+        virtio_enabled = true;
+
+        /*
+         * Assumes that "virtio_mmio_irq" is the highest allocated irq, which is
+         * updated from alloc_virtio_mmio_irq() currently.
+         */
+        virtio_irq = virtio_mmio_irq - 1;
         nr_spis = max(nr_spis, virtio_irq - 32 + 1);
+    }
 
     for (i = 0; i < d_config->b_info.num_irqs; i++) {
         uint32_t irq = d_config->b_info.irqs[i];
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 07 08:56:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Dec 2022 08:56:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456061.713750 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qDt-0003sK-Ty; Wed, 07 Dec 2022 08:56:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456061.713750; Wed, 07 Dec 2022 08:56:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qDt-0003sC-RM; Wed, 07 Dec 2022 08:56:13 +0000
Received: by outflank-mailman (input) for mailman id 456061;
 Wed, 07 Dec 2022 08:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDs-0003rb-Id
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDs-0002qX-Hq
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qDs-00067b-Gx
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GXPD31DU3Qdn/O0eJwEzjMqgZ8U78+J1vDu8cF8Szq8=; b=19MWdYktr4joDr8waXcB3L2Pci
	6mn0YNTlIvHNnja0kS8SKIg78X03/txkYjgE1Mrv5NnNLWFuZ/jcQA09Erus6i+56YYeWON6YZ7/M
	EmwrPLrLYA621Uu6lOosVdWNslQnoVROAFHjd+/oQkUk6MxXganL1W8YL4ev54vL06q8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: arm: Split make_virtio_mmio_node()
Message-Id: <E1p2qDs-00067b-Gx@xenbits.xenproject.org>
Date: Wed, 07 Dec 2022 08:56:12 +0000

commit 866ce2657e136ccd0c278bbe335701d8ce8e2a86
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Thu Sep 8 14:23:00 2022 +0530
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Dec 6 18:19:50 2022 +0000

    libxl: arm: Split make_virtio_mmio_node()
    
    make_virtio_mmio_node() creates the DT node for simple MMIO devices
    currently, i.e. the ones that don't require any additional properties.
    
    In order to allow using it for other complex device types, split the
    functionality into two, one where the fdt node isn't closed and the
    other one to create a simple DT node.
    
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_arm.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 23c76dae88..500904d2fa 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -907,9 +907,9 @@ static int make_xen_iommu_node(libxl__gc *gc, void *fdt)
     return 0;
 }
 
-static int make_virtio_mmio_node(libxl__gc *gc, void *fdt,
-                                 uint64_t base, uint32_t irq,
-                                 uint32_t backend_domid)
+/* The caller is responsible to complete / close the fdt node */
+static int make_virtio_mmio_node_common(libxl__gc *gc, void *fdt, uint64_t base,
+                                        uint32_t irq, uint32_t backend_domid)
 {
     int res;
     gic_interrupt intr;
@@ -942,10 +942,18 @@ static int make_virtio_mmio_node(libxl__gc *gc, void *fdt,
         if (res) return res;
     }
 
-    res = fdt_end_node(fdt);
+    return res;
+}
+
+static int make_virtio_mmio_node(libxl__gc *gc, void *fdt, uint64_t base,
+                                 uint32_t irq, uint32_t backend_domid)
+{
+    int res;
+
+    res = make_virtio_mmio_node_common(gc, fdt, base, irq, backend_domid);
     if (res) return res;
 
-    return 0;
+    return fdt_end_node(fdt);
 }
 
 static const struct arch_info *get_arch_info(libxl__gc *gc,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 07 08:56:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Dec 2022 08:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456062.713754 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qE3-0003wB-Vb; Wed, 07 Dec 2022 08:56:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456062.713754; Wed, 07 Dec 2022 08:56:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2qE3-0003w3-Sv; Wed, 07 Dec 2022 08:56:23 +0000
Received: by outflank-mailman (input) for mailman id 456062;
 Wed, 07 Dec 2022 08:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qE2-0003vl-La
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qE2-0002qb-Kr
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2qE2-000684-K1
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 08:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QRAtiJul+OAzMXEsnw4/kWFKbT2BH6rgAexSMrNrJ1c=; b=0ZDdo1TDny63hEqe9FRM1NWREy
	Op8Nrl152VRsvVOS31x49DGqPwkZihNLA0fDeRx9Wq/9UK5iW3leS1RWxY6Y08DY4pI/CQ19jr7AY
	57vanFfKmoGieE4/lPapog/unchqoW3nKB181lHlHW9KxcYF4uJkZZuQKix0ouYVjpno=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: arm: make creation of iommu node independent of disk device
Message-Id: <E1p2qE2-000684-K1@xenbits.xenproject.org>
Date: Wed, 07 Dec 2022 08:56:22 +0000

commit b926dbcccaa92831dda37576f768ddab9ec8a701
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Fri Sep 9 20:13:28 2022 +0530
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Dec 6 18:19:50 2022 +0000

    libxl: arm: make creation of iommu node independent of disk device
    
    The iommu node will be required for other virtio device types too, not
    just disk device.
    
    Move the call to make_xen_iommu_node(), out of the disk device specific
    block and rename "iommu_created" variable to "iommu_needed", and set it
    to true for virtio disk device.
    
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
---
 tools/libs/light/libxl_arm.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 500904d2fa..fa3d61f1e8 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -1157,7 +1157,7 @@ static int libxl__prepare_dtb(libxl__gc *gc, libxl_domain_config *d_config,
     size_t fdt_size = 0;
     int pfdt_size = 0;
     libxl_domain_build_info *const info = &d_config->b_info;
-    bool iommu_created;
+    bool iommu_needed = false;
     unsigned int i;
 
     const libxl_version_info *vers;
@@ -1265,22 +1265,25 @@ next_resize:
         if (d_config->num_pcidevs)
             FDT( make_vpci_node(gc, fdt, ainfo, dom) );
 
-        iommu_created = false;
         for (i = 0; i < d_config->num_disks; i++) {
             libxl_device_disk *disk = &d_config->disks[i];
 
             if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
-                if (disk->backend_domid != LIBXL_TOOLSTACK_DOMID &&
-                    !iommu_created) {
-                    FDT( make_xen_iommu_node(gc, fdt) );
-                    iommu_created = true;
-                }
+                if (disk->backend_domid != LIBXL_TOOLSTACK_DOMID)
+                    iommu_needed = true;
 
                 FDT( make_virtio_mmio_node(gc, fdt, disk->base, disk->irq,
                                            disk->backend_domid) );
             }
         }
 
+        /*
+         * The iommu node should be created only once for all virtio-mmio
+         * devices.
+         */
+        if (iommu_needed)
+            FDT( make_xen_iommu_node(gc, fdt) );
+
         if (pfdt)
             FDT( copy_partial_fdt(gc, fdt, pfdt) );
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 07 12:33:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Dec 2022 12:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456288.714044 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2tbi-0007l4-Mu; Wed, 07 Dec 2022 12:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456288.714044; Wed, 07 Dec 2022 12:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p2tbi-0007kw-KD; Wed, 07 Dec 2022 12:33:02 +0000
Received: by outflank-mailman (input) for mailman id 456288;
 Wed, 07 Dec 2022 12:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2tbh-0007kq-Sj
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 12:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2tbh-00088G-QY
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 12:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p2tbh-0006Bl-Pa
 for xen-changelog@lists.xenproject.org; Wed, 07 Dec 2022 12:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Hd0AAA4jwl5+GTnjijihR0ABAp9yI7C4BC7Y3/ar9+A=; b=0G6T4D9ldWvuOZ6Nzh0xt+l/xz
	WA0FqvGfnJNentq0EWqwK3Nqw+lZTzg3KzoDBxPq2b8batNXcgE+0q4b6U5EOs3Qt+biiTUnFxSwh
	eBhush4bnOHgSSnPNf5UlCeLY7J+90PuN2SCWtCmezZkHysxAe7RXltiSfPVmcWX4fS8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen/arm: Correct the p2m pool size calculations
Message-Id: <E1p2tbh-0006Bl-Pa@xenbits.xenproject.org>
Date: Wed, 07 Dec 2022 12:33:01 +0000

commit 042a5b7024e7b27f5806914b9d42099a48c8f893
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 20 12:14:30 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Dec 6 17:00:00 2022 -0800

    xen/arm: Correct the p2m pool size calculations
    
    Allocating or freeing p2m pages doesn't alter the size of the mempool; only
    the split between free and used pages.
    
    Right now, the hypercalls operate on the free subset of the pool, meaning that
    XEN_DOMCTL_get_paging_mempool_size varies with time as the guest shuffles its
    physmap, and XEN_DOMCTL_set_paging_mempool_size ignores the used subset of the
    pool and lets the guest grow unbounded.
    
    This fixes test-pagign-mempool on ARM so that the behaviour matches x86.
    
    This is part of XSA-409 / CVE-2022-33747.
    
    Fixes: cbea5a1149ca ("xen/arm: Allocate and free P2M pages from the P2M pool")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Release-acked-by: Henry Wang <Henry.Wang@arm.com>
---
 xen/arch/arm/p2m.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 6f87e17c1d..eba443ab23 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -78,7 +78,6 @@ static struct page_info *p2m_alloc_page(struct domain *d)
             spin_unlock(&d->arch.paging.lock);
             return NULL;
         }
-        d->arch.paging.p2m_total_pages--;
     }
     spin_unlock(&d->arch.paging.lock);
 
@@ -91,10 +90,7 @@ static void p2m_free_page(struct domain *d, struct page_info *pg)
     if ( is_hardware_domain(d) )
         free_domheap_page(pg);
     else
-    {
-        d->arch.paging.p2m_total_pages++;
         page_list_add_tail(pg, &d->arch.paging.p2m_freelist);
-    }
     spin_unlock(&d->arch.paging.lock);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Dec 08 04:11:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Dec 2022 04:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456806.714628 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p38FU-0001Hr-3p; Thu, 08 Dec 2022 04:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456806.714628; Thu, 08 Dec 2022 04: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 1p38FU-0001Hj-0s; Thu, 08 Dec 2022 04:11:04 +0000
Received: by outflank-mailman (input) for mailman id 456806;
 Thu, 08 Dec 2022 04:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p38FS-0001Hb-H1
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 04:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p38FS-0004IN-F5
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 04:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p38FS-00017V-DO
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 04: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Lbso5mIhKpVpDG/5HjOSjQELNutBIQsD1nx2ntyJhEY=; b=ZU0RAUiqvw8dzqCKB8PK3jALWw
	WJanVbwTZuX6DlN3CNUyc/pAHtfmuSp1+Hl4al0Yv+FAUTouOmATpCAkuPSQIlapPv8dARQ2v+iP3
	TZ5ZjOw0iBDwOxz/c/kyNLSmw/mTM7SmB/XLMiFiEykgA+nmYo41RnvUXBtW4A71ntXQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] Config.mk: Bump tags to 4.17.0 final
Message-Id: <E1p38FS-00017V-DO@xenbits.xenproject.org>
Date: Thu, 08 Dec 2022 04:11:02 +0000

commit 74e2a324e85a747761108a4a584d52b9591799c8
Author:     Julien Grall <julien@xen.org>
AuthorDate: Wed Dec 7 19:53:43 2022 +0000
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Dec 7 19:53:43 2022 +0000

    Config.mk: Bump tags to 4.17.0 final
    
    No actual change to the code since RC4.
    
    Signed-off-by: Julien Grall <julien@xen.org>
---
 Config.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Config.mk b/Config.mk
index 7c3c499f80..d1f569f567 100644
--- a/Config.mk
+++ b/Config.mk
@@ -229,15 +229,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.17.0-rc4
-MINIOS_UPSTREAM_REVISION ?= xen-4.17.0-rc4
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.17.0
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.17.0
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.17.0-rc4
+QEMU_TRADITIONAL_REVISION ?= xen-4.17.0
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 08 04:11:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Dec 2022 04:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456807.714632 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p38Fe-0001Jn-5K; Thu, 08 Dec 2022 04:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456807.714632; Thu, 08 Dec 2022 04:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p38Fe-0001Jf-2S; Thu, 08 Dec 2022 04:11:14 +0000
Received: by outflank-mailman (input) for mailman id 456807;
 Thu, 08 Dec 2022 04:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p38Fc-0001JW-Ii
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 04:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p38Fc-0004IT-I6
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 04:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p38Fc-00017z-HC
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 04: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eQXOyczMYnEtQE0/AGf8ga2+OZkgh4K32d2sS58FKgE=; b=5MA2f3vYXvgs6NCbbXQdjX94ow
	dcNtncrqbnqeqPiMFS6OuiNkFF3d9EDFMhyQPzd8gbiSY8jHu7A20YtdnQUVy2xlkkmDAVGDxqi6w
	kNz3BL4kBMWKhhHc2sdESaA//iV/LMjnMdhYwFL9UJgLNSqhlvpeZfrMjAfpOyBi1AqE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] README: make heading say 4.17
Message-Id: <E1p38Fc-00017z-HC@xenbits.xenproject.org>
Date: Thu, 08 Dec 2022 04:11:12 +0000

commit 9da9560a53f485a4d1f82cff462151503f6bb770
Author:     Julien Grall <julien@xen.org>
AuthorDate: Wed Dec 7 20:01:21 2022 +0000
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Dec 7 20:09:38 2022 +0000

    README: make heading say 4.17
---
 README | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/README b/README
index 2fdca8861b..a947e8f3e3 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
-###############################################
+###################################
 __  __            _  _    _ _____
-\ \/ /___ _ __   | || |  / |___  |    _ __ ___
- \  // _ \ '_ \  | || |_ | |  / /____| '__/ __|
- /  \  __/ | | | |__   _|| | / /_____| | | (__
-/_/\_\___|_| |_|    |_|(_)_|/_/      |_|  \___|
+\ \/ /___ _ __   | || |  / |___  |
+ \  // _ \ '_ \  | || |_ | |  / /
+ /  \  __/ | | | |__   _|| | / /
+/_/\_\___|_| |_|    |_|(_)_|/_/
 
-###############################################
+##################################
 
 https://www.xen.org/
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 08 04:11:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Dec 2022 04:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456808.714636 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p38Fo-0001Mn-6v; Thu, 08 Dec 2022 04:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456808.714636; Thu, 08 Dec 2022 04: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 1p38Fo-0001Me-3r; Thu, 08 Dec 2022 04:11:24 +0000
Received: by outflank-mailman (input) for mailman id 456808;
 Thu, 08 Dec 2022 04:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p38Fm-0001MO-ME
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 04:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p38Fm-0004Im-LW
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 04:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p38Fm-00018U-K4
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 04: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v+0zJZO1niZJdjGOcaEgTNVvGjidt3dd+20bj+Z5wmk=; b=xNrRj1tG09PDB14tVMUqLxx6TT
	Nb3+63e8fxr7tIb4mJ+c/4m3E3XwBJ8Hoc55q+5/DGvRvhSE49Bs/Ni82wJbFTnHMinisbSVk+A3z
	BuQ/vlT8VdPj3o+xYWVvjFhu42c6MrksmWtY0mecncHRNrGld6lQlDc5Oa++WlvqzZKc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] CHANGELOG: Set 4.17 release date and tag
Message-Id: <E1p38Fm-00018U-K4@xenbits.xenproject.org>
Date: Thu, 08 Dec 2022 04:11:22 +0000

commit 7b96d2d71b950c31105e312733934328442b5ac2
Author:     Henry Wang <Henry.Wang@arm.com>
AuthorDate: Thu Dec 1 19:39:09 2022 +0800
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Dec 7 20:09:41 2022 +0000

    CHANGELOG: Set 4.17 release date and tag
    
    Signed-off-by: Henry Wang <Henry.Wang@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5d686a4258..7f4d0f25e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
-## [4.17.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging)
+## [4.17.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.17.0) - 2022-12-12
 
 ### Changed
  - On x86 "vga=current" can now be used together with GrUB2's gfxpayload setting. Note that
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 08 04:11:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Dec 2022 04:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456809.714641 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p38Fy-0001PP-9R; Thu, 08 Dec 2022 04:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456809.714641; Thu, 08 Dec 2022 04: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 1p38Fy-0001PF-5U; Thu, 08 Dec 2022 04:11:34 +0000
Received: by outflank-mailman (input) for mailman id 456809;
 Thu, 08 Dec 2022 04:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p38Fw-0001P2-PH
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 04:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p38Fw-0004Iy-OW
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 04:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p38Fw-000195-NX
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 04: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6uiSm1e3Ndl65oIJrs3MvdWtnqovpZaGNxApCJcsgGw=; b=N9T/BoYdLR+XPkyqxRP9b2BuXx
	mU7AVNKO2Sm+ye+4wDhFsqy8MiJwJq14Wb0K+dMY9RdXHrJxIqpV827y7vzDY8JF9Yl6jMOym31je
	3zcoerghhfcplat+iZdlbuJIyHnypIIvK33h7/x+9Fc7ErtFwjbPuu3MNjRaDK9vIcNQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] Set 4.17 version
Message-Id: <E1p38Fw-000195-NX@xenbits.xenproject.org>
Date: Thu, 08 Dec 2022 04:11:32 +0000

commit 4aa115ea4e92ffc787fa17a4bd1f2cb903457412
Author:     Julien Grall <julien@xen.org>
AuthorDate: Wed Dec 7 20:08:16 2022 +0000
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Dec 7 20:09:41 2022 +0000

    Set 4.17 version
    
    Signed-off-by: Julien Grall <julien@xen.org>
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 9d0df5e2c5..d7102a3b47 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    = 17
-export XEN_EXTRAVERSION ?= -rc$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .0$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 08 10:11:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Dec 2022 10:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456990.714798 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3Drr-0002ej-Tt; Thu, 08 Dec 2022 10:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456990.714798; Thu, 08 Dec 2022 10: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 1p3Drr-0002eb-R4; Thu, 08 Dec 2022 10:11:03 +0000
Received: by outflank-mailman (input) for mailman id 456990;
 Thu, 08 Dec 2022 10:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3Drq-0002eV-6n
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 10:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3Drq-00055z-58
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 10:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3Drq-0000Sd-3I
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 10: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p5LZHx1FgjsI3N9DpjE8lO+DwN6qYARTEAtRqimSRCE=; b=Nds+atVJR6tB28zM2AA2SKzgV1
	iLq9eiztfTMwt+bxUhB9aUqcokFk7Ui7HRGFAuwXwMyCSN25g/2+oKjnTUPOVtpaaFq38F83v9q2q
	0Ety8EXFg+lx5CTzZwnX4e7UeBupkRNyyKGCwOWtJ07keaS2lCaOfcE0Xi6061HhhZZ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: drop stale check from hvm_load_cpu_msrs()
Message-Id: <E1p3Drq-0000Sd-3I@xenbits.xenproject.org>
Date: Thu, 08 Dec 2022 10:11:02 +0000

commit 60737ee9c590bea87c190a9421f2c19a41224c4a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Dec 7 12:16:08 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 7 12:16:08 2022 +0100

    x86/HVM: drop stale check from hvm_load_cpu_msrs()
    
    Up until f61685a66903 ("x86: remove defunct init/load/save_msr()
    hvm_funcs") the check of the _rsvd field served as an error check for
    the earlier hvm_funcs.save_msr() invocation. With that invocation gone
    the check makes no sense anymore: It is effectively dead code due to the
    checking of the field in the earlier loop.
    
    While dropping the conditional also eliminate the "err" local variable
    (using a non-standard name anyway), replaced by suitable new/adjusted
    "return" statements.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/hvm.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 02f5f3b359..fbf8f2cf5f 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1428,7 +1428,6 @@ static int cf_check hvm_load_cpu_msrs(struct domain *d, hvm_domain_context_t *h)
     struct vcpu *v;
     const struct hvm_save_descriptor *desc;
     struct hvm_msr *ctxt;
-    int err = 0;
 
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
@@ -1479,7 +1478,7 @@ static int cf_check hvm_load_cpu_msrs(struct domain *d, hvm_domain_context_t *h)
             return -EOPNOTSUPP;
     /* Checking finished */
 
-    for ( i = 0; !err && i < ctxt->count; ++i )
+    for ( i = 0; i < ctxt->count; ++i )
     {
         switch ( ctxt->msr[i].index )
         {
@@ -1495,17 +1494,15 @@ static int cf_check hvm_load_cpu_msrs(struct domain *d, hvm_domain_context_t *h)
             rc = guest_wrmsr(v, ctxt->msr[i].index, ctxt->msr[i].val);
 
             if ( rc != X86EMUL_OKAY )
-                err = -ENXIO;
+                return -ENXIO;
             break;
 
         default:
-            if ( !ctxt->msr[i]._rsvd )
-                err = -ENXIO;
-            break;
+            return -ENXIO;
         }
     }
 
-    return err;
+    return 0;
 }
 
 /* We need variable length data chunks for XSAVE area and MSRs, hence
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 08 10:11:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Dec 2022 10:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456991.714802 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3Ds1-0002gR-Vk; Thu, 08 Dec 2022 10:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456991.714802; Thu, 08 Dec 2022 10:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3Ds1-0002gJ-Se; Thu, 08 Dec 2022 10:11:13 +0000
Received: by outflank-mailman (input) for mailman id 456991;
 Thu, 08 Dec 2022 10:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3Ds0-0002g5-9O
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 10:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3Ds0-000565-8X
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 10:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3Ds0-0000T8-7N
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 10: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1jZojZAWlrmjppdOjo7+oBgGcX9IxnfEqCRGM42Sf/0=; b=KdwsBnUrmupLcTubpn8oqXfUB9
	/XUjV1t54HvQEpxtP9R0O+Sj1JBb34embdZA1nUEy2vqUDL+7Ze+YHqZl+avvwMKRqRBBZ1x5K/vd
	OkpTVZ7j3dTaBCdxzQTgogVPpH/aUI5zfeXDs4ybuvquOqvz0lcQNhhID/dSfPhmHT1g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: remove trigraphs from comments
Message-Id: <E1p3Ds0-0000T8-7N@xenbits.xenproject.org>
Date: Thu, 08 Dec 2022 10:11:12 +0000

commit 51c5b8b9afe9c6c63f6f2a55f467118c40cff976
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Dec 7 12:16:49 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 7 12:16:49 2022 +0100

    xen: remove trigraphs from comments
    
    MISRA C rule 4.2 states that trigraphs (sequences of two question marks
    followed by a specified third character [=/'()!<>-]) should not be used.
    This applies to both code and comments. Thankfully, we do not use them
    in the code, but still there are some comments where they are
    accidentally used. Fix it.
    
    With regards to the comments and respective macros in pci_regs.h, these
    were inherited from Linux. Let's knowingly accept the divergence.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/x86/x86_emulate/x86_emulate.h |  2 +-
 xen/include/public/arch-x86_64.h       |  2 +-
 xen/include/xen/pci_regs.h             | 12 ++++++------
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index 4732855c40..bb7af967ff 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -228,7 +228,7 @@ struct x86_emulate_ops
      * All functions:
      *  @ctxt:  [IN ] Emulation context info as passed to the emulator.
      * All memory-access functions:
-     *  @seg:   [IN ] Segment being dereferenced (specified as x86_seg_??).
+     *  @seg:   [IN ] Segment being dereferenced (specified as x86_seg_?).
      *  @offset:[IN ] Offset within segment.
      *  @p_data:[IN ] Pointer to i/o data buffer (length is @bytes)
      * Read functions:
diff --git a/xen/include/public/arch-x86_64.h b/xen/include/public/arch-x86_64.h
index 5db52de695..acf705f25e 100644
--- a/xen/include/public/arch-x86_64.h
+++ b/xen/include/public/arch-x86_64.h
@@ -22,5 +22,5 @@
  * A similar callback occurs if the segment selectors are invalid.
  * failsafe_address is used as the value of eip.
  *
- * On x86_64, event_selector and failsafe_selector are ignored (???).
+ * On x86_64, event_selector and failsafe_selector are ignored (?!?).
  */
diff --git a/xen/include/xen/pci_regs.h b/xen/include/xen/pci_regs.h
index ee8e82be36..a90aff1712 100644
--- a/xen/include/xen/pci_regs.h
+++ b/xen/include/xen/pci_regs.h
@@ -246,13 +246,13 @@
 #define  PCI_PM_CTRL_STATE_MASK	0x0003	/* Current power state (D0 to D3) */
 #define  PCI_PM_CTRL_NO_SOFT_RESET	0x0008	/* No reset for D3hot->D0 */
 #define  PCI_PM_CTRL_PME_ENABLE	0x0100	/* PME pin enable */
-#define  PCI_PM_CTRL_DATA_SEL_MASK	0x1e00	/* Data select (??) */
-#define  PCI_PM_CTRL_DATA_SCALE_MASK	0x6000	/* Data scale (??) */
+#define  PCI_PM_CTRL_DATA_SEL_MASK	0x1e00	/* Data select (?) */
+#define  PCI_PM_CTRL_DATA_SCALE_MASK	0x6000	/* Data scale (?) */
 #define  PCI_PM_CTRL_PME_STATUS	0x8000	/* PME pin status */
-#define PCI_PM_PPB_EXTENSIONS	6	/* PPB support extensions (??) */
-#define  PCI_PM_PPB_B2_B3	0x40	/* Stop clock when in D3hot (??) */
-#define  PCI_PM_BPCC_ENABLE	0x80	/* Bus power/clock control enable (??) */
-#define PCI_PM_DATA_REGISTER	7	/* (??) */
+#define PCI_PM_PPB_EXTENSIONS	6	/* PPB support extensions (?) */
+#define  PCI_PM_PPB_B2_B3	0x40	/* Stop clock when in D3hot (?) */
+#define  PCI_PM_BPCC_ENABLE	0x80	/* Bus power/clock control enable (?) */
+#define PCI_PM_DATA_REGISTER	7	/* (?) */
 #define PCI_PM_SIZEOF		8
 
 /* AGP registers */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 08 10:11:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Dec 2022 10:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456992.714806 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3DsC-0002j3-0w; Thu, 08 Dec 2022 10:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456992.714806; Thu, 08 Dec 2022 10:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3DsB-0002iv-UH; Thu, 08 Dec 2022 10:11:23 +0000
Received: by outflank-mailman (input) for mailman id 456992;
 Thu, 08 Dec 2022 10:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3DsA-0002iO-DD
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 10:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3DsA-00056P-CO
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 10:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3DsA-0000Td-Ad
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 10: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DZT/6HQP7yD1HpMb3nsxWp7R6iqjfx4wWluJ8rUuaxU=; b=a2o+/hMgcnRDM9HLbkvTtPvGMv
	NJlVDOE9QQDufde3WUCylsLx9v9GJtTz3N0JEIiMdcJl8KZVvm22FRJch1EKqxXNziyBs1JY2cfRQ
	XCbBqLbXyAOklJd3lu31g6EvJOGH1Y0oYWoHgQTOre+R/6leCkPoFc3H0IRrkZOtCYAo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ioreq_broadcast(): accept partial broadcast success
Message-Id: <E1p3DsA-0000Td-Ad@xenbits.xenproject.org>
Date: Thu, 08 Dec 2022 10:11:22 +0000

commit a44734df6c24fadbdb001f051cc5580c467caf7d
Author:     Per Bilse <per.bilse@citrix.com>
AuthorDate: Wed Dec 7 12:17:30 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 7 12:17:30 2022 +0100

    ioreq_broadcast(): accept partial broadcast success
    
    Avoid incorrectly triggering an error when a broadcast buffered ioreq
    is not handled by all registered clients, as long as the failure is
    strictly because the client doesn't handle buffered ioreqs.
    
    Signed-off-by: Per Bilse <per.bilse@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/common/ioreq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c
index 4617aef29b..ecb8f545e1 100644
--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -1317,7 +1317,8 @@ unsigned int ioreq_broadcast(ioreq_t *p, bool buffered)
 
     FOR_EACH_IOREQ_SERVER(d, id, s)
     {
-        if ( !s->enabled )
+        if ( !s->enabled ||
+             (buffered && s->bufioreq_handling == HVM_IOREQSRV_BUFIOREQ_OFF) )
             continue;
 
         if ( ioreq_send(s, p, buffered) == IOREQ_STATUS_UNHANDLED )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 08 10:11:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Dec 2022 10:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.456993.714810 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3DsM-0002lv-2E; Thu, 08 Dec 2022 10:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 456993.714810; Thu, 08 Dec 2022 10: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 1p3DsL-0002ln-Vj; Thu, 08 Dec 2022 10:11:33 +0000
Received: by outflank-mailman (input) for mailman id 456993;
 Thu, 08 Dec 2022 10:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3DsK-0002lf-GN
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 10:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3DsK-00056a-Fe
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 10:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3DsK-0000UF-EY
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 10: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u+yXlc+aU9B6OGOFaLP7jKc4n4v45exOR5tlaL9l6YQ=; b=JhslqJ2C7lt0pgjuWaTb6jfxy9
	qDVkzO5SUGRlGca0qgUUj7pwvSNNjPMRXcOW+ghOtZHHFnPk3ah5bLKzaJWb7r+YLokN1dyr+Fh52
	3XPs2a0IFxB0XxgBo9axQscLShVTmtBEMkecnWQHMfN6OUOLxMDMImN4lBuctuRCQ9yQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/platform: protect XENPF_get_dom0_console if CONFIG_VIDEO not set
Message-Id: <E1p3DsK-0000UF-EY@xenbits.xenproject.org>
Date: Thu, 08 Dec 2022 10:11:32 +0000

commit 11b4ff64841efd9724e5c1fce81ec2b5484b8d57
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Dec 7 12:18:36 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 7 12:18:36 2022 +0100

    x86/platform: protect XENPF_get_dom0_console if CONFIG_VIDEO not set
    
    A build failure [1] is observed if CONFIG_VGA (and thus CONFIG_VIDEO) is
    not set. This is because XENPF_get_dom0_console cmd of platform hypercall
    makes a call to fill_console_start_info, which is defined in video/vga.c
    and built only if CONFIG_VGA is set.
    
    To fix this issue, protect XENPF_get_dom0_console with CONFIG_VIDEO
    ifdefery.
    
    [1]:
    ld: prelink.o: in function `do_platform_op':
    (.text.do_platform_op+0x1a7): undefined reference to `fill_console_start_info'
    
    Fixes: 4dd160583c79 ("x86/platform: introduce hypercall to get initial video console settings")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/platform_hypercall.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index 3f0d0389af..08ab2fea62 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -839,6 +839,7 @@ ret_t do_platform_op(
     }
     break;
 
+#ifdef CONFIG_VIDEO
     case XENPF_get_dom0_console:
         if ( !fill_console_start_info(&op->u.dom0_console) )
         {
@@ -849,6 +850,7 @@ ret_t do_platform_op(
         if ( copy_field_to_guest(u_xenpf_op, op, u.dom0_console) )
             ret = -EFAULT;
         break;
+#endif
 
     default:
         ret = -ENOSYS;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 08 22:55:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Dec 2022 22:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.457471.715380 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3PnC-0007cs-Se; Thu, 08 Dec 2022 22:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 457471.715380; Thu, 08 Dec 2022 22: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 1p3PnC-0007cj-Pb; Thu, 08 Dec 2022 22:55:02 +0000
Received: by outflank-mailman (input) for mailman id 457471;
 Thu, 08 Dec 2022 22:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3PnB-0007cd-ML
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 22:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3PnB-0006j3-LW
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 22:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3PnB-0004oF-KS
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Bx5X1nOaaQ0/UeXEL+JYwqlrgCh5Yr7TFbrPEXyBcEo=; b=hLsEFs+SJt1fWxsjKb/MhIs8ro
	UIE9jAbofz4MEO5UqXZ3Pp6iCNFnIzMIYUlmB6yhWkzYWMJyvA+XGzGtx1yV/aUiBZYQQ1uJIQumZ
	mfiSJnqesRvAxUk1T/VZeVNjrUW7nksYjYo9eipQF2BzjzUVfe1LpHmryxU8VVw535ls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG: Set 4.17 release date and tag
Message-Id: <E1p3PnB-0004oF-KS@xenbits.xenproject.org>
Date: Thu, 08 Dec 2022 22:55:01 +0000

commit 0829a2f3fcaba9233dfdce9a8cee9d126a51bd4d
Author:     Henry Wang <Henry.Wang@arm.com>
AuthorDate: Thu Dec 1 19:39:09 2022 +0800
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Dec 7 20:13:58 2022 +0000

    CHANGELOG: Set 4.17 release date and tag
    
    Signed-off-by: Henry Wang <Henry.Wang@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5d686a4258..7f4d0f25e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
-## [4.17.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging)
+## [4.17.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.17.0) - 2022-12-12
 
 ### Changed
  - On x86 "vga=current" can now be used together with GrUB2's gfxpayload setting. Note that
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 08 22:55:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Dec 2022 22:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.457472.715384 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3PnM-0007fn-UQ; Thu, 08 Dec 2022 22:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 457472.715384; Thu, 08 Dec 2022 22:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3PnM-0007fe-R5; Thu, 08 Dec 2022 22:55:12 +0000
Received: by outflank-mailman (input) for mailman id 457472;
 Thu, 08 Dec 2022 22:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3PnL-0007eg-PX
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 22:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3PnL-0006jj-Oj
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 22:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3PnL-0004os-Na
 for xen-changelog@lists.xenproject.org; Thu, 08 Dec 2022 22:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ubyUIsVdQYvgP5f+mjsCMiOmSZQHo+qj0CJ3ujEL2F4=; b=3r4jEAo1UKi1L/PDklg4VAW35G
	oclRTTrHLznsIFgjEnEcqeWHl+t23y402dyjijgxTQ60M1GjlbZuEGUF8odJif+wsj1tKheLkt56j
	nH00+EX+8gPBevQE4Heblsa9wExwwZKeTZ9fAaouHWWN9rpI4XThHYGPM5ddBrF9hKw0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG: Start new "unstable" section
Message-Id: <E1p3PnL-0004os-Na@xenbits.xenproject.org>
Date: Thu, 08 Dec 2022 22:55:11 +0000

commit af50d9be4358f26c459459eeaa3f6a1a66821738
Author:     Henry Wang <Henry.Wang@arm.com>
AuthorDate: Thu Dec 1 19:39:10 2022 +0800
Commit:     Julien Grall <julien@xen.org>
CommitDate: Wed Dec 7 20:13:58 2022 +0000

    CHANGELOG: Start new "unstable" section
    
    Signed-off-by: Henry Wang <Henry.Wang@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7f4d0f25e9..6754139713 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@ 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/)
 
+## [unstable UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
+
 ## [4.17.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.17.0) - 2022-12-12
 
 ### Changed
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 09 07:33:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Dec 2022 07:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.457656.715619 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3XsV-0003jP-CO; Fri, 09 Dec 2022 07:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 457656.715619; Fri, 09 Dec 2022 07: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 1p3XsV-0003jF-9M; Fri, 09 Dec 2022 07:33:03 +0000
Received: by outflank-mailman (input) for mailman id 457656;
 Fri, 09 Dec 2022 07:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3XsU-0003j9-3p
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 07:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3XsU-0001mk-1X
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 07:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3XsU-0002Gb-0Q
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=denbbWxMUPouGfav9l0RjXOtVnHM0k/ylfV7Or6Sz4M=; b=7LsM37GNeDOXBaCTSIvGygk6n+
	ofkxOPpI2qFl6VEJwlpuSpgQIVu0WOBjT0uei/EEnARKlQb+KEpjYhJvqAxxoHk+Gg7ZdOMAMlGLN
	isk5M75rZHAm79C5zJzx/4yuLfyQNgieXvtYVmNeFWvT0fQbR1/BLCsS1bpC1rSI1QZE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] SUPPORT.md: Define support lifetime
Message-Id: <E1p3XsU-0002Gb-0Q@xenbits.xenproject.org>
Date: Fri, 09 Dec 2022 07:33:02 +0000

commit d50a866d88ea31aebca639b8400cae6699bbc012
Author:     Julien Grall <julien@xen.org>
AuthorDate: Wed Dec 7 19:59:07 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 8 17:57:30 2022 +0000

    SUPPORT.md: Define support lifetime
    
    Signed-off-by: Julien Grall <julien@xen.org>
    Release-acked-by: Henry Wang <Henry.Wang@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 765dd15685..cb504eec1e 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -10,9 +10,9 @@ for the definitions of the support status levels etc.
 # Release Support
 
     Xen-Version: 4.17
-    Initial-Release: n/a
-    Supported-Until: TBD
-    Security-Support-Until: Unreleased - not yet security-supported
+    Initial-Release: 2022-12-12
+    Supported-Until: 2024-06-12
+    Security-Support-Until: 2025-12-12
 
 Release Notes
 : <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.17_Release_Notes">RN</a>
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Dec 09 07:33:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Dec 2022 07:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.457657.715623 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3Xsf-0003l6-DZ; Fri, 09 Dec 2022 07:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 457657.715623; Fri, 09 Dec 2022 07: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 1p3Xsf-0003ky-As; Fri, 09 Dec 2022 07:33:13 +0000
Received: by outflank-mailman (input) for mailman id 457657;
 Fri, 09 Dec 2022 07:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3Xse-0003ko-5M
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 07:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3Xse-0001n9-4d
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 07:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3Xse-0002H4-3i
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mLfTcCqMfJ77cGvMc2O8/xXAX+WxKfn0zV85CUGYfAk=; b=0NrRqh/lhQ6cKeTA2G0fphVtcS
	wgB03Zx2UkXkwPPrUi8Xeyt5PkFJfueOd8qILxUEiTdYS7tlOLTRSYfbvMjekcLGt414/YvFK+K+5
	qHJ1FtRJN3l5QaxGfX8phBAtAsW7GdxAqBAukN6GJJz5JAvtPx74mty6OBTOp/ByqW+4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] Use EfiACPIReclaimMemory for ESRT
Message-Id: <E1p3Xse-0002H4-3i@xenbits.xenproject.org>
Date: Fri, 09 Dec 2022 07:33:12 +0000

commit 11560248ffda3f00f20bbdf3ae088af474f7f2a3
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Mon Oct 10 23:42:03 2022 -0400
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 8 18:03:08 2022 +0000

    Use EfiACPIReclaimMemory for ESRT
    
    A previous patch tried to get Linux to use the ESRT under Xen if it is
    in memory of type EfiRuntimeServicesData.  However, this turns out to be
    a bad idea.  Ard Biesheuvel pointed out that EfiRuntimeServices* memory
    winds up fragmenting both the EFI page tables and the direct map, and
    that EfiACPIReclaimMemory is a much better choice for this purpose.
    
    Link: https://lists.xenproject.org/archives/html/xen-devel/2022-09/msg01365.html
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Release-acked-by: Henry Wang <Henry.Wang@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit d7669c101427c1504517418e832fb760ae89e6bc)
---
 xen/common/efi/boot.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index db0340c8e2..b3de1011ee 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -601,11 +601,14 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
     if ( physical_start > esrt || esrt - physical_start >= len )
         return 0;
     /*
-     * The specification requires EfiBootServicesData, but accept
-     * EfiRuntimeServicesData, which is a more logical choice.
+     * The specification requires EfiBootServicesData, but also accept
+     * EfiRuntimeServicesData (for compatibility with buggy firmware)
+     * and EfiACPIReclaimMemory (which will contain the tables after
+     * successful kexec).
      */
     if ( (desc->Type != EfiRuntimeServicesData) &&
-         (desc->Type != EfiBootServicesData) )
+         (desc->Type != EfiBootServicesData) &&
+         (desc->Type != EfiACPIReclaimMemory) )
         return 0;
     available_len = len - (esrt - physical_start);
     if ( available_len <= offsetof(EFI_SYSTEM_RESOURCE_TABLE, Entries) )
@@ -1144,18 +1147,19 @@ static void __init efi_relocate_esrt(EFI_SYSTEM_TABLE *SystemTable)
     for ( i = 0; i < info_size; i += mdesc_size )
     {
         /*
-         * ESRT needs to be moved to memory of type EfiRuntimeServicesData
+         * ESRT needs to be moved to memory of type EfiACPIReclaimMemory
          * so that the memory it is in will not be used for other purposes.
          */
         void *new_esrt = NULL;
-        size_t esrt_size = get_esrt_size(memory_map + i);
+        const EFI_MEMORY_DESCRIPTOR *desc = memory_map + i;
+        size_t esrt_size = get_esrt_size(desc);
 
         if ( !esrt_size )
             continue;
-        if ( ((EFI_MEMORY_DESCRIPTOR *)(memory_map + i))->Type ==
-             EfiRuntimeServicesData )
+        if ( desc->Type == EfiRuntimeServicesData ||
+             desc->Type == EfiACPIReclaimMemory )
             break; /* ESRT already safe from reuse */
-        status = efi_bs->AllocatePool(EfiRuntimeServicesData, esrt_size,
+        status = efi_bs->AllocatePool(EfiACPIReclaimMemory, esrt_size,
                                       &new_esrt);
         if ( status == EFI_SUCCESS && new_esrt )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Dec 09 09:11:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Dec 2022 09:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.457749.715731 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3ZPL-0004iX-3y; Fri, 09 Dec 2022 09:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 457749.715731; Fri, 09 Dec 2022 09: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 1p3ZPL-0004iP-0L; Fri, 09 Dec 2022 09:11:03 +0000
Received: by outflank-mailman (input) for mailman id 457749;
 Fri, 09 Dec 2022 09:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPJ-0004iE-Ra
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPJ-0004pf-Qp
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPJ-0006MP-Pl
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KrsfyHSW+46mExvSD+az5BPKWp8ydmPTZI2lYY1v0Qg=; b=hno9fCG8iwpMB7xu9jEFPpb86h
	vOoPKNQEcqO9ycDxxy8W9QPekDjIowY2YcDwBUG3qkUdr1m0UzLF80ALVErzkqulINdLNloSkA/By
	bmkzEY//jxtw7Po6AxRbTFShK183yk6Qd84OGyM8p9HwwjcZjzRPuIxpTXYtGygqCIHc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/irq: do not release irq until all cleanup is done
Message-Id: <E1p3ZPJ-0006MP-Pl@xenbits.xenproject.org>
Date: Fri, 09 Dec 2022 09:11:01 +0000

commit b6b3dc8d887b4d78b802c236d93dc792c8355074
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Dec 8 10:10:00 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 8 10:10:00 2022 +0100

    x86/irq: do not release irq until all cleanup is done
    
    Current code in _clear_irq_vector() will mark the irq as unused before
    doing the cleanup required when move_in_progress is true.
    
    This can lead to races in create_irq() if the function picks an irq
    desc that's been marked as unused but has move_in_progress set, as the
    call to assign_irq_vector() in that function can then fail with
    -EAGAIN.
    
    Prevent that by only marking irq descs as unused when all the cleanup
    has been done.  While there also use write_atomic() when setting
    IRQ_UNUSED in _clear_irq_vector() and add a barrier in order to
    prevent the setting of IRQ_UNUSED getting reordered by the compiler.
    
    The check for move_in_progress cannot be removed from
    _assign_irq_vector(), as other users (io_apic_set_pci_routing() and
    ioapic_guest_write()) can still pass active irq descs to
    assign_irq_vector().
    
    Note the trace point is not moved and is now set before the irq is
    marked as unused.  This is done so that the CPU mask provided in the
    trace point is the one belonging to the current vector, not the old
    one.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: e267d11969a40f0aec33dbf966f5a6490b205f43
    master date: 2022-12-02 10:32:21 +0100
---
 xen/arch/x86/irq.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 47b86af5dc..80ce9d624f 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -222,27 +222,28 @@ static void _clear_irq_vector(struct irq_desc *desc)
         clear_bit(vector, desc->arch.used_vectors);
     }
 
-    desc->arch.used = IRQ_UNUSED;
-
     trace_irq_mask(TRC_HW_IRQ_CLEAR_VECTOR, irq, vector, tmp_mask);
 
-    if ( likely(!desc->arch.move_in_progress) )
-        return;
+    if ( unlikely(desc->arch.move_in_progress) )
+    {
+        /* If we were in motion, also clear desc->arch.old_vector */
+        old_vector = desc->arch.old_vector;
+        cpumask_and(tmp_mask, desc->arch.old_cpu_mask, &cpu_online_map);
 
-    /* If we were in motion, also clear desc->arch.old_vector */
-    old_vector = desc->arch.old_vector;
-    cpumask_and(tmp_mask, desc->arch.old_cpu_mask, &cpu_online_map);
+        for_each_cpu(cpu, tmp_mask)
+        {
+            ASSERT(per_cpu(vector_irq, cpu)[old_vector] == irq);
+            TRACE_3D(TRC_HW_IRQ_MOVE_FINISH, irq, old_vector, cpu);
+            per_cpu(vector_irq, cpu)[old_vector] = ~irq;
+        }
 
-    for_each_cpu(cpu, tmp_mask)
-    {
-        ASSERT(per_cpu(vector_irq, cpu)[old_vector] == irq);
-        TRACE_3D(TRC_HW_IRQ_MOVE_FINISH, irq, old_vector, cpu);
-        per_cpu(vector_irq, cpu)[old_vector] = ~irq;
-    }
+        release_old_vec(desc);
 
-    release_old_vec(desc);
+        desc->arch.move_in_progress = 0;
+    }
 
-    desc->arch.move_in_progress = 0;
+    smp_wmb();
+    write_atomic(&desc->arch.used, IRQ_UNUSED);
 }
 
 void __init clear_irq_vector(int irq)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Dec 09 09:11:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Dec 2022 09:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.457750.715734 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3ZPV-0004ke-4U; Fri, 09 Dec 2022 09:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 457750.715734; Fri, 09 Dec 2022 09: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 1p3ZPV-0004kW-1p; Fri, 09 Dec 2022 09:11:13 +0000
Received: by outflank-mailman (input) for mailman id 457750;
 Fri, 09 Dec 2022 09:11:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPT-0004kQ-UR
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPT-0004pl-Tk
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPT-0006ND-Ss
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vMy7/JmxdQWHm4Ie1KYED/DNYBgFupEZ7KltxD/2rBU=; b=x3z4Ac1z7k7fjQ03EcHnAd1NoE
	BIVfVGDv+d7JpjMu/+tU49XBqEYm5N01U9h34qu/sudsyMXSiUQ+YdJUX5SQF5Pn3qx0jtlUPpyyb
	mg7ZMsPhhIME55NN4wlT81QMtlKgEYANsS01dXlwUkQQH7ApWTV7sN5EUkE7Yxa8qB8E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/pvh: do not forward MADT Local APIC NMI structures to dom0
Message-Id: <E1p3ZPT-0006ND-Ss@xenbits.xenproject.org>
Date: Fri, 09 Dec 2022 09:11:11 +0000

commit 09849cdd251443f22fb2ee07b2aaa7cd45546b5b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Dec 8 10:10:50 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 8 10:10:50 2022 +0100

    x86/pvh: do not forward MADT Local APIC NMI structures to dom0
    
    Currently Xen will passthrough any Local APIC NMI Structure found in
    the native ACPI MADT table to a PVH dom0.  This is wrong because PVH
    doesn't have access to the physical local APIC, and instead gets an
    emulated local APIC by Xen, that doesn't have the LINT0 or LINT1
    pins wired to anything.  Furthermore the ACPI Processor UIDs used in
    the APIC NMI Structures are likely to not match the ones generated by
    Xen for the Local x2APIC Structures, creating confusion to dom0.
    
    Fix this by removing the logic to passthrough the Local APIC NMI
    Structure for PVH dom0.
    
    Fixes: 1d74282c45 ('x86: setup PVHv2 Dom0 ACPI tables')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b39e6385250ccef9509af0eab9003ad5c1478842
    master date: 2022-12-02 10:33:40 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 34 +---------------------------------
 1 file changed, 1 insertion(+), 33 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 8048987286..862c73830f 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -58,9 +58,6 @@
 static unsigned int __initdata acpi_intr_overrides;
 static struct acpi_madt_interrupt_override __initdata *intsrcovr;
 
-static unsigned int __initdata acpi_nmi_sources;
-static struct acpi_madt_nmi_source __initdata *nmisrc;
-
 static unsigned int __initdata order_stats[MAX_ORDER + 1];
 
 static void __init print_order_stats(const struct domain *d)
@@ -761,25 +758,6 @@ static int __init acpi_set_intr_ovr(struct acpi_subtable_header *header,
     return 0;
 }
 
-static int __init acpi_count_nmi_src(struct acpi_subtable_header *header,
-                                     const unsigned long end)
-{
-    acpi_nmi_sources++;
-    return 0;
-}
-
-static int __init acpi_set_nmi_src(struct acpi_subtable_header *header,
-                                   const unsigned long end)
-{
-    const struct acpi_madt_nmi_source *src =
-        container_of(header, struct acpi_madt_nmi_source, header);
-
-    *nmisrc = *src;
-    nmisrc++;
-
-    return 0;
-}
-
 static int __init pvh_setup_acpi_madt(struct domain *d, paddr_t *addr)
 {
     struct acpi_table_madt *madt;
@@ -795,16 +773,11 @@ static int __init pvh_setup_acpi_madt(struct domain *d, paddr_t *addr)
     acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE,
                           acpi_count_intr_ovr, UINT_MAX);
 
-    /* Count number of NMI sources in the MADT. */
-    acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_count_nmi_src,
-                          UINT_MAX);
-
     max_vcpus = dom0_max_vcpus();
     /* Calculate the size of the crafted MADT. */
     size = sizeof(*madt);
     size += sizeof(*io_apic) * nr_ioapics;
     size += sizeof(*intsrcovr) * acpi_intr_overrides;
-    size += sizeof(*nmisrc) * acpi_nmi_sources;
     size += sizeof(*x2apic) * max_vcpus;
 
     madt = xzalloc_bytes(size);
@@ -860,12 +833,7 @@ static int __init pvh_setup_acpi_madt(struct domain *d, paddr_t *addr)
     acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_set_intr_ovr,
                           acpi_intr_overrides);
 
-    /* Setup NMI sources. */
-    nmisrc = (void *)intsrcovr;
-    acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_set_nmi_src,
-                          acpi_nmi_sources);
-
-    ASSERT(((void *)nmisrc - (void *)madt) == size);
+    ASSERT(((void *)intsrcovr - (void *)madt) == size);
     madt->header.length = size;
     /*
      * Calling acpi_tb_checksum here is a layering violation, but
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Dec 09 09:11:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Dec 2022 09:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.457751.715738 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3ZPf-0004nh-5y; Fri, 09 Dec 2022 09:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 457751.715738; Fri, 09 Dec 2022 09: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 1p3ZPf-0004na-3N; Fri, 09 Dec 2022 09:11:23 +0000
Received: by outflank-mailman (input) for mailman id 457751;
 Fri, 09 Dec 2022 09:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPe-0004nP-1i
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPe-0004qP-0T
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPd-0006O3-Vo
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09:11:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dDtGvtFRJCUgYkg8Utxla3QLCZ39S89zFuzgmZNVQpQ=; b=xa12uKWfOdBE4sZp3JKkj8aI2X
	zg/DtxjvX5gJ/jh2oEztTM/98nyfL6lVRANvOzASO0JWeSubgU8QHqNsBnUCxaJYIAIXOt8HB4AR2
	AwZc24rfk42aTdjOdaT6/kAW9xdY0pXOW3XP3aOB/VllozAWOdVQPl+UOVCpa8rPPooo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/HVM: don't mark external IRQs as pending when vLAPIC is disabled
Message-Id: <E1p3ZPd-0006O3-Vo@xenbits.xenproject.org>
Date: Fri, 09 Dec 2022 09:11:21 +0000

commit 07bbac08b594741480457c272c5f2d1feee3fbbd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Dec 8 10:11:32 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 8 10:11:32 2022 +0100

    x86/HVM: don't mark external IRQs as pending when vLAPIC is disabled
    
    In software-disabled state an LAPIC does not accept any interrupt
    requests and hence no IRR bit would newly become set while in this
    state. As a result it is also wrong for us to mark IO-APIC or MSI
    originating vectors as having a pending request when the vLAPIC is in
    this state. Such interrupts are simply lost.
    
    Introduce (IO-APIC) or re-use (MSI) a local variable to help
    readability.
    
    Fixes: 4fe21ad3712e ("This patch add virtual IOAPIC support for VMX guest")
    Fixes: 85715f4bc7c9 ("MSI 5/6: add MSI support to passthrough HVM domain")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: f1d7aac1e3c3cd164e17d41791a575a5c3e87121
    master date: 2022-12-02 10:35:01 +0100
---
 xen/arch/x86/hvm/vioapic.c |  9 +++++++--
 xen/arch/x86/hvm/vmsi.c    | 10 ++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index 553c0f76ef..0def33cecf 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -460,9 +460,14 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
 
     case dest_Fixed:
         for_each_vcpu ( d, v )
-            if ( vlapic_match_dest(vcpu_vlapic(v), NULL, 0, dest, dest_mode) )
-                ioapic_inj_irq(vioapic, vcpu_vlapic(v), vector, trig_mode,
+        {
+            struct vlapic *vlapic = vcpu_vlapic(v);
+
+            if ( vlapic_enabled(vlapic) &&
+                 vlapic_match_dest(vlapic, NULL, 0, dest, dest_mode) )
+                ioapic_inj_irq(vioapic, vlapic, vector, trig_mode,
                                delivery_mode);
+        }
         break;
 
     case dest_NMI:
diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index 13e2a190b4..235705c8c6 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -87,10 +87,12 @@ int vmsi_deliver(
 
     case dest_Fixed:
         for_each_vcpu ( d, v )
-            if ( vlapic_match_dest(vcpu_vlapic(v), NULL,
-                                   0, dest, dest_mode) )
-                vmsi_inj_irq(vcpu_vlapic(v), vector,
-                             trig_mode, delivery_mode);
+        {
+            target = vcpu_vlapic(v);
+            if ( vlapic_enabled(target) &&
+                 vlapic_match_dest(target, NULL, 0, dest, dest_mode) )
+                vmsi_inj_irq(target, vector, trig_mode, delivery_mode);
+        }
         break;
 
     default:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Dec 09 09:11:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Dec 2022 09:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.457752.715742 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3ZPp-0004qs-8r; Fri, 09 Dec 2022 09:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 457752.715742; Fri, 09 Dec 2022 09: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 1p3ZPp-0004qk-6C; Fri, 09 Dec 2022 09:11:33 +0000
Received: by outflank-mailman (input) for mailman id 457752;
 Fri, 09 Dec 2022 09:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPo-0004qY-48
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPo-0004qb-3T
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPo-0006Ou-2V
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nZZyQPrE0pz0yiJkA4piPKs0Oyvsnk4SYNJm0xXtUuc=; b=aWfU3V0xgevGgAmoVkBOj7dV1d
	qTCFSHjnfS6fvoj+Rv3voMyl8nJdI7zkUtmxnfaP2gCG+t2LZJevC/H8N/iAnYT6F+rFU9+Oy1XST
	+Bv550uYrIcZR0+S8CayRegFWkYzwt1QPKVH6OAd4idQ5tFJGgNd421kLF4V6avrvXRI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/Viridian: don't mark IRQ vectors as pending when vLAPIC is disabled
Message-Id: <E1p3ZPo-0006Ou-2V@xenbits.xenproject.org>
Date: Fri, 09 Dec 2022 09:11:32 +0000

commit a61f93d59742986d3119124bbe7a77fdcdf98a38
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Dec 8 10:12:02 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 8 10:12:02 2022 +0100

    x86/Viridian: don't mark IRQ vectors as pending when vLAPIC is disabled
    
    In software-disabled state an LAPIC does not accept any interrupt
    requests and hence no IRR bit would newly become set while in this
    state. As a result it is also wrong for us to mark Viridian IPI or timer
    vectors as having a pending request when the vLAPIC is in this state.
    Such interrupts are simply lost.
    
    Introduce a local variable in send_ipi() to help readability.
    
    Fixes: fda96b7382ea ("viridian: add implementation of the HvSendSyntheticClusterIpi hypercall")
    Fixes: 26fba3c85571 ("viridian: add implementation of synthetic timers")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    master commit: 831419f82913417dee4e5b0f80769c5db590540b
    master date: 2022-12-02 10:35:32 +0100
---
 xen/arch/x86/hvm/viridian/synic.c    | 2 +-
 xen/arch/x86/hvm/viridian/viridian.c | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index 22e2df27e5..21f760fd24 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -350,7 +350,7 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
     BUILD_BUG_ON(sizeof(payload) > sizeof(msg->u.payload));
     memcpy(msg->u.payload, &payload, sizeof(payload));
 
-    if ( !vs->masked )
+    if ( !vs->masked && vlapic_enabled(vcpu_vlapic(v)) )
         vlapic_set_irq(vcpu_vlapic(v), vs->vector, 0);
 
     return true;
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 7d1cfc530b..ff4d83193b 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -831,7 +831,12 @@ static void send_ipi(struct hypercall_vpmask *vpmask, uint8_t vector)
         cpu_raise_softirq_batch_begin();
 
     for_each_vp ( vpmask, vp )
-        vlapic_set_irq(vcpu_vlapic(currd->vcpu[vp]), vector, 0);
+    {
+        struct vlapic *vlapic = vcpu_vlapic(currd->vcpu[vp]);
+
+        if ( vlapic_enabled(vlapic) )
+            vlapic_set_irq(vlapic, vector, 0);
+    }
 
     if ( nr > 1 )
         cpu_raise_softirq_batch_finish();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Dec 09 09:11:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Dec 2022 09:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.457753.715746 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3ZPz-0004tW-AQ; Fri, 09 Dec 2022 09:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 457753.715746; Fri, 09 Dec 2022 09: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 1p3ZPz-0004tO-7f; Fri, 09 Dec 2022 09:11:43 +0000
Received: by outflank-mailman (input) for mailman id 457753;
 Fri, 09 Dec 2022 09:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPy-0004tA-79
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPy-0004qm-6R
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3ZPy-0006Pc-5U
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 09: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OLx1D4cj3UX7vrtsHYxGOnmdIcRqP9uJvr/RrQRaJYE=; b=XJszddcVqAp/RQOjF2QWblf5rE
	8jrZShPD9qyY2Eg/ek9JFk8bsJVf+/cRORAi2hneq7nxHL9BDG1n+ShtK+1yTLiPbyEiC50R8L0IA
	4JtzNe7cHC/OsFjpR5Mk85sF+n9MKQh3f1mh06HypM6UJDcp2u4uckaI7hLB4kuBO3is=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/HVM: don't mark evtchn upcall vector as pending when vLAPIC is disabled
Message-Id: <E1p3ZPy-0006Pc-5U@xenbits.xenproject.org>
Date: Fri, 09 Dec 2022 09:11:42 +0000

commit 4ad5975d4e35635f03d2cb9e86292c0daeabd75f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Dec 8 10:12:41 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 8 10:12:41 2022 +0100

    x86/HVM: don't mark evtchn upcall vector as pending when vLAPIC is disabled
    
    Linux'es relatively new use of HVMOP_set_evtchn_upcall_vector has
    exposed a problem with the marking of the respective vector as
    pending: For quite some time Linux has been checking whether any stale
    ISR or IRR bits would still be set while preparing the LAPIC for use.
    This check is now triggering on the upcall vector, as the registration,
    at least for APs, happens before the LAPIC is actually enabled.
    
    In software-disabled state an LAPIC would not accept any interrupt
    requests and hence no IRR bit would newly become set while in this
    state. As a result it is also wrong for us to mark the upcall vector as
    having a pending request when the vLAPIC is in this state.
    
    To compensate for the "enabled" check added to the assertion logic, add
    logic to (conditionally) mark the upcall vector as having a request
    pending at the time the LAPIC is being software-enabled by the guest.
    Note however that, like for the pt_may_unmask_irq() we already have
    there, long term we may need to find a different solution. This will be
    especially relevant in case yet better LAPIC acceleration would
    eliminate notifications of guest writes to this and other registers.
    
    Fixes: 7b5b8ca7dffd ("x86/upcall: inject a spurious event after setting upcall vector")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: f5d0279839b58cb622f0995dbf9cff056f03082e
    master date: 2022-12-06 13:51:49 +0100
---
 xen/arch/x86/hvm/irq.c    | 5 +++--
 xen/arch/x86/hvm/vlapic.c | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 52aae4565f..4da12c932e 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -321,9 +321,10 @@ void hvm_assert_evtchn_irq(struct vcpu *v)
 
     if ( v->arch.hvm.evtchn_upcall_vector != 0 )
     {
-        uint8_t vector = v->arch.hvm.evtchn_upcall_vector;
+        struct vlapic *vlapic = vcpu_vlapic(v);
 
-        vlapic_set_irq(vcpu_vlapic(v), vector, 0);
+        if ( vlapic_enabled(vlapic) )
+           vlapic_set_irq(vlapic, v->arch.hvm.evtchn_upcall_vector, 0);
     }
     else if ( is_hvm_pv_evtchn_vcpu(v) )
         vcpu_kick(v);
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index b8c84458ff..a51f172128 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -828,6 +828,9 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         {
             vlapic->hw.disabled &= ~VLAPIC_SW_DISABLED;
             pt_may_unmask_irq(vlapic_domain(vlapic), &vlapic->pt);
+            if ( v->arch.hvm.evtchn_upcall_vector &&
+                 vcpu_info(v, evtchn_upcall_pending) )
+                vlapic_set_irq(vlapic, v->arch.hvm.evtchn_upcall_vector, 0);
         }
         break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Dec 09 15:44:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Dec 2022 15:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.458027.715930 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3fXf-0001eZ-6P; Fri, 09 Dec 2022 15:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 458027.715930; Fri, 09 Dec 2022 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 1p3fXf-0001eR-3X; Fri, 09 Dec 2022 15:44:03 +0000
Received: by outflank-mailman (input) for mailman id 458027;
 Fri, 09 Dec 2022 15:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3fXe-0001eL-3M
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 15:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3fXe-0005J6-2Y
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 15:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3fXe-0005Ll-1c
 for xen-changelog@lists.xenproject.org; Fri, 09 Dec 2022 15: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=D8p6qE1eTygOOUAs8FTrMALPV+pdrsox9iife8hkyh8=; b=Apbkw3KC0OglLQjnMefRUys0xy
	/tJ3vC1NaO8GDpscyWrnVY2JFRgts3ajHbgRPbOlNiEXrJ4bg79kwSeVNzsuftTuY7+DQMcD1pyfw
	/YRtuDh3UdZNnqiVnzK/ySvyem8DQBX3E1yXXGBASOTE3T62gP21cozmsh4Ou1426e0o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/tboot: Drop mfn_in_guarded_stack()
Message-Id: <E1p3fXe-0005Ll-1c@xenbits.xenproject.org>
Date: Fri, 09 Dec 2022 15:44:02 +0000

commit db92cb450dd7ad5eb103819d26b737cdc054ce4a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jul 26 12:53:20 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 8 17:30:23 2022 +0000

    x86/tboot: Drop mfn_in_guarded_stack()
    
    To support CET Shadow Stacks, guard pages changed unilaterally from being
    holes to being read-only (i.e. they're never holes any more).
    
    Furthermore, being real shadow stacks in some cases, the frames explicitly
    should be included in the integrity check.
    
    Fixes: 60016604739b ("x86/shstk: Rework the stack layout to support shadow stacks")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/tboot.c | 33 +--------------------------------
 1 file changed, 1 insertion(+), 32 deletions(-)

diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index fe1abfdf08..03098450f7 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -242,29 +242,6 @@ static void tboot_gen_domain_integrity(const uint8_t key[TB_KEY_SIZE],
     memset(&ctx, 0, sizeof(ctx));
 }
 
-/*
- * For stack overflow detection in debug build, a guard page is set up.
- * This fn is used to detect whether a page is in the guarded pages for
- * the above reason.
- */
-static int mfn_in_guarded_stack(unsigned long mfn)
-{
-    void *p;
-    int i;
-
-    for ( i = 0; i < nr_cpu_ids; i++ )
-    {
-        if ( !stack_base[i] )
-            continue;
-        p = (void *)((unsigned long)stack_base[i] + STACK_SIZE -
-                     PRIMARY_STACK_SIZE - PAGE_SIZE);
-        if ( mfn == virt_to_mfn(p) )
-            return -1;
-    }
-
-    return 0;
-}
-
 static void tboot_gen_xenheap_integrity(const uint8_t key[TB_KEY_SIZE],
                                         vmac_t *mac)
 {
@@ -288,15 +265,7 @@ static void tboot_gen_xenheap_integrity(const uint8_t key[TB_KEY_SIZE],
             continue; /* skip tboot and its page tables */
 
         if ( is_page_in_use(page) && is_special_page(page) )
-        {
-            void *pg;
-
-            if ( mfn_in_guarded_stack(mfn) )
-                continue; /* skip guard stack, see memguard_guard_stack() in mm.c */
-
-            pg = mfn_to_virt(mfn);
-            vmac_update((uint8_t *)pg, PAGE_SIZE, &ctx);
-        }
+            vmac_update(mfn_to_virt(mfn), PAGE_SIZE, &ctx);
     }
     *mac = vmac(NULL, 0, nonce, NULL, &ctx);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 10 12:55:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Dec 2022 12:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.458528.716381 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3zNf-0000Rv-6V; Sat, 10 Dec 2022 12:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 458528.716381; Sat, 10 Dec 2022 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 1p3zNf-0000Rl-3L; Sat, 10 Dec 2022 12:55:03 +0000
Received: by outflank-mailman (input) for mailman id 458528;
 Sat, 10 Dec 2022 12:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3zNe-0000Rf-1P
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 12:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3zNe-0000vc-0b
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 12:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3zNd-0002aw-Vj
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=09pHiX9XknOUGAwaUxJNSkmQmiZxikd+NTjJlzUYFaI=; b=4kXbSgD4qsh1K23+mwSLe4mJ0S
	IoxL5CEwcVpI1UrT8e3t+U6bzEnO0fHzCCw2fW43kC4ZDjyU1uzquq4x74Umwc8yQG9IQTktNKkGx
	iCSLcldK9y4KH8ENDlqZZ675ekc2YmP4A5xP2byAcobQcAo9S0F7RZhv4mADUYWK1CC8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Use EfiACPIReclaimMemory for ESRT
Message-Id: <E1p3zNd-0002aw-Vj@xenbits.xenproject.org>
Date: Sat, 10 Dec 2022 12:55:01 +0000

commit d7669c101427c1504517418e832fb760ae89e6bc
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Mon Oct 10 23:42:03 2022 -0400
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 8 18:00:22 2022 +0000

    Use EfiACPIReclaimMemory for ESRT
    
    A previous patch tried to get Linux to use the ESRT under Xen if it is
    in memory of type EfiRuntimeServicesData.  However, this turns out to be
    a bad idea.  Ard Biesheuvel pointed out that EfiRuntimeServices* memory
    winds up fragmenting both the EFI page tables and the direct map, and
    that EfiACPIReclaimMemory is a much better choice for this purpose.
    
    Link: https://lists.xenproject.org/archives/html/xen-devel/2022-09/msg01365.html
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Release-acked-by: Henry Wang <Henry.Wang@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/efi/boot.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index db0340c8e2..b3de1011ee 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -601,11 +601,14 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
     if ( physical_start > esrt || esrt - physical_start >= len )
         return 0;
     /*
-     * The specification requires EfiBootServicesData, but accept
-     * EfiRuntimeServicesData, which is a more logical choice.
+     * The specification requires EfiBootServicesData, but also accept
+     * EfiRuntimeServicesData (for compatibility with buggy firmware)
+     * and EfiACPIReclaimMemory (which will contain the tables after
+     * successful kexec).
      */
     if ( (desc->Type != EfiRuntimeServicesData) &&
-         (desc->Type != EfiBootServicesData) )
+         (desc->Type != EfiBootServicesData) &&
+         (desc->Type != EfiACPIReclaimMemory) )
         return 0;
     available_len = len - (esrt - physical_start);
     if ( available_len <= offsetof(EFI_SYSTEM_RESOURCE_TABLE, Entries) )
@@ -1144,18 +1147,19 @@ static void __init efi_relocate_esrt(EFI_SYSTEM_TABLE *SystemTable)
     for ( i = 0; i < info_size; i += mdesc_size )
     {
         /*
-         * ESRT needs to be moved to memory of type EfiRuntimeServicesData
+         * ESRT needs to be moved to memory of type EfiACPIReclaimMemory
          * so that the memory it is in will not be used for other purposes.
          */
         void *new_esrt = NULL;
-        size_t esrt_size = get_esrt_size(memory_map + i);
+        const EFI_MEMORY_DESCRIPTOR *desc = memory_map + i;
+        size_t esrt_size = get_esrt_size(desc);
 
         if ( !esrt_size )
             continue;
-        if ( ((EFI_MEMORY_DESCRIPTOR *)(memory_map + i))->Type ==
-             EfiRuntimeServicesData )
+        if ( desc->Type == EfiRuntimeServicesData ||
+             desc->Type == EfiACPIReclaimMemory )
             break; /* ESRT already safe from reuse */
-        status = efi_bs->AllocatePool(EfiRuntimeServicesData, esrt_size,
+        status = efi_bs->AllocatePool(EfiACPIReclaimMemory, esrt_size,
                                       &new_esrt);
         if ( status == EFI_SUCCESS && new_esrt )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 10 12:55:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Dec 2022 12:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.458529.716385 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3zNp-0000Ux-7z; Sat, 10 Dec 2022 12:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 458529.716385; Sat, 10 Dec 2022 12:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3zNp-0000Uo-4x; Sat, 10 Dec 2022 12:55:13 +0000
Received: by outflank-mailman (input) for mailman id 458529;
 Sat, 10 Dec 2022 12:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3zNo-0000TQ-4m
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 12:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3zNo-0000vm-3x
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 12:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3zNo-0002bR-35
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 12:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Yq8ig4lBg9SM8sGFNqzTo4urT3czQQz1RBfI55ZFl+o=; b=AMyS0/nRuQpWl/pI41a8PCj2rh
	EgYdu2853QrD/6oNU0Idl7AgEnCyDnILS9ehiCSXmuddg8TFNQ7171E9ed/1Lm6mHXaj7nW85D7UK
	Y1KGl+lpTE43qoz+imysq2aerL5Llg3TCj0PvOm25oDHw1KNg7eSLHXhQXHtZL+IiJuQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Do not route NS phys timer IRQ to Xen
Message-Id: <E1p3zNo-0002bR-35@xenbits.xenproject.org>
Date: Sat, 10 Dec 2022 12:55:12 +0000

commit 8d30b9e32c462fdfab4207bfcd31ed63749c4f28
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 28 14:49:37 2022 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 9 18:27:09 2022 +0000

    xen/arm: Do not route NS phys timer IRQ to Xen
    
    At the moment, we route NS phys timer IRQ to Xen even though it does not
    make use of this timer. Xen uses hypervisor timer for itself and the
    physical timer is fully emulated, hence there is nothing that can trigger
    such IRQ. This means that requesting/releasing IRQ ends up as a deadcode
    as it has no impact on the functional behavior, whereas the code within
    a handler ends up being unreachable. This is a left over from the early
    days when the CNTHP IRQ was buggy on the HW model used for testing and we
    had to use the CNTP instead.
    
    Remove the calls to {request/release}_irq for this timer as well as the
    code within the handler. Since timer_interrupt handler is now only used
    by the CNTHP, refactor it as follows:
     - rename it to htimer_interrupt to reflect its purpose,
     - remove the IRQ affiliation test,
     - invert the condition to avoid indented code and use unlikely,
     - improve readability by adding new lines \btw code and comments.
    
    Keep the calls to zero the CNTP_CTL_EL0 register for sanity and also
    remove the corresponding perf counter definition.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/perfc_defn.h |  1 -
 xen/arch/arm/time.c                   | 34 +++++++++++-----------------------
 2 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/xen/arch/arm/include/asm/perfc_defn.h b/xen/arch/arm/include/asm/perfc_defn.h
index 31f071222b..3ab0391175 100644
--- a/xen/arch/arm/include/asm/perfc_defn.h
+++ b/xen/arch/arm/include/asm/perfc_defn.h
@@ -70,7 +70,6 @@ PERFCOUNTER(spis,                 "#SPIs")
 PERFCOUNTER(guest_irqs,           "#GUEST-IRQS")
 
 PERFCOUNTER(hyp_timer_irqs,   "Hypervisor timer interrupts")
-PERFCOUNTER(phys_timer_irqs,  "Physical timer interrupts")
 PERFCOUNTER(virt_timer_irqs,  "Virtual timer interrupts")
 PERFCOUNTER(maintenance_irqs, "Maintenance interrupts")
 
diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index dec53b5f7d..0054cf2b7b 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -220,27 +220,18 @@ int reprogram_timer(s_time_t timeout)
 }
 
 /* Handle the firing timer */
-static void timer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
+static void htimer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
 {
-    if ( irq == (timer_irq[TIMER_HYP_PPI]) &&
-         READ_SYSREG(CNTHP_CTL_EL2) & CNTx_CTL_PENDING )
-    {
-        perfc_incr(hyp_timer_irqs);
-        /* Signal the generic timer code to do its work */
-        raise_softirq(TIMER_SOFTIRQ);
-        /* Disable the timer to avoid more interrupts */
-        WRITE_SYSREG(0, CNTHP_CTL_EL2);
-    }
+    if ( unlikely(!(READ_SYSREG(CNTHP_CTL_EL2) & CNTx_CTL_PENDING)) )
+        return;
 
-    if ( irq == (timer_irq[TIMER_PHYS_NONSECURE_PPI]) &&
-         READ_SYSREG(CNTP_CTL_EL0) & CNTx_CTL_PENDING )
-    {
-        perfc_incr(phys_timer_irqs);
-        /* Signal the generic timer code to do its work */
-        raise_softirq(TIMER_SOFTIRQ);
-        /* Disable the timer to avoid more interrupts */
-        WRITE_SYSREG(0, CNTP_CTL_EL0);
-    }
+    perfc_incr(hyp_timer_irqs);
+
+    /* Signal the generic timer code to do its work */
+    raise_softirq(TIMER_SOFTIRQ);
+
+    /* Disable the timer to avoid more interrupts */
+    WRITE_SYSREG(0, CNTHP_CTL_EL2);
 }
 
 static void vtimer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
@@ -302,12 +293,10 @@ void init_timer_interrupt(void)
     WRITE_SYSREG(0, CNTHP_CTL_EL2);   /* Hypervisor's timer disabled */
     isb();
 
-    request_irq(timer_irq[TIMER_HYP_PPI], 0, timer_interrupt,
+    request_irq(timer_irq[TIMER_HYP_PPI], 0, htimer_interrupt,
                 "hyptimer", NULL);
     request_irq(timer_irq[TIMER_VIRT_PPI], 0, vtimer_interrupt,
                    "virtimer", NULL);
-    request_irq(timer_irq[TIMER_PHYS_NONSECURE_PPI], 0, timer_interrupt,
-                "phytimer", NULL);
 
     check_timer_irq_cfg(timer_irq[TIMER_HYP_PPI], "hypervisor");
     check_timer_irq_cfg(timer_irq[TIMER_VIRT_PPI], "virtual");
@@ -326,7 +315,6 @@ static void deinit_timer_interrupt(void)
 
     release_irq(timer_irq[TIMER_HYP_PPI], NULL);
     release_irq(timer_irq[TIMER_VIRT_PPI], NULL);
-    release_irq(timer_irq[TIMER_PHYS_NONSECURE_PPI], NULL);
 }
 
 /* Wait a set number of microseconds */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 10 12:55:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Dec 2022 12:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.458530.716389 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p3zO0-0000YF-9V; Sat, 10 Dec 2022 12:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 458530.716389; Sat, 10 Dec 2022 12: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 1p3zO0-0000Y7-6e; Sat, 10 Dec 2022 12:55:24 +0000
Received: by outflank-mailman (input) for mailman id 458530;
 Sat, 10 Dec 2022 12:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3zNy-0000Xn-7s
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 12:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3zNy-0000w9-78
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 12:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p3zNy-0002cF-66
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 12:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HBWjDEloGNAtlNtWSiGg7GCWOD8LjcssSJkYnLkiLvE=; b=0ArXHmjF2dtHqvn4v4SJqOGy3d
	mGK6VeaKrI/W7gA8DTxdP2gaInuMqr6m+uky6KWgZKC21Bd7Pkzl2XYFCw7AkGBZkEBi82p/MZPOu
	5knNJ+WDahMsBaxqVfDHIIFX/MQcEiSZfA2XxKsza88/seQRIZ7eP3ikHnPosc4OfZsk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Drop pte_update_limit from physical relocation logic
Message-Id: <E1p3zNy-0002cF-66@xenbits.xenproject.org>
Date: Sat, 10 Dec 2022 12:55:22 +0000

commit 54073350bad16b6045522df40a90be79d970aa0e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 6 13:54:38 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 9 21:05:24 2022 +0000

    x86/boot: Drop pte_update_limit from physical relocation logic
    
    This check has existed in one form or another since c/s 369bafdb1c1 "xen: Big
    changes to x86 start-of-day" in 2007.
    
    c/s 0d31d1680868 "x86/setup: do not relocate Xen over current Xen image
    placement" demonstrates clearly that the logic was broken.
    
    Without dissecting the myriad changes over the past 14 years, I'm pretty
    certain Xen only booted by accident when l2_xenmap[0] was handled specially
    and skipped the pte_update_limit check which would have left it corrupt.
    
    The old logic was simply not safe, even if implemented as intended.  TLB
    entries can be lost for any reason; architectural (e.g. SMI), or uarch
    (e.g. enough OoO execution to thrash the TLB).  It is never safe to have
    non-pagetable data in your live pagetables, for any period of time.
    
    Either way, since c/s 0d31d1680868 there is not a partial overlap of the Xen
    image, so drop the vestigial remnants.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/setup.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index e05189f649..6bb5bc7c84 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1264,21 +1264,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)
             l3_pgentry_t *pl3e;
             l2_pgentry_t *pl2e;
             int i, j, k;
-            unsigned long pte_update_limit;
 
             /* Select relocation address. */
             xen_phys_start = end - reloc_size;
             e = xen_phys_start + XEN_IMG_OFFSET;
             bootsym(trampoline_xen_phys_start) = xen_phys_start;
 
-            /*
-             * No PTEs pointing above this address are candidates for relocation.
-             * Due to possibility of partial overlap of the end of source image
-             * and the beginning of region for destination image some PTEs may
-             * point to addresses in range [e, e + XEN_IMG_OFFSET).
-             */
-            pte_update_limit = PFN_DOWN(e);
-
             /*
              * Perform relocation to new physical address.
              * Before doing so we must sync static/global data with main memory
@@ -1301,8 +1292,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
                 {
                     /* Not present, 1GB mapping, or already relocated? */
                     if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) ||
-                         (l3e_get_flags(*pl3e) & _PAGE_PSE) ||
-                         (l3e_get_pfn(*pl3e) >= pte_update_limit) )
+                         (l3e_get_flags(*pl3e) & _PAGE_PSE) )
                         continue;
                     *pl3e = l3e_from_intpte(l3e_get_intpte(*pl3e) +
                                             xen_phys_start);
@@ -1311,8 +1301,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
                     {
                         /* Not present, PSE, or already relocated? */
                         if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) ||
-                             (l2e_get_flags(*pl2e) & _PAGE_PSE) ||
-                             (l2e_get_pfn(*pl2e) >= pte_update_limit) )
+                             (l2e_get_flags(*pl2e) & _PAGE_PSE) )
                             continue;
                         *pl2e = l2e_from_intpte(l2e_get_intpte(*pl2e) +
                                                 xen_phys_start);
@@ -1325,8 +1314,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
             for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++, pl2e++ )
             {
                 if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) ||
-                     !(l2e_get_flags(*pl2e) & _PAGE_PSE) ||
-                     (l2e_get_pfn(*pl2e) >= pte_update_limit) )
+                     !(l2e_get_flags(*pl2e) & _PAGE_PSE) )
                     continue;
 
                 *pl2e = l2e_from_intpte(l2e_get_intpte(*pl2e) + xen_phys_start);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 10 19:22:08 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Dec 2022 19:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.458630.716437 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p45QB-0005ja-SG; Sat, 10 Dec 2022 19:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 458630.716437; Sat, 10 Dec 2022 19:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p45QB-0005jS-PJ; Sat, 10 Dec 2022 19:22:03 +0000
Received: by outflank-mailman (input) for mailman id 458630;
 Sat, 10 Dec 2022 19:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45QA-0005jM-Es
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45QA-0001pi-Dh
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45QA-0006Nz-CI
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8l7pUI8iJas+ckdFmEPlXKjOFBdgwMNJYgBJirEeEaw=; b=dt8COlTRTiysa2szSW0FflMl/Q
	SXYQ01/ZMtlubGmClj3Px018HksaG/SCDTsxS55GyCAV9oJqlOWppK+Vgdy+Iseqwl3N2rZfWiFkp
	gy2wKKxxtKwnbv0OosSFn7/xyVH6wrWViQYxvils1lBROssMdsLb94Z1QhjV8T7srTx8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Install packages required by tests in containers
Message-Id: <E1p45QA-0006Nz-CI@xenbits.xenproject.org>
Date: Sat, 10 Dec 2022 19:22:02 +0000

commit 1ed7da301020ee1e16177cb3d9caa817f195a59a
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Nov 17 17:16:42 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Dec 9 14:55:33 2022 -0800

    automation: Install packages required by tests in containers
    
    Installation of additional packages from the test scripts when running
    the tests has some drawbacks. It is slower than cloning containers and can
    fail due to some network issues (apparently it often happens on x86
    rackspace). This patch is adding the packages required by the tests to be
    installed when building the containers.
    
    >From qemu-alpine-x86_64.sh into debian:stretch:
     - cpio,
     - busybox-static.
    
    >From qemu-smoke-*-{arm,arm64}.sh into debian:unstable-arm64v8:
     - u-boot-qemu,
     - u-boot-tools,
     - device-tree-compiler,
     - curl,
     - cpio,
     - busybox-static.
    
    The follow-up patch will remove installation of these packages from the
    test scripts. This is done in order not to break the CI in-between.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/debian/stretch.dockerfile          | 3 +++
 automation/build/debian/unstable-arm64v8.dockerfile | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/automation/build/debian/stretch.dockerfile b/automation/build/debian/stretch.dockerfile
index da6aa874dd..30fcc5288d 100644
--- a/automation/build/debian/stretch.dockerfile
+++ b/automation/build/debian/stretch.dockerfile
@@ -49,6 +49,9 @@ RUN apt-get update && \
         apt-transport-https \
         # for test phase, qemu-smoke-* jobs
         qemu-system-x86 \
+        # for test phase, qemu-alpine-* jobs
+        cpio \
+        busybox-static \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
diff --git a/automation/build/debian/unstable-arm64v8.dockerfile b/automation/build/debian/unstable-arm64v8.dockerfile
index 5c73458d9d..0080c22ba2 100644
--- a/automation/build/debian/unstable-arm64v8.dockerfile
+++ b/automation/build/debian/unstable-arm64v8.dockerfile
@@ -43,6 +43,13 @@ RUN apt-get update && \
         wget \
         git \
         nasm \
+        # for test phase, qemu-smoke-* jobs
+        u-boot-qemu \
+        u-boot-tools \
+        device-tree-compiler \
+        curl \
+        cpio \
+        busybox-static \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 10 19:22:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Dec 2022 19:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.458631.716441 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p45QL-0005m5-Ts; Sat, 10 Dec 2022 19:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 458631.716441; Sat, 10 Dec 2022 19: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 1p45QL-0005lx-Qt; Sat, 10 Dec 2022 19:22:13 +0000
Received: by outflank-mailman (input) for mailman id 458631;
 Sat, 10 Dec 2022 19:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45QK-0005lk-J5
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45QK-0001pm-Gq
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45QK-0006Px-Fn
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zmp8yY1oixIB2+O3rnxRkiughRiHwU1acyRWigEpwfk=; b=lK8KUV5HifvuemUWNZUMcv9sWV
	yaaCodIyCct7zXRb7y6yxNKF1qMxtOqSZv0fVV+mF6ibKrKtyBigoNFANTuKmnjLDNQpM5Lz55Ru4
	aTEnqNZem6pOdEvVk2zEPY2Z75DcrMxHqmlpxQop+FGNMMQkhzO9cJTQYkHrzKgOkNXA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Remove installation of packages from test scripts
Message-Id: <E1p45QK-0006Px-Fn@xenbits.xenproject.org>
Date: Sat, 10 Dec 2022 19:22:12 +0000

commit 72cfe1c3ad1fae95f4f0ac51dbdd6838264fdd7f
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Nov 17 17:16:43 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Dec 9 14:55:33 2022 -0800

    automation: Remove installation of packages from test scripts
    
    Now, when these packages are already installed in the respective
    containers, we can remove them from the test scripts.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/qemu-alpine-x86_64.sh        | 4 ----
 automation/scripts/qemu-smoke-dom0-arm32.sh     | 8 --------
 automation/scripts/qemu-smoke-dom0-arm64.sh     | 9 ---------
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 9 ---------
 4 files changed, 30 deletions(-)

diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 2e9625109c..8c8d0b0cd7 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -2,10 +2,6 @@
 
 set -ex
 
-apt-get -qy update
-apt-get -qy install --no-install-recommends cpio \
-                                            busybox-static
-
 # DomU Busybox
 cd binaries
 mkdir -p initrd
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index ef19b988c2..98e4d481f6 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -2,14 +2,6 @@
 
 set -ex
 
-export DEBIAN_FRONTEND=noninteractive
-apt-get -qy update
-apt-get -qy install --no-install-recommends u-boot-qemu \
-                                            u-boot-tools \
-                                            device-tree-compiler \
-                                            curl \
-                                            cpio
-
 cd binaries
 # Use the kernel from Debian
 curl --fail --silent --show-error --location --output vmlinuz http://http.us.debian.org/debian/dists/bullseye/main/installer-armhf/current/images/netboot/vmlinuz
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index 9004c537e3..0bf5cfdc61 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -2,15 +2,6 @@
 
 set -ex
 
-export DEBIAN_FRONTEND=noninteractive
-apt-get -qy update
-apt-get -qy install --no-install-recommends u-boot-qemu \
-                                            u-boot-tools \
-                                            device-tree-compiler \
-                                            cpio \
-                                            curl \
-                                            busybox-static
-
 # DomU Busybox
 cd binaries
 mkdir -p initrd
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 933209e2e0..2b59346fdc 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -38,15 +38,6 @@ fi
 "
 fi
 
-export DEBIAN_FRONTEND=noninteractive
-apt-get -qy update
-apt-get -qy install --no-install-recommends u-boot-qemu \
-                                            u-boot-tools \
-                                            device-tree-compiler \
-                                            busybox-static \
-                                            cpio \
-                                            curl
-
 # XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
 curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
 ./binaries/qemu-system-aarch64 \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 10 19:22:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Dec 2022 19:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.458632.716444 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p45QV-0005or-V9; Sat, 10 Dec 2022 19:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 458632.716444; Sat, 10 Dec 2022 19: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 1p45QV-0005ok-SR; Sat, 10 Dec 2022 19:22:23 +0000
Received: by outflank-mailman (input) for mailman id 458632;
 Sat, 10 Dec 2022 19:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45QU-0005oZ-M5
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45QU-0001q8-LF
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45QU-0006QX-KY
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZMRfpbV1J+kiIezzkyVg28zE6fp2PSqR0RiRxiewJ8A=; b=SoU8twZW/lWJ6++ZixscV4n6QB
	hmO5Xwp1jUirTOkslbEXfItRkYyuSfQeoMhENIA2flc4iT8ZhCD+UHe8fCPSwvn0unCDcD+RBsuho
	cbaF3LAqWQ5mUM/KMCc/WdywG7y+FwMaCnBb3jGc2BlKhAqn+LGCnrQSLP6RnD0FhgpQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] add SPDX to arch/arm/*.c
Message-Id: <E1p45QU-0006QX-KY@xenbits.xenproject.org>
Date: Sat, 10 Dec 2022 19:22:22 +0000

commit d25aeb176e6c771cbe2b75f51a35031f93703603
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Wed Oct 12 17:56:48 2022 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Dec 9 14:55:33 2022 -0800

    add SPDX to arch/arm/*.c
    
    Add SPDX license information to all the *.c files under arch/arm.
    
    The SPDX tags added by this patch were chosen based on the existing
    copyright headers. When the copyright header was missing we used the
    default license which is GPLv2 for Xen (as per the COPYING file).
    
    One exception is domain_page.c which is a split from mm.c so the license
    is GPLv2+.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/alternative.c        | 13 +------------
 xen/arch/arm/bootfdt.c            |  5 +----
 xen/arch/arm/cpuerrata.c          |  1 +
 xen/arch/arm/cpufeature.c         | 13 +------------
 xen/arch/arm/decode.c             | 11 +----------
 xen/arch/arm/device.c             | 11 +----------
 xen/arch/arm/dm.c                 | 13 +------------
 xen/arch/arm/domain.c             | 12 +-----------
 xen/arch/arm/domain_build.c       |  1 +
 xen/arch/arm/domain_page.c        |  1 +
 xen/arch/arm/domctl.c             |  1 +
 xen/arch/arm/early_printk.c       |  5 +----
 xen/arch/arm/gic-v2.c             | 11 +----------
 xen/arch/arm/gic-v3-its.c         | 13 +------------
 xen/arch/arm/gic-v3-lpi.c         | 13 +------------
 xen/arch/arm/gic-v3.c             | 11 +----------
 xen/arch/arm/gic-vgic.c           | 11 +----------
 xen/arch/arm/gic.c                | 11 +----------
 xen/arch/arm/guest_atomics.c      | 13 +------------
 xen/arch/arm/guest_walk.c         | 13 +------------
 xen/arch/arm/guestcopy.c          |  1 +
 xen/arch/arm/hvm.c                | 13 +------------
 xen/arch/arm/io.c                 | 11 +----------
 xen/arch/arm/ioreq.c              | 13 +------------
 xen/arch/arm/irq.c                | 11 +----------
 xen/arch/arm/kernel.c             |  1 +
 xen/arch/arm/livepatch.c          |  1 +
 xen/arch/arm/mem_access.c         | 13 +------------
 xen/arch/arm/mm.c                 | 11 +----------
 xen/arch/arm/monitor.c            | 13 +------------
 xen/arch/arm/p2m.c                |  1 +
 xen/arch/arm/percpu.c             |  1 +
 xen/arch/arm/physdev.c            |  1 +
 xen/arch/arm/platform.c           | 11 +----------
 xen/arch/arm/platform_hypercall.c |  1 +
 xen/arch/arm/processor.c          | 11 +----------
 xen/arch/arm/psci.c               | 11 +----------
 xen/arch/arm/setup.c              | 11 +----------
 xen/arch/arm/shutdown.c           |  1 +
 xen/arch/arm/smp.c                |  1 +
 xen/arch/arm/smpboot.c            | 11 +----------
 xen/arch/arm/sysctl.c             |  1 +
 xen/arch/arm/time.c               | 11 +----------
 xen/arch/arm/traps.c              | 11 +----------
 xen/arch/arm/vcpreg.c             | 11 +----------
 xen/arch/arm/vgic-v2.c            | 11 +----------
 xen/arch/arm/vgic-v3-its.c        | 13 +------------
 xen/arch/arm/vgic-v3.c            | 11 +----------
 xen/arch/arm/vgic.c               | 11 +----------
 xen/arch/arm/vm_event.c           | 13 +------------
 xen/arch/arm/vpci.c               | 11 +----------
 xen/arch/arm/vpl011.c             | 13 +------------
 xen/arch/arm/vpsci.c              | 13 +------------
 xen/arch/arm/vsmc.c               | 10 +---------
 xen/arch/arm/vtimer.c             | 11 +----------
 xen/arch/arm/vuart.c              | 11 +----------
 56 files changed, 56 insertions(+), 438 deletions(-)

diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index f03cd943c6..f00e3b9b3c 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -1,20 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * alternative runtime patching
  * inspired by the x86 version
  *
  * Copyright (C) 2014-2016 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <xen/init.h>
diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index 6014c0f852..0085c28d74 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -1,11 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Early Device Tree
  *
  * Copyright (C) 2012-2014 Citrix Systems, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
  */
 #include <xen/types.h>
 #include <xen/lib.h>
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index 5952111b72..1abacfe5bb 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #include <xen/cpu.h>
 #include <xen/cpumask.h>
 #include <xen/init.h>
diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
index 62d5e1770a..c4ec38bb25 100644
--- a/xen/arch/arm/cpufeature.c
+++ b/xen/arch/arm/cpufeature.c
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Contains CPU feature definitions
  *
  * Copyright (C) 2015 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <xen/types.h>
diff --git a/xen/arch/arm/decode.c b/xen/arch/arm/decode.c
index f5f6562600..2537dbebc1 100644
--- a/xen/arch/arm/decode.c
+++ b/xen/arch/arm/decode.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/decode.c
  *
@@ -5,16 +6,6 @@
  *
  * Julien Grall <julien.grall@linaro.org>
  * Copyright (C) 2013 Linaro Limited.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/guest_access.h>
diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 70cd6c1a19..ca8539dee5 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/device.c
  *
@@ -5,16 +6,6 @@
  *
  * Julien Grall <julien.grall@linaro.org>
  * Copyright (C) 2013 Linaro Limited.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <asm/device.h>
diff --git a/xen/arch/arm/dm.c b/xen/arch/arm/dm.c
index 1b3fd6bc7d..5569efa121 100644
--- a/xen/arch/arm/dm.c
+++ b/xen/arch/arm/dm.c
@@ -1,17 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (c) 2019 Arm ltd.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <xen/dm.h>
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 476f4f29f8..99577adb6c 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -1,14 +1,4 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 #include <xen/bitops.h>
 #include <xen/errno.h>
 #include <xen/grant_table.h>
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 71a3243f48..bef5e905a7 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #include <xen/init.h>
 #include <xen/compile.h>
 #include <xen/lib.h>
diff --git a/xen/arch/arm/domain_page.c b/xen/arch/arm/domain_page.c
index 71182575f9..b7c02c9190 100644
--- a/xen/arch/arm/domain_page.c
+++ b/xen/arch/arm/domain_page.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 #include <xen/mm.h>
 #include <xen/pmap.h>
 #include <xen/vmap.h>
diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index 1baf25c3d9..ad56efb0f5 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /******************************************************************************
  * Arch-specific domctl.c
  *
diff --git a/xen/arch/arm/early_printk.c b/xen/arch/arm/early_printk.c
index 333073d97e..03cbe0fb88 100644
--- a/xen/arch/arm/early_printk.c
+++ b/xen/arch/arm/early_printk.c
@@ -1,11 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * printk() for use before the final page tables are setup.
  *
  * Copyright (C) 2012 Citrix Systems, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
  */
 
 #include <xen/init.h>
diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index ae5bd8e95f..61802839cb 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/gic-v2.c
  *
@@ -5,16 +6,6 @@
  *
  * Tim Deegan <tim@xen.org>
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/lib.h>
diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index e217c21bf8..1ec9934191 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -1,21 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * xen/arch/arm/gic-v3-its.c
  *
  * ARM GICv3 Interrupt Translation Service (ITS) support
  *
  * Copyright (C) 2016,2017 - ARM Ltd
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <xen/acpi.h>
diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c
index f0b7ef17da..eb0a5535e4 100644
--- a/xen/arch/arm/gic-v3-lpi.c
+++ b/xen/arch/arm/gic-v3-lpi.c
@@ -1,21 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * xen/arch/arm/gic-v3-lpi.c
  *
  * ARM GICv3 Locality-specific Peripheral Interrupts (LPI) support
  *
  * Copyright (C) 2016,2017 - ARM Ltd
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <xen/cpu.h>
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 018fa0dfa0..37eb7ff95e 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/gic-v3.c
  *
@@ -9,16 +10,6 @@
  *
  * Vijaya Kumar K <vijaya.kumar@caviumnetworks.com>, Cavium Inc
  * ported to Xen
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/acpi.h>
diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c
index 98c021f1a8..56490dbc43 100644
--- a/xen/arch/arm/gic-vgic.c
+++ b/xen/arch/arm/gic-vgic.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/gic-vgic.c
  *
@@ -5,16 +6,6 @@
  *
  * Tim Deegan <tim@xen.org>
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/errno.h>
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 9b82325442..d922ea67aa 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/gic.c
  *
@@ -5,16 +6,6 @@
  *
  * Tim Deegan <tim@xen.org>
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/lib.h>
diff --git a/xen/arch/arm/guest_atomics.c b/xen/arch/arm/guest_atomics.c
index 1b78a062f0..6ba77f082d 100644
--- a/xen/arch/arm/guest_atomics.c
+++ b/xen/arch/arm/guest_atomics.c
@@ -1,17 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * arch/arm/guest_atomics.c
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 #include <xen/cpu.h>
 
diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c
index 87de40d0cb..43d3215304 100644
--- a/xen/arch/arm/guest_walk.c
+++ b/xen/arch/arm/guest_walk.c
@@ -1,18 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Guest page table walk
  * Copyright (c) 2017 Sergej Proskurin <proskurin@sec.in.tum.de>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <xen/domain_page.h>
diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c
index abb6236e27..225fd343dd 100644
--- a/xen/arch/arm/guestcopy.c
+++ b/xen/arch/arm/guestcopy.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #include <xen/domain_page.h>
 #include <xen/guest_access.h>
 #include <xen/lib.h>
diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c
index fc1a52767d..0989309fea 100644
--- a/xen/arch/arm/hvm.c
+++ b/xen/arch/arm/hvm.c
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * arch/arm/hvm.c
  *
  * Arch-specific hardware virtual machine abstractions.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <xen/init.h>
diff --git a/xen/arch/arm/io.c b/xen/arch/arm/io.c
index 4ce94243aa..172583df04 100644
--- a/xen/arch/arm/io.c
+++ b/xen/arch/arm/io.c
@@ -1,19 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/io.c
  *
  * ARM I/O handlers
  *
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/ioreq.h>
diff --git a/xen/arch/arm/ioreq.c b/xen/arch/arm/ioreq.c
index 1338c86adb..5585457189 100644
--- a/xen/arch/arm/ioreq.c
+++ b/xen/arch/arm/ioreq.c
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * arm/ioreq.c: hardware virtual machine I/O emulation
  *
  * Copyright (c) 2019 Arm ltd.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <xen/domain.h>
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 00fadbc354..79718f68e7 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/irq.c
  *
@@ -5,16 +6,6 @@
  *
  * Ian Campbell <ian.campbell@citrix.com>
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/cpu.h>
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 2556a45c38..23b840ea9e 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Kernel image loading.
  *
diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
index 57abc746e6..d646379c8c 100644
--- a/xen/arch/arm/livepatch.c
+++ b/xen/arch/arm/livepatch.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  *  Copyright (C) 2016 Citrix Systems R&D Ltd.
  */
diff --git a/xen/arch/arm/mem_access.c b/xen/arch/arm/mem_access.c
index 3e3620294c..31db846354 100644
--- a/xen/arch/arm/mem_access.c
+++ b/xen/arch/arm/mem_access.c
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * arch/arm/mem_access.c
  *
  * Architecture-specific mem_access handling routines
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License v2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <xen/mem_access.h>
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 6ccffeaea5..630175276f 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/mm.c
  *
@@ -5,16 +6,6 @@
  *
  * Tim Deegan <tim@xen.org>
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/domain_page.h>
diff --git a/xen/arch/arm/monitor.c b/xen/arch/arm/monitor.c
index 8c4a396e3c..6c93a9e993 100644
--- a/xen/arch/arm/monitor.c
+++ b/xen/arch/arm/monitor.c
@@ -1,21 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * arch/arm/monitor.c
  *
  * Arch-specific monitor_op domctl handler.
  *
  * Copyright (c) 2016 Tamas K Lengyel (tamas.lengyel@zentific.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License v2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <xen/vm_event.h>
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 08e5ac3def..948f199d84 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #include <xen/cpu.h>
 #include <xen/domain_page.h>
 #include <xen/iocap.h>
diff --git a/xen/arch/arm/percpu.c b/xen/arch/arm/percpu.c
index 67eb821ff6..87fe960330 100644
--- a/xen/arch/arm/percpu.c
+++ b/xen/arch/arm/percpu.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #include <xen/percpu.h>
 #include <xen/cpu.h>
 #include <xen/init.h>
diff --git a/xen/arch/arm/physdev.c b/xen/arch/arm/physdev.c
index 95a8cdc0ee..7b1682ee10 100644
--- a/xen/arch/arm/physdev.c
+++ b/xen/arch/arm/physdev.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /******************************************************************************
  * Arch-specific physdev.c
  *
diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c
index 4db5bbb4c5..6701ff77bc 100644
--- a/xen/arch/arm/platform.c
+++ b/xen/arch/arm/platform.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/platform.c
  *
@@ -5,16 +6,6 @@
  *
  * Julien Grall <julien.grall@linaro.org>
  * Copyright (C) 2013 Linaro Limited.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <asm/platform.h>
diff --git a/xen/arch/arm/platform_hypercall.c b/xen/arch/arm/platform_hypercall.c
index 403cc84324..743687a303 100644
--- a/xen/arch/arm/platform_hypercall.c
+++ b/xen/arch/arm/platform_hypercall.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /******************************************************************************
  * platform_hypercall.c
  *
diff --git a/xen/arch/arm/processor.c b/xen/arch/arm/processor.c
index acad8b31d6..6de206c07e 100644
--- a/xen/arch/arm/processor.c
+++ b/xen/arch/arm/processor.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/processor.c
  *
@@ -5,16 +6,6 @@
  *
  * Julien Grall <julien.grall@linaro.org>
  * Copyright (C) 2014 Linaro Limited.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 #include <asm/procinfo.h>
 
diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c
index 0c90c2305c..695d2fa1f1 100644
--- a/xen/arch/arm/psci.c
+++ b/xen/arch/arm/psci.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/psci.c
  *
@@ -5,16 +6,6 @@
  *
  * Andre Przywara <andre.przywara@linaro.org>
  * Copyright (c) 2013 Linaro Limited.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 4395640019..1f26f67b90 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/setup.c
  *
@@ -5,16 +6,6 @@
  *
  * Tim Deegan <tim@xen.org>
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/compile.h>
diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c
index 0606cb84b3..205a5e7f8c 100644
--- a/xen/arch/arm/shutdown.c
+++ b/xen/arch/arm/shutdown.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #include <xen/console.h>
 #include <xen/cpu.h>
 #include <xen/delay.h>
diff --git a/xen/arch/arm/smp.c b/xen/arch/arm/smp.c
index 5823a69d3e..bb65a08fc1 100644
--- a/xen/arch/arm/smp.c
+++ b/xen/arch/arm/smp.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 #include <xen/mm.h>
 #include <asm/system.h>
 #include <asm/smp.h>
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index bfa988c162..412ae22869 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -1,19 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/smpboot.c
  *
  * Dummy smpboot support
  *
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/cpu.h>
diff --git a/xen/arch/arm/sysctl.c b/xen/arch/arm/sysctl.c
index f87944e847..b0a78a8b10 100644
--- a/xen/arch/arm/sysctl.c
+++ b/xen/arch/arm/sysctl.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /******************************************************************************
  * Arch-specific sysctl.c
  *
diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index 0054cf2b7b..433d7be909 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/time.c
  *
@@ -5,16 +6,6 @@
  *
  * Tim Deegan <tim@xen.org>
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/console.h>
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 79f9ed0725..061c92acbd 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1,19 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/traps.c
  *
  * ARM Trap handlers
  *
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/domain_page.h>
diff --git a/xen/arch/arm/vcpreg.c b/xen/arch/arm/vcpreg.c
index b5fbbe1cb8..4adfc0a68d 100644
--- a/xen/arch/arm/vcpreg.c
+++ b/xen/arch/arm/vcpreg.c
@@ -1,19 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/arm64/vcpreg.c
  *
  * Emulate co-processor registers trapped.
  *
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/sched.h>
diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c
index b1bd7a46ad..0026cb4360 100644
--- a/xen/arch/arm/vgic-v2.c
+++ b/xen/arch/arm/vgic-v2.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/vgic-v2.c
  *
@@ -5,16 +6,6 @@
  *
  * Ian Campbell <ian.campbell@citrix.com>
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/bitops.h>
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
index 58d939b85f..299b384250 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * xen/arch/arm/vgic-v3-its.c
  *
@@ -5,18 +6,6 @@
  *
  * Andre Przywara <andre.przywara@arm.com>
  * Copyright (c) 2016,2017 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 015446be17..76b69a7a50 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/vgic-v3.c
  *
@@ -6,16 +7,6 @@
  *
  * Vijaya Kumar K <vijaya.kumar@caviumnetworks.com>
  * Copyright (c) 2014 Cavium Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/bitops.h>
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 83386cf3d5..c61c68870c 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/vgic.c
  *
@@ -5,16 +6,6 @@
  *
  * Ian Campbell <ian.campbell@citrix.com>
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/bitops.h>
diff --git a/xen/arch/arm/vm_event.c b/xen/arch/arm/vm_event.c
index eaac92078d..ba99f56eb2 100644
--- a/xen/arch/arm/vm_event.c
+++ b/xen/arch/arm/vm_event.c
@@ -1,21 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * arch/arm/vm_event.c
  *
  * Architecture-specific vm_event handling routines
  *
  * Copyright (c) 2016 Tamas K Lengyel (tamas.lengyel@zentific.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License v2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <xen/sched.h>
diff --git a/xen/arch/arm/vpci.c b/xen/arch/arm/vpci.c
index a9fc5817f9..3bc4bb5508 100644
--- a/xen/arch/arm/vpci.c
+++ b/xen/arch/arm/vpci.c
@@ -1,15 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/vpci.c
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 #include <xen/sched.h>
 #include <xen/vpci.h>
diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index 43522d48fd..f6144da1d7 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -1,19 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * arch/arm/vpl011.c
  *
  * Virtual PL011 UART
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
 #define XEN_WANT_FLEX_CONSOLE_RING 1
diff --git a/xen/arch/arm/vpsci.c b/xen/arch/arm/vpsci.c
index 744d43ec27..d1615be8a6 100644
--- a/xen/arch/arm/vpsci.c
+++ b/xen/arch/arm/vpsci.c
@@ -1,15 +1,4 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 #include <xen/errno.h>
 #include <xen/sched.h>
 #include <xen/types.h>
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index 676740ef15..7335276f3f 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -1,17 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * xen/arch/arm/vsmc.c
  *
  * Generic handler for SMC and HVC calls according to
  * ARM SMC calling convention
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 
diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index aeaea78e4c..48f2daa907 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/vtimer.c
  *
@@ -5,16 +6,6 @@
  *
  * Ian Campbell <ian.campbell@citrix.com>
  * Copyright (c) 2011 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <xen/lib.h>
diff --git a/xen/arch/arm/vuart.c b/xen/arch/arm/vuart.c
index 80d4755d43..d5ba483f1e 100644
--- a/xen/arch/arm/vuart.c
+++ b/xen/arch/arm/vuart.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * xen/arch/arm/vuart.c
  *
@@ -19,16 +20,6 @@
  * Julien Grall <julien.grall@linaro.org>
  * Ian Campbell <ian.campbell@citrix.com>
  * Copyright (c) 2012 Citrix Systems.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 #include <xen/lib.h>
 #include <xen/sched.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 10 19:22:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Dec 2022 19:22:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.458633.716449 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p45Qg-0005ry-4O; Sat, 10 Dec 2022 19:22:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 458633.716449; Sat, 10 Dec 2022 19:22: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 1p45Qg-0005rr-1N; Sat, 10 Dec 2022 19:22:34 +0000
Received: by outflank-mailman (input) for mailman id 458633;
 Sat, 10 Dec 2022 19:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45Qe-0005rf-PE
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45Qe-0001qJ-OL
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45Qe-0006Qy-NO
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=evwGUXaA7z5LGQcjtrDp9EAfcdRzF5lGQ002I2gw7PU=; b=gcLmF7js6Wk3ADKYxwJrLKxCRe
	j7IwC6mpIg/qHhOzmjUCJ32tMySdGrkprYVY2eU1ltBvGoXv7l5KLcVTPmvw/s01Pwspukg01HDF1
	cxNah/HiNTeqDdxz56KgMCnHJt+5pLt0Pmyt3Jd/Vxqu/awVcw2Hr2qT4nfy25+crmi4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Create Yocto docker images
Message-Id: <E1p45Qe-0006Qy-NO@xenbits.xenproject.org>
Date: Sat, 10 Dec 2022 19:22:32 +0000

commit 8a6bce7c76f142b3028495bdb54680b6f517ab12
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Thu Dec 1 14:25:30 2022 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Dec 9 14:55:33 2022 -0800

    automation: Create Yocto docker images
    
    Add containers suitable to run yocto kirkstone build based on ubuntu
    22.04. It contains all packages required by Yocto and a checkout of the
    layers required to build Xen with Yocto.
    
    Add a generic docker image template to be used to automatically generate
    docker files for different configurations:
    - specific yocto version
    - different targets (qemu arm, arm64 and x86)
    - different host platforms (x86 or arm64)
    
    During a call to 'make all', only the images for the host platform we
    run it on in the CI is generated.
    If needed, images for an other host platform can be generated manually
    by calling the right make target (see make help).
    
    Add a build script to build and run xen on qemu using Yocto.
    The script supports arm32, arm64 and x86_64 and checks that dom0 is
    properly booting. At this stage this does not run any guest on top of
    dom0. The script is to be executed in one of the docker images to build
    and run a system using a Xen source tree.
    
    Add automation/build/yocto/*.dockerfile to gitignore as those files are
    generated.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .gitignore                                 |   1 +
 automation/build/Makefile                  |  16 +-
 automation/build/yocto/build-yocto.sh      | 356 +++++++++++++++++++++++++++++
 automation/build/yocto/yocto.dockerfile.in | 114 +++++++++
 automation/build/yocto/yocto.inc           |  44 ++++
 5 files changed, 528 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index ea3243af9d..ce7caa56af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,6 +38,7 @@ dist
 stubdom/*.tar.gz
 
 autom4te.cache/
+automation/build/yocto/*.dockerfile
 build-*/
 config.log
 config.status
diff --git a/automation/build/Makefile b/automation/build/Makefile
index a4b2b85178..c4aaa747ff 100644
--- a/automation/build/Makefile
+++ b/automation/build/Makefile
@@ -1,20 +1,30 @@
 
 # the base of where these containers will appear
 REGISTRY := registry.gitlab.com/xen-project/xen
-CONTAINERS = $(subst .dockerfile,,$(wildcard */*.dockerfile))
+CONTAINERS := $(filter-out yocto/%,$(subst .dockerfile,,$(wildcard */*.dockerfile)))
+CONTAINERS_EXTRA =
 DOCKER_CMD ?= docker
 
 help:
 	@echo "Builds containers for building Xen based on different distros"
 	@echo "To build one run 'make DISTRO/VERSION'. Available containers:"
-	@$(foreach file,$(sort $(CONTAINERS)),echo ${file};)
+	@$(foreach file,$(sort $(CONTAINERS)),echo $(file);)
+	@echo "Extra containers (not built using make all):"
+	@$(foreach file,$(sort $(CONTAINERS_EXTRA)),echo $(file);)
 	@echo "To push container builds, set the env var PUSH"
 
+include yocto/yocto.inc
+
 %: %.dockerfile ## Builds containers
 	$(DOCKER_CMD) build -t $(REGISTRY)/$(@D):$(@F) -f $< $(<D)
 	@if [ ! -z $${PUSH+x} ]; then \
 		$(DOCKER_CMD) push $(REGISTRY)/$(@D):$(@F); \
 	fi
 
-.PHONY: all
+.PHONY: all clean
 all: $(CONTAINERS)
+
+# Remove generated dockerfiles for yocto
+clean:
+	rm -f yocto/*.dockerfile
+
diff --git a/automation/build/yocto/build-yocto.sh b/automation/build/yocto/build-yocto.sh
new file mode 100755
index 0000000000..3601cebc3c
--- /dev/null
+++ b/automation/build/yocto/build-yocto.sh
@@ -0,0 +1,356 @@
+#!/bin/bash
+#
+# Yocto meta virtualization build and run script
+#
+# This script is building Yocto xen-image-minimal for qemu targets and run
+# them using runqemu inside yocto to check that dom0 is booting properly.
+# The build is using a local xen source tree so that specific patches can be
+# tested.
+# In order to optimize the build time, a build cache is used so that only xen
+# packages and its dependencies are rebuilt (qemu and final image mainly).
+#
+# get command error even when piped.
+set -o pipefail
+
+# Directories
+YOCTODIR="$HOME/yocto-layers"
+CACHEDIR="$HOME/yocto-cache"
+LOGDIR="$HOME/logs"
+XENDIR="$HOME/xen"
+BUILDDIR="$HOME/build"
+
+# what yocto bsp we support
+TARGET_SUPPORTED="qemuarm qemuarm64 qemux86-64"
+VERBOSE="n"
+TARGETLIST=""
+BUILDJOBS="8"
+
+# actions to do
+do_clean="n"
+do_build="y"
+do_run="y"
+do_localsrc="n"
+do_dump="n"
+build_result=0
+
+# layers to include in the project
+build_layerlist="poky/meta poky/meta-poky poky/meta-yocto-bsp \
+                 meta-openembedded/meta-oe meta-openembedded/meta-python \
+                 meta-openembedded/meta-filesystems \
+                 meta-openembedded/meta-networking meta-virtualization"
+
+# yocto image to build
+build_image="xen-image-minimal"
+
+function print_progress() {
+    echo -n "$(date +%T) $*"
+}
+
+function run_task() {
+    local task_name="$1"
+    local task_target="$2"
+
+    task_log="${task_name//project_}-${task_target}"
+
+    mkdir -p "${LOGDIR}"
+    print_progress
+    echo -n "${task_name//project_} ${task_target}: "
+    if [ "${VERBOSE}" = "n" ]; then
+        "$@" > "${LOGDIR}/${task_log}.log" 2>&1
+    else
+        "$@" 2>&1 | tee "${LOGDIR}/${task_log}.log"
+    fi
+
+    if [ ${?} -ne 0 ]; then
+        echo "Error"
+        build_result=$((build_result+1))
+        if [ "${do_dump}" = "y" ]; then
+            echo
+            echo "############ LOGS-START ############"
+            cat "${LOGDIR}/${task_log}.log"
+            echo "############  LOGS-END  ############"
+            echo
+        fi
+        return 1
+    else
+        echo "OK"
+        return 0
+    fi
+}
+
+function project_create() {
+    target="${1:?}"
+    destdir="${BUILDDIR}/${target}"
+
+    (
+        # init yocto project
+        source "${YOCTODIR}/poky/oe-init-build-env" "${destdir}"
+
+        # add needed layers
+        for layer in ${build_layerlist}; do
+            bitbake-layers add-layer "${YOCTODIR}/${layer}" || exit 1
+        done
+    ) || return 1
+
+    # Detect latest version available in Yocto and use it instead of default
+    # one.
+    XENVERS=$(grep -e "^XEN_REL" \
+        "${YOCTODIR}"/meta-virtualization/recipes-extended/xen/xen_*.bb \
+        2> /dev/null | tr -d ' ' | tr -d '?' | tr -d '"' \
+        | sed -e "s/.*=//" | sort -V | tail -n 1)
+
+    # customize project configuration
+    cat <<EOF >> "${destdir}/conf/local.conf"
+# Yocto BSP
+MACHINE = "${target}"
+
+# Use local cache to reuse previous builds results
+SSTATE_DIR = "${CACHEDIR}/sstate-cache"
+DL_DIR = "${CACHEDIR}/downloads"
+
+# Enable xen and virtualization
+DISTRO_FEATURES = " virtualization xen ipv4"
+
+# Speed up run by not generating ssh host keys
+IMAGE_INSTALL:append:pn-xen-image-minimal = " ssh-pregen-hostkeys"
+
+# Save some disk space
+INHERIT += "rm_work"
+
+# Reduce number of jobs
+BB_NUMBER_THREADS="${BUILDJOBS}"
+
+# Use latest Xen version
+PREFERRED_VERSION:pn-xen = "${XENVERS}%"
+PREFERRED_VERSION:pn-xen-tools = "${XENVERS}%"
+
+# Use autorev for now as Xen SHA used by latest yocto recipe for Xen does not
+# include fixes required to build x86 on arm
+SRCREV:pn-xen = "\${AUTOREV}"
+SRCREV:pn-xen-tools = "\${AUTOREV}"
+
+# Disable all QA errors as the recipe is not up to date with changes in Xen
+# when we use local sources
+ERROR_QA:pn-xen = "arch"
+ERROR_QA:pn-xen-tools = "arch"
+
+EOF
+
+    if [ "${do_localsrc}" = "y" ]; then
+        XENBASE=$(dirname "$(realpath -m "${XENDIR}")")
+        XENSUB=$(basename "$(realpath -m "${XENDIR}")")
+
+        cat <<EOF >> "${destdir}/conf/local.conf"
+# Use local sources for xen and xen-tools
+FILESEXTRAPATHS:prepend:pn-xen := "${XENBASE}:"
+FILESEXTRAPATHS:prepend:pn-xen-tools := "${XENBASE}:"
+
+SRC_URI:pn-xen = "file://${XENSUB}/;subdir=local-xen/"
+SRC_URI:pn-xen-tools = "file://${XENSUB}/;subdir=local-xen/"
+
+S:pn-xen = "\${WORKDIR}/local-xen/${XENSUB}"
+S:pn-xen-tools = "\${WORKDIR}/local-xen/${XENSUB}"
+
+SRCPV:pn-xen = "1"
+SRCPV:pn-xen-tools = "1"
+
+EOF
+    fi
+}
+
+function project_build() {
+    target="${1:?}"
+    destdir="${BUILDDIR}/${target}"
+
+    (
+        source "${YOCTODIR}/poky/oe-init-build-env" "${destdir}"
+
+        bitbake "${build_image}" || exit 1
+    ) || return 1
+}
+
+function project_clean() {
+    target="${1:?}"
+    destdir="${BUILDDIR}/${target}"
+
+    rm -rf "${destdir}"
+}
+
+function project_run() {
+    target="${1:?}"
+    destdir="${BUILDDIR}/${target}"
+    (
+        source "${YOCTODIR}/poky/oe-init-build-env" "${destdir}" > /dev/null 2>&1
+
+        /usr/bin/expect <<EOF
+set timeout 1000
+spawn bash -c "runqemu serialstdio nographic slirp"
+
+expect_after {
+    -re "(.*)\r" {
+        exp_continue
+    }
+    timeout {send_user "ERROR-Timeout!\n"; exit 1}
+    eof {send_user "ERROR-EOF!\n"; exit 1}
+}
+
+# wait initial login
+expect -re ".* login: "
+send "root\r"
+expect -re "root@.*# "
+
+EOF
+    exit $?
+    ) || return 1
+}
+
+function help() {
+    cat <<EOF
+Usage: ${0} [TARGET1] [TARGET2]
+
+This script is build the yocto xen-image-minimal for different qemu targets
+and is running it after.
+Without any target specified, all supported targets are done.
+
+Options:
+  -h, --help       Print this help
+  -v, --verbose    Verbose build
+  --list-target    List supported targets
+  --clean          Clean existing project before starting
+  --no-build       Do not build (to run an already built project)
+  --no-run         Do not run
+  --num-jobs=NUM   Define the number of parallel jobs in Yocto.
+                   Default: ${BUILDJOBS}
+  --dump-log       On error, dump the logs on the console
+  --image=IMG      Yocto image or package to build
+                   Default: xen-image-minimal
+  --xen-dir=DIR    path to xen hypervisor source tree
+                   if not provide, normal yocto version of xen is built
+                   Default: ${XENDIR}
+  --out-dir=DIR    directory where to create the projectss
+                   Default: ${BUILDDIR}
+  --log-dir=DIR    directory to store logs
+                   Default: ${LOGDIR}
+  --cache-dir=DIR  directory where to take and store build cache
+                   Default: ${CACHEDIR}
+  --layer-dir=DIR  directory containing the checkout of yocto layers
+                   Default: ${YOCTODIR}
+EOF
+}
+
+for OPTION in "$@"
+do
+    case ${OPTION} in
+        -h|--help)
+            help
+            exit 0
+            ;;
+        -v|--verbose)
+            VERBOSE="y"
+            ;;
+        --list-targets)
+            echo "${TARGET_SUPPORTED}"
+            exit 0
+            ;;
+        --clean)
+            do_clean="y"
+            ;;
+        --no-build)
+            do_build="n"
+            ;;
+        --no-run)
+            do_run="n"
+            ;;
+        --dump-log)
+            do_dump="y"
+            ;;
+        --num-jobs=*)
+            BUILDJOBS="${OPTION#*=}"
+            ;;
+        --image=*)
+            build_image="${OPTION#*=}"
+            ;;
+        --xen-dir=*)
+            XENDIR="${OPTION#*=}"
+            if [ ! -e "${XENDIR}/xen/Makefile" ]; then
+                echo "No Xen source tree in ${XENDIR}"
+                exit 1
+            fi
+            do_localsrc="y"
+            ;;
+        --out-dir=*)
+            BUILDDIR="${OPTION#*=}"
+            ;;
+        --log-dir=*)
+            LOGDIR="${OPTION#*=}"
+            ;;
+        --cache-dir=*)
+            CACHEDIR="${OPTION#*=}"
+            ;;
+        --layer-dir=*)
+            YOCTODIR="${OPTION#*=}"
+            ;;
+        --*)
+            echo "Invalid option ${OPTION}"
+            help
+            exit 1
+            ;;
+        *)
+            if echo "${TARGET_SUPPORTED}" | grep -q -w "${OPTION}"; then
+                TARGETLIST="${TARGETLIST} ${OPTION}"
+            else
+                echo "Unsupported target ${OPTION}"
+                exit 1
+            fi
+            ;;
+    esac
+done
+
+# if no target is specified build all targets
+if [ -z "${TARGETLIST}" ]; then
+    TARGETLIST="${TARGET_SUPPORTED}"
+fi
+
+mkdir -p "${CACHEDIR}"
+mkdir -p "${LOGDIR}"
+mkdir -p "${BUILDDIR}"
+
+# Make sure we have an absolute path
+YOCTODIR=$(realpath -m "${YOCTODIR}")
+CACHEDIR=$(realpath -m "${CACHEDIR}")
+BUILDDIR=$(realpath -m "${BUILDDIR}")
+LOGDIR=$(realpath -m "${LOGDIR}")
+if [ "${do_localsrc}" = "y" ]; then
+    XENDIR=$(realpath -m "${XENDIR}")
+fi
+
+# Check that we have all the layers we need
+for f in ${build_layerlist}; do
+    if [ ! -f "${YOCTODIR}/${f}/conf/layer.conf" ]; then
+        echo "Layer ${f} missing in ${YOCTODIR}"
+        exit 1
+    fi
+done
+
+for f in ${TARGETLIST}; do
+    if [ "${do_clean}" = "y" ]; then
+        run_task project_clean "${f}"
+    fi
+    if [ ! -f "${BUILDDIR}/${f}/conf/local.conf" ]; then
+        run_task project_create "${f}"
+    fi
+    if [ -f "${BUILDDIR}/${f}/conf/local.conf" ]; then
+        if [ "${do_build}" = "y" ]; then
+            run_task project_build "${f}"
+        fi
+        if [ "${do_run}" = "y" ]; then
+            run_task project_run "${f}"
+        fi
+
+    fi
+done
+
+print_progress "Build Complete (${build_result} errors)"
+echo
+exit ${build_result}
+
diff --git a/automation/build/yocto/yocto.dockerfile.in b/automation/build/yocto/yocto.dockerfile.in
new file mode 100644
index 0000000000..b0892d4203
--- /dev/null
+++ b/automation/build/yocto/yocto.dockerfile.in
@@ -0,0 +1,114 @@
+# Docker file to create an environment to build yocto with virtualization
+#
+# Arguments that can be passed during image creation using --build-arg:
+# "host_uid=$(id -u)": to use current user uid for build user in the image
+# "host_gid=$(id -g)": to use current user gid for build user in the image
+# "ubuntu_version=VERS": to select the ubuntu version number
+
+# Use standard ubuntu minimal.
+ARG ubuntu_version=22.04
+From ##DOCKERPLAT##ubuntu:$ubuntu_version AS base
+LABEL maintainer.name="The Xen Project " \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+# Install minimal ubuntu requirements for yocto and other tools we need.
+# See https://docs.yoctoproject.org/4.0.1/brief-yoctoprojectqs/index.html#build-host-packages
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        gawk \
+        wget \
+        git \
+        diffstat \
+        unzip \
+        texinfo \
+        gcc \
+        build-essential \
+        chrpath \
+        socat \
+        cpio \
+        python3 \
+        python3-pip \
+        python3-pexpect \
+        xz-utils \
+        debianutils \
+        iputils-ping \
+        python3-git \
+        python3-jinja2 \
+        libegl1-mesa \
+        libsdl1.2-dev \
+        python3-subunit \
+        mesa-common-dev \
+        zstd \
+        liblz4-tool \
+        file \
+        vim \
+        bison \
+        expect \
+        locales \
+        liblz4-tool \
+        zstd \
+        openssl \
+        libssl3 \
+        ca-certificates \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+
+# Use bash as shell.
+RUN rm /bin/sh && ln -s bash /bin/sh
+
+# Fix local for yocto.
+RUN locale-gen en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 \
+    LANG=en_US.UTF-8
+ENV LANG en_US.UTF-8
+ENV LC_ALL en_US.UTF-8
+
+# Create a user for the build (we don't want to build as root).
+ENV USER_NAME docker-build
+ARG host_uid=1000
+ARG host_gid=1000
+RUN groupadd -g $host_gid $USER_NAME && \
+    useradd -g $host_gid -m -s /bin/bash -u $host_uid $USER_NAME
+
+# Switch to our user instead of root and start in its home.
+USER $USER_NAME
+WORKDIR /home/$USER_NAME
+
+# Create needed directories
+RUN mkdir -p /home/$USER_NAME/yocto-layers \
+             /home/$USER_NAME/yocto-cache \
+             /home/$USER_NAME/logs \
+             /home/$USER_NAME/bin \
+             /home/$USER_NAME/xen && \
+    chown $USER_NAME.$USER_NAME /home/$USER_NAME/*
+
+# clone yocto repositories we need.
+RUN for rep in \
+                https://github.com/openembedded/meta-openembedded \
+                https://git.yoctoproject.org/poky \
+                https://git.yoctoproject.org/meta-virtualization \
+            ; do \
+        git -C /home/$USER_NAME/yocto-layers \
+            clone -b ##YOCTOVERSION## --single-branch $rep; \
+    done
+
+# The builder stage is building an initial cache state that we include in the
+# final image.
+From base AS builder
+
+# This step can take one to several hours depending on your download bandwith
+# and the speed of your computer.
+COPY ./build-yocto.sh /
+RUN /build-yocto.sh --dump-log ##YOCTOTARGET##
+
+From base
+
+# Only copy the cache status.
+COPY --from=builder /home/$USER_NAME/yocto-cache /home/$USER_NAME/yocto-cache/.
+
+LABEL maintainer.name="The Xen Project " \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
diff --git a/automation/build/yocto/yocto.inc b/automation/build/yocto/yocto.inc
new file mode 100644
index 0000000000..e4328ec7f3
--- /dev/null
+++ b/automation/build/yocto/yocto.inc
@@ -0,0 +1,44 @@
+# This makefile generates the docker files for Yocto builds.
+# The containers for the current architecture are the one built using make all.
+# To build containers for a different architecture, you need to call make for
+# the image you want explicitely.
+# The containers are named this way:
+# YOCTOVERSION-TARGET for x86_64 hosts
+# YOCTOVERSION-TARGET-arm64v8 for arm64 hosts
+# For example you can build an arm64 container with the following command:
+# make yocto/kirkstone-qemuarm64-arm64v8
+
+# Yocto versions we are currently using.
+YOCTO_VERSION = kirkstone
+
+# Yocto BSPs we want to build for.
+YOCTO_TARGETS = qemuarm64 qemuarm qemux86-64
+
+# Supported container architectures.
+YOCTO_ARCHS = amd64 arm64v8
+
+# Architecture we want to use in gitlab CI (depends on runners arch).
+CI_ARCH = arm64v8
+
+define GEN_DOCKER
+# Make all is generating architecture we use in the CI.
+ifeq ($(CI_ARCH),$(3))
+CONTAINERS += yocto/$(1)-$(2)$(4)
+else
+CONTAINERS_EXTRA += yocto/$(1)-$(2)$(4)
+endif
+
+.INTERMEDIATE: yocto/$(1)-$(2)$(4).dockerfile
+
+yocto/$(1)-$(2)$(4).dockerfile: yocto/yocto.dockerfile.in
+	@cat $$< | \
+	    sed -e "s,##YOCTOVERSION##,$(1),g" | \
+	    sed -e "s,##YOCTOTARGET##,$(2),g" | \
+	    sed -e "s,##DOCKERPLAT##,$(3)/,g" > $$@
+
+endef
+
+$(eval $(foreach version,$(YOCTO_VERSION),\
+       $(foreach target,$(YOCTO_TARGETS),\
+       $(foreach arch,$(YOCTO_ARCHS),\
+       $(call GEN_DOCKER,$(version),$(target),$(arch),$(if $(filter amd64,$(arch)),,-$(arch)))))))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 10 19:22:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Dec 2022 19:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.458634.716453 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p45Qq-0005uQ-5o; Sat, 10 Dec 2022 19:22:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 458634.716453; Sat, 10 Dec 2022 19:22:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p45Qq-0005uH-34; Sat, 10 Dec 2022 19:22:44 +0000
Received: by outflank-mailman (input) for mailman id 458634;
 Sat, 10 Dec 2022 19:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45Qo-0005u8-S2
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45Qo-0001qm-RJ
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45Qo-0006RN-QU
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Dw6d8KKP0z/Eimei/5sfdouIp0QsDskwqPC0kNWrxrg=; b=pUo1BTMeuCoFbO1HFqTBIODCio
	RHlfxUiBt/3IQ6At0Oe8SOtg0YNOwtl0m+m1n9wIrL5Sep0wsaZALQumxaPFgO8kxjgAfgVJ6xIqn
	mGthpYZEwK9TPFZVUJFoQJ1vSz/B8lcF4fwGaNgPmiSuw2cWnKtl77lsuJA3gYwWRxh0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add a clean rule for containers
Message-Id: <E1p45Qo-0006RN-QU@xenbits.xenproject.org>
Date: Sat, 10 Dec 2022 19:22:42 +0000

commit 4755d10e9c57808c7e7128e9d9c4615d0eba5cda
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Thu Dec 1 14:25:31 2022 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Dec 9 14:55:33 2022 -0800

    automation: Add a clean rule for containers
    
    Add make clean support to remove the containers from the local docker
    registry.
    make clean-<image_name> must be called to remove an image:
    make clean-yocto/kirkstone-qemuarm: remove yocto kirkstone for qemuarm
    image
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/automation/build/Makefile b/automation/build/Makefile
index c4aaa747ff..f1d56ce532 100644
--- a/automation/build/Makefile
+++ b/automation/build/Makefile
@@ -28,3 +28,13 @@ all: $(CONTAINERS)
 clean:
 	rm -f yocto/*.dockerfile
 
+define CLEAN_RULE
+.PHONY: clean-$(1)
+clean-$(1):
+	if [ -n "$$$$(docker image ls -q $(REGISTRY)/$(subst /,:,$(1)))" ]; then \
+		docker image rm $(REGISTRY)/$(subst /,:,$(1)); \
+	fi
+
+endef
+
+$(eval $(foreach img,$(CONTAINERS) $(CONTAINERS_EXTRA),$(call CLEAN_RULE,$(img))))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 10 19:22:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Dec 2022 19:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.458635.716457 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p45R0-0005wi-7P; Sat, 10 Dec 2022 19:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 458635.716457; Sat, 10 Dec 2022 19:22:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p45R0-0005wa-4S; Sat, 10 Dec 2022 19:22:54 +0000
Received: by outflank-mailman (input) for mailman id 458635;
 Sat, 10 Dec 2022 19:22:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45Qy-0005wS-V0
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45Qy-0001qx-UI
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45Qy-0006Ro-TO
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=R3YDTTbZECGZmrfjBPqydjVTMSVsCX2+7BOddWlK2Wc=; b=BU7oMWhxYJy+M3IB3jGkFs3q4D
	aOqIqXg7O3tS7q7XdcWOCf6OOc8PLVBp3B+MadWEhCGMS1rPSvMKO74lryh9YXgYi1oLSfgwYlq7v
	642mp2BfNWgdrBHSkGGcIGqA4qP6m/8QDaLlSoVBNELBm57UNUA+2XmQl1Q1s86vyEfg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add CI test jobs for Yocto
Message-Id: <E1p45Qy-0006Ro-TO@xenbits.xenproject.org>
Date: Sat, 10 Dec 2022 19:22:52 +0000

commit 15dccc881d0636991955162a11a202023e13a313
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Dec 1 14:25:32 2022 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Dec 9 14:55:33 2022 -0800

    automation: Add CI test jobs for Yocto
    
    Populate test jobs for Yocto based tests using the provided containers.
    Due to the size restrictions, it is currently not possible to split the
    build and run tasks, therefore everything is done in a single step.
    
    Test jobs for the supported Yocto targets are generic to avoid the
    necessity to add new ones after each Yocto release. The only thing
    required to be changed after updating the containers is the variable
    YOCTO_VERSION stored in a .yocto-test template.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml | 45 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index c7e0078e04..2d57f4feb7 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -54,6 +54,35 @@
   tags:
     - x86_64
 
+.yocto-test:
+  extends: .test-jobs-common
+  script:
+    - ./automation/build/yocto/build-yocto.sh -v --log-dir=./logs --xen-dir=`pwd` ${YOCTO_BOARD}
+  variables:
+    YOCTO_VERSION: kirkstone
+    CONTAINER: yocto:${YOCTO_VERSION}-${YOCTO_BOARD}-${YOCTO_HOST}
+  artifacts:
+    paths:
+      - 'logs/*'
+    when: always
+  needs: []
+
+.yocto-test-arm64:
+  extends: .yocto-test
+  variables:
+    YOCTO_HOST: arm64v8
+  tags:
+    - arm64
+
+# This is not used by any test job as we only run Yocto on arm based machines.
+# Keep it here so that someone having x86 hardware can easily add jobs.
+.yocto-test-x86-64:
+  extends: .yocto-test
+  variables:
+    YOCTO_HOST: amd64
+  tags:
+    - x86_64
+
 # Test jobs
 build-each-commit-gcc:
   extends: .test-jobs-common
@@ -188,3 +217,19 @@ qemu-smoke-x86-64-clang-pvh:
     - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
   needs:
     - debian-unstable-clang-debug
+
+# Yocto test jobs
+yocto-qemuarm64:
+  extends: .yocto-test-arm64
+  variables:
+    YOCTO_BOARD: qemuarm64
+
+yocto-qemuarm:
+  extends: .yocto-test-arm64
+  variables:
+    YOCTO_BOARD: qemuarm
+
+yocto-qemux86-64:
+  extends: .yocto-test-arm64
+  variables:
+    YOCTO_BOARD: qemux86-64
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 10 19:23:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Dec 2022 19:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.458636.716462 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p45RA-0005zH-B1; Sat, 10 Dec 2022 19:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 458636.716462; Sat, 10 Dec 2022 19:23:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p45RA-0005z9-68; Sat, 10 Dec 2022 19:23:04 +0000
Received: by outflank-mailman (input) for mailman id 458636;
 Sat, 10 Dec 2022 19:23:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45R9-0005yy-2J
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:23:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45R9-0001rP-1Z
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p45R9-0006SO-0T
 for xen-changelog@lists.xenproject.org; Sat, 10 Dec 2022 19:23: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=W0C9BiHMATgJLHgB6RpUGOwrNg8QMb3PTdwg9kRg7ss=; b=D7MJK991XiwkoHy2U/doe/wmKt
	gjqVALVZ5L4laMcs1kJYXoz++O+q03VS0bQ2JofkwNM0Wx6hg0U0BkoCFZXYYytP9Nnw5GzBz11aK
	oDXbNCTPW5TUWILAxXI5hcAwbZDp4XgV04EKnIt01Sb2/I/and1AzaVCVr852e3o0a+c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xsm/flask: misra rule 8.4 fix
Message-Id: <E1p45R9-0006SO-0T@xenbits.xenproject.org>
Date: Sat, 10 Dec 2022 19:23:03 +0000

commit f86d0a1ff200264aaf80b65d7d200a3ba19c7845
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Wed Dec 7 15:24:24 2022 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Dec 9 14:56:40 2022 -0800

    xsm/flask: misra rule 8.4 fix
    
    Fix several MISRA Issues Rule 8.4 ("A compatible declaration shall be
    visible when an object or function with external linkage is defined")
    found by cppcheck affecting xen/xsm/flask.
    
    - policydb_loaded_version is not declared; removed it because it is
      unused
    - move ss_initialized declaration to xen/xsm/flask/include/conditional.h
    - #include <conditional.h> (which is
      xen/xsm/flask/include/conditional.h) in xen/xsm/flask/ss/policydb.c so
      that policydb.c also gets the declaration of ss_initialized
    - #include <conditional.h> in xen/xsm/flask/ss/services.c to declare
      security_*_bools functions that services.c is defining and using
    
    This patch solves all the Rule 8.4 violations found by cppcheck on xsm/
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/xsm/flask/flask_op.c            | 2 --
 xen/xsm/flask/include/conditional.h | 2 ++
 xen/xsm/flask/ss/policydb.c         | 3 +--
 xen/xsm/flask/ss/services.c         | 5 +----
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
index d319466c6b..b866e8d05f 100644
--- a/xen/xsm/flask/flask_op.c
+++ b/xen/xsm/flask/flask_op.c
@@ -56,8 +56,6 @@ static int bool_num = 0;
 static int *bool_pending_values = NULL;
 static int flask_security_make_bools(void);
 
-extern int ss_initialized;
-
 static int __init cf_check parse_flask_param(const char *s)
 {
     if ( !strcmp(s, "enforcing") )
diff --git a/xen/xsm/flask/include/conditional.h b/xen/xsm/flask/include/conditional.h
index 90553405b0..879d40e147 100644
--- a/xen/xsm/flask/include/conditional.h
+++ b/xen/xsm/flask/include/conditional.h
@@ -24,4 +24,6 @@ int security_find_bool(const char *name);
 char *security_get_bool_name(unsigned int b);
 int security_get_bool_value(unsigned int b);
 
+extern int ss_initialized;
+
 #endif
diff --git a/xen/xsm/flask/ss/policydb.c b/xen/xsm/flask/ss/policydb.c
index 162470bbbd..7f232f92fa 100644
--- a/xen/xsm/flask/ss/policydb.c
+++ b/xen/xsm/flask/ss/policydb.c
@@ -28,6 +28,7 @@
 #include <xen/xmalloc.h>
 #include <xen/string.h>
 #include <xen/errno.h>
+#include <conditional.h>
 #include "security.h"
 
 #include "policydb.h"
@@ -1730,8 +1731,6 @@ static int policydb_bounds_sanity_check(struct policydb *p)
     return 0;
 }
 
-extern int ss_initialized;
-
 /*
  * Read the configuration data from a policy database binary
  * representation file into a policy database structure.
diff --git a/xen/xsm/flask/ss/services.c b/xen/xsm/flask/ss/services.c
index dab07b5f60..35ad1034ca 100644
--- a/xen/xsm/flask/ss/services.c
+++ b/xen/xsm/flask/ss/services.c
@@ -42,6 +42,7 @@
 #include <xen/spinlock.h>
 #include <xen/rwlock.h>
 #include <xen/errno.h>
+#include <conditional.h>
 #include "flask.h"
 #include "avc.h"
 #include "avc_ss.h"
@@ -53,8 +54,6 @@
 #include "conditional.h"
 #include "mls.h"
 
-unsigned int policydb_loaded_version;
-
 static DEFINE_RWLOCK(policy_rwlock);
 #define POLICY_RDLOCK read_lock(&policy_rwlock)
 #define POLICY_WRLOCK write_lock(&policy_rwlock)
@@ -1388,7 +1387,6 @@ int security_load_policy(const void *data, size_t len)
             policydb_destroy(&policydb);
             return -EINVAL;
         }
-        policydb_loaded_version = policydb.policyvers;
         ss_initialized = 1;
         seqno = ++latest_granting;
         LOAD_UNLOCK;
@@ -1447,7 +1445,6 @@ int security_load_policy(const void *data, size_t len)
     memcpy(&policydb, &newpolicydb, sizeof policydb);
     sidtab_set(&sidtab, &newsidtab);
     seqno = ++latest_granting;
-    policydb_loaded_version = policydb.policyvers;
     POLICY_WRUNLOCK;
     LOAD_UNLOCK;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:55:11 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460143.717961 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vRe-0005M4-He; Tue, 13 Dec 2022 02:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460143.717961; Tue, 13 Dec 2022 02: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 1p4vRe-0005Lu-ER; Tue, 13 Dec 2022 02:55:02 +0000
Received: by outflank-mailman (input) for mailman id 460143;
 Tue, 13 Dec 2022 02:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vRd-0005Lm-KF
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vRd-0000pY-JN
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vRd-0008OO-IM
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oA4AEIW4PUhSQXqmWKXMfwXYwRXQRJd2YlLUulg5XI0=; b=7JOMrqKK3ViuMQDaWOpfSehTED
	WfmtRgNXJsk9KzGvIisj5qnSXJlEVyHRP3UA0GeH/tD9a7kgCbuJl9DD6YurBKkBoOAmfEHoVDJDR
	Tp6KI5nEMr3x31va0VQkKDyqWJ2jpqMcQK+UkWiUZ/l5O15au266pYixEL2xL5BRGSsU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored: Fix Oxenstored Live Update
Message-Id: <E1p4vRd-0008OO-IM@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:55:01 +0000

commit dae2ebabf81bfa1554a278ddc895ac0b3ccfcb6e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 19 18:12:33 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/oxenstored: Fix Oxenstored Live Update
    
    tl;dr This hunk was part of the patch emailed to xen-devel, but was missing
    from what ultimately got committed.
    
    https://lore.kernel.org/xen-devel/4164cb728313c3b9fc38cf5e9ecb790ac93a9600.1610748224.git.edvin.torok@citrix.com/
    is the patch in question, but was part of a series that had threading issues.
    I have a vague recollection that I sourced the commits from a local branch,
    which clearly wasn't as up-to-date as I had thought.
    
    Either way, it's my fault/mistake, and this hunk should have been part of what
    got comitted.
    
    Fixes: 00c48f57ab36 ("tools/oxenstored: Start live update process")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-acked-by: Henry Wang <Henry.Wang@arm.com>
    (cherry picked from commit 7110192b1df697be84a50f741651d4c3cb129504)
---
 tools/ocaml/xenstored/xenstored.ml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index c799e20f11..3e9f6ce5b2 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -418,6 +418,11 @@ let _ =
 		rw_sock
 	) in
 
+	(* required for xenstore-control to detect availability of live-update *)
+	Store.mkdir store Perms.Connection.full_rights (Store.Path.of_string "/tool");
+	Store.write store Perms.Connection.full_rights
+		(Store.Path.of_string "/tool/xenstored") Sys.executable_name;
+
 	Sys.set_signal Sys.sighup (Sys.Signal_handle sighup_handler);
 	Sys.set_signal Sys.sigterm (Sys.Signal_handle (fun _ ->
 		info "Received SIGTERM";
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:55:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460144.717965 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vRp-0005O2-Id; Tue, 13 Dec 2022 02:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460144.717965; Tue, 13 Dec 2022 02: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 1p4vRp-0005Nv-G6; Tue, 13 Dec 2022 02:55:13 +0000
Received: by outflank-mailman (input) for mailman id 460144;
 Tue, 13 Dec 2022 02:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vRn-0005Nl-Nc
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vRn-0000pr-Mp
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vRn-0008P1-LX
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=adeSli4/IZNzceSIp1UUvo33vYtAna1lawXcAdQSMf4=; b=Nn2wf5WKn0bZCYoG5ITcgbxvda
	0e1UW/VRo6unEtCscj/XPWzthapE4ZFyDyvyB14TaQytMQse4TNQ05tEiqwlTTz2uKQGxmbjjekle
	yF10Fk4N/HX4sntQ8P74rMi+odAyOob6bWAH4Icjx3G3lEZdEOECHMeZVhxV+ae7XErE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/xenstored: fix live update exception
Message-Id: <E1p4vRn-0008P1-LX@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:55:11 +0000

commit 8837acbcda63bf3f6321642d83089a9d3fb57d80
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Oct 21 08:59:25 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/ocaml/xenstored: fix live update exception
    
    During live update we will load the /tool/xenstored path from the previous binary,
    and then try to mkdir /tool again which will fail with EEXIST.
    Check for existence of the path before creating it.
    
    The write call to /tool/xenstored should not need any changes
    (and we do want to overwrite any previous path, in case it changed).
    
    Prior to 7110192b1df6 live update would work only if the binary path was
    specified, and with 7110192b1df6 and this live update also works when
    no binary path is specified in `xenstore-control live-update`.
    
    Fixes: 7110192b1df6 ("tools/oxenstored: Fix Oxenstored Live Update")
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-acked-by: Henry Wang <Henry.Wang@arm.com>
    (cherry picked from commit f838b956779ff8a0b94636462f3c6d95c3adeb73)
---
 tools/ocaml/xenstored/xenstored.ml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 3e9f6ce5b2..ffd43a4eee 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -419,7 +419,9 @@ let _ =
 	) in
 
 	(* required for xenstore-control to detect availability of live-update *)
-	Store.mkdir store Perms.Connection.full_rights (Store.Path.of_string "/tool");
+	let tool_path = Store.Path.of_string "/tool" in
+	if not (Store.path_exists store tool_path) then
+		Store.mkdir store Perms.Connection.full_rights tool_path;
 	Store.write store Perms.Connection.full_rights
 		(Store.Path.of_string "/tool/xenstored") Sys.executable_name;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:55:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460147.717969 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vRz-0005R5-Lv; Tue, 13 Dec 2022 02:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460147.717969; Tue, 13 Dec 2022 02: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 1p4vRz-0005Qx-J3; Tue, 13 Dec 2022 02:55:23 +0000
Received: by outflank-mailman (input) for mailman id 460147;
 Tue, 13 Dec 2022 02:55:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vRx-0005Qb-QN
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vRx-0000qJ-Pe
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vRx-00006K-Or
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NmAXOUb02svTbri22k8BDeQ81/bC71o3vi40Y53UNK0=; b=GdqM3rO2DDUZE+wz66eWSyYN5o
	/wCGg4Lb3fQq4OIPKpPfqC+CL85ZgYfdoZZIWfW7b3ds4T0PTkSQo+ugp6i17Gluq7Eu5YgE1IHkq
	2kPT/J84lrCfyO4XeOYjf5/5CI0gEVxMgIz7UOBaBPmnOvLXo97mwuJ2NN9mi0EHcwec=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/xenstored/store.ml: fix build error
Message-Id: <E1p4vRx-00006K-Or@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:55:21 +0000

commit 3774760ae0e3ecffb5a1d60133adc172702663b9
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Wed Nov 9 10:48:33 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/ocaml/xenstored/store.ml: fix build error
    
    Building with Dune in release mode fails with:
    ```
    File "ocaml/xenstored/store.ml", line 464, characters 13-32:
    Warning 18: this type-based record disambiguation is not principal.
    File "ocaml/xenstored/store.ml", line 1:
    Error: Some fatal warnings were triggered (1 occurrences)
    ```
    
    This is a warning to help keep the code futureproof, quoting from its
    documentation:
    > Check information path during type-checking, to make sure that all types are
    > derived in a principal way. When using labelled arguments and/or polymorphic
    > methods, this flag is required to ensure future versions of the compiler will
    > be able to infer types correctly, even if internal algorithms change. All
    > programs accepted in -principal mode are also accepted in the default mode with
    > equivalent types, but different binary signatures, and this may slow down type
    > checking; yet it is a good idea to use it once before publishing source code.
    
    Fixes: db471408edd46 "tools/ocaml/xenstored: Fix quota bypass on domain shutdown"
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-acked-by: Henry Wang <Henry.Wang@arm.com>
    (cherry picked from commit 124492eff8e4acdaaed939fa9406b108c55fec73)
---
 tools/ocaml/xenstored/store.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/store.ml b/tools/ocaml/xenstored/store.ml
index 70f0c83de4..c94dbf3a62 100644
--- a/tools/ocaml/xenstored/store.ml
+++ b/tools/ocaml/xenstored/store.ml
@@ -461,7 +461,7 @@ let reset_permissions store domid =
 		| Some perms ->
 			if perms <> node.perms then
 				Logging.debug "store|node" "Changed permissions for node %s" (Node.get_name node);
-			Some { node with perms }
+			Some { node with Node.perms }
 	) store.root
 
 type ops = {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:55:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460148.717974 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vS9-0005U6-NW; Tue, 13 Dec 2022 02:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460148.717974; Tue, 13 Dec 2022 02: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 1p4vS9-0005Ty-Kb; Tue, 13 Dec 2022 02:55:33 +0000
Received: by outflank-mailman (input) for mailman id 460148;
 Tue, 13 Dec 2022 02:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vS7-0005Tm-Um
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vS7-0000qw-U1
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vS7-00006s-Rp
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zWzOyEB7zfi5rEpgvXoJlAEbOj/ZKQVx4OyMQhR+Zug=; b=EzwExTkeQPRTXDCVp22ALhwc5Z
	gA7s3JSpt7kNu3xLEGBpo847Q1jkNDb9y7HfkLd6XrLI6M7hyIEsqq0jX+qgR6vVd146cXWOM8oQr
	xyBSv7ivDFgCjV90rbeN7vwTV4x7/Ozg3YQvmNuOgm591EiAkNc9vzyBZtoQ09A9YX2A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored: Fix incorrect scope after an if statement
Message-Id: <E1p4vS7-00006s-Rp@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:55:31 +0000

commit 94fbce235ec62569b6d236de9914bf301a98c036
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 11 18:50:34 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/oxenstored: Fix incorrect scope after an if statement
    
    A debug statement got inserted into a single-expression if statement.
    
    Insert brackets to give the intended meaning, rather than the actual meaning
    where the "let con = Connections..." is outside and executed unconditionally.
    
    This results in some unnecessary ring checks for domains which otherwise have
    IO credit.
    
    Fixes: 42f0581a91d4 ("tools/oxenstored: Implement live update for socket connections")
    Reported-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit ee36179371fd4215a43fb179be2165f65c1cd1cd)
---
 tools/ocaml/xenstored/xenstored.ml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index ffd43a4eee..c5dc7a28d0 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -475,7 +475,7 @@ let _ =
 
 	let ring_scan_checker dom =
 		(* no need to scan domains already marked as for processing *)
-		if not (Domain.get_io_credit dom > 0) then
+		if not (Domain.get_io_credit dom > 0) then (
 			debug "Looking up domid %d" (Domain.get_id dom);
 			let con = Connections.find_domain cons (Domain.get_id dom) in
 			if not (Connection.has_more_work con) then (
@@ -490,7 +490,8 @@ let _ =
 					let n = 32 + 2 * (Domains.number domains) in
 					info "found lazy domain %d, credit %d" (Domain.get_id dom) n;
 					Domain.set_io_credit ~n dom
-			) in
+			)
+		) in
 
 	let last_stat_time = ref 0. in
 	let last_scan_time = ref 0. in
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:55:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460149.717977 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vSJ-0005WK-Ol; Tue, 13 Dec 2022 02:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460149.717977; Tue, 13 Dec 2022 02:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vSJ-0005WC-M0; Tue, 13 Dec 2022 02:55:43 +0000
Received: by outflank-mailman (input) for mailman id 460149;
 Tue, 13 Dec 2022 02:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSI-0005W4-1M
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSI-0000rE-0f
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSH-00007T-WA
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3PjnSE6NA2DWNCzxZvArEwgn0Q6IOjE4Sc7b6mCyD7c=; b=XsL6biVJuvLNXrvdptNLDomSkk
	jZRgYjOZaA0p8h7ztsUdUczfGvGDcu8jM2Vq9IKoiIvCXNk2Y2NJjWTRqY6GZgkGluhP1ZPuqvPIF
	O196L4x7YCD4wBIZkCxsqSaafK/9qbEpVMvGdijIusaSqaVwPAU/oD6pS3eCTWBVfITw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak
Message-Id: <E1p4vSH-00007T-WA@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:55:41 +0000

commit 5e41efcc506edc588df337aa309779ea50726f8d
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Jan 18 15:04:48 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak
    
    There is no binding for xenevtchn_close().  In principle, this is a resource
    leak, but the typical usage is as a singleton that lives for the lifetime of
    the program.
    
    Ocaml 5 no longer permits storing a naked C pointer in an Ocaml value.
    
    Therefore, use a Custom block.  This allows us to use the finaliser callback
    to call xenevtchn_close(), if the Ocaml object goes out of scope.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 22d5affdf0cecfa6faae46fbaec68b8018835220)
---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index f889a7a2e4..37f1cc4e14 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -33,7 +33,22 @@
 #include <caml/fail.h>
 #include <caml/signals.h>
 
-#define _H(__h) ((xenevtchn_handle *)(__h))
+#define _H(__h) (*((xenevtchn_handle **)Data_custom_val(__h)))
+
+static void stub_evtchn_finalize(value v)
+{
+	xenevtchn_close(_H(v));
+}
+
+static struct custom_operations xenevtchn_ops = {
+	.identifier  = "xenevtchn",
+	.finalize    = stub_evtchn_finalize,
+	.compare     = custom_compare_default,     /* Can't compare     */
+	.hash        = custom_hash_default,        /* Can't hash        */
+	.serialize   = custom_serialize_default,   /* Can't serialize   */
+	.deserialize = custom_deserialize_default, /* Can't deserialize */
+	.compare_ext = custom_compare_ext_default, /* Can't compare     */
+};
 
 CAMLprim value stub_eventchn_init(void)
 {
@@ -48,7 +63,9 @@ CAMLprim value stub_eventchn_init(void)
 	if (xce == NULL)
 		caml_failwith("open failed");
 
-	result = (value)xce;
+	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
+	_H(result) = xce;
+
 	CAMLreturn(result);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:55:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460150.717981 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vST-0005Yu-Q1; Tue, 13 Dec 2022 02:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460150.717981; Tue, 13 Dec 2022 02:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vST-0005Ym-NP; Tue, 13 Dec 2022 02:55:53 +0000
Received: by outflank-mailman (input) for mailman id 460150;
 Tue, 13 Dec 2022 02:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSS-0005YS-68
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSS-0000rT-5O
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSS-00007x-2j
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fDI47zRCX9kcTd+tkBWYm5wCXx9KH63tWuBfhyiHRuA=; b=v2Pmv50Ztn45HV9tUje4/s6m+O
	YQ/umgeHhzotmFNTuV+5pp2suFi45i01HtwawwwybT56bmbASAjq1WkZCRfyhPjE6p3kcbPQM6XUV
	eDUcXJjeonsQCZK3KzGEFkv5pGjdc+Ep63GsuLUZbz3A2o1pXIeLHBqwDMc+jTfkVJTU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/evtchn: Add binding for xenevtchn_fdopen()
Message-Id: <E1p4vSS-00007x-2j@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:55:52 +0000

commit dd3006b1dddd3995b18b7284421c0ba4c4674a04
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Mon Nov 14 13:36:19 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/ocaml/evtchn: Add binding for xenevtchn_fdopen()
    
    For live update, the new oxenstored needs to reconstruct an evtchn object
    around an existing file descriptor.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 7ba68a6c558e1fd811c95cb7215a5cd07a3cc2ea)
---
 tools/ocaml/libs/eventchn/xeneventchn.ml      |  1 +
 tools/ocaml/libs/eventchn/xeneventchn.mli     |  4 ++++
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 19 +++++++++++++++++++
 3 files changed, 24 insertions(+)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn.ml b/tools/ocaml/libs/eventchn/xeneventchn.ml
index dd00a1f0ea..be4de82f46 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn.ml
+++ b/tools/ocaml/libs/eventchn/xeneventchn.ml
@@ -17,6 +17,7 @@
 type handle
 
 external init: unit -> handle = "stub_eventchn_init"
+external fdopen: Unix.file_descr -> handle = "stub_eventchn_fdopen"
 external fd: handle -> Unix.file_descr = "stub_eventchn_fd"
 
 type t = int
diff --git a/tools/ocaml/libs/eventchn/xeneventchn.mli b/tools/ocaml/libs/eventchn/xeneventchn.mli
index 08c7337643..98b3c86f37 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn.mli
+++ b/tools/ocaml/libs/eventchn/xeneventchn.mli
@@ -47,6 +47,10 @@ val init: unit -> handle
 (** Return an initialised event channel interface. On error it
     will throw a Failure exception. *)
 
+val fdopen: Unix.file_descr -> handle
+(** Return an initialised event channel interface, from an already open evtchn
+    file descriptor.  On error it will throw a Failure exception. *)
+
 val fd: handle -> Unix.file_descr
 (** Return a file descriptor suitable for Unix.select. When
     the descriptor becomes readable, it is safe to call 'pending'.
diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index 37f1cc4e14..7bdf711bc1 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -69,6 +69,25 @@ CAMLprim value stub_eventchn_init(void)
 	CAMLreturn(result);
 }
 
+CAMLprim value stub_eventchn_fdopen(value fdval)
+{
+	CAMLparam1(fdval);
+	CAMLlocal1(result);
+	xenevtchn_handle *xce;
+
+	caml_enter_blocking_section();
+	xce = xenevtchn_fdopen(NULL, Int_val(fdval), 0);
+	caml_leave_blocking_section();
+
+	if (xce == NULL)
+		caml_failwith("evtchn fdopen failed");
+
+	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
+	_H(result) = xce;
+
+	CAMLreturn(result);
+}
+
 CAMLprim value stub_eventchn_fd(value xce)
 {
 	CAMLparam1(xce);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:56:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460151.717985 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vSd-0005bp-Ro; Tue, 13 Dec 2022 02:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460151.717985; Tue, 13 Dec 2022 02:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vSd-0005bh-Os; Tue, 13 Dec 2022 02:56:03 +0000
Received: by outflank-mailman (input) for mailman id 460151;
 Tue, 13 Dec 2022 02:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSc-0005bD-9E
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSc-0000rt-8U
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSc-000090-7b
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YIjQWz7PGHfDtYob3GT9n9UTQaKRDPiMaf9issWMJGU=; b=zTipVeK86YQxJRzNU031l9rSpj
	LS1+dKrNzl4s4iYB+ofDPmHfuceBqnbLwnR+K7rJHvYelnsmjHyuAD5C3B7B7fUF58C70FxdPYQ56
	XWgcaziWNiMgacGm9o5glaEkXKH3sWujMvuxy84RQGgjxQ63aYZ0kNUFnFVrQdkAwU2k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/evtchn: Extend the init() binding with a cloexec flag
Message-Id: <E1p4vSc-000090-7b@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:56:02 +0000

commit c96f51bc3e7c166ebdfd4d75fc8a1808fc699ac2
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Thu Nov 3 14:50:38 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/ocaml/evtchn: Extend the init() binding with a cloexec flag
    
    For live update, oxenstored wants to clear CLOEXEC on the evtchn handle, so it
    survives the execve() into the new oxenstored.
    
    Have the new interface match how cloexec works in other Ocaml standard
    libraries.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 9bafe4a53306e7aa2ce6ffc96f7477c6f329f7a7)
---
 tools/ocaml/libs/eventchn/xeneventchn.ml      |  5 ++++-
 tools/ocaml/libs/eventchn/xeneventchn.mli     |  9 ++++++---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 10 +++++++---
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn.ml b/tools/ocaml/libs/eventchn/xeneventchn.ml
index be4de82f46..c16fdd4674 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn.ml
+++ b/tools/ocaml/libs/eventchn/xeneventchn.ml
@@ -16,7 +16,10 @@
 
 type handle
 
-external init: unit -> handle = "stub_eventchn_init"
+external _init: bool -> handle = "stub_eventchn_init"
+
+let init ?(cloexec=true) () = _init cloexec
+
 external fdopen: Unix.file_descr -> handle = "stub_eventchn_fdopen"
 external fd: handle -> Unix.file_descr = "stub_eventchn_fd"
 
diff --git a/tools/ocaml/libs/eventchn/xeneventchn.mli b/tools/ocaml/libs/eventchn/xeneventchn.mli
index 98b3c86f37..870429b6b5 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn.mli
+++ b/tools/ocaml/libs/eventchn/xeneventchn.mli
@@ -43,9 +43,12 @@ val to_int: t -> int
 
 val of_int: int -> t
 
-val init: unit -> handle
-(** Return an initialised event channel interface. On error it
-    will throw a Failure exception. *)
+val init: ?cloexec:bool -> unit -> handle
+(** [init ?cloexec ()]
+    Return an initialised event channel interface.
+    The default is to close the underlying file descriptor
+    on [execve], which can be overriden with [~cloexec:false].
+    On error it will throw a Failure exception. *)
 
 val fdopen: Unix.file_descr -> handle
 (** Return an initialised event channel interface, from an already open evtchn
diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index 7bdf711bc1..aa8a69cc1e 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -50,14 +50,18 @@ static struct custom_operations xenevtchn_ops = {
 	.compare_ext = custom_compare_ext_default, /* Can't compare     */
 };
 
-CAMLprim value stub_eventchn_init(void)
+CAMLprim value stub_eventchn_init(value cloexec)
 {
-	CAMLparam0();
+	CAMLparam1(cloexec);
 	CAMLlocal1(result);
 	xenevtchn_handle *xce;
+	unsigned int flags = 0;
+
+	if ( !Bool_val(cloexec) )
+		flags |= XENEVTCHN_NO_CLOEXEC;
 
 	caml_enter_blocking_section();
-	xce = xenevtchn_open(NULL, 0);
+	xce = xenevtchn_open(NULL, flags);
 	caml_leave_blocking_section();
 
 	if (xce == NULL)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:56:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:56:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460152.717989 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vSn-0005et-VA; Tue, 13 Dec 2022 02:56:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460152.717989; Tue, 13 Dec 2022 02:56:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vSn-0005el-SR; Tue, 13 Dec 2022 02:56:13 +0000
Received: by outflank-mailman (input) for mailman id 460152;
 Tue, 13 Dec 2022 02:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSm-0005eV-C9
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSm-0000s2-BO
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSm-00009V-Af
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1V5AvUyKyJ2cRZsqPb/S4ZR8ERXTjN5OsrDQTZwogiA=; b=gD91tM6wu1i/FSMVhC+YYhSQs5
	1VEESiFJeYRXfiSKRXjXhl2u4TX9ADjsIOntZjoSQmN9u6LJ6+LEj0fypTrow7STKdEioiab+wcO8
	vicLX4HQCNI1Hwoq5MHSMq7+1zcY1q2yBjQoUWLEmLSkQ6ttE+HRm+5mvTkB6HidVhOk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored: Style fixes to Domain
Message-Id: <E1p4vSm-00009V-Af@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:56:12 +0000

commit bb3dcf7bc89c6263cdf4ee82de9edfe58f369e2b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 30 14:56:43 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/oxenstored: Style fixes to Domain
    
    This file has some style problems so severe that they interfere with the
    readability of the subsequent bugfix patches.
    
    Fix these issues ahead of time, to make the subsequent changes more readable.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit b45bfaf359e4821b1bf98a4fcd194d7fd176f167)
---
 tools/ocaml/xenstored/domain.ml | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index 81cb59b8f1..ab08dcf37f 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -57,17 +57,16 @@ let is_paused_for_conflict dom = dom.conflict_credit <= 0.0
 let is_free_to_conflict = is_dom0
 
 let string_of_port = function
-| None -> "None"
-| Some x -> string_of_int (Xeneventchn.to_int x)
+	| None -> "None"
+	| Some x -> string_of_int (Xeneventchn.to_int x)
 
 let dump d chan =
 	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
 
-let notify dom = match dom.port with
-| None ->
-	warn "domain %d: attempt to notify on unknown port" dom.id
-| Some port ->
-	Event.notify dom.eventchn port
+let notify dom =
+	match dom.port with
+	| None -> warn "domain %d: attempt to notify on unknown port" dom.id
+	| Some port -> Event.notify dom.eventchn port
 
 let bind_interdomain dom =
 	begin match dom.port with
@@ -84,8 +83,7 @@ let close dom =
 	| None -> ()
 	| Some port -> Event.unbind dom.eventchn port
 	end;
-	Xenmmap.unmap dom.interface;
-	()
+	Xenmmap.unmap dom.interface
 
 let make id mfn remote_port interface eventchn = {
 	id = id;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:56:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460153.717993 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vSy-0005hr-0F; Tue, 13 Dec 2022 02:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460153.717993; Tue, 13 Dec 2022 02:56:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vSx-0005hj-Tx; Tue, 13 Dec 2022 02:56:23 +0000
Received: by outflank-mailman (input) for mailman id 460153;
 Tue, 13 Dec 2022 02:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSw-0005hV-Gj
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSw-0000s8-G3
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vSw-00009y-DX
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5KR+P8mL7X5bftHPYEeACz3si6Jjo3bdC6WSW1sYRsw=; b=po6bzNRiYXnxCCdn9pdVJ4doiB
	i+gPAn31Sfe/c5WXGOTUimTNSCTWOtknEonMN687LfNIY67fPoI2SCE+f6cqyqJ2MbDj8oCCeboU0
	+dLVV878s4GQ9KI5Eno5cRsHxfeMM2AYCs0KoaL8GOiavJPr/I86MgA580W19rt2aMwk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored: Bind the DOM_EXC VIRQ in in Event.init()
Message-Id: <E1p4vSw-00009y-DX@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:56:22 +0000

commit cd69a4cf61d6a4ae8f0021f2baa1d7eb6462cbb6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Nov 29 21:05:43 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/oxenstored: Bind the DOM_EXC VIRQ in in Event.init()
    
    Xenstored always needs to bind the DOM_EXC VIRQ.
    
    Instead of doing it shortly after the call to Event.init(), do it in the
    constructor directly.  This removes the need for the field to be a mutable
    option.
    
    It will also simplify a future change to support live update.  Rename the
    field from virq_port (which could be any VIRQ) to it's proper name.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 9804a5db435fe40c8ded8cf36c2d2b2281c56f1d)
---
 tools/ocaml/xenstored/event.ml     | 9 ++++++---
 tools/ocaml/xenstored/xenstored.ml | 4 +---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/ocaml/xenstored/event.ml b/tools/ocaml/xenstored/event.ml
index ccca90b6fc..a3be296374 100644
--- a/tools/ocaml/xenstored/event.ml
+++ b/tools/ocaml/xenstored/event.ml
@@ -17,12 +17,15 @@
 (**************** high level binding ****************)
 type t = {
 	handle: Xeneventchn.handle;
-	mutable virq_port: Xeneventchn.t option;
+	domexc: Xeneventchn.t;
 }
 
-let init () = { handle = Xeneventchn.init (); virq_port = None; }
+let init () =
+	let handle = Xeneventchn.init () in
+	let domexc = Xeneventchn.bind_dom_exc_virq handle in
+	{ handle; domexc }
+
 let fd eventchn = Xeneventchn.fd eventchn.handle
-let bind_dom_exc_virq eventchn = eventchn.virq_port <- Some (Xeneventchn.bind_dom_exc_virq eventchn.handle)
 let bind_interdomain eventchn domid port = Xeneventchn.bind_interdomain eventchn.handle domid port
 let unbind eventchn port = Xeneventchn.unbind eventchn.handle port
 let notify eventchn port = Xeneventchn.notify eventchn.handle port
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index c5dc7a28d0..55071b49ec 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -397,7 +397,6 @@ let _ =
 	if cf.restart && Sys.file_exists Disk.xs_daemon_database then (
 		let rwro = DB.from_file store domains cons Disk.xs_daemon_database in
 		info "Live reload: database loaded";
-		Event.bind_dom_exc_virq eventchn;
 		Process.LiveUpdate.completed ();
 		rwro
 	) else (
@@ -413,7 +412,6 @@ let _ =
 
 		if cf.domain_init then (
 			Connections.add_domain cons (Domains.create0 domains);
-			Event.bind_dom_exc_virq eventchn
 		);
 		rw_sock
 	) in
@@ -451,7 +449,7 @@ let _ =
 			let port = Event.pending eventchn in
 			debug "pending port %d" (Xeneventchn.to_int port);
 			finally (fun () ->
-				if Some port = eventchn.Event.virq_port then (
+				if port = eventchn.Event.domexc then (
 					let (notify, deaddom) = Domains.cleanup domains in
 					List.iter (Store.reset_permissions store) deaddom;
 					List.iter (Connections.del_domain cons) deaddom;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:56:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460154.717999 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vT8-0005ka-2z; Tue, 13 Dec 2022 02:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460154.717999; Tue, 13 Dec 2022 02: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 1p4vT7-0005kS-VS; Tue, 13 Dec 2022 02:56:33 +0000
Received: by outflank-mailman (input) for mailman id 460154;
 Tue, 13 Dec 2022 02:56:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vT6-0005kL-Jg
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vT6-0000u8-J1
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vT6-0000Bg-ID
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=py9w6CEkXdV4w1nRhHHVBzwnU6e3DvU8z77SKbOkJk4=; b=oRYJIAMDQW7sjD3tPTgKQm2Udk
	ZRIvm//KIBBz2ilgb9sWwXLl8V2GMojFchhkCLfxrGvgpxGSEJLSVdib9Vh3X5PpWTHdH0OHJTemW
	pRFDNFraS2XvOndpYzxIOmxnZKaztLhT6zOiKciXB8gfi7Uyf8HzALSxEXxIM3JL9W4U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored: Rename some 'port' variables to 'remote_port'
Message-Id: <E1p4vT6-0000Bg-ID@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:56:32 +0000

commit 0ce5f6ddf96cf6d1a4b5ccebaffe7d48df99c12a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 30 03:17:28 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/oxenstored: Rename some 'port' variables to 'remote_port'
    
    This will make the logic clearer when we plumb local_port through these
    functions.
    
    While doing this, rearrange the construct in Domains.create0 to separate the
    remote port handling from the interface handling.  (The interface logic is
    dubious in several ways, but not altered by this cleanup.)
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 31fbee749a75621039ca601eaee7222050a7dd83)
---
 tools/ocaml/xenstored/domains.ml   | 26 ++++++++++++--------------
 tools/ocaml/xenstored/process.ml   | 12 ++++++------
 tools/ocaml/xenstored/xenstored.ml |  8 ++++----
 3 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index 17fe2fa257..26018ac0dd 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -122,9 +122,9 @@ let cleanup doms =
 let resume _doms _domid =
 	()
 
-let create doms domid mfn port =
+let create doms domid mfn remote_port =
 	let interface = Xenctrl.map_foreign_range xc domid (Xenmmap.getpagesize()) mfn in
-	let dom = Domain.make domid mfn port interface doms.eventchn in
+	let dom = Domain.make domid mfn remote_port interface doms.eventchn in
 	Hashtbl.add doms.table domid dom;
 	Domain.bind_interdomain dom;
 	dom
@@ -133,18 +133,16 @@ let xenstored_kva = ref ""
 let xenstored_port = ref ""
 
 let create0 doms =
-	let port, interface =
-		(
-			let port = Utils.read_file_single_integer !xenstored_port
-			and fd = Unix.openfile !xenstored_kva
-					       [ Unix.O_RDWR ] 0o600 in
-			let interface = Xenmmap.mmap fd Xenmmap.RDWR Xenmmap.SHARED
-						  (Xenmmap.getpagesize()) 0 in
-			Unix.close fd;
-			port, interface
-		)
-		in
-	let dom = Domain.make 0 Nativeint.zero port interface doms.eventchn in
+	let remote_port = Utils.read_file_single_integer !xenstored_port in
+
+	let interface =
+		let fd = Unix.openfile !xenstored_kva [ Unix.O_RDWR ] 0o600 in
+		let interface = Xenmmap.mmap fd Xenmmap.RDWR Xenmmap.SHARED (Xenmmap.getpagesize()) 0 in
+		Unix.close fd;
+		interface
+	in
+
+	let dom = Domain.make 0 Nativeint.zero remote_port interface doms.eventchn in
 	Hashtbl.add doms.table 0 dom;
 	Domain.bind_interdomain dom;
 	Domain.notify dom;
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 6cb990ee7f..2026390d7d 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -558,10 +558,10 @@ let do_transaction_end con t domains cons data =
 let do_introduce con t domains cons data =
 	if not (Connection.is_dom0 con)
 	then raise Define.Permission_denied;
-	let (domid, mfn, port) =
+	let (domid, mfn, remote_port) =
 		match (split None '\000' data) with
-		| domid :: mfn :: port :: _ ->
-			int_of_string domid, Nativeint.of_string mfn, int_of_string port
+		| domid :: mfn :: remote_port :: _ ->
+			int_of_string domid, Nativeint.of_string mfn, int_of_string remote_port
 		| _                         -> raise Invalid_Cmd_Args;
 		in
 	let dom =
@@ -569,18 +569,18 @@ let do_introduce con t domains cons data =
 			let edom = Domains.find domains domid in
 			if (Domain.get_mfn edom) = mfn && (Connections.find_domain cons domid) != con then begin
 				(* Use XS_INTRODUCE for recreating the xenbus event-channel. *)
-				edom.remote_port <- port;
+				edom.remote_port <- remote_port;
 				Domain.bind_interdomain edom;
 			end;
 			edom
 		else try
-			let ndom = Domains.create domains domid mfn port in
+			let ndom = Domains.create domains domid mfn remote_port in
 			Connections.add_domain cons ndom;
 			Connections.fire_spec_watches (Transaction.get_root t) cons Store.Path.introduce_domain;
 			ndom
 		with _ -> raise Invalid_Cmd_Args
 	in
-	if (Domain.get_remote_port dom) <> port || (Domain.get_mfn dom) <> mfn then
+	if (Domain.get_remote_port dom) <> remote_port || (Domain.get_mfn dom) <> mfn then
 		raise Domain_not_match
 
 let do_release con t domains cons data =
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 55071b49ec..1f11f576b5 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -167,10 +167,10 @@ let from_channel_f chan global_f socket_f domain_f watch_f store_f =
 					global_f ~rw
 				| "socket" :: fd :: [] ->
 					socket_f ~fd:(int_of_string fd)
-				| "dom" :: domid :: mfn :: port :: []->
+				| "dom" :: domid :: mfn :: remote_port :: []->
 					domain_f (int_of_string domid)
 					         (Nativeint.of_string mfn)
-					         (int_of_string port)
+					         (int_of_string remote_port)
 				| "watch" :: domid :: path :: token :: [] ->
 					watch_f (int_of_string domid)
 					        (unhexify path) (unhexify token)
@@ -209,10 +209,10 @@ let from_channel store cons doms chan =
 		else
 			warn "Ignoring invalid socket FD %d" fd
 	in
-	let domain_f domid mfn port =
+	let domain_f domid mfn remote_port =
 		let ndom =
 			if domid > 0 then
-				Domains.create doms domid mfn port
+				Domains.create doms domid mfn remote_port
 			else
 				Domains.create0 doms
 			in
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:56:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:56:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460155.718001 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vTI-0005nh-3M; Tue, 13 Dec 2022 02:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460155.718001; Tue, 13 Dec 2022 02:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vTI-0005nZ-0l; Tue, 13 Dec 2022 02:56:44 +0000
Received: by outflank-mailman (input) for mailman id 460155;
 Tue, 13 Dec 2022 02:56:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTG-0005nJ-Mh
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTG-0000uC-Lx
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTG-0000KF-LD
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/OkRuPxEfwERBnrKEPQtfnZoIHkQpK9ZMFVbHBnMP/w=; b=ehwIwMF9Um2KiMvAGV89D7xyqd
	pZO9HIb6P+v0dtIzaNj/+NO6syidt+o5zWVlZnzjz/yNwhkWsmk+o4gHkQxRoeg31f1dX0nkHvoe+
	uASGlfA0vODr9839YhS+HK3GD62j8GO5F820JjXk88E42p8fFSixLc59qNfCxigIEW7Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored: Implement Domain.rebind_evtchn
Message-Id: <E1p4vTG-0000KF-LD@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:56:42 +0000

commit 5c11a898e5b995c5c92fbc7fe50b8cb2671ab1fb
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 30 11:55:58 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/oxenstored: Implement Domain.rebind_evtchn
    
    Generally speaking, the event channel local/remote port is fixed for the
    lifetime of the associated domain object.  The exception to this is a
    secondary XS_INTRODUCE (defined to re-bind to a new event channel) which pokes
    around at the domain object's internal state.
    
    We need to refactor the evtchn handling to support live update, so start by
    moving the relevant manipulation into Domain.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit aecdc28d9538ca2a1028ef9bc6550cb171dbbed4)
---
 tools/ocaml/xenstored/domain.ml  | 12 ++++++++++++
 tools/ocaml/xenstored/process.ml |  3 +--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index ab08dcf37f..d59a9401e2 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -63,6 +63,18 @@ let string_of_port = function
 let dump d chan =
 	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
 
+let rebind_evtchn d remote_port =
+	begin match d.port with
+	| None -> ()
+	| Some p -> Event.unbind d.eventchn p
+	end;
+	let local = Event.bind_interdomain d.eventchn d.id remote_port in
+	debug "domain %d rebind (l %s, r %d) => (l %d, r %d)"
+	      d.id (string_of_port d.port) d.remote_port
+	      (Xeneventchn.to_int local) remote_port;
+	d.remote_port <- remote_port;
+	d.port <- Some (local)
+
 let notify dom =
 	match dom.port with
 	| None -> warn "domain %d: attempt to notify on unknown port" dom.id
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 2026390d7d..8948c4bba6 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -569,8 +569,7 @@ let do_introduce con t domains cons data =
 			let edom = Domains.find domains domid in
 			if (Domain.get_mfn edom) = mfn && (Connections.find_domain cons domid) != con then begin
 				(* Use XS_INTRODUCE for recreating the xenbus event-channel. *)
-				edom.remote_port <- remote_port;
-				Domain.bind_interdomain edom;
+				Domain.rebind_evtchn edom remote_port;
 			end;
 			edom
 		else try
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:56:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:56:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460156.718005 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vTS-0005q0-5I; Tue, 13 Dec 2022 02:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460156.718005; Tue, 13 Dec 2022 02:56:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vTS-0005ps-2D; Tue, 13 Dec 2022 02:56:54 +0000
Received: by outflank-mailman (input) for mailman id 460156;
 Tue, 13 Dec 2022 02:56:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTQ-0005pj-S7
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTQ-0000uS-RH
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTQ-0000Kr-OE
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:56:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Jr+TOcqHK4+nGAIl2H6AL6b/Cq32XI1p0v7Fxrz0rjg=; b=DQqNow9VWJXjYbMbHhmOiQ2vzV
	m+JXv75vCrlA47yOCiBgI5dQ0XOt0IwNCbWZ0Tk7WKwdTSRrcPp9FoIBdDZzZHj6T2hI1gkUoOvKs
	zmerYwUWADhhIpeQPpg60OhlshkUitA0cp06m/+imEs1BOzM7OO9xCVnuXyBlFSsBfDE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored: Rework Domain evtchn handling to use port_pair
Message-Id: <E1p4vTQ-0000Kr-OE@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:56:52 +0000

commit e5502f2bbde2582749e6e0391c5b80419de83fd7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 30 11:59:34 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/oxenstored: Rework Domain evtchn handling to use port_pair
    
    Inter-domain event channels are always a pair of local and remote ports.
    Right now the handling is asymmetric, caused by the fact that the evtchn is
    bound after the associated Domain object is constructed.
    
    First, move binding of the event channel into the Domain.make() constructor.
    This means the local port no longer needs to be an option.  It also removes
    the final callers of Domain.bind_interdomain.
    
    Next, introduce a new port_pair type to encapsulate the fact that these two
    should be updated together, and replace the previous port and remote_port
    fields.  This refactoring also changes the Domain.get_port interface (removing
    an option) so take the opportunity to name it get_local_port instead.
    
    Also, this fixes a use-after-free risk with Domain.close.  Once the evtchn has
    been unbound, the same local port number can be reused for a different
    purpose, so explicitly invalidate the ports to prevent their accidental misuse
    in the future.
    
    This also cleans up some of the debugging, to always print a port pair.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit df2db174b36eba67c218763ef621c67912202fc6)
---
 tools/ocaml/xenstored/connections.ml |  9 +----
 tools/ocaml/xenstored/domain.ml      | 75 ++++++++++++++++++------------------
 tools/ocaml/xenstored/domains.ml     |  2 -
 3 files changed, 39 insertions(+), 47 deletions(-)

diff --git a/tools/ocaml/xenstored/connections.ml b/tools/ocaml/xenstored/connections.ml
index 7d68c583b4..a80ae0bed2 100644
--- a/tools/ocaml/xenstored/connections.ml
+++ b/tools/ocaml/xenstored/connections.ml
@@ -48,9 +48,7 @@ let add_domain cons dom =
 	let xbcon = Xenbus.Xb.open_mmap ~capacity (Domain.get_interface dom) (fun () -> Domain.notify dom) in
 	let con = Connection.create xbcon (Some dom) in
 	Hashtbl.add cons.domains (Domain.get_id dom) con;
-	match Domain.get_port dom with
-	| Some p -> Hashtbl.add cons.ports p con;
-	| None -> ()
+	Hashtbl.add cons.ports (Domain.get_local_port dom) con
 
 let select ?(only_if = (fun _ -> true)) cons =
 	Hashtbl.fold (fun _ con (ins, outs) ->
@@ -97,10 +95,7 @@ let del_domain cons id =
 		let con = find_domain cons id in
 		Hashtbl.remove cons.domains id;
 		(match Connection.get_domain con with
-		 | Some d ->
-		   (match Domain.get_port d with
-		    | Some p -> Hashtbl.remove cons.ports p
-		    | None -> ())
+		 | Some d -> Hashtbl.remove cons.ports (Domain.get_local_port d)
 		 | None -> ());
 		del_watches cons con;
 		Connection.close con
diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index d59a9401e2..481e10794d 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -19,14 +19,31 @@ open Printf
 let debug fmt = Logging.debug "domain" fmt
 let warn  fmt = Logging.warn  "domain" fmt
 
+(* A bound inter-domain event channel port pair.  The remote port, and the
+   local port it is bound to. *)
+type port_pair =
+{
+	local: Xeneventchn.t;
+	remote: int;
+}
+
+(* Sentinal port_pair with both set to EVTCHN_INVALID *)
+let invalid_ports =
+{
+	local = Xeneventchn.of_int 0;
+	remote = 0
+}
+
+let string_of_port_pair p =
+	sprintf "(l %d, r %d)" (Xeneventchn.to_int p.local) p.remote
+
 type t =
 {
 	id: Xenctrl.domid;
 	mfn: nativeint;
 	interface: Xenmmap.mmap_interface;
 	eventchn: Event.t;
-	mutable remote_port: int;
-	mutable port: Xeneventchn.t option;
+	mutable ports: port_pair;
 	mutable bad_client: bool;
 	mutable io_credit: int; (* the rounds of ring process left to do, default is 0,
 	                           usually set to 1 when there is work detected, could
@@ -41,8 +58,8 @@ let is_dom0 d = d.id = 0
 let get_id domain = domain.id
 let get_interface d = d.interface
 let get_mfn d = d.mfn
-let get_remote_port d = d.remote_port
-let get_port d = d.port
+let get_remote_port d = d.ports.remote
+let get_local_port d = d.ports.local
 
 let is_bad_domain domain = domain.bad_client
 let mark_as_bad domain = domain.bad_client <- true
@@ -56,54 +73,36 @@ let is_paused_for_conflict dom = dom.conflict_credit <= 0.0
 
 let is_free_to_conflict = is_dom0
 
-let string_of_port = function
-	| None -> "None"
-	| Some x -> string_of_int (Xeneventchn.to_int x)
-
 let dump d chan =
-	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
+	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.ports.remote
 
 let rebind_evtchn d remote_port =
-	begin match d.port with
-	| None -> ()
-	| Some p -> Event.unbind d.eventchn p
-	end;
+	Event.unbind d.eventchn d.ports.local;
 	let local = Event.bind_interdomain d.eventchn d.id remote_port in
-	debug "domain %d rebind (l %s, r %d) => (l %d, r %d)"
-	      d.id (string_of_port d.port) d.remote_port
-	      (Xeneventchn.to_int local) remote_port;
-	d.remote_port <- remote_port;
-	d.port <- Some (local)
+	let new_ports = { local; remote = remote_port } in
+	debug "domain %d rebind %s => %s"
+	      d.id (string_of_port_pair d.ports) (string_of_port_pair new_ports);
+	d.ports <- new_ports
 
 let notify dom =
-	match dom.port with
-	| None -> warn "domain %d: attempt to notify on unknown port" dom.id
-	| Some port -> Event.notify dom.eventchn port
-
-let bind_interdomain dom =
-	begin match dom.port with
-	| None -> ()
-	| Some port -> Event.unbind dom.eventchn port
-	end;
-	dom.port <- Some (Event.bind_interdomain dom.eventchn dom.id dom.remote_port);
-	debug "bound domain %d remote port %d to local port %s" dom.id dom.remote_port (string_of_port dom.port)
-
+	Event.notify dom.eventchn dom.ports.local
 
 let close dom =
-	debug "domain %d unbound port %s" dom.id (string_of_port dom.port);
-	begin match dom.port with
-	| None -> ()
-	| Some port -> Event.unbind dom.eventchn port
-	end;
+	debug "domain %d unbind %s" dom.id (string_of_port_pair dom.ports);
+	Event.unbind dom.eventchn dom.ports.local;
+	dom.ports <- invalid_ports;
 	Xenmmap.unmap dom.interface
 
-let make id mfn remote_port interface eventchn = {
+let make id mfn remote_port interface eventchn =
+	let local = Event.bind_interdomain eventchn id remote_port in
+	let ports = { local; remote = remote_port } in
+	debug "domain %d bind %s" id (string_of_port_pair ports);
+{
 	id = id;
 	mfn = mfn;
-	remote_port = remote_port;
+	ports;
 	interface = interface;
 	eventchn = eventchn;
-	port = None;
 	bad_client = false;
 	io_credit = 0;
 	conflict_credit = !Define.conflict_burst_limit;
diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index 26018ac0dd..2ab0c5f4d8 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -126,7 +126,6 @@ let create doms domid mfn remote_port =
 	let interface = Xenctrl.map_foreign_range xc domid (Xenmmap.getpagesize()) mfn in
 	let dom = Domain.make domid mfn remote_port interface doms.eventchn in
 	Hashtbl.add doms.table domid dom;
-	Domain.bind_interdomain dom;
 	dom
 
 let xenstored_kva = ref ""
@@ -144,7 +143,6 @@ let create0 doms =
 
 	let dom = Domain.make 0 Nativeint.zero remote_port interface doms.eventchn in
 	Hashtbl.add doms.table 0 dom;
-	Domain.bind_interdomain dom;
 	Domain.notify dom;
 	dom
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:57:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:57:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460157.718009 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vTb-0005tJ-9A; Tue, 13 Dec 2022 02:57:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460157.718009; Tue, 13 Dec 2022 02:57:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vTb-0005tC-6E; Tue, 13 Dec 2022 02:57:03 +0000
Received: by outflank-mailman (input) for mailman id 460157;
 Tue, 13 Dec 2022 02:57:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTa-0005t6-VA
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTa-0000uu-UP
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTa-0000LS-TZ
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9cU7OU+/vU5dotYsisgORAtjFzJi2H2Q1NuyVKFkPuI=; b=YmqlLr0JAbqayutqXaT7Y+1D2F
	jyAJmQ1n+qti7Av4vuyTWF6nCPzGT07ctpny629qyZ9tCPRBfT+NDpXpW051Y+ZJdW6dd0DA8lkM8
	URr3kTG+5nNlMyS5YfdQUtwdl8I2G1jy0dcN5cyzdU3dmhKjOgPIOOOfv/b9nMp/riLk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored: Keep /dev/xen/evtchn open across live update
Message-Id: <E1p4vTa-0000LS-TZ@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:57:02 +0000

commit 8108d3c99c30a39414bcca5cbab1ce98ceece90d
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Thu Nov 3 15:31:39 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/oxenstored: Keep /dev/xen/evtchn open across live update
    
    Closing the evtchn handle will unbind and free all local ports.  The new
    xenstored would need to rebind all evtchns, which is work that we don't want
    or need to be doing during the critical handover period.
    
    However, it turns out that the Windows PV drivers also rebind their local port
    too across suspend/resume, leaving (o)xenstored with a stale idea of the
    remote port to use.  In this case, reusing the established connection is the
    only robust option.
    
    Therefore:
     * Have oxenstored open /dev/xen/evtchn without CLOEXEC at start of day.
     * Extend the handover information with the evtchn fd, domexc virq local port,
       and the local port number for each domain connection.
     * Have (the new) oxenstored recover the open handle using Xeneventchn.fdopen,
       and use the provided local ports rather than trying to rebind them.
    
    When this new information isn't present (i.e. live updating from an oxenstored
    prior to this change), the best-effort status quo will have to do.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 9b224c25293a53fcbe32da68052d861dda71a6f4)
---
 tools/ocaml/xenstored/domain.ml    | 13 ++++--
 tools/ocaml/xenstored/domains.ml   |  9 ++--
 tools/ocaml/xenstored/event.ml     | 20 +++++++--
 tools/ocaml/xenstored/process.ml   |  2 +-
 tools/ocaml/xenstored/xenstored.ml | 85 +++++++++++++++++++++++++-------------
 5 files changed, 90 insertions(+), 39 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index 481e10794d..5c15752a37 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -74,7 +74,8 @@ let is_paused_for_conflict dom = dom.conflict_credit <= 0.0
 let is_free_to_conflict = is_dom0
 
 let dump d chan =
-	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.ports.remote
+	fprintf chan "dom,%d,%nd,%d,%d\n"
+		d.id d.mfn d.ports.remote (Xeneventchn.to_int d.ports.local)
 
 let rebind_evtchn d remote_port =
 	Event.unbind d.eventchn d.ports.local;
@@ -93,8 +94,14 @@ let close dom =
 	dom.ports <- invalid_ports;
 	Xenmmap.unmap dom.interface
 
-let make id mfn remote_port interface eventchn =
-	let local = Event.bind_interdomain eventchn id remote_port in
+(* On clean start, local_port will be None, and we must bind the remote port
+   given.  On Live Update, the event channel is already bound, and both the
+   local and remote port numbers come from the transfer record. *)
+let make ?local_port ~remote_port id mfn interface eventchn =
+	let local = match local_port with
+		| None -> Event.bind_interdomain eventchn id remote_port
+		| Some p -> Xeneventchn.of_int p
+	in
 	let ports = { local; remote = remote_port } in
 	debug "domain %d bind %s" id (string_of_port_pair ports);
 {
diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index 2ab0c5f4d8..b6c075c838 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -56,6 +56,7 @@ let exist doms id = Hashtbl.mem doms.table id
 let find doms id = Hashtbl.find doms.table id
 let number doms = Hashtbl.length doms.table
 let iter doms fct = Hashtbl.iter (fun _ b -> fct b) doms.table
+let eventchn doms = doms.eventchn
 
 let rec is_empty_queue q =
 	Queue.is_empty q ||
@@ -122,16 +123,16 @@ let cleanup doms =
 let resume _doms _domid =
 	()
 
-let create doms domid mfn remote_port =
+let create doms ?local_port ~remote_port domid mfn =
 	let interface = Xenctrl.map_foreign_range xc domid (Xenmmap.getpagesize()) mfn in
-	let dom = Domain.make domid mfn remote_port interface doms.eventchn in
+	let dom = Domain.make ?local_port ~remote_port domid mfn interface doms.eventchn in
 	Hashtbl.add doms.table domid dom;
 	dom
 
 let xenstored_kva = ref ""
 let xenstored_port = ref ""
 
-let create0 doms =
+let create0 ?local_port doms =
 	let remote_port = Utils.read_file_single_integer !xenstored_port in
 
 	let interface =
@@ -141,7 +142,7 @@ let create0 doms =
 		interface
 	in
 
-	let dom = Domain.make 0 Nativeint.zero remote_port interface doms.eventchn in
+	let dom = Domain.make ?local_port ~remote_port 0 Nativeint.zero interface doms.eventchn in
 	Hashtbl.add doms.table 0 dom;
 	Domain.notify dom;
 	dom
diff --git a/tools/ocaml/xenstored/event.ml b/tools/ocaml/xenstored/event.ml
index a3be296374..629dc6041b 100644
--- a/tools/ocaml/xenstored/event.ml
+++ b/tools/ocaml/xenstored/event.ml
@@ -20,9 +20,18 @@ type t = {
 	domexc: Xeneventchn.t;
 }
 
-let init () =
-	let handle = Xeneventchn.init () in
-	let domexc = Xeneventchn.bind_dom_exc_virq handle in
+(* On clean start, both parameters will be None, and we must open the evtchn
+   handle and bind the DOM_EXC VIRQ.  On Live Update, the fd is preserved
+   across exec(), and the DOM_EXC VIRQ still bound. *)
+let init ?fd ?domexc_port () =
+	let handle = match fd with
+		| None -> Xeneventchn.init ~cloexec:false ()
+		| Some fd -> fd |> Utils.FD.of_int |> Xeneventchn.fdopen
+	in
+	let domexc = match domexc_port with
+		| None -> Xeneventchn.bind_dom_exc_virq handle
+		| Some p -> Xeneventchn.of_int p
+	in
 	{ handle; domexc }
 
 let fd eventchn = Xeneventchn.fd eventchn.handle
@@ -31,3 +40,8 @@ let unbind eventchn port = Xeneventchn.unbind eventchn.handle port
 let notify eventchn port = Xeneventchn.notify eventchn.handle port
 let pending eventchn = Xeneventchn.pending eventchn.handle
 let unmask eventchn port = Xeneventchn.unmask eventchn.handle port
+
+let dump e chan =
+	Printf.fprintf chan "evtchn-dev,%d,%d\n"
+		       (Utils.FD.to_int @@ Xeneventchn.fd e.handle)
+		       (Xeneventchn.to_int e.domexc)
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 8948c4bba6..0b0700d931 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -573,7 +573,7 @@ let do_introduce con t domains cons data =
 			end;
 			edom
 		else try
-			let ndom = Domains.create domains domid mfn remote_port in
+			let ndom = Domains.create ~remote_port domains domid mfn in
 			Connections.add_domain cons ndom;
 			Connections.fire_spec_watches (Transaction.get_root t) cons Store.Path.introduce_domain;
 			ndom
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 1f11f576b5..f526f4fb23 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -144,7 +144,7 @@ exception Bad_format of string
 
 let dump_format_header = "$xenstored-dump-format"
 
-let from_channel_f chan global_f socket_f domain_f watch_f store_f =
+let from_channel_f chan global_f evtchn_f socket_f domain_f watch_f store_f =
 	let unhexify s = Utils.unhexify s in
 	let getpath s =
 		let u = Utils.unhexify s in
@@ -165,12 +165,19 @@ let from_channel_f chan global_f socket_f domain_f watch_f store_f =
 					(* there might be more parameters here,
 					   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)
 				| "socket" :: fd :: [] ->
 					socket_f ~fd:(int_of_string fd)
-				| "dom" :: domid :: mfn :: remote_port :: []->
-					domain_f (int_of_string domid)
-					         (Nativeint.of_string mfn)
-					         (int_of_string remote_port)
+				| "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
+					domain_f ?local_port
+						 ~remote_port:(int_of_string remote_port)
+						 (int_of_string domid)
+						 (Nativeint.of_string mfn)
 				| "watch" :: domid :: path :: token :: [] ->
 					watch_f (int_of_string domid)
 					        (unhexify path) (unhexify token)
@@ -189,10 +196,21 @@ let from_channel_f chan global_f socket_f domain_f watch_f store_f =
 	done;
 	info "Completed loading xenstore dump"
 
-let from_channel store cons doms chan =
+let from_channel store cons domains_init chan =
 	(* don't let the permission get on our way, full perm ! *)
 	let op = Store.get_ops store Perms.Connection.full_rights in
 	let rwro = ref (None) in
+	let doms = ref (None) in
+
+	let require_doms () =
+		match !doms with
+		| None ->
+			warn "No event channel file descriptor available in dump!";
+		        let domains = domains_init @@ Event.init () in
+		        doms := Some domains;
+		        domains
+		| Some d -> d
+	in
 	let global_f ~rw =
 		let get_listen_sock sockfd =
 			let fd = sockfd |> int_of_string |> Utils.FD.of_int in
@@ -201,6 +219,10 @@ let from_channel store cons doms chan =
 		in
 		rwro := get_listen_sock rw
 	in
+	let evtchn_f ~fd ~domexc_port =
+		let evtchn = Event.init ~fd ~domexc_port () in
+		doms := Some(domains_init evtchn)
+	in
 	let socket_f ~fd =
 		let ufd = Utils.FD.of_int fd in
 		let is_valid = try (Unix.fstat ufd).Unix.st_kind = Unix.S_SOCK with _ -> false in
@@ -209,12 +231,13 @@ let from_channel store cons doms chan =
 		else
 			warn "Ignoring invalid socket FD %d" fd
 	in
-	let domain_f domid mfn remote_port =
+	let domain_f ?local_port ~remote_port domid mfn =
+		let doms = require_doms () in
 		let ndom =
 			if domid > 0 then
-				Domains.create doms domid mfn remote_port
+				Domains.create ?local_port ~remote_port doms domid mfn
 			else
-				Domains.create0 doms
+				Domains.create0 ?local_port doms
 			in
 		Connections.add_domain cons ndom;
 		in
@@ -229,8 +252,8 @@ let from_channel store cons doms chan =
 		op.Store.write path value;
 		op.Store.setperms path perms
 		in
-	from_channel_f chan global_f socket_f domain_f watch_f store_f;
-	!rwro
+	from_channel_f chan global_f evtchn_f socket_f domain_f watch_f store_f;
+	!rwro, require_doms ()
 
 let from_file store cons doms file =
 	info "Loading xenstore dump from %s" file;
@@ -238,7 +261,7 @@ let from_file store cons doms file =
 	finally (fun () -> from_channel store doms cons channel)
 	        (fun () -> close_in channel)
 
-let to_channel store cons rw chan =
+let to_channel store cons (rw, evtchn) chan =
 	let hexify s = Utils.hexify s in
 
 	fprintf chan "%s\n" dump_format_header;
@@ -248,6 +271,9 @@ let to_channel store cons rw chan =
 		Utils.FD.to_int fd in
 	fprintf chan "global,%d\n" (fdopt rw);
 
+	(* dump evtchn device info *)
+	Event.dump evtchn chan;
+
 	(* dump connections related to domains: domid, mfn, eventchn port/ sockets, and watches *)
 	Connections.iter cons (fun con -> Connection.dump con chan);
 
@@ -367,7 +393,6 @@ let _ =
 	| None         -> () end;
 
 	let store = Store.create () in
-	let eventchn = Event.init () in
 	let next_frequent_ops = ref 0. in
 	let advance_next_frequent_ops () =
 		next_frequent_ops := (Unix.gettimeofday () +. !Define.conflict_max_history_seconds)
@@ -375,16 +400,8 @@ let _ =
 	let delay_next_frequent_ops_by duration =
 		next_frequent_ops := !next_frequent_ops +. duration
 	in
-	let domains = Domains.init eventchn advance_next_frequent_ops in
+	let domains_init eventchn = Domains.init eventchn advance_next_frequent_ops in
 
-	(* For things that need to be done periodically but more often
-	 * than the periodic_ops function *)
-	let frequent_ops () =
-		if Unix.gettimeofday () > !next_frequent_ops then (
-			History.trim ();
-			Domains.incr_conflict_credit domains;
-			advance_next_frequent_ops ()
-		) in
 	let cons = Connections.create () in
 
 	let quit = ref false in
@@ -393,14 +410,15 @@ let _ =
 	List.iter (fun path ->
 		Store.write store Perms.Connection.full_rights path "") Store.Path.specials;
 
-	let rw_sock =
+	let rw_sock, domains =
 	if cf.restart && Sys.file_exists Disk.xs_daemon_database then (
-		let rwro = DB.from_file store domains cons Disk.xs_daemon_database in
+		let rw, domains = DB.from_file store domains_init cons Disk.xs_daemon_database in
 		info "Live reload: database loaded";
 		Process.LiveUpdate.completed ();
-		rwro
+		rw, domains
 	) else (
 		info "No live reload: regular startup";
+		let domains = domains_init @@ Event.init () in
 		if !Disk.enable then (
 			info "reading store from disk";
 			Disk.read store
@@ -413,9 +431,18 @@ let _ =
 		if cf.domain_init then (
 			Connections.add_domain cons (Domains.create0 domains);
 		);
-		rw_sock
+		rw_sock, domains
 	) in
 
+	(* For things that need to be done periodically but more often
+	 * than the periodic_ops function *)
+	let frequent_ops () =
+		if Unix.gettimeofday () > !next_frequent_ops then (
+			History.trim ();
+			Domains.incr_conflict_credit domains;
+			advance_next_frequent_ops ()
+		) in
+
 	(* required for xenstore-control to detect availability of live-update *)
 	let tool_path = Store.Path.of_string "/tool" in
 	if not (Store.path_exists store tool_path) then
@@ -430,8 +457,10 @@ let _ =
 	Sys.set_signal Sys.sigusr1 (Sys.Signal_handle (fun _ -> sigusr1_handler store));
 	Sys.set_signal Sys.sigpipe Sys.Signal_ignore;
 
+	let eventchn = Domains.eventchn domains in
+
 	if cf.activate_access_log then begin
-		let post_rotate () = DB.to_file store cons (None) Disk.xs_daemon_database in
+		let post_rotate () = DB.to_file store cons (None, eventchn) Disk.xs_daemon_database in
 		Logging.init_access_log post_rotate
 	end;
 
@@ -593,7 +622,7 @@ let _ =
 			live_update := Process.LiveUpdate.should_run cons;
 			if !live_update || !quit then begin
 				(* don't initiate live update if saving state fails *)
-				DB.to_file store cons (rw_sock) Disk.xs_daemon_database;
+				DB.to_file store cons (rw_sock, eventchn) Disk.xs_daemon_database;
 				quit := true;
 			end
 		with exc ->
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:57:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:57:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460158.718013 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vTm-0005wT-Au; Tue, 13 Dec 2022 02:57:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460158.718013; Tue, 13 Dec 2022 02: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 1p4vTm-0005wL-80; Tue, 13 Dec 2022 02:57:14 +0000
Received: by outflank-mailman (input) for mailman id 460158;
 Tue, 13 Dec 2022 02:57:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTl-0005wE-42
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTl-0000v3-39
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTl-0000Lw-1e
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=B74I2ZFBdGTOd5ts8SLaeXPp3L6EH2jg4k8Bm+LKtJ4=; b=5VW/BqHFj31Vl7h0I1GD6d2c2T
	n1Sh9rI04MRVe+EdQH9SwBIlPntAfGhHs3p8lHh3fscNWSWraMiRdkdzvyPODRz/fWURktxcvj82s
	e9c9ls6zx5zuTWTuKTmg0icGbf24lHIW0tMUt/6zUHmOdT1F/O7dQaffUZW+Cz7qv428=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored: Log live update issues at warning level
Message-Id: <E1p4vTl-0000Lw-1e@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:57:13 +0000

commit 724d003ecc23539543bbc118b84d33c1f2fcf7c4
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 8 08:57:47 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/oxenstored: Log live update issues at warning level
    
    During live update, oxenstored tries a best effort approach to recover as many
    domains and information as possible even if it encounters errors restoring
    some domains.
    
    However, logging about misunderstood input is more severe than simply info.
    Log it at warning instead.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 3f02e0a70fe9f8143454b742563433958d4a87f8)
---
 tools/ocaml/xenstored/xenstored.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index f526f4fb23..35b8cbd43f 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -186,9 +186,9 @@ let from_channel_f chan global_f evtchn_f socket_f domain_f watch_f store_f =
 					        (Perms.Node.of_string (unhexify perms ^ "\000"))
 					        (unhexify value)
 				| _ ->
-					info "restoring: ignoring unknown line: %s" line
+					warn "restoring: ignoring unknown line: %s" line
 			with exn ->
-				info "restoring: ignoring unknown line: %s (exception: %s)"
+				warn "restoring: ignoring unknown line: %s (exception: %s)"
 				     line (Printexc.to_string exn);
 				()
 		with End_of_file ->
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:57:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:57:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460159.718017 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vTw-0005zW-C0; Tue, 13 Dec 2022 02:57:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460159.718017; Tue, 13 Dec 2022 02:57:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vTw-0005zP-9S; Tue, 13 Dec 2022 02:57:24 +0000
Received: by outflank-mailman (input) for mailman id 460159;
 Tue, 13 Dec 2022 02:57:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTv-0005zB-6d
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTv-0000v9-60
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vTv-0000Nm-5I
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MXzLSzWNXIFPfrdfA1K9t9i9iD9CRytQPtSi0ILTlQ8=; b=JtfEzfj/zR0QilB4Pwu6Y56tCB
	LfJAeECbjPJf/9WCTURMGnzJQVVUxIlcZvahiE95wPQJYx3at/3nq1TCuKzj72lg2TxyV93msM/Aa
	lt2O+TJLNUoIA7IcVzpk6Rovr8XwlvfcLxNYiA1XiSqLYPUkPKySchNWmYUaFAaffRzY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored: Set uncaught exception handler
Message-Id: <E1p4vTv-0000Nm-5I@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:57:23 +0000

commit a41d9693539676e8b4a4d2cef46db492e24b94a0
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Mon Nov 7 17:41:36 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/oxenstored: Set uncaught exception handler
    
    Unhandled exceptions go to stderr by default, but this doesn't typically work
    for oxenstored because:
     * daemonize reopens stderr as /dev/null
     * systemd redirects stderr to /dev/null too
    
    Debugging an unhandled exception requires reproducing the issue locally when
    using --no-fork, and is not conducive to figuring out what went wrong on a
    remote system.
    
    Install a custom handler which also tries to render the backtrace to the
    configured syslog facility, and DAEMON|ERR otherwise.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit ee7815f49faf743e960dac9e72809eb66393bc6d)
---
 tools/ocaml/xenstored/logging.ml   | 29 +++++++++++++++++++++++++++++
 tools/ocaml/xenstored/xenstored.ml |  3 ++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml
index 39c3036155..255051437d 100644
--- a/tools/ocaml/xenstored/logging.ml
+++ b/tools/ocaml/xenstored/logging.ml
@@ -342,3 +342,32 @@ let xb_answer ~tid ~con ~ty data =
 let watch_not_fired ~con perms path =
 	let data = Printf.sprintf "EPERM perms=[%s] path=%s" perms path in
 	access_logging ~tid:0 ~con ~data Watch_not_fired ~level:Info
+
+let msg_of exn bt =
+	Printf.sprintf "Fatal exception: %s\n%s\n" (Printexc.to_string exn)
+		(Printexc.raw_backtrace_to_string bt)
+
+let fallback_exception_handler exn bt =
+	(* stderr goes to /dev/null, so use the logger where possible,
+	   but always print to stderr too, in case everything else fails,
+	   e.g. this can be used to debug with --no-fork
+
+	   this function should try not to raise exceptions, but if it does
+	   the ocaml runtime should still print the exception, both the original,
+	   and the one from this function, but to stderr this time
+	 *)
+	let msg = msg_of exn bt in
+	prerr_endline msg;
+	(* See Printexc.set_uncaught_exception_handler, need to flush,
+	   so has to call stop and flush *)
+	match !xenstored_logger with
+	| Some l -> error "xenstored-fallback" "%s" msg; l.stop ()
+	| None ->
+		(* Too early, no logger set yet.
+		   We normally try to use the configured logger so we don't flood syslog
+		   during development for example, or if the user has a file set
+		 *)
+		try Syslog.log Syslog.Daemon Syslog.Err msg
+		with e ->
+			let bt = Printexc.get_raw_backtrace () in
+			prerr_endline @@ msg_of e bt
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 35b8cbd43f..4d5851c5cb 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -355,7 +355,8 @@ let tweak_gc () =
 	Gc.set { (Gc.get ()) with Gc.max_overhead = !Define.gc_max_overhead }
 
 
-let _ =
+let () =
+	Printexc.set_uncaught_exception_handler Logging.fallback_exception_handler;
 	let cf = do_argv in
 	let pidfile =
 		if Sys.file_exists (config_filename cf) then
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:57:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:57:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460160.718021 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vU6-00061t-Dj; Tue, 13 Dec 2022 02:57:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460160.718021; Tue, 13 Dec 2022 02:57:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vU6-00061l-B3; Tue, 13 Dec 2022 02:57:34 +0000
Received: by outflank-mailman (input) for mailman id 460160;
 Tue, 13 Dec 2022 02:57:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vU5-00061X-9T
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vU5-0000vm-8i
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vU5-0000OR-81
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oBwb5cJvX0UK/fTcbNj7GWQGGI5euhgALPXEwiaHLc4=; b=25cHonRcGAqa7ZAFs9b4tMAifq
	MEsXPWlQR3cM36yPNHlmsn56aBFN+FEhA6BgV76I9exAcokKtlsmI1WXQyIJDGXh+5Mfskorr4PTB
	9J1SomK18i/Coo7mXV2t3wC0a4aKXithK2pJr2IBwXCBUiygpvurnLXe7F2jw4u1fMhM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored/syslog: Avoid potential NULL dereference
Message-Id: <E1p4vU5-0000OR-81@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:57:33 +0000

commit 4a8ff8bf1b32b4ff3ac8c472f0d861aa866a0fcf
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 8 14:24:19 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/oxenstored/syslog: Avoid potential NULL dereference
    
    strdup() may return NULL.  Check for this before passing to syslog().
    
    Drop const from c_msg.  It is bogus, as demonstrated by the need to cast to
    void * in order to free the memory.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit acd3fb6d65905f8a185dcb9fe6a330a591b96203)
---
 tools/ocaml/xenstored/syslog_stubs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/syslog_stubs.c b/tools/ocaml/xenstored/syslog_stubs.c
index 875d48ad57..e16c3a9491 100644
--- a/tools/ocaml/xenstored/syslog_stubs.c
+++ b/tools/ocaml/xenstored/syslog_stubs.c
@@ -14,6 +14,7 @@
 
 #include <syslog.h>
 #include <string.h>
+#include <caml/fail.h>
 #include <caml/mlvalues.h>
 #include <caml/memory.h>
 #include <caml/alloc.h>
@@ -35,14 +36,16 @@ static int __syslog_facility_table[] = {
 value stub_syslog(value facility, value level, value msg)
 {
 	CAMLparam3(facility, level, msg);
-	const char *c_msg = strdup(String_val(msg));
+	char *c_msg = strdup(String_val(msg));
 	int c_facility = __syslog_facility_table[Int_val(facility)]
 	               | __syslog_level_table[Int_val(level)];
 
+	if ( !c_msg )
+		caml_raise_out_of_memory();
 	caml_enter_blocking_section();
 	syslog(c_facility, "%s", c_msg);
 	caml_leave_blocking_section();
 
-	free((void*)c_msg);
+	free(c_msg);
 	CAMLreturn(Val_unit);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Dec 13 02:57:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Dec 2022 02:57:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.460161.718025 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p4vUG-00066N-FD; Tue, 13 Dec 2022 02:57:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 460161.718025; Tue, 13 Dec 2022 02:57: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 1p4vUG-00066F-CX; Tue, 13 Dec 2022 02:57:44 +0000
Received: by outflank-mailman (input) for mailman id 460161;
 Tue, 13 Dec 2022 02:57:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vUF-00065z-C2
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vUF-0000w5-BL
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p4vUF-0000Oq-Ah
 for xen-changelog@lists.xenproject.org; Tue, 13 Dec 2022 02:57: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Xaqq0Ht4fNhot4m6MBMI10zC+OGpyIi5tMbclMakj9M=; b=pewjvpW25LLQxZ1D+SV3P1p3vV
	tQAz8nupbaHjLgkfTPSGz7z5um4JOzTZ8x6A2khAHEblPfgZyC2WzNBsgJK+A2lPHlkkIqxFTxSEa
	IthOzEOUcD3tgdZuJr0RQRaan5nFScvypUjyO2zAN+oGT99ajYEbKftyN0nWWUJA/9Zo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored: Render backtraces more nicely in Syslog
Message-Id: <E1p4vUF-0000Oq-Ah@xenbits.xenproject.org>
Date: Tue, 13 Dec 2022 02:57:43 +0000

commit 03a43f548e9095448db72c829db575097910f84f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Dec 1 21:06:25 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 12 11:04:12 2022 +0000

    tools/oxenstored: Render backtraces more nicely in Syslog
    
    fallback_exception_handler feeds a string with embedded newlines directly into
    syslog().  While this is an improvement on getting nothing, syslogd escapes
    all control characters it gets, and emits one (long) log line.
    
    Fix the problem generally in the syslog stub.  As we already have a local copy
    of the string, split it in place and emit one syslog() call per line.
    
    Also tweak Logging.msg_of to avoid putting an extra newline on a string which
    already ends with one.
    
    Fixes: ee7815f49faf ("tools/oxenstored: Set uncaught exception handler")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit d2162d884cba0ff7b2ac0d832f4e044444bda2e1)
---
 tools/ocaml/xenstored/logging.ml     |  2 +-
 tools/ocaml/xenstored/syslog_stubs.c | 26 +++++++++++++++++++++++---
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml
index 255051437d..f233bc9a39 100644
--- a/tools/ocaml/xenstored/logging.ml
+++ b/tools/ocaml/xenstored/logging.ml
@@ -344,7 +344,7 @@ let watch_not_fired ~con perms path =
 	access_logging ~tid:0 ~con ~data Watch_not_fired ~level:Info
 
 let msg_of exn bt =
-	Printf.sprintf "Fatal exception: %s\n%s\n" (Printexc.to_string exn)
+	Printf.sprintf "Fatal exception: %s\n%s" (Printexc.to_string exn)
 		(Printexc.raw_backtrace_to_string bt)
 
 let fallback_exception_handler exn bt =
diff --git a/tools/ocaml/xenstored/syslog_stubs.c b/tools/ocaml/xenstored/syslog_stubs.c
index e16c3a9491..760e78ff73 100644
--- a/tools/ocaml/xenstored/syslog_stubs.c
+++ b/tools/ocaml/xenstored/syslog_stubs.c
@@ -37,14 +37,34 @@ value stub_syslog(value facility, value level, value msg)
 {
 	CAMLparam3(facility, level, msg);
 	char *c_msg = strdup(String_val(msg));
+	char *s = c_msg, *ss;
 	int c_facility = __syslog_facility_table[Int_val(facility)]
 	               | __syslog_level_table[Int_val(level)];
 
 	if ( !c_msg )
 		caml_raise_out_of_memory();
-	caml_enter_blocking_section();
-	syslog(c_facility, "%s", c_msg);
-	caml_leave_blocking_section();
+
+	/*
+	 * syslog() doesn't like embedded newlines, and c_msg generally
+	 * contains them.
+	 *
+	 * Split the message in place by converting \n to \0, and issue one
+	 * syslog() call per line, skipping the final iteration if c_msg ends
+	 * with a newline anyway.
+	 */
+	do {
+		ss = strchr(s, '\n');
+		if ( ss )
+			*ss = '\0';
+		else if ( *s == '\0' )
+			break;
+
+		caml_enter_blocking_section();
+		syslog(c_facility, "%s", s);
+		caml_leave_blocking_section();
+
+		s = ss + 1;
+	} while ( ss );
 
 	free(c_msg);
 	CAMLreturn(Val_unit);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Dec 16 03:24:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Dec 2022 03:24:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.464118.722455 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p61KL-0005Xq-9n; Fri, 16 Dec 2022 03:24:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 464118.722455; Fri, 16 Dec 2022 03:24:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p61KL-0005Xi-60; Fri, 16 Dec 2022 03:24:01 +0000
Received: by outflank-mailman (input) for mailman id 464118;
 Fri, 16 Dec 2022 03:24:00 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p61KK-0005Xc-Fp
 for xen-changelog@lists.xenproject.org; Fri, 16 Dec 2022 03:24:00 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p61KK-0005pu-Eh
 for xen-changelog@lists.xenproject.org; Fri, 16 Dec 2022 03:24:00 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p61KK-0008EK-Dh
 for xen-changelog@lists.xenproject.org; Fri, 16 Dec 2022 03:24:00 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=omu7hQfCZFvlZsiJ1BgbRKctKuG7qCAk5A9Vt6kNjKA=; b=nXhpkmnndhnjN7Ww72/CVcN1e1
	8Ax8NYXEbCkGhyPmjp2MbF6Xe0SM2T6S0pgo4JN9Clq5IXy1YeJ9qTF53BxIBSXtSQLTEnO52EtUB
	v11BPW5x5I2osp62y5dWv5UckWYXhvmvwpCngn/94KsLWnaZtR8RsF2IxlQIFmskYtqw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] Merge tag 'v7.2.0' into 'staging'
Message-Id: <E1p61KK-0008EK-Dh@xenbits.xenproject.org>
Date: Fri, 16 Dec 2022 03:24:00 +0000

=== This changeset includes merge from high-traffic branch ===
Commits on that branch are not reported individually.

commit efb74542d6fbb814408c80f97048c7809aad759a
Merge: b67b00e6b4c7831a3f5bc684bc0df7a9bfd1bd56 b746458e1ce1bec85e58b458386f8b7a0bedfaa6
Author:     Anthony PERARD <anthony.perard@gmail.com>
AuthorDate: Thu Dec 15 15:12:57 2022 +0000
Commit:     Anthony PERARD <anthony.perard@gmail.com>
CommitDate: Thu Dec 15 15:12:57 2022 +0000

    Merge tag 'v7.2.0' into 'staging'
 .cirrus.yml                                        |     4 +-
 .github/workflows/lockdown.yml                     |     6 +-
 .gitignore                                         |     4 +
 .gitlab-ci.d/base.yml                              |    72 +
 .gitlab-ci.d/buildtest-template.yml                |    30 +-
 .gitlab-ci.d/buildtest.yml                         |    81 +-
 .gitlab-ci.d/cirrus.yml                            |    30 +-
 .gitlab-ci.d/cirrus/build.yml                      |     3 +-
 .gitlab-ci.d/cirrus/freebsd-12.vars                |     2 +-
 .gitlab-ci.d/cirrus/freebsd-13.vars                |     2 +-
 .gitlab-ci.d/cirrus/macos-11.vars                  |    16 -
 .gitlab-ci.d/cirrus/macos-12.vars                  |    16 +
 .gitlab-ci.d/container-core.yml                    |     5 -
 .gitlab-ci.d/container-cross.yml                   |    58 +-
 .gitlab-ci.d/container-template.yml                |     1 +
 .gitlab-ci.d/containers.yml                        |    13 +-
 .gitlab-ci.d/crossbuild-template.yml               |     8 +-
 .gitlab-ci.d/crossbuilds.yml                       |    16 +-
 .gitlab-ci.d/custom-runners.yml                    |     4 +-
 .../custom-runners/centos-stream-8-x86_64.yml      |     2 +
 .../custom-runners/ubuntu-20.04-aarch32.yml        |    23 -
 .../custom-runners/ubuntu-20.04-aarch64.yml        |   118 -
 .gitlab-ci.d/custom-runners/ubuntu-20.04-s390x.yml |    25 +-
 .../custom-runners/ubuntu-22.04-aarch32.yml        |    25 +
 .../custom-runners/ubuntu-22.04-aarch64.yml        |   130 +
 .gitlab-ci.d/edk2.yml                              |   133 +-
 .gitlab-ci.d/opensbi.yml                           |   134 +-
 .gitlab-ci.d/qemu-project.yml                      |     1 +
 .gitlab-ci.d/stages.yml                            |     1 -
 .gitlab-ci.d/static_checks.yml                     |    33 +-
 .gitlab-ci.d/windows.yml                           |    25 +-
 .gitmodules                                        |     9 +-
 .mailmap                                           |     8 +-
 .travis.yml                                        |     8 +-
 Kconfig.host                                       |     7 +-
 MAINTAINERS                                        |   320 +-
 Makefile                                           |    36 +-
 README.rst                                         |     4 +-
 VERSION                                            |     2 +-
 accel/accel-common.c                               |    18 +
 accel/accel-softmmu.c                              |     8 +-
 accel/dummy-cpus.c                                 |    14 +-
 accel/hvf/hvf-accel-ops.c                          |     6 +-
 accel/hvf/hvf-all.c                                |     1 -
 accel/kvm/kvm-accel-ops.c                          |     9 +
 accel/kvm/kvm-all.c                                |   639 +-
 accel/kvm/kvm-cpus.h                               |     4 +
 accel/meson.build                                  |     2 +-
 accel/qtest/meson.build                            |     3 +-
 accel/stubs/kvm-stub.c                             |    26 +-
 accel/stubs/tcg-stub.c                             |    15 +-
 accel/tcg/atomic_template.h                        |     4 +-
 accel/tcg/cpu-exec-common.c                        |     2 +-
 accel/tcg/cpu-exec.c                               |   252 +-
 accel/tcg/cputlb.c                                 |   399 +-
 accel/tcg/hmp.c                                    |     1 -
 accel/tcg/internal.h                               |   104 +-
 accel/tcg/meson.build                              |     1 +
 accel/tcg/plugin-gen.c                             |    22 +-
 accel/tcg/tb-hash.h                                |     1 +
 accel/tcg/tb-jmp-cache.h                           |    65 +
 accel/tcg/tb-maint.c                               |   704 +
 accel/tcg/tcg-accel-ops-icount.c                   |    13 +-
 accel/tcg/tcg-accel-ops-icount.h                   |     6 +-
 accel/tcg/tcg-accel-ops-mttcg.c                    |     1 -
 accel/tcg/tcg-accel-ops-mttcg.h                    |     6 +-
 accel/tcg/tcg-accel-ops-rr.c                       |     3 +-
 accel/tcg/tcg-accel-ops-rr.h                       |     6 +-
 accel/tcg/tcg-accel-ops.c                          |   114 +-
 accel/tcg/tcg-accel-ops.h                          |     6 +-
 accel/tcg/tcg-all.c                                |    18 +-
 accel/tcg/translate-all.c                          |  1352 +-
 accel/tcg/translator.c                             |   150 +-
 accel/tcg/user-exec.c                              |    66 +-
 audio/alsaaudio.c                                  |    38 +-
 audio/audio.c                                      |   195 +-
 audio/audio.h                                      |     6 +-
 audio/audio_int.h                                  |     4 +-
 audio/audio_template.h                             |    33 +-
 audio/audio_win_int.c                              |     1 -
 audio/dbusaudio.c                                  |     6 +-
 audio/meson.build                                  |     3 +-
 audio/noaudio.c                                    |     4 +-
 audio/rate_template.h                              |    11 +-
 audio/sndioaudio.c                                 |   565 +
 audio/spiceaudio.c                                 |    19 +-
 audio/wavaudio.c                                   |     2 +-
 backends/cryptodev-builtin.c                       |   313 +-
 backends/cryptodev-lkcf.c                          |   645 +
 backends/cryptodev-vhost-user.c                    |    71 +-
 backends/cryptodev-vhost.c                         |     4 +-
 backends/cryptodev.c                               |    68 +-
 backends/dbus-vmstate.c                            |    13 +-
 backends/hostmem-epc.c                             |     1 -
 backends/hostmem.c                                 |    29 +-
 backends/meson.build                               |    13 +-
 backends/rng-egd.c                                 |     2 +-
 backends/rng-random.c                              |     2 +-
 backends/rng.c                                     |    18 +-
 backends/tpm/tpm_emulator.c                        |    70 +-
 backends/tpm/tpm_ioctl.h                           |   100 +-
 backends/tpm/tpm_passthrough.c                     |     1 -
 backends/tpm/trace-events                          |     2 +
 backends/vhost-user.c                              |     6 +-
 block.c                                            |   931 +-
 block/accounting.c                                 |    26 +-
 block/backup.c                                     |     8 +-
 block/blkdebug.c                                   |    11 +-
 block/blkio.c                                      |  1046 +
 block/blklogwrites.c                               |    17 +-
 block/blkreplay.c                                  |     7 +-
 block/blkverify.c                                  |    15 +-
 block/block-backend.c                              |   276 +-
 block/block-copy.c                                 |    33 +-
 block/block-ram-registrar.c                        |    58 +
 block/bochs.c                                      |    17 +-
 block/cloop.c                                      |    19 +-
 block/commit.c                                     |     7 +-
 block/copy-before-write.c                          |   126 +-
 block/copy-on-read.c                               |     9 +-
 block/copy-on-read.h                               |     6 +-
 block/coroutines.h                                 |    55 +-
 block/crypto.c                                     |    73 +-
 block/curl.c                                       |     2 +-
 block/dirty-bitmap.c                               |    26 +-
 block/dmg.c                                        |    74 +-
 block/export/export.c                              |     8 +-
 block/export/fuse.c                                |     4 +-
 block/export/meson.build                           |     7 +-
 block/export/vduse-blk.c                           |   374 +
 block/export/vduse-blk.h                           |    20 +
 block/export/vhost-user-blk-server.c               |   263 +-
 block/export/virtio-blk-handler.c                  |   240 +
 block/export/virtio-blk-handler.h                  |    37 +
 block/file-posix.c                                 |    58 +-
 block/filter-compress.c                            |     8 +-
 block/gluster.c                                    |     7 +-
 block/io.c                                         |   255 +-
 block/io_uring.c                                   |    13 +-
 block/iscsi.c                                      |     7 +-
 block/linux-aio.c                                  |    12 +-
 block/meson.build                                  |     3 +
 block/mirror.c                                     |   106 +-
 block/monitor/bitmap-qmp-cmds.c                    |    46 +-
 block/monitor/block-hmp-cmds.c                     |    12 +-
 block/nbd.c                                        |   306 +-
 block/nfs.c                                        |    10 +-
 block/nvme.c                                       |    96 +-
 block/parallels-ext.c                              |     6 +-
 block/parallels.c                                  |    55 +-
 block/preallocate.c                                |     9 +-
 block/qapi-sysemu.c                                |     3 +-
 block/qcow.c                                       |    91 +-
 block/qcow2-bitmap.c                               |    28 +-
 block/qcow2-cache.c                                |    11 +-
 block/qcow2-cluster.c                              |    69 +-
 block/qcow2-refcount.c                             |   425 +-
 block/qcow2-snapshot.c                             |    55 +-
 block/qcow2.c                                      |   233 +-
 block/qcow2.h                                      |    51 +-
 block/qed-table.c                                  |     2 +-
 block/qed.c                                        |    53 +-
 block/quorum.c                                     |    38 +-
 block/raw-format.c                                 |    13 +-
 block/rbd.c                                        |    24 +
 block/replication.c                                |    12 +-
 block/snapshot-access.c                            |     6 +-
 block/snapshot.c                                   |    59 +-
 block/ssh.c                                        |     7 +-
 block/throttle.c                                   |    10 +-
 block/trace-events                                 |     2 +
 block/vdi.c                                        |    32 +-
 block/vhdx-log.c                                   |    23 +-
 block/vhdx.c                                       |    68 +-
 block/vmdk.c                                       |   227 +-
 block/vpc.c                                        |    42 +-
 block/vvfat.c                                      |    55 +-
 blockdev-nbd.c                                     |    21 +-
 blockdev.c                                         |   178 +-
 blockjob.c                                         |   181 +-
 bsd-user/arm/target.h                              |     2 +-
 bsd-user/arm/target_arch.h                         |     6 +-
 bsd-user/arm/target_arch_cpu.h                     |     6 +-
 bsd-user/arm/target_arch_elf.h                     |     7 +-
 bsd-user/arm/target_arch_reg.h                     |     6 +-
 bsd-user/arm/target_arch_signal.h                  |     7 +-
 bsd-user/arm/target_arch_sigtramp.h                |     6 +-
 bsd-user/arm/target_arch_sysarch.h                 |     6 +-
 bsd-user/arm/target_arch_thread.h                  |     7 +-
 bsd-user/arm/target_arch_vmparam.h                 |     7 +-
 bsd-user/arm/target_syscall.h                      |     6 +-
 bsd-user/bsd-file.h                                |   918 +-
 bsd-user/bsd-proc.h                                |    42 +
 bsd-user/elfload.c                                 |     2 +-
 bsd-user/errno_defs.h                              |     6 +-
 bsd-user/freebsd/host-os.h                         |     6 +-
 bsd-user/freebsd/os-syscall.c                      |   452 +-
 bsd-user/freebsd/target_os_elf.h                   |     7 +-
 bsd-user/freebsd/target_os_siginfo.h               |     7 +-
 bsd-user/freebsd/target_os_signal.h                |     6 +-
 bsd-user/freebsd/target_os_stack.h                 |     6 +-
 bsd-user/freebsd/target_os_thread.h                |     6 +-
 bsd-user/freebsd/target_os_user.h                  |     6 +-
 bsd-user/freebsd/target_os_vmparam.h               |     7 +-
 bsd-user/host/i386/host-signal.h                   |     1 +
 bsd-user/host/x86_64/host-signal.h                 |     1 +
 bsd-user/i386/target.h                             |     7 +-
 bsd-user/i386/target_arch.h                        |     6 +-
 bsd-user/i386/target_arch_cpu.h                    |     6 +-
 bsd-user/i386/target_arch_elf.h                    |     7 +-
 bsd-user/i386/target_arch_reg.h                    |     6 +-
 bsd-user/i386/target_arch_sigtramp.h               |     6 +-
 bsd-user/i386/target_arch_sysarch.h                |     6 +-
 bsd-user/i386/target_arch_thread.h                 |     7 +-
 bsd-user/i386/target_arch_vmparam.h                |     7 +-
 bsd-user/main.c                                    |    59 +-
 bsd-user/mmap.c                                    |     5 +-
 bsd-user/netbsd/host-os.h                          |     6 +-
 bsd-user/netbsd/target_os_elf.h                    |     7 +-
 bsd-user/netbsd/target_os_siginfo.h                |     6 +-
 bsd-user/netbsd/target_os_signal.h                 |     6 +-
 bsd-user/netbsd/target_os_stack.h                  |     6 +-
 bsd-user/netbsd/target_os_thread.h                 |     6 +-
 bsd-user/openbsd/host-os.h                         |     6 +-
 bsd-user/openbsd/target_os_elf.h                   |     7 +-
 bsd-user/openbsd/target_os_siginfo.h               |     6 +-
 bsd-user/openbsd/target_os_signal.h                |     6 +-
 bsd-user/openbsd/target_os_stack.h                 |     6 +-
 bsd-user/openbsd/target_os_thread.h                |     6 +-
 bsd-user/qemu.h                                    |     2 +-
 bsd-user/signal.c                                  |     3 +-
 bsd-user/syscall_defs.h                            |    10 +-
 bsd-user/x86_64/target.h                           |     2 +-
 bsd-user/x86_64/target_arch.h                      |     6 +-
 bsd-user/x86_64/target_arch_cpu.h                  |     6 +-
 bsd-user/x86_64/target_arch_elf.h                  |     7 +-
 bsd-user/x86_64/target_arch_reg.h                  |     6 +-
 bsd-user/x86_64/target_arch_signal.h               |     7 +-
 bsd-user/x86_64/target_arch_sigtramp.h             |     6 +-
 bsd-user/x86_64/target_arch_sysarch.h              |     6 +-
 bsd-user/x86_64/target_arch_thread.h               |     7 +-
 bsd-user/x86_64/target_arch_vmparam.h              |     7 +-
 capstone                                           |     1 -
 chardev/baum.c                                     |    22 +-
 chardev/char-fd.c                                  |     5 +-
 chardev/char-io.c                                  |     2 +-
 chardev/char-pipe.c                                |     1 -
 chardev/char-pty.c                                 |   117 +-
 chardev/char-serial.c                              |     5 +-
 chardev/char-socket.c                              |     6 +-
 chardev/char-stdio.c                               |     5 +-
 chardev/char-win-stdio.c                           |     8 +-
 chardev/char.c                                     |     4 +-
 chardev/chardev-internal.h                         |     3 +-
 chardev/meson.build                                |     4 +-
 chardev/msmouse.c                                  |   152 +-
 chardev/wctablet.c                                 |     4 +-
 common-user/meson.build                            |     4 +
 configs/devices/hppa-softmmu/default.mak           |     2 +-
 configs/devices/loongarch64-softmmu/default.mak    |     3 +
 configs/devices/mips-softmmu/common.mak            |     1 -
 configs/devices/mips64el-softmmu/default.mak       |     1 -
 configs/devices/or1k-softmmu/default.mak           |     1 +
 configs/devices/ppc-softmmu/default.mak            |     3 +-
 configs/targets/aarch64-linux-user.mak             |     1 +
 configs/targets/aarch64_be-linux-user.mak          |     3 +-
 configs/targets/arm-linux-user.mak                 |     1 +
 configs/targets/armeb-linux-user.mak               |     3 +-
 configs/targets/hppa-linux-user.mak                |     2 +-
 configs/targets/hppa-softmmu.mak                   |     2 +-
 configs/targets/loongarch64-linux-user.mak         |     3 +
 configs/targets/loongarch64-softmmu.mak            |     5 +
 configs/targets/m68k-linux-user.mak                |     2 +-
 configs/targets/m68k-softmmu.mak                   |     2 +-
 configs/targets/microblaze-linux-user.mak          |     2 +-
 configs/targets/microblaze-softmmu.mak             |     2 +-
 configs/targets/mips-linux-user.mak                |     2 +-
 configs/targets/mips-softmmu.mak                   |     2 +-
 configs/targets/mips64-linux-user.mak              |     2 +-
 configs/targets/mips64-softmmu.mak                 |     2 +-
 configs/targets/mipsn32-linux-user.mak             |     2 +-
 configs/targets/nios2-softmmu.mak                  |     1 +
 configs/targets/or1k-linux-user.mak                |     2 +-
 configs/targets/or1k-softmmu.mak                   |     3 +-
 configs/targets/ppc-linux-user.mak                 |     2 +-
 configs/targets/ppc-softmmu.mak                    |     2 +-
 configs/targets/ppc64-linux-user.mak               |     2 +-
 configs/targets/ppc64-softmmu.mak                  |     2 +-
 configs/targets/riscv32-linux-user.mak             |     1 +
 configs/targets/riscv64-linux-user.mak             |     1 +
 configs/targets/s390x-linux-user.mak               |     2 +-
 configs/targets/s390x-softmmu.mak                  |     2 +-
 configs/targets/sh4eb-linux-user.mak               |     2 +-
 configs/targets/sh4eb-softmmu.mak                  |     2 +-
 configs/targets/sparc-linux-user.mak               |     2 +-
 configs/targets/sparc-softmmu.mak                  |     2 +-
 configs/targets/sparc32plus-linux-user.mak         |     2 +-
 configs/targets/sparc64-linux-user.mak             |     2 +-
 configs/targets/sparc64-softmmu.mak                |     2 +-
 configs/targets/xtensaeb-linux-user.mak            |     2 +-
 configs/targets/xtensaeb-softmmu.mak               |     2 +-
 configure                                          |  2044 +-
 contrib/elf2dmp/main.c                             |     7 +-
 contrib/elf2dmp/qemu_elf.c                         |    53 +
 contrib/gitdm/domain-map                           |     2 +
 contrib/gitdm/group-map-academics                  |     6 +
 contrib/gitdm/group-map-individuals                |     3 +
 contrib/ivshmem-server/ivshmem-server.c            |     2 +-
 contrib/plugins/Makefile                           |     1 +
 contrib/plugins/cache.c                            |     2 +-
 contrib/plugins/execlog.c                          |   137 +-
 contrib/rdmacm-mux/meson.build                     |     4 +-
 contrib/vhost-user-blk/meson.build                 |     3 +-
 contrib/vhost-user-blk/vhost-user-blk.c            |    18 +-
 contrib/vhost-user-gpu/vugbm.c                     |     2 +-
 contrib/vhost-user-scsi/vhost-user-scsi.c          |    82 +-
 cpu.c                                              |    44 +-
 cpus-common.c                                      |     8 +
 crypto/akcipher-gcrypt.c.inc                       |   595 +
 crypto/akcipher-nettle.c.inc                       |   451 +
 crypto/akcipher.c                                  |   126 +
 crypto/akcipherpriv.h                              |    55 +
 crypto/block-luks-priv.h                           |   143 +
 crypto/block-luks.c                                |   236 +-
 crypto/block.c                                     |     6 +-
 crypto/cipher-afalg.c                              |     1 -
 crypto/der.c                                       |   452 +
 crypto/der.h                                       |   286 +
 crypto/hash-afalg.c                                |     1 -
 crypto/ivgen-plain.h                               |     6 +-
 crypto/meson.build                                 |    11 +-
 crypto/pbkdf.c                                     |    23 +
 crypto/rsakey-builtin.c.inc                        |   200 +
 crypto/rsakey-nettle.c.inc                         |   158 +
 crypto/rsakey.c                                    |    86 +
 crypto/rsakey.h                                    |   101 +
 crypto/secret_common.c                             |    88 +-
 crypto/sm4.c                                       |    49 +
 crypto/tlscredsanon.c                              |    20 +-
 crypto/tlscredspsk.c                               |    36 +-
 crypto/tlscredsx509.c                              |    20 +-
 disas.c                                            |    56 +-
 disas/arm-a64.cc                                   |   101 -
 disas/arm.c                                        |  4012 ----
 disas/capstone.c                                   |    73 +-
 disas/i386.c                                       |  6771 ------
 disas/libvixl/LICENCE                              |    30 -
 disas/libvixl/README                               |    11 -
 disas/libvixl/meson.build                          |     7 -
 disas/libvixl/vixl/a64/assembler-a64.h             |  4624 ----
 disas/libvixl/vixl/a64/constants-a64.h             |  2116 --
 disas/libvixl/vixl/a64/cpu-a64.h                   |    83 -
 disas/libvixl/vixl/a64/decoder-a64.cc              |   877 -
 disas/libvixl/vixl/a64/decoder-a64.h               |   275 -
 disas/libvixl/vixl/a64/disasm-a64.cc               |  3495 ---
 disas/libvixl/vixl/a64/disasm-a64.h                |   177 -
 disas/libvixl/vixl/a64/instructions-a64.cc         |   622 -
 disas/libvixl/vixl/a64/instructions-a64.h          |   757 -
 disas/libvixl/vixl/code-buffer.h                   |   113 -
 disas/libvixl/vixl/compiler-intrinsics.cc          |   144 -
 disas/libvixl/vixl/compiler-intrinsics.h           |   155 -
 disas/libvixl/vixl/globals.h                       |   155 -
 disas/libvixl/vixl/invalset.h                      |   775 -
 disas/libvixl/vixl/platform.h                      |    39 -
 disas/libvixl/vixl/utils.cc                        |   142 -
 disas/libvixl/vixl/utils.h                         |   286 -
 disas/meson.build                                  |    11 +-
 disas/mips.c                                       |    12 +-
 disas/nanomips.c                                   | 21990 ++++++++++++++++++
 disas/nanomips.cpp                                 | 22398 -------------------
 disas/nanomips.h                                   |  1076 -
 disas/ppc.c                                        |  5435 -----
 disas/riscv.c                                      |  1632 +-
 disas/s390.c                                       |  1892 --
 docs/about/build-platforms.rst                     |    37 +-
 docs/about/deprecated.rst                          |   168 +-
 docs/about/removed-features.rst                    |    87 +-
 docs/ccid.txt                                      |   182 -
 docs/conf.py                                       |     2 +-
 docs/devel/acpi-bits.rst                           |   141 +
 docs/devel/build-system.rst                        |     5 -
 docs/devel/ci-jobs.rst.inc                         |   116 +-
 docs/devel/ci.rst                                  |    11 +-
 docs/devel/code-of-conduct.rst                     |     2 +
 docs/devel/fuzzing.rst                             |     4 +-
 docs/devel/index-api.rst                           |     1 -
 docs/devel/index-build.rst                         |     4 +-
 docs/devel/index-internals.rst                     |     2 +-
 docs/devel/index-process.rst                       |     2 +-
 docs/devel/index-tcg.rst                           |     2 +-
 docs/devel/index.rst                               |     2 -
 docs/devel/loads-stores.rst                        |     2 +-
 docs/devel/maintainers.rst                         |   107 +
 docs/devel/multiple-iothreads.txt                  |     4 +-
 docs/devel/qapi-code-gen.rst                       |    13 +-
 docs/devel/qom.rst                                 |     7 +-
 docs/devel/qtest.rst                               |     3 +-
 docs/devel/replay.rst                              |   306 +
 docs/devel/replay.txt                              |    46 -
 docs/devel/reset.rst                               |     8 +-
 docs/devel/style.rst                               |     2 +-
 docs/devel/submitting-a-patch.rst                  |   139 +-
 docs/devel/submitting-a-pull-request.rst           |    12 +-
 docs/devel/tcg-plugins.rst                         |   175 +-
 docs/devel/testing.rst                             |    74 +-
 docs/devel/tracing.rst                             |     2 +-
 docs/devel/virtio-backends.rst                     |   214 +
 docs/devel/writing-monitor-commands.rst            |    13 +-
 docs/hyperv.txt                                    |   255 -
 docs/interop/firmware.json                         |    21 +-
 docs/interop/live-block-operations.rst             |     4 +-
 docs/interop/nbd.txt                               |     1 +
 docs/interop/qemu-ga.rst                           |     8 +-
 docs/interop/vhost-user-gpu.rst                    |    10 +-
 docs/interop/vhost-user.rst                        |   572 +-
 docs/meson.build                                   |     2 +-
 docs/pcie_sriov.txt                                |     6 +-
 docs/replay.txt                                    |   410 -
 docs/specs/acpi_erst.rst                           |     4 +-
 docs/specs/fw_cfg.rst                              |   290 +
 docs/specs/fw_cfg.txt                              |   265 -
 docs/specs/index.rst                               |     1 +
 docs/specs/pci-ids.txt                             |    18 +-
 docs/specs/tpm.rst                                 |    44 +-
 docs/specs/vmgenid.txt                             |     4 +-
 docs/system/arm/aspeed.rst                         |   122 +-
 docs/system/arm/cpu-features.rst                   |    58 +-
 docs/system/arm/emulation.rst                      |    26 +
 docs/system/arm/nuvoton.rst                        |     4 +-
 docs/system/arm/virt.rst                           |    29 +-
 docs/system/device-emulation.rst                   |     3 +
 docs/system/devices/can.rst                        |     5 +-
 docs/system/devices/canokey.rst                    |   158 +
 docs/system/devices/ccid.rst                       |   171 +
 docs/system/devices/cxl.rst                        |   386 +
 docs/system/devices/nvme.rst                       |    86 +-
 docs/system/devices/usb.rst                        |    61 +-
 docs/system/i386/hyperv.rst                        |   288 +
 docs/system/index.rst                              |     1 +
 docs/system/loongarch/loongson3.rst                |   129 +
 docs/system/openrisc/cpu-features.rst              |    15 +
 docs/system/openrisc/emulation.rst                 |    17 +
 docs/system/openrisc/or1k-sim.rst                  |    43 +
 docs/system/openrisc/virt.rst                      |    50 +
 docs/system/ppc/embedded.rst                       |     1 -
 docs/system/ppc/ppce500.rst                        |    28 +-
 docs/system/ppc/pseries.rst                        |    29 +
 docs/system/replay.rst                             |   237 +
 docs/system/riscv/virt.rst                         |    25 +
 docs/system/s390x/bootdevices.rst                  |    28 +-
 docs/system/target-i386.rst                        |     1 +
 docs/system/target-openrisc.rst                    |    71 +
 docs/system/targets.rst                            |     1 +
 docs/system/tls.rst                                |     2 +-
 docs/tools/qemu-img.rst                            |     6 +-
 docs/tools/qemu-nbd.rst                            |     5 +-
 docs/tools/qemu-pr-helper.rst                      |     4 +-
 docs/tools/qemu-storage-daemon.rst                 |    22 +
 docs/tools/virtiofsd.rst                           |     9 +-
 dump/dump.c                                        |   908 +-
 dump/win_dump.c                                    |   313 +-
 ebpf/ebpf_rss.c                                    |     2 +-
 event-loop-base.c                                  |   140 +
 fpu/softfloat-parts.c.inc                          |    33 +-
 fpu/softfloat-specialize.c.inc                     |    26 +-
 fpu/softfloat.c                                    |   205 +-
 fsdev/virtfs-proxy-helper.c                        |     4 +-
 gdb-xml/i386-32bit.xml                             |     2 +-
 gdb-xml/loongarch-base64.xml                       |    45 +
 gdb-xml/loongarch-fpu.xml                          |    50 +
 gdb-xml/riscv-32bit-cpu.xml                        |     6 +-
 gdb-xml/riscv-32bit-fpu.xml                        |    10 +-
 gdb-xml/riscv-64bit-cpu.xml                        |     6 +-
 gdb-xml/riscv-64bit-fpu.xml                        |    10 +-
 gdbstub.c                                          |  3594 ---
 gdbstub/gdbstub.c                                  |  3517 +++
 gdbstub/internals.h                                |    17 +
 gdbstub/meson.build                                |     9 +
 gdbstub/softmmu.c                                  |    51 +
 gdbstub/trace-events                               |    29 +
 gdbstub/trace.h                                    |     1 +
 gdbstub/user.c                                     |    68 +
 hmp-commands-info.hx                               |   107 +-
 hmp-commands.hx                                    |   119 +-
 hw/9pfs/9p-posix-acl.c                             |    12 +-
 hw/9pfs/9p-proxy.c                                 |     1 -
 hw/9pfs/9p-synth.c                                 |     4 +-
 hw/9pfs/9p-util-darwin.c                           |    54 +-
 hw/9pfs/9p-util.h                                  |    69 +
 hw/9pfs/9p-xattr-user.c                            |     8 +-
 hw/9pfs/9p.c                                       |   263 +-
 hw/9pfs/9p.h                                       |    11 +-
 hw/9pfs/virtio-9p-device.c                         |     2 +-
 hw/Kconfig                                         |     2 +
 hw/acpi/Kconfig                                    |     5 +
 hw/acpi/acpi_interface.c                           |     8 +
 hw/acpi/aml-build-stub.c                           |    10 +
 hw/acpi/aml-build.c                                |   124 +-
 hw/acpi/cxl-stub.c                                 |    12 +
 hw/acpi/cxl.c                                      |   256 +
 hw/acpi/erst.c                                     |     9 +-
 hw/acpi/generic_event_device.c                     |     8 +
 hw/acpi/ghes.c                                     |     2 +-
 hw/acpi/ipmi-stub.c                                |     2 +-
 hw/acpi/ipmi.c                                     |    53 +-
 hw/acpi/meson.build                                |     6 +-
 hw/acpi/nvdimm.c                                   |   143 +-
 hw/acpi/pcihp.c                                    |     6 +-
 hw/acpi/piix4.c                                    |    77 +-
 hw/acpi/trace-events                               |    13 +
 hw/acpi/viot.c                                     |   107 +-
 hw/adc/aspeed_adc.c                                |    16 +
 hw/adc/npcm7xx_adc.c                               |     4 +-
 hw/adc/zynq-xadc.c                                 |     4 +-
 hw/alpha/dp264.c                                   |     3 -
 hw/arm/Kconfig                                     |     4 +
 hw/arm/allwinner-a10.c                             |     4 +-
 hw/arm/allwinner-h3.c                              |     2 +-
 hw/arm/armv7m.c                                    |    16 +-
 hw/arm/aspeed.c                                    |   349 +-
 hw/arm/aspeed_ast10x0.c                            |   377 +
 hw/arm/aspeed_ast2600.c                            |   149 +-
 hw/arm/aspeed_soc.c                                |   212 +-
 hw/arm/bcm2835_peripherals.c                       |    26 +-
 hw/arm/boot.c                                      |    70 +-
 hw/arm/digic.c                                     |     5 +-
 hw/arm/exynos4210.c                                |   430 +-
 hw/arm/fby35.c                                     |   192 +
 hw/arm/meson.build                                 |     8 +-
 hw/arm/microbit.c                                  |     2 +-
 hw/arm/mps2-tz.c                                   |     6 +-
 hw/arm/mps2.c                                      |     2 +-
 hw/arm/msf2-som.c                                  |     2 +-
 hw/arm/musca.c                                     |     3 +-
 hw/arm/musicpal.c                                  |     2 +-
 hw/arm/netduino2.c                                 |     2 +-
 hw/arm/netduinoplus2.c                             |     2 +-
 hw/arm/npcm7xx_boards.c                            |    24 +-
 hw/arm/nseries.c                                   |     6 +-
 hw/arm/omap2.c                                     |     2 +-
 hw/arm/pxa2xx.c                                    |     4 +-
 hw/arm/pxa2xx_pic.c                                |     2 +-
 hw/arm/realview.c                                  |    33 +-
 hw/arm/sbsa-ref.c                                  |    16 +
 hw/arm/smmuv3-internal.h                           |     2 +-
 hw/arm/smmuv3.c                                    |    19 +-
 hw/arm/stellaris.c                                 |    17 +-
 hw/arm/stm32vldiscovery.c                          |     2 +-
 hw/arm/sysbus-fdt.c                                |   571 -
 hw/arm/virt-acpi-build.c                           |    42 +-
 hw/arm/virt.c                                      |   220 +-
 hw/arm/xlnx-versal-virt.c                          |     7 +-
 hw/arm/xlnx-versal.c                               |    99 +-
 hw/arm/xlnx-zynqmp.c                               |    62 +-
 hw/audio/ac97.c                                    |   758 +-
 hw/audio/cs4231a.c                                 |     8 +-
 hw/audio/intel-hda.c                               |    11 +-
 hw/audio/pcspk.c                                   |    10 -
 hw/audio/soundhw.c                                 |   151 +-
 hw/avr/boot.c                                      |     1 -
 hw/block/block.c                                   |     4 +-
 hw/block/dataplane/virtio-blk.c                    |     5 +
 hw/block/fdc-isa.c                                 |    16 +-
 hw/block/fdc-sysbus.c                              |    16 +-
 hw/block/fdc.c                                     |    28 +-
 hw/block/hd-geometry.c                             |     9 +-
 hw/block/m25p80.c                                  |   237 +-
 hw/block/m25p80_sfdp.c                             |   332 +
 hw/block/m25p80_sfdp.h                             |    29 +
 hw/block/meson.build                               |     5 +-
 hw/block/nand.c                                    |    47 +-
 hw/block/onenand.c                                 |    32 +-
 hw/block/pflash_cfi01.c                            |     4 +-
 hw/block/pflash_cfi02.c                            |     4 +-
 hw/block/trace-events                              |     1 +
 hw/block/vhost-user-blk.c                          |   107 +-
 hw/block/virtio-blk-common.c                       |    39 +
 hw/block/virtio-blk.c                              |    76 +-
 hw/block/xen-block.c                               |     1 -
 hw/char/escc.c                                     |     2 +-
 hw/char/exynos4210_uart.c                          |     2 +-
 hw/char/parallel.c                                 |    14 +-
 hw/char/pl011.c                                    |     2 +-
 hw/char/serial-isa.c                               |    14 +-
 hw/char/serial.c                                   |     3 +
 hw/char/virtio-serial-bus.c                        |     3 +-
 hw/core/clock.c                                    |     2 +-
 hw/core/cpu-common.c                               |     3 +-
 hw/core/cpu-sysemu.c                               |     5 +-
 hw/core/generic-loader.c                           |     2 +-
 hw/core/irq.c                                      |    15 -
 hw/core/loader.c                                   |   101 +-
 hw/core/machine-hmp-cmds.c                         |     4 +
 hw/core/machine.c                                  |   272 +-
 hw/core/meson.build                                |     1 +
 hw/core/numa.c                                     |    28 +-
 hw/core/qdev-properties.c                          |    19 +
 hw/core/qdev.c                                     |    41 +-
 hw/core/reset.c                                    |    17 +-
 hw/core/resettable.c                               |     3 +-
 hw/core/sysbus-fdt.c                               |   572 +
 hw/core/uboot_image.h                              |   213 +-
 hw/cxl/Kconfig                                     |     3 +
 hw/cxl/cxl-cdat.c                                  |   224 +
 hw/cxl/cxl-component-utils.c                       |   405 +
 hw/cxl/cxl-device-utils.c                          |   271 +
 hw/cxl/cxl-host-stubs.c                            |    15 +
 hw/cxl/cxl-host.c                                  |   340 +
 hw/cxl/cxl-mailbox-utils.c                         |   478 +
 hw/cxl/meson.build                                 |    13 +
 hw/display/acpi-vga-stub.c                         |     7 +
 hw/display/acpi-vga.c                              |    26 +
 hw/display/artist.c                                |   204 +-
 hw/display/ati_2d.c                                |     7 +-
 hw/display/bcm2835_fb.c                            |     3 +-
 hw/display/blizzard.c                              |   354 +-
 hw/display/cg3.c                                   |     1 -
 hw/display/cirrus_vga.c                            |  1609 +-
 hw/display/cirrus_vga_isa.c                        |     1 +
 hw/display/meson.build                             |    17 +
 hw/display/next-fb.c                               |     2 +-
 hw/display/omap_dss.c                              |   598 +-
 hw/display/pl110_template.h                        |     6 +-
 hw/display/pxa2xx_lcd.c                            |   198 +-
 hw/display/qxl-logger.c                            |    22 +-
 hw/display/qxl-render.c                            |    20 +-
 hw/display/qxl.c                                   |    45 +-
 hw/display/qxl.h                                   |    23 +-
 hw/display/sii9022.c                               |     2 +
 hw/display/ssd0303.c                               |     2 +
 hw/display/tcx.c                                   |     1 -
 hw/display/trace-events                            |     1 +
 hw/display/vga-isa.c                               |     1 +
 hw/display/vga-mmio.c                              |     1 +
 hw/display/vga-pci.c                               |     5 +
 hw/display/vga.c                                   |    18 +-
 hw/display/vga_int.h                               |     3 +-
 hw/display/vga_regs.h                              |     6 +-
 hw/display/vhost-user-gpu-pci.c                    |     1 +
 hw/display/vhost-user-gpu.c                        |    11 +-
 hw/display/vhost-user-vga.c                        |     1 +
 hw/display/virtio-gpu-base.c                       |    10 +-
 hw/display/virtio-gpu-gl.c                         |     3 +-
 hw/display/virtio-gpu-pci-gl.c                     |     1 +
 hw/display/virtio-gpu-pci.c                        |     1 +
 hw/display/virtio-gpu-udmabuf.c                    |     1 -
 hw/display/virtio-gpu.c                            |     6 +
 hw/display/virtio-vga-gl.c                         |     1 +
 hw/display/virtio-vga.c                            |     6 +-
 hw/display/vmware_vga.c                            |    42 +-
 hw/display/xenfb.c                                 |   274 +-
 hw/display/xlnx_dp.c                               |    53 +-
 hw/dma/pl330.c                                     |     3 +-
 hw/dma/xilinx_axidma.c                             |     2 +-
 hw/dma/xlnx_csu_dma.c                              |     2 +-
 hw/dma/xlnx_dpdma.c                                |     2 +-
 hw/gpio/Kconfig                                    |     3 +
 hw/gpio/aspeed_gpio.c                              |   270 +-
 hw/gpio/meson.build                                |     2 +-
 hw/gpio/trace-events                               |     4 +
 hw/hppa/Kconfig                                    |     5 +-
 hw/hppa/dino.c                                     |   608 -
 hw/hppa/hppa_hardware.h                            |     5 +-
 hw/hppa/hppa_sys.h                                 |    24 -
 hw/hppa/lasi.c                                     |   367 -
 hw/hppa/machine.c                                  |   152 +-
 hw/hppa/meson.build                                |     2 +-
 hw/hppa/pci.c                                      |    88 -
 hw/hppa/trace-events                               |    14 -
 hw/hyperv/Kconfig                                  |     5 +
 hw/hyperv/hyperv.c                                 |   354 +-
 hw/hyperv/meson.build                              |     1 +
 hw/hyperv/syndbg.c                                 |   401 +
 hw/hyperv/vmbus.c                                  |    99 -
 hw/i2c/aspeed_i2c.c                                |  1012 +-
 hw/i2c/core.c                                      |    70 +-
 hw/i2c/pmbus_device.c                              |    15 +-
 hw/i2c/smbus_ich9.c                                |    15 +
 hw/i2c/smbus_slave.c                               |     4 +
 hw/i2c/trace-events                                |     4 +-
 hw/i386/acpi-build.c                               |   628 +-
 hw/i386/amd_iommu.c                                |    24 +-
 hw/i386/e820_memory_layout.c                       |    20 +-
 hw/i386/e820_memory_layout.h                       |    12 +-
 hw/i386/fw_cfg.c                                   |     3 -
 hw/i386/fw_cfg.h                                   |     1 -
 hw/i386/intel_iommu.c                              |   786 +-
 hw/i386/intel_iommu_internal.h                     |    25 +-
 hw/i386/microvm-dt.c                               |     9 +-
 hw/i386/microvm.c                                  |    77 +-
 hw/i386/multiboot.c                                |     5 +-
 hw/i386/pc.c                                       |   304 +-
 hw/i386/pc_piix.c                                  |   199 +-
 hw/i386/pc_q35.c                                   |    47 +-
 hw/i386/pc_sysfw.c                                 |    37 +-
 hw/i386/sgx.c                                      |     2 +-
 hw/i386/trace-events                               |     2 +
 hw/i386/x86.c                                      |   194 +-
 hw/i386/xen/xen-hvm.c                              |    17 +-
 hw/i386/xen/xen_platform.c                         |    48 +-
 hw/ide/atapi.c                                     |     8 +-
 hw/ide/core.c                                      |    42 +-
 hw/ide/macio.c                                     |     5 +-
 hw/ide/microdrive.c                                |     8 +-
 hw/ide/piix.c                                      |    64 +-
 hw/ide/via.c                                       |     2 +-
 hw/input/lasips2.c                                 |   335 +-
 hw/input/pckbd.c                                   |   382 +-
 hw/input/pl050.c                                   |   160 +-
 hw/input/ps2.c                                     |   487 +-
 hw/input/trace-events                              |     2 -
 hw/input/vhost-user-input.c                        |     8 +-
 hw/input/virtio-input-host.c                       |     5 +-
 hw/input/virtio-input.c                            |     3 +-
 hw/intc/Kconfig                                    |    18 +
 hw/intc/arm_gic.c                                  |    28 +-
 hw/intc/arm_gicv3_common.c                         |    59 +-
 hw/intc/arm_gicv3_cpuif.c                          |   429 +-
 hw/intc/arm_gicv3_dist.c                           |     9 +-
 hw/intc/arm_gicv3_its.c                            |   776 +-
 hw/intc/arm_gicv3_its_kvm.c                        |     2 +
 hw/intc/arm_gicv3_kvm.c                            |    24 +-
 hw/intc/arm_gicv3_redist.c                         |   484 +-
 hw/intc/armv7m_nvic.c                              |     9 +-
 hw/intc/exynos4210_combiner.c                      |   108 +-
 hw/intc/exynos4210_gic.c                           |   353 +-
 hw/intc/gicv3_internal.h                           |   213 +-
 hw/intc/heathrow_pic.c                             |     1 -
 hw/intc/loongarch_extioi.c                         |   317 +
 hw/intc/loongarch_ipi.c                            |   273 +
 hw/intc/loongarch_pch_msi.c                        |    91 +
 hw/intc/loongarch_pch_pic.c                        |   431 +
 hw/intc/meson.build                                |     5 +
 hw/intc/nios2_vic.c                                |   313 +
 hw/intc/openpic.c                                  |     3 +-
 hw/intc/pnv_xive.c                                 |    20 -
 hw/intc/pnv_xive2.c                                |    41 +-
 hw/intc/ppc-uic.c                                  |    26 +-
 hw/intc/riscv_aclint.c                             |   189 +-
 hw/intc/riscv_aplic.c                              |     2 +-
 hw/intc/riscv_imsic.c                              |     4 +-
 hw/intc/s390_flic_kvm.c                            |     2 +-
 hw/intc/sifive_plic.c                              |    44 +-
 hw/intc/trace-events                               |    39 +-
 hw/intc/xics.c                                     |    12 +-
 hw/intc/xics_kvm.c                                 |     1 -
 hw/intc/xive.c                                     |    29 +-
 hw/intc/xive2.c                                    |    18 +-
 hw/ipmi/isa_ipmi_bt.c                              |     4 +
 hw/ipmi/isa_ipmi_kcs.c                             |     4 +
 hw/ipmi/smbus_ipmi.c                               |     8 +-
 hw/isa/Kconfig                                     |     9 +
 hw/isa/isa-bus.c                                   |    10 +-
 hw/isa/lpc_ich9.c                                  |    37 +
 hw/isa/piix3.c                                     |   165 +-
 hw/isa/piix4.c                                     |   122 +-
 hw/isa/vt82c686.c                                  |   120 +-
 hw/loongarch/Kconfig                               |    22 +
 hw/loongarch/acpi-build.c                          |   549 +
 hw/loongarch/fw_cfg.c                              |    34 +
 hw/loongarch/fw_cfg.h                              |    15 +
 hw/loongarch/meson.build                           |     8 +
 hw/loongarch/virt.c                                |   985 +
 hw/m68k/bootinfo.h                                 |    56 +-
 hw/m68k/mcf5206.c                                  |     2 +-
 hw/m68k/mcf5208.c                                  |     3 +-
 hw/m68k/q800.c                                     |    82 +-
 hw/m68k/virt.c                                     |    76 +-
 hw/mem/Kconfig                                     |     5 +
 hw/mem/cxl_type3.c                                 |   647 +
 hw/mem/meson.build                                 |     1 +
 hw/mem/nvdimm.c                                    |     2 +-
 hw/meson.build                                     |     2 +
 hw/microblaze/boot.c                               |     8 +-
 hw/mips/bootloader.c                               |    28 +-
 hw/mips/boston.c                                   |    25 +-
 hw/mips/fuloong2e.c                                |    50 +-
 hw/mips/gt64xxx_pci.c                              |     6 +-
 hw/mips/jazz.c                                     |    23 +-
 hw/mips/loongson3_virt.c                           |     1 -
 hw/mips/malta.c                                    |   195 +-
 hw/mips/mipssim.c                                  |     3 +-
 hw/misc/Kconfig                                    |     3 +
 hw/misc/applesmc.c                                 |    29 +
 hw/misc/aspeed_hace.c                              |   167 +-
 hw/misc/aspeed_peci.c                              |   152 +
 hw/misc/aspeed_sbc.c                               |    45 +-
 hw/misc/aspeed_scu.c                               |   110 +-
 hw/misc/bcm2835_property.c                         |     4 +
 hw/misc/cbus.c                                     |     6 +-
 hw/misc/grlib_ahb_apb_pnp.c                        |    10 +-
 hw/misc/iotkit-secctl.c                            |     2 +-
 hw/misc/iotkit-sysctl.c                            |     4 +-
 hw/misc/ivshmem.c                                  |     2 +-
 hw/misc/lasi.c                                     |   274 +
 hw/misc/mac_via.c                                  |     8 +-
 hw/misc/macio/cuda.c                               |     1 -
 hw/misc/macio/gpio.c                               |     1 -
 hw/misc/macio/macio.c                              |     8 +-
 hw/misc/macio/pmu.c                                |     1 -
 hw/misc/meson.build                                |     7 +-
 hw/misc/mips_itu.c                                 |     3 +-
 hw/misc/mos6522.c                                  |     2 +-
 hw/misc/pvpanic-isa.c                              |    42 +
 hw/misc/sbsa_ec.c                                  |     1 -
 hw/misc/sifive_u_otp.c                             |    14 +-
 hw/misc/trace-events                               |    15 +-
 hw/misc/xlnx-versal-crl.c                          |   421 +
 hw/net/can/can_sja1000.c                           |    31 +-
 hw/net/can/ctu_can_fd_frame.h                      |   184 +-
 hw/net/can/ctu_can_fd_regs.h                       |  1264 +-
 hw/net/can/ctucan_core.h                           |     2 +-
 hw/net/can/xlnx-zynqmp-can.c                       |    34 +-
 hw/net/e1000.c                                     |     5 +-
 hw/net/e1000_regs.h                                |    31 +-
 hw/net/e1000e.c                                    |    15 +-
 hw/net/e1000e_core.c                               |    62 +-
 hw/net/fsl_etsec/etsec.c                           |    26 +-
 hw/net/fsl_etsec/etsec.h                           |     7 -
 hw/net/fsl_etsec/rings.c                           |     1 -
 hw/net/imx_fec.c                                   |     2 +-
 hw/net/lan9118.c                                   |    10 +-
 hw/net/mcf_fec.c                                   |     8 +-
 hw/net/meson.build                                 |     8 +-
 hw/net/msf2-emac.c                                 |     1 -
 hw/net/ne2000.c                                    |   138 +-
 hw/net/npcm7xx_emc.c                               |     1 -
 hw/net/pcnet.c                                     |   136 +-
 hw/net/pcnet.h                                     |     4 +-
 hw/net/rocker/rocker.c                             |    27 +-
 hw/net/rtl8139.c                                   |    49 +-
 hw/net/tulip.c                                     |    12 +-
 hw/net/vhost_net-stub.c                            |    12 +
 hw/net/vhost_net.c                                 |   120 +-
 hw/net/virtio-net.c                                |   278 +-
 hw/net/vmxnet3.c                                   |    27 +-
 hw/net/vmxnet3.h                                   |     4 +-
 hw/net/xen_nic.c                                   |     5 +-
 hw/nios2/10m50_devboard.c                          |   115 +-
 hw/nios2/Kconfig                                   |     1 +
 hw/nios2/boot.c                                    |    16 +-
 hw/nios2/generic_nommu.c                           |     1 -
 hw/nios2/meson.build                               |     2 +-
 hw/nvme/ctrl.c                                     |  1208 +-
 hw/nvme/dif.c                                      |     5 +
 hw/nvme/ns.c                                       |    13 +-
 hw/nvme/nvme.h                                     |    79 +-
 hw/nvme/subsys.c                                   |    78 +-
 hw/nvme/trace-events                               |    11 +
 hw/nvram/eeprom93xx.c                              |     2 +-
 hw/nvram/eeprom_at24c.c                            |    10 +-
 hw/nvram/fw_cfg.c                                  |    78 +-
 hw/nvram/mac_nvram.c                               |     2 +-
 hw/nvram/spapr_nvram.c                             |    16 +-
 hw/nvram/xlnx-bbram.c                              |     4 +-
 hw/nvram/xlnx-efuse.c                              |     4 +-
 hw/openrisc/Kconfig                                |    12 +
 hw/openrisc/boot.c                                 |   119 +
 hw/openrisc/cputimer.c                             |    22 +-
 hw/openrisc/meson.build                            |     2 +
 hw/openrisc/openrisc_sim.c                         |   132 +-
 hw/openrisc/virt.c                                 |   571 +
 hw/pci-bridge/Kconfig                              |     5 +
 hw/pci-bridge/cxl_downstream.c                     |   249 +
 hw/pci-bridge/cxl_root_port.c                      |   236 +
 hw/pci-bridge/cxl_upstream.c                       |   409 +
 hw/pci-bridge/meson.build                          |     6 +-
 hw/pci-bridge/pci_expander_bridge.c                |   176 +-
 hw/pci-bridge/pci_expander_bridge_stubs.c          |    14 +
 hw/pci-bridge/pcie_root_port.c                     |     6 +-
 hw/pci-host/Kconfig                                |     4 +
 hw/pci-host/dino.c                                 |   521 +
 hw/pci-host/gpex-acpi.c                            |    20 +-
 hw/pci-host/grackle.c                              |    15 +-
 hw/pci-host/i440fx.c                               |     9 +-
 hw/pci-host/meson.build                            |     6 +-
 hw/pci-host/mv64361.c                              |     1 -
 hw/pci-host/pnv_phb.c                              |   345 +
 hw/pci-host/pnv_phb.h                              |    55 +
 hw/pci-host/pnv_phb3.c                             |   177 +-
 hw/pci-host/pnv_phb3_msi.c                         |     1 -
 hw/pci-host/pnv_phb3_pbcq.c                        |     1 -
 hw/pci-host/pnv_phb4.c                             |   230 +-
 hw/pci-host/pnv_phb4_pec.c                         |    25 +-
 hw/pci-host/q35.c                                  |     3 +-
 hw/pci-host/raven.c                                |     1 -
 hw/pci-host/remote.c                               |     1 -
 hw/pci-host/trace-events                           |     5 +
 hw/pci-host/uninorth.c                             |     1 -
 hw/pci/meson.build                                 |     1 +
 hw/pci/msi.c                                       |    49 +-
 hw/pci/msix.c                                      |    45 +-
 hw/pci/pci.c                                       |    52 +-
 hw/pci/pcie.c                                      |     5 +-
 hw/pci/pcie_aer.c                                  |     4 +-
 hw/pci/pcie_doe.c                                  |   367 +
 hw/pci/pcie_port.c                                 |    25 +
 hw/pci/shpc.c                                      |     5 +-
 hw/ppc/Kconfig                                     |    14 +-
 hw/ppc/e500.c                                      |   120 +-
 hw/ppc/e500.h                                      |     1 -
 hw/ppc/e500plat.c                                  |     1 -
 hw/ppc/mac.h                                       |   105 -
 hw/ppc/mac_newworld.c                              |   229 +-
 hw/ppc/mac_oldworld.c                              |   116 +-
 hw/ppc/meson.build                                 |    10 +-
 hw/ppc/mpc8544ds.c                                 |     9 +-
 hw/ppc/pegasos2.c                                  |    38 +-
 hw/ppc/pnv.c                                       |   295 +-
 hw/ppc/pnv_bmc.c                                   |     1 -
 hw/ppc/pnv_core.c                                  |     1 +
 hw/ppc/pnv_lpc.c                                   |    19 +-
 hw/ppc/pnv_occ.c                                   |    16 +-
 hw/ppc/pnv_pnor.c                                  |     6 +-
 hw/ppc/pnv_psi.c                                   |    36 +-
 hw/ppc/pnv_sbe.c                                   |   414 +
 hw/ppc/pnv_xscom.c                                 |     3 +
 hw/ppc/ppc.c                                       |    47 +-
 hw/ppc/ppc405.h                                    |   194 +-
 hw/ppc/ppc405_boards.c                             |   564 +-
 hw/ppc/ppc405_uc.c                                 |  1153 +-
 hw/ppc/ppc440.h                                    |     4 -
 hw/ppc/ppc440_bamboo.c                             |    95 +-
 hw/ppc/ppc440_uc.c                                 |   283 +-
 hw/ppc/ppc4xx_devs.c                               |   913 +-
 hw/ppc/ppc4xx_pci.c                                |    31 +-
 hw/ppc/ppc4xx_sdram.c                              |   757 +
 hw/ppc/prep.c                                      |     6 +-
 hw/ppc/prep_systemio.c                             |     2 +-
 hw/ppc/sam460ex.c                                  |   108 +-
 hw/ppc/spapr.c                                     |    90 +-
 hw/ppc/spapr_caps.c                                |     2 +-
 hw/ppc/spapr_hcall.c                               |    97 +-
 hw/ppc/spapr_iommu.c                               |     3 +-
 hw/ppc/spapr_numa.c                                |     1 -
 hw/ppc/spapr_nvdimm.c                              |    18 +-
 hw/ppc/spapr_pci.c                                 |    11 +-
 hw/ppc/spapr_pci_nvlink2.c                         |     3 +-
 hw/ppc/spapr_rtas.c                                |    20 +-
 hw/ppc/spapr_rtas_ddw.c                            |    35 +-
 hw/ppc/spapr_tpm_proxy.c                           |     1 -
 hw/ppc/spapr_vof.c                                 |     1 -
 hw/ppc/trace-events                                |    17 +-
 hw/ppc/virtex_ml507.c                              |    43 +-
 hw/ppc/vof.c                                       |     3 +-
 hw/rdma/vmw/pvrdma_main.c                          |    18 +-
 hw/remote/Kconfig                                  |     4 +
 hw/remote/iohub.c                                  |     1 -
 hw/remote/iommu.c                                  |   131 +
 hw/remote/machine.c                                |    89 +-
 hw/remote/memory.c                                 |     1 -
 hw/remote/meson.build                              |     4 +
 hw/remote/message.c                                |     1 -
 hw/remote/mpqemu-link.c                            |     3 +-
 hw/remote/proxy-memory-listener.c                  |     1 -
 hw/remote/proxy.c                                  |     1 -
 hw/remote/remote-obj.c                             |     1 -
 hw/remote/trace-events                             |    11 +
 hw/remote/vfio-user-obj.c                          |   951 +
 hw/riscv/Kconfig                                   |     2 +
 hw/riscv/boot.c                                    |    60 +-
 hw/riscv/microchip_pfsoc.c                         |    71 +-
 hw/riscv/opentitan.c                               |    56 +-
 hw/riscv/shakti_c.c                                |     3 +-
 hw/riscv/sifive_e.c                                |     2 +-
 hw/riscv/sifive_u.c                                |    33 +-
 hw/riscv/spike.c                                   |    17 +-
 hw/riscv/virt.c                                    |   411 +-
 hw/rtc/Kconfig                                     |     3 +
 hw/rtc/exynos4210_rtc.c                            |     4 +-
 hw/rtc/goldfish_rtc.c                              |    37 +-
 hw/rtc/ls7a_rtc.c                                  |   488 +
 hw/rtc/m41t80.c                                    |     6 +-
 hw/rtc/mc146818rtc.c                               |    23 +-
 hw/rtc/meson.build                                 |     1 +
 hw/rx/rx-gdbsim.c                                  |    10 +-
 hw/s390x/css.c                                     |    51 +-
 hw/s390x/event-facility.c                          |     2 +-
 hw/s390x/ipl.c                                     |    44 +-
 hw/s390x/ipl.h                                     |     2 +-
 hw/s390x/meson.build                               |     2 +
 hw/s390x/pv.c                                      |   114 +-
 hw/s390x/s390-ccw.c                                |     2 +-
 hw/s390x/s390-pci-bus.c                            |   111 +-
 hw/s390x/s390-pci-inst.c                           |    85 +-
 hw/s390x/s390-pci-kvm.c                            |    52 +
 hw/s390x/s390-pci-vfio.c                           |   129 +-
 hw/s390x/s390-virtio-ccw.c                         |   185 +-
 hw/s390x/tod-kvm.c                                 |     9 +
 hw/s390x/vhost-scsi-ccw.c                          |    73 +
 hw/s390x/vhost-vsock-ccw.c                         |     9 +
 hw/s390x/virtio-ccw-9p.c                           |     9 +
 hw/s390x/virtio-ccw-balloon.c                      |     9 +
 hw/s390x/virtio-ccw-blk.c                          |     9 +
 hw/s390x/virtio-ccw-crypto.c                       |     9 +
 hw/s390x/virtio-ccw-gpu.c                          |    10 +
 hw/s390x/virtio-ccw-input.c                        |    20 +
 hw/s390x/virtio-ccw-net.c                          |     9 +
 hw/s390x/virtio-ccw-rng.c                          |     9 +
 hw/s390x/virtio-ccw-scsi.c                         |    56 +-
 hw/s390x/virtio-ccw-serial.c                       |     9 +
 hw/s390x/virtio-ccw.c                              |    14 +-
 hw/s390x/virtio-ccw.h                              |   149 -
 hw/scsi/Kconfig                                    |     5 +
 hw/scsi/esp.c                                      |    14 +-
 hw/scsi/lsi53c895a.c                               |    10 +-
 hw/scsi/megasas.c                                  |    12 +-
 hw/scsi/mfi.h                                      |     2 +-
 hw/scsi/mptsas.c                                   |    11 +-
 hw/scsi/scsi-bus.c                                 |    47 +-
 hw/scsi/scsi-disk.c                                |   130 +-
 hw/scsi/scsi-generic.c                             |    27 +-
 hw/scsi/spapr_vscsi.c                              |     7 +-
 hw/scsi/trace-events                               |     3 +
 hw/scsi/vhost-scsi-common.c                        |     4 +-
 hw/scsi/vhost-scsi.c                               |    13 +-
 hw/scsi/vhost-user-scsi.c                          |     3 +-
 hw/scsi/virtio-scsi-dataplane.c                    |    13 +-
 hw/scsi/virtio-scsi.c                              |   117 +-
 hw/scsi/vmw_pvscsi.c                               |     8 +-
 hw/sd/allwinner-sdhost.c                           |    74 +-
 hw/sd/sd.c                                         |     5 +-
 hw/sd/sdhci-internal.h                             |    20 -
 hw/sd/sdhci.c                                      |    63 +-
 hw/sensor/Kconfig                                  |     4 +
 hw/sensor/isl_pmbus_vr.c                           |    40 +
 hw/sensor/lsm303dlhc_mag.c                         |     2 +
 hw/sensor/max31785.c                               |   573 +
 hw/sensor/meson.build                              |     1 +
 hw/smbios/smbios.c                                 |    96 +-
 hw/smbios/smbios_build.h                           |     9 +-
 hw/sparc/leon3.c                                   |     1 -
 hw/sparc/sun4m.c                                   |    12 +-
 hw/sparc64/sun4u.c                                 |     9 +-
 hw/sparc64/sun4u_iommu.c                           |     2 +-
 hw/ssi/aspeed_smc.c                                |   170 +-
 hw/ssi/ibex_spi_host.c                             |   646 +
 hw/ssi/meson.build                                 |     1 +
 hw/ssi/ssi.c                                       |    18 +-
 hw/ssi/trace-events                                |     7 +
 hw/timer/allwinner-a10-pit.c                       |     2 +-
 hw/timer/altera_timer.c                            |     2 +-
 hw/timer/arm_timer.c                               |     2 +-
 hw/timer/aspeed_timer.c                            |    17 +
 hw/timer/cadence_ttc.c                             |    32 +-
 hw/timer/digic-timer.c                             |     2 +-
 hw/timer/etraxfs_timer.c                           |     6 +-
 hw/timer/exynos4210_mct.c                          |     6 +-
 hw/timer/exynos4210_pwm.c                          |     2 +-
 hw/timer/grlib_gptimer.c                           |     2 +-
 hw/timer/ibex_timer.c                              |    18 +-
 hw/timer/imx_epit.c                                |    13 +-
 hw/timer/imx_gpt.c                                 |     2 +-
 hw/timer/mss-timer.c                               |     2 +-
 hw/timer/renesas_cmt.c                             |     2 +-
 hw/timer/renesas_tmr.c                             |     8 +-
 hw/timer/sh_timer.c                                |     2 +-
 hw/timer/slavio_timer.c                            |     2 +-
 hw/timer/sse-timer.c                               |     2 +-
 hw/timer/xilinx_timer.c                            |     2 +-
 hw/tpm/tpm_crb.c                                   |     8 +-
 hw/tpm/tpm_ppi.c                                   |     2 +-
 hw/tpm/tpm_tis_common.c                            |     7 +-
 hw/tpm/tpm_tis_isa.c                               |    32 +
 hw/usb/Kconfig                                     |     5 +
 hw/usb/canokey.c                                   |   334 +
 hw/usb/canokey.h                                   |    69 +
 hw/usb/ccid-card-emulated.c                        |     3 +-
 hw/usb/ccid-card-passthru.c                        |     3 +-
 hw/usb/dev-hub.c                                   |    82 +-
 hw/usb/dev-mtp.c                                   |     5 +-
 hw/usb/dev-network.c                               |   320 +-
 hw/usb/dev-smartcard-reader.c                      |     2 +-
 hw/usb/dev-storage.c                               |    58 +-
 hw/usb/dev-uas.c                                   |     5 +-
 hw/usb/dev-wacom.c                                 |     4 +-
 hw/usb/hcd-dwc2.h                                  |     4 +-
 hw/usb/hcd-ehci.c                                  |     5 +-
 hw/usb/hcd-musb.c                                  |   328 +-
 hw/usb/hcd-ohci.c                                  |    17 +-
 hw/usb/hcd-xhci-pci.c                              |     2 +-
 hw/usb/hcd-xhci-sysbus.c                           |     2 +-
 hw/usb/hcd-xhci.c                                  |    94 +-
 hw/usb/host-libusb.c                               |    16 +-
 hw/usb/meson.build                                 |     5 +
 hw/usb/quirks-pl2303-ids.h                         |   180 +-
 hw/usb/redirect.c                                  |     3 +-
 hw/usb/trace-events                                |    17 +
 hw/usb/u2f.h                                       |     2 +-
 hw/usb/vt82c686-uhci-pci.c                         |     4 +-
 hw/vfio/common.c                                   |   192 +-
 hw/vfio/display.c                                  |     8 +-
 hw/vfio/migration.c                                |    29 +-
 hw/vfio/pci-quirks.c                               |    34 +-
 hw/vfio/pci.c                                      |   244 +-
 hw/vfio/pci.h                                      |     2 +
 hw/vfio/spapr.c                                    |     8 +-
 hw/vfio/trace-events                               |     1 +
 hw/virtio/Kconfig                                  |    23 +-
 hw/virtio/meson.build                              |    38 +-
 hw/virtio/trace-events                             |    22 +-
 hw/virtio/vhost-backend.c                          |    11 +-
 hw/virtio/vhost-iova-tree.c                        |     6 +-
 hw/virtio/vhost-iova-tree.h                        |     2 +-
 hw/virtio/vhost-scsi-pci.c                         |     2 +-
 hw/virtio/vhost-shadow-virtqueue.c                 |   281 +-
 hw/virtio/vhost-shadow-virtqueue.h                 |    58 +-
 hw/virtio/vhost-user-blk-pci.c                     |     2 +-
 hw/virtio/vhost-user-fs-pci.c                      |     2 +-
 hw/virtio/vhost-user-fs.c                          |    24 +-
 hw/virtio/vhost-user-gpio-pci.c                    |    69 +
 hw/virtio/vhost-user-gpio.c                        |   418 +
 hw/virtio/vhost-user-i2c-pci.c                     |     2 +-
 hw/virtio/vhost-user-i2c.c                         |    22 +-
 hw/virtio/vhost-user-input-pci.c                   |     2 +-
 hw/virtio/vhost-user-rng-pci.c                     |     2 +-
 hw/virtio/vhost-user-rng.c                         |    34 +-
 hw/virtio/vhost-user-scsi-pci.c                    |     2 +-
 hw/virtio/vhost-user-vsock-pci.c                   |     2 +-
 hw/virtio/vhost-user-vsock.c                       |    10 +-
 hw/virtio/vhost-user.c                             |   313 +-
 hw/virtio/vhost-vdpa.c                             |   147 +-
 hw/virtio/vhost-vsock-common.c                     |    20 +-
 hw/virtio/vhost-vsock-pci.c                        |     2 +-
 hw/virtio/vhost-vsock.c                            |    21 +-
 hw/virtio/vhost.c                                  |   120 +-
 hw/virtio/virtio-9p-pci.c                          |     2 +-
 hw/virtio/virtio-balloon-pci.c                     |     2 +-
 hw/virtio/virtio-balloon.c                         |    12 +-
 hw/virtio/virtio-blk-pci.c                         |     2 +-
 hw/virtio/virtio-bus.c                             |    23 +-
 hw/virtio/virtio-crypto.c                          |   592 +-
 hw/virtio/virtio-input-host-pci.c                  |     2 +-
 hw/virtio/virtio-input-pci.c                       |     2 +-
 hw/virtio/virtio-iommu-pci.c                       |    18 +-
 hw/virtio/virtio-iommu.c                           |   202 +-
 hw/virtio/virtio-mem-pci.c                         |     2 -
 hw/virtio/virtio-mem.c                             |    16 +-
 hw/virtio/virtio-mmio.c                            |    18 +-
 hw/virtio/virtio-net-pci.c                         |     2 +-
 hw/virtio/virtio-pci.c                             |   112 +-
 hw/virtio/virtio-pci.h                             |   255 -
 hw/virtio/virtio-pmem-pci.c                        |     2 -
 hw/virtio/virtio-pmem.c                            |     4 +-
 hw/virtio/virtio-rng-pci.c                         |    16 +-
 hw/virtio/virtio-rng.c                             |     2 +-
 hw/virtio/virtio-scsi-pci.c                        |     2 +-
 hw/virtio/virtio-serial-pci.c                      |     2 +-
 hw/virtio/virtio-stub.c                            |    42 +
 hw/virtio/virtio.c                                 |  1187 +-
 hw/watchdog/meson.build                            |     1 +
 hw/watchdog/sbsa_gwdt.c                            |     6 -
 hw/watchdog/spapr_watchdog.c                       |   274 +
 hw/watchdog/trace-events                           |     7 +
 hw/watchdog/watchdog.c                             |    43 -
 hw/watchdog/wdt_aspeed.c                           |    40 +-
 hw/watchdog/wdt_diag288.c                          |     6 -
 hw/watchdog/wdt_i6300esb.c                         |     6 -
 hw/watchdog/wdt_ib700.c                            |     6 -
 hw/watchdog/wdt_imx2.c                             |     6 -
 hw/xen/meson.build                                 |    20 +-
 hw/xen/xen_pt.c                                    |    12 -
 hw/xen/xen_pt.h                                    |     2 +
 hw/xen/xen_pt_config_init.c                        |    29 +-
 hw/xen/xen_pt_graphics.c                           |   122 +
 hw/xen/xen_pvdev.c                                 |    45 +-
 hw/xenpv/xen_machine_pv.c                          |     1 +
 hw/xtensa/mx_pic.c                                 |     2 +-
 hw/xtensa/sim.c                                    |     2 +-
 hw/xtensa/xtfpga.c                                 |     4 +-
 include/block/accounting.h                         |     6 +-
 include/block/aio-wait.h                           |    19 +-
 include/block/aio.h                                |    10 +
 include/block/block-common.h                       |    48 +
 include/block/block-copy.h                         |     4 +-
 include/block/block-global-state.h                 |    30 +-
 include/block/block-hmp-cmds.h                     |     6 +-
 include/block/block-io.h                           |    32 +-
 include/block/block_int-common.h                   |    68 +-
 include/block/block_int-global-state.h             |     5 +-
 include/block/block_int-io.h                       |     8 +-
 include/block/blockjob.h                           |    59 +-
 include/block/nbd.h                                |     7 +-
 include/block/nvme.h                               |   111 +-
 include/block/qdict.h                              |     3 +
 include/block/thread-pool.h                        |     3 +
 include/chardev/char-socket.h                      |     7 +-
 include/chardev/char.h                             |     4 +-
 include/crypto/akcipher.h                          |   179 +
 include/crypto/block.h                             |    32 +-
 include/crypto/sm4.h                               |     6 +
 include/crypto/tls-cipher-suites.h                 |     6 +-
 include/disas/dis-asm.h                            |     6 +-
 include/elf.h                                      |     3 +
 include/exec/cpu-all.h                             |    40 +-
 include/exec/cpu-common.h                          |    11 +-
 include/exec/cpu-defs.h                            |    48 +-
 include/exec/cpu_ldst.h                            |     2 +-
 include/exec/exec-all.h                            |   233 +-
 include/exec/gdbstub.h                             |    66 +-
 include/exec/helper-head.h                         |     2 +-
 include/exec/log.h                                 |    52 +-
 include/exec/memop.h                               |     4 +-
 include/exec/memopidx.h                            |     2 +-
 include/exec/memory.h                              |    22 +-
 include/exec/page-vary.h                           |    18 +
 include/exec/plugin-gen.h                          |     7 +-
 include/exec/poison.h                              |     6 +-
 include/exec/ram_addr.h                            |    15 +-
 include/exec/ramblock.h                            |     3 +
 include/exec/softmmu-semi.h                        |   101 -
 include/exec/translate-all.h                       |     2 +-
 include/exec/translator.h                          |   117 +-
 include/fpu/softfloat-helpers.h                    |     2 +-
 include/fpu/softfloat-types.h                      |     6 +-
 include/fpu/softfloat.h                            |     7 +
 include/glib-compat.h                              |     4 +
 include/hw/acpi/acpi_aml_interface.h               |    49 +
 include/hw/acpi/cxl.h                              |    29 +
 include/hw/acpi/generic_event_device.h             |     4 +-
 include/hw/acpi/ipmi.h                             |     9 +-
 include/hw/acpi/piix4.h                            |    75 +
 include/hw/adc/aspeed_adc.h                        |     1 +
 include/hw/adc/zynq-xadc.h                         |     3 +-
 include/hw/arm/aspeed_soc.h                        |    40 +-
 include/hw/arm/bcm2835_peripherals.h               |     2 +
 include/hw/arm/boot.h                              |     5 +-
 include/hw/arm/exynos4210.h                        |    50 +-
 include/hw/arm/smmu-common.h                       |     1 +
 include/hw/arm/sysbus-fdt.h                        |    37 -
 include/hw/arm/virt.h                              |    21 +-
 include/hw/arm/xlnx-versal.h                       |    16 +
 include/hw/arm/xlnx-zynqmp.h                       |     7 +
 include/hw/audio/soundhw.h                         |     8 +-
 include/hw/block/block.h                           |     7 +-
 include/hw/block/fdc.h                             |     3 +-
 include/hw/boards.h                                |    15 +-
 include/hw/core/cpu.h                              |    43 +-
 include/hw/core/sysbus-fdt.h                       |    37 +
 include/hw/core/sysemu-cpu-ops.h                   |     8 +-
 include/hw/core/tcg-cpu-ops.h                      |    18 +-
 include/hw/cxl/cxl.h                               |    61 +
 include/hw/cxl/cxl_cdat.h                          |   166 +
 include/hw/cxl/cxl_component.h                     |   230 +
 include/hw/cxl/cxl_device.h                        |   272 +
 include/hw/cxl/cxl_host.h                          |    23 +
 include/hw/cxl/cxl_pci.h                           |   168 +
 include/hw/display/xlnx_dp.h                       |    12 +-
 include/hw/elf_ops.h                               |     2 +-
 include/hw/firmware/smbios.h                       |    22 +
 include/hw/gpio/aspeed_gpio.h                      |    18 +-
 include/hw/hw.h                                    |     2 +-
 include/hw/hyperv/hyperv-proto.h                   |    52 +
 include/hw/hyperv/hyperv.h                         |    58 +
 include/hw/hyperv/vmbus.h                          |     3 -
 include/hw/i2c/arm_sbcon_i2c.h                     |     7 +-
 include/hw/i2c/aspeed_i2c.h                        |   301 +-
 include/hw/i2c/i2c.h                               |    30 +
 include/hw/i2c/i2c_mux_pca954x.h                   |     4 +-
 include/hw/i2c/pmbus_device.h                      |     7 +
 include/hw/i386/intel_iommu.h                      |    25 +-
 include/hw/i386/microvm.h                          |     4 -
 include/hw/i386/pc.h                               |    33 +-
 include/hw/i386/x86-iommu.h                        |     4 +-
 include/hw/i386/x86.h                              |    13 +-
 include/hw/ide.h                                   |     3 -
 include/hw/ide/internal.h                          |     3 +
 include/hw/ide/piix.h                              |     7 +
 include/hw/input/i8042.h                           |    74 +-
 include/hw/input/lasips2.h                         |    68 +-
 include/hw/input/lm832x.h                          |     4 +-
 include/hw/input/pl050.h                           |    59 +
 include/hw/input/ps2.h                             |    77 +-
 include/hw/intc/arm_gicv3_common.h                 |    21 +-
 include/hw/intc/arm_gicv3_its_common.h             |    19 +
 include/hw/intc/exynos4210_combiner.h              |    57 +
 include/hw/intc/exynos4210_gic.h                   |    43 +
 include/hw/intc/loongarch_extioi.h                 |    62 +
 include/hw/intc/loongarch_ipi.h                    |    53 +
 include/hw/intc/loongarch_pch_msi.h                |    22 +
 include/hw/intc/loongarch_pch_pic.h                |    69 +
 include/hw/intc/nios2_vic.h                        |    64 +
 include/hw/intc/ppc-uic.h                          |     6 +-
 include/hw/intc/riscv_aclint.h                     |     3 +
 include/hw/intc/rx_icu.h                           |     2 +-
 include/hw/irq.h                                   |     5 -
 include/hw/isa/isa.h                               |    17 -
 include/hw/isa/vt82c686.h                          |     4 +-
 include/hw/loader.h                                |    55 +-
 include/hw/loongarch/virt.h                        |    57 +
 include/hw/mem/nvdimm.h                            |     8 -
 include/hw/mips/bios.h                             |     2 +-
 include/hw/mips/bootloader.h                       |     8 +-
 include/hw/misc/aspeed_hace.h                      |     9 +-
 include/hw/misc/aspeed_lpc.h                       |     2 +-
 include/hw/misc/aspeed_peci.h                      |    29 +
 include/hw/misc/aspeed_sbc.h                       |    15 +-
 include/hw/misc/aspeed_scu.h                       |    45 +
 include/hw/misc/bcm2835_cprman.h                   |     4 +-
 include/hw/misc/bcm2835_cprman_internals.h         |     4 +-
 include/hw/misc/lasi.h                             |    78 +
 include/hw/misc/macio/macio.h                      |    23 +-
 include/hw/misc/npcm7xx_gcr.h                      |    30 +
 include/hw/misc/pvpanic.h                          |     9 -
 include/hw/misc/stm32f4xx_exti.h                   |     4 +-
 include/hw/misc/stm32f4xx_syscfg.h                 |     4 +-
 include/hw/misc/xlnx-versal-crl.h                  |   235 +
 include/hw/misc/xlnx-versal-pmc-iou-slcr.h         |     6 +-
 include/hw/net/allwinner-sun8i-emac.h              |     2 +-
 include/hw/net/mv88w8618_eth.h                     |     5 +-
 include/hw/nubus/mac-nubus-bridge.h                |     4 +-
 include/hw/nvram/fw_cfg.h                          |    43 +
 include/hw/nvram/mac_nvram.h                       |    51 +
 include/hw/openrisc/boot.h                         |    34 +
 include/hw/pci-bridge/pci_expander_bridge.h        |    12 +
 include/hw/pci-host/dino.h                         |   146 +
 include/hw/pci-host/grackle.h                      |    44 +
 include/hw/pci-host/i440fx.h                       |     4 +-
 include/hw/pci-host/ls7a.h                         |    51 +
 include/hw/pci-host/pnv_phb3.h                     |    19 +-
 include/hw/pci-host/pnv_phb3_regs.h                |    16 -
 include/hw/pci-host/pnv_phb4.h                     |    22 +-
 include/hw/pci-host/remote.h                       |     4 +-
 include/hw/pci/msi.h                               |     1 +
 include/hw/pci/msix.h                              |     3 +-
 include/hw/pci/pci.h                               |    88 +-
 include/hw/pci/pci_bridge.h                        |    20 +
 include/hw/pci/pci_bus.h                           |     9 +
 include/hw/pci/pci_ids.h                           |     5 +
 include/hw/pci/pcie.h                              |     1 +
 include/hw/pci/pcie_doe.h                          |   123 +
 include/hw/pci/pcie_host.h                         |     6 +-
 include/hw/pci/pcie_port.h                         |     2 +
 include/hw/pci/pcie_regs.h                         |     4 +
 include/hw/ppc/pnv.h                               |    12 +-
 include/hw/ppc/pnv_lpc.h                           |     8 +-
 include/hw/ppc/pnv_occ.h                           |     7 +-
 include/hw/ppc/pnv_pnor.h                          |     8 +-
 include/hw/ppc/pnv_psi.h                           |     7 +-
 include/hw/ppc/pnv_sbe.h                           |    55 +
 include/hw/ppc/pnv_xscom.h                         |    12 +
 include/hw/ppc/ppc.h                               |    10 +-
 include/hw/ppc/ppc4xx.h                            |   135 +-
 include/hw/ppc/spapr.h                             |    34 +-
 include/hw/ppc/xive.h                              |     1 +
 include/hw/ptimer.h                                |    16 +-
 include/hw/qdev-core.h                             |    31 +-
 include/hw/qdev-properties.h                       |    12 +
 include/hw/registerfields.h                        |    70 +
 include/hw/remote/iommu.h                          |    40 +
 include/hw/remote/machine.h                        |     4 +
 include/hw/remote/vfio-user-obj.h                  |     6 +
 include/hw/riscv/boot.h                            |     5 +-
 include/hw/riscv/boot_opensbi.h                    |     5 +-
 include/hw/riscv/microchip_pfsoc.h                 |    14 +-
 include/hw/riscv/opentitan.h                       |    33 +-
 include/hw/riscv/shakti_c.h                        |     4 +-
 include/hw/riscv/sifive_e.h                        |     3 +-
 include/hw/riscv/virt.h                            |     9 +-
 include/hw/rtc/goldfish_rtc.h                      |     2 +
 include/hw/rtc/m48t59.h                            |     2 +-
 include/hw/rtc/mc146818rtc.h                       |     4 +-
 include/hw/rtc/sun4v-rtc.h                         |     4 +-
 include/hw/rtc/xlnx-zynqmp-rtc.h                   |     4 +-
 include/hw/rx/rx62n.h                              |     4 +-
 include/hw/s390x/pv.h                              |    19 +
 include/hw/s390x/s390-pci-bus.h                    |     8 +-
 include/hw/s390x/s390-pci-clp.h                    |     4 +-
 include/hw/s390x/s390-pci-kvm.h                    |    38 +
 include/hw/s390x/s390-pci-vfio.h                   |     5 +
 include/hw/s390x/s390-virtio-ccw.h                 |     1 +
 include/hw/scsi/scsi.h                             |    19 +-
 include/hw/sd/allwinner-sdhost.h                   |     1 +
 include/hw/sensor/emc141x_regs.h                   |     4 +-
 include/hw/sensor/isl_pmbus_vr.h                   |     5 +
 include/hw/southbridge/piix.h                      |    12 +-
 include/hw/ssi/aspeed_smc.h                        |     2 +
 include/hw/ssi/ibex_spi_host.h                     |    94 +
 include/hw/ssi/ssi.h                               |     3 +
 include/hw/ssi/xlnx-versal-ospi.h                  |     6 +-
 include/hw/timer/aspeed_timer.h                    |     1 +
 include/hw/timer/bcm2835_systmr.h                  |     4 +-
 include/hw/timer/cadence_ttc.h                     |    54 +
 include/hw/timer/ibex_timer.h                      |     2 +
 include/hw/tricore/tc27x_soc.h                     |     4 +-
 include/hw/tricore/tricore_testdevice.h            |     5 +-
 include/hw/usb.h                                   |   100 +-
 include/hw/usb/dwc2-regs.h                         |  1618 +-
 include/hw/usb/hcd-musb.h                          |     4 +-
 include/hw/usb/msd.h                               |     1 +
 include/hw/usb/xlnx-usb-subsystem.h                |     4 +-
 include/hw/usb/xlnx-versal-usb2-ctrl-regs.h        |     4 +-
 include/hw/vfio/vfio-common.h                      |     2 +-
 include/hw/virtio/vhost-backend.h                  |     3 +
 include/hw/virtio/vhost-user-blk.h                 |     1 -
 include/hw/virtio/vhost-user-fs.h                  |     6 +-
 include/hw/virtio/vhost-user-gpio.h                |    45 +
 include/hw/virtio/vhost-user-i2c.h                 |     6 +-
 include/hw/virtio/vhost-user-rng.h                 |     6 +-
 include/hw/virtio/vhost-user-vsock.h               |     6 +-
 include/hw/virtio/vhost-user.h                     |    61 +-
 include/hw/virtio/vhost-vdpa.h                     |     7 +
 include/hw/virtio/vhost-vsock-common.h             |     8 +-
 include/hw/virtio/vhost.h                          |   179 +-
 include/hw/virtio/virtio-access.h                  |     8 +-
 include/hw/virtio/virtio-blk-common.h              |    20 +
 include/hw/virtio/virtio-blk.h                     |     2 +
 include/hw/virtio/virtio-crypto.h                  |     5 +-
 include/hw/virtio/virtio-gpu-bswap.h               |     2 +-
 include/hw/virtio/virtio-gpu.h                     |     4 +-
 include/hw/virtio/virtio-iommu.h                   |     4 +-
 include/hw/virtio/virtio-net.h                     |     7 +
 include/hw/virtio/virtio-pci.h                     |   260 +
 include/hw/virtio/virtio-scsi.h                    |    45 -
 include/hw/virtio/virtio.h                         |    77 +-
 include/hw/watchdog/wdt_aspeed.h                   |     3 +
 include/hw/watchdog/wdt_imx2.h                     |     6 +-
 include/hw/xen/xen.h                               |     2 +-
 include/hw/xen/xen_common.h                        |     6 -
 include/io/channel-command.h                       |    30 +-
 include/io/channel-null.h                          |    55 +
 include/io/channel-socket.h                        |     2 +
 include/io/channel.h                               |    38 +-
 include/libdecnumber/dconfig.h                     |     2 +-
 include/monitor/hmp.h                              |    12 +-
 include/monitor/monitor.h                          |     4 +
 include/monitor/stats.h                            |    45 +
 include/net/eth.h                                  |     2 +-
 include/net/net.h                                  |    14 +-
 include/net/vhost_net.h                            |     4 +
 include/qapi/qmp/qbool.h                           |     4 +
 include/qapi/qmp/qdict.h                           |     7 +-
 include/qapi/qmp/qerror.h                          |     3 -
 include/qapi/qmp/qlist.h                           |     4 +
 include/qapi/qmp/qnull.h                           |     4 +
 include/qapi/qmp/qnum.h                            |     4 +
 include/qapi/qmp/qstring.h                         |     4 +
 include/qemu-common.h                              |   117 -
 include/qemu-main.h                                |    11 +
 include/qemu/accel.h                               |    13 +
 include/qemu/async-teardown.h                      |    22 +
 include/qemu/atomic.h                              |    24 +-
 include/qemu/bitmap.h                              |     1 +
 include/qemu/bswap.h                               |    64 +-
 include/qemu/compiler.h                            |    26 +-
 include/qemu/config-file.h                         |     1 -
 include/qemu/coroutine.h                           |   100 +-
 include/qemu/cpu-float.h                           |    64 +
 include/qemu/crc-ccitt.h                           |     6 +-
 include/qemu/cutils.h                              |    66 +-
 include/qemu/error-report.h                        |     2 -
 include/qemu/hbitmap.h                             |    15 +-
 include/qemu/help-texts.h                          |    13 +
 include/qemu/host-utils.h                          |    73 +-
 include/qemu/int128.h                              |    61 +-
 include/qemu/iova-tree.h                           |     4 +-
 include/qemu/job.h                                 |   306 +-
 include/qemu/keyval.h                              |    15 +
 include/qemu/log-for-trace.h                       |     2 +-
 include/qemu/log.h                                 |    93 +-
 include/qemu/main-loop.h                           |    42 +-
 include/qemu/mmap-alloc.h                          |     2 -
 include/qemu/module.h                              |    47 +-
 include/qemu/option.h                              |     6 -
 include/qemu/osdep.h                               |   115 +-
 include/qemu/plugin-memory.h                       |     2 +-
 include/qemu/plugin.h                              |    24 +
 include/qemu/qemu-plugin.h                         |     7 +-
 include/qemu/qemu-progress.h                       |     8 +
 include/qemu/selfmap.h                             |     2 +-
 include/qemu/sockets.h                             |    41 +-
 include/qemu/thread-context.h                      |    57 +
 include/qemu/thread-posix.h                        |     9 +-
 include/qemu/thread.h                              |    14 +-
 include/qemu/typedefs.h                            |     5 +
 include/qemu/win_dump_defs.h                       |   115 +-
 include/qom/object.h                               |     1 -
 include/scsi/constants.h                           |     2 +
 include/semihosting/common-semi.h                  |    39 +
 include/semihosting/console.h                      |    66 +-
 include/semihosting/guestfd.h                      |    91 +
 include/semihosting/semihost.h                     |    24 +-
 include/semihosting/softmmu-uaccess.h              |    59 +
 include/semihosting/syscalls.h                     |    75 +
 include/standard-headers/asm-m68k/bootinfo-virt.h  |     3 +
 include/standard-headers/asm-m68k/bootinfo.h       |     8 +-
 include/standard-headers/asm-x86/bootparam.h       |     8 +-
 include/standard-headers/drm/drm_fourcc.h          |    73 +-
 include/standard-headers/linux/ethtool.h           |    29 +-
 include/standard-headers/linux/input-event-codes.h |    25 +-
 include/standard-headers/linux/input.h             |    12 +-
 include/standard-headers/linux/pci_regs.h          |    30 +-
 include/standard-headers/linux/vhost_types.h       |    17 +-
 include/standard-headers/linux/virtio_9p.h         |     2 +-
 include/standard-headers/linux/virtio_config.h     |    13 +-
 include/standard-headers/linux/virtio_crypto.h     |    82 +-
 include/standard-headers/linux/virtio_ids.h        |    14 +-
 include/standard-headers/linux/virtio_net.h        |    34 +-
 include/standard-headers/linux/virtio_pci.h        |     2 +
 include/standard-headers/linux/virtio_ring.h       |    16 +-
 include/sysemu/accel-ops.h                         |     8 +
 include/sysemu/arch_init.h                         |     1 +
 include/sysemu/block-backend-global-state.h        |    10 +-
 include/sysemu/block-backend-io.h                  |    98 +-
 include/sysemu/block-ram-registrar.h               |    37 +
 include/sysemu/cpu-timers.h                        |     1 +
 include/sysemu/cpus.h                              |     3 +
 include/sysemu/cryptodev.h                         |   136 +-
 include/sysemu/device_tree.h                       |    10 +
 include/sysemu/dirtylimit.h                        |    37 +
 include/sysemu/dirtyrate.h                         |    28 +
 include/sysemu/dump-arch.h                         |     3 +
 include/sysemu/dump.h                              |    38 +-
 include/sysemu/event-loop-base.h                   |    41 +
 include/sysemu/hostmem.h                           |     2 +
 include/sysemu/iothread.h                          |     6 +-
 include/sysemu/kvm.h                               |    40 +-
 include/sysemu/kvm_int.h                           |    76 +
 include/sysemu/os-posix.h                          |     5 +-
 include/sysemu/os-win32.h                          |    43 +-
 include/sysemu/replay.h                            |    11 +-
 include/sysemu/reset.h                             |     5 +-
 include/sysemu/runstate.h                          |     9 +-
 include/sysemu/sysemu.h                            |    11 +-
 include/sysemu/tpm.h                               |     6 +
 include/sysemu/watchdog.h                          |    12 -
 include/tcg/tcg-ldst.h                             |     6 +-
 include/tcg/tcg-op.h                               |    11 +
 include/tcg/tcg.h                                  |     8 +-
 include/ui/console.h                               |     7 +-
 include/ui/dbus-display.h                          |     6 +-
 include/ui/dbus-module.h                           |     6 +-
 include/ui/gtk.h                                   |     2 +-
 include/ui/qemu-pixman.h                           |     2 +-
 include/user/safe-syscall.h                        |     2 +-
 include/user/syscall-trace.h                       |     2 +-
 io/channel-buffer.c                                |     1 +
 io/channel-command.c                               |   214 +-
 io/channel-file.c                                  |    14 +-
 io/channel-null.c                                  |   237 +
 io/channel-socket.c                                |   140 +-
 io/channel-tls.c                                   |     1 +
 io/channel-watch.c                                 |    12 +-
 io/channel-websock.c                               |     3 +-
 io/channel.c                                       |    49 +-
 io/meson.build                                     |     1 +
 io/trace-events                                    |     3 +
 iothread.c                                         |    68 +-
 job-qmp.c                                          |    92 +-
 job.c                                              |   674 +-
 libdecnumber/dpd/decimal64.c                       |     3 +-
 linux-headers/asm-arm64/kvm.h                      |    49 +-
 linux-headers/asm-generic/mman-common.h            |     2 +
 linux-headers/asm-generic/unistd.h                 |     4 +-
 linux-headers/asm-mips/mman.h                      |     2 +
 linux-headers/asm-riscv/kvm.h                      |    22 +
 linux-headers/asm-riscv/unistd.h                   |     3 +-
 linux-headers/asm-s390/kvm.h                       |     1 +
 linux-headers/asm-x86/kvm.h                        |    33 +-
 linux-headers/asm-x86/mman.h                       |    14 -
 linux-headers/linux/kvm.h                          |   198 +-
 linux-headers/linux/psci.h                         |     4 +
 linux-headers/linux/userfaultfd.h                  |    16 +-
 linux-headers/linux/vduse.h                        |   353 +
 linux-headers/linux/vfio.h                         |   410 +-
 linux-headers/linux/vfio_zdev.h                    |     7 +
 linux-headers/linux/vhost.h                        |    40 +-
 linux-user/aarch64/cpu_loop.c                      |    14 +-
 linux-user/aarch64/signal.c                        |   245 +-
 linux-user/aarch64/target_cpu.h                    |     5 +-
 linux-user/aarch64/target_mman.h                   |     1 +
 linux-user/aarch64/target_prctl.h                  |    80 +-
 linux-user/aarch64/target_syscall.h                |     2 +-
 linux-user/alpha/cpu_loop.c                        |     1 -
 linux-user/alpha/target_mman.h                     |     8 +
 linux-user/arm/cpu_loop.c                          |     7 +-
 linux-user/arm/nwfpe/double_cpdo.c                 |     4 +-
 linux-user/arm/nwfpe/fpa11_cpdt.c                  |     4 +-
 linux-user/arm/target_cpu.h                        |     4 +-
 linux-user/arm/target_mman.h                       |     1 +
 linux-user/arm/target_syscall.h                    |     2 +-
 linux-user/cpu_loop-common.h                       |    13 +-
 linux-user/cris/cpu_loop.c                         |     1 -
 linux-user/cris/target_mman.h                      |     1 +
 linux-user/elfload.c                               |   321 +-
 linux-user/flatload.c                              |     2 +-
 linux-user/generic/target_mman.h                   |    92 +
 linux-user/hexagon/cpu_loop.c                      |     1 -
 linux-user/hexagon/target_mman.h                   |     1 +
 linux-user/hexagon/target_signal.h                 |     2 +-
 linux-user/hppa/cpu_loop.c                         |    22 +-
 linux-user/hppa/signal.c                           |    57 +-
 linux-user/hppa/target_mman.h                      |    15 +
 linux-user/hppa/target_signal.h                    |    14 +-
 linux-user/hppa/target_syscall.h                   |     2 +
 linux-user/i386/cpu_loop.c                         |     9 +-
 linux-user/i386/signal.c                           |   231 +-
 linux-user/i386/target_elf.h                       |     2 +-
 linux-user/i386/target_mman.h                      |     1 +
 linux-user/include/host/s390/host-signal.h         |    32 +
 linux-user/ioctls.h                                |    24 -
 linux-user/linuxload.c                             |    12 +-
 linux-user/loongarch64/cpu_loop.c                  |    96 +
 linux-user/loongarch64/signal.c                    |   315 +
 linux-user/loongarch64/sockbits.h                  |    11 +
 linux-user/loongarch64/syscall_nr.h                |   312 +
 linux-user/loongarch64/target_cpu.h                |    34 +
 linux-user/loongarch64/target_elf.h                |    12 +
 linux-user/loongarch64/target_errno_defs.h         |    12 +
 linux-user/loongarch64/target_fcntl.h              |    11 +
 linux-user/loongarch64/target_mman.h               |     1 +
 linux-user/loongarch64/target_prctl.h              |     1 +
 linux-user/loongarch64/target_resource.h           |    11 +
 linux-user/loongarch64/target_signal.h             |    13 +
 linux-user/loongarch64/target_structs.h            |    11 +
 linux-user/loongarch64/target_syscall.h            |    48 +
 linux-user/loongarch64/termbits.h                  |    11 +
 linux-user/m68k/cpu_loop.c                         |    19 +-
 linux-user/m68k/target_mman.h                      |     1 +
 linux-user/main.c                                  |    80 +-
 linux-user/microblaze/cpu_loop.c                   |     1 -
 linux-user/microblaze/target_mman.h                |     1 +
 linux-user/mips/cpu_loop.c                         |     1 -
 linux-user/mips/target_mman.h                      |     1 +
 linux-user/mips64/target_mman.h                    |     1 +
 linux-user/mmap.c                                  |   112 +-
 linux-user/nios2/cpu_loop.c                        |    96 +-
 linux-user/nios2/signal.c                          |    25 +-
 linux-user/nios2/target_cpu.h                      |     1 +
 linux-user/nios2/target_mman.h                     |     1 +
 linux-user/openrisc/cpu_loop.c                     |     1 -
 linux-user/openrisc/target_mman.h                  |     1 +
 linux-user/ppc/cpu_loop.c                          |     1 -
 linux-user/ppc/signal.c                            |     5 +-
 linux-user/ppc/target_mman.h                       |     1 +
 linux-user/ppc/target_syscall.h                    |     2 +-
 linux-user/qemu.h                                  |    15 +-
 linux-user/riscv/cpu_loop.c                        |     3 +-
 linux-user/riscv/signal.c                          |     4 +-
 linux-user/riscv/target_mman.h                     |     1 +
 linux-user/s390x/cpu_loop.c                        |     1 -
 linux-user/s390x/signal.c                          |     7 +
 linux-user/s390x/target_mman.h                     |     1 +
 linux-user/semihost.c                              |    48 +-
 linux-user/sh4/cpu_loop.c                          |     1 -
 linux-user/sh4/signal.c                            |     6 +-
 linux-user/sh4/target_mman.h                       |     1 +
 linux-user/signal-common.h                         |    46 +
 linux-user/signal.c                                |    40 +-
 linux-user/sparc/cpu_loop.c                        |     1 -
 linux-user/sparc/target_mman.h                     |     1 +
 linux-user/strace.c                                |   524 +-
 linux-user/strace.h                                |     4 +-
 linux-user/strace.list                             |    40 +-
 linux-user/syscall.c                               |   502 +-
 linux-user/syscall_defs.h                          |    14 +-
 linux-user/uname.c                                 |     7 +-
 linux-user/uname.h                                 |     2 +-
 linux-user/user-internals.h                        |    23 +-
 linux-user/user-mmap.h                             |     1 +
 linux-user/x86_64/target_elf.h                     |     2 +-
 linux-user/x86_64/target_mman.h                    |     1 +
 linux-user/xtensa/signal.c                         |     2 +-
 linux-user/xtensa/target_mman.h                    |     1 +
 linux-user/xtensa/target_structs.h                 |     2 +-
 meson                                              |     2 +-
 meson.build                                        |  1103 +-
 meson_options.txt                                  |    79 +-
 migration/block.c                                  |    24 +-
 migration/channel-block.c                          |   197 +
 migration/channel-block.h                          |    59 +
 migration/channel.c                                |    15 +-
 migration/colo.c                                   |     5 +-
 migration/dirtyrate.c                              |   227 +-
 migration/dirtyrate.h                              |     7 +-
 migration/meson.build                              |     4 +-
 migration/migration.c                              |   296 +-
 migration/migration.h                              |    54 +-
 migration/multifd-zlib.c                           |    38 +-
 migration/multifd.c                                |   119 +-
 migration/multifd.h                                |    70 +-
 migration/postcopy-ram.c                           |   190 +-
 migration/postcopy-ram.h                           |    11 +
 migration/qemu-file-channel.c                      |   194 -
 migration/qemu-file-channel.h                      |    32 -
 migration/qemu-file.c                              |   247 +-
 migration/qemu-file.h                              |   126 +-
 migration/ram.c                                    |   434 +-
 migration/ram.h                                    |     5 +
 migration/rdma.c                                   |   186 +-
 migration/savevm.c                                 |   106 +-
 migration/socket.c                                 |    34 +-
 migration/socket.h                                 |     1 +
 migration/tls.c                                    |    13 +-
 migration/tls.h                                    |     4 +
 migration/trace-events                             |    18 +-
 migration/vmstate-types.c                          |     1 +
 migration/vmstate.c                                |     5 +-
 monitor/hmp-cmds.c                                 |   590 +-
 monitor/hmp.c                                      |    15 +-
 monitor/misc.c                                     |    26 +-
 monitor/monitor-internal.h                         |     1 -
 monitor/monitor.c                                  |    10 +
 monitor/qmp-cmds.c                                 |   182 +-
 nbd/client-connection.c                            |     2 +
 nbd/server.c                                       |    81 +-
 nbd/trace-events                                   |     3 +
 net/announce.c                                     |     2 +-
 net/can/can_socketcan.c                            |    26 +-
 net/clients.h                                      |    17 +
 net/colo-compare.c                                 |     3 +-
 net/colo.c                                         |    26 +-
 net/colo.h                                         |     1 +
 net/dgram.c                                        |   623 +
 net/filter-rewriter.c                              |     2 +-
 net/hub.c                                          |     2 +
 net/l2tpv3.c                                       |     5 +-
 net/meson.build                                    |    22 +-
 net/net.c                                          |   219 +-
 net/slirp.c                                        |    90 +-
 net/socket.c                                       |    47 +-
 net/stream.c                                       |   386 +
 net/tap-bsd.c                                      |     5 +-
 net/tap-linux.c                                    |     3 +-
 net/tap-linux.h                                    |    10 +-
 net/tap-solaris.c                                  |     3 +-
 net/tap-win32.c                                    |     4 +-
 net/tap.c                                          |    63 +-
 net/trace-events                                   |     1 +
 net/util.h                                         |     2 +-
 net/vde.c                                          |     4 +-
 net/vhost-user.c                                   |     3 +-
 net/vhost-vdpa-stub.c                              |    21 +
 net/vhost-vdpa.c                                   |   460 +-
 net/vmnet-bridged.m                                |   152 +
 net/vmnet-common.m                                 |   378 +
 net/vmnet-host.c                                   |   128 +
 net/vmnet-shared.c                                 |   114 +
 net/vmnet_int.h                                    |    63 +
 os-posix.c                                         |    14 +-
 os-win32.c                                         |    10 -
 page-vary-common.c                                 |     1 -
 page-vary.c                                        |     2 +-
 pc-bios/README                                     |     2 +-
 pc-bios/bios-256k.bin                              |   Bin 262144 -> 262144 bytes
 pc-bios/bios-microvm.bin                           |   Bin 131072 -> 131072 bytes
 pc-bios/bios.bin                                   |   Bin 131072 -> 131072 bytes
 pc-bios/hppa-firmware.img                          |   Bin 701964 -> 719368 bytes
 pc-bios/keymaps/meson.build                        |    22 +-
 pc-bios/meson.build                                |     4 +-
 pc-bios/opensbi-riscv32-generic-fw_dynamic.bin     |   Bin 108504 -> 117704 bytes
 pc-bios/opensbi-riscv64-generic-fw_dynamic.bin     |   Bin 105296 -> 115344 bytes
 pc-bios/optionrom/Makefile                         |    70 +-
 pc-bios/optionrom/code16gcc.h                      |     3 -
 pc-bios/qboot.rom                                  |   Bin 65536 -> 65536 bytes
 pc-bios/s390-ccw.img                               |   Bin 50936 -> 42608 bytes
 pc-bios/s390-ccw/Makefile                          |    63 +-
 pc-bios/s390-ccw/bootmap.c                         |    27 +-
 pc-bios/s390-ccw/cio.h                             |     2 +-
 pc-bios/s390-ccw/iplb.h                            |     2 +-
 pc-bios/s390-ccw/main.c                            |    27 +-
 pc-bios/s390-ccw/netboot.mak                       |    28 +-
 pc-bios/s390-ccw/s390-ccw.h                        |     1 +
 pc-bios/s390-ccw/start.S                           |     2 +-
 pc-bios/s390-ccw/virtio-blkdev.c                   |    93 +-
 pc-bios/s390-ccw/virtio-scsi.c                     |    21 +-
 pc-bios/s390-ccw/virtio-scsi.h                     |     2 +-
 pc-bios/s390-ccw/virtio.c                          |    28 +-
 pc-bios/s390-ccw/virtio.h                          |    16 +-
 pc-bios/s390-netboot.img                           |   Bin 79688 -> 67232 bytes
 pc-bios/skiboot.lid                                |   Bin 2528128 -> 2527240 bytes
 pc-bios/slof.bin                                   |   Bin 992384 -> 995176 bytes
 pc-bios/vgabios-ati.bin                            |   Bin 39936 -> 39936 bytes
 pc-bios/vgabios-bochs-display.bin                  |   Bin 28672 -> 28672 bytes
 pc-bios/vgabios-cirrus.bin                         |   Bin 39424 -> 39424 bytes
 pc-bios/vgabios-qxl.bin                            |   Bin 39424 -> 39936 bytes
 pc-bios/vgabios-ramfb.bin                          |   Bin 28672 -> 29184 bytes
 pc-bios/vgabios-stdvga.bin                         |   Bin 39424 -> 39936 bytes
 pc-bios/vgabios-virtio.bin                         |   Bin 39424 -> 39936 bytes
 pc-bios/vgabios-vmware.bin                         |   Bin 39424 -> 39936 bytes
 pc-bios/vgabios.bin                                |   Bin 38912 -> 39424 bytes
 pc-bios/vof/Makefile                               |    28 +-
 plugins/api.c                                      |     2 +
 plugins/core.c                                     |    22 +-
 plugins/meson.build                                |     2 +-
 plugins/plugin.h                                   |     6 +-
 po/LINGUAS                                         |     1 +
 po/uk.po                                           |    75 +
 python/Makefile                                    |     2 +-
 python/README.rst                                  |     2 +-
 python/qemu/aqmp/__init__.py                       |    59 -
 python/qemu/aqmp/aqmp_tui.py                       |   653 -
 python/qemu/aqmp/error.py                          |    50 -
 python/qemu/aqmp/events.py                         |   717 -
 python/qemu/aqmp/legacy.py                         |   177 -
 python/qemu/aqmp/message.py                        |   209 -
 python/qemu/aqmp/models.py                         |   146 -
 python/qemu/aqmp/protocol.py                       |  1048 -
 python/qemu/aqmp/py.typed                          |     0
 python/qemu/aqmp/qmp_client.py                     |   655 -
 python/qemu/aqmp/qmp_shell.py                      |   609 -
 python/qemu/aqmp/util.py                           |   217 -
 python/qemu/machine/machine.py                     |    20 +-
 python/qemu/machine/qtest.py                       |     2 +-
 python/qemu/qmp/README.rst                         |     9 -
 python/qemu/qmp/__init__.py                        |   447 +-
 python/qemu/qmp/error.py                           |    50 +
 python/qemu/qmp/events.py                          |   717 +
 python/qemu/qmp/legacy.py                          |   315 +
 python/qemu/qmp/message.py                         |   209 +
 python/qemu/qmp/models.py                          |   146 +
 python/qemu/qmp/protocol.py                        |  1048 +
 python/qemu/qmp/qmp_client.py                      |   655 +
 python/qemu/qmp/qmp_shell.py                       |   610 +
 python/qemu/qmp/qmp_tui.py                         |   652 +
 python/qemu/qmp/util.py                            |   219 +
 python/qemu/utils/__init__.py                      |     2 +-
 python/qemu/utils/qemu_ga_client.py                |     4 +-
 python/qemu/utils/qom.py                           |     2 +-
 python/qemu/utils/qom_common.py                    |     4 +-
 python/qemu/utils/qom_fuse.py                      |     2 +-
 python/setup.cfg                                   |    12 +-
 python/tests/protocol.py                           |    14 +-
 qapi/audio.json                                    |    26 +-
 qapi/block-core.json                               |   348 +-
 qapi/block-export.json                             |    65 +-
 qapi/block.json                                    |    25 +-
 qapi/char.json                                     |    10 +-
 qapi/common.json                                   |     2 -
 qapi/control.json                                  |    13 +-
 qapi/crypto.json                                   |   128 +-
 qapi/dump.json                                     |     6 +-
 qapi/job.json                                      |     1 -
 qapi/machine-target.json                           |     7 +-
 qapi/machine.json                                  |   130 +-
 qapi/meson.build                                   |    19 +-
 qapi/migration.json                                |   151 +-
 qapi/misc-target.json                              |    17 +-
 qapi/misc.json                                     |    39 +-
 qapi/net.json                                      |   261 +-
 qapi/pragma.json                                   |     3 +-
 qapi/qapi-schema.json                              |     2 +
 qapi/qdev.json                                     |     3 +-
 qapi/qmp-event.c                                   |     9 +-
 qapi/qobject-input-visitor.c                       |     2 +-
 qapi/qom.json                                      |    95 +-
 qapi/replay.json                                   |     1 -
 qapi/run-state.json                                |    38 +-
 qapi/sockets.json                                  |     8 +-
 qapi/stats.json                                    |   251 +
 qapi/ui.json                                       |   191 +-
 qapi/virtio.json                                   |   954 +
 qemu-edid.c                                        |     4 +
 qemu-img.c                                         |   105 +-
 qemu-io-cmds.c                                     |    20 +-
 qemu-io.c                                          |     5 +-
 qemu-nbd.c                                         |    22 +-
 qemu-options.hx                                    |   432 +-
 qga/channel-posix.c                                |    76 +-
 qga/commands-bsd.c                                 |   200 +
 qga/commands-common.h                              |    62 +
 qga/commands-linux.c                               |   286 +
 qga/commands-posix.c                               |  1646 +-
 qga/commands-win32.c                               |    78 +-
 qga/commands.c                                     |    19 +-
 qga/cutils.c                                       |    33 +
 qga/cutils.h                                       |     8 +
 qga/guest-agent-core.h                             |     2 +-
 qga/installer/qemu-ga.wxs                          |    83 +-
 qga/main.c                                         |   117 +-
 qga/meson.build                                    |    26 +-
 qga/qapi-schema.json                               |   231 +-
 qga/vss-win32/meson.build                          |     6 +-
 qga/vss-win32/requester.cpp                        |     4 +-
 qobject/qbool.c                                    |     5 +
 qobject/qdict.c                                    |     5 +
 qobject/qlist.c                                    |     5 +
 qobject/qnull.c                                    |     5 +
 qobject/qnum.c                                     |     5 +
 qobject/qstring.c                                  |     5 +
 qom/object.c                                       |    24 +-
 qom/object_interfaces.c                            |     1 +
 replay/replay-char.c                               |     2 +-
 replay/replay-events.c                             |    56 +-
 replay/replay-internal.h                           |    39 +-
 replay/replay-snapshot.c                           |     2 -
 replay/replay.c                                    |    84 +-
 roms/SLOF                                          |     2 +-
 roms/opensbi                                       |     2 +-
 roms/qboot                                         |     2 +-
 roms/seabios                                       |     2 +-
 roms/seabios-hppa                                  |     2 +-
 roms/skiboot                                       |     2 +-
 scripts/analyze-inclusions                         |     4 -
 scripts/archive-source.sh                          |     2 +-
 scripts/checkpatch.pl                              |    17 +-
 scripts/ci/org.centos/stream/8/x86_64/configure    |     7 +-
 scripts/ci/setup/build-environment.yml             |    29 +-
 scripts/clean-header-guards.pl                     |     4 +-
 scripts/clean-includes                             |     2 +-
 scripts/cocci-macro-file.h                         |     2 +-
 scripts/coverity-scan/COMPONENTS.md                |    15 +-
 scripts/coverity-scan/run-coverity-scan            |     2 +-
 scripts/cpu-x86-uarch-abi.py                       |     2 +-
 scripts/device-crash-test                          |    19 +-
 scripts/feature_to_c.sh                            |     1 +
 scripts/gensyscalls.sh                             |     2 +
 scripts/git-submodule.sh                           |    12 +-
 scripts/hxtool-conv.pl                             |   137 -
 scripts/kvm/vmxcap                                 |    17 +
 scripts/main.c                                     |     1 +
 scripts/meson-buildoptions.py                      |    89 +-
 scripts/meson-buildoptions.sh                      |   134 +-
 scripts/modinfo-generate.py                        |    49 +-
 scripts/mtest2make.py                              |     8 +-
 scripts/nsis.py                                    |    60 +-
 scripts/oss-fuzz/build.sh                          |    16 +-
 scripts/oss-fuzz/output_reproducer.py              |     2 +-
 scripts/qapi/common.py                             |     2 +-
 scripts/qapi/expr.py                               |     4 +-
 scripts/qapi/schema.py                             |     4 +
 scripts/qemu-binfmt-conf.sh                        |     9 +-
 scripts/qemu-stamp.py                              |    24 +
 scripts/qmp/qmp-shell                              |     2 +-
 scripts/qmp/qmp-shell-wrap                         |     2 +-
 scripts/render_block_graph.py                      |     4 +-
 scripts/simplebench/bench_block_job.py             |     5 +-
 scripts/symlink-install-tree.py                    |    33 +
 scripts/update-linux-headers.sh                    |     2 +-
 scripts/vmstate-static-checker.py                  |     3 +-
 scripts/xen-detect.c                               |   203 +
 scsi/pr-manager-helper.c                           |     2 +-
 scsi/qemu-pr-helper.c                              |    10 +-
 semihosting/arm-compat-semi.c                      |  1023 +-
 semihosting/common-semi.h                          |    39 -
 semihosting/config.c                               |    28 +-
 semihosting/console.c                              |   139 +-
 semihosting/guestfd.c                              |   160 +
 semihosting/meson.build                            |     6 +
 semihosting/syscalls.c                             |   978 +
 semihosting/uaccess.c                              |    91 +
 slirp                                              |     1 -
 softmmu/bootdevice.c                               |     3 +-
 softmmu/cpu-throttle.c                             |     1 -
 softmmu/cpu-timers.c                               |     1 -
 softmmu/cpus.c                                     |    31 +-
 softmmu/datadir.c                                  |    31 +-
 softmmu/device_tree.c                              |    58 +
 softmmu/dirtylimit.c                               |   601 +
 softmmu/globals.c                                  |     5 +-
 softmmu/icount.c                                   |    13 +-
 softmmu/main.c                                     |    33 +-
 softmmu/memory.c                                   |    74 +-
 softmmu/meson.build                                |     1 +
 softmmu/physmem.c                                  |    57 +-
 softmmu/qdev-monitor.c                             |     7 +-
 softmmu/qemu-seccomp.c                             |    13 +
 softmmu/qtest.c                                    |    53 +-
 softmmu/runstate.c                                 |    30 +-
 softmmu/trace-events                               |     7 +
 softmmu/vl.c                                       |   573 +-
 storage-daemon/qemu-storage-daemon.c               |    32 +-
 stubs/error-printf.c                               |     1 +
 stubs/get-vm-name.c                                |     2 +-
 stubs/icount.c                                     |     4 +
 stubs/meson.build                                  |     4 +-
 stubs/monitor-core.c                               |     1 -
 stubs/physmem.c                                    |    13 +
 stubs/replay-tools.c                               |     9 +-
 stubs/semihost.c                                   |     8 +-
 stubs/vfio-user-obj.c                              |     6 +
 stubs/xen-hw-stub.c                                |     3 +-
 subprojects/libvduse/include/atomic.h              |     1 +
 subprojects/libvduse/include/compiler.h            |     1 +
 subprojects/libvduse/libvduse.c                    |  1376 ++
 subprojects/libvduse/libvduse.h                    |   247 +
 subprojects/libvduse/linux-headers/linux           |     1 +
 subprojects/libvduse/meson.build                   |    10 +
 subprojects/libvduse/standard-headers/linux        |     1 +
 subprojects/libvfio-user                           |     1 +
 subprojects/libvhost-user/include/compiler.h       |     1 +
 subprojects/libvhost-user/libvhost-user.c          |    58 +-
 subprojects/libvhost-user/libvhost-user.h          |     9 +
 target/Kconfig                                     |     1 +
 target/alpha/cpu-param.h                           |     2 +-
 target/alpha/cpu.c                                 |    18 +
 target/alpha/cpu.h                                 |    11 +-
 target/alpha/helper.c                              |    12 +-
 target/alpha/mem_helper.c                          |     2 +-
 target/alpha/translate.c                           |    20 +-
 target/arm/a32.decode                              |    16 +-
 target/arm/arch_dump.c                             |     8 +-
 target/arm/common-semi-target.h                    |    62 +
 target/arm/cpregs.h                                |   496 +
 target/arm/cpu-param.h                             |    19 +-
 target/arm/cpu.c                                   |   307 +-
 target/arm/cpu.h                                   |  1228 +-
 target/arm/cpu64.c                                 |  1090 +-
 target/arm/cpu_tcg.c                               |   253 +-
 target/arm/crypto_helper.c                         |    38 +-
 target/arm/debug_helper.c                          |   810 +-
 target/arm/gdbstub.c                               |     7 +-
 target/arm/gdbstub64.c                             |     2 +-
 target/arm/helper-a64.c                            |     4 +-
 target/arm/helper-sme.h                            |   147 +
 target/arm/helper-sve.h                            |     4 +
 target/arm/helper.c                                |  5586 ++---
 target/arm/helper.h                                |    28 +-
 target/arm/hvf/hvf.c                               |    10 +-
 target/arm/internals.h                             |   392 +-
 target/arm/kvm-stub.c                              |     4 +-
 target/arm/kvm.c                                   |    15 +-
 target/arm/kvm64.c                                 |   119 +-
 target/arm/kvm_arm.h                               |     7 +-
 target/arm/m_helper.c                              |    91 +-
 target/arm/machine.c                               |    38 +-
 target/arm/meson.build                             |     5 +
 target/arm/mte_helper.c                            |    69 +-
 target/arm/mve_helper.c                            |     6 +-
 target/arm/neon_helper.c                           |     2 +-
 target/arm/op_helper.c                             |   170 +-
 target/arm/pauth_helper.c                          |     4 +-
 target/arm/ptw.c                                   |  2895 +++
 target/arm/sme-fa64.decode                         |    60 +
 target/arm/sme.decode                              |    88 +
 target/arm/sme_helper.c                            |  1201 +
 target/arm/sve.decode                              |    98 +-
 target/arm/sve_helper.c                            |   325 +-
 target/arm/sve_ldst_internal.h                     |   222 +
 target/arm/syndrome.h                              |    26 +-
 target/arm/t32.decode                              |    18 +-
 target/arm/tlb_helper.c                            |    80 +-
 target/arm/translate-a32.h                         |    19 +-
 target/arm/translate-a64.c                         |   818 +-
 target/arm/translate-a64.h                         |    96 +-
 target/arm/translate-m-nocp.c                      |    29 +-
 target/arm/translate-mve.c                         |     3 +-
 target/arm/translate-neon.c                        |    29 +-
 target/arm/translate-sme.c                         |   373 +
 target/arm/translate-sve.c                         |  6006 ++---
 target/arm/translate-vfp.c                         |   110 +-
 target/arm/translate.c                             |   768 +-
 target/arm/translate.h                             |   151 +-
 target/arm/vec_helper.c                            |    52 +-
 target/arm/vec_internal.h                          |    36 +-
 target/avr/cpu-qom.h                               |     6 +-
 target/avr/cpu.c                                   |    22 +-
 target/avr/cpu.h                                   |     4 +-
 target/avr/helper.c                                |    75 +-
 target/avr/translate.c                             |    44 +-
 target/cris/cpu-param.h                            |     2 +-
 target/cris/cpu.c                                  |    19 +
 target/cris/helper.c                               |     2 +-
 target/cris/translate.c                            |    18 +-
 target/hexagon/attribs.h                           |     2 +-
 target/hexagon/attribs_def.h.inc                   |    38 +-
 target/hexagon/cpu.c                               |    19 +-
 target/hexagon/decode.c                            |    13 +-
 target/hexagon/gdbstub.c                           |     1 -
 target/hexagon/gen_tcg.h                           |    10 +-
 target/hexagon/gen_tcg_funcs.py                    |    11 +-
 target/hexagon/genptr.c                            |    43 +-
 target/hexagon/helper.h                            |     1 +
 target/hexagon/hex_arch_types.h                    |     4 +-
 target/hexagon/hex_common.py                       |     3 +-
 target/hexagon/hex_regs.h                          |     4 +-
 target/hexagon/imported/encode_pp.def              |    23 -
 target/hexagon/imported/ldst.idef                  |   122 +-
 target/hexagon/imported/subinsns.idef              |    72 +-
 target/hexagon/macros.h                            |    45 +-
 target/hexagon/op_helper.c                         |    32 +-
 target/hexagon/translate.c                         |    54 +-
 target/hppa/cpu-param.h                            |     2 +-
 target/hppa/cpu.c                                  |    39 +-
 target/hppa/cpu.h                                  |     3 +-
 target/hppa/helper.c                               |     6 +-
 target/hppa/op_helper.c                            |     6 +-
 target/hppa/translate.c                            |    35 +-
 target/i386/arch_dump.c                            |    30 +-
 target/i386/cpu-param.h                            |     8 +-
 target/i386/cpu-sysemu.c                           |     2 +-
 target/i386/cpu.c                                  |   455 +-
 target/i386/cpu.h                                  |   165 +-
 target/i386/gdbstub.c                              |     4 +-
 target/i386/hax/hax-accel-ops.h                    |     6 +-
 target/i386/hax/hax-all.c                          |     1 -
 target/i386/hax/hax-mem.c                          |    10 +-
 target/i386/helper.c                               |    39 +-
 target/i386/helper.h                               |    10 +-
 target/i386/hvf/hvf.c                              |    27 +-
 target/i386/hvf/vmcs.h                             |     5 +-
 target/i386/hvf/vmx.h                              |     2 +-
 target/i386/hvf/x86.c                              |     1 -
 target/i386/hvf/x86_cpuid.c                        |     8 +-
 target/i386/hvf/x86_decode.c                       |     1 -
 target/i386/hvf/x86_descr.c                        |     1 -
 target/i386/hvf/x86_emu.c                          |     1 -
 target/i386/hvf/x86_flags.c                        |     1 -
 target/i386/hvf/x86_mmu.c                          |     1 -
 target/i386/hvf/x86_task.c                         |     1 -
 target/i386/hvf/x86hvf.c                           |     1 -
 target/i386/kvm/hyperv-proto.h                     |    46 +-
 target/i386/kvm/hyperv-stub.c                      |     6 +
 target/i386/kvm/hyperv.c                           |    56 +-
 target/i386/kvm/kvm-cpu.c                          |     2 +-
 target/i386/kvm/kvm-stub.c                         |     5 +
 target/i386/kvm/kvm.c                              |   601 +-
 target/i386/kvm/kvm_i386.h                         |    14 +
 target/i386/kvm/sev-stub.c                         |     1 -
 target/i386/machine.c                              |    58 +
 target/i386/nvmm/nvmm-accel-ops.h                  |     6 +-
 target/i386/nvmm/nvmm-all.c                        |     9 +-
 target/i386/ops_sse.h                              |  2444 +-
 target/i386/ops_sse_header.h                       |   410 +-
 target/i386/sev.c                                  |    42 +-
 target/i386/sev.h                                  |     4 +-
 target/i386/tcg/bpt_helper.c                       |     2 +-
 target/i386/tcg/cc_helper.c                        |    41 -
 target/i386/tcg/decode-new.c.inc                   |  1844 ++
 target/i386/tcg/decode-new.h                       |   252 +
 target/i386/tcg/emit.c.inc                         |  2300 ++
 target/i386/tcg/excp_helper.c                      |    44 +-
 target/i386/tcg/fpu_helper.c                       |   216 +-
 target/i386/tcg/helper-tcg.h                       |    52 +-
 target/i386/tcg/misc_helper.c                      |     6 +-
 target/i386/tcg/seg_helper.c                       |     6 +-
 target/i386/tcg/sysemu/excp_helper.c               |   720 +-
 target/i386/tcg/sysemu/misc_helper.c               |    12 +-
 target/i386/tcg/sysemu/svm_helper.c                |   236 +-
 target/i386/tcg/tcg-cpu.c                          |    25 +-
 target/i386/tcg/translate.c                        |  3087 +--
 target/i386/tcg/user/excp_helper.c                 |     7 +
 target/i386/whpx/whpx-accel-ops.c                  |     1 +
 target/i386/whpx/whpx-accel-ops.h                  |     7 +-
 target/i386/whpx/whpx-all.c                        |   876 +-
 target/i386/whpx/whpx-apic.c                       |     1 -
 target/i386/whpx/whpx-internal.h                   |    39 +-
 target/loongarch/Kconfig                           |     2 +
 target/loongarch/README                            |    52 +
 target/loongarch/constant_timer.c                  |    64 +
 target/loongarch/cpu-csr.h                         |   208 +
 target/loongarch/cpu-param.h                       |    18 +
 target/loongarch/cpu.c                             |   774 +
 target/loongarch/cpu.h                             |   423 +
 target/loongarch/csr_helper.c                      |    89 +
 target/loongarch/disas.c                           |   757 +
 target/loongarch/fpu_helper.c                      |   879 +
 target/loongarch/gdbstub.c                         |   104 +
 target/loongarch/helper.h                          |   132 +
 target/loongarch/insn_trans/trans_arith.c.inc      |   304 +
 target/loongarch/insn_trans/trans_atomic.c.inc     |   113 +
 target/loongarch/insn_trans/trans_bit.c.inc        |   220 +
 target/loongarch/insn_trans/trans_branch.c.inc     |    83 +
 target/loongarch/insn_trans/trans_extra.c.inc      |   101 +
 target/loongarch/insn_trans/trans_farith.c.inc     |   135 +
 target/loongarch/insn_trans/trans_fcmp.c.inc       |    63 +
 target/loongarch/insn_trans/trans_fcnv.c.inc       |    33 +
 target/loongarch/insn_trans/trans_fmemory.c.inc    |   175 +
 target/loongarch/insn_trans/trans_fmov.c.inc       |   181 +
 target/loongarch/insn_trans/trans_memory.c.inc     |   229 +
 target/loongarch/insn_trans/trans_privileged.c.inc |   502 +
 target/loongarch/insn_trans/trans_shift.c.inc      |   106 +
 target/loongarch/insns.decode                      |   486 +
 target/loongarch/internals.h                       |    61 +
 target/loongarch/iocsr_helper.c                    |    70 +
 target/loongarch/machine.c                         |   102 +
 target/loongarch/meson.build                       |    30 +
 target/loongarch/op_helper.c                       |   139 +
 target/loongarch/tlb_helper.c                      |   764 +
 target/loongarch/translate.c                       |   279 +
 target/loongarch/translate.h                       |    46 +
 target/m68k/cpu-param.h                            |     2 +-
 target/m68k/cpu.c                                  |    40 +-
 target/m68k/cpu.h                                  |    22 +-
 target/m68k/helper.c                               |     2 +-
 target/m68k/helper.h                               |    14 +-
 target/m68k/m68k-semi.c                            |   407 +-
 target/m68k/meson.build                            |     6 +-
 target/m68k/op_helper.c                            |   180 +-
 target/m68k/qregs.def                              |    10 -
 target/m68k/qregs.h.inc                            |    10 +
 target/m68k/translate.c                            |   410 +-
 target/meson.build                                 |     1 +
 target/microblaze/cpu-param.h                      |     2 +-
 target/microblaze/cpu.c                            |    21 +-
 target/microblaze/cpu.h                            |     8 +-
 target/microblaze/helper.c                         |     2 +-
 target/microblaze/translate.c                      |    19 +-
 target/mips/TODO                                   |    51 -
 target/mips/cpu-defs.c.inc                         |    28 +
 target/mips/cpu-param.h                            |     2 +-
 target/mips/cpu.c                                  |    21 +-
 target/mips/cpu.h                                  |     8 +-
 target/mips/kvm.c                                  |     5 +-
 target/mips/mips-defs.h                            |     1 +
 target/mips/tcg/exception.c                        |     3 +-
 target/mips/tcg/lmmi_helper.c                      |     2 +-
 target/mips/tcg/meson.build                        |     2 +
 target/mips/tcg/micromips_translate.c.inc          |    12 +-
 target/mips/tcg/mips16e_translate.c.inc            |     4 +-
 target/mips/tcg/msa_helper.c                       |    66 +-
 target/mips/tcg/msa_translate.c                    |    29 +-
 target/mips/tcg/nanomips_translate.c.inc           |    41 +-
 target/mips/tcg/octeon.decode                      |    41 +
 target/mips/tcg/octeon_translate.c                 |   201 +
 target/mips/tcg/sysemu/cp0_helper.c                |     3 +-
 target/mips/tcg/sysemu/mips-semi.c                 |   457 +-
 target/mips/tcg/sysemu/special_helper.c            |     2 +-
 target/mips/tcg/sysemu/tlb_helper.c                |     5 +
 target/mips/tcg/sysemu_helper.h.inc                |     2 -
 target/mips/tcg/tcg-internal.h                     |    22 +-
 target/mips/tcg/translate.c                        |    71 +-
 target/mips/tcg/translate.h                        |     5 +
 target/nios2/cpu-param.h                           |     2 +-
 target/nios2/cpu.c                                 |   234 +-
 target/nios2/cpu.h                                 |   258 +-
 target/nios2/helper.c                              |   363 +-
 target/nios2/helper.h                              |     5 +
 target/nios2/meson.build                           |     9 +-
 target/nios2/mmu.c                                 |    78 +-
 target/nios2/nios2-semi.c                          |   397 +-
 target/nios2/op_helper.c                           |    88 +
 target/nios2/translate.c                           |   770 +-
 target/openrisc/cpu-param.h                        |     2 +-
 target/openrisc/cpu.c                              |    33 +-
 target/openrisc/cpu.h                              |     3 +
 target/openrisc/exception.c                        |     2 +-
 target/openrisc/exception.h                        |     2 +-
 target/openrisc/exception_helper.c                 |     3 +-
 target/openrisc/interrupt.c                        |     4 +-
 target/openrisc/mmu.c                              |     8 +-
 target/openrisc/sys_helper.c                       |    31 +-
 target/openrisc/translate.c                        |    23 +-
 target/ppc/arch_dump.c                             |    20 +-
 target/ppc/cpu-models.c                            |    17 +-
 target/ppc/cpu-models.h                            |    14 +-
 target/ppc/cpu-param.h                             |     2 +-
 target/ppc/cpu-qom.h                               |     6 +-
 target/ppc/cpu.c                                   |     8 +-
 target/ppc/cpu.h                                   |   409 +-
 target/ppc/cpu_init.c                              |   382 +-
 target/ppc/dfp_helper.c                            |    96 +-
 target/ppc/excp_helper.c                           |  1011 +-
 target/ppc/fpu_helper.c                            |   839 +-
 target/ppc/gdbstub.c                               |     6 +-
 target/ppc/helper.h                                |   310 +-
 target/ppc/helper_regs.c                           |    25 +-
 target/ppc/insn32.decode                           |   291 +-
 target/ppc/insn64.decode                           |    79 +
 target/ppc/int_helper.c                            |   624 +-
 target/ppc/internal.h                              |    27 +-
 target/ppc/kvm.c                                   |    35 +-
 target/ppc/machine.c                               |     7 +-
 target/ppc/mem_helper.c                            |    27 +-
 target/ppc/misc_helper.c                           |    13 +-
 target/ppc/mmu-book3s-v3.c                         |     5 +
 target/ppc/mmu-book3s-v3.h                         |    15 +
 target/ppc/mmu-hash64.c                            |    41 +-
 target/ppc/mmu-radix64.c                           |   120 +-
 target/ppc/mmu_common.c                            |    40 +-
 target/ppc/mmu_helper.c                            |   160 +-
 target/ppc/monitor.c                               |     9 +
 target/ppc/power8-pmu-regs.c.inc                   |    10 +-
 target/ppc/power8-pmu.c                            |    74 +-
 target/ppc/power8-pmu.h                            |     7 +-
 target/ppc/timebase_helper.c                       |     6 +-
 target/ppc/trace-events                            |     2 +-
 target/ppc/translate.c                             |   775 +-
 target/ppc/translate/fixedpoint-impl.c.inc         |    92 +-
 target/ppc/translate/fp-impl.c.inc                 |   279 +-
 target/ppc/translate/fp-ops.c.inc                  |    12 -
 target/ppc/translate/processor-ctrl-impl.c.inc     |   105 +
 target/ppc/translate/storage-ctrl-impl.c.inc       |   250 +
 target/ppc/translate/vmx-impl.c.inc                |   585 +-
 target/ppc/translate/vmx-ops.c.inc                 |    28 +-
 target/ppc/translate/vsx-impl.c.inc                |   637 +-
 target/ppc/translate/vsx-ops.c.inc                 |    25 -
 target/riscv/arch_dump.c                           |     6 +-
 target/riscv/bitmanip_helper.c                     |    80 +
 target/riscv/common-semi-target.h                  |    50 +
 target/riscv/cpu-param.h                           |     2 +-
 target/riscv/cpu.c                                 |   444 +-
 target/riscv/cpu.h                                 |   164 +-
 target/riscv/cpu_bits.h                            |   145 +-
 target/riscv/cpu_helper.c                          |   454 +-
 target/riscv/crypto_helper.c                       |   302 +
 target/riscv/csr.c                                 |  1840 +-
 target/riscv/debug.c                               |   731 +
 target/riscv/debug.h                               |   137 +
 target/riscv/gdbstub.c                             |    36 +-
 target/riscv/helper.h                              |    42 +-
 target/riscv/insn16.decode                         |     7 +-
 target/riscv/insn32.decode                         |   110 +-
 target/riscv/insn_trans/trans_privileged.c.inc     |     7 +-
 target/riscv/insn_trans/trans_rvb.c.inc            |   116 +-
 target/riscv/insn_trans/trans_rvh.c.inc            |     2 +
 target/riscv/insn_trans/trans_rvi.c.inc            |    26 +-
 target/riscv/insn_trans/trans_rvk.c.inc            |   391 +
 target/riscv/insn_trans/trans_rvm.c.inc            |    18 +-
 target/riscv/insn_trans/trans_rvv.c.inc            |   227 +-
 target/riscv/instmap.h                             |    45 +
 target/riscv/internals.h                           |     7 +-
 target/riscv/kvm.c                                 |     5 +-
 target/riscv/machine.c                             |    80 +-
 target/riscv/meson.build                           |    10 +-
 target/riscv/monitor.c                             |    11 +-
 target/riscv/op_helper.c                           |    13 +-
 target/riscv/pmp.c                                 |    29 +-
 target/riscv/pmp.h                                 |     8 +-
 target/riscv/pmu.c                                 |   453 +
 target/riscv/pmu.h                                 |    36 +
 target/riscv/sbi_ecall_interface.h                 |     4 +-
 target/riscv/time_helper.c                         |   114 +
 target/riscv/time_helper.h                         |    30 +
 target/riscv/translate.c                           |   105 +-
 target/riscv/vector_helper.c                       |  1822 +-
 target/rx/cpu.c                                    |    21 +-
 target/rx/cpu.h                                    |     2 +
 target/rx/gdbstub.c                                |     1 -
 target/rx/op_helper.c                              |    27 +-
 target/rx/translate.c                              |    87 +-
 target/s390x/arch_dump.c                           |   270 +-
 target/s390x/cpu-param.h                           |     2 +-
 target/s390x/cpu.c                                 |    10 +-
 target/s390x/cpu.h                                 |     1 +
 target/s390x/cpu_features_def.h.inc                |     3 +-
 target/s390x/cpu_models.c                          |    49 +-
 target/s390x/cpu_models.h                          |     4 +-
 target/s390x/cpu_models_sysemu.c                   |     1 -
 target/s390x/gen-features.c                        |    28 +-
 target/s390x/helper.c                              |     1 -
 target/s390x/helper.h                              |    13 +
 target/s390x/ioinst.c                              |     4 +-
 target/s390x/kvm/kvm.c                             |    30 +-
 target/s390x/kvm/kvm_s390x.h                       |     2 +
 target/s390x/kvm/meson.build                       |     2 +
 target/s390x/kvm/stubs.c                           |    12 +
 target/s390x/s390x-internal.h                      |    12 +-
 target/s390x/tcg/cc_helper.c                       |     7 +
 target/s390x/tcg/crypto_helper.c                   |   259 +
 target/s390x/tcg/excp_helper.c                     |    26 +-
 target/s390x/tcg/fpu_helper.c                      |     2 +-
 target/s390x/tcg/insn-data.def                     |  1422 --
 target/s390x/tcg/insn-data.h.inc                   |  1448 ++
 target/s390x/tcg/insn-format.def                   |    81 -
 target/s390x/tcg/insn-format.h.inc                 |    81 +
 target/s390x/tcg/mem_helper.c                      |     4 -
 target/s390x/tcg/misc_helper.c                     |     9 +-
 target/s390x/tcg/tcg_s390x.h                       |    12 +-
 target/s390x/tcg/translate.c                       |   115 +-
 target/s390x/tcg/translate_vx.c.inc                |   471 +-
 target/s390x/tcg/vec.h                             |     2 +-
 target/s390x/tcg/vec_fpu_helper.c                  |    36 +-
 target/s390x/tcg/vec_helper.c                      |     2 -
 target/s390x/tcg/vec_int_helper.c                  |    56 +-
 target/s390x/tcg/vec_string_helper.c               |   100 +-
 target/sh4/cpu-param.h                             |     2 +-
 target/sh4/cpu.c                                   |    34 +-
 target/sh4/cpu.h                                   |    65 +-
 target/sh4/helper.c                                |     6 +-
 target/sh4/op_helper.c                             |     5 +-
 target/sh4/translate.c                             |   112 +-
 target/sparc/cpu-param.h                           |     2 +-
 target/sparc/cpu.c                                 |    11 +-
 target/sparc/cpu.h                                 |    14 +-
 target/sparc/mmu_helper.c                          |     8 +-
 target/sparc/translate.c                           |    19 +-
 target/sparc/vis_helper.c                          |     4 +-
 target/tricore/cpu-param.h                         |     2 +-
 target/tricore/cpu.c                               |    22 +-
 target/tricore/cpu.h                               |     1 +
 target/tricore/csfr.def                            |   125 -
 target/tricore/csfr.h.inc                          |   125 +
 target/tricore/gdbstub.c                           |     1 -
 target/tricore/op_helper.c                         |     8 +-
 target/tricore/translate.c                         |    23 +-
 target/xtensa/core-de233_fpu.c                     |     1 -
 target/xtensa/core-de233_fpu/core-isa.h            |     7 +-
 target/xtensa/core-de233_fpu/core-matmap.h         |     4 +-
 target/xtensa/core-dsp3400.c                       |     1 -
 target/xtensa/core-dsp3400/core-isa.h              |     8 +-
 target/xtensa/core-dsp3400/core-matmap.h           |     4 +-
 target/xtensa/core-lx106.c                         |    51 +
 target/xtensa/core-lx106/core-isa.h                |   470 +
 target/xtensa/core-lx106/gdb-config.c.inc          |    83 +
 target/xtensa/core-lx106/xtensa-modules.c.inc      |  7668 +++++++
 target/xtensa/core-test_mmuhifi_c3.c               |     1 -
 target/xtensa/cores.list                           |     1 +
 target/xtensa/cpu-param.h                          |     2 +-
 target/xtensa/cpu.c                                |    33 +
 target/xtensa/cpu.h                                |    16 +-
 target/xtensa/helper.c                             |     6 +-
 target/xtensa/import_core.sh                       |     1 -
 target/xtensa/op_helper.c                          |     7 +-
 target/xtensa/overlay_tool.h                       |     2 +-
 target/xtensa/translate.c                          |   243 +-
 tcg/aarch64/tcg-target.c.inc                       |    37 +-
 tcg/arm/tcg-target.c.inc                           |     4 +-
 tcg/i386/tcg-target.c.inc                          |     4 +-
 tcg/loongarch64/tcg-target.c.inc                   |    48 +-
 tcg/loongarch64/tcg-target.h                       |     9 +-
 tcg/mips/tcg-target.c.inc                          |     2 +-
 tcg/ppc/tcg-target.c.inc                           |   161 +-
 tcg/ppc/tcg-target.h                               |     4 +-
 tcg/region.c                                       |    10 +-
 tcg/riscv/tcg-target.c.inc                         |     4 +-
 tcg/sparc/tcg-target-con-set.h                     |    32 -
 tcg/sparc/tcg-target-con-str.h                     |    23 -
 tcg/sparc/tcg-target.c.inc                         |  2069 --
 tcg/sparc/tcg-target.h                             |   172 -
 tcg/sparc64/tcg-target-con-set.h                   |    22 +
 tcg/sparc64/tcg-target-con-str.h                   |    20 +
 tcg/sparc64/tcg-target.c.inc                       |  1938 ++
 tcg/sparc64/tcg-target.h                           |   161 +
 tcg/tcg-internal.h                                 |     2 +-
 tcg/tcg-op.c                                       |    34 +-
 tcg/tcg.c                                          |   341 +-
 tcg/tci.c                                          |     1 -
 tcg/tci/tcg-target.c.inc                           |     7 -
 tcg/tci/tcg-target.h                               |     5 -
 tests/Makefile.include                             |   117 +-
 tests/avocado/acpi-bits.py                         |   398 +
 tests/avocado/acpi-bits/bits-config/bits-cfg.txt   |    18 +
 tests/avocado/acpi-bits/bits-tests/smbios.py2      |  2430 ++
 tests/avocado/acpi-bits/bits-tests/testacpi.py2    |   283 +
 tests/avocado/acpi-bits/bits-tests/testcpuid.py2   |    83 +
 tests/avocado/avocado_qemu/__init__.py             |    48 +-
 tests/avocado/boot_linux.py                        |    15 +-
 tests/avocado/boot_linux_console.py                |    93 +-
 tests/avocado/info_usernet.py                      |     4 +
 tests/avocado/machine_aarch64_virt.py              |    95 +
 tests/avocado/machine_arm_canona1100.py            |     4 +-
 tests/avocado/machine_aspeed.py                    |   272 +
 tests/avocado/machine_microblaze.py                |     4 +-
 tests/avocado/machine_s390_ccw_virtio.py           |     1 +
 tests/avocado/machine_sparc64_sun4u.py             |     4 +-
 tests/avocado/migration.py                         |     4 +-
 tests/avocado/ppc_bamboo.py                        |     1 +
 tests/avocado/ppc_mpc8544ds.py                     |     6 +-
 tests/avocado/ppc_virtex_ml507.py                  |     6 +-
 tests/avocado/replay_kernel.py                     |    40 +-
 tests/avocado/replay_linux.py                      |    87 +-
 tests/avocado/virtio_check_params.py               |     1 -
 tests/avocado/virtio_version.py                    |     1 -
 tests/avocado/vnc.py                               |    64 +
 tests/bench/benchmark-crypto-akcipher.c            |   137 +
 tests/bench/meson.build                            |     1 +
 tests/bench/test_akcipher_keys.inc                 |   537 +
 tests/check-block.sh                               |    26 -
 tests/data/acpi/pc/DSDT                            |   Bin 6002 -> 6458 bytes
 tests/data/acpi/pc/DSDT.acpierst                   |   Bin 5969 -> 6418 bytes
 tests/data/acpi/pc/DSDT.acpihmat                   |   Bin 7327 -> 7783 bytes
 tests/data/acpi/pc/DSDT.bridge                     |   Bin 8668 -> 9532 bytes
 tests/data/acpi/pc/DSDT.cphp                       |   Bin 6466 -> 6922 bytes
 tests/data/acpi/pc/DSDT.dimmpxm                    |   Bin 7656 -> 8112 bytes
 tests/data/acpi/pc/DSDT.hpbridge                   |   Bin 5969 -> 6418 bytes
 tests/data/acpi/pc/DSDT.hpbrroot                   |   Bin 3084 -> 3064 bytes
 tests/data/acpi/pc/DSDT.ipmikcs                    |   Bin 6074 -> 6530 bytes
 tests/data/acpi/pc/DSDT.memhp                      |   Bin 7361 -> 7817 bytes
 tests/data/acpi/pc/DSDT.nohpet                     |   Bin 5860 -> 6316 bytes
 tests/data/acpi/pc/DSDT.numamem                    |   Bin 6008 -> 6464 bytes
 tests/data/acpi/pc/DSDT.roothp                     |   Bin 6210 -> 6656 bytes
 tests/data/acpi/pc/SSDT.dimmpxm                    |   Bin 734 -> 1815 bytes
 tests/data/acpi/q35/APIC.acpihmat-noinitiator      |   Bin 0 -> 144 bytes
 tests/data/acpi/q35/APIC.core-count2               |   Bin 0 -> 2478 bytes
 tests/data/acpi/q35/CEDT.cxl                       |   Bin 0 -> 184 bytes
 tests/data/acpi/q35/DSDT                           |   Bin 8289 -> 8310 bytes
 tests/data/acpi/q35/DSDT.acpierst                  |   Bin 8306 -> 8327 bytes
 tests/data/acpi/q35/DSDT.acpihmat                  |   Bin 9614 -> 9635 bytes
 tests/data/acpi/q35/DSDT.acpihmat-noinitiator      |   Bin 0 -> 8589 bytes
 tests/data/acpi/q35/DSDT.applesmc                  |   Bin 0 -> 8356 bytes
 tests/data/acpi/q35/DSDT.bridge                    |   Bin 11003 -> 11439 bytes
 tests/data/acpi/q35/DSDT.core-count2               |   Bin 0 -> 32450 bytes
 tests/data/acpi/q35/DSDT.cphp                      |   Bin 8753 -> 8774 bytes
 tests/data/acpi/q35/DSDT.cxl                       |   Bin 0 -> 9636 bytes
 tests/data/acpi/q35/DSDT.dimmpxm                   |   Bin 9943 -> 9964 bytes
 tests/data/acpi/q35/DSDT.ipmibt                    |   Bin 8364 -> 8385 bytes
 tests/data/acpi/q35/DSDT.ipmismbus                 |   Bin 0 -> 8398 bytes
 tests/data/acpi/q35/DSDT.ivrs                      |   Bin 8306 -> 8327 bytes
 tests/data/acpi/q35/DSDT.memhp                     |   Bin 9648 -> 9669 bytes
 tests/data/acpi/q35/DSDT.mmio64                    |   Bin 9419 -> 9440 bytes
 tests/data/acpi/q35/DSDT.multi-bridge              |   Bin 8583 -> 8630 bytes
 tests/data/acpi/q35/DSDT.nohpet                    |   Bin 8147 -> 8168 bytes
 tests/data/acpi/q35/DSDT.numamem                   |   Bin 8295 -> 8316 bytes
 tests/data/acpi/q35/DSDT.pvpanic-isa               |   Bin 0 -> 8411 bytes
 tests/data/acpi/q35/DSDT.tis.tpm12                 |   Bin 8900 -> 8916 bytes
 tests/data/acpi/q35/DSDT.tis.tpm2                  |   Bin 8921 -> 8942 bytes
 tests/data/acpi/q35/DSDT.viot                      |   Bin 9398 -> 9419 bytes
 tests/data/acpi/q35/DSDT.xapic                     |   Bin 35652 -> 35673 bytes
 tests/data/acpi/q35/FACP.core-count2               |   Bin 0 -> 244 bytes
 tests/data/acpi/q35/HMAT.acpihmat-noinitiator      |   Bin 0 -> 288 bytes
 tests/data/acpi/q35/SRAT.acpihmat-noinitiator      |   Bin 0 -> 312 bytes
 tests/data/acpi/q35/SSDT.dimmpxm                   |   Bin 734 -> 1815 bytes
 tests/data/acpi/q35/VIOT.viot                      |   Bin 112 -> 112 bytes
 tests/data/acpi/virt/APIC                          |   Bin 168 -> 172 bytes
 tests/data/acpi/virt/APIC.acpihmatvirt             |   Bin 0 -> 412 bytes
 tests/data/acpi/virt/APIC.memhp                    |   Bin 168 -> 172 bytes
 tests/data/acpi/virt/APIC.numamem                  |   Bin 168 -> 172 bytes
 tests/data/acpi/virt/DSDT.acpihmatvirt             |   Bin 0 -> 5282 bytes
 tests/data/acpi/virt/FACP                          |   Bin 268 -> 276 bytes
 tests/data/acpi/virt/FACP.memhp                    |   Bin 268 -> 276 bytes
 tests/data/acpi/virt/FACP.numamem                  |   Bin 268 -> 276 bytes
 tests/data/acpi/virt/GTDT                          |   Bin 96 -> 96 bytes
 tests/data/acpi/virt/GTDT.memhp                    |   Bin 96 -> 96 bytes
 tests/data/acpi/virt/GTDT.numamem                  |   Bin 96 -> 96 bytes
 tests/data/acpi/virt/HMAT.acpihmatvirt             |   Bin 0 -> 288 bytes
 tests/data/acpi/virt/PPTT.acpihmatvirt             |   Bin 0 -> 196 bytes
 tests/data/acpi/virt/SRAT.acpihmatvirt             |   Bin 0 -> 240 bytes
 tests/data/acpi/virt/SSDT.memhp                    |   Bin 736 -> 1817 bytes
 tests/data/test-qga-config                         |     2 +-
 tests/docker/Makefile.include                      |   150 +-
 tests/docker/common.rc                             |     6 +-
 tests/docker/docker.py                             |    95 +-
 tests/docker/dockerfiles/alpine.docker             |    14 +-
 tests/docker/dockerfiles/centos8.docker            |    11 +-
 .../dockerfiles/debian-all-test-cross.docker       |    20 +-
 tests/docker/dockerfiles/debian-alpha-cross.docker |    12 +-
 tests/docker/dockerfiles/debian-amd64-cross.docker |   182 +-
 tests/docker/dockerfiles/debian-amd64.docker       |   199 +-
 tests/docker/dockerfiles/debian-arm64-cross.docker |   229 +-
 tests/docker/dockerfiles/debian-armel-cross.docker |   184 +-
 tests/docker/dockerfiles/debian-armhf-cross.docker |   190 +-
 .../debian-hexagon-cross.d/build-toolchain.sh      |   141 +
 .../docker/dockerfiles/debian-hexagon-cross.docker |    21 +-
 .../build-toolchain.sh                             |   141 -
 tests/docker/dockerfiles/debian-hppa-cross.docker  |    12 +-
 .../dockerfiles/debian-loongarch-cross.docker      |    27 +
 tests/docker/dockerfiles/debian-m68k-cross.docker  |    12 +-
 tests/docker/dockerfiles/debian-mips-cross.docker  |    38 +-
 .../docker/dockerfiles/debian-mips64-cross.docker  |    12 +-
 .../dockerfiles/debian-mips64el-cross.docker       |   183 +-
 .../docker/dockerfiles/debian-mipsel-cross.docker  |   185 +-
 tests/docker/dockerfiles/debian-native.docker      |     2 +-
 .../dockerfiles/debian-powerpc-test-cross.docker   |    12 +-
 .../docker/dockerfiles/debian-ppc64el-cross.docker |   184 +-
 .../docker/dockerfiles/debian-riscv64-cross.docker |     3 +
 .../dockerfiles/debian-riscv64-test-cross.docker   |    10 +-
 tests/docker/dockerfiles/debian-s390x-cross.docker |   225 +-
 tests/docker/dockerfiles/debian-sh4-cross.docker   |    12 +-
 .../docker/dockerfiles/debian-sparc64-cross.docker |    12 +-
 tests/docker/dockerfiles/debian-toolchain.docker   |     5 +-
 .../docker/dockerfiles/debian-tricore-cross.docker |     1 -
 tests/docker/dockerfiles/debian10.docker           |    37 -
 tests/docker/dockerfiles/debian11.docker           |    18 -
 tests/docker/dockerfiles/empty.docker              |     8 -
 tests/docker/dockerfiles/fedora-i386-cross.docker  |     3 +-
 tests/docker/dockerfiles/fedora-win32-cross.docker |   139 +-
 tests/docker/dockerfiles/fedora-win64-cross.docker |   138 +-
 tests/docker/dockerfiles/fedora.docker             |   228 +-
 tests/docker/dockerfiles/opensuse-leap.docker      |    16 +-
 tests/docker/dockerfiles/ubuntu1804.docker         |   145 -
 tests/docker/dockerfiles/ubuntu2004.docker         |   234 +-
 tests/docker/run                                   |     2 +-
 tests/docker/test-mingw                            |    16 +-
 tests/fp/fp-bench.c                                |     3 +-
 tests/fp/fp-test.c                                 |     3 +-
 tests/fp/meson.build                               |     5 +-
 tests/fp/platform.h                                |     4 +-
 tests/guest-debug/run-test.py                      |    11 +-
 tests/lcitool/libvirt-ci                           |     2 +-
 tests/lcitool/projects/qemu.yml                    |    11 +-
 tests/lcitool/refresh                              |   204 +-
 tests/meson.build                                  |     4 +-
 tests/migration/aarch64/a-b-kernel.S               |     3 +-
 tests/migration/aarch64/a-b-kernel.h               |    10 +-
 tests/migration/guestperf/engine.py                |     1 -
 tests/migration/i386/a-b-bootblock.S               |     1 +
 tests/migration/i386/a-b-bootblock.h               |    12 +-
 tests/migration/stress.c                           |     2 +-
 tests/qapi-schema/alternate-array.err              |     2 -
 tests/qapi-schema/alternate-array.json             |     2 -
 tests/qapi-schema/alternate-array.out              |    18 +
 tests/qapi-schema/alternate-conflict-lists.err     |     2 +
 tests/qapi-schema/alternate-conflict-lists.json    |     6 +
 tests/qapi-schema/alternate-conflict-lists.out     |     0
 tests/qapi-schema/meson.build                      |    25 +-
 tests/qapi-schema/qapi-schema-test.json            |     1 +
 tests/qapi-schema/qapi-schema-test.out             |     4 +
 tests/qemu-iotests/030                             |    85 +-
 tests/qemu-iotests/040                             |    53 +-
 tests/qemu-iotests/051                             |     3 +-
 tests/qemu-iotests/051.out                         |     2 +-
 tests/qemu-iotests/051.pc.out                      |     2 +-
 tests/qemu-iotests/056                             |     2 +-
 tests/qemu-iotests/065                             |    24 +-
 tests/qemu-iotests/108                             |   264 +-
 tests/qemu-iotests/108.out                         |    81 +
 tests/qemu-iotests/131                             |    35 +-
 tests/qemu-iotests/131.out                         |    13 +
 tests/qemu-iotests/149                             |     6 +-
 tests/qemu-iotests/151                             |   227 +-
 tests/qemu-iotests/151.out                         |     4 +-
 tests/qemu-iotests/163                             |     5 +-
 tests/qemu-iotests/172.out                         |    76 +
 tests/qemu-iotests/205                             |     4 +-
 tests/qemu-iotests/216                             |    12 +-
 tests/qemu-iotests/218                             |     5 +-
 tests/qemu-iotests/223                             |    16 +
 tests/qemu-iotests/223.out                         |    51 +-
 tests/qemu-iotests/224                             |     4 +-
 tests/qemu-iotests/227.out                         |     4 +-
 tests/qemu-iotests/242                             |     6 +-
 tests/qemu-iotests/245                             |    17 +-
 tests/qemu-iotests/255                             |     4 +-
 tests/qemu-iotests/258                             |    11 +-
 tests/qemu-iotests/264                             |     2 +-
 tests/qemu-iotests/298                             |    17 +-
 tests/qemu-iotests/303                             |     6 +-
 tests/qemu-iotests/307.out                         |     4 +-
 tests/qemu-iotests/310                             |    22 +-
 tests/qemu-iotests/common.config                   |    41 -
 tests/qemu-iotests/common.rc                       |    35 +-
 tests/qemu-iotests/iotests.py                      |    92 +-
 tests/qemu-iotests/meson.build                     |    73 +-
 tests/qemu-iotests/mypy.ini                        |     2 +-
 tests/qemu-iotests/pylintrc                        |     5 +
 tests/qemu-iotests/testrunner.py                   |     4 +
 tests/qemu-iotests/tests/backing-file-invalidation |   152 +
 .../tests/backing-file-invalidation.out            |     5 +
 tests/qemu-iotests/tests/copy-before-write         |   222 +
 tests/qemu-iotests/tests/copy-before-write.out     |     5 +
 tests/qemu-iotests/tests/export-incoming-iothread  |    81 +
 .../tests/export-incoming-iothread.out             |     5 +
 tests/qemu-iotests/tests/image-fleecing            |    30 +-
 tests/qemu-iotests/tests/migration-permissions     |    28 +-
 tests/qemu-iotests/tests/mirror-ready-cancel-error |     2 +-
 tests/qemu-iotests/tests/mirror-top-perms          |    11 +-
 tests/qemu-iotests/tests/nbd-multiconn             |   145 +
 tests/qemu-iotests/tests/nbd-multiconn.out         |     5 +
 tests/qemu-iotests/tests/nbd-qemu-allocation.out   |     2 +-
 tests/qemu-iotests/tests/nbd-reconnect-on-open     |     2 +-
 tests/qemu-iotests/tests/reopen-file               |    89 +
 tests/qemu-iotests/tests/reopen-file.out           |     5 +
 tests/qemu-iotests/tests/stream-error-on-reset     |     4 +-
 tests/qemu-iotests/tests/stream-under-throttle     |   121 +
 tests/qemu-iotests/tests/stream-under-throttle.out |     5 +
 tests/qtest/ac97-test.c                            |     4 +-
 tests/qtest/acpi-utils.c                           |     1 -
 tests/qtest/acpi-utils.h                           |     2 +-
 tests/qtest/ahci-test.c                            |    39 +-
 tests/qtest/am53c974-test.c                        |     2 +-
 tests/qtest/arm-cpu-features.c                     |     2 +-
 tests/qtest/aspeed_gpio-test.c                     |    90 +
 tests/qtest/aspeed_hace-test.c                     |   150 +-
 tests/qtest/aspeed_smc-test.c                      |   293 +-
 tests/qtest/bcm2835-dma-test.c                     |   118 +
 tests/qtest/bios-tables-test.c                     |   521 +-
 tests/qtest/boot-order-test.c                      |     2 +-
 tests/qtest/boot-sector.c                          |     3 +-
 tests/qtest/boot-sector.h                          |     2 +-
 tests/qtest/boot-serial-test.c                     |    13 +-
 tests/qtest/cdrom-test.c                           |     4 +-
 tests/qtest/cpu-plug-test.c                        |     1 -
 tests/qtest/cxl-test.c                             |   155 +
 tests/qtest/dbus-display-test.c                    |     5 +-
 tests/qtest/dbus-vmstate-test.c                    |     5 +-
 tests/qtest/device-introspect-test.c               |     3 +-
 tests/qtest/device-plug-test.c                     |   100 +-
 tests/qtest/drive_del-test.c                       |   127 +-
 tests/qtest/ds1338-test.c                          |     2 +-
 tests/qtest/e1000-test.c                           |     4 +-
 tests/qtest/e1000e-test.c                          |    76 +-
 tests/qtest/eepro100-test.c                        |     2 +-
 tests/qtest/endianness-test.c                      |     3 +-
 tests/qtest/erst-test.c                            |     3 +-
 tests/qtest/es1370-test.c                          |     4 +-
 tests/qtest/fdc-test.c                             |    29 +-
 tests/qtest/fuzz-e1000e-test.c                     |     2 +-
 tests/qtest/fuzz-lsi53c895a-test.c                 |    86 +-
 tests/qtest/fuzz-megasas-test.c                    |    16 +-
 tests/qtest/fuzz-sb16-test.c                       |    18 +-
 tests/qtest/fuzz-sdcard-test.c                     |    20 +-
 tests/qtest/fuzz-virtio-scsi-test.c                |    12 +-
 tests/qtest/fuzz-xlnx-dp-test.c                    |     4 +-
 tests/qtest/fuzz/fuzz.c                            |    23 +-
 tests/qtest/fuzz/fuzz.h                            |     7 +-
 tests/qtest/fuzz/generic_fuzz.c                    |    21 +-
 tests/qtest/fuzz/generic_fuzz_configs.h            |     4 +-
 tests/qtest/fuzz/i440fx_fuzz.c                     |     2 +-
 tests/qtest/fuzz/qos_fuzz.c                        |     5 +-
 tests/qtest/fuzz/virtio_blk_fuzz.c                 |     6 +-
 tests/qtest/fuzz/virtio_net_fuzz.c                 |     4 +-
 tests/qtest/fuzz/virtio_scsi_fuzz.c                |     2 +-
 tests/qtest/fw_cfg-test.c                          |     2 +-
 tests/qtest/hd-geo-test.c                          |   298 +-
 tests/qtest/hexloader-test.c                       |     2 +-
 tests/qtest/i440fx-test.c                          |    48 +-
 tests/qtest/ide-test.c                             |    93 +-
 tests/qtest/intel-hda-test.c                       |    13 +-
 tests/qtest/ipmi-bt-test.c                         |     1 -
 tests/qtest/ipoctal232-test.c                      |     2 +-
 tests/qtest/ivshmem-test.c                         |    30 +-
 tests/qtest/libqmp.c                               |   258 +
 tests/qtest/libqmp.h                               |    53 +
 tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c   |     4 +-
 tests/qtest/libqos/ahci.c                          |     3 +-
 tests/qtest/libqos/arm-imx25-pdk-machine.c         |     4 +-
 tests/qtest/libqos/arm-n800-machine.c              |     4 +-
 tests/qtest/libqos/arm-raspi2-machine.c            |     4 +-
 tests/qtest/libqos/arm-sabrelite-machine.c         |     4 +-
 tests/qtest/libqos/arm-smdkc210-machine.c          |     4 +-
 tests/qtest/libqos/arm-virt-machine.c              |    23 +-
 tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c    |     4 +-
 tests/qtest/libqos/e1000e.c                        |   128 +-
 tests/qtest/libqos/fw_cfg.c                        |     2 +-
 tests/qtest/libqos/fw_cfg.h                        |     2 +-
 tests/qtest/libqos/generic-pcihost.c               |   231 +
 tests/qtest/libqos/generic-pcihost.h               |    54 +
 tests/qtest/libqos/i2c-imx.c                       |     2 +-
 tests/qtest/libqos/i2c-omap.c                      |     2 +-
 tests/qtest/libqos/i2c.c                           |     2 +-
 tests/qtest/libqos/i2c.h                           |     2 +-
 tests/qtest/libqos/libqos-malloc.c                 |   346 +
 tests/qtest/libqos/libqos-malloc.h                 |    50 +
 tests/qtest/libqos/libqos.c                        |     4 +-
 tests/qtest/libqos/libqos.h                        |     4 +-
 tests/qtest/libqos/libqtest.h                      |   813 -
 tests/qtest/libqos/malloc-pc.c                     |     2 -
 tests/qtest/libqos/malloc-pc.h                     |     2 +-
 tests/qtest/libqos/malloc-spapr.c                  |     2 -
 tests/qtest/libqos/malloc-spapr.h                  |     2 +-
 tests/qtest/libqos/malloc.c                        |   347 -
 tests/qtest/libqos/malloc.h                        |    50 -
 tests/qtest/libqos/meson.build                     |    14 +-
 tests/qtest/libqos/pci-pc.c                        |    11 +-
 tests/qtest/libqos/pci-pc.h                        |     2 +-
 tests/qtest/libqos/pci-spapr.c                     |     3 +-
 tests/qtest/libqos/pci-spapr.h                     |     2 +-
 tests/qtest/libqos/pci.c                           |    78 +-
 tests/qtest/libqos/pci.h                           |     8 +-
 tests/qtest/libqos/ppc64_pseries-machine.c         |     2 +-
 tests/qtest/libqos/qgraph.c                        |     2 +-
 tests/qtest/libqos/qgraph.h                        |     6 +-
 tests/qtest/libqos/qos_external.c                  |     4 +-
 tests/qtest/libqos/qos_external.h                  |     2 +-
 tests/qtest/libqos/rtas.c                          |     2 +-
 tests/qtest/libqos/rtas.h                          |     2 +-
 tests/qtest/libqos/sdhci-cmd.c                     |     2 +-
 tests/qtest/libqos/sdhci-cmd.h                     |     2 +-
 tests/qtest/libqos/sdhci.c                         |     2 +-
 tests/qtest/libqos/tpci200.c                       |     2 +-
 tests/qtest/libqos/usb.c                           |     2 +-
 tests/qtest/libqos/vhost-user-blk.c                |     2 +-
 tests/qtest/libqos/virtio-9p-client.c              |  1049 +
 tests/qtest/libqos/virtio-9p-client.h              |   494 +
 tests/qtest/libqos/virtio-9p.c                     |     8 +-
 tests/qtest/libqos/virtio-balloon.c                |     2 +-
 tests/qtest/libqos/virtio-blk.c                    |     2 +-
 tests/qtest/libqos/virtio-gpio.c                   |   172 +
 tests/qtest/libqos/virtio-gpio.h                   |    35 +
 tests/qtest/libqos/virtio-iommu.c                  |     2 +-
 tests/qtest/libqos/virtio-mmio.c                   |     4 +-
 tests/qtest/libqos/virtio-net.c                    |     2 +-
 tests/qtest/libqos/virtio-pci.c                    |     4 +-
 tests/qtest/libqos/virtio-rng.c                    |     2 +-
 tests/qtest/libqos/virtio-scsi.c                   |     2 +-
 tests/qtest/libqos/virtio-serial.c                 |     2 +-
 tests/qtest/libqos/virtio.c                        |     8 +-
 tests/qtest/libqos/virtio.h                        |     2 +-
 tests/qtest/libqos/x86_64_pc-machine.c             |     2 +-
 tests/qtest/libqtest-single.h                      |     6 +-
 tests/qtest/libqtest.c                             |   477 +-
 tests/qtest/libqtest.h                             |   835 +
 tests/qtest/lpc-ich9-test.c                        |     2 +-
 tests/qtest/m48t59-test.c                          |     4 +-
 tests/qtest/machine-none-test.c                    |     6 +-
 tests/qtest/megasas-test.c                         |     2 +-
 tests/qtest/meson.build                            |   110 +-
 tests/qtest/microbit-test.c                        |    18 +-
 tests/qtest/migration-helpers.c                    |    51 +
 tests/qtest/migration-helpers.h                    |    14 +-
 tests/qtest/migration-test.c                       |  1727 +-
 tests/qtest/modules-test.c                         |     5 +-
 tests/qtest/ne2000-test.c                          |     2 +-
 tests/qtest/npcm7xx_adc-test.c                     |     4 +-
 tests/qtest/npcm7xx_emc-test.c                     |    12 +-
 tests/qtest/npcm7xx_pwm-test.c                     |     5 +-
 tests/qtest/npcm7xx_rng-test.c                     |     2 +-
 tests/qtest/npcm7xx_sdhci-test.c                   |     4 +-
 tests/qtest/npcm7xx_smbus-test.c                   |     2 +-
 tests/qtest/npcm7xx_watchdog_timer-test.c          |     2 +-
 tests/qtest/numa-test.c                            |    21 +-
 tests/qtest/nvme-test.c                            |     2 +-
 tests/qtest/pca9552-test.c                         |     2 +-
 tests/qtest/pci-test.c                             |     2 +-
 tests/qtest/pcnet-test.c                           |     2 +-
 tests/qtest/pflash-cfi02-test.c                    |    17 +-
 tests/qtest/pnv-xscom-test.c                       |     2 +-
 tests/qtest/prom-env-test.c                        |     6 +-
 tests/qtest/pvpanic-pci-test.c                     |     2 +-
 tests/qtest/pvpanic-test.c                         |     2 +-
 tests/qtest/pxe-test.c                             |     3 +-
 tests/qtest/q35-test.c                             |     2 +-
 tests/qtest/qmp-cmd-test.c                         |     5 +-
 tests/qtest/qmp-test.c                             |    19 +-
 tests/qtest/qom-test.c                             |    25 +-
 tests/qtest/qos-test.c                             |    11 +-
 tests/qtest/readconfig-test.c                      |   195 +
 tests/qtest/rtas-test.c                            |     2 +-
 tests/qtest/rtc-test.c                             |     2 +-
 tests/qtest/rtl8139-test.c                         |     1 -
 tests/qtest/sdhci-test.c                           |     2 +-
 tests/qtest/spapr-phb-test.c                       |     2 +-
 tests/qtest/tco-test.c                             |     2 +-
 tests/qtest/test-filter-mirror.c                   |     3 +-
 tests/qtest/test-filter-redirector.c               |     3 +-
 tests/qtest/test-hmp.c                             |     2 +-
 tests/qtest/test-x86-cpuid-compat.c                |     1 -
 tests/qtest/tpm-crb-swtpm-test.c                   |     7 +-
 tests/qtest/tpm-emu.h                              |     2 +-
 tests/qtest/tpm-tis-device-swtpm-test.c            |     7 +-
 tests/qtest/tpm-tis-swtpm-test.c                   |     7 +-
 tests/qtest/tpm-util.c                             |    21 +-
 tests/qtest/tpm-util.h                             |     1 +
 tests/qtest/tulip-test.c                           |     2 +-
 tests/qtest/vhost-user-blk-test.c                  |    15 +-
 tests/qtest/vhost-user-test.c                      |   196 +-
 tests/qtest/virtio-9p-test.c                       |  1222 +-
 tests/qtest/virtio-blk-test.c                      |    11 +-
 tests/qtest/virtio-net-failover.c                  |    11 +-
 tests/qtest/virtio-net-test.c                      |    19 +-
 tests/qtest/virtio-rng-test.c                      |     7 +-
 tests/qtest/virtio-scsi-test.c                     |     4 +-
 tests/qtest/virtio-test.c                          |     2 +-
 tests/qtest/vmgenid-test.c                         |     2 +-
 tests/qtest/vmxnet3-test.c                         |     2 +-
 tests/qtest/vnc-display-test.c                     |   103 +
 tests/qtest/wdt_ib700-test.c                       |     2 +-
 tests/qtest/xlnx-can-test.c                        |     2 +-
 tests/requirements.txt                             |     1 +
 tests/tcg/Makefile.prereqs                         |    18 -
 tests/tcg/Makefile.qemu                            |   121 -
 tests/tcg/Makefile.target                          |    49 +-
 tests/tcg/aarch64/Makefile.softmmu-target          |    13 +-
 tests/tcg/aarch64/Makefile.target                  |    31 +-
 tests/tcg/aarch64/bti-3.c                          |    42 +
 tests/tcg/aarch64/float_convd.ref                  |   988 +
 tests/tcg/aarch64/system/pauth-3.c                 |     2 +-
 tests/tcg/aarch64/system/semiconsole.c             |     2 +-
 tests/tcg/aarch64/system/semiheap.c                |     2 +-
 tests/tcg/arm/Makefile.softmmu-target              |     2 +-
 tests/tcg/arm/Makefile.target                      |     9 +-
 tests/tcg/arm/float_convd.ref                      |   988 +
 tests/tcg/configure.sh                             |   354 -
 tests/tcg/cris/Makefile.target                     |     2 +-
 tests/tcg/hexagon/Makefile.target                  |     1 +
 tests/tcg/hexagon/float_convd.ref                  |   988 +
 tests/tcg/hexagon/hvx_misc.c                       |    45 +
 tests/tcg/hexagon/load_unpack.c                    |    14 +-
 tests/tcg/hexagon/mem_noshuf.c                     |   122 +-
 tests/tcg/hexagon/mem_noshuf_exception.c           |   146 +
 tests/tcg/hexagon/usr.c                            |    10 +
 tests/tcg/i386/Makefile.softmmu-target             |     3 +-
 tests/tcg/i386/Makefile.target                     |    43 +-
 tests/tcg/i386/README                              |     9 +
 tests/tcg/i386/float_convd.conf                    |   988 +
 tests/tcg/i386/float_convs.ref                     |   748 +
 tests/tcg/i386/test-3dnow.c                        |     3 +
 tests/tcg/i386/test-avx.c                          |   364 +
 tests/tcg/i386/test-avx.py                         |   375 +
 tests/tcg/i386/test-i386-bmi2.c                    |   169 +-
 tests/tcg/i386/test-i386-fp-exceptions.c           |    24 +-
 tests/tcg/i386/test-i386.c                         |   577 +-
 tests/tcg/i386/test-mmx.c                          |   315 +
 tests/tcg/i386/test-mmx.py                         |   244 +
 tests/tcg/i386/x86.csv                             |  4658 ++++
 tests/tcg/loongarch64/Makefile.softmmu-target      |    33 +
 tests/tcg/loongarch64/Makefile.target              |    20 +
 tests/tcg/loongarch64/float_convd.ref              |   988 +
 tests/tcg/loongarch64/float_convs.ref              |   748 +
 tests/tcg/loongarch64/float_madds.ref              |   768 +
 tests/tcg/loongarch64/system/boot.S                |    56 +
 tests/tcg/loongarch64/system/kernel.ld             |    30 +
 tests/tcg/loongarch64/system/regdef.h              |    86 +
 tests/tcg/loongarch64/test_bit.c                   |    88 +
 tests/tcg/loongarch64/test_div.c                   |    54 +
 tests/tcg/loongarch64/test_fclass.c                |   130 +
 tests/tcg/loongarch64/test_fcsr.c                  |    15 +
 tests/tcg/loongarch64/test_fpcom.c                 |    37 +
 tests/tcg/loongarch64/test_pcadd.c                 |    38 +
 tests/tcg/m68k/Makefile.target                     |     3 +
 tests/tcg/m68k/trap.c                              |   129 +
 tests/tcg/multiarch/Makefile.target                |    23 +-
 tests/tcg/multiarch/float_convd.c                  |   106 +
 tests/tcg/multiarch/linux/linux-madvise.c          |    70 +
 tests/tcg/multiarch/linux/linux-test.c             |     2 +-
 tests/tcg/multiarch/munmap-pthread.c               |    79 +
 tests/tcg/multiarch/noexec.c.inc                   |   139 +
 tests/tcg/multiarch/overflow.c                     |    58 +
 tests/tcg/multiarch/system/Makefile.softmmu-target |     2 +-
 tests/tcg/multiarch/system/memory.c                |     2 +-
 tests/tcg/nios2/10m50-ghrd.ld                      |    70 +
 tests/tcg/nios2/Makefile.softmmu-target            |    32 +
 tests/tcg/nios2/Makefile.target                    |    11 -
 tests/tcg/nios2/boot.S                             |   218 +
 tests/tcg/nios2/intr.S                             |    31 +
 tests/tcg/nios2/semicall.h                         |    28 +
 tests/tcg/nios2/test-shadow-1.S                    |    40 +
 tests/tcg/ppc64/Makefile.target                    |    13 +-
 tests/tcg/ppc64/bcdsub.c                           |   134 +
 tests/tcg/ppc64/byte_reverse.c                     |    21 +
 tests/tcg/ppc64/mffsce.c                           |    37 +
 tests/tcg/ppc64/mtfsf.c                            |    60 +
 tests/tcg/ppc64/non_signalling_xscv.c              |    37 +
 tests/tcg/ppc64/signal_save_restore_xer.c          |    42 +
 tests/tcg/ppc64/xxspltw.c                          |    46 +
 tests/tcg/ppc64le/Makefile.target                  |    25 +-
 tests/tcg/ppc64le/bcdsub.c                         |   134 -
 tests/tcg/ppc64le/byte_reverse.c                   |    21 -
 tests/tcg/ppc64le/mtfsf.c                          |    60 -
 tests/tcg/ppc64le/non_signalling_xscv.c            |    37 -
 tests/tcg/ppc64le/signal_save_restore_xer.c        |    42 -
 tests/tcg/ppc64le/xxspltw.c                        |    46 -
 tests/tcg/riscv64/Makefile.softmmu-target          |    21 +
 tests/tcg/riscv64/Makefile.target                  |     1 +
 tests/tcg/riscv64/issue1060.S                      |    53 +
 tests/tcg/riscv64/noexec.c                         |    79 +
 tests/tcg/riscv64/semihost.ld                      |    21 +
 tests/tcg/s390x/Makefile.softmmu-target            |     9 +
 tests/tcg/s390x/Makefile.target                    |    29 +-
 tests/tcg/s390x/branch-relative-long.c             |     4 +-
 tests/tcg/s390x/noexec.c                           |   106 +
 tests/tcg/s390x/signals-s390x.c                    |    69 +-
 tests/tcg/s390x/unaligned-lowcore.S                |    19 +
 tests/tcg/s390x/vfminmax.c                         |   411 +
 tests/tcg/s390x/vistr.c                            |    45 +
 tests/tcg/s390x/vx.h                               |    19 +
 tests/tcg/s390x/vxeh2_vcvt.c                       |    88 +
 tests/tcg/s390x/vxeh2_vlstr.c                      |   139 +
 tests/tcg/s390x/vxeh2_vs.c                         |    93 +
 tests/tcg/sh4/Makefile.target                      |    12 -
 tests/tcg/x86_64/Makefile.softmmu-target           |     3 +-
 tests/tcg/x86_64/Makefile.target                   |    17 +-
 tests/tcg/x86_64/cmpxchg.c                         |    42 +
 tests/tcg/x86_64/float_convd.ref                   |   988 +
 tests/tcg/x86_64/float_convs.ref                   |   748 +
 tests/tcg/x86_64/noexec.c                          |    75 +
 tests/tcg/x86_64/system/boot.S                     |     2 +-
 tests/tcg/xtensa/Makefile.softmmu-target           |     2 +-
 tests/tcg/xtensa/crt.S                             |     2 +
 tests/tcg/xtensa/test_break.S                      |    86 +-
 tests/tcg/xtensa/test_mmu.S                        |   182 +-
 tests/tcg/xtensa/test_phys_mem.S                   |    10 +-
 tests/tcg/xtensa/test_sr.S                         |     2 +
 tests/tcg/xtensa/test_timer.S                      |    68 +-
 tests/unit/check-block-qdict.c                     |     2 +-
 tests/unit/check-qjson.c                           |     1 -
 tests/unit/check-qnull.c                           |     1 -
 tests/unit/check-qnum.c                            |     1 -
 tests/unit/check-qobject.c                         |   133 +-
 tests/unit/check-qom-proplist.c                    |     1 +
 tests/unit/check-qstring.c                         |     1 -
 tests/unit/crypto-tls-psk-helpers.c                |    27 +-
 tests/unit/crypto-tls-psk-helpers.h                |     1 +
 tests/unit/crypto-tls-x509-helpers.c               |    16 +-
 tests/unit/crypto-tls-x509-helpers.h               |    53 +
 tests/unit/io-channel-helpers.c                    |     9 +-
 tests/unit/meson.build                             |     9 +-
 tests/unit/ptimer-test.c                           |    28 +-
 tests/unit/socket-helpers.c                        |    19 +-
 tests/unit/socket-helpers.h                        |     9 +
 tests/unit/test-bdrv-drain.c                       |    97 +-
 tests/unit/test-bdrv-graph-mod.c                   |   104 +-
 tests/unit/test-block-iothread.c                   |   171 +-
 tests/unit/test-blockjob-txn.c                     |    24 +-
 tests/unit/test-blockjob.c                         |   136 +-
 tests/unit/test-clone-visitor.c                    |     1 -
 tests/unit/test-coroutine.c                        |     2 +-
 tests/unit/test-crypto-akcipher.c                  |   990 +
 tests/unit/test-crypto-block.c                     |   340 +-
 tests/unit/test-crypto-der.c                       |   372 +
 tests/unit/test-crypto-tlscredsx509.c              |     4 +-
 tests/unit/test-crypto-tlssession.c                |    25 +-
 tests/unit/test-cutils.c                           |    78 +
 tests/unit/test-forward-visitor.c                  |     3 +-
 tests/unit/test-image-locking.c                    |    10 +-
 tests/unit/test-int128.c                           |    50 +
 tests/unit/test-io-channel-command.c               |    59 +-
 tests/unit/test-io-channel-file.c                  |     2 +-
 tests/unit/test-io-channel-null.c                  |    95 +
 tests/unit/test-io-channel-socket.c                |    38 +-
 tests/unit/test-io-channel-tls.c                   |     6 +-
 tests/unit/test-iov.c                              |    31 +-
 tests/unit/test-keyval.c                           |     2 +-


From xen-changelog-bounces@lists.xenproject.org Fri Dec 16 03:33:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Dec 2022 03:33:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.464119.722459 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p61T6-0006ZT-2i; Fri, 16 Dec 2022 03:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 464119.722459; Fri, 16 Dec 2022 03: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 1p61T5-0006ZL-Vq; Fri, 16 Dec 2022 03:33:03 +0000
Received: by outflank-mailman (input) for mailman id 464119;
 Fri, 16 Dec 2022 03:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p61T4-0006Z9-GT
 for xen-changelog@lists.xenproject.org; Fri, 16 Dec 2022 03:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p61T4-00060o-Du
 for xen-changelog@lists.xenproject.org; Fri, 16 Dec 2022 03:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p61T4-00004z-Cm
 for xen-changelog@lists.xenproject.org; Fri, 16 Dec 2022 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KQFt3//hxn+O1HlLjVuFELSzjNZW4N7lEA+0woYQFXA=; b=0/2dvBuUWrgFN0xql/OwaS/azf
	p0Qhpvq/T/ifP0ue5wSTnqY2QAmjOHJcb//7UhFe2k3bCYRZ2zaM+P8umhLRW8aAZTfhEeYTEoWTK
	LG2MpaCM/z1qo+cDJ0Ci/IMOBPBqENuF90L1MoEIc8dHWUjBGl4wqB5Iu0Lca358wcy8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] main loop: Big hammer to fix logfile disk DoS in Xen setups
Message-Id: <E1p61T4-00004z-Cm@xenbits.xenproject.org>
Date: Fri, 16 Dec 2022 03:33:02 +0000

commit 1cf02b05b27c48775a25699e61b93b814b9ae042
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Thu May 26 16:21:56 2016 +0100
Commit:     Anthony PERARD <anthony.perard@gmail.com>
CommitDate: Thu Dec 15 15:19:18 2022 +0000

    main loop: Big hammer to fix logfile disk DoS in Xen setups
    
    Each time round the main loop, we now fstat stderr.  If it is too big,
    we dup2 /dev/null onto it.  This is not a very pretty patch but it is
    very simple, easy to see that it's correct, and has a low risk of
    collateral damage.
    
    There is no limit by default but can be adjusted by setting a new
    environment variable.
    
    This fixes CVE-2014-3672.
    
    Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
    Tested-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
    
    Set the default to 0 so that it won't affect non-xen installation. The
    limit will be set by Xen toolstack.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
    (cherry picked from commit 44a072f0de0d57c95c2212bbce02888832b7b74f)
    (cherry picked from commit 269381bb635692856aa8789a3f322e543e0c648d)
---
 util/main-loop.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/util/main-loop.c b/util/main-loop.c
index 10fa74c6e3..7dfb95e3c5 100644
--- a/util/main-loop.c
+++ b/util/main-loop.c
@@ -186,6 +186,50 @@ int qemu_init_main_loop(Error **errp)
     return 0;
 }
 
+static void check_cve_2014_3672_xen(void)
+{
+    static unsigned long limit = ~0UL;
+    const int fd = 2;
+    struct stat stab;
+
+    if (limit == ~0UL) {
+        const char *s = getenv("XEN_QEMU_CONSOLE_LIMIT");
+        /* XEN_QEMU_CONSOLE_LIMIT=0 means no limit */
+        limit = s ? strtoul(s,0,0) : 0;
+    }
+    if (limit == 0)
+        return;
+
+    int r = fstat(fd, &stab);
+    if (r) {
+        perror("fstat stderr (for CVE-2014-3672 check)");
+        exit(-1);
+    }
+    if (!S_ISREG(stab.st_mode))
+        return;
+    if (stab.st_size <= limit)
+        return;
+
+    /* oh dear */
+    fprintf(stderr,"\r\n"
+            "Closing stderr due to CVE-2014-3672 limit. "
+            " Set XEN_QEMU_CONSOLE_LIMIT to number of bytes to override,"
+            " or 0 for no limit.\n");
+    fflush(stderr);
+
+    int nfd = open("/dev/null", O_WRONLY);
+    if (nfd < 0) {
+        perror("open /dev/null (for CVE-2014-3672 check)");
+        exit(-1);
+    }
+    r = dup2(nfd, fd);
+    if (r != fd) {
+        perror("dup2 /dev/null (for CVE-2014-3672 check)");
+        exit(-1);
+    }
+    close(nfd);
+}
+
 static void main_loop_update_params(EventLoopBase *base, Error **errp)
 {
     ERRP_GUARD();
@@ -307,6 +351,8 @@ static int os_host_main_loop_wait(int64_t timeout)
 
     g_main_context_acquire(context);
 
+    check_cve_2014_3672_xen();
+
     glib_pollfds_fill(&timeout);
 
     qemu_mutex_unlock_iothread();
@@ -489,6 +535,8 @@ static int os_host_main_loop_wait(int64_t timeout)
 
     g_main_context_acquire(context);
 
+    check_cve_2014_3672_xen();
+
     /* XXX: need to suppress polling by better using win32 events */
     ret = 0;
     for (pe = first_polling_entry; pe != NULL; pe = pe->next) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:44:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465450.724116 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gqZ-0003FA-Ow; Sat, 17 Dec 2022 23:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465450.724116; Sat, 17 Dec 2022 23: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 1p6gqZ-0003F2-M5; Sat, 17 Dec 2022 23:44:03 +0000
Received: by outflank-mailman (input) for mailman id 465450;
 Sat, 17 Dec 2022 23:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gqY-0003Ew-K2
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gqY-0004Gf-Gh
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gqY-0001LK-Ds
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4Kdx1OS5xhRu+lFmhLtuinPyElNOVShmqT2YUKTgtiI=; b=GmE3XbWMOZZv/7Usq2CNTPkZ4t
	79T7m+qvINRnxPvrMqfMzrUy9Hvm1Hg6YgcOgxRp+DbeSzORPp16Q2h7Y5hYGqypuyuF6mse+kCcT
	OXsxtCjfWKusxn/oAArZd8b8ECEDnKAbLlujibmjbLVUQfpyxAoRsll2eaqOPr9AJtRg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: Provide helpers for common code to access acpi_numa
Message-Id: <E1p6gqY-0001LK-Ds@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:44:02 +0000

commit 9bbfd7b14c4ad3774d88fe6430ab8726720633ec
Author:     Wei Chen <wei.chen@arm.com>
AuthorDate: Mon Dec 12 12:10:18 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 12 12:10:18 2022 +0100

    xen/x86: Provide helpers for common code to access acpi_numa
    
    acpi_numa is a specific NUMA switch for ACPI NUMA implementation.
    Other NUMA implementation may not need this switch. But this switch is
    not only used by ACPI code, it is also used directly in some general
    NUMA logic code. So far this hasn't caused any problem because Xen only
    has x86 implementing ACPI NUMA, but now Arm is implementing device tree
    based NUMA. Accesssing acpi_numa directly in some functions will be a
    block of reusing NUMA common code. It is also difficult for us to replace
    it with a new generic switch, because it is hard to prove that the new
    switch states can guarantee the original code will work correctly.
    
    So in this patch, we provide two helpers for common code to update and
    get states of acpi_numa. And other new NUMA implementations just need
    to provide the same helpers for common code. In this case, the generic
    NUMA logic code can be reused by all NUMA implementations.
    
    Signed-off-by: Wei Chen <wei.chen@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/numa.h |  5 +++--
 xen/arch/x86/numa.c             | 38 +++++++++++++++++++++++++-------------
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/include/asm/numa.h b/xen/arch/x86/include/asm/numa.h
index c32ccffde3..237f2c6dbf 100644
--- a/xen/arch/x86/include/asm/numa.h
+++ b/xen/arch/x86/include/asm/numa.h
@@ -32,8 +32,9 @@ extern void numa_add_cpu(int cpu);
 extern void numa_init_array(void);
 extern bool numa_off;
 
-
-extern int srat_disabled(void);
+extern int arch_numa_setup(const char *opt);
+extern bool arch_numa_disabled(void);
+extern bool srat_disabled(void);
 extern void numa_set_node(int cpu, nodeid_t node);
 extern nodeid_t setup_node(unsigned int pxm);
 extern void srat_detect_node(int cpu);
diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index 322157fab7..1c3198445d 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -50,9 +50,28 @@ nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
 bool numa_off;
 s8 acpi_numa = 0;
 
-int srat_disabled(void)
+int __init arch_numa_setup(const char *opt)
 {
-    return numa_off || acpi_numa < 0;
+#ifdef CONFIG_ACPI_NUMA
+    if ( !strncmp(opt, "noacpi", 6) )
+    {
+        numa_off = false;
+        acpi_numa = -1;
+        return 0;
+    }
+#endif
+
+    return -EINVAL;
+}
+
+bool arch_numa_disabled(void)
+{
+    return acpi_numa < 0;
+}
+
+bool srat_disabled(void)
+{
+    return numa_off || arch_numa_disabled();
 }
 
 /*
@@ -294,28 +313,21 @@ void numa_set_node(int cpu, nodeid_t node)
 /* [numa=off] */
 static int __init cf_check numa_setup(const char *opt)
 {
-    if ( !strncmp(opt,"off",3) )
+    if ( !strncmp(opt, "off", 3) )
         numa_off = true;
-    else if ( !strncmp(opt,"on",2) )
+    else if ( !strncmp(opt, "on", 2) )
         numa_off = false;
 #ifdef CONFIG_NUMA_EMU
     else if ( !strncmp(opt, "fake=", 5) )
     {
         numa_off = false;
-        numa_fake = simple_strtoul(opt+5,NULL,0);
+        numa_fake = simple_strtoul(opt + 5, NULL, 0);
         if ( numa_fake >= MAX_NUMNODES )
             numa_fake = MAX_NUMNODES;
     }
-#endif
-#ifdef CONFIG_ACPI_NUMA
-    else if ( !strncmp(opt,"noacpi",6) )
-    {
-        numa_off = false;
-        acpi_numa = -1;
-    }
 #endif
     else
-        return -EINVAL;
+        return arch_numa_setup(opt);
 
     return 0;
 } 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:44:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465451.724120 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gqj-0003I1-Qi; Sat, 17 Dec 2022 23:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465451.724120; Sat, 17 Dec 2022 23:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gqj-0003Ht-Nv; Sat, 17 Dec 2022 23:44:13 +0000
Received: by outflank-mailman (input) for mailman id 465451;
 Sat, 17 Dec 2022 23:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gqi-0003Hk-Ll
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gqi-0004Gn-Kt
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gqi-0001Lr-J9
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sWo08j7TO3n/hLR9bNU1MOMDKdkqpppD2bTTZ7+YW38=; b=0qbJd8xcV0I9w/yBn9X038tl8x
	U8z5L78RU9tGetM/6Iu6Siae9j+iePPPx2jQiycNiEWOYiwOIo6sPO7rnbHhS8YsRhVE2Y2J9NiLc
	vIGc6DdoZ0b71s1rJpKh2Xh8vT6qJNkUD9h6pxoCCj5f9uwVV4tXz1ZhynBEAbhb6S6k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: move generically usable NUMA code from x86 to common
Message-Id: <E1p6gqi-0001Lr-J9@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:44:12 +0000

commit eac84d9d579011f311d502317b74dc56e788463d
Author:     Wei Chen <wei.chen@arm.com>
AuthorDate: Mon Dec 12 12:11:55 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 12 12:11:55 2022 +0100

    xen/x86: move generically usable NUMA code from x86 to common
    
    There are some codes in x86/numa.c can be shared by common
    architectures to implememnt NUMA support. Just like some
    variables and functions to check and store NUMA memory map.
    And some variables and functions to do NUMA initialization.
    
    In this patch, we move them to common/numa.c and xen/numa.h
    and use the CONFIG_NUMA to gate them for non-NUMA supported
    architectures. As the target header file is Xen-style, so
    we trim some spaces and replace tabs for the codes that has
    been moved to xen/numa.h at the same time.
    
    As acpi_scan_nodes has been used in a common function, it
    doesn't make sense to use acpi_xxx in common code, so we
    rename it to numa_process_nodes in this patch too. After that
    if we still use CONFIG_ACPI_NUMA in to gate numa_process_nodes
    in numa_initmem_init, that doesn't make sense. As CONFIG_NUMA
    will be selected by CONFIG_ACPI_NUMA for x86. So, we replace
    CONFIG_ACPI_NUMA by CONFIG_NUMA to gate numa_process_nodes.
    
    As arch_numa_disabled has been implememnted for ACPI NUMA,
    we can rename srat_disabled to numa_disabled and move it
    to common code as well.
    
    The macro node_to_first_cpu(node) hasn't been used anywhere,
    so we drop it in this patch too.
    
    Because some architectures allow to use all 64 physical address
    bits, but some architectures are not (like Arm64 allows 52, 48
    bits). In this case, we use min(PADDR_BITS, BITS_PER_LONG - 1)
    to calculate the shift when only one node is in the system in
    this patch too.
    
    Signed-off-by: Wei Chen <wei.chen@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/acpi.h  |   1 -
 xen/arch/x86/include/asm/numa.h  |  57 +----
 xen/arch/x86/include/asm/setup.h |   1 -
 xen/arch/x86/numa.c              | 433 +-----------------------------------
 xen/arch/x86/smpboot.c           |   2 +-
 xen/arch/x86/srat.c              |  10 +-
 xen/common/Makefile              |   1 +
 xen/common/numa.c                | 464 +++++++++++++++++++++++++++++++++++++++
 xen/include/xen/numa.h           |  66 ++++++
 9 files changed, 539 insertions(+), 496 deletions(-)

diff --git a/xen/arch/x86/include/asm/acpi.h b/xen/arch/x86/include/asm/acpi.h
index 9a9cc4c240..5c2dd5da2d 100644
--- a/xen/arch/x86/include/asm/acpi.h
+++ b/xen/arch/x86/include/asm/acpi.h
@@ -102,7 +102,6 @@ extern unsigned long acpi_wakeup_address;
 #define ARCH_HAS_POWER_INIT	1
 
 extern s8 acpi_numa;
-extern int acpi_scan_nodes(u64 start, u64 end);
 #define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
 
 extern struct acpi_sleep_info acpi_sinfo;
diff --git a/xen/arch/x86/include/asm/numa.h b/xen/arch/x86/include/asm/numa.h
index 237f2c6dbf..6c87942d43 100644
--- a/xen/arch/x86/include/asm/numa.h
+++ b/xen/arch/x86/include/asm/numa.h
@@ -9,72 +9,17 @@ typedef u8 nodeid_t;
 
 extern int srat_rev;
 
-extern nodeid_t      cpu_to_node[NR_CPUS];
-extern cpumask_t     node_to_cpumask[];
-
-#define cpu_to_node(cpu)		(cpu_to_node[cpu])
-#define parent_node(node)		(node)
-#define node_to_first_cpu(node)  (__ffs(node_to_cpumask[node]))
-#define node_to_cpumask(node)    (node_to_cpumask[node])
-
-struct node { 
-	paddr_t start, end;
-};
-
-extern int compute_hash_shift(struct node *nodes, int numnodes,
-			      nodeid_t *nodeids);
 extern nodeid_t pxm_to_node(unsigned int pxm);
 
 #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
-#define VIRTUAL_BUG_ON(x) 
 
-extern void numa_add_cpu(int cpu);
-extern void numa_init_array(void);
-extern bool numa_off;
-
-extern int arch_numa_setup(const char *opt);
-extern bool arch_numa_disabled(void);
-extern bool srat_disabled(void);
-extern void numa_set_node(int cpu, nodeid_t node);
+extern bool numa_disabled(void);
 extern nodeid_t setup_node(unsigned int pxm);
 extern void srat_detect_node(int cpu);
 
-extern void setup_node_bootmem(nodeid_t nodeid, paddr_t start, paddr_t end);
 extern nodeid_t apicid_to_node[];
 extern void init_cpu_to_node(void);
 
-static inline void clear_node_cpumask(int cpu)
-{
-	cpumask_clear_cpu(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
-}
-
-/* Simple perfect hash to map pdx to node numbers */
-extern int memnode_shift; 
-extern unsigned long memnodemapsize;
-extern u8 *memnodemap;
-
-struct node_data {
-    unsigned long node_start_pfn;
-    unsigned long node_spanned_pages;
-};
-
-extern struct node_data node_data[];
-
-static inline __attribute__((pure)) nodeid_t phys_to_nid(paddr_t addr)
-{ 
-	nodeid_t nid;
-	VIRTUAL_BUG_ON((paddr_to_pdx(addr) >> memnode_shift) >= memnodemapsize);
-	nid = memnodemap[paddr_to_pdx(addr) >> memnode_shift]; 
-	VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]); 
-	return nid; 
-} 
-
-#define NODE_DATA(nid)		(&(node_data[nid]))
-
-#define node_start_pfn(nid)	(NODE_DATA(nid)->node_start_pfn)
-#define node_spanned_pages(nid)	(NODE_DATA(nid)->node_spanned_pages)
-#define node_end_pfn(nid)       (NODE_DATA(nid)->node_start_pfn + \
-				 NODE_DATA(nid)->node_spanned_pages)
 #define arch_want_default_dmazone() (num_online_nodes() > 1)
 
 extern int valid_numa_range(paddr_t start, paddr_t end, nodeid_t node);
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 21037b7f31..ae470ea12f 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -20,7 +20,6 @@ void early_time_init(void);
 
 void set_nr_cpu_ids(unsigned int max_cpus);
 
-void numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn);
 void arch_init_memory(void);
 void subarch_init_memory(void);
 
diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index 1c3198445d..90b2a22591 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -4,20 +4,11 @@
  * Adapted for Xen: Ryan Harper <ryanh@us.ibm.com>
  */ 
 
-#include <xen/mm.h>
-#include <xen/string.h>
 #include <xen/init.h>
-#include <xen/ctype.h>
+#include <xen/mm.h>
 #include <xen/nodemask.h>
 #include <xen/numa.h>
-#include <xen/keyhandler.h>
-#include <xen/param.h>
-#include <xen/time.h>
-#include <xen/smp.h>
-#include <xen/pfn.h>
 #include <asm/acpi.h>
-#include <xen/sched.h>
-#include <xen/softirq.h>
 
 #ifndef Dprintk
 #define Dprintk(x...)
@@ -26,28 +17,13 @@
 /* from proto.h */
 #define round_up(x,y) ((((x)+(y))-1) & (~((y)-1)))
 
-struct node_data node_data[MAX_NUMNODES];
-
-/* Mapping from pdx to node id */
-int memnode_shift;
-static typeof(*memnodemap) _memnodemap[64];
-unsigned long memnodemapsize;
-u8 *memnodemap;
-
-nodeid_t cpu_to_node[NR_CPUS] __read_mostly = {
-    [0 ... NR_CPUS-1] = NUMA_NO_NODE
-};
 /*
  * Keep BIOS's CPU2node information, should not be used for memory allocaion
  */
 nodeid_t apicid_to_node[MAX_LOCAL_APIC] = {
     [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
 };
-cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly;
 
-nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
-
-bool numa_off;
 s8 acpi_numa = 0;
 
 int __init arch_numa_setup(const char *opt)
@@ -69,270 +45,6 @@ bool arch_numa_disabled(void)
     return acpi_numa < 0;
 }
 
-bool srat_disabled(void)
-{
-    return numa_off || arch_numa_disabled();
-}
-
-/*
- * Given a shift value, try to populate memnodemap[]
- * Returns :
- * 1 if OK
- * 0 if memnodmap[] too small (of shift too small)
- * -1 if node overlap or lost ram (shift too big)
- */
-static int __init populate_memnodemap(const struct node *nodes,
-                                      int numnodes, int shift, nodeid_t *nodeids)
-{
-    int i, res = -1;
-
-    memset(memnodemap, NUMA_NO_NODE, memnodemapsize * sizeof(*memnodemap));
-    for ( i = 0; i < numnodes; i++ )
-    {
-        unsigned long spdx = paddr_to_pdx(nodes[i].start);
-        unsigned long epdx = paddr_to_pdx(nodes[i].end - 1);
-
-        if ( spdx > epdx )
-            continue;
-        if ( (epdx >> shift) >= memnodemapsize )
-            return 0;
-        do {
-            if ( memnodemap[spdx >> shift] != NUMA_NO_NODE &&
-                 (!nodeids || memnodemap[spdx >> shift] != nodeids[i]) )
-                return -1;
-
-            if ( !nodeids )
-                memnodemap[spdx >> shift] = i;
-            else
-                memnodemap[spdx >> shift] = nodeids[i];
-
-            spdx += (1UL << shift);
-        } while ( spdx <= epdx );
-        res = 1;
-    }
-
-    return res;
-}
-
-static int __init allocate_cachealigned_memnodemap(void)
-{
-    unsigned long size = PFN_UP(memnodemapsize * sizeof(*memnodemap));
-    unsigned long mfn = mfn_x(alloc_boot_pages(size, 1));
-
-    memnodemap = mfn_to_virt(mfn);
-    mfn <<= PAGE_SHIFT;
-    size <<= PAGE_SHIFT;
-    printk(KERN_DEBUG "NUMA: Allocated memnodemap from %lx - %lx\n",
-           mfn, mfn + size);
-    memnodemapsize = size / sizeof(*memnodemap);
-
-    return 0;
-}
-
-/*
- * The LSB of all start addresses in the node map is the value of the
- * maximum possible shift.
- */
-static int __init extract_lsb_from_nodes(const struct node *nodes,
-                                         int numnodes, const nodeid_t *nodeids)
-{
-    int i, nodes_used = 0;
-    unsigned long spdx, epdx;
-    unsigned long bitfield = 0, memtop = 0;
-
-    for ( i = 0; i < numnodes; i++ )
-    {
-        spdx = paddr_to_pdx(nodes[i].start);
-        epdx = paddr_to_pdx(nodes[i].end - 1) + 1;
-        if ( spdx >= epdx )
-            continue;
-        if ( i && (!nodeids || nodeids[i - 1] != nodeids[i]) )
-            bitfield |= spdx;
-        if ( !i || !nodeids || nodeids[i - 1] != nodeids[i] )
-            nodes_used++;
-        if ( epdx > memtop )
-            memtop = epdx;
-    }
-    if ( nodes_used <= 1 )
-        i = BITS_PER_LONG - 1;
-    else
-        i = find_first_bit(&bitfield, sizeof(unsigned long)*8);
-    memnodemapsize = ((memtop - 1) >> i) + 1;
-    return i;
-}
-
-int __init compute_hash_shift(struct node *nodes, int numnodes,
-                              nodeid_t *nodeids)
-{
-    int shift;
-
-    shift = extract_lsb_from_nodes(nodes, numnodes, nodeids);
-    if ( memnodemapsize <= ARRAY_SIZE(_memnodemap) )
-        memnodemap = _memnodemap;
-    else if ( allocate_cachealigned_memnodemap() )
-        return -1;
-    printk(KERN_DEBUG "NUMA: Using %d for the hash shift.\n", shift);
-
-    if ( populate_memnodemap(nodes, numnodes, shift, nodeids) != 1 )
-    {
-        printk(KERN_INFO "Your memory is not aligned you need to "
-               "rebuild your hypervisor with a bigger NODEMAPSIZE "
-               "shift=%d\n", shift);
-        return -1;
-    }
-
-    return shift;
-}
-/* initialize NODE_DATA given nodeid and start/end */
-void __init setup_node_bootmem(nodeid_t nodeid, paddr_t start, paddr_t end)
-{
-    unsigned long start_pfn = paddr_to_pfn(start);
-    unsigned long end_pfn = paddr_to_pfn(end);
-
-    NODE_DATA(nodeid)->node_start_pfn = start_pfn;
-    NODE_DATA(nodeid)->node_spanned_pages = end_pfn - start_pfn;
-
-    node_set_online(nodeid);
-} 
-
-void __init numa_init_array(void)
-{
-    int rr, i;
-
-    /* There are unfortunately some poorly designed mainboards around
-       that only connect memory to a single CPU. This breaks the 1:1 cpu->node
-       mapping. To avoid this fill in the mapping for all possible
-       CPUs, as the number of CPUs is not known yet.
-       We round robin the existing nodes. */
-    rr = first_node(node_online_map);
-    for ( i = 0; i < nr_cpu_ids; i++ )
-    {
-        if ( cpu_to_node[i] != NUMA_NO_NODE )
-            continue;
-        numa_set_node(i, rr);
-        rr = cycle_node(rr, node_online_map);
-    }
-}
-
-#ifdef CONFIG_NUMA_EMU
-static int numa_fake __initdata = 0;
-
-/* Numa emulation */
-static int __init numa_emulation(unsigned long start_pfn,
-                                 unsigned long end_pfn)
-{
-    int i;
-    struct node nodes[MAX_NUMNODES];
-    uint64_t sz = pfn_to_paddr(end_pfn - start_pfn) / numa_fake;
-
-    /* Kludge needed for the hash function */
-    if ( hweight64(sz) > 1 )
-    {
-        u64 x = 1;
-        while ( (x << 1) < sz )
-            x <<= 1;
-        if ( x < sz/2 )
-            printk(KERN_ERR "Numa emulation unbalanced. Complain to maintainer\n");
-        sz = x;
-    }
-
-    memset(&nodes,0,sizeof(nodes));
-    for ( i = 0; i < numa_fake; i++ )
-    {
-        nodes[i].start = pfn_to_paddr(start_pfn) + i * sz;
-        if ( i == numa_fake - 1 )
-            sz = pfn_to_paddr(end_pfn) - nodes[i].start;
-        nodes[i].end = nodes[i].start + sz;
-        printk(KERN_INFO "Faking node %d at %"PRIx64"-%"PRIx64" (%"PRIu64"MB)\n",
-               i,
-               nodes[i].start, nodes[i].end,
-               (nodes[i].end - nodes[i].start) >> 20);
-        node_set_online(i);
-    }
-    memnode_shift = compute_hash_shift(nodes, numa_fake, NULL);
-    if ( memnode_shift < 0 )
-    {
-        memnode_shift = 0;
-        printk(KERN_ERR "No NUMA hash function found. Emulation disabled.\n");
-        return -1;
-    }
-    for_each_online_node ( i )
-        setup_node_bootmem(i, nodes[i].start, nodes[i].end);
-    numa_init_array();
-
-    return 0;
-}
-#endif
-
-void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
-{ 
-    int i;
-    paddr_t start = pfn_to_paddr(start_pfn);
-    paddr_t end = pfn_to_paddr(end_pfn);
-
-#ifdef CONFIG_NUMA_EMU
-    if ( numa_fake && !numa_emulation(start_pfn, end_pfn) )
-        return;
-#endif
-
-#ifdef CONFIG_ACPI_NUMA
-    if ( !numa_off && !acpi_scan_nodes(start, end) )
-        return;
-#endif
-
-    printk(KERN_INFO "%s\n",
-           numa_off ? "NUMA turned off" : "No NUMA configuration found");
-
-    printk(KERN_INFO "Faking a node at %"PRIpaddr"-%"PRIpaddr"\n",
-           start, end);
-    /* setup dummy node covering all memory */
-    memnode_shift = BITS_PER_LONG - 1;
-    memnodemap = _memnodemap;
-    /* Dummy node only uses 1 slot in reality */
-    memnodemap[0] = 0;
-    memnodemapsize = 1;
-
-    nodes_clear(node_online_map);
-    node_set_online(0);
-    for ( i = 0; i < nr_cpu_ids; i++ )
-        numa_set_node(i, 0);
-    cpumask_copy(&node_to_cpumask[0], cpumask_of(0));
-    setup_node_bootmem(0, start, end);
-}
-
-void numa_add_cpu(int cpu)
-{
-    cpumask_set_cpu(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
-} 
-
-void numa_set_node(int cpu, nodeid_t node)
-{
-    cpu_to_node[cpu] = node;
-}
-
-/* [numa=off] */
-static int __init cf_check numa_setup(const char *opt)
-{
-    if ( !strncmp(opt, "off", 3) )
-        numa_off = true;
-    else if ( !strncmp(opt, "on", 2) )
-        numa_off = false;
-#ifdef CONFIG_NUMA_EMU
-    else if ( !strncmp(opt, "fake=", 5) )
-    {
-        numa_off = false;
-        numa_fake = simple_strtoul(opt + 5, NULL, 0);
-        if ( numa_fake >= MAX_NUMNODES )
-            numa_fake = MAX_NUMNODES;
-    }
-#endif
-    else
-        return arch_numa_setup(opt);
-
-    return 0;
-} 
-custom_param("numa", numa_setup);
-
 /*
  * Setup early cpu_to_node.
  *
@@ -381,146 +93,3 @@ unsigned int __init arch_get_dma_bitsize(void)
                  flsl(node_start_pfn(node) + node_spanned_pages(node) / 4 - 1)
                  + PAGE_SHIFT, 32);
 }
-
-static void cf_check dump_numa(unsigned char key)
-{
-    s_time_t now = NOW();
-    unsigned int i, j, n;
-    struct domain *d;
-    struct page_info *page;
-    unsigned int page_num_node[MAX_NUMNODES];
-    const struct vnuma_info *vnuma;
-
-    printk("'%c' pressed -> dumping numa info (now = %"PRI_stime")\n", key,
-           now);
-
-    for_each_online_node ( i )
-    {
-        paddr_t pa = pfn_to_paddr(node_start_pfn(i) + 1);
-
-        printk("NODE%u start->%lu size->%lu free->%lu\n",
-               i, node_start_pfn(i), node_spanned_pages(i),
-               avail_node_heap_pages(i));
-        /* sanity check phys_to_nid() */
-        if ( phys_to_nid(pa) != i )
-            printk("phys_to_nid(%"PRIpaddr") -> %d should be %u\n",
-                   pa, phys_to_nid(pa), i);
-    }
-
-    j = cpumask_first(&cpu_online_map);
-    n = 0;
-    for_each_online_cpu ( i )
-    {
-        if ( i != j + n || cpu_to_node[j] != cpu_to_node[i] )
-        {
-            if ( n > 1 )
-                printk("CPU%u...%u -> NODE%d\n", j, j + n - 1, cpu_to_node[j]);
-            else
-                printk("CPU%u -> NODE%d\n", j, cpu_to_node[j]);
-            j = i;
-            n = 1;
-        }
-        else
-            ++n;
-    }
-    if ( n > 1 )
-        printk("CPU%u...%u -> NODE%d\n", j, j + n - 1, cpu_to_node[j]);
-    else
-        printk("CPU%u -> NODE%d\n", j, cpu_to_node[j]);
-
-    rcu_read_lock(&domlist_read_lock);
-
-    printk("Memory location of each domain:\n");
-    for_each_domain ( d )
-    {
-        process_pending_softirqs();
-
-        printk("Domain %u (total: %u):\n", d->domain_id, domain_tot_pages(d));
-
-        for_each_online_node ( i )
-            page_num_node[i] = 0;
-
-        spin_lock(&d->page_alloc_lock);
-        page_list_for_each(page, &d->page_list)
-        {
-            i = phys_to_nid(page_to_maddr(page));
-            page_num_node[i]++;
-        }
-        spin_unlock(&d->page_alloc_lock);
-
-        for_each_online_node ( i )
-            printk("    Node %u: %u\n", i, page_num_node[i]);
-
-        if ( !read_trylock(&d->vnuma_rwlock) )
-            continue;
-
-        if ( !d->vnuma )
-        {
-            read_unlock(&d->vnuma_rwlock);
-            continue;
-        }
-
-        vnuma = d->vnuma;
-        printk("     %u vnodes, %u vcpus, guest physical layout:\n",
-               vnuma->nr_vnodes, d->max_vcpus);
-        for ( i = 0; i < vnuma->nr_vnodes; i++ )
-        {
-            unsigned int start_cpu = ~0U;
-
-            if ( vnuma->vnode_to_pnode[i] == NUMA_NO_NODE )
-                printk("       %3u: pnode ???,", i);
-            else
-                printk("       %3u: pnode %3u,", i, vnuma->vnode_to_pnode[i]);
-
-            printk(" vcpus ");
-
-            for ( j = 0; j < d->max_vcpus; j++ )
-            {
-                if ( !(j & 0x3f) )
-                    process_pending_softirqs();
-
-                if ( vnuma->vcpu_to_vnode[j] == i )
-                {
-                    if ( start_cpu == ~0U )
-                    {
-                        printk("%d", j);
-                        start_cpu = j;
-                    }
-                }
-                else if ( start_cpu != ~0U )
-                {
-                    if ( j - 1 != start_cpu )
-                        printk("-%d ", j - 1);
-                    else
-                        printk(" ");
-                    start_cpu = ~0U;
-                }
-            }
-
-            if ( start_cpu != ~0U  && start_cpu != j - 1 )
-                printk("-%d", j - 1);
-
-            printk("\n");
-
-            for ( j = 0; j < vnuma->nr_vmemranges; j++ )
-            {
-                if ( vnuma->vmemrange[j].nid == i )
-                    printk("           %016"PRIx64" - %016"PRIx64"\n",
-                           vnuma->vmemrange[j].start,
-                           vnuma->vmemrange[j].end);
-            }
-        }
-
-        read_unlock(&d->vnuma_rwlock);
-    }
-
-    rcu_read_unlock(&domlist_read_lock);
-}
-
-static int __init cf_check register_numa_trigger(void)
-{
-    register_keyhandler('u', dump_numa, "dump NUMA info", 1);
-    return 0;
-}
-__initcall(register_numa_trigger);
-
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index a238aa1f14..52beed9d8d 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -1350,7 +1350,7 @@ int cpu_add(uint32_t apic_id, uint32_t acpi_id, uint32_t pxm)
 
     x86_acpiid_to_apicid[acpi_id] = apic_id;
 
-    if ( !srat_disabled() )
+    if ( !numa_disabled() )
     {
         nodeid_t node = setup_node(pxm);
 
diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
index fbcd8749c4..ce507dac9e 100644
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -238,7 +238,7 @@ acpi_numa_x2apic_affinity_init(const struct acpi_srat_x2apic_cpu_affinity *pa)
 	unsigned pxm;
 	nodeid_t node;
 
-	if (srat_disabled())
+	if (numa_disabled())
 		return;
 	if (pa->header.length < sizeof(struct acpi_srat_x2apic_cpu_affinity)) {
 		bad_srat();
@@ -274,7 +274,7 @@ acpi_numa_processor_affinity_init(const struct acpi_srat_cpu_affinity *pa)
 	unsigned pxm;
 	nodeid_t node;
 
-	if (srat_disabled())
+	if (numa_disabled())
 		return;
 	if (pa->header.length != sizeof(struct acpi_srat_cpu_affinity)) {
 		bad_srat();
@@ -314,7 +314,7 @@ acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma)
 	unsigned int i;
 	bool next = false;
 
-	if (srat_disabled())
+	if (numa_disabled())
 		return;
 	if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) {
 		bad_srat();
@@ -543,8 +543,8 @@ void __init srat_parse_regions(paddr_t addr)
 	pfn_pdx_hole_setup(mask >> PAGE_SHIFT);
 }
 
-/* Use the information discovered above to actually set up the nodes. */
-int __init acpi_scan_nodes(paddr_t start, paddr_t end)
+/* Use discovered information to actually set up the nodes. */
+int __init numa_process_nodes(paddr_t start, paddr_t end)
 {
 	int i;
 	nodemask_t all_nodes_parsed;
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 3baf83d527..9a3a12b12d 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += memory.o
 obj-y += multicall.o
 obj-y += notifier.o
+obj-$(CONFIG_NUMA) += numa.o
 obj-y += page_alloc.o
 obj-$(CONFIG_HAS_PDX) += pdx.o
 obj-$(CONFIG_PERF_COUNTERS) += perfc.o
diff --git a/xen/common/numa.c b/xen/common/numa.c
new file mode 100644
index 0000000000..a135154c3e
--- /dev/null
+++ b/xen/common/numa.c
@@ -0,0 +1,464 @@
+/*
+ * Generic VM initialization for NUMA setups.
+ * Copyright 2002,2003 Andi Kleen, SuSE Labs.
+ * Adapted for Xen: Ryan Harper <ryanh@us.ibm.com>
+ */
+
+#include <xen/init.h>
+#include <xen/keyhandler.h>
+#include <xen/mm.h>
+#include <xen/nodemask.h>
+#include <xen/numa.h>
+#include <xen/param.h>
+#include <xen/sched.h>
+#include <xen/softirq.h>
+
+struct node_data __ro_after_init node_data[MAX_NUMNODES];
+
+/* Mapping from pdx to node id */
+unsigned int __ro_after_init memnode_shift;
+unsigned long __ro_after_init memnodemapsize;
+nodeid_t *__ro_after_init memnodemap;
+static typeof(*memnodemap) __ro_after_init _memnodemap[64];
+
+nodeid_t __read_mostly cpu_to_node[NR_CPUS] = {
+    [0 ... NR_CPUS-1] = NUMA_NO_NODE
+};
+
+cpumask_t __read_mostly node_to_cpumask[MAX_NUMNODES];
+
+nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
+
+bool __ro_after_init numa_off;
+
+bool numa_disabled(void)
+{
+    return numa_off || arch_numa_disabled();
+}
+
+/*
+ * Given a shift value, try to populate memnodemap[]
+ * Returns :
+ * 1 if OK
+ * 0 if memnodmap[] too small (or shift too small)
+ * -1 if node overlap or lost ram (shift too big)
+ */
+static int __init populate_memnodemap(const struct node *nodes,
+                                      unsigned int numnodes, unsigned int shift,
+                                      const nodeid_t *nodeids)
+{
+    unsigned int i;
+    int res = -1;
+
+    memset(memnodemap, NUMA_NO_NODE, memnodemapsize * sizeof(*memnodemap));
+
+    for ( i = 0; i < numnodes; i++ )
+    {
+        unsigned long spdx = paddr_to_pdx(nodes[i].start);
+        unsigned long epdx = paddr_to_pdx(nodes[i].end - 1);
+
+        if ( spdx > epdx )
+            continue;
+
+        if ( (epdx >> shift) >= memnodemapsize )
+            return 0;
+
+        do {
+            if ( memnodemap[spdx >> shift] != NUMA_NO_NODE &&
+                 (!nodeids || memnodemap[spdx >> shift] != nodeids[i]) )
+                return -1;
+
+            if ( !nodeids )
+                memnodemap[spdx >> shift] = i;
+            else
+                memnodemap[spdx >> shift] = nodeids[i];
+
+            spdx += (1UL << shift);
+        } while ( spdx <= epdx );
+
+        res = 1;
+    }
+
+    return res;
+}
+
+static int __init allocate_cachealigned_memnodemap(void)
+{
+    unsigned long size = PFN_UP(memnodemapsize * sizeof(*memnodemap));
+    unsigned long mfn = mfn_x(alloc_boot_pages(size, 1));
+
+    memnodemap = mfn_to_virt(mfn);
+    mfn <<= PAGE_SHIFT;
+    size <<= PAGE_SHIFT;
+    printk(KERN_DEBUG "NUMA: Allocated memnodemap from %lx - %lx\n",
+           mfn, mfn + size);
+    memnodemapsize = size / sizeof(*memnodemap);
+
+    return 0;
+}
+
+/*
+ * The LSB of all start addresses in the node map is the value of the
+ * maximum possible shift.
+ */
+static unsigned int __init extract_lsb_from_nodes(const struct node *nodes,
+                                                  nodeid_t numnodes,
+                                                  const nodeid_t *nodeids)
+{
+    unsigned int i, nodes_used = 0;
+    unsigned long bitfield = 0, memtop = 0;
+
+    for ( i = 0; i < numnodes; i++ )
+    {
+        unsigned long spdx = paddr_to_pdx(nodes[i].start);
+        unsigned long epdx = paddr_to_pdx(nodes[i].end - 1) + 1;
+
+        if ( spdx >= epdx )
+            continue;
+
+        if ( i && (!nodeids || nodeids[i - 1] != nodeids[i]) )
+            bitfield |= spdx;
+
+        if ( !i || !nodeids || nodeids[i - 1] != nodeids[i] )
+            nodes_used++;
+
+        if ( epdx > memtop )
+            memtop = epdx;
+    }
+
+    if ( nodes_used <= 1 )
+        i = min(PADDR_BITS, BITS_PER_LONG - 1);
+    else
+        i = find_first_bit(&bitfield, sizeof(unsigned long) * 8);
+
+    memnodemapsize = ((memtop - 1) >> i) + 1;
+
+    return i;
+}
+
+int __init compute_hash_shift(const struct node *nodes,
+                              unsigned int numnodes, const nodeid_t *nodeids)
+{
+    unsigned int shift = extract_lsb_from_nodes(nodes, numnodes, nodeids);
+
+    if ( memnodemapsize <= ARRAY_SIZE(_memnodemap) )
+        memnodemap = _memnodemap;
+    else if ( allocate_cachealigned_memnodemap() )
+        return -1;
+
+    printk(KERN_DEBUG "NUMA: Using %u for the hash shift\n", shift);
+
+    if ( populate_memnodemap(nodes, numnodes, shift, nodeids) != 1 )
+    {
+        printk(KERN_INFO "Your memory is not aligned you need to "
+               "rebuild your hypervisor with a bigger NODEMAPSIZE "
+               "shift=%u\n", shift);
+        return -1;
+    }
+
+    return shift;
+}
+
+/* Initialize NODE_DATA given nodeid and start/end */
+void __init setup_node_bootmem(nodeid_t nodeid, paddr_t start, paddr_t end)
+{
+    unsigned long start_pfn = paddr_to_pfn(start);
+    unsigned long end_pfn = paddr_to_pfn(end);
+
+    NODE_DATA(nodeid)->node_start_pfn = start_pfn;
+    NODE_DATA(nodeid)->node_spanned_pages = end_pfn - start_pfn;
+
+    node_set_online(nodeid);
+}
+
+void __init numa_init_array(void)
+{
+    unsigned int i;
+    nodeid_t rr;
+
+    /*
+     * There are unfortunately some poorly designed mainboards
+     * around that only connect memory to a single CPU. This
+     * breaks the 1:1 cpu->node mapping. To avoid this fill in
+     * the mapping for all possible CPUs, as the number of CPUs
+     * is not known yet. We round robin the existing nodes.
+     */
+    rr = first_node(node_online_map);
+    for ( i = 0; i < nr_cpu_ids; i++ )
+    {
+        if ( cpu_to_node[i] != NUMA_NO_NODE )
+            continue;
+        numa_set_node(i, rr);
+        rr = cycle_node(rr, node_online_map);
+    }
+}
+
+#ifdef CONFIG_NUMA_EMU
+static unsigned int __initdata numa_fake;
+
+/* Numa emulation */
+static int __init numa_emulation(unsigned long start_pfn,
+                                 unsigned long end_pfn)
+{
+    int ret;
+    unsigned int i;
+    struct node nodes[MAX_NUMNODES];
+    uint64_t sz = pfn_to_paddr(end_pfn - start_pfn) / numa_fake;
+
+    /* Kludge needed for the hash function */
+    if ( hweight64(sz) > 1 )
+    {
+        uint64_t x = 1;
+
+        while ( (x << 1) < sz )
+            x <<= 1;
+        if ( x < sz / 2 )
+            printk(KERN_ERR "Numa emulation unbalanced. Complain to maintainer\n");
+        sz = x;
+    }
+
+    memset(&nodes, 0, sizeof(nodes));
+    for ( i = 0; i < numa_fake; i++ )
+    {
+        nodes[i].start = pfn_to_paddr(start_pfn) + i * sz;
+
+        if ( i == numa_fake - 1 )
+            sz = pfn_to_paddr(end_pfn) - nodes[i].start;
+
+        nodes[i].end = nodes[i].start + sz;
+        printk(KERN_INFO "Faking node %u at %"PRIx64"-%"PRIx64" (%"PRIu64"MB)\n",
+               i, nodes[i].start, nodes[i].end,
+               (nodes[i].end - nodes[i].start) >> 20);
+        node_set_online(i);
+    }
+
+    ret = compute_hash_shift(nodes, numa_fake, NULL);
+    if ( ret < 0 )
+    {
+        printk(KERN_ERR "No NUMA hash function found. Emulation disabled.\n");
+        return -1;
+    }
+    memnode_shift = ret;
+
+    for_each_online_node ( i )
+        setup_node_bootmem(i, nodes[i].start, nodes[i].end);
+
+    numa_init_array();
+
+    return 0;
+}
+#endif
+
+void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
+{
+    unsigned int i;
+    paddr_t start = pfn_to_paddr(start_pfn);
+    paddr_t end = pfn_to_paddr(end_pfn);
+
+#ifdef CONFIG_NUMA_EMU
+    if ( numa_fake && !numa_emulation(start_pfn, end_pfn) )
+        return;
+#endif
+
+#ifdef CONFIG_NUMA
+    if ( !numa_off && !numa_process_nodes(start, end) )
+        return;
+#endif
+
+    printk(KERN_INFO "%s\n",
+           numa_off ? "NUMA turned off" : "No NUMA configuration found");
+
+    printk(KERN_INFO "Faking a node at %"PRIpaddr"-%"PRIpaddr"\n",
+           start, end);
+
+    /* Setup dummy node covering all memory */
+    memnode_shift = BITS_PER_LONG - 1;
+    memnodemap = _memnodemap;
+
+    /* Dummy node only uses 1 slot in reality */
+    memnodemap[0] = 0;
+    memnodemapsize = 1;
+
+    nodes_clear(node_online_map);
+    node_set_online(0);
+    for ( i = 0; i < nr_cpu_ids; i++ )
+        numa_set_node(i, 0);
+
+    cpumask_copy(&node_to_cpumask[0], cpumask_of(0));
+    setup_node_bootmem(0, start, end);
+}
+
+void numa_add_cpu(unsigned int cpu)
+{
+    cpumask_set_cpu(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
+}
+
+void numa_set_node(unsigned int cpu, nodeid_t node)
+{
+    cpu_to_node[cpu] = node;
+}
+
+/* [numa=off] */
+static int __init cf_check numa_setup(const char *opt)
+{
+    if ( !strncmp(opt, "off", 3) )
+        numa_off = true;
+    else if ( !strncmp(opt, "on", 2) )
+        numa_off = false;
+#ifdef CONFIG_NUMA_EMU
+    else if ( !strncmp(opt, "fake=", 5) )
+    {
+        numa_off = false;
+        numa_fake = simple_strtoul(opt + 5, NULL, 0);
+        if ( numa_fake >= MAX_NUMNODES )
+            numa_fake = MAX_NUMNODES;
+    }
+#endif
+    else
+        return arch_numa_setup(opt);
+
+    return 0;
+}
+custom_param("numa", numa_setup);
+
+static void cf_check dump_numa(unsigned char key)
+{
+    s_time_t now = NOW();
+    unsigned int i, j, n;
+    struct domain *d;
+
+    printk("'%c' pressed -> dumping numa info (now = %"PRI_stime")\n", key,
+           now);
+
+    for_each_online_node ( i )
+    {
+        paddr_t pa = pfn_to_paddr(node_start_pfn(i) + 1);
+
+        printk("NODE%u start->%lu size->%lu free->%lu\n",
+               i, node_start_pfn(i), node_spanned_pages(i),
+               avail_node_heap_pages(i));
+        /* Sanity check phys_to_nid() */
+        if ( phys_to_nid(pa) != i )
+            printk("phys_to_nid(%"PRIpaddr") -> %d should be %u\n",
+                   pa, phys_to_nid(pa), i);
+    }
+
+    j = cpumask_first(&cpu_online_map);
+    n = 0;
+    for_each_online_cpu ( i )
+    {
+        if ( i != j + n || cpu_to_node[j] != cpu_to_node[i] )
+        {
+            if ( n > 1 )
+                printk("CPU%u...%u -> NODE%d\n", j, j + n - 1, cpu_to_node[j]);
+            else
+                printk("CPU%u -> NODE%d\n", j, cpu_to_node[j]);
+            j = i;
+            n = 1;
+        }
+        else
+            ++n;
+    }
+    if ( n > 1 )
+        printk("CPU%u...%u -> NODE%d\n", j, j + n - 1, cpu_to_node[j]);
+    else
+        printk("CPU%u -> NODE%d\n", j, cpu_to_node[j]);
+
+    rcu_read_lock(&domlist_read_lock);
+
+    printk("Memory location of each domain:\n");
+    for_each_domain ( d )
+    {
+        const struct page_info *page;
+        unsigned int page_num_node[MAX_NUMNODES];
+        const struct vnuma_info *vnuma;
+
+        process_pending_softirqs();
+
+        printk("%pd (total: %u):\n", d, domain_tot_pages(d));
+
+        memset(page_num_node, 0, sizeof(page_num_node));
+
+        spin_lock(&d->page_alloc_lock);
+        page_list_for_each ( page, &d->page_list )
+        {
+            i = phys_to_nid(page_to_maddr(page));
+            page_num_node[i]++;
+        }
+        spin_unlock(&d->page_alloc_lock);
+
+        for_each_online_node ( i )
+            printk("    Node %u: %u\n", i, page_num_node[i]);
+
+        if ( !read_trylock(&d->vnuma_rwlock) )
+            continue;
+
+        if ( !d->vnuma )
+        {
+            read_unlock(&d->vnuma_rwlock);
+            continue;
+        }
+
+        vnuma = d->vnuma;
+        printk("     %u vnodes, %u vcpus, guest physical layout:\n",
+               vnuma->nr_vnodes, d->max_vcpus);
+        for ( i = 0; i < vnuma->nr_vnodes; i++ )
+        {
+            unsigned int start_cpu = ~0U;
+
+            if ( vnuma->vnode_to_pnode[i] == NUMA_NO_NODE )
+                printk("       %3u: pnode ???,", i);
+            else
+                printk("       %3u: pnode %3u,", i, vnuma->vnode_to_pnode[i]);
+
+            printk(" vcpus ");
+
+            for ( j = 0; j < d->max_vcpus; j++ )
+            {
+                if ( !(j & 0x3f) )
+                    process_pending_softirqs();
+
+                if ( vnuma->vcpu_to_vnode[j] == i )
+                {
+                    if ( start_cpu == ~0U )
+                    {
+                        printk("%u", j);
+                        start_cpu = j;
+                    }
+                }
+                else if ( start_cpu != ~0U )
+                {
+                    if ( j - 1 != start_cpu )
+                        printk("-%u ", j - 1);
+                    else
+                        printk(" ");
+                    start_cpu = ~0U;
+                }
+            }
+
+            if ( start_cpu != ~0U  && start_cpu != j - 1 )
+                printk("-%u", j - 1);
+
+            printk("\n");
+
+            for ( j = 0; j < vnuma->nr_vmemranges; j++ )
+            {
+                if ( vnuma->vmemrange[j].nid == i )
+                    printk("           %016"PRIx64" - %016"PRIx64"\n",
+                           vnuma->vmemrange[j].start,
+                           vnuma->vmemrange[j].end);
+            }
+        }
+
+        read_unlock(&d->vnuma_rwlock);
+    }
+
+    rcu_read_unlock(&domlist_read_lock);
+}
+
+static int __init cf_check register_numa_trigger(void)
+{
+    register_keyhandler('u', dump_numa, "dump NUMA info", 1);
+    return 0;
+}
+__initcall(register_numa_trigger);
diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
index 7aef1a88dc..5b3877344b 100644
--- a/xen/include/xen/numa.h
+++ b/xen/include/xen/numa.h
@@ -18,4 +18,70 @@
   (((d)->vcpu != NULL && (d)->vcpu[0] != NULL) \
    ? vcpu_to_node((d)->vcpu[0]) : NUMA_NO_NODE)
 
+/* The following content can be used when NUMA feature is enabled */
+#ifdef CONFIG_NUMA
+
+extern nodeid_t      cpu_to_node[NR_CPUS];
+extern cpumask_t     node_to_cpumask[];
+
+#define cpu_to_node(cpu)        cpu_to_node[cpu]
+#define parent_node(node)       (node)
+#define node_to_cpumask(node)   node_to_cpumask[node]
+
+struct node {
+    paddr_t start, end;
+};
+
+extern int compute_hash_shift(const struct node *nodes,
+                              unsigned int numnodes, const nodeid_t *nodeids);
+
+#define VIRTUAL_BUG_ON(x)
+
+extern bool numa_off;
+
+extern void numa_add_cpu(unsigned int cpu);
+extern void numa_init_array(void);
+extern void numa_set_node(unsigned int cpu, nodeid_t node);
+extern void numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn);
+extern int numa_process_nodes(paddr_t start, paddr_t end);
+
+extern int arch_numa_setup(const char *opt);
+extern bool arch_numa_disabled(void);
+extern void setup_node_bootmem(nodeid_t nodeid, paddr_t start, paddr_t end);
+
+static inline void clear_node_cpumask(unsigned int cpu)
+{
+    cpumask_clear_cpu(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
+}
+
+/* Simple perfect hash to map pdx to node numbers */
+extern unsigned int memnode_shift;
+extern unsigned long memnodemapsize;
+extern uint8_t *memnodemap;
+
+struct node_data {
+    unsigned long node_start_pfn;
+    unsigned long node_spanned_pages;
+};
+
+extern struct node_data node_data[];
+
+static inline nodeid_t __attribute_pure__ phys_to_nid(paddr_t addr)
+{
+    nodeid_t nid;
+    VIRTUAL_BUG_ON((paddr_to_pdx(addr) >> memnode_shift) >= memnodemapsize);
+    nid = memnodemap[paddr_to_pdx(addr) >> memnode_shift];
+    VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]);
+    return nid;
+}
+
+#define NODE_DATA(nid)          (&node_data[nid])
+
+#define node_start_pfn(nid)     (NODE_DATA(nid)->node_start_pfn)
+#define node_spanned_pages(nid) (NODE_DATA(nid)->node_spanned_pages)
+#define node_end_pfn(nid)       (NODE_DATA(nid)->node_start_pfn + \
+                                 NODE_DATA(nid)->node_spanned_pages)
+
+#endif
+
 #endif /* _XEN_NUMA_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:44:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465452.724124 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gqt-0003LU-UO; Sat, 17 Dec 2022 23:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465452.724124; Sat, 17 Dec 2022 23: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 1p6gqt-0003LK-RQ; Sat, 17 Dec 2022 23:44:23 +0000
Received: by outflank-mailman (input) for mailman id 465452;
 Sat, 17 Dec 2022 23:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gqs-0003L3-Om
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gqs-0004H9-O0
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gqs-0001MN-N3
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gh4Iy4MDapPPcuNF8ZyJn1OX0SDoXFCtGOvqrBKFz/k=; b=SKFADCvPo3YV3/6rmQVcXokgiw
	7c9bf0w+CUUV/C6VjDWHmAdNumRSZ000RwFHfr651LSlOtJqQhFSRDO7Ve6/WG1cfvCewy5r2H6ti
	7o9/IlFcLsOnaOdeCXefKP5HHBNv+ox6OahekcaUuiIx6WgdL71WeTH2nkQwSMB2aBdM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: Use ASSERT instead of VIRTUAL_BUG_ON for phys_to_nid
Message-Id: <E1p6gqs-0001MN-N3@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:44:22 +0000

commit e9c72d524fbdb109c45f24acce998f0bd552fb6f
Author:     Wei Chen <wei.chen@arm.com>
AuthorDate: Mon Dec 12 12:13:26 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 12 12:13:26 2022 +0100

    xen/x86: Use ASSERT instead of VIRTUAL_BUG_ON for phys_to_nid
    
    VIRTUAL_BUG_ON is an empty macro used in phys_to_nid. This
    results in two lines of error-checking code in phys_to_nid
    that is not actually working and causing two compilation
    errors:
    1. error: "MAX_NUMNODES" undeclared (first use in this function).
       This is because in the common header file, "MAX_NUMNODES" is
       defined after the common header file includes the ARCH header
       file, where phys_to_nid has attempted to use "MAX_NUMNODES".
       This error was resolved after we moved the phys_to_nid from
       x86 ARCH header file to common header file.
    2. error: wrong type argument to unary exclamation mark.
       This is because, the error-checking code contains !node_data[nid].
       But node_data is a data structure variable, it's not a pointer.
    
    So, in this patch, we use ASSERT instead of VIRTUAL_BUG_ON to
    enable the two lines of error-checking code. And fix the left
    compilation errors by replacing !node_data[nid] to
    !node_data[nid].node_spanned_pages. Although NUMA allows one node
    can only have CPUs but without any memory. And node with 0 bytes
    of memory might have an entry in memnodemap[] theoretically. But
    that doesn't mean phys_to_nid can find any valid address from a
    node with 0 bytes memory.
    
    Signed-off-by: Wei Chen <wei.chen@arm.com>
    Tested-by: Jiamei Xie <jiamei.xie@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/numa.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
index 5b3877344b..04556f3a6f 100644
--- a/xen/include/xen/numa.h
+++ b/xen/include/xen/numa.h
@@ -35,8 +35,6 @@ struct node {
 extern int compute_hash_shift(const struct node *nodes,
                               unsigned int numnodes, const nodeid_t *nodeids);
 
-#define VIRTUAL_BUG_ON(x)
-
 extern bool numa_off;
 
 extern void numa_add_cpu(unsigned int cpu);
@@ -69,9 +67,9 @@ extern struct node_data node_data[];
 static inline nodeid_t __attribute_pure__ phys_to_nid(paddr_t addr)
 {
     nodeid_t nid;
-    VIRTUAL_BUG_ON((paddr_to_pdx(addr) >> memnode_shift) >= memnodemapsize);
+    ASSERT((paddr_to_pdx(addr) >> memnode_shift) < memnodemapsize);
     nid = memnodemap[paddr_to_pdx(addr) >> memnode_shift];
-    VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]);
+    ASSERT(nid < MAX_NUMNODES && node_data[nid].node_spanned_pages);
     return nid;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:44:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465453.724128 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gr3-0003Ot-Vg; Sat, 17 Dec 2022 23:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465453.724128; Sat, 17 Dec 2022 23:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gr3-0003Ok-T0; Sat, 17 Dec 2022 23:44:33 +0000
Received: by outflank-mailman (input) for mailman id 465453;
 Sat, 17 Dec 2022 23:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gr2-0003OX-SE
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gr2-0004HK-RQ
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gr2-0001Mm-QC
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qyvpDMgMzbOEDYMX4k48kQE6rlH/PJe9/DfgYRJ4Gjc=; b=zIrheEfsopSu3XIjm7B4wh/OiE
	67OpeeglOD+S7wHk160X0Y7P0TceeSyKbteFZIwLSOPdq9cFjxOYOiiBKnjr54OE2LhTw1SfdUcJg
	KoZnp32W8obN1rc59ohX6++ZLbVHHrWXbyTud5UCQwjfWhuCtTJ1TsgYRpH/+i/gr44s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: use arch_get_ram_range to get information from E820 map
Message-Id: <E1p6gr2-0001Mm-QC@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:44:32 +0000

commit cfee463c112b8ac261f6ca1d32e4c70e4821ba7a
Author:     Wei Chen <wei.chen@arm.com>
AuthorDate: Mon Dec 12 12:14:13 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 12 12:14:13 2022 +0100

    xen/x86: use arch_get_ram_range to get information from E820 map
    
    The sanity check of nodes_cover_memory is also a requirement of
    other architectures that support NUMA. But now, the code of
    nodes_cover_memory is tied to the x86 E820. In this case, we
    introduce arch_get_ram_range to decouple architecture specific
    memory map from this function. This means, other architectures
    like Arm can also use it to check its node and memory coverage
    from bootmem info.
    
    Depends arch_get_ram_range, we make nodes_cover_memory become
    architecture independent. We also use neutral words to replace
    SRAT and E820 in the print message of this function. This will
    to make the massage seems more common.
    
    As arch_get_ram_range use unsigned int for index, we also adjust
    the index in nodes_cover_memory from int to unsigned int.
    
    Signed-off-by: Wei Chen <wei.chen@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/numa.c    | 15 +++++++++++++++
 xen/arch/x86/srat.c    | 30 ++++++++++++++++++------------
 xen/include/xen/numa.h | 13 +++++++++++++
 3 files changed, 46 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index 90b2a22591..fa8caaa084 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -9,6 +9,7 @@
 #include <xen/nodemask.h>
 #include <xen/numa.h>
 #include <asm/acpi.h>
+#include <asm/e820.h>
 
 #ifndef Dprintk
 #define Dprintk(x...)
@@ -93,3 +94,17 @@ unsigned int __init arch_get_dma_bitsize(void)
                  flsl(node_start_pfn(node) + node_spanned_pages(node) / 4 - 1)
                  + PAGE_SHIFT, 32);
 }
+
+int __init arch_get_ram_range(unsigned int idx, paddr_t *start, paddr_t *end)
+{
+    if ( idx >= e820.nr_map )
+        return -ENOENT;
+
+    if ( e820.map[idx].type != E820_RAM )
+        return -ENODATA;
+
+    *start = e820.map[idx].addr;
+    *end = *start + e820.map[idx].size;
+
+    return 0;
+}
diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
index ce507dac9e..1a108a34c6 100644
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -452,37 +452,43 @@ acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma)
    Make sure the PXMs cover all memory. */
 static int __init nodes_cover_memory(void)
 {
-	int i;
+	unsigned int i;
 
-	for (i = 0; i < e820.nr_map; i++) {
-		int j, found;
+	for (i = 0; ; i++) {
+		int err;
+		unsigned int j;
+		bool found;
 		paddr_t start, end;
 
-		if (e820.map[i].type != E820_RAM) {
-			continue;
-		}
+		/* Try to loop memory map from index 0 to end to get RAM ranges. */
+		err = arch_get_ram_range(i, &start, &end);
 
-		start = e820.map[i].addr;
-		end = e820.map[i].addr + e820.map[i].size;
+		/* Reached the end of the memory map? */
+		if (err == -ENOENT)
+			break;
+
+		/* Skip non-RAM entries. */
+		if (err)
+			continue;
 
 		do {
-			found = 0;
+			found = false;
 			for_each_node_mask(j, memory_nodes_parsed)
 				if (start < nodes[j].end
 				    && end > nodes[j].start) {
 					if (start >= nodes[j].start) {
 						start = nodes[j].end;
-						found = 1;
+						found = true;
 					}
 					if (end <= nodes[j].end) {
 						end = nodes[j].start;
-						found = 1;
+						found = true;
 					}
 				}
 		} while (found && start < end);
 
 		if (start < end) {
-			printk(KERN_ERR "SRAT: No PXM for e820 range: "
+			printk(KERN_ERR "NUMA: No NODE for RAM range: "
 				"[%"PRIpaddr", %"PRIpaddr"]\n", start, end - 1);
 			return 0;
 		}
diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
index 04556f3a6f..9da0e7d555 100644
--- a/xen/include/xen/numa.h
+++ b/xen/include/xen/numa.h
@@ -80,6 +80,19 @@ static inline nodeid_t __attribute_pure__ phys_to_nid(paddr_t addr)
 #define node_end_pfn(nid)       (NODE_DATA(nid)->node_start_pfn + \
                                  NODE_DATA(nid)->node_spanned_pages)
 
+/*
+ * This function provides the ability for caller to get one RAM entry
+ * from architectural memory map by index.
+ *
+ * This function will return zero if it can return a proper RAM entry.
+ * Otherwise it will return -ENOENT for out of scope index, or other
+ * error codes, e.g. return -ENODATA for non-RAM type memory entry.
+ *
+ * Note: the range is exclusive at the end, e.g. [*start, *end).
+ */
+extern int arch_get_ram_range(unsigned int idx,
+                              paddr_t *start, paddr_t *end);
+
 #endif
 
 #endif /* _XEN_NUMA_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:44:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:44:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465454.724132 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6grE-0003RR-0z; Sat, 17 Dec 2022 23:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465454.724132; Sat, 17 Dec 2022 23:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6grD-0003RK-Ua; Sat, 17 Dec 2022 23:44:43 +0000
Received: by outflank-mailman (input) for mailman id 465454;
 Sat, 17 Dec 2022 23:44:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grD-0003R8-0V
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grC-0004Hp-W0
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grC-0001NK-UA
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IAvFwR7vmSlOgql/FQxLy4yz/++JUdlr/37K4O2YzyE=; b=W2jRFRsr2erEPpAYgo7YniRR8s
	VB7UBcYBmJ2Va99oWqu4zizXR1L7YMReUe7devfCbklkB1oAfY28+LP11f3i6Q3xRbrfwB74flQJ1
	uPdbemncGc8VCwjiVoB32rackqAC2oyX34ws7YD3/Zrf0+Hc6VXB1WlrLqe1M/PQ3X34=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: move NUMA process nodes nodes code from x86 to common
Message-Id: <E1p6grC-0001NK-UA@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:44:42 +0000

commit d46b1f5c29400a25bfc2492a649225a7915b04b2
Author:     Wei Chen <wei.chen@arm.com>
AuthorDate: Mon Dec 12 12:14:53 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 12 12:14:53 2022 +0100

    xen/x86: move NUMA process nodes nodes code from x86 to common
    
    x86 has implemented a set of codes to process NUMA nodes. These
    codes will parse NUMA memory and processor information from
    ACPI SRAT table. But except some ACPI specific codes, most
    of the process code like memory blocks validation, node memory
    range updates and some sanity check can be reused by other
    NUMA implementation.
    
    So in this patch, we move some variables and related functions
    for NUMA memory and processor to common as library. At the
    same time, numa_set_processor_nodes_parsed has been introduced
    for ACPI specific code to update processor parsing results.
    With this helper, we can reuse most of NUMA memory affinity init
    code from ACPI. As bad_srat and node_to_pxm functions have been
    used in common code to do architectural fallback and node to
    architectural node info translation. But it doesn't make sense
    to reuse the functions names in common code, we have rename them
    to neutral names as well.
    
    PXM is an ACPI specific item, we can't use it in common code
    directly. So we introduced an numa_fw_nid_name for each NUMA
    implementation to set their specific firmware NUMA node name.
    In this case, we do not need to retain a lot of per-arch code
    but still can print architectural log messages for different
    NUMA implementations. A default value "???" will be set to
    indicate an unset numa_fw_nid_name.
    
    mem_hotplug is accessed by common code if memory hotplug is
    activated. Even if this is only supported by x86, export the
    variable so that other architectures could support it in the future.
    
    As asm/acpi.h has been removed from common/numa.c, we have to
    move NR_NODE_MEMBLKS from asm/acpi.h to xen/numa.h in this patch
    as well.
    
    Signed-off-by: Wei Chen <wei.chen@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/acpi.h |   1 -
 xen/arch/x86/include/asm/mm.h   |   2 -
 xen/arch/x86/include/asm/numa.h |   3 +-
 xen/arch/x86/mm.c               |   2 -
 xen/arch/x86/numa.c             |   5 +
 xen/arch/x86/srat.c             | 337 ++++-----------------------------------
 xen/common/numa.c               | 341 +++++++++++++++++++++++++++++++++++++++-
 xen/common/page_alloc.c         |   2 +
 xen/include/xen/mm.h            |   2 +
 xen/include/xen/numa.h          |  10 +-
 10 files changed, 386 insertions(+), 319 deletions(-)

diff --git a/xen/arch/x86/include/asm/acpi.h b/xen/arch/x86/include/asm/acpi.h
index 5c2dd5da2d..c453450a74 100644
--- a/xen/arch/x86/include/asm/acpi.h
+++ b/xen/arch/x86/include/asm/acpi.h
@@ -102,7 +102,6 @@ extern unsigned long acpi_wakeup_address;
 #define ARCH_HAS_POWER_INIT	1
 
 extern s8 acpi_numa;
-#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
 
 extern struct acpi_sleep_info acpi_sinfo;
 #define acpi_video_flags bootsym(video_flags)
diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index d723c7c38f..2c5f856067 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -456,8 +456,6 @@ static inline int get_page_and_type(struct page_info *page,
     ASSERT(((_p)->count_info & PGC_count_mask) != 0);          \
     ASSERT(page_get_owner(_p) == (_d))
 
-extern paddr_t mem_hotplug;
-
 /******************************************************************************
  * With shadow pagetables, the different kinds of address start
  * to get get confusing.
diff --git a/xen/arch/x86/include/asm/numa.h b/xen/arch/x86/include/asm/numa.h
index 6c87942d43..2ca3475271 100644
--- a/xen/arch/x86/include/asm/numa.h
+++ b/xen/arch/x86/include/asm/numa.h
@@ -10,6 +10,7 @@ typedef u8 nodeid_t;
 extern int srat_rev;
 
 extern nodeid_t pxm_to_node(unsigned int pxm);
+extern unsigned int numa_node_to_arch_nid(nodeid_t n);
 
 #define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
 
@@ -22,8 +23,6 @@ extern void init_cpu_to_node(void);
 
 #define arch_want_default_dmazone() (num_online_nodes() > 1)
 
-extern int valid_numa_range(paddr_t start, paddr_t end, nodeid_t node);
-
 void srat_parse_regions(paddr_t addr);
 extern u8 __node_distance(nodeid_t a, nodeid_t b);
 unsigned int arch_get_dma_bitsize(void);
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index db1817b691..68f9989e1f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -157,8 +157,6 @@ l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
 l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
     l1_fixmap_x[L1_PAGETABLE_ENTRIES];
 
-paddr_t __read_mostly mem_hotplug;
-
 /* Frame table size in pages. */
 unsigned long max_page;
 unsigned long total_pages;
diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index fa8caaa084..4b0b297c7e 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -46,6 +46,11 @@ bool arch_numa_disabled(void)
     return acpi_numa < 0;
 }
 
+bool __init arch_numa_unavailable(void)
+{
+    return acpi_numa <= 0;
+}
+
 /*
  * Setup early cpu_to_node.
  *
diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
index 1a108a34c6..56749ddca5 100644
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -24,10 +24,6 @@
 
 static struct acpi_table_slit *__read_mostly acpi_slit;
 
-static nodemask_t memory_nodes_parsed __initdata;
-static nodemask_t processor_nodes_parsed __initdata;
-static struct node nodes[MAX_NUMNODES] __initdata;
-
 struct pxm2node {
 	unsigned pxm;
 	nodeid_t node;
@@ -35,19 +31,6 @@ struct pxm2node {
 static struct pxm2node __read_mostly pxm2node[MAX_NUMNODES] =
 	{ [0 ... MAX_NUMNODES - 1] = {.node = NUMA_NO_NODE} };
 
-static unsigned node_to_pxm(nodeid_t n);
-
-static int num_node_memblks;
-static struct node node_memblk_range[NR_NODE_MEMBLKS];
-static nodeid_t memblk_nodeid[NR_NODE_MEMBLKS];
-static __initdata DECLARE_BITMAP(memblk_hotplug, NR_NODE_MEMBLKS);
-
-enum conflicts {
-	NO_CONFLICT,
-	OVERLAP,
-	INTERLEAVE,
-};
-
 static inline bool node_found(unsigned idx, unsigned pxm)
 {
 	return ((pxm2node[idx].pxm == pxm) &&
@@ -110,78 +93,7 @@ nodeid_t setup_node(unsigned pxm)
 	return node;
 }
 
-int valid_numa_range(paddr_t start, paddr_t end, nodeid_t node)
-{
-	int i;
-
-	for (i = 0; i < num_node_memblks; i++) {
-		struct node *nd = &node_memblk_range[i];
-
-		if (nd->start <= start && nd->end >= end &&
-			memblk_nodeid[i] == node)
-			return 1;
-	}
-
-	return 0;
-}
-
-static
-enum conflicts __init conflicting_memblks(nodeid_t nid, paddr_t start,
-					  paddr_t end, paddr_t nd_start,
-					  paddr_t nd_end, unsigned int *mblkid)
-{
-	unsigned int i;
-
-	/*
-	 * Scan all recorded nodes' memory blocks to check conflicts:
-	 * Overlap or interleave.
-	 */
-	for (i = 0; i < num_node_memblks; i++) {
-		struct node *nd = &node_memblk_range[i];
-
-		*mblkid = i;
-
-		/* Skip 0 bytes node memory block. */
-		if (nd->start == nd->end)
-			continue;
-		/*
-		 * Use memblk range to check memblk overlaps, include the
-		 * self-overlap case. As nd's range is non-empty, the special
-		 * case "nd->end == end && nd->start == start" also can be covered.
-		 */
-		if (nd->end > start && nd->start < end)
-			return OVERLAP;
-
-		/*
-		 * Use node memory range to check whether new range contains
-		 * memory from other nodes - interleave check. We just need
-		 * to check full contains situation. Because overlaps have
-		 * been checked above.
-		 */
-	        if (nid != memblk_nodeid[i] &&
-		    nd->start >= nd_start && nd->end <= nd_end)
-			return INTERLEAVE;
-	}
-
-	return NO_CONFLICT;
-}
-
-static __init void cutoff_node(int i, paddr_t start, paddr_t end)
-{
-	struct node *nd = &nodes[i];
-	if (nd->start < start) {
-		nd->start = start;
-		if (nd->end < nd->start)
-			nd->start = nd->end;
-	}
-	if (nd->end > end) {
-		nd->end = end;
-		if (nd->start > nd->end)
-			nd->start = nd->end;
-	}
-}
-
-static __init void bad_srat(void)
+void __init numa_fw_bad(void)
 {
 	int i;
 	printk(KERN_ERR "SRAT: SRAT not used.\n");
@@ -241,7 +153,7 @@ acpi_numa_x2apic_affinity_init(const struct acpi_srat_x2apic_cpu_affinity *pa)
 	if (numa_disabled())
 		return;
 	if (pa->header.length < sizeof(struct acpi_srat_x2apic_cpu_affinity)) {
-		bad_srat();
+		numa_fw_bad();
 		return;
 	}
 	if (!(pa->flags & ACPI_SRAT_CPU_ENABLED))
@@ -254,12 +166,12 @@ acpi_numa_x2apic_affinity_init(const struct acpi_srat_x2apic_cpu_affinity *pa)
 	pxm = pa->proximity_domain;
 	node = setup_node(pxm);
 	if (node == NUMA_NO_NODE) {
-		bad_srat();
+		numa_fw_bad();
 		return;
 	}
 
 	apicid_to_node[pa->apic_id] = node;
-	node_set(node, processor_nodes_parsed);
+	numa_set_processor_nodes_parsed(node);
 	acpi_numa = 1;
 
 	if (opt_acpi_verbose)
@@ -277,7 +189,7 @@ acpi_numa_processor_affinity_init(const struct acpi_srat_cpu_affinity *pa)
 	if (numa_disabled())
 		return;
 	if (pa->header.length != sizeof(struct acpi_srat_cpu_affinity)) {
-		bad_srat();
+		numa_fw_bad();
 		return;
 	}
 	if (!(pa->flags & ACPI_SRAT_CPU_ENABLED))
@@ -290,11 +202,11 @@ acpi_numa_processor_affinity_init(const struct acpi_srat_cpu_affinity *pa)
 	}
 	node = setup_node(pxm);
 	if (node == NUMA_NO_NODE) {
-		bad_srat();
+		numa_fw_bad();
 		return;
 	}
 	apicid_to_node[pa->apic_id] = node;
-	node_set(node, processor_nodes_parsed);
+	numa_set_processor_nodes_parsed(node);
 	acpi_numa = 1;
 
 	if (opt_acpi_verbose)
@@ -306,33 +218,27 @@ acpi_numa_processor_affinity_init(const struct acpi_srat_cpu_affinity *pa)
 void __init
 acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma)
 {
-	struct node *nd;
-	paddr_t nd_start, nd_end;
-	paddr_t start, end;
 	unsigned pxm;
 	nodeid_t node;
-	unsigned int i;
-	bool next = false;
 
 	if (numa_disabled())
 		return;
 	if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) {
-		bad_srat();
+		numa_fw_bad();
 		return;
 	}
 	if (!(ma->flags & ACPI_SRAT_MEM_ENABLED))
 		return;
 
-	start = ma->base_address;
-	end = start + ma->length;
 	/* Supplement the heuristics in l1tf_calculations(). */
-	l1tf_safe_maddr = max(l1tf_safe_maddr, ROUNDUP(end, PAGE_SIZE));
+	l1tf_safe_maddr = max(l1tf_safe_maddr,
+			      ROUNDUP(ma->base_address + ma->length,
+				      PAGE_SIZE));
 
-	if (num_node_memblks >= NR_NODE_MEMBLKS)
-	{
+	if (!numa_memblks_available()) {
 		dprintk(XENLOG_WARNING,
-                "Too many numa entry, try bigger NR_NODE_MEMBLKS \n");
-		bad_srat();
+			"Too many numa entries, try bigger NR_NODE_MEMBLKS!\n");
+		numa_fw_bad();
 		return;
 	}
 
@@ -341,159 +247,18 @@ acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma)
 		pxm &= 0xff;
 	node = setup_node(pxm);
 	if (node == NUMA_NO_NODE) {
-		bad_srat();
+		numa_fw_bad();
 		return;
 	}
 
 	/*
-	 * For the node that already has some memory blocks, we will
-	 * expand the node memory range temporarily to check memory
-	 * interleaves with other nodes. We will not use this node
-	 * temp memory range to check overlaps, because it will mask
-	 * the overlaps in same node.
-	 *
-	 * Node with 0 bytes memory doesn't need this expandsion.
+	 * In an extremely unlikely case, srat_parse_regions might not
+	 * be called. So set the variable here just in case.
 	 */
-	nd_start = start;
-	nd_end = end;
-	nd = &nodes[node];
-	if (nd->start != nd->end) {
-		if (nd_start > nd->start)
-			nd_start = nd->start;
-
-		if (nd_end < nd->end)
-			nd_end = nd->end;
-	}
-
-	/* It is fine to add this area to the nodes data it will be used later*/
-	switch (conflicting_memblks(node, start, end, nd_start, nd_end, &i)) {
-	case OVERLAP:
-		if (memblk_nodeid[i] == node) {
-			bool mismatch = !(ma->flags &
-					  ACPI_SRAT_MEM_HOT_PLUGGABLE) !=
-			                !test_bit(i, memblk_hotplug);
-
-			printk("%sSRAT: PXM %u [%"PRIpaddr", %"PRIpaddr"] overlaps with itself [%"PRIpaddr", %"PRIpaddr"]\n",
-			       mismatch ? KERN_ERR : KERN_WARNING, pxm, start,
-			       end - 1, node_memblk_range[i].start,
-			       node_memblk_range[i].end - 1);
-			if (mismatch) {
-				bad_srat();
-				return;
-			}
-			break;
-		}
-
-		printk(KERN_ERR
-		       "SRAT: PXM %u [%"PRIpaddr", %"PRIpaddr"] overlaps with PXM %u [%"PRIpaddr", %"PRIpaddr"]\n",
-		       pxm, start, end - 1, node_to_pxm(memblk_nodeid[i]),
-		       node_memblk_range[i].start,
-		       node_memblk_range[i].end - 1);
-		bad_srat();
-		return;
-
-	case INTERLEAVE:
-		printk(KERN_ERR
-		       "SRAT： PXM %u: [%"PRIpaddr", %"PRIpaddr"] interleaves with PXM %u memblk [%"PRIpaddr", %"PRIpaddr"]\n",
-		       pxm, nd_start, nd_end - 1, node_to_pxm(memblk_nodeid[i]),
-		       node_memblk_range[i].start, node_memblk_range[i].end - 1);
-		bad_srat();
-		return;
-
-	case NO_CONFLICT:
-		break;
-	}
-
-	if (!(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)) {
-		node_set(node, memory_nodes_parsed);
-		nd->start = nd_start;
-		nd->end = nd_end;
-	}
-
-	printk(KERN_INFO "SRAT: Node %u PXM %u [%"PRIpaddr", %"PRIpaddr"]%s\n",
-	       node, pxm, start, end - 1,
-	       ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE ? " (hotplug)" : "");
-
-	/* Keep node_memblk_range[] sorted by address. */
-	for (i = 0; i < num_node_memblks; ++i)
-		if (node_memblk_range[i].start > start ||
-		    (node_memblk_range[i].start == start &&
-		     node_memblk_range[i].end > end))
-			break;
-
-	memmove(&node_memblk_range[i + 1], &node_memblk_range[i],
-	        (num_node_memblks - i) * sizeof(*node_memblk_range));
-	node_memblk_range[i].start = start;
-	node_memblk_range[i].end = end;
-
-	memmove(&memblk_nodeid[i + 1], &memblk_nodeid[i],
-	        (num_node_memblks - i) * sizeof(*memblk_nodeid));
-	memblk_nodeid[i] = node;
-
-	if (ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) {
-		next = true;
-		if (end > mem_hotplug)
-			mem_hotplug = end;
-	}
-	for (; i <= num_node_memblks; ++i) {
-		bool prev = next;
-
-		next = test_bit(i, memblk_hotplug);
-		if (prev)
-			__set_bit(i, memblk_hotplug);
-		else
-			__clear_bit(i, memblk_hotplug);
-	}
-
-	num_node_memblks++;
-}
-
-/* Sanity check to catch more bad SRATs (they are amazingly common).
-   Make sure the PXMs cover all memory. */
-static int __init nodes_cover_memory(void)
-{
-	unsigned int i;
-
-	for (i = 0; ; i++) {
-		int err;
-		unsigned int j;
-		bool found;
-		paddr_t start, end;
-
-		/* Try to loop memory map from index 0 to end to get RAM ranges. */
-		err = arch_get_ram_range(i, &start, &end);
-
-		/* Reached the end of the memory map? */
-		if (err == -ENOENT)
-			break;
-
-		/* Skip non-RAM entries. */
-		if (err)
-			continue;
-
-		do {
-			found = false;
-			for_each_node_mask(j, memory_nodes_parsed)
-				if (start < nodes[j].end
-				    && end > nodes[j].start) {
-					if (start >= nodes[j].start) {
-						start = nodes[j].end;
-						found = true;
-					}
-					if (end <= nodes[j].end) {
-						end = nodes[j].start;
-						found = true;
-					}
-				}
-		} while (found && start < end);
-
-		if (start < end) {
-			printk(KERN_ERR "NUMA: No NODE for RAM range: "
-				"[%"PRIpaddr", %"PRIpaddr"]\n", start, end - 1);
-			return 0;
-		}
-	}
-	return 1;
+	numa_fw_nid_name = "PXM";
+	if (!numa_update_node_memblks(node, pxm, ma->base_address, ma->length,
+				      ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE))
+		numa_fw_bad();
 }
 
 void __init acpi_numa_arch_fixup(void) {}
@@ -534,6 +299,8 @@ void __init srat_parse_regions(paddr_t addr)
 	    acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat))
 		return;
 
+	/* Set "PXM" as early as feasible. */
+	numa_fw_nid_name = "PXM";
 	srat_region_mask = pdx_init_mask(addr);
 	acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
 			      srat_parse_region, 0);
@@ -549,59 +316,9 @@ void __init srat_parse_regions(paddr_t addr)
 	pfn_pdx_hole_setup(mask >> PAGE_SHIFT);
 }
 
-/* Use discovered information to actually set up the nodes. */
-int __init numa_process_nodes(paddr_t start, paddr_t end)
-{
-	int i;
-	nodemask_t all_nodes_parsed;
-
-	/* First clean up the node list */
-	for (i = 0; i < MAX_NUMNODES; i++)
-		cutoff_node(i, start, end);
-
-	if (acpi_numa <= 0)
-		return -1;
-
-	if (!nodes_cover_memory()) {
-		bad_srat();
-		return -1;
-	}
-
-	memnode_shift = compute_hash_shift(node_memblk_range, num_node_memblks,
-				memblk_nodeid);
-
-	if (memnode_shift < 0) {
-		printk(KERN_ERR
-		     "SRAT: No NUMA node hash function found. Contact maintainer\n");
-		bad_srat();
-		return -1;
-	}
-
-	nodes_or(all_nodes_parsed, memory_nodes_parsed, processor_nodes_parsed);
-
-	/* Finally register nodes */
-	for_each_node_mask(i, all_nodes_parsed)
-	{
-		uint64_t size = nodes[i].end - nodes[i].start;
-
-		if ( size == 0 )
-			printk(KERN_INFO "SRAT: node %u has no memory\n", i);
-
-		setup_node_bootmem(i, nodes[i].start, nodes[i].end);
-	}
-	for (i = 0; i < nr_cpu_ids; i++) {
-		if (cpu_to_node[i] == NUMA_NO_NODE)
-			continue;
-		if (!nodemask_test(cpu_to_node[i], &processor_nodes_parsed))
-			numa_set_node(i, NUMA_NO_NODE);
-	}
-	numa_init_array();
-	return 0;
-}
-
-static unsigned node_to_pxm(nodeid_t n)
+unsigned int numa_node_to_arch_nid(nodeid_t n)
 {
-	unsigned i;
+	unsigned int i;
 
 	if ((n < ARRAY_SIZE(pxm2node)) && (pxm2node[n].node == n))
 		return pxm2node[n].pxm;
@@ -618,8 +335,8 @@ u8 __node_distance(nodeid_t a, nodeid_t b)
 
 	if (!acpi_slit)
 		return a == b ? 10 : 20;
-	index = acpi_slit->locality_count * node_to_pxm(a);
-	slit_val = acpi_slit->entry[index + node_to_pxm(b)];
+	index = acpi_slit->locality_count * numa_node_to_arch_nid(a);
+	slit_val = acpi_slit->entry[index + numa_node_to_arch_nid(b)];
 
 	/* ACPI defines 0xff as an unreachable node and 0-9 are undefined */
 	if ((slit_val == 0xff) || (slit_val <= 9))
diff --git a/xen/common/numa.c b/xen/common/numa.c
index a135154c3e..4948b21fbe 100644
--- a/xen/common/numa.c
+++ b/xen/common/numa.c
@@ -13,6 +13,21 @@
 #include <xen/sched.h>
 #include <xen/softirq.h>
 
+static nodemask_t __initdata processor_nodes_parsed;
+static nodemask_t __initdata memory_nodes_parsed;
+static struct node __initdata nodes[MAX_NUMNODES];
+
+static unsigned int __ro_after_init num_node_memblks;
+static struct node __ro_after_init node_memblk_range[NR_NODE_MEMBLKS];
+static nodeid_t __ro_after_init memblk_nodeid[NR_NODE_MEMBLKS];
+static __initdata DECLARE_BITMAP(memblk_hotplug, NR_NODE_MEMBLKS);
+
+enum conflicts {
+    NO_CONFLICT,
+    OVERLAP,
+    INTERLEAVE,
+};
+
 struct node_data __ro_after_init node_data[MAX_NUMNODES];
 
 /* Mapping from pdx to node id */
@@ -31,11 +46,335 @@ nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
 
 bool __ro_after_init numa_off;
 
+const char *__ro_after_init numa_fw_nid_name = "???";
+
 bool numa_disabled(void)
 {
     return numa_off || arch_numa_disabled();
 }
 
+void __init numa_set_processor_nodes_parsed(nodeid_t node)
+{
+    node_set(node, processor_nodes_parsed);
+}
+
+bool valid_numa_range(paddr_t start, paddr_t end, nodeid_t node)
+{
+    unsigned int i;
+
+    for ( i = 0; i < num_node_memblks; i++ )
+    {
+        const struct node *nd = &node_memblk_range[i];
+
+        if ( nd->start <= start && nd->end >= end &&
+             memblk_nodeid[i] == node )
+            return true;
+    }
+
+    return false;
+}
+
+static enum conflicts __init conflicting_memblks(
+    nodeid_t nid, paddr_t start, paddr_t end, paddr_t nd_start,
+    paddr_t nd_end, unsigned int *mblkid)
+{
+    unsigned int i;
+
+    /*
+     * Scan all recorded nodes' memory blocks to check conflicts:
+     * Overlap or interleave.
+     */
+    for ( i = 0; i < num_node_memblks; i++ )
+    {
+        const struct node *nd = &node_memblk_range[i];
+
+        *mblkid = i;
+
+        /* Skip 0 bytes node memory block. */
+        if ( nd->start == nd->end )
+            continue;
+        /*
+         * Use memblk range to check memblk overlaps, include the
+         * self-overlap case. As nd's range is non-empty, the special
+         * case "nd->end == end && nd->start == start" also can be covered.
+         */
+        if ( nd->end > start && nd->start < end )
+            return OVERLAP;
+
+        /*
+         * Use node memory range to check whether new range contains
+         * memory from other nodes - interleave check. We just need
+         * to check full contains situation. Because overlaps have
+         * been checked above.
+         */
+        if ( nid != memblk_nodeid[i] &&
+             nd->start >= nd_start && nd->end <= nd_end )
+            return INTERLEAVE;
+    }
+
+    return NO_CONFLICT;
+}
+
+static void __init cutoff_node(nodeid_t i, paddr_t start, paddr_t end)
+{
+    struct node *nd = &nodes[i];
+
+    if ( nd->start < start )
+    {
+        nd->start = start;
+        if ( nd->end < nd->start )
+            nd->start = nd->end;
+    }
+
+    if ( nd->end > end )
+    {
+        nd->end = end;
+        if ( nd->start > nd->end )
+            nd->start = nd->end;
+    }
+}
+
+bool __init numa_memblks_available(void)
+{
+    return num_node_memblks < NR_NODE_MEMBLKS;
+}
+
+/*
+ * This function will be called by NUMA memory affinity initialization to
+ * update NUMA node's memory range. In this function, we assume all memory
+ * regions belonging to a single node are in one chunk. Holes (or MMIO
+ * ranges) between them will be included in the node.
+ *
+ * So in numa_update_node_memblks, if there are multiple banks for each
+ * node, start and end are stretched to cover the holes between them, and
+ * it works as long as memory banks of different NUMA nodes don't interleave.
+ */
+bool __init numa_update_node_memblks(nodeid_t node, unsigned int arch_nid,
+                                     paddr_t start, paddr_t size, bool hotplug)
+{
+    unsigned int i;
+    bool next = false;
+    paddr_t end = start + size;
+    paddr_t nd_start = start;
+    paddr_t nd_end = end;
+    struct node *nd = &nodes[node];
+
+    /*
+     * For the node that already has some memory blocks, we will
+     * expand the node memory range temporarily to check memory
+     * interleaves with other nodes. We will not use this node
+     * temp memory range to check overlaps, because it will mask
+     * the overlaps in same node.
+     *
+     * Node with 0 bytes memory doesn't need this expansion.
+     */
+    if ( nd->start != nd->end )
+    {
+        if ( nd_start > nd->start )
+            nd_start = nd->start;
+
+        if ( nd_end < nd->end )
+            nd_end = nd->end;
+    }
+
+    /* It is fine to add this area to the nodes data it will be used later */
+    switch ( conflicting_memblks(node, start, end, nd_start, nd_end, &i) )
+    {
+    case OVERLAP:
+        if ( memblk_nodeid[i] == node )
+        {
+            bool mismatch = !hotplug != !test_bit(i, memblk_hotplug);
+
+            printk("%sNUMA: %s %u [%"PRIpaddr", %"PRIpaddr"] overlaps with itself [%"PRIpaddr", %"PRIpaddr"]\n",
+                   mismatch ? KERN_ERR : KERN_WARNING, numa_fw_nid_name,
+                   arch_nid, start, end - 1,
+                   node_memblk_range[i].start, node_memblk_range[i].end - 1);
+            if ( mismatch )
+                return false;
+            break;
+        }
+
+        printk(KERN_ERR
+               "NUMA: %s %u [%"PRIpaddr", %"PRIpaddr"] overlaps with %s %u [%"PRIpaddr", %"PRIpaddr"]\n",
+               numa_fw_nid_name, arch_nid, start, end - 1, numa_fw_nid_name,
+               numa_node_to_arch_nid(memblk_nodeid[i]),
+               node_memblk_range[i].start, node_memblk_range[i].end - 1);
+        return false;
+
+    case INTERLEAVE:
+        printk(KERN_ERR
+               "NUMA： %s %u: [%"PRIpaddr", %"PRIpaddr"] interleaves with %s %u memblk [%"PRIpaddr", %"PRIpaddr"]\n",
+               numa_fw_nid_name, arch_nid, nd_start, nd_end - 1,
+               numa_fw_nid_name, numa_node_to_arch_nid(memblk_nodeid[i]),
+               node_memblk_range[i].start, node_memblk_range[i].end - 1);
+        return false;
+
+    case NO_CONFLICT:
+        break;
+    }
+
+    if ( !hotplug )
+    {
+        node_set(node, memory_nodes_parsed);
+        nd->start = nd_start;
+        nd->end = nd_end;
+    }
+
+    printk(KERN_INFO "NUMA: Node %u %s %u [%"PRIpaddr", %"PRIpaddr"]%s\n",
+           node, numa_fw_nid_name, arch_nid, start, end - 1,
+           hotplug ? " (hotplug)" : "");
+
+    /* Keep node_memblk_range[] sorted by address. */
+    for ( i = 0; i < num_node_memblks; ++i )
+        if ( node_memblk_range[i].start > start ||
+             (node_memblk_range[i].start == start &&
+             node_memblk_range[i].end > end) )
+            break;
+
+    memmove(&node_memblk_range[i + 1], &node_memblk_range[i],
+            (num_node_memblks - i) * sizeof(*node_memblk_range));
+    node_memblk_range[i].start = start;
+    node_memblk_range[i].end = end;
+
+    memmove(&memblk_nodeid[i + 1], &memblk_nodeid[i],
+            (num_node_memblks - i) * sizeof(*memblk_nodeid));
+    memblk_nodeid[i] = node;
+
+    if ( hotplug )
+    {
+        next = true;
+        if ( end > mem_hotplug )
+            mem_hotplug = end;
+    }
+
+    for ( ; i <= num_node_memblks; ++i )
+    {
+        bool prev = next;
+
+        next = test_bit(i, memblk_hotplug);
+        if ( prev )
+            __set_bit(i, memblk_hotplug);
+        else
+            __clear_bit(i, memblk_hotplug);
+    }
+
+    num_node_memblks++;
+
+    return true;
+}
+
+/*
+ * Sanity check to catch more bad SRATs (they are amazingly common).
+ * Make sure the PXMs cover all memory.
+ */
+static bool __init nodes_cover_memory(void)
+{
+    unsigned int i;
+
+    for ( i = 0; ; i++ )
+    {
+        int err;
+        unsigned int j;
+        bool found;
+        paddr_t start, end;
+
+        /* Try to loop memory map from index 0 to end to get RAM ranges. */
+        err = arch_get_ram_range(i, &start, &end);
+
+        /* Reached the end of the memory map? */
+        if ( err == -ENOENT )
+            break;
+
+        /* Skip non-RAM entries. */
+        if ( err )
+            continue;
+
+        do {
+            found = false;
+            for_each_node_mask ( j, memory_nodes_parsed )
+                if ( start < nodes[j].end && end > nodes[j].start )
+                {
+                    if ( start >= nodes[j].start )
+                    {
+                        start = nodes[j].end;
+                        found = true;
+                    }
+
+                    if ( end <= nodes[j].end )
+                    {
+                        end = nodes[j].start;
+                        found = true;
+                    }
+                }
+        } while ( found && start < end );
+
+        if ( start < end )
+        {
+            printk(KERN_ERR "NUMA: No node for RAM range: "
+                   "[%"PRIpaddr", %"PRIpaddr"]\n", start, end - 1);
+            return false;
+        }
+    }
+
+    return true;
+}
+
+/* Use discovered information to actually set up the nodes. */
+static bool __init numa_process_nodes(paddr_t start, paddr_t end)
+{
+    int ret;
+    unsigned int i;
+    nodemask_t all_nodes_parsed;
+
+    /* First clean up the node list */
+    for ( i = 0; i < MAX_NUMNODES; i++ )
+        cutoff_node(i, start, end);
+
+    /* When numa is on and has data, we can start to process numa nodes. */
+    if ( arch_numa_unavailable() )
+        return false;
+
+    if ( !nodes_cover_memory() )
+    {
+        numa_fw_bad();
+        return false;
+    }
+
+    ret = compute_hash_shift(node_memblk_range, num_node_memblks,
+                             memblk_nodeid);
+    if ( ret < 0 )
+    {
+        printk(KERN_ERR
+               "NUMA: No NUMA node hash function found. Contact maintainer\n");
+        numa_fw_bad();
+        return false;
+    }
+    memnode_shift = ret;
+
+    nodes_or(all_nodes_parsed, memory_nodes_parsed, processor_nodes_parsed);
+
+    /* Finally register nodes */
+    for_each_node_mask ( i, all_nodes_parsed )
+    {
+        if ( nodes[i].end == nodes[i].start )
+            printk(KERN_INFO "NUMA: node %u has no memory\n", i);
+
+        setup_node_bootmem(i, nodes[i].start, nodes[i].end);
+    }
+
+    for ( i = 0; i < nr_cpu_ids; i++ )
+    {
+        if ( cpu_to_node[i] == NUMA_NO_NODE )
+            continue;
+        if ( !nodemask_test(cpu_to_node[i], &processor_nodes_parsed) )
+            numa_set_node(i, NUMA_NO_NODE);
+    }
+
+    numa_init_array();
+
+    return true;
+}
+
 /*
  * Given a shift value, try to populate memnodemap[]
  * Returns :
@@ -261,7 +600,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
 #endif
 
 #ifdef CONFIG_NUMA
-    if ( !numa_off && !numa_process_nodes(start, end) )
+    if ( !numa_off && numa_process_nodes(start, end) )
         return;
 #endif
 
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index c5b8c7444f..0c93a10787 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -159,6 +159,8 @@
 #define PGT_TYPE_INFO_INITIALIZER 0
 #endif
 
+paddr_t __ro_after_init mem_hotplug;
+
 /*
  * Comma-separated list of hexadecimal page numbers containing bad bytes.
  * e.g. 'badpage=0x3f45,0x8a321'.
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index a925028ab3..9d14aed74b 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -147,6 +147,8 @@ int assign_page(
 /* Dump info to serial console */
 void arch_dump_shared_mem_info(void);
 
+extern paddr_t mem_hotplug;
+
 /*
  * Extra fault info types which are used to further describe
  * the source of an access violation.
diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
index 9da0e7d555..04ecaf7769 100644
--- a/xen/include/xen/numa.h
+++ b/xen/include/xen/numa.h
@@ -11,6 +11,7 @@
 #define NUMA_NO_DISTANCE 0xFF
 
 #define MAX_NUMNODES    (1 << NODES_SHIFT)
+#define NR_NODE_MEMBLKS (MAX_NUMNODES * 2)
 
 #define vcpu_to_node(v) (cpu_to_node((v)->processor))
 
@@ -36,14 +37,16 @@ extern int compute_hash_shift(const struct node *nodes,
                               unsigned int numnodes, const nodeid_t *nodeids);
 
 extern bool numa_off;
+extern const char *numa_fw_nid_name;
 
 extern void numa_add_cpu(unsigned int cpu);
 extern void numa_init_array(void);
 extern void numa_set_node(unsigned int cpu, nodeid_t node);
 extern void numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn);
-extern int numa_process_nodes(paddr_t start, paddr_t end);
+extern void numa_fw_bad(void);
 
 extern int arch_numa_setup(const char *opt);
+extern bool arch_numa_unavailable(void);
 extern bool arch_numa_disabled(void);
 extern void setup_node_bootmem(nodeid_t nodeid, paddr_t start, paddr_t end);
 
@@ -92,6 +95,11 @@ static inline nodeid_t __attribute_pure__ phys_to_nid(paddr_t addr)
  */
 extern int arch_get_ram_range(unsigned int idx,
                               paddr_t *start, paddr_t *end);
+extern bool valid_numa_range(paddr_t start, paddr_t end, nodeid_t node);
+extern bool numa_memblks_available(void);
+extern bool numa_update_node_memblks(nodeid_t node, unsigned int arch_nid,
+                                     paddr_t start, paddr_t size, bool hotplug);
+extern void numa_set_processor_nodes_parsed(nodeid_t node);
 
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:44:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465455.724136 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6grO-0003Un-4S; Sat, 17 Dec 2022 23:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465455.724136; Sat, 17 Dec 2022 23:44:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6grO-0003Ud-1q; Sat, 17 Dec 2022 23:44:54 +0000
Received: by outflank-mailman (input) for mailman id 465455;
 Sat, 17 Dec 2022 23:44:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grN-0003UX-3Q
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grN-0004I4-2e
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grN-0001No-1x
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nSBEUzEEycjqesk+jtRns9aBp4ijFelZzPLu/df0GEw=; b=kntnR4YIiB86Pq9hv+UBkPbXxh
	+kAAyj3FiVYDm3PhDaB6QH0XdTcS9WusYuaMPyMFkNYbMcs3UCPiY8ezhUkPhzFxAUU9IndT8sx0x
	vqHwCpRLGXtTyoU9WYCF+mI6q6ZRdYqkG+htPJHmuOry5kAMJeiZCLCi/duLoHyEzLls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: introduce a Kconfig option to configure NUMA nodes number
Message-Id: <E1p6grN-0001No-1x@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:44:53 +0000

commit c243c0bb2a77e1328842436ca654f808701161c6
Author:     Wei Chen <wei.chen@arm.com>
AuthorDate: Mon Dec 12 12:15:28 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 12 12:15:28 2022 +0100

    xen: introduce a Kconfig option to configure NUMA nodes number
    
    Currently the maximum number of NUMA nodes is a hardcoded value.
    This provides little flexibility unless changing the code.
    
    Introduce a new Kconfig option to change the maximum number of
    NUMA nodes conveniently. Also considering that not all
    architectures support NUMA, this Kconfig option is only visible
    on NUMA enabled architectures. Architectures not supporting NUMA
    still use 1 for MAX_NUMNODES.
    
    As NODES_SHIFT is currently unused, we're taking this
    opportunity to remove it.
    
    Signed-off-by: Wei Chen <wei.chen@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/Kconfig                | 11 +++++++++++
 xen/arch/x86/include/asm/numa.h |  2 --
 xen/include/xen/numa.h          | 11 ++++++-----
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/xen/arch/Kconfig b/xen/arch/Kconfig
index f16eb0df43..7028f7b74f 100644
--- a/xen/arch/Kconfig
+++ b/xen/arch/Kconfig
@@ -17,3 +17,14 @@ config NR_CPUS
 	  For CPU cores which support Simultaneous Multi-Threading or similar
 	  technologies, this the number of logical threads which Xen will
 	  support.
+
+config NR_NUMA_NODES
+	int "Maximum number of NUMA nodes supported"
+	range 2 64
+	default "64"
+	depends on NUMA
+	help
+	  Controls the build-time size of various arrays and bitmaps
+	  associated with multiple-nodes management. It is the upper bound of
+	  the number of NUMA nodes that the scheduler, memory allocation and
+	  other NUMA-aware components can handle.
diff --git a/xen/arch/x86/include/asm/numa.h b/xen/arch/x86/include/asm/numa.h
index 2ca3475271..7866afa408 100644
--- a/xen/arch/x86/include/asm/numa.h
+++ b/xen/arch/x86/include/asm/numa.h
@@ -3,8 +3,6 @@
 
 #include <xen/cpumask.h>
 
-#define NODES_SHIFT 6
-
 typedef u8 nodeid_t;
 
 extern int srat_rev;
diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
index 04ecaf7769..71a5f837b3 100644
--- a/xen/include/xen/numa.h
+++ b/xen/include/xen/numa.h
@@ -3,14 +3,15 @@
 
 #include <asm/numa.h>
 
-#ifndef NODES_SHIFT
-#define NODES_SHIFT     0
-#endif
-
 #define NUMA_NO_NODE     0xFF
 #define NUMA_NO_DISTANCE 0xFF
 
-#define MAX_NUMNODES    (1 << NODES_SHIFT)
+#ifdef CONFIG_NR_NUMA_NODES
+#define MAX_NUMNODES CONFIG_NR_NUMA_NODES
+#else
+#define MAX_NUMNODES 1
+#endif
+
 #define NR_NODE_MEMBLKS (MAX_NUMNODES * 2)
 
 #define vcpu_to_node(v) (cpu_to_node((v)->processor))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:45:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465456.724140 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6grY-0003Yb-6V; Sat, 17 Dec 2022 23:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465456.724140; Sat, 17 Dec 2022 23:45:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6grY-0003YS-3X; Sat, 17 Dec 2022 23:45:04 +0000
Received: by outflank-mailman (input) for mailman id 465456;
 Sat, 17 Dec 2022 23:45:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grX-0003Xz-6b
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grX-0004Ij-5o
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grX-0001OS-4u
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=B0SPoKBKAO7jc2A4nAHbNpAz9/NbX4RNuixqfyCRQaA=; b=xUlCqF98oBoLeEFBSzoXEYjmKB
	+kleva7Bk/eadnofIR/JrTfRO54rCVB0uJ2RpwrLBtx3E5vLcEDE/iewmpNmV3QsNA5lJVqq9BMgw
	kNKV/MvaNEHST98LcM1ANkzHHOwPo/qpbQ219VUNhxKFmvRXhJYqGkmVyPoNaW3wtib4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/tboot: drop failed attempt to hash shadow page tables
Message-Id: <E1p6grX-0001OS-4u@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:45:03 +0000

commit f00ad745cfa774a269b28e88951b56b7001d4fe0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 12 12:17:07 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 12 12:17:07 2022 +0100

    x86/tboot: drop failed attempt to hash shadow page tables
    
    While plausible to do what was intended based on the name of the flag
    (PGC_page_table), that name was misleading and is going to be changed.
    It marks page tables pages _having_ a shadow, not shadows of page table
    pages. The attempt also didn't cover the HAP case at all, and it
    constituted a potentially very long loop doing nothing when
    !SHADOW_PAGING. Instead leave a comment of what actually wants doing
    there (which then also may need to account for e.g. the risk of A/D bits
    becoming set behind our backs).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
---
 xen/arch/x86/tboot.c | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index 03098450f7..569732cffe 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -177,29 +177,6 @@ static void update_iommu_mac(vmac_ctx_t *ctx, uint64_t pt_maddr, int level)
 #define is_page_in_use(page) \
     (page_state_is(page, inuse) || page_state_is(page, offlining))
 
-static void update_pagetable_mac(vmac_ctx_t *ctx)
-{
-    unsigned long mfn;
-
-    for ( mfn = 0; mfn < max_page; mfn++ )
-    {
-        struct page_info *page = mfn_to_page(_mfn(mfn));
-
-        if ( !mfn_valid(_mfn(mfn)) )
-            continue;
-        if ( is_page_in_use(page) && !is_special_page(page) )
-        {
-            if ( page->count_info & PGC_page_table )
-            {
-                void *pg = map_domain_page(_mfn(mfn));
-
-                vmac_update(pg, PAGE_SIZE, ctx);
-                unmap_domain_page(pg);
-            }
-        }
-    }
-}
- 
 static void tboot_gen_domain_integrity(const uint8_t key[TB_KEY_SIZE],
                                        vmac_t *mac)
 {
@@ -233,8 +210,7 @@ static void tboot_gen_domain_integrity(const uint8_t key[TB_KEY_SIZE],
         }
     }
 
-    /* MAC all shadow page tables */
-    update_pagetable_mac(&ctx);
+    /* TODO: MAC all shadow / HAP page tables */
 
     *mac = vmac(NULL, 0, nonce, NULL, &ctx);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:45:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:45:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465457.724144 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gri-0003bR-7k; Sat, 17 Dec 2022 23:45:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465457.724144; Sat, 17 Dec 2022 23:45:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gri-0003bJ-4z; Sat, 17 Dec 2022 23:45:14 +0000
Received: by outflank-mailman (input) for mailman id 465457;
 Sat, 17 Dec 2022 23:45:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grh-0003bA-AB
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grh-0004Iu-9R
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grh-0001Ot-8V
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j8okLIAc5YjcBAf94p9AKZCMMyVnUndhEbwcnLq6pvA=; b=Lbe7fJL4rjJozkWMOkExyEw6VX
	70ZnpzDGITtSaZBiA4/9NcCi0qJ4BX8iqhCR4Q7Fbjup513ppr6mqIK8gaZ7x09jbT3f93iwbS9oo
	NG8m1+CVEY+6bKq+TUA/pl+M0PZrXYrcJiCnCGMLCrw7BkDll0lPpoz25s9qAHJvlsdE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: rename PGC_page_table to PGC_shadowed_pt
Message-Id: <E1p6grh-0001Ot-8V@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:45:13 +0000

commit c44c0dc35889848ee27549ac3455314e236cfc3d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 12 12:18:41 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 12 12:18:41 2022 +0100

    x86/mm: rename PGC_page_table to PGC_shadowed_pt
    
    The original name didn't express the purpose of the flag: It is being
    set once a page table page obtains a shadow, and it is removed when the
    last shadow of a page was destroyed.
    
    In set_tlbflush_timestamp() also remove the 2nd half of the condition as
    being redundant (PGC_shadowed_pt can't be set on a page without shadow
    mode being enabled on the owning domain).
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/mm.h    |  6 +++---
 xen/arch/x86/mm.c                |  3 +--
 xen/arch/x86/mm/p2m-pod.c        |  4 ++--
 xen/arch/x86/mm/shadow/common.c  | 20 ++++++++++----------
 xen/arch/x86/mm/shadow/private.h |  8 ++++----
 5 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index 2c5f856067..c4240a94d2 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -70,9 +70,9 @@
  /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
- /* Set when is using a page as a page table */
-#define _PGC_page_table   PG_shift(3)
-#define PGC_page_table    PG_mask(1, 3)
+ /* Set when a page table page has been shadowed. */
+#define _PGC_shadowed_pt  PG_shift(3)
+#define PGC_shadowed_pt   PG_mask(1, 3)
  /* Page is broken? */
 #define _PGC_broken       PG_shift(4)
 #define PGC_broken        PG_mask(1, 4)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 68f9989e1f..8b9740f575 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -591,8 +591,7 @@ static inline void set_tlbflush_timestamp(struct page_info *page)
      *  2. Shadow mode reuses this field for shadowed page tables to store
      *     flags info -- we don't want to conflict with that.
      */
-    if ( !(page->count_info & PGC_page_table) ||
-         !shadow_mode_enabled(page_get_owner(page)) )
+    if ( !(page->count_info & PGC_shadowed_pt) )
         page_set_tlbflush_timestamp(page);
 }
 
diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index fc110506dc..2490c841f9 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -803,7 +803,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn)
         for ( k = 0, page = mfn_to_page(mfn); k < n; ++k, ++page )
             if ( is_special_page(page) ||
                  !(page->count_info & PGC_allocated) ||
-                 (page->count_info & PGC_page_table) ||
+                 (page->count_info & PGC_shadowed_pt) ||
                  (page->count_info & PGC_count_mask) > max_ref )
                 goto out;
     }
@@ -946,7 +946,7 @@ p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, unsigned int count
 
             if ( !is_special_page(pg) &&
                  (pg->count_info & PGC_allocated) &&
-                 !(pg->count_info & PGC_page_table) &&
+                 !(pg->count_info & PGC_shadowed_pt) &&
                  ((pg->count_info & PGC_count_mask) <= max_ref) )
                 map[i] = map_domain_page(mfns[i]);
         }
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index a8404f97f6..cae1d9190c 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -185,7 +185,7 @@ static void sh_oos_audit(struct domain *d)
                 BUG();
             }
             pg = mfn_to_page(oos[idx]);
-            if ( !(pg->count_info & PGC_page_table) )
+            if ( !(pg->count_info & PGC_shadowed_pt) )
             {
                 printk("%s: idx %x gmfn %lx not a pt (count %lx)\n",
                        __func__, idx, mfn_x(oos[idx]), pg->count_info);
@@ -716,7 +716,7 @@ void shadow_promote(struct domain *d, mfn_t gmfn, unsigned int type)
            || d->is_shutting_down);
 
     /* Is the page already shadowed? */
-    if ( !test_and_set_bit(_PGC_page_table, &page->count_info) )
+    if ( !test_and_set_bit(_PGC_shadowed_pt, &page->count_info) )
     {
         page->shadow_flags = 0;
 #ifdef CONFIG_HVM
@@ -734,7 +734,7 @@ void shadow_demote(struct domain *d, mfn_t gmfn, u32 type)
 {
     struct page_info *page = mfn_to_page(gmfn);
 
-    ASSERT(test_bit(_PGC_page_table, &page->count_info));
+    ASSERT(test_bit(_PGC_shadowed_pt, &page->count_info));
     ASSERT(page->shadow_flags & (1u << type));
 
     page->shadow_flags &= ~(1u << type);
@@ -748,7 +748,7 @@ void shadow_demote(struct domain *d, mfn_t gmfn, u32 type)
             oos_hash_remove(d, gmfn);
         }
 #endif
-        clear_bit(_PGC_page_table, &page->count_info);
+        clear_bit(_PGC_shadowed_pt, &page->count_info);
     }
 
     TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_DEMOTE);
@@ -779,7 +779,7 @@ sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size)
     // Ditto for L2s before L3s, etc.
     //
 
-    if ( !(page->count_info & PGC_page_table) )
+    if ( !(page->count_info & PGC_shadowed_pt) )
         return 0;  /* Not shadowed at all */
 
     if ( page->shadow_flags & SHF_L1_32 )
@@ -2266,7 +2266,7 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
     SHADOW_PRINTK("d%d gmfn=%"PRI_mfn"\n", d->domain_id, mfn_x(gmfn));
 
     /* Bail out now if the page is not shadowed */
-    if ( (pg->count_info & PGC_page_table) == 0 )
+    if ( !(pg->count_info & PGC_shadowed_pt) )
     {
         paging_unlock(d);
         return;
@@ -2283,7 +2283,7 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
      */
 #define DO_UNSHADOW(_type) do {                                         \
     t = (_type);                                                        \
-    if ( !(pg->count_info & PGC_page_table) ||                          \
+    if ( !(pg->count_info & PGC_shadowed_pt) ||                         \
          !(pg->shadow_flags & (1 << t)) )                               \
         break;                                                          \
     smfn = shadow_hash_lookup(d, mfn_x(gmfn), t);                       \
@@ -2299,7 +2299,7 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
     else if ( sh_type_has_up_pointer(d, t) )                            \
         sh_remove_shadow_via_pointer(d, smfn);                          \
     if ( !fast &&                                                       \
-         (pg->count_info & PGC_page_table) &&                           \
+         (pg->count_info & PGC_shadowed_pt) &&                          \
          (pg->shadow_flags & (1 << t)) )                                \
     {                                                                   \
         HASH_CALLBACKS_CHECK(SHF_page_type_mask);                       \
@@ -2322,7 +2322,7 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
 #undef DO_UNSHADOW
 
     /* If that didn't catch the shadows, something is wrong */
-    if ( !fast && all && (pg->count_info & PGC_page_table) )
+    if ( !fast && all && (pg->count_info & PGC_shadowed_pt) )
     {
         printk(XENLOG_G_ERR "can't find all shadows of mfn %"PRI_mfn
                " (shadow_flags=%04x)\n", mfn_x(gmfn), pg->shadow_flags);
@@ -2339,7 +2339,7 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
 void shadow_prepare_page_type_change(struct domain *d,
                                      const struct page_info *page)
 {
-    if ( !(page->count_info & PGC_page_table) )
+    if ( !(page->count_info & PGC_shadowed_pt) )
         return;
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 85bb26c7ea..b8a62ec1ff 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -320,7 +320,7 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
 static inline int sh_page_has_multiple_shadows(struct page_info *pg)
 {
     u32 shadows;
-    if ( !(pg->count_info & PGC_page_table) )
+    if ( !(pg->count_info & PGC_shadowed_pt) )
         return 0;
     shadows = pg->shadow_flags & SHF_page_type_mask;
     /* More than one type bit set in shadow-flags? */
@@ -332,7 +332,7 @@ static inline int sh_page_has_multiple_shadows(struct page_info *pg)
  * domain is translated, &c */
 static inline int page_is_out_of_sync(struct page_info *p)
 {
-    return (p->count_info & PGC_page_table)
+    return (p->count_info & PGC_shadowed_pt)
         && (p->shadow_flags & SHF_out_of_sync);
 }
 
@@ -343,7 +343,7 @@ static inline int mfn_is_out_of_sync(mfn_t gmfn)
 
 static inline int page_oos_may_write(struct page_info *p)
 {
-    return (p->count_info & PGC_page_table)
+    return (p->count_info & PGC_shadowed_pt)
         && (p->shadow_flags & SHF_oos_may_write);
 }
 
@@ -545,7 +545,7 @@ sh_mfn_is_a_page_table(mfn_t gmfn)
 
     owner = page_get_owner(page);
     if ( owner && shadow_mode_refcounts(owner)
-         && (page->count_info & PGC_page_table) )
+         && (page->count_info & PGC_shadowed_pt) )
         return 1;
 
     type_info = page->u.inuse.type_info & PGT_type_mask;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:45:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:45:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465458.724148 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6grs-0003eH-91; Sat, 17 Dec 2022 23:45:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465458.724148; Sat, 17 Dec 2022 23:45:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6grs-0003eA-6T; Sat, 17 Dec 2022 23:45:24 +0000
Received: by outflank-mailman (input) for mailman id 465458;
 Sat, 17 Dec 2022 23:45:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grr-0003e1-DL
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grr-0004J8-Ca
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6grr-0001PS-Bf
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9C1U8vgrk6m1W/7J0grzoEkxd2+t8JgVEmGVeH6Y2aw=; b=lSlgz71vmzvO4UhS8Fwxlvc6F/
	QLG/MtYWH+U9SnXPYVJF0wbo4Bh99WJpunIJzpsE4/Z9GACAXYJ+KKLFXG+lVFUJ/UMYlwQlhYPz8
	QNT2zkcMe1NMsaVfxxyU/f9Ipd0FlfDpXGXDYqMsnONh64IsfYu9KES0DsqraKmhG/Ok=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: PGC_shadowed_pt is used by shadow code only
Message-Id: <E1p6grr-0001PS-Bf@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:45:23 +0000

commit 4384d96c1cedfa4e388401be3a19ff50f8dce54b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 12 12:19:20 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 12 12:19:20 2022 +0100

    x86/mm: PGC_shadowed_pt is used by shadow code only
    
    By defining the constant to zero when !SHADOW_PAGING we give compilers
    the chance to eliminate a little more dead code elsewhere in the tree.
    Plus, as a minor benefit, the general reference count can be one bit
    wider. (To simplify things, have PGC_shadowed_pt change places with
    PGC_extra.)
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/mm.h | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index c4240a94d2..db29e3e205 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -70,9 +70,9 @@
  /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
- /* Set when a page table page has been shadowed. */
-#define _PGC_shadowed_pt  PG_shift(3)
-#define PGC_shadowed_pt   PG_mask(1, 3)
+ /* Page is not reference counted */
+#define _PGC_extra        PG_shift(3)
+#define PGC_extra         PG_mask(1, 3)
  /* Page is broken? */
 #define _PGC_broken       PG_shift(4)
 #define PGC_broken        PG_mask(1, 4)
@@ -83,12 +83,20 @@
 #define PGC_state_offlined  PG_mask(2, 6)
 #define PGC_state_free      PG_mask(3, 6)
 #define page_state_is(pg, st) (((pg)->count_info&PGC_state) == PGC_state_##st)
-/* Page is not reference counted */
-#define _PGC_extra        PG_shift(7)
-#define PGC_extra         PG_mask(1, 7)
+#ifdef CONFIG_SHADOW_PAGING
+ /* Set when a page table page has been shadowed. */
+#define _PGC_shadowed_pt  PG_shift(7)
+#define PGC_shadowed_pt   PG_mask(1, 7)
+#else
+#define PGC_shadowed_pt   0
+#endif
 
 /* Count of references to this frame. */
+#if PGC_shadowed_pt
 #define PGC_count_width   PG_shift(7)
+#else
+#define PGC_count_width   PG_shift(6)
+#endif
 #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:45:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:45:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465459.724151 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gs3-0003h5-Am; Sat, 17 Dec 2022 23:45:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465459.724151; Sat, 17 Dec 2022 23:45:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gs3-0003gy-8E; Sat, 17 Dec 2022 23:45:35 +0000
Received: by outflank-mailman (input) for mailman id 465459;
 Sat, 17 Dec 2022 23:45:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gs1-0003gm-GK
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gs1-0004JO-FX
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gs1-0001Pt-Ek
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=a46TT92zdtR4+uOjtZpEtCgUP7+kxdl5yOwEONgTXk4=; b=0L28fFBoCVtxIHRkfAl6iEqMrP
	OsHjEdKhYPp9ahgVfLsp64PCjD57xE2I6t/nY+KPOnX3ahAiHkSENRCIZNzkPWHMkQxUKJLoTUewr
	ekssQPPSIrFGWwdL67ARAYdGbn9isv33PAvTlVPN/2qEqbMRVGz3bOzM8iVi0k35wY5g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/tboot: correct IOMMU (VT-d) interaction
Message-Id: <E1p6gs1-0001Pt-Ek@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:45:33 +0000

commit 8301856bd956558161aa0c71623c85403ebdca35
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 12 12:21:01 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 12 12:21:01 2022 +0100

    x86/tboot: correct IOMMU (VT-d) interaction
    
    First of all using is_idle_domain() on the subject domain in the body of
    for_each_domain() is pointless. Replace that conditional by one checking
    that a domain actually has IOMMU support enabled for it, and that we're
    actually on a VT-d system (both are largely cosmetic / documentary with
    how things work elsewhere, but still).
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/tboot.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index 569732cffe..68bee222dd 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -31,6 +31,8 @@ static vmac_t frametable_mac; /* MAC for frame table during S3 */
 static uint64_t __initdata txt_heap_base, __initdata txt_heap_size;
 static uint64_t __initdata sinit_base, __initdata sinit_size;
 
+static bool __ro_after_init is_vtd;
+
 /*
  * TXT configuration registers (offsets from TXT_{PUB, PRIV}_CONFIG_REGS_BASE)
  */
@@ -201,7 +203,7 @@ static void tboot_gen_domain_integrity(const uint8_t key[TB_KEY_SIZE],
         }
         spin_unlock(&d->page_alloc_lock);
 
-        if ( !is_idle_domain(d) )
+        if ( is_iommu_enabled(d) && is_vtd )
         {
             const struct domain_iommu *dio = dom_iommu(d);
 
@@ -413,6 +415,8 @@ int __init cf_check tboot_parse_dmar_table(acpi_table_handler dmar_handler)
     if ( txt_heap_base == 0 )
         return 1;
 
+    is_vtd = true;
+
     /* walk heap to SinitMleData */
     pa = txt_heap_base;
     /* skip BiosData */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:45:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:45:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465460.724155 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gsD-0003jo-CI; Sat, 17 Dec 2022 23:45:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465460.724155; Sat, 17 Dec 2022 23:45:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gsD-0003jh-9m; Sat, 17 Dec 2022 23:45:45 +0000
Received: by outflank-mailman (input) for mailman id 465460;
 Sat, 17 Dec 2022 23:45:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsB-0003jT-JF
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsB-0004Jx-IS
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsB-0001QN-Hm
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TNCbsJUV4pQGH+eIjyS5PCoN0C+v5OCmorPFQSbEv+I=; b=w6lVSjVXAqYUW75hZkN2jEf0/D
	uw5ETlKwTlEFq5hDuKstWxGsHrkHiJoJF37sRPPqQ0s2Wx7ozlw/RuhioJJ97CZs7Z+VbLFJdlURQ
	N6KyA9t5QI2MHP7lZXk4WJ6aSr0icp9q8kBauciMhVg2JNBuzEbE3hkqQeE5k1PH6snE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/tboot: actually wipe contexts
Message-Id: <E1p6gsB-0001QN-Hm@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:45:43 +0000

commit b08600e2d6b58eca29d72f6cb6672a5cba5baed4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 12 12:27:30 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 12 12:27:30 2022 +0100

    x86/tboot: actually wipe contexts
    
    Especially with our use of __builtin_memset() to implement memset() the
    compiler is free to eliminate instances when it can prove that the
    affected object is dead. Introduce a small helper function accompanying
    the memset() with a construct forcing the compiler to retain the
    clearing of (stack) memory.
    
    Fixes: c021c95498d9 ("x86: Replace our own specialised versions of memset and memcpy with")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/tboot.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index 68bee222dd..90f6e805a9 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -179,6 +179,17 @@ static void update_iommu_mac(vmac_ctx_t *ctx, uint64_t pt_maddr, int level)
 #define is_page_in_use(page) \
     (page_state_is(page, inuse) || page_state_is(page, offlining))
 
+/* Wipe ctx to ensure key is not left in memory. */
+static void wipe_ctx(vmac_ctx_t *ctx)
+{
+    memset(ctx, 0, sizeof(*ctx));
+    /*
+     * Make sure the compiler won't optimize out the memset(), for the local
+     * variable (at the call sites) going out of scope right afterwards.
+     */
+    asm volatile ( "" :: "m" (*ctx) );
+}
+
 static void tboot_gen_domain_integrity(const uint8_t key[TB_KEY_SIZE],
                                        vmac_t *mac)
 {
@@ -216,8 +227,7 @@ static void tboot_gen_domain_integrity(const uint8_t key[TB_KEY_SIZE],
 
     *mac = vmac(NULL, 0, nonce, NULL, &ctx);
 
-    /* wipe ctx to ensure key is not left in memory */
-    memset(&ctx, 0, sizeof(ctx));
+    wipe_ctx(&ctx);
 }
 
 static void tboot_gen_xenheap_integrity(const uint8_t key[TB_KEY_SIZE],
@@ -247,8 +257,7 @@ static void tboot_gen_xenheap_integrity(const uint8_t key[TB_KEY_SIZE],
     }
     *mac = vmac(NULL, 0, nonce, NULL, &ctx);
 
-    /* wipe ctx to ensure key is not left in memory */
-    memset(&ctx, 0, sizeof(ctx));
+    wipe_ctx(&ctx);
 }
 
 static void tboot_gen_frametable_integrity(const uint8_t key[TB_KEY_SIZE],
@@ -276,8 +285,7 @@ static void tboot_gen_frametable_integrity(const uint8_t key[TB_KEY_SIZE],
 
     *mac = vmac(NULL, 0, nonce, NULL, &ctx);
 
-    /* wipe ctx to ensure key is not left in memory */
-    memset(&ctx, 0, sizeof(ctx));
+    wipe_ctx(&ctx);
 }
 
 void tboot_shutdown(uint32_t shutdown_type)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:45:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:45:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465461.724160 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gsN-0003n5-Fe; Sat, 17 Dec 2022 23:45:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465461.724160; Sat, 17 Dec 2022 23:45:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gsN-0003my-Cm; Sat, 17 Dec 2022 23:45:55 +0000
Received: by outflank-mailman (input) for mailman id 465461;
 Sat, 17 Dec 2022 23:45:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsL-0003mi-M4
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsL-0004KA-LK
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsL-0001Qp-Ka
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:45:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eV+K92AZYzNr/dA3m3HRo9KVNmksjbXElc9ZmumLqCQ=; b=Sff+mRaXQalw4ugeFWnTjyKMBm
	qvpm5qGpPnAWaB2JLgaRXteX+ABjwiyzg3xtyLX0ojqSzrm8xM4TMX9r8JlB4QIvMICSdgPHfR1ul
	DO8CgepRJSOZS2VtBw3UZfsH5yY2hrLPhy+t5IltHOZPTk3NkyG0qo5Xr7DOZXZw9AcY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: do not install .deps files
Message-Id: <E1p6gsL-0001Qp-Ka@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:45:53 +0000

commit 96993519424c3fef49fd00d80a271d986767a3cd
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Mon Dec 12 12:29:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 12 12:29:09 2022 +0100

    docs: do not install .deps files
    
    It isn't really part of the documentation. Furthermore, entries there
    are in not determined order, which breaks build reproducibility.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/docs/Makefile b/docs/Makefile
index 8de1efb6f5..966a104490 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -178,6 +178,7 @@ $(foreach i,$(MAN_SECTIONS),$(eval $(call GENERATE_MANPAGE_RULES,$(i))))
 install-html: html txt figs
 	$(INSTALL_DIR) $(DESTDIR)$(docdir)
 	[ ! -d html ] || cp -R html $(DESTDIR)$(docdir)
+	rm -f $(DESTDIR)$(docdir)/html/hypercall/*/.deps
 
 .PHONY: install
 install: install-man-pages install-html
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:46:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:46:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465462.724164 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gsX-0003ph-Hk; Sat, 17 Dec 2022 23:46:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465462.724164; Sat, 17 Dec 2022 23:46: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 1p6gsX-0003pT-EO; Sat, 17 Dec 2022 23:46:05 +0000
Received: by outflank-mailman (input) for mailman id 465462;
 Sat, 17 Dec 2022 23:46:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsV-0003pH-PM
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsV-0004Kb-OZ
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsV-0001RV-Nd
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1twhNJsN0kh3xtJYvDxBhqwH3kffy5S0N2lj5gNuyj0=; b=l6r7Oadh+froC6Zii3cD16/NdL
	8VGMZ62VPxgr/GkJMIYOyBeEKkemTgLFqc0mR6M/LmTBxfSFbzZxDRaJGZFrfVbwe+T8nVC51PBoh
	E4heQasEhu5FVb7oCkiMX2hskrtX6e44r4BYcPwfTLODrjPirlS4ti+dhmllvf0NtTyU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/scripts: add xen-analysis.py for coverity and eclair analysis
Message-Id: <E1p6gsV-0001RV-Nd@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:46:03 +0000

commit b4465e73b1875dea0aaefc98cc27a08666325eef
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Dec 7 13:07:00 2022 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Dec 12 14:19:04 2022 -0800

    xen/scripts: add xen-analysis.py for coverity and eclair analysis
    
    Add new script for coverity/eclair analysis tool that will enable
    the procedure to suppress findings when these tool are used.
    The procedure is documented in docs/misra/documenting-violations.rst
    and the script is documented in docs/misra/xen-static-analysis.rst.
    
    Add in docs/misra/ the files safe.json and
    false-positive-{coverity,eclair}.json that are JSON files containing
    the data structures for the justifications, they are used by the
    analysis script to link the Xen tags to the proprietary tool comment.
    
    Add docs/misra/documenting-violations.rst to explain how to add
    justifications.
    
    Add docs/misra/xen-static-analysis.rst to explain how to use the
    script to analyse Xen.
    
    Add analysis artifacts files to .gitignore.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Tested-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .gitignore                                   |   1 +
 docs/misra/documenting-violations.rst        | 191 +++++++++++++++++++++++++++
 docs/misra/false-positive-coverity.json      |  12 ++
 docs/misra/false-positive-eclair.json        |  12 ++
 docs/misra/safe.json                         |  11 ++
 docs/misra/xen-static-analysis.rst           |  54 ++++++++
 xen/scripts/xen-analysis.py                  |  31 +++++
 xen/scripts/xen_analysis/__init__.py         |   0
 xen/scripts/xen_analysis/generic_analysis.py |  87 ++++++++++++
 xen/scripts/xen_analysis/settings.py         | 111 ++++++++++++++++
 xen/scripts/xen_analysis/tag_database.py     | 109 +++++++++++++++
 xen/scripts/xen_analysis/utils.py            |  56 ++++++++
 12 files changed, 675 insertions(+)

diff --git a/.gitignore b/.gitignore
index ce7caa56af..5f9005358e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
 *.c.cppcheck
 *.opic
 *.a
+*.safparse
 *.so
 *.so.[0-9]*
 *.bin
diff --git a/docs/misra/documenting-violations.rst b/docs/misra/documenting-violations.rst
new file mode 100644
index 0000000000..1d23447556
--- /dev/null
+++ b/docs/misra/documenting-violations.rst
@@ -0,0 +1,191 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Documenting violations
+======================
+
+Static analysers are used on the Xen codebase for both static analysis and MISRA
+compliance.
+There might be the need to suppress some findings instead of fixing them and
+many tools permit the usage of in-code comments that suppress findings so that
+they are not shown in the final report.
+
+Xen includes a tool capable of translating a specific comment used in its
+codebase to the right proprietary in-code comment understandable by the selected
+analyser that suppress its finding.
+
+In the Xen codebase, these tags will be used to document and suppress findings:
+
+ - SAF-X-safe: This tag means that the next line of code contains a finding, but
+   the non compliance to the checker is analysed and demonstrated to be safe.
+ - SAF-X-false-positive-<tool>: This tag means that the next line of code
+   contains a finding, but the finding is a bug of the tool.
+
+SAF stands for Static Analyser Finding, the X is a placeholder for a positive
+number that starts from zero, the number after SAF- shall be incremental and
+unique, base ten notation and without leading zeros.
+
+Entries in the database shall never be removed, even if they are not used
+anymore in the code (if a patch is removing or modifying the faulty line).
+This is to make sure that numbers are not reused which could lead to conflicts
+with old branches or misleading justifications.
+
+An entry can be reused in multiple places in the code to suppress a finding if
+and only if the justification holds for the same non-compliance to the coding
+standard.
+
+An orphan entry, that is an entry who was justifying a finding in the code, but
+later that code was removed and there is no other use of that entry in the code,
+can be reused as long as the justification for the finding holds. This is done
+to avoid the allocation of a new entry with exactly the same justification, that
+would lead to waste of space and maintenance issues of the database.
+
+The files where to store all the justifications are in xen/docs/misra/ and are
+named as safe.json and false-positive-<tool>.json, they have JSON format, each
+one has a different justification schema which shares some fields.
+
+Here is an example to add a new justification in safe.json::
+
+|{
+|    "version": "1.0",
+|    "content": [
+|        {
+|            "id": "SAF-0-safe",
+|            "analyser": {
+|                "coverity": "misra_c_2012_rule_20_7_violation",
+|                "eclair": "MC3R1.R20.7"
+|            },
+|            "name": "R20.7 C macro parameters not used as expression",
+|            "text": "The macro parameters used in this [...]"
+|        },
+|        {
+|            "id": "SAF-1-safe",
+|            "analyser": {},
+|            "name": "Sentinel",
+|            "text": "Next ID to be used"
+|        }
+|    ]
+|}
+
+To document a finding in safe.json, just add another block {[...]} before the
+sentinel block, using the id contained in the sentinel block and increment by
+one the number contained in the id of the sentinel block.
+
+Here is an explanation of the fields inside an object of the "content" array:
+ - id: it is a unique string that is used to refer to the finding, many finding
+   can be tagged with the same id, if the justification holds for any applied
+   case.
+   It tells the tool to substitute a Xen in-code comment having this structure:
+   /* SAF-0-safe [...] \*/
+ - analyser: it is an object containing pair of key-value strings, the key is
+   the analyser, so it can be coverity or eclair, the value is the proprietary
+   id corresponding on the finding, for example when coverity is used as
+   analyser, the tool will translate the Xen in-code coment in this way:
+   /* SAF-0-safe [...] \*/ -> /* coverity[misra_c_2012_rule_20_7_violation] \*/
+   if the object doesn't have a key-value, then the corresponding in-code
+   comment won't be translated.
+ - name: a simple name for the finding
+ - text: a proper justification to turn off the finding.
+
+
+Here is an example to add a new justification in false-positive-<tool>.json::
+
+|{
+|    "version": "1.0",
+|    "content": [
+|        {
+|            "id": "SAF-0-false-positive-<tool>",
+|            "violation-id": "<proprietary-id>",
+|            "tool-version": "<version>",
+|            "name": "R20.7 [...]",
+|            "text": "[...]"
+|        },
+|        {
+|            "id": "SAF-1-false-positive-<tool>",
+|            "violation-id": "",
+|            "tool-version": "",
+|            "name": "Sentinel",
+|            "text": "Next ID to be used"
+|        }
+|    ]
+|}
+
+To document a finding in false-positive-<tool>.json, just add another block
+{[...]} before the sentinel block, using the id contained in the sentinel block
+and increment by one the number contained in the id of the sentinel block.
+
+Here is an explanation of the fields inside an object of the "content" array:
+ - id: it has the same meaning as in the "safe" justification schema.
+   It tells the tool to substitute a Xen in-code comment having this structure:
+   /* SAF-0-false-positive-<tool> [...] \*/
+ - violation-id: its value is a string containing the proprietary id
+   corresponding to the finding, for example when <tool> is coverity, the Xen
+   tool will translate the Xen in-code coment in this way:
+   /* SAF-0-false-positive-coverity [...] \*/ -> /* coverity[misra_c_2012_rule_20_7_violation] \*/
+   if the object doesn't have a value, then the corresponding in-code comment
+   won't be translated.
+ - tool-version: the version of the tool affected by the false positive, if it
+   is discovered in more than one version, this string can be a range
+   (eg. 2.7 - 3.0)
+ - name, text: they have the same meaning as in the "safe" justification schema.
+
+
+Justification example
+---------------------
+
+Here an example of the usage of the in-code comment tags to suppress a finding
+for the Rule 8.6:
+
+Eclair reports it in its web report, file xen/include/xen/kernel.h, line 68:
+
+| MC3R1.R8.6 for program 'xen/xen-syms', variable '_start' has no definition
+
+Also coverity reports it, here is an extract of the finding:
+
+| xen/include/xen/kernel.h:68:
+| 1. misra_c_2012_rule_8_6_violation: Function "_start" is declared but never
+ defined.
+
+The analysers are complaining because we have this in xen/include/xen/kernel.h
+at line 68::
+
+| extern char _start[], _end[], start[];
+
+Those are symbols exported by the linker, hence we will need to have a proper
+deviation for this finding.
+
+We will prepare our entry in the safe.json database::
+
+|{
+|    "version": "1.0",
+|    "content": [
+|        {
+|        [...]
+|        },
+|        {
+|            "id": "SAF-1-safe",
+|            "analyser": {
+|                "eclair": "MC3R1.R8.6",
+|                "coverity": "misra_c_2012_rule_8_6_violation"
+|            },
+|            "name": "Rule 8.6: linker script defined symbols",
+|            "text": "It is safe to declare this symbol because it is defined in the linker script."
+|        },
+|        {
+|            "id": "SAF-2-safe",
+|            "analyser": {},
+|            "name": "Sentinel",
+|            "text": "Next ID to be used"
+|        }
+|    ]
+|}
+
+And we will use the proper tag above the violation line::
+
+| /* SAF-1-safe R8.6 linker defined symbols */
+| extern char _start[], _end[], start[];
+
+This entry will fix also the violation on _end and start, because they are on
+the same line and the same "violation ID".
+
+Also, the same tag can be used on other symbols from the linker that are
+declared in the codebase, because the justification holds for them too.
diff --git a/docs/misra/false-positive-coverity.json b/docs/misra/false-positive-coverity.json
new file mode 100644
index 0000000000..462448414f
--- /dev/null
+++ b/docs/misra/false-positive-coverity.json
@@ -0,0 +1,12 @@
+{
+    "version": "1.0",
+    "content": [
+        {
+            "id": "SAF-0-false-positive-coverity",
+            "violation-id": "",
+            "tool-version": "",
+            "name": "Sentinel",
+            "text": "Next ID to be used"
+        }
+    ]
+}
diff --git a/docs/misra/false-positive-eclair.json b/docs/misra/false-positive-eclair.json
new file mode 100644
index 0000000000..1d6ea5d7f0
--- /dev/null
+++ b/docs/misra/false-positive-eclair.json
@@ -0,0 +1,12 @@
+{
+    "version": "1.0",
+    "content": [
+        {
+            "id": "SAF-0-false-positive-eclair",
+            "violation-id": "",
+            "tool-version": "",
+            "name": "Sentinel",
+            "text": "Next ID to be used"
+        }
+    ]
+}
diff --git a/docs/misra/safe.json b/docs/misra/safe.json
new file mode 100644
index 0000000000..e079d30381
--- /dev/null
+++ b/docs/misra/safe.json
@@ -0,0 +1,11 @@
+{
+    "version": "1.0",
+    "content": [
+        {
+            "id": "SAF-0-safe",
+            "analyser": {},
+            "name": "Sentinel",
+            "text": "Next ID to be used"
+        }
+    ]
+}
diff --git a/docs/misra/xen-static-analysis.rst b/docs/misra/xen-static-analysis.rst
new file mode 100644
index 0000000000..5b886474d4
--- /dev/null
+++ b/docs/misra/xen-static-analysis.rst
@@ -0,0 +1,54 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Xen static analysis
+===================
+
+The Xen codebase integrates some scripts and tools that helps the developer to
+perform static analysis of the code, currently Xen supports three analysis tool
+that are eclair, coverity and cppcheck.
+The Xen tree has a script (xen-analysis.py) available to ease the analysis
+process and it integrates a way to suppress findings on these tools (only Eclair
+and Coverity are currently supported by the script), please check the
+documenting-violation.rst document to know more about it.
+
+Analyse Xen with Coverity or Eclair
+-----------------------------------
+
+The xen-analysis.py script has two arguments to select which tool is used for
+the analysis:
+
+ - xen-analysis.py --run-coverity -- [optional make arguments]
+ - xen-analysis.py --run-eclair -- [optional make arguments]
+
+For example when using Coverity to analyse a Xen build obtained by passing these
+arguments to the make system: XEN_TARGET_ARCH=arm64
+CROSS_COMPILE=aarch64-linux-gnu-, the optional make arguments passed to
+xen-analysis.py must be the same and the command below should be passed to
+Coverity in its build phase:
+
+ - xen-analysis.py --run-coverity -- XEN_TARGET_ARCH=arm64
+   CROSS_COMPILE=aarch64-linux-gnu-
+
+Which tells to the script to prepare the codebase for an analysis by Coverity
+and forwards the make arguments to the make build invocation.
+
+When invoking the script, the procedure below will be followed:
+
+ 1. Find which files among \*.c and \*.h has any in-code comment as
+    /* SAF-X-[...] \*/, the meaning of these comments is explained in
+    documenting-violation.rst.
+    Save the files obtained as <file>.safparse and generate <file> files where
+    the special in-code comments above are substituted with the proprietary
+    in-code comment used by the selected analysis tool. The safe.json and
+    false-positive-<tool>.json text file database are used to link each Xen tag
+    to the right proprietary in-code comment.
+ 2. Now Xen compilation starts using every <additional make parameters> supplied
+    at the script invocation. Coverity and Eclair are capable of intercepting
+    the compiler running from make to perform their analysis without
+    instrumenting the makefile.
+ 3. As final step every <file>.safparse file are reverted back as <file> and
+    every artifact related to the analysis will be cleaned.
+    This step is performed even in case any of the previous step fail, to skip
+    this step, call the script adding the --no-clean argument, but before
+    running again the script, call it with the --clean-only argument, that will
+    execute only this cleaning step.
diff --git a/xen/scripts/xen-analysis.py b/xen/scripts/xen-analysis.py
new file mode 100755
index 0000000000..b5d9ef1862
--- /dev/null
+++ b/xen/scripts/xen-analysis.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+
+import sys
+from xen_analysis import settings, generic_analysis
+from xen_analysis.generic_analysis import *
+
+
+def main(argv):
+    ret_code = 0
+    settings.parse_commandline(argv)
+    try:
+        if settings.step_parse_tags:
+            generic_analysis.parse_xen_tags()
+        if settings.step_build_xen:
+            generic_analysis.build_xen()
+    except (ParseTagPhaseError, BuildPhaseError) as e:
+        print("ERROR: {}".format(e))
+        if hasattr(e, "errorcode"):
+            ret_code = e.errorcode
+    finally:
+        if settings.step_clean_analysis:
+            e = generic_analysis.clean_analysis_artifacts()
+            if e:
+                print("ERROR: {}".format(e))
+                ret_code = 1
+
+    sys.exit(ret_code)
+
+
+if __name__ == "__main__":
+    main(sys.argv[1:])
diff --git a/xen/scripts/xen_analysis/__init__.py b/xen/scripts/xen_analysis/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/xen/scripts/xen_analysis/generic_analysis.py b/xen/scripts/xen_analysis/generic_analysis.py
new file mode 100644
index 0000000000..372ff35664
--- /dev/null
+++ b/xen/scripts/xen_analysis/generic_analysis.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python3
+
+import os, subprocess
+from . import settings, utils, tag_database
+
+class ParseTagPhaseError(Exception):
+    pass
+
+class BuildPhaseError(Exception):
+    pass
+
+class CleanPhaseError(Exception):
+    pass
+
+
+def parse_xen_tags():
+    # Load the database for the Xen tags
+    subs_list = tag_database.load_tag_database(
+        settings.analysis_tool,
+        [settings.repo_dir + "/docs/misra/safe.json"]
+    )
+    subs_list = tag_database.load_tag_database(
+        settings.analysis_tool,
+        [settings.repo_dir + "/docs/misra/false-positive-{}.json"
+                                .format(settings.analysis_tool)],
+        subs_list,
+        "false-positive"
+    )
+
+    # Create outdir if it doesn't exists
+    os.makedirs(settings.outdir, exist_ok=True)
+
+    # The following lambda function will return a file if it contains lines with
+    # a comment containing "SAF-<number>-{safe|false-positive-<tool>}" on a
+    # single line.
+    grep_action = lambda x: utils.grep(x,
+                                    tag_database.get_xen_tag_comment_regex(
+                                                        settings.analysis_tool)
+    )
+    # Look for a list of .h/.c files that matches the condition above
+    parse_file_list = utils.recursive_find_file(settings.xen_dir, r'.*\.[ch]$',
+                                                grep_action)
+
+    for entry in parse_file_list:
+        file = entry["file"]
+        bkp_file = file + ".safparse"
+        if os.path.isfile(bkp_file):
+            raise ParseTagPhaseError(
+                "Found {}, please check the integrity of {}"
+                    .format(bkp_file,file)
+                )
+        os.rename(file, bkp_file)
+        time_bkp_file = os.stat(bkp_file)
+        # Create <file> from <file>.safparse but with the Xen tag parsed
+        tag_database.substitute_tags(settings.analysis_tool, bkp_file, entry,
+                                     subs_list)
+        # Set timestamp for file equal to bkp_file, so that if the file is
+        # modified during the process by the user, we can catch it
+        os.utime(file, (time_bkp_file.st_atime, time_bkp_file.st_mtime))
+
+
+def build_xen():
+    utils.invoke_command(
+            "make -C {} {} build"
+                .format(settings.xen_dir, settings.make_forward_args),
+            False, BuildPhaseError,
+            "Build error occured when running:\n{}"
+        )
+
+
+def clean_analysis_artifacts():
+    safparse_files = utils.recursive_find_file(settings.xen_dir,
+                                               r'.*.safparse$')
+    for original_file in safparse_files:
+        # This commands strips the .safparse extension, leaving <file>
+        parsed_file_path = os.path.splitext(original_file)[0]
+        mtime_original_file = os.stat(original_file).st_mtime
+        mtime_parsed_file = os.stat(parsed_file_path).st_mtime
+        if mtime_original_file != mtime_parsed_file:
+            return CleanPhaseError(
+                    "The file {} was modified during the analysis "
+                    "procedure, it is impossible now to restore from the "
+                    "content of {}, please handle it manually"
+                    .format(parsed_file_path, original_file)
+                )
+        # Replace <file>.safparse to <file>
+        os.replace(original_file, parsed_file_path)
diff --git a/xen/scripts/xen_analysis/settings.py b/xen/scripts/xen_analysis/settings.py
new file mode 100644
index 0000000000..e8d474eaf3
--- /dev/null
+++ b/xen/scripts/xen_analysis/settings.py
@@ -0,0 +1,111 @@
+#!/usr/bin/env python3
+
+import sys, re, os
+
+module_dir = os.path.dirname(os.path.realpath(__file__))
+xen_dir = os.path.realpath(module_dir + "/../..")
+repo_dir = os.path.realpath(xen_dir + "/..")
+tools_dir = os.path.realpath(xen_dir + "/tools")
+
+step_parse_tags = True
+step_build_xen = True
+step_clean_analysis = True
+
+target_build = False
+target_clean = False
+
+analysis_tool = ""
+make_forward_args = ""
+outdir = xen_dir
+
+
+def help():
+    msg="""
+Usage: {} [OPTION] ... [-- [make arguments]]
+
+This script runs the analysis on the Xen codebase.
+
+The phases for the analysis are <tags>, <build>, <clean>
+
+Depending on the options below, only some phases will run:
+
+<no options>: tags, build, clean
+--build-only: build
+--clean-only: clean
+--no-build:   tags, clean
+--no-clean:   tags, build
+
+--no-build/--no-clean can be passed together to avoid both clean and build
+phases.
+Tags and build phases need to specify --run-coverity or --run-eclair.
+
+Options:
+  --build-only    Run only the commands to build Xen with the optional make
+                  arguments passed to the script
+  --clean-only    Run only the commands to clean the analysis artifacts
+  -h, --help      Print this help
+  --no-build      Skip the build Xen phase
+  --no-clean      Don\'t clean the analysis artifacts on exit
+  --run-coverity  Run the analysis for the Coverity tool
+  --run-eclair    Run the analysis for the Eclair tool
+"""
+    print(msg.format(sys.argv[0]))
+
+
+def parse_commandline(argv):
+    global analysis_tool
+    global make_forward_args
+    global outdir
+    global step_parse_tags
+    global step_build_xen
+    global step_clean_analysis
+    global target_build
+    global target_clean
+    forward_to_make = False
+    for option in argv:
+        if forward_to_make:
+            # Intercept outdir
+            outdir_regex = re.match("^O=(.*)$", option)
+            if outdir_regex:
+                outdir = outdir_regex.group(1)
+            # Forward any make arguments
+            make_forward_args = make_forward_args + " " + option
+        elif option == "--build-only":
+            target_build = True
+        elif option == "--clean-only":
+            target_clean = True
+        elif (option == "--help") or (option == "-h"):
+            help()
+            sys.exit(0)
+        elif option == "--no-build":
+            step_build_xen = False
+        elif option == "--no-clean":
+            step_clean_analysis = False
+        elif (option == "--run-coverity") or (option == "--run-eclair"):
+            analysis_tool = option[6:]
+        elif option == "--":
+            forward_to_make = True
+        else:
+            print("Invalid option: {}".format(option))
+            help()
+            sys.exit(1)
+
+    if target_build and target_clean:
+        print("--build-only is not compatible with --clean-only argument.")
+        sys.exit(1)
+
+    if target_clean:
+        step_parse_tags = False
+        step_build_xen = False
+        step_clean_analysis = True
+        return
+
+    if analysis_tool == "":
+        print("Please specify one analysis tool.")
+        help()
+        sys.exit(1)
+
+    if target_build:
+        step_parse_tags = False
+        step_build_xen = True
+        step_clean_analysis = False
diff --git a/xen/scripts/xen_analysis/tag_database.py b/xen/scripts/xen_analysis/tag_database.py
new file mode 100644
index 0000000000..ca374bbb62
--- /dev/null
+++ b/xen/scripts/xen_analysis/tag_database.py
@@ -0,0 +1,109 @@
+#!/usr/bin/env python3
+
+import re, json
+
+class TagDatabaseError(Exception):
+    pass
+
+# This is the dictionary for the rules that translates to proprietary comments:
+#  - cppcheck: /* cppcheck-suppress[id] */
+#  - coverity: /* coverity[id] */
+#  - eclair:   /* -E> hide id 1 "" */
+# Add entries to support more analyzers
+tool_syntax = {
+    "cppcheck":"cppcheck-suppress[VID]",
+    "coverity":"coverity[VID]",
+    "eclair":"-E> hide VID 1 \"\""
+}
+
+
+def get_xen_tag_index_type_regex(tool):
+    return r'^SAF-(\d+)-(safe|false-positive-' + tool + ')$'
+
+
+def get_xen_tag_comment_regex(tool):
+    return r'^[ \t]*/\* +(SAF-\d+-(?:safe|false-positive-' + tool + ')).*\*/$'
+
+
+# Returns a data structure containing dictionaries for safe and false-positive-*
+# Xen tags, the key is the unique index of the tag and the content is the
+# proprietary in-code comment to be used when the tag is found in the codebase
+def load_tag_database(tool, input_files, data_struct = None, schema = "safe"):
+    ret = data_struct if data_struct is not None else {
+        "safe": {},
+        "false-positive-" + tool: {}
+    }
+    database = []
+
+    # Open all input files
+    for file in input_files:
+        try:
+            with open(file, "rt") as handle:
+                content = json.load(handle)
+                database = database + content['content']
+        except json.JSONDecodeError as e:
+            raise TagDatabaseError("JSON decoding error in file {}: {}"
+                                    .format(file, e))
+        except Exception as e:
+            raise TagDatabaseError("Can't open file {}: {}"
+                                    .format(file, e))
+
+    for entry in database:
+        # If the false-positive schema is used, check the proprietary id in the
+        # 'violation-id' field, otherwise rely on the "safe" schema.
+        if schema == "false-positive":
+            proprietary_id = entry['violation-id']
+        elif tool in entry['analyser']:
+            proprietary_id = entry['analyser'][tool]
+        else:
+            proprietary_id = ""
+        if proprietary_id != "":
+            comment=tool_syntax[tool].replace("VID",proprietary_id)
+            # Regex to capture the index of the Xen tag and the schema
+            xen_tag = re.compile(get_xen_tag_index_type_regex(tool))\
+                            .match(entry["id"])
+            if xen_tag and xen_tag.group(1) and xen_tag.group(2):
+                # Save in safe or false-positive-* the key {#id: "comment"}
+                id_number = int(xen_tag.group(1))
+                key = xen_tag.group(2)
+                ret[key][id_number] = "/* {} */\n".format(comment)
+            else:
+                raise TagDatabaseError(
+                        "Error in database file, entry {} has unexpected "
+                        "format.".format(entry["id"])
+                    )
+
+    return ret
+
+
+def substitute_tags(tool, input_file, grep_struct, subs_rules):
+    try:
+        with open(grep_struct["file"], "wt") as outfile:
+
+            try:
+                with open(input_file, "rt") as infile:
+                    parsed_content = infile.readlines()
+            except Exception as e:
+                raise TagDatabaseError("Issue with reading file {}: {}"
+                                       .format(input_file, e))
+
+            # grep_struct contains the line number where the comments are, the
+            # line number starts from 1 but in the array the first line is zero.
+            # For every line where there is a Xen tag comment, get the Xen tag
+            # that is in the capture group zero, extract from the Xen tag the
+            # unique index and the type (safe, false-positive-*) and with those
+            # information access the subs_rules dictionary to see if there is
+            # a match
+            for line_number in grep_struct["matches"]:
+                xen_tag = grep_struct["matches"][line_number][0]
+                xen_tag_regex_obj = re.compile(
+                            get_xen_tag_index_type_regex(tool)).match(xen_tag)
+                id_number = int(xen_tag_regex_obj.group(1))
+                key = xen_tag_regex_obj.group(2)
+                if id_number in subs_rules[key]:
+                    parsed_content[line_number-1] = subs_rules[key][id_number]
+
+            outfile.writelines(parsed_content)
+    except Exception as e:
+        raise TagDatabaseError("Issue with writing file {}: {}"
+                               .format(grep_struct["file"], e))
diff --git a/xen/scripts/xen_analysis/utils.py b/xen/scripts/xen_analysis/utils.py
new file mode 100644
index 0000000000..1193e3f463
--- /dev/null
+++ b/xen/scripts/xen_analysis/utils.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python3
+
+import os, re, subprocess
+
+
+def grep(filepath, regex):
+    regObj = re.compile(regex)
+    res = { "file": filepath, "matches": {} }
+    try:
+        with open(filepath, "rt") as f:
+            line_number = 1
+            for line in f:
+                match = regObj.match(line)
+                if match:
+                    res["matches"][line_number] = match.groups()
+                line_number = line_number + 1
+    except Exception as e:
+        print("WARNING: Can't open {}: {}".format(filepath, e))
+
+    # Return filename and line matches if there are
+    return res if res["matches"] else {}
+
+
+def recursive_find_file(path, filename_regex, action = None):
+    filename_reg_obj = re.compile(filename_regex)
+    res = []
+    for root, dirs, fnames in os.walk(path):
+        for fname in fnames:
+            if filename_reg_obj.match(fname):
+                if action is None:
+                    res.append(os.path.join(root, fname))
+                else:
+                    out = action(os.path.join(root, fname))
+                    if out:
+                        res.append(out)
+
+    return res
+
+
+def invoke_command(command, needs_output, exeption_type = Exception,
+                   exeption_msg = ""):
+    try:
+        pipe_stdout = subprocess.PIPE if (needs_output == True) else None
+        output = subprocess.run(command, shell=True, check=True,
+                                stdout=pipe_stdout, stderr=subprocess.STDOUT,
+                                encoding='utf8')
+    except (subprocess.CalledProcessError, subprocess.SubprocessError) as e:
+        if needs_output == True:
+            exeption_msg = exeption_msg.format(e.cmd, output.stdout)
+        else:
+            exeption_msg = exeption_msg.format(e.cmd)
+        excp = exeption_type(exeption_msg)
+        excp.errorcode = e.returncode if hasattr(e, 'returncode') else 1
+        raise excp
+
+    return output.stdout
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:46:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:46:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465463.724168 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gsh-0003t2-M2; Sat, 17 Dec 2022 23:46:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465463.724168; Sat, 17 Dec 2022 23:46: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 1p6gsh-0003su-Iv; Sat, 17 Dec 2022 23:46:15 +0000
Received: by outflank-mailman (input) for mailman id 465463;
 Sat, 17 Dec 2022 23:46:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsf-0003sh-SR
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsf-0004Km-Re
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsf-0001Rx-Qv
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=B1n/OPZEr6GtoNcqW5HrbqfAh40unoJNjFkWNZpig2A=; b=eapAvu2Ooy98oJbR3OnaFQaMG9
	xCFtD+MAQjJmr2zgVvmWofF1nWN/fTtkKH5ZR/g4i/2/8/WHsthzoP75Uql7UjbFl2yXJxhENZTff
	KyNYGuWtKGSRkN3nMfOB4xn/LgLuD5t1+1TomXnWDiXc0TH/x5fAjk5qnw/esQn1GrPQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/scripts: add cppcheck tool to the xen-analysis.py script
Message-Id: <E1p6gsf-0001Rx-Qv@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:46:13 +0000

commit 02b26c02c7c497f78e2468204b9223f13ed6a69d
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Dec 7 13:07:01 2022 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Dec 12 14:19:11 2022 -0800

    xen/scripts: add cppcheck tool to the xen-analysis.py script
    
    Add Cppcheck analysis to the xen-analysis.py script using the
    arguments --run-cppcheck.
    
    Now cppcheck analysis will build Xen while the analysis is performed
    on the source files, it will produce a text report and an additional
    html output when the script is called with --cppcheck-html.
    
    With this patch cppcheck will benefit of platform configuration files
    that will help it to understand the target of the compilation and
    improve the analysis. These are XML files placed in
    xen/tools/cppcheck-plat/, describing to cppcheck the length of basic
    types to help it in the analysis.
    
    To do so:
     - Update xen-analysis.py with the code to integrate cppcheck.
     - add platform configuration files for cppcheck..
     - add cppcheck-cc.sh script that is a wrapper for cppcheck and it's
       used as Xen compiler, it will intercept all flags given from the
       make build system and it will execute cppcheck on the compiled
       file together with the file compilation.
     - guarded hypercall-defs.c with CPPCHECK define because cppcheck
       gets confused as the file does not contain c code.
     - add false-positive-cppcheck.json file
     - update documentation.
     - update .gitignore
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Tested-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .gitignore                                        |   6 +
 docs/misra/cppcheck.txt                           |  27 +--
 docs/misra/documenting-violations.rst             |  27 ++-
 docs/misra/false-positive-cppcheck.json           |  12 +
 docs/misra/xen-static-analysis.rst                |  42 +++-
 xen/include/hypercall-defs.c                      |   9 +
 xen/scripts/xen-analysis.py                       |  18 +-
 xen/scripts/xen_analysis/cppcheck_analysis.py     | 273 ++++++++++++++++++++++
 xen/scripts/xen_analysis/cppcheck_report_utils.py | 130 +++++++++++
 xen/scripts/xen_analysis/generic_analysis.py      |   9 +-
 xen/scripts/xen_analysis/settings.py              |  88 +++++--
 xen/tools/cppcheck-cc.sh                          | 223 ++++++++++++++++++
 xen/tools/cppcheck-plat/arm32-wchar_t4.xml        |  17 ++
 xen/tools/cppcheck-plat/arm64-wchar_t2.xml        |  17 ++
 xen/tools/cppcheck-plat/x86_64-wchar_t2.xml       |  17 ++
 15 files changed, 864 insertions(+), 51 deletions(-)

diff --git a/.gitignore b/.gitignore
index 5f9005358e..ea64b6d201 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,8 +8,11 @@
 *.d
 *.d2
 *.c.cppcheck
+*.cppcheck.txt
+*.cppcheck.xml
 *.opic
 *.a
+*.c.json
 *.safparse
 *.so
 *.so.[0-9]*
@@ -283,9 +286,11 @@ xen/arch/*/efi/efi.h
 xen/arch/*/efi/pe.c
 xen/arch/*/efi/runtime.c
 xen/arch/*/include/asm/asm-offsets.h
+xen/build-dir-cppcheck/
 xen/common/config_data.S
 xen/common/config.gz
 xen/cppcheck-htmlreport/
+xen/cppcheck-report/
 xen/cppcheck-misra.*
 xen/include/headers*.chk
 xen/include/compat/*
@@ -316,6 +321,7 @@ xen/xsm/flask/xenpolicy-*
 tools/flask/policy/policy.conf
 tools/flask/policy/xenpolicy-*
 xen/xen
+xen/suppression-list.txt
 xen/xen-cppcheck.xml
 xen/xen-syms
 xen/xen-syms.map
diff --git a/docs/misra/cppcheck.txt b/docs/misra/cppcheck.txt
index 25d8c3050b..f7b9f678b4 100644
--- a/docs/misra/cppcheck.txt
+++ b/docs/misra/cppcheck.txt
@@ -3,8 +3,7 @@ Cppcheck for Xen static and MISRA analysis
 
 Xen can be analysed for both static analysis problems and MISRA violation using
 cppcheck, the open source tool allows the creation of a report with all the
-findings. Xen has introduced the support in the Makefile so it's very easy to
-use and in this document we can see how.
+findings.
 
 The minimum version required for cppcheck is 2.7. Note that at the time of
 writing (June 2022), the version 2.8 is known to be broken [1].
@@ -38,27 +37,7 @@ Dependencies are listed in the readme.md of the project repository.
 Use cppcheck to analyse Xen
 ===========================
 
-Using cppcheck integration is very simple, it requires few steps:
-
- 1) Compile Xen
- 2) call the cppcheck make target to generate a report in xml format:
-    make CPPCHECK_MISRA=y cppcheck
- 3) call the cppcheck-html make target to generate a report in xml and html
-    format:
-    make CPPCHECK_MISRA=y cppcheck-html
-
-    In case the cppcheck binaries are not in the PATH, CPPCHECK and
-    CPPCHECK_HTMLREPORT variables can be overridden with the full path to the
-    binaries:
-
-    make -C xen \
-        CPPCHECK=/path/to/cppcheck \
-        CPPCHECK_HTMLREPORT=/path/to/cppcheck-htmlreport \
-        CPPCHECK_MISRA=y \
-        cppcheck-html
-
-The output is by default in a folder named cppcheck-htmlreport, but the name
-can be changed by passing it in the CPPCHECK_HTMLREPORT_OUTDIR variable.
-
+To analyse Xen using cppcheck, please refer to the document
+xen-static-analysis.rst, section "Analyse Xen with Cppcheck".
 
 [1] https://sourceforge.net/p/cppcheck/discussion/general/thread/bfc3ab6c41/?limit=25
diff --git a/docs/misra/documenting-violations.rst b/docs/misra/documenting-violations.rst
index 1d23447556..0d02a8e6f9 100644
--- a/docs/misra/documenting-violations.rst
+++ b/docs/misra/documenting-violations.rst
@@ -51,6 +51,7 @@ Here is an example to add a new justification in safe.json::
 |        {
 |            "id": "SAF-0-safe",
 |            "analyser": {
+|                "cppcheck": "misra-c2012-20.7",
 |                "coverity": "misra_c_2012_rule_20_7_violation",
 |                "eclair": "MC3R1.R20.7"
 |            },
@@ -77,9 +78,9 @@ Here is an explanation of the fields inside an object of the "content" array:
    It tells the tool to substitute a Xen in-code comment having this structure:
    /* SAF-0-safe [...] \*/
  - analyser: it is an object containing pair of key-value strings, the key is
-   the analyser, so it can be coverity or eclair, the value is the proprietary
-   id corresponding on the finding, for example when coverity is used as
-   analyser, the tool will translate the Xen in-code coment in this way:
+   the analyser, so it can be cppcheck, coverity or eclair, the value is the
+   proprietary id corresponding on the finding, for example when coverity is
+   used as analyser, the tool will translate the Xen in-code coment in this way:
    /* SAF-0-safe [...] \*/ -> /* coverity[misra_c_2012_rule_20_7_violation] \*/
    if the object doesn't have a key-value, then the corresponding in-code
    comment won't be translated.
@@ -189,3 +190,23 @@ the same line and the same "violation ID".
 
 Also, the same tag can be used on other symbols from the linker that are
 declared in the codebase, because the justification holds for them too.
+
+A possible violation found by Cppcheck can be handled in the same way, from the
+cppcheck text report it is possible to identify the violation id:
+
+| include/public/arch-arm.h(226,0):misra-c2012-20.7:style:Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses (Misra rule 20.7)
+
+The violation id can be located also in the HTML report, opening index.html from
+the browser, the violations can be filtered by id in the left side panel, under
+the column "Defect ID". On the right there will be a list of files with the type
+of violation and the violation line number, for the same violation above, there
+will be an entry like the following and the violation id will be in the column
+"Id":
+
+| include/public/arch-arm.h
+| [...]
+| 226 misra-c2012-20.7  style Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses (Misra rule 20.7)
+| [...]
+
+Given the violation id "misra-c2012-20.7", the procedure above can be followed
+to justify this finding.
diff --git a/docs/misra/false-positive-cppcheck.json b/docs/misra/false-positive-cppcheck.json
new file mode 100644
index 0000000000..5d4da2ce61
--- /dev/null
+++ b/docs/misra/false-positive-cppcheck.json
@@ -0,0 +1,12 @@
+{
+    "version": "1.0",
+    "content": [
+        {
+            "id": "SAF-0-false-positive-cppcheck",
+            "violation-id": "",
+            "tool-version": "",
+            "name": "Sentinel",
+            "text": "Next ID to be used"
+        }
+    ]
+}
diff --git a/docs/misra/xen-static-analysis.rst b/docs/misra/xen-static-analysis.rst
index 5b886474d4..2712255db1 100644
--- a/docs/misra/xen-static-analysis.rst
+++ b/docs/misra/xen-static-analysis.rst
@@ -7,9 +7,8 @@ The Xen codebase integrates some scripts and tools that helps the developer to
 perform static analysis of the code, currently Xen supports three analysis tool
 that are eclair, coverity and cppcheck.
 The Xen tree has a script (xen-analysis.py) available to ease the analysis
-process and it integrates a way to suppress findings on these tools (only Eclair
-and Coverity are currently supported by the script), please check the
-documenting-violation.rst document to know more about it.
+process and it integrates a way to suppress findings on these tools, please
+check the documenting-violation.rst document to know more about it.
 
 Analyse Xen with Coverity or Eclair
 -----------------------------------
@@ -52,3 +51,40 @@ When invoking the script, the procedure below will be followed:
     this step, call the script adding the --no-clean argument, but before
     running again the script, call it with the --clean-only argument, that will
     execute only this cleaning step.
+
+
+Analyse Xen with Cppcheck
+-------------------------
+
+Cppcheck tool is integrated in xen-analysis.py script, when using the script,
+the tool will be called on every source file compiled by the make build system.
+Here how to start the analysis with Cppcheck:
+
+ - xen-analysis.py --run-cppcheck [--cppcheck-misra] [--cppcheck-html] --
+   [optional make arguments]
+
+The command above tells the script to prepare the codebase and use Cppcheck tool
+for the analysis.
+The optional argument --cppcheck-misra activates the analysis also for MISRA
+compliance.
+The optional argument --cppcheck-html instruct cppcheck to produce an additional
+HTML report.
+
+When invoking the script for Cppcheck analysis, the followed procedure is
+similar to the one above for Coverity or Eclair, but it has some additional
+steps:
+
+ 1. This step is the same as step 1 for Coverity/Eclair.
+ 2. The cppcheck dependency are created, build directory for cppcheck analysis
+    and an header file containing internal compiler macro
+    (include/generated/compiler-def.h) are generated
+ 3. Xen compilation starts using every <additional make parameters> supplied
+    at the script invocation, but because cppcheck is not able to intercept the
+    compiled files and flags on compiler invocation, a script (cppcheck-cc.sh)
+    is passed as CC to the make system, it is a wrapper for the compiler that
+    will also execute cppcheck on every compiled file.
+ 4. After the compilation and analysis, the cppcheck report will be created
+    putting together all the cppcheck report fragments for every analysed file.
+    Cppcheck will produce a text fragment and an additional XML report fragment
+    if the script is configured to produce the HTML output.
+ 5. This step is the same as step 3 for Coverity/Eclair.
diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index 1896121074..41e1af01f6 100644
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -60,6 +60,13 @@
  * are possible.
  */
 
+/*
+ * Cppcheck thinks this file needs to be analysed because it is preprocessed by
+ * the compiler, but it gets confused because this file does not contains C
+ * code. Hence protect the code when CPPCHECK is used.
+ */
+#ifndef CPPCHECK
+
 #ifdef CONFIG_HVM
 #define PREFIX_hvm hvm
 #else
@@ -288,3 +295,5 @@ mca                                do       do       -        -        -
 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
 paging_domctl_cont                 do       do       do       do       -
 #endif
+
+#endif /* !CPPCHECK */
diff --git a/xen/scripts/xen-analysis.py b/xen/scripts/xen-analysis.py
index b5d9ef1862..8e50c27cd8 100755
--- a/xen/scripts/xen-analysis.py
+++ b/xen/scripts/xen-analysis.py
@@ -1,28 +1,42 @@
 #!/usr/bin/env python3
 
 import sys
-from xen_analysis import settings, generic_analysis
+from xen_analysis import settings, generic_analysis, cppcheck_analysis
 from xen_analysis.generic_analysis import *
+from xen_analysis.cppcheck_analysis import *
+
+PhaseExceptions = (GetMakeVarsPhaseError, ParseTagPhaseError,
+                   CppcheckDepsPhaseError, BuildPhaseError,
+                   CppcheckReportPhaseError)
 
 
 def main(argv):
     ret_code = 0
     settings.parse_commandline(argv)
     try:
+        if settings.step_get_make_vars:
+            cppcheck_analysis.get_make_vars()
         if settings.step_parse_tags:
             generic_analysis.parse_xen_tags()
+        if settings.step_cppcheck_deps:
+            cppcheck_analysis.generate_cppcheck_deps()
         if settings.step_build_xen:
             generic_analysis.build_xen()
-    except (ParseTagPhaseError, BuildPhaseError) as e:
+        if settings.step_cppcheck_report:
+            cppcheck_analysis.generate_cppcheck_report()
+    except PhaseExceptions as e:
         print("ERROR: {}".format(e))
         if hasattr(e, "errorcode"):
             ret_code = e.errorcode
     finally:
         if settings.step_clean_analysis:
+            cppcheck_analysis.clean_analysis_artifacts()
             e = generic_analysis.clean_analysis_artifacts()
             if e:
                 print("ERROR: {}".format(e))
                 ret_code = 1
+        if settings.step_distclean_analysis:
+            cppcheck_analysis.clean_reports()
 
     sys.exit(ret_code)
 
diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xen_analysis/cppcheck_analysis.py
new file mode 100644
index 0000000000..0e952a1696
--- /dev/null
+++ b/xen/scripts/xen_analysis/cppcheck_analysis.py
@@ -0,0 +1,273 @@
+#!/usr/bin/env python3
+
+import os, re, shutil
+from . import settings, utils, cppcheck_report_utils
+
+class GetMakeVarsPhaseError(Exception):
+    pass
+
+class CppcheckDepsPhaseError(Exception):
+    pass
+
+class CppcheckReportPhaseError(Exception):
+    pass
+
+CPPCHECK_BUILD_DIR = "build-dir-cppcheck"
+CPPCHECK_HTMLREPORT_OUTDIR = "cppcheck-htmlreport"
+CPPCHECK_REPORT_OUTDIR = "cppcheck-report"
+cppcheck_extra_make_args = ""
+xen_cc = ""
+
+def get_make_vars():
+    global xen_cc
+    invoke_make = utils.invoke_command(
+            "make -C {} {} export-variable-CC"
+                .format(settings.xen_dir, settings.make_forward_args),
+            True, GetMakeVarsPhaseError,
+            "Error occured retrieving make vars:\n{}"
+        )
+
+    cc_var_regex = re.search('^CC=(.*)$', invoke_make, flags=re.M)
+    if cc_var_regex:
+        xen_cc = cc_var_regex.group(1)
+
+    if xen_cc == "":
+        raise GetMakeVarsPhaseError("CC variable not found in Xen make output")
+
+
+def __generate_suppression_list(out_file):
+    # The following lambda function will return a file if it contains lines with
+    # a comment containing "cppcheck-suppress[*]" on a single line.
+    grep_action = lambda x: utils.grep(x,
+                    r'^[ \t]*/\* cppcheck-suppress\[(.*)\] \*/$')
+    # Look for a list of .h files that matches the condition above
+    headers = utils.recursive_find_file(settings.xen_dir, r'.*\.h$',
+                                        grep_action)
+
+    try:
+        with open(out_file, "wt") as supplist_file:
+            # Add this rule to skip every finding in the autogenerated
+            # header for cppcheck
+            supplist_file.write("*:*generated/compiler-def.h\n")
+
+            for entry in headers:
+                filename = entry["file"]
+                try:
+                    with open(filename, "rt") as infile:
+                        header_content = infile.readlines()
+                except OSError as e:
+                    raise CppcheckDepsPhaseError(
+                            "Issue with reading file {}: {}"
+                                .format(filename, e)
+                          )
+                header_lines_len = len(header_content)
+                # line_num in entry will be header_content[line_num-1], here we
+                # are going to search the first line after line_num that have
+                # anything different from comments or empty line, because the
+                # in-code comment suppression is related to that line then.
+                for line_num in entry["matches"]:
+                    cppcheck_violation_id = ""
+                    tmp_line = line_num
+                    # look up to which line is referring the comment at
+                    # line_num (which would be header_content[tmp_line-1])
+                    comment_section = False
+                    while tmp_line < header_lines_len:
+                        line = header_content[tmp_line]
+                        # Matches a line with just optional spaces/tabs and the
+                        # start of a comment '/*'
+                        comment_line_starts = re.match('^[ \t]*/\*.*$', line)
+                        # Matches a line with text and the end of a comment '*/'
+                        comment_line_stops = re.match('^.*\*/$', line)
+                        if (not comment_section) and comment_line_starts:
+                            comment_section = True
+                        if (len(line.strip()) != 0) and (not comment_section):
+                            cppcheck_violation_id = entry["matches"][line_num][0]
+                            break
+                        if comment_section and comment_line_stops:
+                            comment_section = False
+                        tmp_line = tmp_line + 1
+
+                    if cppcheck_violation_id == "":
+                        raise CppcheckDepsPhaseError(
+                            "Error matching cppcheck comment in {} at line {}."
+                                .format(filename, line_num)
+                          )
+                    # Write [error id]:[filename]:[line]
+                    # tmp_line refers to the array index, so translated to the
+                    # file line (that begins with 1) it is tmp_line+1
+                    supplist_file.write(
+                            "{}:{}:{}\n".format(cppcheck_violation_id, filename,
+                                                (tmp_line + 1))
+                        )
+    except OSError as e:
+        raise CppcheckDepsPhaseError("Issue with writing file {}: {}"
+                                     .format(out_file, e))
+
+
+def generate_cppcheck_deps():
+    global cppcheck_extra_make_args
+
+    # Compile flags to pass to cppcheck:
+    # - include config.h as this is passed directly to the compiler.
+    # - define CPPCHECK as we use it to disable or enable some specific part of
+    #   the code to solve some cppcheck issues.
+    # - explicitely enable some cppcheck checks as we do not want to use "all"
+    #   which includes unusedFunction which gives wrong positives as we check
+    #   file per file.
+    # - Explicitly suppress warnings on compiler-def.h because cppcheck throws
+    #   an unmatchedSuppression due to the rule we put in suppression-list.txt
+    #   to skip every finding in the file.
+    #
+    # Compiler defines are in compiler-def.h which is included in config.h
+    #
+    cppcheck_flags="""
+--cppcheck-build-dir={}/{}
+ --max-ctu-depth=10
+ --enable=style,information,missingInclude
+ --template=\'{{file}}({{line}},{{column}}):{{id}}:{{severity}}:{{message}}\'
+ --relative-paths={}
+ --inline-suppr
+ --suppressions-list={}/suppression-list.txt
+ --suppress='unmatchedSuppression:*generated/compiler-def.h'
+ --include={}/include/xen/config.h
+ -DCPPCHECK
+""".format(settings.outdir, CPPCHECK_BUILD_DIR, settings.xen_dir,
+           settings.outdir, settings.xen_dir)
+
+    invoke_cppcheck = utils.invoke_command(
+            "{} --version".format(settings.cppcheck_binpath),
+            True, CppcheckDepsPhaseError,
+            "Error occured retrieving cppcheck version:\n{}\n\n{}"
+        )
+
+    version_regex = re.search('^Cppcheck (.*)$', invoke_cppcheck, flags=re.M)
+    # Currently, only cppcheck version >= 2.7 is supported, but version 2.8 is
+    # known to be broken, please refer to docs/misra/cppcheck.txt
+    if (not version_regex) or (not version_regex.group(1).startswith("2.7")):
+        raise CppcheckDepsPhaseError(
+                "Can't find cppcheck version or version is not 2.7"
+              )
+
+    # If misra option is selected, append misra addon and generate cppcheck
+    # files for misra analysis
+    if settings.cppcheck_misra:
+        cppcheck_flags = cppcheck_flags + " --addon=cppcheck-misra.json"
+
+        utils.invoke_command(
+            "{}/convert_misra_doc.py -i {}/docs/misra/rules.rst"
+            " -o {}/cppcheck-misra.txt -j {}/cppcheck-misra.json"
+                .format(settings.tools_dir, settings.repo_dir,
+                        settings.outdir, settings.outdir),
+            False, CppcheckDepsPhaseError,
+            "An error occured when running:\n{}"
+        )
+
+    # Generate compiler macros
+    os.makedirs("{}/include/generated".format(settings.outdir), exist_ok=True)
+    utils.invoke_command(
+            "{} -dM -E -o \"{}/include/generated/compiler-def.h\" - < /dev/null"
+                .format(xen_cc, settings.outdir),
+            False, CppcheckDepsPhaseError,
+            "An error occured when running:\n{}"
+        )
+
+    # Generate cppcheck suppression list
+    __generate_suppression_list(
+        "{}/suppression-list.txt".format(settings.outdir))
+
+    # Generate cppcheck build folder
+    os.makedirs("{}/{}".format(settings.outdir, CPPCHECK_BUILD_DIR),
+                exist_ok=True)
+
+    cppcheck_cc_flags = """--compiler={} --cppcheck-cmd={} {}
+ --cppcheck-plat={}/cppcheck-plat --ignore-path=tools/
+ --ignore-path=arch/x86/efi/check.c
+""".format(xen_cc, settings.cppcheck_binpath, cppcheck_flags,
+           settings.tools_dir)
+
+    if settings.cppcheck_html:
+        cppcheck_cc_flags = cppcheck_cc_flags + " --cppcheck-html"
+
+    # Generate the extra make argument to pass the cppcheck-cc.sh wrapper as CC
+    cppcheck_extra_make_args = "CC=\"{}/cppcheck-cc.sh {} --\"".format(
+                                        settings.tools_dir,
+                                        cppcheck_cc_flags
+                                    ).replace("\n", "")
+
+
+def generate_cppcheck_report():
+    # Prepare text report
+    # Look for a list of .cppcheck.txt files, those are the txt report
+    # fragments
+    fragments = utils.recursive_find_file(settings.outdir, r'.*\.cppcheck.txt$')
+    text_report_dir = "{}/{}".format(settings.outdir,
+                                        CPPCHECK_REPORT_OUTDIR)
+    report_filename = "{}/xen-cppcheck.txt".format(text_report_dir)
+    os.makedirs(text_report_dir, exist_ok=True)
+    try:
+        cppcheck_report_utils.cppcheck_merge_txt_fragments(fragments,
+                                                           report_filename,
+                                                           [settings.xen_dir])
+    except cppcheck_report_utils.CppcheckTXTReportError as e:
+        raise CppcheckReportPhaseError(e)
+
+    # If HTML output is requested
+    if settings.cppcheck_html:
+        # Look for a list of .cppcheck.xml files, those are the XML report
+        # fragments
+        fragments = utils.recursive_find_file(settings.outdir,
+                                              r'.*\.cppcheck.xml$')
+        html_report_dir = "{}/{}".format(settings.outdir,
+                                         CPPCHECK_HTMLREPORT_OUTDIR)
+        xml_filename = "{}/xen-cppcheck.xml".format(html_report_dir)
+        os.makedirs(html_report_dir, exist_ok=True)
+        try:
+            cppcheck_report_utils.cppcheck_merge_xml_fragments(fragments,
+                                                               xml_filename,
+                                                               settings.xen_dir,
+                                                               settings.outdir)
+        except cppcheck_report_utils.CppcheckHTMLReportError as e:
+            raise CppcheckReportPhaseError(e)
+        # Call cppcheck-htmlreport utility to generate the HTML output
+        utils.invoke_command(
+            "{} --file={} --source-dir={} --report-dir={}/html --title=Xen"
+                .format(settings.cppcheck_htmlreport_binpath, xml_filename,
+                        settings.xen_dir, html_report_dir),
+            False, CppcheckReportPhaseError,
+            "Error occured generating Cppcheck HTML report:\n{}"
+        )
+        # Strip src and obj path from *.html files
+        html_files = utils.recursive_find_file(html_report_dir, r'.*\.html$')
+        try:
+            cppcheck_report_utils.cppcheck_strip_path_html(html_files,
+                                                           (settings.xen_dir,
+                                                            settings.outdir))
+        except cppcheck_report_utils.CppcheckHTMLReportError as e:
+            raise CppcheckReportPhaseError(e)
+
+
+def clean_analysis_artifacts():
+    clean_files = ("suppression-list.txt", "cppcheck-misra.txt",
+                   "cppcheck-misra.json")
+    cppcheck_build_dir = "{}/{}".format(settings.outdir, CPPCHECK_BUILD_DIR)
+    if os.path.isdir(cppcheck_build_dir):
+        shutil.rmtree(cppcheck_build_dir)
+    artifact_files = utils.recursive_find_file(settings.outdir,
+                                r'.*\.(?:c\.json|cppcheck\.txt|cppcheck\.xml)$')
+    for file in clean_files:
+        file = "{}/{}".format(settings.outdir, file)
+        if os.path.isfile(file):
+            artifact_files.append(file)
+    for delfile in artifact_files:
+        os.remove(delfile)
+
+
+def clean_reports():
+    text_report_dir = "{}/{}".format(settings.outdir,
+                                     CPPCHECK_REPORT_OUTDIR)
+    html_report_dir = "{}/{}".format(settings.outdir,
+                                     CPPCHECK_HTMLREPORT_OUTDIR)
+    if os.path.isdir(text_report_dir):
+        shutil.rmtree(text_report_dir)
+    if os.path.isdir(html_report_dir):
+        shutil.rmtree(html_report_dir)
diff --git a/xen/scripts/xen_analysis/cppcheck_report_utils.py b/xen/scripts/xen_analysis/cppcheck_report_utils.py
new file mode 100644
index 0000000000..02440aefdf
--- /dev/null
+++ b/xen/scripts/xen_analysis/cppcheck_report_utils.py
@@ -0,0 +1,130 @@
+#!/usr/bin/env python3
+
+import os
+from xml.etree import ElementTree
+
+class CppcheckHTMLReportError(Exception):
+    pass
+
+class CppcheckTXTReportError(Exception):
+    pass
+
+
+def __elements_equal(el1, el2):
+    if type(el1) != type(el2): return False
+
+    if el1.find('location') is None: return False
+    if el2.find('location') is None: return False
+
+    el1_location = str(el1.find('location').attrib)
+    el2_location = str(el2.find('location').attrib)
+
+    if el1_location != el2_location: return False
+
+    return True
+
+
+def __contain_element(new, lst):
+    for elem in lst:
+        if __elements_equal(new, elem):
+            return True
+    return False
+
+
+def __get_xml_root_file(filename):
+    try:
+        result_xml_root = ElementTree.parse(filename).getroot()
+    except ElementTree.ParseError as e:
+        raise CppcheckHTMLReportError(
+                    "XML parsing error in {}: {}".format(filename, e)
+                )
+    return result_xml_root
+
+
+def __sanitize_cppcheck_xml_path(xml_tree, src_path, obj_path):
+    # Some path are relative to the source tree but some others are generated
+    # in the obj tree, for cppcheck when using cppcheck-htmlreport we can pass
+    # only one source tree where the files will be fetched if relative path are
+    # found. So for every path that does not exists in src tree, we guess it
+    # comes from obj tree and we put explicit absolute path to it
+    error_item_root = xml_tree.findall("errors")[0]
+    for error_item in error_item_root:
+        for location_item in error_item.findall("location"):
+            path = location_item.attrib["file"]
+            new_obj_path = obj_path + "/" + path
+            new_src_path = src_path + "/" + path
+            if (path[0] != "/") and (not os.path.isfile(new_src_path)) \
+               and os.path.isfile(new_obj_path):
+                location_item.attrib["file"] = new_obj_path
+
+
+def cppcheck_merge_xml_fragments(fragments_list, out_xml_file, src_path,
+                                 obj_path):
+
+    result_xml = __get_xml_root_file(fragments_list[0])
+    insert_point = result_xml.findall("errors")[0]
+    for xml_file in fragments_list[1:]:
+        xml_root = __get_xml_root_file(xml_file)
+        curr_elem_list = list(insert_point)
+        new_elem_list = list(xml_root.findall("errors")[0])
+        for xml_error_elem in new_elem_list:
+            if not __contain_element(xml_error_elem, curr_elem_list):
+                insert_point.insert(1, xml_error_elem)
+
+    if result_xml is None:
+        return False
+
+    __sanitize_cppcheck_xml_path(result_xml, src_path, obj_path)
+
+    ElementTree.ElementTree(result_xml).write(out_xml_file)
+
+    return True
+
+
+def cppcheck_merge_txt_fragments(fragments_list, out_txt_file, strip_paths):
+    try:
+        with open(out_txt_file, "wt") as outfile:
+            # Using a set will remove automatically the duplicate lines
+            text_report_content = set()
+            for file in fragments_list:
+                try:
+                    with open(file, "rt") as infile:
+                        frag_lines = infile.readlines()
+                except OSError as e:
+                    raise CppcheckTXTReportError(
+                            "Issue with reading file {}: {}"
+                                .format(file, e)
+                            )
+                text_report_content.update(frag_lines)
+
+            # Back to modifiable list
+            text_report_content = list(text_report_content)
+            # Strip path from report lines
+            for i in list(range(0, len(text_report_content))):
+                for path in strip_paths:
+                    text_report_content[i] = text_report_content[i].replace(
+                                                                path + "/", "")
+            # Write the final text report
+            outfile.writelines(text_report_content)
+    except OSError as e:
+        raise CppcheckTXTReportError("Issue with writing file {}: {}"
+                                            .format(out_txt_file, e))
+
+
+def cppcheck_strip_path_html(html_files, strip_paths):
+    for file in html_files:
+        try:
+            with open(file, "rt") as infile:
+                html_lines = infile.readlines()
+        except OSError as e:
+            raise CppcheckHTMLReportError("Issue with reading file {}: {}"
+                                                            .format(file, e))
+        for i in list(range(0, len(html_lines))):
+            for path in strip_paths:
+                html_lines[i] = html_lines[i].replace(path + "/", "")
+        try:
+            with open(file, "wt") as outfile:
+                outfile.writelines(html_lines)
+        except OSError as e:
+            raise CppcheckHTMLReportError("Issue with writing file {}: {}"
+                                                            .format(file, e))
diff --git a/xen/scripts/xen_analysis/generic_analysis.py b/xen/scripts/xen_analysis/generic_analysis.py
index 372ff35664..94122aebac 100644
--- a/xen/scripts/xen_analysis/generic_analysis.py
+++ b/xen/scripts/xen_analysis/generic_analysis.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 
-import os, subprocess
-from . import settings, utils, tag_database
+import os
+from . import settings, utils, tag_database, cppcheck_analysis
 
 class ParseTagPhaseError(Exception):
     pass
@@ -61,8 +61,9 @@ def parse_xen_tags():
 
 def build_xen():
     utils.invoke_command(
-            "make -C {} {} build"
-                .format(settings.xen_dir, settings.make_forward_args),
+            "make -C {} {} {} build"
+                .format(settings.xen_dir, settings.make_forward_args,
+                        cppcheck_analysis.cppcheck_extra_make_args),
             False, BuildPhaseError,
             "Build error occured when running:\n{}"
         )
diff --git a/xen/scripts/xen_analysis/settings.py b/xen/scripts/xen_analysis/settings.py
index e8d474eaf3..a8502e554e 100644
--- a/xen/scripts/xen_analysis/settings.py
+++ b/xen/scripts/xen_analysis/settings.py
@@ -7,14 +7,23 @@ xen_dir = os.path.realpath(module_dir + "/../..")
 repo_dir = os.path.realpath(xen_dir + "/..")
 tools_dir = os.path.realpath(xen_dir + "/tools")
 
+step_get_make_vars = False
 step_parse_tags = True
+step_cppcheck_deps = False
 step_build_xen = True
+step_cppcheck_report = False
 step_clean_analysis = True
+step_distclean_analysis = False
 
 target_build = False
 target_clean = False
+target_distclean = False
 
 analysis_tool = ""
+cppcheck_binpath = "cppcheck"
+cppcheck_html = False
+cppcheck_htmlreport_binpath = "cppcheck-htmlreport"
+cppcheck_misra = False
 make_forward_args = ""
 outdir = xen_dir
 
@@ -25,44 +34,66 @@ Usage: {} [OPTION] ... [-- [make arguments]]
 
 This script runs the analysis on the Xen codebase.
 
-The phases for the analysis are <tags>, <build>, <clean>
+The phases for the analysis are <tags>, <build>, <clean>, <cppcheck report>
 
 Depending on the options below, only some phases will run:
 
-<no options>: tags, build, clean
---build-only: build
+<no options>: tags, build, [cppcheck report], clean
+--build-only: build, [cppcheck report]
 --clean-only: clean
+--distclean:  clean, [destroy cppcheck report]
 --no-build:   tags, clean
 --no-clean:   tags, build
 
 --no-build/--no-clean can be passed together to avoid both clean and build
 phases.
-Tags and build phases need to specify --run-coverity or --run-eclair.
+Tags and build phases need to specify --run-coverity, --run-eclair or
+--run-cppcheck.
+Cppcheck report creation phase runs only when --run-cppcheck is passed to the
+script.
 
 Options:
-  --build-only    Run only the commands to build Xen with the optional make
-                  arguments passed to the script
-  --clean-only    Run only the commands to clean the analysis artifacts
-  -h, --help      Print this help
-  --no-build      Skip the build Xen phase
-  --no-clean      Don\'t clean the analysis artifacts on exit
-  --run-coverity  Run the analysis for the Coverity tool
-  --run-eclair    Run the analysis for the Eclair tool
+  --build-only          Run only the commands to build Xen with the optional
+                        make arguments passed to the script
+  --clean-only          Run only the commands to clean the analysis artifacts
+  --cppcheck-bin=       Path to the cppcheck binary (Default: {})
+  --cppcheck-html       Produce an additional HTML output report for Cppcheck
+  --cppcheck-html-bin=  Path to the cppcheck-html binary (Default: {})
+  --cppcheck-misra      Activate the Cppcheck MISRA analysis
+  --distclean           Clean analysis artifacts and reports
+  -h, --help            Print this help
+  --no-build            Skip the build Xen phase
+  --no-clean            Don\'t clean the analysis artifacts on exit
+  --run-coverity        Run the analysis for the Coverity tool
+  --run-cppcheck        Run the Cppcheck analysis tool on Xen
+  --run-eclair          Run the analysis for the Eclair tool
 """
-    print(msg.format(sys.argv[0]))
+    print(msg.format(sys.argv[0], cppcheck_binpath,
+                     cppcheck_htmlreport_binpath))
 
 
 def parse_commandline(argv):
     global analysis_tool
+    global cppcheck_binpath
+    global cppcheck_html
+    global cppcheck_htmlreport_binpath
+    global cppcheck_misra
     global make_forward_args
     global outdir
+    global step_get_make_vars
     global step_parse_tags
+    global step_cppcheck_deps
     global step_build_xen
+    global step_cppcheck_report
     global step_clean_analysis
+    global step_distclean_analysis
     global target_build
     global target_clean
+    global target_distclean
     forward_to_make = False
     for option in argv:
+        args_with_content_regex = re.match(r'^(--[a-z]+[a-z-]*)=(.*)$', option)
+
         if forward_to_make:
             # Intercept outdir
             outdir_regex = re.match("^O=(.*)$", option)
@@ -74,6 +105,18 @@ def parse_commandline(argv):
             target_build = True
         elif option == "--clean-only":
             target_clean = True
+        elif args_with_content_regex and \
+             args_with_content_regex.group(1) == "--cppcheck-bin":
+            cppcheck_binpath = args_with_content_regex.group(2)
+        elif option == "--cppcheck-html":
+            cppcheck_html = True
+        elif args_with_content_regex and \
+             args_with_content_regex.group(1) == "--cppcheck-html-bin":
+            cppcheck_htmlreport_binpath = args_with_content_regex.group(2)
+        elif option == "--cppcheck-misra":
+            cppcheck_misra = True
+        elif option == "--distclean":
+            target_distclean = True
         elif (option == "--help") or (option == "-h"):
             help()
             sys.exit(0)
@@ -83,6 +126,11 @@ def parse_commandline(argv):
             step_clean_analysis = False
         elif (option == "--run-coverity") or (option == "--run-eclair"):
             analysis_tool = option[6:]
+        elif (option == "--run-cppcheck"):
+            analysis_tool = "cppcheck"
+            step_get_make_vars = True
+            step_cppcheck_deps = True
+            step_cppcheck_report = True
         elif option == "--":
             forward_to_make = True
         else:
@@ -90,13 +138,23 @@ def parse_commandline(argv):
             help()
             sys.exit(1)
 
-    if target_build and target_clean:
-        print("--build-only is not compatible with --clean-only argument.")
+    if target_build and (target_clean or target_distclean):
+        print("--build-only is not compatible with --clean-only/--distclean "
+              "argument.")
         sys.exit(1)
 
+    if target_distclean:
+        # Implicit activation of clean target
+        target_clean = True
+
+        step_distclean_analysis = True
+
     if target_clean:
+        step_get_make_vars = False
         step_parse_tags = False
+        step_cppcheck_deps = False
         step_build_xen = False
+        step_cppcheck_report = False
         step_clean_analysis = True
         return
 
diff --git a/xen/tools/cppcheck-cc.sh b/xen/tools/cppcheck-cc.sh
new file mode 100755
index 0000000000..f6728e4c10
--- /dev/null
+++ b/xen/tools/cppcheck-cc.sh
@@ -0,0 +1,223 @@
+#!/usr/bin/env bash
+
+set -e
+
+function help() {
+    cat <<EOF
+Usage: ${0} [OPTION] ... -- <compiler arguments>
+
+This script is a wrapper for cppcheck that enables it to analyse the files that
+are the target for the build, it is used in place of a selected compiler and the
+make process will run it on every file that needs to be built.
+All the arguments passed to the original compiler are forwarded to it without
+modification, furthermore, they are used to improve the cppcheck analysis.
+
+Options:
+  --compiler=       Use this compiler for the build
+  --cppcheck-cmd=   Command line for the cppcheck analysis.
+  --cppcheck-html   Prepare for cppcheck HTML output
+  --cppcheck-plat=  Path to the cppcheck platform folder
+  --ignore-path=    This script won't run cppcheck on the files having this
+                    path, the compiler will run anyway on them. This argument
+                    can be specified multiple times.
+  -h, --help        Print this help
+EOF
+}
+
+CC_FILE=""
+COMPILER=""
+CPPCHECK_HTML="n"
+CPPCHECK_PLAT_PATH=""
+CPPCHECK_TOOL=""
+CPPCHECK_TOOL_ARGS=""
+FORWARD_FLAGS=""
+IGNORE_PATH="n"
+IGNORE_PATH_LIST=""
+JDB_FILE=""
+OBJTREE_PATH=""
+
+# Variable used for arg parsing
+forward_to_cc="n"
+sm_tool_args="n"
+obj_arg_content="n"
+
+for OPTION in "$@"
+do
+    if [ "${forward_to_cc}" = "y" ]; then
+        if [[ ${OPTION} == *.c ]]
+        then
+            CC_FILE="${OPTION}"
+        elif [ "${OPTION}" = "-o" ]
+        then
+            # After -o there is the path to the obj file, flag it
+            obj_arg_content="y"
+        elif [ "${obj_arg_content}" = "y" ]
+        then
+            # This must be the path to the obj file, turn off flag and save path
+            OBJTREE_PATH="$(dirname "${OPTION}")"
+            obj_arg_content="n"
+        fi
+        # Forward any argument to the compiler
+        FORWARD_FLAGS="${FORWARD_FLAGS} ${OPTION}"
+        continue
+    fi
+    case ${OPTION} in
+        -h|--help)
+            help
+            exit 0
+            ;;
+        --compiler=*)
+            COMPILER="${OPTION#*=}"
+            sm_tool_args="n"
+            ;;
+        --cppcheck-cmd=*)
+            CPPCHECK_TOOL="${OPTION#*=}"
+            sm_tool_args="y"
+            ;;
+        --cppcheck-html)
+            CPPCHECK_HTML="y"
+            sm_tool_args="n"
+            ;;
+        --cppcheck-plat=*)
+            CPPCHECK_PLAT_PATH="${OPTION#*=}"
+            sm_tool_args="n"
+            ;;
+        --ignore-path=*)
+            IGNORE_PATH_LIST="${IGNORE_PATH_LIST} ${OPTION#*=}"
+            sm_tool_args="n"
+            ;;
+        --)
+            forward_to_cc="y"
+            sm_tool_args="n"
+            ;;
+        *)
+            if [ "${sm_tool_args}" = "y" ]; then
+                CPPCHECK_TOOL_ARGS="${CPPCHECK_TOOL_ARGS} ${OPTION}"
+            else
+                echo "Invalid option ${OPTION}"
+                exit 1
+            fi
+            ;;
+    esac
+done
+
+if [ "${COMPILER}" = "" ]
+then
+    echo "--compiler arg is mandatory."
+    exit 1
+fi
+
+function create_jcd() {
+    local line="${1}"
+    local arg_num=0
+    local same_line=0
+
+    {
+        echo "["
+        echo "    {"
+        echo "        \"arguments\": ["
+
+        for arg in ${line}; do
+            # This code prevents to put comma in the last element of the list or
+            # on sequential lines that are going to be merged
+            if [ "${arg_num}" -ne 0 ] && [ "${same_line}" -eq 0 ]
+            then
+                echo ","
+            fi
+            if [ "${same_line}" -ne 0 ]
+            then
+                echo -n "${arg}\""
+                same_line=0
+            elif [ "${arg}" = "-iquote" ] || [ "${arg}" = "-I" ]
+            then
+                # cppcheck doesn't understand -iquote, substitute with -I
+                echo -n "            \"-I"
+                same_line=1
+            else
+                echo -n "            \"${arg}\""
+            fi
+            arg_num=$(( arg_num + 1 ))
+        done
+        echo ""
+        echo "        ],"
+        echo "        \"directory\": \"$(pwd -P)\","
+        echo "        \"file\": \"${CC_FILE}\""
+        echo "    }"
+        echo "]"
+    } > "${JDB_FILE}"
+}
+
+
+# Execute compiler with forwarded flags
+# Shellcheck complains about missing quotes on FORWARD_FLAGS, but they can't be
+# used here
+# shellcheck disable=SC2086
+${COMPILER} ${FORWARD_FLAGS}
+
+if [ -n "${CC_FILE}" ];
+then
+    for path in ${IGNORE_PATH_LIST}
+    do
+        if [[ ${CC_FILE} == *${path}* ]]
+        then
+            IGNORE_PATH="y"
+            echo "${0}: ${CC_FILE} ignored by --ignore-path matching *${path}*"
+        fi
+    done
+    if [ "${IGNORE_PATH}" = "n" ]
+    then
+        JDB_FILE="${OBJTREE_PATH}/$(basename "${CC_FILE}".json)"
+
+        # Prepare the Json Compilation Database for the file
+        create_jcd "${COMPILER} ${FORWARD_FLAGS}"
+
+        out_file="${OBJTREE_PATH}/$(basename "${CC_FILE%.c}".cppcheck.txt)"
+
+        # Select the right target platform, ARCH is generated from Xen Makefile
+        case ${ARCH} in
+            arm64)
+                # arm64 has efi code compiled with -fshort-wchar
+                platform="${CPPCHECK_PLAT_PATH}/arm64-wchar_t2.xml"
+                ;;
+            arm32)
+                # arm32 has no efi code
+                platform="${CPPCHECK_PLAT_PATH}/arm32-wchar_t4.xml"
+                ;;
+            x86_64)
+                # x86_64 has efi code compiled with -fshort-wchar
+                platform="${CPPCHECK_PLAT_PATH}/x86_64-wchar_t2.xml"
+                ;;
+            *)
+                echo "ARCH: ${ARCH} not expected!"
+                exit 1
+                ;;
+        esac
+
+        if [ ! -f "${platform}" ]
+        then
+            echo "${platform} not found!"
+            exit 1
+        fi
+
+        # Shellcheck complains about missing quotes on CPPCHECK_TOOL_ARGS, but
+        # they can't be used here
+        # shellcheck disable=SC2086
+        ${CPPCHECK_TOOL} ${CPPCHECK_TOOL_ARGS} \
+            --project="${JDB_FILE}" \
+            --output-file="${out_file}" \
+            --platform="${platform}"
+
+        if [ "${CPPCHECK_HTML}" = "y" ]
+        then
+            # Shellcheck complains about missing quotes on CPPCHECK_TOOL_ARGS,
+            # but they can't be used here
+            # shellcheck disable=SC2086
+            ${CPPCHECK_TOOL} ${CPPCHECK_TOOL_ARGS} \
+                --project="${JDB_FILE}" \
+                --output-file="${out_file%.txt}.xml" \
+                --platform="${platform}" \
+                -q \
+                --xml
+        fi
+    fi
+fi
diff --git a/xen/tools/cppcheck-plat/arm32-wchar_t4.xml b/xen/tools/cppcheck-plat/arm32-wchar_t4.xml
new file mode 100644
index 0000000000..3aefa7ba5c
--- /dev/null
+++ b/xen/tools/cppcheck-plat/arm32-wchar_t4.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<platform>
+  <char_bit>8</char_bit>
+  <default-sign>unsigned</default-sign>
+  <sizeof>
+    <short>2</short>
+    <int>4</int>
+    <long>4</long>
+    <long-long>8</long-long>
+    <float>4</float>
+    <double>8</double>
+    <long-double>8</long-double>
+    <pointer>4</pointer>
+    <size_t>4</size_t>
+    <wchar_t>4</wchar_t>
+  </sizeof>
+</platform>
diff --git a/xen/tools/cppcheck-plat/arm64-wchar_t2.xml b/xen/tools/cppcheck-plat/arm64-wchar_t2.xml
new file mode 100644
index 0000000000..b2dc2fb2cc
--- /dev/null
+++ b/xen/tools/cppcheck-plat/arm64-wchar_t2.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<platform>
+  <char_bit>8</char_bit>
+  <default-sign>unsigned</default-sign>
+  <sizeof>
+    <short>2</short>
+    <int>4</int>
+    <long>8</long>
+    <long-long>8</long-long>
+    <float>4</float>
+    <double>8</double>
+    <long-double>16</long-double>
+    <pointer>8</pointer>
+    <size_t>8</size_t>
+    <wchar_t>2</wchar_t>
+  </sizeof>
+</platform>
diff --git a/xen/tools/cppcheck-plat/x86_64-wchar_t2.xml b/xen/tools/cppcheck-plat/x86_64-wchar_t2.xml
new file mode 100644
index 0000000000..0b3bb6e0fb
--- /dev/null
+++ b/xen/tools/cppcheck-plat/x86_64-wchar_t2.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<platform>
+  <char_bit>8</char_bit>
+  <default-sign>signed</default-sign>
+  <sizeof>
+    <short>2</short>
+    <int>4</int>
+    <long>8</long>
+    <long-long>8</long-long>
+    <float>4</float>
+    <double>8</double>
+    <long-double>16</long-double>
+    <pointer>8</pointer>
+    <size_t>8</size_t>
+    <wchar_t>2</wchar_t>
+  </sizeof>
+</platform>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:46:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:46:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465464.724171 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gsr-0003wX-PN; Sat, 17 Dec 2022 23:46:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465464.724171; Sat, 17 Dec 2022 23:46: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 1p6gsr-0003wQ-Mo; Sat, 17 Dec 2022 23:46:25 +0000
Received: by outflank-mailman (input) for mailman id 465464;
 Sat, 17 Dec 2022 23:46:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsp-0003wA-VP
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsp-0004UY-Ub
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gsp-0001SO-Ts
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EevpMTjVYJHaKGnVmWPYbenN1XgB83YoAkNgIdGhmp4=; b=Hoj1VQnopCbgifINw18GGEj6V3
	+pFt7bCmYXZn4fFfLJcK17EneZUV1B4B8HlUWJffy3nom6YCX+u4skwVe93lhK8JTIv7s8EFXLwgq
	LQDGK4xwnVhGtrFxzLFn7/E7f+qoJO0TvHs6dPcTWkZD++4Czl7aRRA1tS0SkiHivzEE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Makefile: remove Cppcheck invocation from the Makefile
Message-Id: <E1p6gsp-0001SO-Ts@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:46:23 +0000

commit 01b4592114af6895d6ef14aecf0da76267079a21
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Dec 7 13:07:02 2022 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Dec 12 14:19:14 2022 -0800

    xen/Makefile: remove Cppcheck invocation from the Makefile
    
    The script xen-analysis.py is going to be used for the analysis with
    cppcheck, so remove the rules from the Makefile.
    
    The python script xen/tools/merge_cppcheck_reports.py was used by the
    makefile rules, but its functionality is integrated in the
    xen-analysis.py script now, so it can be removed.
    
    Remove some entry from the .gitignore related to Cppcheck invocation
    from Makefile.
    
    This is a partial revert of commit 43aa3f6e72d34 where the entry
    xen/xen-cppcheck.xml from .gitignore is reverted because its path has
    changed, *.c.cppcheck entry is not needed anymore either,
    merge_cppcheck_reports.py script is reverted for the reason above,
    all makefile changes are reverted.
    Every other change to processor.h, config.h, kconfig.h is kept because
    they are used with the new process.
    
    This is a partial revert of commit 57caa53753212 where Makefile changes
    are reverted, convert_misra_doc.py script is kept as it is used with the
    new process.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .gitignore                          |   2 -
 xen/Makefile                        | 116 ++----------------------------------
 xen/tools/merge_cppcheck_reports.py |  86 --------------------------
 3 files changed, 6 insertions(+), 198 deletions(-)

diff --git a/.gitignore b/.gitignore
index ea64b6d201..880ba88c55 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,7 +7,6 @@
 *.o
 *.d
 *.d2
-*.c.cppcheck
 *.cppcheck.txt
 *.cppcheck.xml
 *.opic
@@ -322,7 +321,6 @@ tools/flask/policy/policy.conf
 tools/flask/policy/xenpolicy-*
 xen/xen
 xen/suppression-list.txt
-xen/xen-cppcheck.xml
 xen/xen-syms
 xen/xen-syms.map
 xen/xen.*
diff --git a/xen/Makefile b/xen/Makefile
index e55fb98e11..2d55bb9401 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -457,7 +457,7 @@ endif # need-config
 
 __all: build
 
-main-targets := build install uninstall clean distclean MAP cppcheck cppcheck-html
+main-targets := build install uninstall clean distclean MAP
 .PHONY: $(main-targets)
 ifneq ($(XEN_TARGET_ARCH),x86_32)
 $(main-targets): %: _% ;
@@ -566,18 +566,16 @@ _clean:
 	$(Q)$(MAKE) $(clean)=tools/kconfig
 	find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \
 		-o -name ".*.o.tmp" -o -name "*~" -o -name "core" \
-		-o -name '*.lex.c' -o -name '*.tab.[ch]' -o -name '*.c.cppcheck' \
-		-o -name "*.gcno" -o -name ".*.cmd" -o -name "lib.a" \) -exec rm -f {} \;
+		-o -name '*.lex.c' -o -name '*.tab.[ch]' -o -name "*.gcno" \
+		-o -name ".*.cmd" -o -name "lib.a" \) -exec rm -f {} \;
 	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET)-syms $(TARGET)-syms.map
 	rm -f $(TARGET).efi $(TARGET).efi.map $(TARGET).efi.stripped
 	rm -f asm-offsets.s arch/*/include/asm/asm-offsets.h
 	rm -f .banner .allconfig.tmp include/xen/compile.h
-	rm -f cppcheck-misra.* xen-cppcheck.xml
 
 .PHONY: _distclean
 _distclean: clean
 	rm -f tags TAGS cscope.files cscope.in.out cscope.out cscope.po.out GTAGS GPATH GRTAGS GSYMS .config source
-	rm -rf $(CPPCHECK_HTMLREPORT_OUTDIR)
 
 $(TARGET).gz: $(TARGET)
 	gzip -n -f -9 < $< > $@.new
@@ -651,111 +649,9 @@ cloc:
 	    done; \
 	done | cloc --list-file=-
 
-# What cppcheck command to use.
-# To get proper results, it is recommended to build cppcheck manually from the
-# latest source and use CPPCHECK to give the full path to the built version.
-CPPCHECK ?= cppcheck
-
-# What cppcheck-htmlreport to use.
-# If you give the full path to a self compiled cppcheck, this should be set
-# to the full path to cppcheck-html in the htmlreport directory of cppcheck.
-# On recent distribution, this is available in the standard path.
-CPPCHECK_HTMLREPORT ?= cppcheck-htmlreport
-
-# By default we generate the report in cppcheck-htmlreport directory in the
-# build directory. This can be changed by giving a directory in this variable.
-CPPCHECK_HTMLREPORT_OUTDIR ?= cppcheck-htmlreport
-
-# By default we do not check misra rules, to enable pass "CPPCHECK_MISRA=y" to
-# make command line.
-CPPCHECK_MISRA ?= n
-
-# Compile flags to pass to cppcheck:
-# - include directories and defines Xen Makefile is passing (from CFLAGS)
-# - include config.h as this is passed directly to the compiler.
-# - define CPPCHECK as we use to disable or enable some specific part of the
-#   code to solve some cppcheck issues.
-# - explicitely enable some cppcheck checks as we do not want to use "all"
-#   which includes unusedFunction which gives wrong positives as we check file
-#   per file.
-#
-# Compiler defines are in compiler-def.h which is included in config.h
-#
-CPPCHECKFLAGS := -DCPPCHECK --max-ctu-depth=10 \
-                 --enable=style,information,missingInclude \
-                 --include=$(srctree)/include/xen/config.h \
-                 -I $(srctree)/xsm/flask/include \
-                 -I $(srctree)/include/xen/libfdt \
-                 $(filter -D% -I%,$(CFLAGS))
-
-# We need to find all C files (as we are not checking assembly files) so
-# we find all generated .o files which have a .c corresponding file.
-CPPCHECKFILES := $(wildcard $(patsubst $(objtree)/%.o,$(srctree)/%.c, \
-                 $(filter-out $(objtree)/tools/%, \
-                 $(shell find $(objtree) -name "*.o"))))
-
-# Headers and files required to run cppcheck on a file
-CPPCHECKDEPS := $(objtree)/include/generated/autoconf.h \
-                $(objtree)/include/generated/compiler-def.h
-
-ifeq ($(CPPCHECK_MISRA),y)
-    CPPCHECKFLAGS += --addon=cppcheck-misra.json
-    CPPCHECKDEPS += cppcheck-misra.json
-endif
-
-quiet_cmd_cppcheck_xml = CPPCHECK $(patsubst $(srctree)/%,%,$<)
-cmd_cppcheck_xml = $(CPPCHECK) -v -q --xml $(CPPCHECKFLAGS) \
-                   --output-file=$@ $<
-
-quiet_cmd_merge_cppcheck_reports = CPPCHECK-MERGE $@
-cmd_merge_cppcheck_reports = $(PYTHON) $(srctree)/tools/merge_cppcheck_reports.py $^ $@
-
-quiet_cmd_cppcheck_html = CPPCHECK-HTML $<
-cmd_cppcheck_html = $(CPPCHECK_HTMLREPORT) --file=$< --source-dir=$(srctree) \
-                    --report-dir=$(CPPCHECK_HTMLREPORT_OUTDIR) --title=Xen
-
-PHONY += _cppcheck _cppcheck-html cppcheck-version
-
-_cppcheck-html: xen-cppcheck.xml
-	$(call if_changed,cppcheck_html)
-
-_cppcheck: xen-cppcheck.xml
-
-xen-cppcheck.xml: $(patsubst $(srctree)/%.c,$(objtree)/%.c.cppcheck,$(CPPCHECKFILES))
-ifeq ($(CPPCHECKFILES),)
-	$(error Please build Xen before running cppcheck)
-endif
-	$(call if_changed,merge_cppcheck_reports)
-
-$(objtree)/%.c.cppcheck: $(srctree)/%.c $(CPPCHECKDEPS) | cppcheck-version
-	$(call if_changed,cppcheck_xml)
-
-cppcheck-version:
-	$(Q)if ! which $(CPPCHECK) > /dev/null 2>&1; then \
-		echo "Cannot find cppcheck executable: $(CPPCHECK)"; \
-		exit 1; \
-	fi
-	$(Q)if [ "$$($(CPPCHECK) --version | awk '{print ($$2 < 2.7)}')" -eq 1 ]; then \
-		echo "Please upgrade your cppcheck to version 2.7 or greater"; \
-		exit 1; \
-	fi
-
-# List of Misra rules to respect is written inside a doc.
-# In order to have some helpful text in the cppcheck output, generate a text
-# file containing the rules identifier, classification and text from the Xen
-# documentation file. Also generate a json file with the right arguments for
-# cppcheck in json format including the list of rules to ignore.
-#
-# convert_misra_doc.py, producing both targets at the same time, should be
-# executed only once. Utilize a pattern rule to achieve this effect, with the
-# stem kind of arbitrarily chosen to be "cppcheck".
-.PRECIOUS: %-misra.json
-%-misra.txt %-misra.json: $(XEN_ROOT)/docs/misra/rules.rst $(srctree)/tools/convert_misra_doc.py
-	$(Q)$(PYTHON) $(srctree)/tools/convert_misra_doc.py -i $< -o $*-misra.txt -j $*-misra.json
-
-# Put this in generated headers this way it is cleaned by include/Makefile
-$(objtree)/include/generated/compiler-def.h:
-	$(Q)$(CC) -dM -E -o $@ - < /dev/null
+# Target used by xen-analysis.sh script to retrieve Xen build system variables
+export-variable-%:
+	$(info $*=$($*))
 
 endif #config-build
 endif # need-sub-make
diff --git a/xen/tools/merge_cppcheck_reports.py b/xen/tools/merge_cppcheck_reports.py
deleted file mode 100755
index 1c1b63ba56..0000000000
--- a/xen/tools/merge_cppcheck_reports.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env python
-
-"""
-This script acts as a tool to merge XML files created by cppcheck.
-Usage:
-    merge_cppcheck_reports.py [FILES] [OUTPUT]
-
-    FILES  - list of XML files with extension .cppcheck
-    OUTPUT - file to store results (with .xml extension).
-             If not specified, the script will print results to stdout.
-"""
-
-import sys
-from xml.etree import ElementTree
-
-def elements_equal(el1, el2):
-    if type(el1) != type(el2): return False
-
-    if el1.find('location') is None: return False
-    if el2.find('location') is None: return False
-
-    el1_location = str(el1.find('location').attrib)
-    el2_location = str(el2.find('location').attrib)
-
-    if el1_location != el2_location: return False
-
-    return True
-
-def contain_element(new, lst):
-    for elem in lst:
-        if elements_equal(new, elem):
-            return True
-    return False
-
-def merge(files):
-    try:
-        result_xml_root = ElementTree.parse(files[0]).getroot()
-    except:
-        print("Xml parsing error in %s\n" % (files[0]))
-        print("Please upgrade your cppcheck to version 2.7 or greater")
-        sys.exit(1)
-    insert_point = result_xml_root.findall("errors")[0]
-    curr = 1
-    total = len(files)
-    numelem = len(insert_point)
-    for xml_file in files[1:]:
-        try:
-            xml_root = ElementTree.parse(xml_file).getroot()
-        except:
-            print("Xml parsing error in %s\n" % (xml_file))
-            print("Please upgrade your cppcheck to version 2.7 or greater")
-            sys.exit(1)
-        curr_elem_list = list(insert_point)
-        new_elem_list = list(xml_root.findall("errors")[0])
-        for xml_error_elem in new_elem_list:
-            if not contain_element(xml_error_elem, curr_elem_list):
-                insert_point.insert(1,xml_error_elem)
-                numelem = numelem + 1
-        curr = curr + 1
-        sys.stdout.write('\r')
-        sys.stdout.write(" %d / %d" % (curr,total))
-        sys.stdout.flush()
-
-    sys.stdout.write('\r\n')
-    print("Done: %d elements" % (numelem))
-    return result_xml_root
-
-def run():
-    files = []
-    output = None
-    for i in sys.argv[1:]:
-        output = i if '.xml' in i else None
-        files.append(i) if '.cppcheck' in i else None
-
-    result = merge(files)
-
-    if result is None:
-        return
-
-    if output is not None:
-        ElementTree.ElementTree(result).write(output)
-    else:
-        print(ElementTree.tostring(result).decode('utf-8'))
-
-if __name__ == '__main__':
-    run()
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:46:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:46:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465465.724176 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gt1-0003zF-RD; Sat, 17 Dec 2022 23:46:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465465.724176; Sat, 17 Dec 2022 23:46:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gt1-0003z7-OO; Sat, 17 Dec 2022 23:46:35 +0000
Received: by outflank-mailman (input) for mailman id 465465;
 Sat, 17 Dec 2022 23:46:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gt0-0003yw-1u
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gt0-0004WO-1F
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gt0-0001Sp-0R
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MHq1IiMxZ003chGLGN798cK5lwJsA8XRao4njGP8IJw=; b=RSihj8mOF6WWO23OKLZs9c6Wxs
	5XqIULqwoD+QEVPe0q/5MYBAfKx9QsscuTPLoPdz4eiiEGCCqYVGFLnblnqb4yhc17czeFmO18N2c
	FdjgFjdblST09/lY4/ViRrB9czEenjb+7fXAqZyhV4ot6ZmOdwDhKlPnj7CnZ8N+DY9U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/misra: fix skipped rule numbers
Message-Id: <E1p6gt0-0001Sp-0R@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:46:34 +0000

commit a0998df973594347a4e4632ac67d8a9572434990
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Dec 7 13:07:03 2022 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Dec 12 14:19:18 2022 -0800

    tools/misra: fix skipped rule numbers
    
    MISRA rules are in the format Rule X.Y, currently the script
    convert_misra_doc.py is using two nested loop through range(1,22) to
    enumerate rules that needs to be skipped, using combination of X.Y in
    that range, however there are two issues in the code:
     - rule 22 is never included because the range(1,22) produces a range
       in [1..21]
     - the second issue is that the code is producing invalid MISRA C 2012
       rules, for example 1.21 and so on
    
    Fix the issue using a dictionary that list the rules in misra c2012.
    
    Fixes: 57caa5375321 ("xen: Add MISRA support to cppcheck make rule")
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Tested-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/tools/convert_misra_doc.py | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/xen/tools/convert_misra_doc.py b/xen/tools/convert_misra_doc.py
index caa4487f64..13074d8a2e 100755
--- a/xen/tools/convert_misra_doc.py
+++ b/xen/tools/convert_misra_doc.py
@@ -14,6 +14,34 @@ Usage:
 
 import sys, getopt, re
 
+# MISRA rule are identified by two numbers, e.g. Rule 1.2, the main rule number
+# and a sub-number. This dictionary contains the number of the MISRA rule as key
+# and the maximum sub-number for that rule as value.
+misra_c2012_rules = {
+    1:4,
+    2:7,
+    3:2,
+    4:2,
+    5:9,
+    6:2,
+    7:4,
+    8:14,
+    9:5,
+    10:8,
+    11:9,
+    12:5,
+    13:6,
+    14:4,
+    15:7,
+    16:7,
+    17:8,
+    18:8,
+    19:2,
+    20:14,
+    21:21,
+    22:10
+}
+
 def main(argv):
     infile = ''
     outfile = ''
@@ -142,8 +170,8 @@ def main(argv):
     skip_list = []
 
     # Search for missing rules and add a dummy text with the rule number
-    for i in list(range(1,22)):
-        for j in list(range(1,22)):
+    for i in misra_c2012_rules:
+        for j in list(range(1,misra_c2012_rules[i]+1)):
             if str(i) + '.' + str(j) not in rule_list:
                 outstr.write('Rule ' + str(i) + '.' + str(j) + '\n')
                 outstr.write('No description for rule ' + str(i) + '.' + str(j)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:46:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:46:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465466.724179 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gtB-00042G-SY; Sat, 17 Dec 2022 23:46:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465466.724179; Sat, 17 Dec 2022 23:46:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gtB-000427-Pm; Sat, 17 Dec 2022 23:46:45 +0000
Received: by outflank-mailman (input) for mailman id 465466;
 Sat, 17 Dec 2022 23:46:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gtA-00041s-56
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gtA-0004Wp-4R
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gtA-0001TH-3R
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iw8xwoE4pU2sw27MbDCTEnY7LlTu9ZPISWPo8WZ8Nh0=; b=pA8h46bdFaWuI14Z2JyIJyoanA
	LQN08bFfpT/rXoW1qxW7lxtD06h67R+qbE2VD1bf6V4HTkEzBZrH9A6wgHiaHML1HLOmZwmccMi4W
	J7F5uzoX71VbaaTyrqW8yNI9Yj3W0ylwLiPIvG5iiju4jEDaqgCaQC+7BEnjNzmhXiIc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Justify linker script defined symbols in include/xen/kernel.h
Message-Id: <E1p6gtA-0001TH-3R@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:46:44 +0000

commit bc19af0bd4b8d0bb817defa4470873c80f67b6c2
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Dec 7 13:07:04 2022 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Dec 12 14:19:20 2022 -0800

    xen: Justify linker script defined symbols in include/xen/kernel.h
    
    Eclair and Coverity found violation of the MISRA rule 8.6 for the
    symbols _start, _end, start, _stext, _etext, _srodata, _erodata,
    _sinittext, _einittext which are declared in
    xen/include/xen/kernel.h.
    All those symbols are defined by the liker script so we can deviate
    from the rule 8.6 for these cases.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/misra/safe.json     | 9 +++++++++
 xen/include/xen/kernel.h | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/docs/misra/safe.json b/docs/misra/safe.json
index e079d30381..e3c8a1d8eb 100644
--- a/docs/misra/safe.json
+++ b/docs/misra/safe.json
@@ -3,6 +3,15 @@
     "content": [
         {
             "id": "SAF-0-safe",
+            "analyser": {
+                "eclair": "MC3R1.R8.6",
+                "coverity": "misra_c_2012_rule_8_6_violation"
+            },
+            "name": "Rule 8.6: linker script defined symbols",
+            "text": "It is safe to declare this symbol because it is defined in the linker script."
+        },
+        {
+            "id": "SAF-1-safe",
             "analyser": {},
             "name": "Sentinel",
             "text": "Next ID to be used"
diff --git a/xen/include/xen/kernel.h b/xen/include/xen/kernel.h
index 8cd142032d..f1a7713784 100644
--- a/xen/include/xen/kernel.h
+++ b/xen/include/xen/kernel.h
@@ -65,24 +65,28 @@
 	1;                                      \
 })
 
+/* SAF-0-safe */
 extern char _start[], _end[], start[];
 #define is_kernel(p) ({                         \
     char *__p = (char *)(unsigned long)(p);     \
     (__p >= _start) && (__p < _end);            \
 })
 
+/* SAF-0-safe */
 extern char _stext[], _etext[];
 #define is_kernel_text(p) ({                    \
     char *__p = (char *)(unsigned long)(p);     \
     (__p >= _stext) && (__p < _etext);          \
 })
 
+/* SAF-0-safe */
 extern const char _srodata[], _erodata[];
 #define is_kernel_rodata(p) ({                  \
     const char *__p = (const char *)(unsigned long)(p);     \
     (__p >= _srodata) && (__p < _erodata);      \
 })
 
+/* SAF-0-safe */
 extern char _sinittext[], _einittext[];
 #define is_kernel_inittext(p) ({                \
     char *__p = (char *)(unsigned long)(p);     \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:46:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:46:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465467.724183 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gtL-000450-UK; Sat, 17 Dec 2022 23:46:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465467.724183; Sat, 17 Dec 2022 23:46:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gtL-00044j-RH; Sat, 17 Dec 2022 23:46:55 +0000
Received: by outflank-mailman (input) for mailman id 465467;
 Sat, 17 Dec 2022 23:46:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gtK-00044Z-81
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gtK-0004X4-7Q
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gtK-0001Tv-6h
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:46:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jX3FOP7jYw9APep/zU9Uwo9mQWTUeZlP7hh7NsDS5yw=; b=5MLqu0i1oOzBAMwHlZCg+I2pfg
	N9khu+pvfS+4B3Gm4mMFsnD6WVfNUaE2jGLABgtzImOjBQY+6GWeeGdO935vEXl7cUYb+HPv1/ZnH
	/K5XtYQ/W7D6oehvLwI4SD8IL27oOBVJvjbDsJIjzpy5rcjS5Rykum9ZeEUwP0Tr94/s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: abort on memory allocation errors
Message-Id: <E1p6gtK-0001Tv-6h@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:46:54 +0000

commit 630dc3798e1d0d1b95f7be8b176563eb40e866e5
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Tue Dec 13 15:23:54 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 13 15:23:54 2022 +0100

    libxl: abort on memory allocation errors
    
    Use abort() instead of just _exit() in libxl__alloc_failed(). This
    is more friendly for debugging, as it will trap into debugger,
    systemd-coredump will collect coredump/backtrace etc. It's much more
    useful than just "libxl: FATAL ERROR: memory allocation failure (...)"
    message without context where it actually failed.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_internal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_internal.c b/tools/libs/light/libxl_internal.c
index 86556b6113..c95624933f 100644
--- a/tools/libs/light/libxl_internal.c
+++ b/tools/libs/light/libxl_internal.c
@@ -36,7 +36,7 @@ void libxl__alloc_failed(libxl_ctx *ctx, const char *func,
     }
 
     fflush(stderr);
-    _exit(-1);
+    abort();
 #undef M_NSIZE
 #undef M_SIZE
 #undef M
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:47:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:47:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465468.724188 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gtW-00047I-07; Sat, 17 Dec 2022 23:47:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465468.724188; Sat, 17 Dec 2022 23:47: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 1p6gtV-000478-Sv; Sat, 17 Dec 2022 23:47:05 +0000
Received: by outflank-mailman (input) for mailman id 465468;
 Sat, 17 Dec 2022 23:47:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gtU-00046w-Az
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gtU-0004XU-AJ
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gtU-0001UU-9c
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=L5dYMVyaPGXYH5hXngat9tKpwk5IZ8J5QIkzy41Jl4Q=; b=GOiQZh4xck4oE/b7tSufw5UO3L
	WESVyC4h5ean3xNw0DW0ENMYvpJAQ/mjgPLGwVVboUPIkxja9BXKu9Dd+YWzCDoipQxKdrqLqgEzh
	7+yoEdr/5G5U/Rf+OQw9ZCULadFg1mSc7512Wy6Iq0IFnUOsHiFO62J2QXf/QlxF2/kI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] EFI: relocate the ESRT when booting via multiboot2
Message-Id: <E1p6gtU-0001UU-9c@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:47:04 +0000

commit 8d7acf3f7d8d2555c78421dced45bc49f79ae806
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Wed Dec 14 12:00:35 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 14 12:00:35 2022 +0100

    EFI: relocate the ESRT when booting via multiboot2
    
    This was missed in the initial patchset.
    
    Move efi_relocate_esrt() up to avoid adding a forward declaration.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/efi/efi-boot.h |   2 +
 xen/common/efi/boot.c       | 136 ++++++++++++++++++++++----------------------
 2 files changed, 70 insertions(+), 68 deletions(-)

diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 27f928ed3c..c94e53d139 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -823,6 +823,8 @@ void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable
     if ( gop )
         efi_set_gop_mode(gop, gop_mode);
 
+    efi_relocate_esrt(SystemTable);
+
     efi_exit_boot(ImageHandle, SystemTable);
 }
 
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index b3de1011ee..d3c6b055ae 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -625,6 +625,74 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
     return esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
 }
 
+static EFI_GUID __initdata esrt_guid = EFI_SYSTEM_RESOURCE_TABLE_GUID;
+
+static void __init efi_relocate_esrt(EFI_SYSTEM_TABLE *SystemTable)
+{
+    EFI_STATUS status;
+    UINTN info_size = 0, map_key, mdesc_size;
+    void *memory_map = NULL;
+    UINT32 ver;
+    unsigned int i;
+
+    for ( ; ; )
+    {
+        status = efi_bs->GetMemoryMap(&info_size, memory_map, &map_key,
+                                      &mdesc_size, &ver);
+        if ( status == EFI_SUCCESS && memory_map != NULL )
+            break;
+        if ( status == EFI_BUFFER_TOO_SMALL || memory_map == NULL )
+        {
+            info_size += 8 * mdesc_size;
+            if ( memory_map != NULL )
+                efi_bs->FreePool(memory_map);
+            memory_map = NULL;
+            status = efi_bs->AllocatePool(EfiLoaderData, info_size, &memory_map);
+            if ( status == EFI_SUCCESS )
+                continue;
+            PrintErr(L"Cannot allocate memory to relocate ESRT\r\n");
+        }
+        else
+            PrintErr(L"Cannot obtain memory map to relocate ESRT\r\n");
+        return;
+    }
+
+    /* Try to obtain the ESRT.  Errors are not fatal. */
+    for ( i = 0; i < info_size; i += mdesc_size )
+    {
+        /*
+         * ESRT needs to be moved to memory of type EfiACPIReclaimMemory
+         * so that the memory it is in will not be used for other purposes.
+         */
+        void *new_esrt = NULL;
+        const EFI_MEMORY_DESCRIPTOR *desc = memory_map + i;
+        size_t esrt_size = get_esrt_size(desc);
+
+        if ( !esrt_size )
+            continue;
+        if ( desc->Type == EfiRuntimeServicesData ||
+             desc->Type == EfiACPIReclaimMemory )
+            break; /* ESRT already safe from reuse */
+        status = efi_bs->AllocatePool(EfiACPIReclaimMemory, esrt_size,
+                                      &new_esrt);
+        if ( status == EFI_SUCCESS && new_esrt )
+        {
+            memcpy(new_esrt, (void *)esrt, esrt_size);
+            status = efi_bs->InstallConfigurationTable(&esrt_guid, new_esrt);
+            if ( status != EFI_SUCCESS )
+            {
+                PrintErr(L"Cannot install new ESRT\r\n");
+                efi_bs->FreePool(new_esrt);
+            }
+        }
+        else
+            PrintErr(L"Cannot allocate memory for ESRT\r\n");
+        break;
+    }
+
+    efi_bs->FreePool(memory_map);
+}
+
 /*
  * Include architecture specific implementation here, which references the
  * static globals defined above.
@@ -903,8 +971,6 @@ static UINTN __init efi_find_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
     return gop_mode;
 }
 
-static EFI_GUID __initdata esrt_guid = EFI_SYSTEM_RESOURCE_TABLE_GUID;
-
 static void __init efi_tables(void)
 {
     unsigned int i;
@@ -1113,72 +1179,6 @@ static void __init efi_set_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UINTN gop
 #define INVALID_VIRTUAL_ADDRESS (0xBAAADUL << \
                                  (EFI_PAGE_SHIFT + BITS_PER_LONG - 32))
 
-static void __init efi_relocate_esrt(EFI_SYSTEM_TABLE *SystemTable)
-{
-    EFI_STATUS status;
-    UINTN info_size = 0, map_key, mdesc_size;
-    void *memory_map = NULL;
-    UINT32 ver;
-    unsigned int i;
-
-    for ( ; ; )
-    {
-        status = efi_bs->GetMemoryMap(&info_size, memory_map, &map_key,
-                                      &mdesc_size, &ver);
-        if ( status == EFI_SUCCESS && memory_map != NULL )
-            break;
-        if ( status == EFI_BUFFER_TOO_SMALL || memory_map == NULL )
-        {
-            info_size += 8 * mdesc_size;
-            if ( memory_map != NULL )
-                efi_bs->FreePool(memory_map);
-            memory_map = NULL;
-            status = efi_bs->AllocatePool(EfiLoaderData, info_size, &memory_map);
-            if ( status == EFI_SUCCESS )
-                continue;
-            PrintErr(L"Cannot allocate memory to relocate ESRT\r\n");
-        }
-        else
-            PrintErr(L"Cannot obtain memory map to relocate ESRT\r\n");
-        return;
-    }
-
-    /* Try to obtain the ESRT.  Errors are not fatal. */
-    for ( i = 0; i < info_size; i += mdesc_size )
-    {
-        /*
-         * ESRT needs to be moved to memory of type EfiACPIReclaimMemory
-         * so that the memory it is in will not be used for other purposes.
-         */
-        void *new_esrt = NULL;
-        const EFI_MEMORY_DESCRIPTOR *desc = memory_map + i;
-        size_t esrt_size = get_esrt_size(desc);
-
-        if ( !esrt_size )
-            continue;
-        if ( desc->Type == EfiRuntimeServicesData ||
-             desc->Type == EfiACPIReclaimMemory )
-            break; /* ESRT already safe from reuse */
-        status = efi_bs->AllocatePool(EfiACPIReclaimMemory, esrt_size,
-                                      &new_esrt);
-        if ( status == EFI_SUCCESS && new_esrt )
-        {
-            memcpy(new_esrt, (void *)esrt, esrt_size);
-            status = efi_bs->InstallConfigurationTable(&esrt_guid, new_esrt);
-            if ( status != EFI_SUCCESS )
-            {
-                PrintErr(L"Cannot install new ESRT\r\n");
-                efi_bs->FreePool(new_esrt);
-            }
-        }
-        else
-            PrintErr(L"Cannot allocate memory for ESRT\r\n");
-        break;
-    }
-
-    efi_bs->FreePool(memory_map);
-}
-
 static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
 {
     EFI_STATUS status;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:47:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:47:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465469.724191 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gtf-0004AQ-31; Sat, 17 Dec 2022 23:47:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465469.724191; Sat, 17 Dec 2022 23:47: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 1p6gtf-0004AI-0K; Sat, 17 Dec 2022 23:47:15 +0000
Received: by outflank-mailman (input) for mailman id 465469;
 Sat, 17 Dec 2022 23:47:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gte-0004A8-Dv
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gte-0004Xf-DH
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gte-0001Uz-Cc
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7xgXa/R9byOMV0u7eRFc3MU4g9V2F/B3qID4MU4NOhA=; b=EAAbOIB9tsrQq0HMK1o14HbJ6L
	37QPgYVpEPEvWsYE9mRxLOVmUOoLckdrTKe3w4HNzkqIQe6oBf+bEBBG2rNSwQuCxMANQCz4CAuqo
	NBr8kraPZFEGCr5yWtRpKuJF0H8+dzMky6TBBHnkQGok3QJa3iUMj40jKIy022eLqL0s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: let tdb_logger() preserve errno
Message-Id: <E1p6gte-0001Uz-Cc@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:47:14 +0000

commit 6a0d1914f0b19742436367a0019602992573bd4b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Dec 14 12:01:47 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 14 12:01:47 2022 +0100

    tools/xenstore: let tdb_logger() preserve errno
    
    tdb_logger() is called by TDB for logging errors. As errno is checked
    often after doing the logging, tdb_logger() should preserve errno.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 476d5c6d51..4cd54c8b5a 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2347,6 +2347,7 @@ static void tdb_logger(TDB_CONTEXT *tdb, int level, const char * fmt, ...)
 {
 	va_list ap;
 	char *s;
+	int saved_errno = errno;
 
 	va_start(ap, fmt);
 	s = talloc_vasprintf(NULL, fmt, ap);
@@ -2362,6 +2363,8 @@ static void tdb_logger(TDB_CONTEXT *tdb, int level, const char * fmt, ...)
 		trace("talloc failure during logging\n");
 		syslog(LOG_ERR, "talloc failure during logging\n");
 	}
+
+	errno = saved_errno;
 }
 
 void setup_structure(bool live_update)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:47:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:47:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465470.724195 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gtp-0004D4-4U; Sat, 17 Dec 2022 23:47:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465470.724195; Sat, 17 Dec 2022 23:47: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 1p6gtp-0004Cx-1y; Sat, 17 Dec 2022 23:47:25 +0000
Received: by outflank-mailman (input) for mailman id 465470;
 Sat, 17 Dec 2022 23:47:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gto-0004Cp-Gx
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gto-0004Xw-GJ
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gto-0001Wx-Fb
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Z8Vi15RMaWASNu8PEpL9i+7IPdZHYiz4Wh3bDIHvKgA=; b=0oQVXX/uJ3t2aoBa6wWVsA54x/
	rnYbkyd2hlrXFuK8HAu+dOE2x5hhK0VXkicwNPi3sA3S8jQ2h8oOOf+6ihvhnlobmgnG44vc7i1x/
	UQpqol64UcDY57Q2dcNm2umSKBUeYv+7NS1pGjURlWjLCKO2iQjfUw08Luecbn9Q8W9s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: preserve errno across corrupt()
Message-Id: <E1p6gto-0001Wx-Fb@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:47:24 +0000

commit bb65cbd81caaaaf325d23f63b4c2165960563459
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Dec 14 12:02:04 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 14 12:02:04 2022 +0100

    tools/xenstore: preserve errno across corrupt()
    
    Let corrupt() preserve errno in order to be able to simplify error
    handling in future.
    
    This is rather easy as the errno value when entering corrupt() is
    saved already.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 4cd54c8b5a..f68f82cb19 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2551,6 +2551,8 @@ void corrupt(struct connection *conn, const char *fmt, ...)
 	talloc_free(str);
 
 	check_store();
+
+	errno = saved_errno;
 }
 
 #ifndef NO_SOCKETS
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:47:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:47:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465471.724199 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gtz-0004G4-6Q; Sat, 17 Dec 2022 23:47:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465471.724199; Sat, 17 Dec 2022 23:47:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gtz-0004Fw-3X; Sat, 17 Dec 2022 23:47:35 +0000
Received: by outflank-mailman (input) for mailman id 465471;
 Sat, 17 Dec 2022 23:47:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gty-0004Fl-KB
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gty-0004YF-JX
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gty-0001XM-Id
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9sFw9+/gb2svDLlh4YFSBjBitZXH6rxLSOI03y3L1oc=; b=cl5x63p5HgfNfbFVyaDImr+SQ/
	O2c4VEtXGtHAOKCbeYMphtG2BeoLrdrwjfoqPpciohutxLO9wdyizmAo/QQAd3BH55CgOOoYjHfpq
	u4Rcxkzc8eRzDE0GJI65IOfF3Ck9nBizzBU4rMGBupRds65FTAiaVsYcQObqKh9uw9RM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: enhance hashtable implementation
Message-Id: <E1p6gty-0001XM-Id@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:47:34 +0000

commit db75092aea988b4be78c8273626f2ee40b4012b8
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Dec 14 12:02:21 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 14 12:02:21 2022 +0100

    tools/xenstore: enhance hashtable implementation
    
    Today it is possible to set a flag when calling hashtable_destroy() in
    order to specify whether the data associated with the hashtable entries
    should be freed or not. The keys of the entries will always be freed.
    
    Change that by replacing the flag of hashtable_destroy() by two flags
    for create_hashtable() which will specify whether the data and/or the
    key of each entry should be freed or not.
    
    This will enable users to have the key e.g. as part of the data.
    
    Add a new function hashtable_iterate() to call a user specified
    function for each entry in the hashtable.
    
    Add new primes to the primetable in order to support smaller sizes of
    the hashtable. The primes are selected according to:
    
    https://planetmath.org/goodhashtableprimes
    
    Update the URL in the source as the old one wasn't correct any longer.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/hashtable.c      | 66 ++++++++++++++++++++++++++++-------------
 tools/xenstore/hashtable.h      | 35 ++++++++++++++++++++--
 tools/xenstore/xenstored_core.c |  7 +++--
 3 files changed, 82 insertions(+), 26 deletions(-)

diff --git a/tools/xenstore/hashtable.c b/tools/xenstore/hashtable.c
index 6ac336eff1..299549c51e 100644
--- a/tools/xenstore/hashtable.c
+++ b/tools/xenstore/hashtable.c
@@ -16,6 +16,7 @@ struct entry
 
 struct hashtable {
     unsigned int tablelength;
+    unsigned int flags;
     struct entry **table;
     unsigned int entrycount;
     unsigned int loadlimit;
@@ -25,12 +26,11 @@ struct hashtable {
 };
 
 /*
-Credit for primes table: Aaron Krowne
- http://br.endernet.org/~akrowne/
- http://planetmath.org/encyclopedia/GoodHashTablePrimes.html
-*/
+ * Credit for primes table: Aaron Krowne
+ * https://planetmath.org/goodhashtableprimes
+ */
 static const unsigned int primes[] = {
-53, 97, 193, 389,
+11, 23, 53, 97, 193, 389,
 769, 1543, 3079, 6151,
 12289, 24593, 49157, 98317,
 196613, 393241, 786433, 1572869,
@@ -52,7 +52,8 @@ indexFor(unsigned int tablelength, unsigned int hashvalue) {
 struct hashtable *
 create_hashtable(unsigned int minsize,
                  unsigned int (*hashf) (void*),
-                 int (*eqf) (void*,void*))
+                 int (*eqf) (void*,void*),
+                 unsigned int flags)
 {
     struct hashtable *h;
     unsigned int pindex, size = primes[0];
@@ -73,6 +74,7 @@ create_hashtable(unsigned int minsize,
         goto err1;
 
     h->tablelength  = size;
+    h->flags        = flags;
     h->primeindex   = pindex;
     h->entrycount   = 0;
     h->hashfn       = hashf;
@@ -235,7 +237,8 @@ hashtable_remove(struct hashtable *h, void *k)
             *pE = e->next;
             h->entrycount--;
             v = e->v;
-            free(e->k);
+            if (h->flags & HASHTABLE_FREE_KEY)
+                free(e->k);
             free(e);
             return v;
         }
@@ -246,29 +249,52 @@ hashtable_remove(struct hashtable *h, void *k)
 }
 
 /*****************************************************************************/
-/* destroy */
-void
-hashtable_destroy(struct hashtable *h, int free_values)
+int
+hashtable_iterate(struct hashtable *h,
+                  int (*func)(const void *k, void *v, void *arg), void *arg)
 {
+    int ret;
     unsigned int i;
     struct entry *e, *f;
     struct entry **table = h->table;
-    if (free_values)
+
+    for (i = 0; i < h->tablelength; i++)
     {
-        for (i = 0; i < h->tablelength; i++)
+        e = table[i];
+        while (e)
         {
-            e = table[i];
-            while (NULL != e)
-            { f = e; e = e->next; free(f->k); free(f->v); free(f); }
+            f = e;
+            e = e->next;
+            ret = func(f->k, f->v, arg);
+            if (ret)
+                return ret;
         }
     }
-    else
+
+    return 0;
+}
+
+/*****************************************************************************/
+/* destroy */
+void
+hashtable_destroy(struct hashtable *h)
+{
+    unsigned int i;
+    struct entry *e, *f;
+    struct entry **table = h->table;
+
+    for (i = 0; i < h->tablelength; i++)
     {
-        for (i = 0; i < h->tablelength; i++)
+        e = table[i];
+        while (NULL != e)
         {
-            e = table[i];
-            while (NULL != e)
-            { f = e; e = e->next; free(f->k); free(f); }
+            f = e;
+            e = e->next;
+            if (h->flags & HASHTABLE_FREE_KEY)
+                free(f->k);
+            if (h->flags & HASHTABLE_FREE_VALUE)
+                free(f->v);
+            free(f);
         }
     }
     free(h->table);
diff --git a/tools/xenstore/hashtable.h b/tools/xenstore/hashtable.h
index 62fef6081a..6d65431f96 100644
--- a/tools/xenstore/hashtable.h
+++ b/tools/xenstore/hashtable.h
@@ -12,13 +12,21 @@ struct hashtable;
  * @param   minsize         minimum initial size of hashtable
  * @param   hashfunction    function for hashing keys
  * @param   key_eq_fn       function for determining key equality
+ * @param   flags           flags HASHTABLE_*
  * @return                  newly created hashtable or NULL on failure
  */
 
+/* Let hashtable_destroy() free the entries' values. */
+#define HASHTABLE_FREE_VALUE (1U << 0)
+/* Let hashtable_remove() and hashtable_destroy() free the entries' keys. */
+#define HASHTABLE_FREE_KEY   (1U << 1)
+
 struct hashtable *
 create_hashtable(unsigned int minsize,
                  unsigned int (*hashfunction) (void*),
-                 int (*key_eq_fn) (void*,void*));
+                 int (*key_eq_fn) (void*,void*),
+                 unsigned int flags
+);
 
 /*****************************************************************************
  * hashtable_insert
@@ -76,16 +84,37 @@ hashtable_remove(struct hashtable *h, void *k);
 unsigned int
 hashtable_count(struct hashtable *h);
 
+/*****************************************************************************
+ * hashtable_iterate
+
+ * @name           hashtable_iterate
+ * @param   h      the hashtable
+ * @param   func   function to call for each entry
+ * @param   arg    user supplied parameter for func
+ * @return         0 if okay, non-zero return value of func (and iteration
+ *                 was aborted)
+ *
+ * Iterates over all entries in the hashtable and calls func with the
+ * key, value, and the user supplied parameter.
+ * func returning a non-zero value will abort the iteration. In case func is
+ * removing an entry other than itself from the hashtable, it must return a
+ * non-zero value in order to abort the iteration. Inserting entries is
+ * allowed, but it is undefined whether func will be called for those new
+ * entries during this iteration.
+ */
+int
+hashtable_iterate(struct hashtable *h,
+                  int (*func)(const void *k, void *v, void *arg), void *arg);
+
 /*****************************************************************************
  * hashtable_destroy
    
  * @name        hashtable_destroy
  * @param   h   the hashtable
- * @param       free_values     whether to call 'free' on the remaining values
  */
 
 void
-hashtable_destroy(struct hashtable *h, int free_values);
+hashtable_destroy(struct hashtable *h);
 
 #endif /* __HASHTABLE_CWC22_H__ */
 
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index f68f82cb19..78a3edaa4e 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2514,7 +2514,9 @@ void check_store(void)
 		.enoent = check_store_enoent,
 	};
 
-	reachable = create_hashtable(16, hash_from_key_fn, keys_equal_fn);
+	/* Don't free values (they are all void *1) */
+	reachable = create_hashtable(16, hash_from_key_fn, keys_equal_fn,
+				     HASHTABLE_FREE_KEY);
 	if (!reachable) {
 		log("check_store: ENOMEM");
 		return;
@@ -2528,8 +2530,7 @@ void check_store(void)
 		clean_store(reachable);
 	log("Checking store complete.");
 
-	hashtable_destroy(reachable, 0 /* Don't free values (they are all
-					  (void *)1) */);
+	hashtable_destroy(reachable);
 }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:47:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:47:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465472.724204 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gu9-0004Kp-7s; Sat, 17 Dec 2022 23:47:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465472.724204; Sat, 17 Dec 2022 23:47:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gu9-0004Kh-55; Sat, 17 Dec 2022 23:47:45 +0000
Received: by outflank-mailman (input) for mailman id 465472;
 Sat, 17 Dec 2022 23:47:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gu8-0004KX-NY
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gu8-0004Yk-Mp
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gu8-0001Xt-MC
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Sx7KK9L9HmR2T2UArGNWuA5T2vX1nTCqzeJ7UqEYRCg=; b=JNBpPHIHKLDCzG0Pe5EPblQ0my
	kLbFVHmuv2LvBdFcYCXbmyDVA+CGRBAXFuhhDhXB34T5z0mW/2IohiWvJcNw3yNgH0qzK8tZQJMM6
	9T26ibNp2yxuo+vlckOyxFJ5bOh7JFUsYjRMjysL1UQ5Wr9VwisJ7m7tE/WOza77WyQ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: add support for generic virtio device
Message-Id: <E1p6gu8-0001Xt-MC@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:47:44 +0000

commit 43ba5202e2eebd350161a8db674bf928c3e6f859
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Wed Dec 14 12:03:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 14 12:03:09 2022 +0100

    libxl: add support for generic virtio device
    
    This patch adds basic support for configuring and assisting generic
    Virtio backends, which could run in any domain.
    
    An example of domain configuration for mmio based Virtio I2C device is:
    virtio = ["type=virtio,device22,transport=mmio"]
    
    To make this work on Arm, allocate Virtio MMIO params (IRQ and memory
    region) and pass them to the backend and update guest device-tree to
    create a DT node for the Virtio devices.
    
    Add special support for I2C and GPIO devices, which require the
    "compatible" DT property to be set, among other device specific
    properties. Support for generic virtio devices is also added, which just
    need a MMIO node but not any special DT properties, for such devices the
    user needs to pass "virtio,device" in the "type" string.
    
    The parsing of generic virtio device configurations will be done in a
    separate commit.
    
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
---
 tools/libs/light/Makefile                 |   1 +
 tools/libs/light/libxl_arm.c              | 100 +++++++++++++++++++++
 tools/libs/light/libxl_create.c           |   4 +
 tools/libs/light/libxl_internal.h         |   6 ++
 tools/libs/light/libxl_types.idl          |  18 ++++
 tools/libs/light/libxl_types_internal.idl |   1 +
 tools/libs/light/libxl_virtio.c           | 144 ++++++++++++++++++++++++++++++
 7 files changed, 274 insertions(+)

diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index 374be1cfab..4fddcc6f51 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -106,6 +106,7 @@ OBJS-y += libxl_vdispl.o
 OBJS-y += libxl_pvcalls.o
 OBJS-y += libxl_vsnd.o
 OBJS-y += libxl_vkb.o
+OBJS-y += libxl_virtio.o
 OBJS-y += libxl_genid.o
 OBJS-y += _libxl_types.o
 OBJS-y += libxl_flask.o
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index fa3d61f1e8..ddc7b2a159 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -113,6 +113,19 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
         }
     }
 
+    for (i = 0; i < d_config->num_virtios; i++) {
+        libxl_device_virtio *virtio = &d_config->virtios[i];
+
+        if (virtio->transport != LIBXL_VIRTIO_TRANSPORT_MMIO)
+            continue;
+
+        rc = alloc_virtio_mmio_params(gc, &virtio->base, &virtio->irq,
+                                      &virtio_mmio_base, &virtio_mmio_irq);
+
+        if (rc)
+            return rc;
+    }
+
     /*
      * Every virtio-mmio device uses one emulated SPI. If Virtio devices are
      * present, make sure that we allocate enough SPIs for them.
@@ -956,6 +969,79 @@ static int make_virtio_mmio_node(libxl__gc *gc, void *fdt, uint64_t base,
     return fdt_end_node(fdt);
 }
 
+/*
+ * The DT bindings for I2C device are present here:
+ *
+ * https://www.kernel.org/doc/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml
+ */
+static int make_virtio_mmio_node_i2c(libxl__gc *gc, void *fdt)
+{
+    int res;
+
+    res = fdt_begin_node(fdt, "i2c");
+    if (res) return res;
+
+    res = fdt_property_compat(gc, fdt, 1, VIRTIO_DEVICE_TYPE_I2C);
+    if (res) return res;
+
+    return fdt_end_node(fdt);
+}
+
+/*
+ * The DT bindings for GPIO device are present here:
+ *
+ * https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml
+ */
+static int make_virtio_mmio_node_gpio(libxl__gc *gc, void *fdt)
+{
+    int res;
+
+    res = fdt_begin_node(fdt, "gpio");
+    if (res) return res;
+
+    res = fdt_property_compat(gc, fdt, 1, VIRTIO_DEVICE_TYPE_GPIO);
+    if (res) return res;
+
+    res = fdt_property(fdt, "gpio-controller", NULL, 0);
+    if (res) return res;
+
+    res = fdt_property_cell(fdt, "#gpio-cells", 2);
+    if (res) return res;
+
+    res = fdt_property(fdt, "interrupt-controller", NULL, 0);
+    if (res) return res;
+
+    res = fdt_property_cell(fdt, "#interrupt-cells", 2);
+    if (res) return res;
+
+    return fdt_end_node(fdt);
+}
+
+static int make_virtio_mmio_node_device(libxl__gc *gc, void *fdt, uint64_t base,
+                                        uint32_t irq, const char *type,
+                                        uint32_t backend_domid)
+{
+    int res;
+
+    res = make_virtio_mmio_node_common(gc, fdt, base, irq, backend_domid);
+    if (res) return res;
+
+    /* Add device specific nodes */
+    if (!strcmp(type, VIRTIO_DEVICE_TYPE_I2C)) {
+        res = make_virtio_mmio_node_i2c(gc, fdt);
+        if (res) return res;
+    } else if (!strcmp(type, VIRTIO_DEVICE_TYPE_GPIO)) {
+        res = make_virtio_mmio_node_gpio(gc, fdt);
+        if (res) return res;
+    } else if (strcmp(type, VIRTIO_DEVICE_TYPE_GENERIC)) {
+        /* Doesn't match generic virtio device */
+        LOG(ERROR, "Invalid type for virtio device: %s", type);
+        return -EINVAL;
+    }
+
+    return fdt_end_node(fdt);
+}
+
 static const struct arch_info *get_arch_info(libxl__gc *gc,
                                              const struct xc_dom_image *dom)
 {
@@ -1277,6 +1363,20 @@ next_resize:
             }
         }
 
+        for (i = 0; i < d_config->num_virtios; i++) {
+            libxl_device_virtio *virtio = &d_config->virtios[i];
+
+            if (virtio->transport != LIBXL_VIRTIO_TRANSPORT_MMIO)
+                continue;
+
+            if (virtio->backend_domid != LIBXL_TOOLSTACK_DOMID)
+                iommu_needed = true;
+
+            FDT( make_virtio_mmio_node_device(gc, fdt, virtio->base,
+                                              virtio->irq, virtio->type,
+                                              virtio->backend_domid) );
+        }
+
         /*
          * The iommu node should be created only once for all virtio-mmio
          * devices.
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 612eacfc7f..beec3f6b6f 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -1752,6 +1752,10 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
         libxl__device_add(gc, domid, &libxl__pvcallsif_devtype,
                           &d_config->pvcallsifs[i]);
 
+    for (i = 0; i < d_config->num_virtios; i++)
+        libxl__device_add(gc, domid, &libxl__virtio_devtype,
+                          &d_config->virtios[i]);
+
     switch (d_config->c_info.type) {
     case LIBXL_DOMAIN_TYPE_HVM:
     {
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index a7c447c10e..0dc8b8f210 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -166,6 +166,11 @@
 /* Convert pfn to physical address space. */
 #define pfn_to_paddr(x) ((uint64_t)(x) << XC_PAGE_SHIFT)
 
+/* Virtio device types */
+#define VIRTIO_DEVICE_TYPE_GENERIC   "virtio,device"
+#define VIRTIO_DEVICE_TYPE_I2C       "virtio,device22"
+#define VIRTIO_DEVICE_TYPE_GPIO      "virtio,device29"
+
 /* logging */
 _hidden void libxl__logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
              const char *file /* may be 0 */, int line /* ignored if !file */,
@@ -4003,6 +4008,7 @@ static inline int *libxl__device_type_get_num(
 
 extern const libxl__device_type libxl__vfb_devtype;
 extern const libxl__device_type libxl__vkb_devtype;
+extern const libxl__device_type libxl__virtio_devtype;
 extern const libxl__device_type libxl__disk_devtype;
 extern const libxl__device_type libxl__nic_devtype;
 extern const libxl__device_type libxl__vtpm_devtype;
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 9e3d33cb5a..0cfad8508d 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -278,6 +278,11 @@ libxl_vkb_backend = Enumeration("vkb_backend", [
     (2, "LINUX")
     ])
 
+libxl_virtio_transport = Enumeration("virtio_transport", [
+    (0, "UNKNOWN"),
+    (1, "MMIO"),
+    ])
+
 libxl_passthrough = Enumeration("passthrough", [
     (0, "default"),
     (1, "disabled"),
@@ -703,6 +708,18 @@ libxl_device_vkb = Struct("device_vkb", [
     ("multi_touch_num_contacts", uint32)
     ])
 
+libxl_device_virtio = Struct("device_virtio", [
+    ("backend_domid", libxl_domid),
+    ("backend_domname", string),
+    ("type", string),
+    ("transport", libxl_virtio_transport),
+    ("devid", libxl_devid),
+    # Note that virtio-mmio parameters (irq and base) are for internal
+    # use by libxl and can't be modified.
+    ("irq", uint32),
+    ("base", uint64)
+    ])
+
 libxl_device_disk = Struct("device_disk", [
     ("backend_domid", libxl_domid),
     ("backend_domname", string),
@@ -980,6 +997,7 @@ libxl_domain_config = Struct("domain_config", [
     ("dtdevs", Array(libxl_device_dtdev, "num_dtdevs")),
     ("vfbs", Array(libxl_device_vfb, "num_vfbs")),
     ("vkbs", Array(libxl_device_vkb, "num_vkbs")),
+    ("virtios", Array(libxl_device_virtio, "num_virtios")),
     ("vtpms", Array(libxl_device_vtpm, "num_vtpms")),
     ("p9s", Array(libxl_device_p9, "num_p9s")),
     ("pvcallsifs", Array(libxl_device_pvcallsif, "num_pvcallsifs")),
diff --git a/tools/libs/light/libxl_types_internal.idl b/tools/libs/light/libxl_types_internal.idl
index fb0f4f23d7..e24288f1a5 100644
--- a/tools/libs/light/libxl_types_internal.idl
+++ b/tools/libs/light/libxl_types_internal.idl
@@ -33,6 +33,7 @@ libxl__device_kind = Enumeration("device_kind", [
     (15, "VSND"),
     (16, "VINPUT"),
     (17, "VIRTIO_DISK"),
+    (18, "VIRTIO"),
     ])
 
 libxl__console_backend = Enumeration("console_backend", [
diff --git a/tools/libs/light/libxl_virtio.c b/tools/libs/light/libxl_virtio.c
new file mode 100644
index 0000000000..6a38def2fa
--- /dev/null
+++ b/tools/libs/light/libxl_virtio.c
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2022 Linaro Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include "libxl_internal.h"
+
+static int libxl__device_virtio_setdefault(libxl__gc *gc, uint32_t domid,
+                                           libxl_device_virtio *virtio,
+                                           bool hotplug)
+{
+    return libxl__resolve_domid(gc, virtio->backend_domname,
+                                &virtio->backend_domid);
+}
+
+static int libxl__device_from_virtio(libxl__gc *gc, uint32_t domid,
+                                     libxl_device_virtio *virtio,
+                                     libxl__device *device)
+{
+    device->backend_devid   = virtio->devid;
+    device->backend_domid   = virtio->backend_domid;
+    device->devid           = virtio->devid;
+    device->domid           = domid;
+
+    device->backend_kind    = LIBXL__DEVICE_KIND_VIRTIO;
+    device->kind            = LIBXL__DEVICE_KIND_VIRTIO;
+
+    return 0;
+}
+
+static int libxl__set_xenstore_virtio(libxl__gc *gc, uint32_t domid,
+                                      libxl_device_virtio *virtio,
+                                      flexarray_t *back, flexarray_t *front,
+                                      flexarray_t *ro_front)
+{
+    const char *transport = libxl_virtio_transport_to_string(virtio->transport);
+
+    flexarray_append_pair(back, "irq", GCSPRINTF("%u", virtio->irq));
+    flexarray_append_pair(back, "base", GCSPRINTF("%lu", virtio->base));
+    flexarray_append_pair(back, "type", GCSPRINTF("%s", virtio->type));
+    flexarray_append_pair(back, "transport", GCSPRINTF("%s", transport));
+
+    flexarray_append_pair(front, "irq", GCSPRINTF("%u", virtio->irq));
+    flexarray_append_pair(front, "base", GCSPRINTF("%lu", virtio->base));
+    flexarray_append_pair(front, "type", GCSPRINTF("%s", virtio->type));
+    flexarray_append_pair(front, "transport", GCSPRINTF("%s", transport));
+
+    return 0;
+}
+
+static int libxl__virtio_from_xenstore(libxl__gc *gc, const char *libxl_path,
+                                       libxl_devid devid,
+                                       libxl_device_virtio *virtio)
+{
+    const char *be_path, *tmp = NULL;
+    int rc;
+
+    virtio->devid = devid;
+
+    rc = libxl__xs_read_mandatory(gc, XBT_NULL,
+                                  GCSPRINTF("%s/backend", libxl_path),
+                                  &be_path);
+    if (rc) goto out;
+
+    rc = libxl__backendpath_parse_domid(gc, be_path, &virtio->backend_domid);
+    if (rc) goto out;
+
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+				GCSPRINTF("%s/irq", be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        virtio->irq = strtoul(tmp, NULL, 0);
+    }
+
+    tmp = NULL;
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+				GCSPRINTF("%s/base", be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        virtio->base = strtoul(tmp, NULL, 0);
+    }
+
+    tmp = NULL;
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+				GCSPRINTF("%s/transport", be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        if (!strcmp(tmp, "mmio")) {
+            virtio->transport = LIBXL_VIRTIO_TRANSPORT_MMIO;
+        } else {
+            return ERROR_INVAL;
+        }
+    }
+
+    tmp = NULL;
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+				GCSPRINTF("%s/type", be_path), &tmp);
+    if (rc) goto out;
+
+    if (tmp) {
+        int len = sizeof(VIRTIO_DEVICE_TYPE_GENERIC) - 1;
+
+        if (!strncmp(tmp, VIRTIO_DEVICE_TYPE_GENERIC, len)) {
+            virtio->type = libxl__strdup(NOGC, tmp);
+        } else {
+            return ERROR_INVAL;
+        }
+    }
+
+out:
+    return rc;
+}
+
+static LIBXL_DEFINE_UPDATE_DEVID(virtio)
+
+#define libxl__add_virtios NULL
+#define libxl_device_virtio_compare NULL
+
+DEFINE_DEVICE_TYPE_STRUCT(virtio, VIRTIO, virtios,
+    .set_xenstore_config = (device_set_xenstore_config_fn_t)
+                           libxl__set_xenstore_virtio,
+    .from_xenstore = (device_from_xenstore_fn_t)libxl__virtio_from_xenstore,
+    .skip_attach = 1
+);
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:47:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:47:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465473.724207 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6guJ-0004No-Am; Sat, 17 Dec 2022 23:47:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465473.724207; Sat, 17 Dec 2022 23:47:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6guJ-0004Ng-82; Sat, 17 Dec 2022 23:47:55 +0000
Received: by outflank-mailman (input) for mailman id 465473;
 Sat, 17 Dec 2022 23:47:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6guI-0004NW-QP
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6guI-0004Yw-Ph
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6guI-0001YI-P5
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:47:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+vxvgSGawL+1Djl1Mzkpzz9at9zOfjVZuJ/8pEDowHM=; b=3TyDnFKa4m8VFmH/9ceqyjf4Gv
	ihHuw5t8jgmGYFUEaacoeGvuToehcvge0Gz8QXv+uV/laeYfWfNR7xUGKI0teoiHd0rxhfuckkDLU
	3kJaDnnR8XpB+QZNAw/7kA2XlX7Q/44mBSvDt4SOtp0F0XOfbDVIY+YmUsONjPZfxvy0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xl: add support to parse generic virtio device
Message-Id: <E1p6guI-0001YI-P5@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:47:54 +0000

commit 953efa0b7b188458b18e4a727f3b1dfa77eacb61
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Wed Dec 14 12:03:25 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 14 12:03:25 2022 +0100

    xl: add support to parse generic virtio device
    
    This patch adds basic support for parsing generic Virtio backend.
    
    An example of domain configuration for mmio based Virtio I2C device is:
    virtio = ["type=virtio,device22,transport=mmio"]
    
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/xl/xl_parse.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 644ab8f8fd..853e9f357a 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1208,6 +1208,83 @@ out:
     if (rc) exit(EXIT_FAILURE);
 }
 
+static int parse_virtio_config(libxl_device_virtio *virtio, char *token)
+{
+    char *oparg;
+    int rc;
+
+    if (MATCH_OPTION("backend", token, oparg)) {
+        virtio->backend_domname = strdup(oparg);
+    } else if (MATCH_OPTION("type", token, oparg)) {
+        virtio->type = strdup(oparg);
+    } else if (MATCH_OPTION("transport", token, oparg)) {
+        rc = libxl_virtio_transport_from_string(oparg, &virtio->transport);
+        if (rc) return rc;
+    } else {
+        fprintf(stderr, "Unknown string \"%s\" in virtio spec\n", token);
+        return -1;
+    }
+
+    return 0;
+}
+
+static void parse_virtio_list(const XLU_Config *config,
+                              libxl_domain_config *d_config)
+{
+    XLU_ConfigList *virtios;
+    const char *item;
+    char *buf = NULL, *oparg, *str = NULL;
+    int rc;
+
+    if (!xlu_cfg_get_list (config, "virtio", &virtios, 0, 0)) {
+        int entry = 0;
+        while ((item = xlu_cfg_get_listitem(virtios, entry)) != NULL) {
+            libxl_device_virtio *virtio;
+            char *p;
+
+            virtio = ARRAY_EXTEND_INIT(d_config->virtios, d_config->num_virtios,
+                                       libxl_device_virtio_init);
+
+            buf = strdup(item);
+
+            p = strtok(buf, ",");
+            while (p != NULL)
+            {
+                while (*p == ' ') p++;
+
+                // Type may contain a comma, do special handling.
+                if (MATCH_OPTION("type", p, oparg)) {
+                    if (!strncmp(oparg, "virtio", strlen("virtio"))) {
+                        char *p2 = strtok(NULL, ",");
+                        str = malloc(strlen(p) + strlen(p2) + 2);
+
+                        strcpy(str, p);
+                        strcat(str, ",");
+                        strcat(str, p2);
+                        p = str;
+                    }
+                }
+
+                rc = parse_virtio_config(virtio, p);
+                if (rc) goto out;
+
+                free(str);
+                str = NULL;
+                p = strtok(NULL, ",");
+            }
+
+            entry++;
+            free(buf);
+        }
+    }
+
+    return;
+
+out:
+    free(buf);
+    if (rc) exit(EXIT_FAILURE);
+}
+
 void parse_config_data(const char *config_source,
                        const char *config_data,
                        int config_len,
@@ -2753,6 +2830,10 @@ skip_usbdev:
 
     parse_vkb_list(config, d_config);
 
+    d_config->virtios = NULL;
+    d_config->num_virtios = 0;
+    parse_virtio_list(config, d_config);
+
     xlu_cfg_get_defbool(config, "xend_suspend_evtchn_compat",
                         &c_info->xend_suspend_evtchn_compat, 0);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:48:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:48:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465474.724213 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6guU-0004Qw-Cv; Sat, 17 Dec 2022 23:48:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465474.724213; Sat, 17 Dec 2022 23:48: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 1p6guU-0004Qo-9o; Sat, 17 Dec 2022 23:48:06 +0000
Received: by outflank-mailman (input) for mailman id 465474;
 Sat, 17 Dec 2022 23:48:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6guS-0004Qb-TK
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6guS-0004ZI-Sa
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6guS-0001Z0-Rx
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XYTpcGxBogfmQdjV2s2DdmDfPDXjBoeNYk61DylgkVU=; b=LQUhIjSHRN1kGrTPj1cka3BiVC
	h/bazmVO4nJHHuuk2ECgcmpoSPqPiEtVBlNPasV119q9Jk8HZ243xGpd877WNWf25QuM9SblbDNa4
	o1Il0xnm3/ul72dgkSF2HGdEw2kQwvzP+uNjE5azTH5UnRwry/FuO2fptxoTQrWOEZA0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: add documentation for generic virtio devices
Message-Id: <E1p6guS-0001Z0-Rx@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:48:04 +0000

commit dd54ea500be80f347402d75f3e4e7061e7db78d2
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Wed Dec 14 12:03:38 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 14 12:03:38 2022 +0100

    docs: add documentation for generic virtio devices
    
    This patch updates xl.cfg man page with details of generic Virtio device
    related information.
    
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
---
 docs/man/xl.cfg.5.pod.in | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index ec444fb2ba..024bceeb61 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -1585,6 +1585,39 @@ Set maximum height for pointer device.
 
 =back
 
+=item B<virtio=[ "VIRTIO_DEVICE_STRING", "VIRTIO_DEVICE_STRING", ...]>
+
+Specifies the Virtio devices to be provided to the guest.
+
+Each B<VIRTIO_DEVICE_STRING> is a comma-separated list of C<KEY=VALUE> settings
+from the following list. As a special case, a single comma is allowed in the
+VALUE of the "type" KEY, where the VALUE is set with "virtio,device<N>".
+
+=over 4
+
+=item B<backend=domain-id>
+
+Specifies the backend domain name or id, defaults to dom0.
+
+=item B<type=STRING>
+
+Specifies the compatible string for the specific Virtio device. The same will be
+written in the Device Tree compatible property of the Virtio device. For
+example, "type=virtio,device22" for the I2C device, whose device-tree binding is
+present here:
+
+L<https://www.kernel.org/doc/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml>
+
+For generic virtio devices, where we don't need to set special or compatible
+properties in the Device Tree, the type field must be set to "virtio,device".
+
+=item B<transport=STRING>
+
+Specifies the transport mechanism for the Virtio device, only "mmio" is
+supported for now.
+
+=back
+
 =item B<tee="STRING">
 
 B<Arm only.> Set TEE type for the guest. TEE is a Trusted Execution
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:48:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:48:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465475.724215 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gue-0004Tm-Dp; Sat, 17 Dec 2022 23:48:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465475.724215; Sat, 17 Dec 2022 23:48: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 1p6gue-0004Tf-BM; Sat, 17 Dec 2022 23:48:16 +0000
Received: by outflank-mailman (input) for mailman id 465475;
 Sat, 17 Dec 2022 23:48:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gud-0004TO-01
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6guc-0004ZW-Vd
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6guc-0001ZS-V0
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CJwp+l7VKildobVGdep9XoWiq6OWCbCFa8qDML39CuI=; b=qLRBzU+xHJQ8EjfWChkxFo71+O
	bqU35XKFNjEC9dAO9tUaVReFCixNTYdpdOVMYZYt7skH5HGX9AyUIT1hzShKVxdiwUIw7iED9Tdrr
	EArFzpZMdm2jvedcY+3x6aUpJUm3D6esGugRzckXdu2j8NJVe8VX/mbLAby04Sf+DwP8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] drivers/char: support up to 1M BAR0 of xhci
Message-Id: <E1p6guc-0001ZS-V0@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:48:14 +0000

commit 549b042943a57b748ce80070d1174e4ff5b8ef0b
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Dec 14 12:04:26 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 14 12:04:26 2022 +0100

    drivers/char: support up to 1M BAR0 of xhci
    
    AMD's XHCI has BAR0 of 1M (compared to 64K on Intel). Map it as a whole
    (reserving more space in the fixmap). Make fixmap slot conditional on
    CONFIG_XHCI.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/fixmap.h | 4 +++-
 xen/drivers/char/xhci-dbc.c       | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/fixmap.h b/xen/arch/x86/include/asm/fixmap.h
index bc39ffe896..516ec3fa6c 100644
--- a/xen/arch/x86/include/asm/fixmap.h
+++ b/xen/arch/x86/include/asm/fixmap.h
@@ -25,7 +25,7 @@
 #include <asm/msi.h>
 #include <acpi/apei.h>
 
-#define MAX_XHCI_PAGES 16
+#define MAX_XHCI_PAGES 256
 
 /*
  * Here we define all the compile-time 'special' virtual
@@ -45,8 +45,10 @@ enum fixed_addresses {
     FIX_COM_BEGIN,
     FIX_COM_END,
     FIX_EHCI_DBGP,
+#ifdef CONFIG_XHCI
     FIX_XHCI_BEGIN,
     FIX_XHCI_END = FIX_XHCI_BEGIN + MAX_XHCI_PAGES - 1,
+#endif
 #ifdef CONFIG_XEN_GUEST
     FIX_PV_CONSOLE,
     FIX_XEN_SHARED_INFO,
diff --git a/xen/drivers/char/xhci-dbc.c b/xen/drivers/char/xhci-dbc.c
index 86f6df6bef..60b781f872 100644
--- a/xen/drivers/char/xhci-dbc.c
+++ b/xen/drivers/char/xhci-dbc.c
@@ -268,10 +268,12 @@ static void *dbc_sys_map_xhc(uint64_t phys, size_t size)
 {
     size_t i;
 
-    if ( size != MAX_XHCI_PAGES * PAGE_SIZE )
+    if ( size > MAX_XHCI_PAGES * PAGE_SIZE )
         return NULL;
 
-    for ( i = FIX_XHCI_END; i >= FIX_XHCI_BEGIN; i-- )
+    size >>= PAGE_SHIFT;
+
+    for ( i = FIX_XHCI_END; i > FIX_XHCI_END - size; i-- )
     {
         set_fixmap_nocache(i, phys);
         phys += PAGE_SIZE;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:48:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:48:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465476.724219 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6guo-0004Wl-FX; Sat, 17 Dec 2022 23:48:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465476.724219; Sat, 17 Dec 2022 23:48: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 1p6guo-0004Wd-Ct; Sat, 17 Dec 2022 23:48:26 +0000
Received: by outflank-mailman (input) for mailman id 465476;
 Sat, 17 Dec 2022 23:48:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gun-0004WQ-2p
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gun-0004Ze-2D
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gun-0001Zt-1a
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QXjGpulQyF23BddxNN6JZuIqrf4ioaWFlJMPS5MyzGw=; b=eEBreUesevUNijRUZZTzeJon+0
	J7Ej+dkIMl9pDy0Td7WEN9yEQykFN4uL+8uapWOd9tQcOo/er5c7f8dvPBsrkBNZ8U5TjZnIVdGiy
	JEpdjG8oX6amWC0fMJLMd0Zw0cUe/LpYAixxAZfHoqnsA5geSOdjCBD3py3YMUxPbf8c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Arm: vGICv3: Sysreg emulation is applicable for AArch64 only
Message-Id: <E1p6gun-0001Zt-1a@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:48:25 +0000

commit 49dd24671569641d832804de550032b6f136abeb
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Dec 5 13:26:27 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:27:06 2022 +0000

    xen/Arm: vGICv3: Sysreg emulation is applicable for AArch64 only
    
    Sysreg emulation is 64-bit specific, so guard the calls to
    vgic_v3_emulate_sysreg() as well as the function itself with
    "#ifdef CONFIG_ARM_64".
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/vgic-v3.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 76b69a7a50..1b0118673c 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -1510,6 +1510,7 @@ static bool vgic_v3_emulate_sgi1r(struct cpu_user_regs *regs, uint64_t *r,
     }
 }
 
+#ifdef CONFIG_ARM_64
 static bool vgic_v3_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr)
 {
     struct hsr_sysreg sysreg = hsr.sysreg;
@@ -1530,6 +1531,7 @@ static bool vgic_v3_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr)
         return false;
     }
 }
+#endif
 
 static bool vgic_v3_emulate_cp64(struct cpu_user_regs *regs, union hsr hsr)
 {
@@ -1553,8 +1555,10 @@ static bool vgic_v3_emulate_reg(struct cpu_user_regs *regs, union hsr hsr)
 {
     switch (hsr.ec)
     {
+#ifdef CONFIG_ARM_64
     case HSR_EC_SYSREG:
         return vgic_v3_emulate_sysreg(regs, hsr);
+#endif
     case HSR_EC_CP15_64:
         return vgic_v3_emulate_cp64(regs, hsr);
     default:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:48:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:48:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465480.724235 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gux-0004qM-QV; Sat, 17 Dec 2022 23:48:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465480.724235; Sat, 17 Dec 2022 23:48:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gux-0004qE-NM; Sat, 17 Dec 2022 23:48:35 +0000
Received: by outflank-mailman (input) for mailman id 465480;
 Sat, 17 Dec 2022 23:48:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gux-0004ph-5g
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gux-0004Zo-4y
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gux-0001aN-4M
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rSRCZZFytYpTrTj9YhHcwBPLOmKdj+94IZXo68YJgFs=; b=c8zMyVGgnYRzIEoPHF3bcjTsgx
	nL1OBn57MHsv5zgPB51BfHA6VfB2kDIEqxHcahESH16PgRiwNgwXlrKyEIi1hCD5KRr7LTOULcKL4
	fCuswBmDyAodsWqFdxgnd+6euCFvEdwCZ84bhcrtLIEHeI/5Ibykgjr0pIKjM+ftPJQ8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Arm: GICv3: Do not calculate affinity level 3 for AArch32
Message-Id: <E1p6gux-0001aN-4M@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:48:35 +0000

commit 60baf1c14b66d74d05fdc80df27c596b08775571
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Dec 5 13:26:28 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:27:06 2022 +0000

    xen/Arm: GICv3: Do not calculate affinity level 3 for AArch32
    
    Refer ARM DDI 0487I.a ID081822, G8-9817, G8.2.169
    Affinity level 3 is not present in AArch32.
    Also, refer ARM DDI 0406C.d ID040418, B4-1644, B4.1.106,
    Affinity level 3 is not present in Armv7 (ie arm32).
    Thus, any access to affinity level 3 needs to be guarded within
    "ifdef CONFIG_ARM_64".
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic-v3.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 37eb7ff95e..532ae47c59 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -518,7 +518,10 @@ static void gicv3_set_pending_state(struct irq_desc *irqd, bool pending)
 static inline uint64_t gicv3_mpidr_to_affinity(int cpu)
 {
      uint64_t mpidr = cpu_logical_map(cpu);
-     return (MPIDR_AFFINITY_LEVEL(mpidr, 3) << 32 |
+     return (
+#ifdef CONFIG_ARM_64
+             MPIDR_AFFINITY_LEVEL(mpidr, 3) << 32 |
+#endif
              MPIDR_AFFINITY_LEVEL(mpidr, 2) << 16 |
              MPIDR_AFFINITY_LEVEL(mpidr, 1) << 8  |
              MPIDR_AFFINITY_LEVEL(mpidr, 0));
@@ -711,7 +714,10 @@ static int __init gicv3_populate_rdist(void)
      * Convert affinity to a 32bit value that can be matched to GICR_TYPER
      * bits [63:32]
      */
-    aff = (MPIDR_AFFINITY_LEVEL(mpidr, 3) << 24 |
+    aff = (
+#ifdef CONFIG_ARM_64
+           MPIDR_AFFINITY_LEVEL(mpidr, 3) << 24 |
+#endif
            MPIDR_AFFINITY_LEVEL(mpidr, 2) << 16 |
            MPIDR_AFFINITY_LEVEL(mpidr, 1) << 8 |
            MPIDR_AFFINITY_LEVEL(mpidr, 0));
@@ -963,7 +969,10 @@ static void gicv3_send_sgi_list(enum gic_sgi sgi, const cpumask_t *cpumask)
          * Prepare affinity path of the cluster for which SGI is generated
          * along with SGI number
          */
-        val = (MPIDR_AFFINITY_LEVEL(cluster_id, 3) << 48  |
+        val = (
+#ifdef CONFIG_ARM_64
+               MPIDR_AFFINITY_LEVEL(cluster_id, 3) << 48  |
+#endif
                MPIDR_AFFINITY_LEVEL(cluster_id, 2) << 32  |
                sgi << 24                                  |
                MPIDR_AFFINITY_LEVEL(cluster_id, 1) << 16  |
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:48:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:48:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465481.724239 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gv8-0004zB-S0; Sat, 17 Dec 2022 23:48:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465481.724239; Sat, 17 Dec 2022 23:48: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 1p6gv8-0004z3-Oq; Sat, 17 Dec 2022 23:48:46 +0000
Received: by outflank-mailman (input) for mailman id 465481;
 Sat, 17 Dec 2022 23:48:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gv7-0004w2-8p
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gv7-0004aH-7j
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gv7-0001at-77
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yYJgkbTHETuXYgvnWF/VmYvOwHbnKWJp+mbK+IHUZl8=; b=vc5zeTkhQZ7JtPoUIJxxh/fxhx
	hNQHXFMIp5aQJUt5VJTV76RxTyjxwv21+L8DCgwkXC8jURSRqxACml/yyp6Jop0+QNU8JBE0gUkHK
	N/RbjY7i+754prinXGm/0/6tFhlP7CHSha3HV/P4F6YQe/XLJU2qyLXpvAnz4MtjDWjk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Arm: vreg: Support vreg_reg64_* helpers on AArch32
Message-Id: <E1p6gv7-0001at-77@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:48:45 +0000

commit cc0c93b4ebd9ab6979c77c983ca679ca08087448
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Dec 5 13:26:29 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:27:06 2022 +0000

    xen/Arm: vreg: Support vreg_reg64_* helpers on AArch32
    
    In some situations (e.g. GICR_TYPER), the hypervior may need to emulate
    64bit registers in AArch32 mode. In such situations, the hypervisor may
    need to read/modify the lower or upper 32 bits of the 64 bit register.
    
    In AArch32, 'unsigned long' is 32 bits. Thus, we cannot use it for 64 bit
    registers.
    
    While we could replace 'unsigned long' by 'uint64_t', it is not entirely clear
    whether a 32-bit compiler would not allocate register for the upper 32-bit.
    Therefore fold vreg_reg_* helper in the size specific one and use the
    appropriate type based on the size requested.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/include/asm/vreg.h | 86 +++++++++--------------------------------
 1 file changed, 19 insertions(+), 67 deletions(-)

diff --git a/xen/arch/arm/include/asm/vreg.h b/xen/arch/arm/include/asm/vreg.h
index f26a70d024..d92450017b 100644
--- a/xen/arch/arm/include/asm/vreg.h
+++ b/xen/arch/arm/include/asm/vreg.h
@@ -89,106 +89,58 @@ static inline bool vreg_emulate_sysreg(struct cpu_user_regs *regs, union hsr hsr
  * The check on the size supported by the register has to be done by
  * the caller of vreg_regN_*.
  *
- * vreg_reg_* should never be called directly. Instead use the vreg_regN_*
- * according to size of the emulated register
- *
  * Note that the alignment fault will always be taken in the guest
  * (see B3.12.7 DDI0406.b).
  */
-static inline register_t vreg_reg_extract(unsigned long reg,
-                                          unsigned int offset,
-                                          enum dabt_size size)
-{
-    reg >>= 8 * offset;
-    reg &= VREG_REG_MASK(size);
-
-    return reg;
-}
-
-static inline void vreg_reg_update(unsigned long *reg, register_t val,
-                                   unsigned int offset,
-                                   enum dabt_size size)
-{
-    unsigned long mask = VREG_REG_MASK(size);
-    int shift = offset * 8;
-
-    *reg &= ~(mask << shift);
-    *reg |= ((unsigned long)val & mask) << shift;
-}
-
-static inline void vreg_reg_setbits(unsigned long *reg, register_t bits,
-                                    unsigned int offset,
-                                    enum dabt_size size)
-{
-    unsigned long mask = VREG_REG_MASK(size);
-    int shift = offset * 8;
-
-    *reg |= ((unsigned long)bits & mask) << shift;
-}
-
-static inline void vreg_reg_clearbits(unsigned long *reg, register_t bits,
-                                      unsigned int offset,
-                                      enum dabt_size size)
-{
-    unsigned long mask = VREG_REG_MASK(size);
-    int shift = offset * 8;
-
-    *reg &= ~(((unsigned long)bits & mask) << shift);
-}
 
 /* N-bit register helpers */
 #define VREG_REG_HELPERS(sz, offmask)                                   \
 static inline register_t vreg_reg##sz##_extract(uint##sz##_t reg,       \
                                                 const mmio_info_t *info)\
 {                                                                       \
-    return vreg_reg_extract(reg, info->gpa & (offmask),                 \
-                            info->dabt.size);                           \
+    unsigned int offset = info->gpa & (offmask);                        \
+                                                                        \
+    reg >>= 8 * offset;                                                 \
+    reg &= VREG_REG_MASK(info->dabt.size);                              \
+                                                                        \
+    return reg;                                                         \
 }                                                                       \
                                                                         \
 static inline void vreg_reg##sz##_update(uint##sz##_t *reg,             \
                                          register_t val,                \
                                          const mmio_info_t *info)       \
 {                                                                       \
-    unsigned long tmp = *reg;                                           \
+    unsigned int offset = info->gpa & (offmask);                        \
+    uint##sz##_t mask = VREG_REG_MASK(info->dabt.size);                 \
+    unsigned int shift = offset * 8;                                    \
                                                                         \
-    vreg_reg_update(&tmp, val, info->gpa & (offmask),                   \
-                    info->dabt.size);                                   \
-                                                                        \
-    *reg = tmp;                                                         \
+    *reg &= ~(mask << shift);                                           \
+    *reg |= ((uint##sz##_t)val & mask) << shift;                        \
 }                                                                       \
                                                                         \
 static inline void vreg_reg##sz##_setbits(uint##sz##_t *reg,            \
                                           register_t bits,              \
                                           const mmio_info_t *info)      \
 {                                                                       \
-    unsigned long tmp = *reg;                                           \
-                                                                        \
-    vreg_reg_setbits(&tmp, bits, info->gpa & (offmask),                 \
-                     info->dabt.size);                                  \
+    unsigned int offset = info->gpa & (offmask);                        \
+    uint##sz##_t mask = VREG_REG_MASK(info->dabt.size);                 \
+    unsigned int shift = offset * 8;                                    \
                                                                         \
-    *reg = tmp;                                                         \
+    *reg |= ((uint##sz##_t)bits & mask) << shift;                       \
 }                                                                       \
                                                                         \
 static inline void vreg_reg##sz##_clearbits(uint##sz##_t *reg,          \
                                             register_t bits,            \
                                             const mmio_info_t *info)    \
 {                                                                       \
-    unsigned long tmp = *reg;                                           \
-                                                                        \
-    vreg_reg_clearbits(&tmp, bits, info->gpa & (offmask),               \
-                       info->dabt.size);                                \
+    unsigned int offset = info->gpa & (offmask);                        \
+    uint##sz##_t mask = VREG_REG_MASK(info->dabt.size);                 \
+    unsigned int shift = offset * 8;                                    \
                                                                         \
-    *reg = tmp;                                                         \
+    *reg &= ~(((uint##sz##_t)bits & mask) << shift);                    \
 }
 
-/*
- * 64 bits registers are only supported on platform with 64-bit long.
- * This is also allow us to optimize the 32 bit case by using
- * unsigned long rather than uint64_t
- */
-#if BITS_PER_LONG == 64
 VREG_REG_HELPERS(64, 0x7);
-#endif
 VREG_REG_HELPERS(32, 0x3);
 
 #undef VREG_REG_HELPERS
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:48:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:48:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465488.724243 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gvI-00059I-Uu; Sat, 17 Dec 2022 23:48:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465488.724243; Sat, 17 Dec 2022 23:48: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 1p6gvI-00059B-SF; Sat, 17 Dec 2022 23:48:56 +0000
Received: by outflank-mailman (input) for mailman id 465488;
 Sat, 17 Dec 2022 23:48:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvH-00058t-BA
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvH-0004aN-AW
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvH-0001bi-9s
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:48: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QNLZBW8cEb2dIQ/wlJGfnTYugCYzSVG7PBadPC7fcU0=; b=vgTaqoWm0MlLRSTUlFsttIU3b6
	k+VfGfl2ZfzngYilZVP1cesNfDm7FHueMT5dcfh67z+2ZJozGr7yRs//LnvAHHxf/Zrv94Af/+lfN
	WQHC/+S7rXx0B279K+VnBiRf58X/xmuh/OMRTz1a7uLu5ZoNcb8SxuQP2guKQBmZwakc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Arm: vGICv3: Adapt emulation of GICR_TYPER for AArch32
Message-Id: <E1p6gvH-0001bi-9s@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:48:55 +0000

commit a4c99f4cf5670a764120ede874d7d4c5e9848c10
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Dec 5 13:26:30 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:27:06 2022 +0000

    xen/Arm: vGICv3: Adapt emulation of GICR_TYPER for AArch32
    
    Refer ARM DDI 0487I.a ID081822, G8-9650, G8.2.113
    Aff3 does not exist on AArch32.
    Also, refer ARM DDI 0406C.d ID040418, B4-1644, B4.1.106
    Aff3 does not exist on Armv7 (ie arm32).
    
    Thus, access to aff3 has been protected with "#ifdef CONFIG_ARM_64".
    Also, v->arch.vmpidr is a 32 bit register on AArch32. So, we have assigned it to
    'uint64_t vmpidr' to perform the shifts.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/vgic-v3.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 1b0118673c..55ae4a7c5c 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -182,12 +182,20 @@ static int __vgic_v3_rdistr_rd_mmio_read(struct vcpu *v, mmio_info_t *info,
     case VREG64(GICR_TYPER):
     {
         uint64_t typer, aff;
+        /*
+         * This is to enable shifts greater than 32 bits which would have
+         * otherwise caused overflow (as v->arch.vmpidr is 32 bit on AArch32).
+         */
+        uint64_t vmpidr = v->arch.vmpidr;
 
         if ( !vgic_reg64_check_access(dabt) ) goto bad_width;
-        aff = (MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 3) << 56 |
-               MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 2) << 48 |
-               MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 1) << 40 |
-               MPIDR_AFFINITY_LEVEL(v->arch.vmpidr, 0) << 32);
+        aff = (
+#ifdef CONFIG_ARM_64
+               MPIDR_AFFINITY_LEVEL(vmpidr, 3) << 56 |
+#endif
+               MPIDR_AFFINITY_LEVEL(vmpidr, 2) << 48 |
+               MPIDR_AFFINITY_LEVEL(vmpidr, 1) << 40 |
+               MPIDR_AFFINITY_LEVEL(vmpidr, 0) << 32);
         typer = aff;
         /* We use the VCPU ID as the redistributor ID in bits[23:8] */
         typer |= v->vcpu_id << GICR_TYPER_PROC_NUM_SHIFT;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:49:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:49:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465489.724247 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gvT-0005Cm-0L; Sat, 17 Dec 2022 23:49:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465489.724247; Sat, 17 Dec 2022 23:49: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 1p6gvS-0005Ce-U0; Sat, 17 Dec 2022 23:49:06 +0000
Received: by outflank-mailman (input) for mailman id 465489;
 Sat, 17 Dec 2022 23:49:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvR-0005CE-Gj
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvR-0004an-DP
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvR-0001cI-Ci
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=neNhFOfNoQ5ss802tkA7X9OjDptJ3j48ayGX7iZRX44=; b=NS6cz7pZcjNTcQh+gJ38Q2Vbju
	R/i+0kZ0egJ4ZKOHndL+rwIghDPvk9lTKAYAbcL/V5ydieE80viPZDpjfMj5YhAhfKwxRqlEoXgWd
	KaMXS5pxI10MGDmPlH5+aauX2qcsb0WILGzP0HaA692WD26VGEOOu/q7wZeoEu7A9f18=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Arm: GICv3: Fix GICR_{PENDBASER, PROPBASER} emulation on 32-bit host
Message-Id: <E1p6gvR-0001cI-Ci@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:49:05 +0000

commit 3f92d294b66f6eaf4c2c69d6544859be610f8a68
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Dec 5 13:26:31 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:27:06 2022 +0000

    xen/Arm: GICv3: Fix GICR_{PENDBASER, PROPBASER} emulation on 32-bit host
    
    'unsigned long long' is defined as 64 bit across both AArch32 and AArch64.
    So, use 'ULL' for 64 bit word instead of UL which is 32 bits for AArch32.
    GICR_PENDBASER and GICR_PROPBASER both are 64 bit registers.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/gic_v3_defs.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/include/asm/gic_v3_defs.h b/xen/arch/arm/include/asm/gic_v3_defs.h
index 728e28d5e5..48a1bc401e 100644
--- a/xen/arch/arm/include/asm/gic_v3_defs.h
+++ b/xen/arch/arm/include/asm/gic_v3_defs.h
@@ -134,15 +134,15 @@
 
 #define GICR_PROPBASER_OUTER_CACHEABILITY_SHIFT         56
 #define GICR_PROPBASER_OUTER_CACHEABILITY_MASK               \
-        (7UL << GICR_PROPBASER_OUTER_CACHEABILITY_SHIFT)
+        (7ULL << GICR_PROPBASER_OUTER_CACHEABILITY_SHIFT)
 #define GICR_PROPBASER_SHAREABILITY_SHIFT               10
 #define GICR_PROPBASER_SHAREABILITY_MASK                     \
-        (3UL << GICR_PROPBASER_SHAREABILITY_SHIFT)
+        (3ULL << GICR_PROPBASER_SHAREABILITY_SHIFT)
 #define GICR_PROPBASER_INNER_CACHEABILITY_SHIFT         7
 #define GICR_PROPBASER_INNER_CACHEABILITY_MASK               \
-        (7UL << GICR_PROPBASER_INNER_CACHEABILITY_SHIFT)
+        (7ULL << GICR_PROPBASER_INNER_CACHEABILITY_SHIFT)
 #define GICR_PROPBASER_RES0_MASK                             \
-        (GENMASK(63, 59) | GENMASK(55, 52) | GENMASK(6, 5))
+        (GENMASK_ULL(63, 59) | GENMASK_ULL(55, 52) | GENMASK_ULL(6, 5))
 
 #define GICR_PENDBASER_SHAREABILITY_SHIFT               10
 #define GICR_PENDBASER_INNER_CACHEABILITY_SHIFT         7
@@ -152,11 +152,11 @@
 #define GICR_PENDBASER_INNER_CACHEABILITY_MASK               \
 	(7UL << GICR_PENDBASER_INNER_CACHEABILITY_SHIFT)
 #define GICR_PENDBASER_OUTER_CACHEABILITY_MASK               \
-        (7UL << GICR_PENDBASER_OUTER_CACHEABILITY_SHIFT)
-#define GICR_PENDBASER_PTZ                              BIT(62, UL)
+        (7ULL << GICR_PENDBASER_OUTER_CACHEABILITY_SHIFT)
+#define GICR_PENDBASER_PTZ                              BIT(62, ULL)
 #define GICR_PENDBASER_RES0_MASK                             \
-        (BIT(63, UL) | GENMASK(61, 59) | GENMASK(55, 52) |  \
-         GENMASK(15, 12) | GENMASK(6, 0))
+        (BIT(63, ULL) | GENMASK_ULL(61, 59) | GENMASK_ULL(55, 52) |  \
+         GENMASK_ULL(15, 12) | GENMASK_ULL(6, 0))
 
 #define DEFAULT_PMR_VALUE            0xff
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:49:17 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:49:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465491.724251 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gvd-0005HC-1l; Sat, 17 Dec 2022 23:49:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465491.724251; Sat, 17 Dec 2022 23:49: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 1p6gvc-0005H5-Va; Sat, 17 Dec 2022 23:49:16 +0000
Received: by outflank-mailman (input) for mailman id 465491;
 Sat, 17 Dec 2022 23:49:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvb-0005Gq-H4
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvb-0004b0-GQ
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvb-0001cj-Ff
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9klNFBT1z8XpjPjsdmvdePL71CJNevdfJ3lM3XRr+YU=; b=MXfxNUbf+8iiNPa7iUcPv+VIOJ
	E4hEuKA3ewywPm8kP2vEEGzo/0SDyjSRw9MclrdFfF3Sk5iF94vpy8/kjnIJmWtrqvtCjH03Q1szF
	WhaeY6gUDTm5nA0Eb9UL8yRksf22h0gorfRVDfh/rNMWpaPJ1PMhJugQgziD+kzN2tFM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Arm: vGICv3: Fix emulation of ICC_SGI1R on AArch32
Message-Id: <E1p6gvb-0001cj-Ff@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:49:15 +0000

commit 469100f014384b133211562a7d3be5f523d1fab8
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Dec 5 13:26:32 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:27:06 2022 +0000

    xen/Arm: vGICv3: Fix emulation of ICC_SGI1R on AArch32
    
    Refer Arm IHI 0069H ID020922, 12.5.23, ICC_SGI1R is a 64 bit register on
    AArch32 systems. Thus, the function needs to change to reflect this.
    The reason being 'register_t' is defined as 'u32' on AArch32.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/vgic-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 55ae4a7c5c..9c1fdcc3f8 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -1474,7 +1474,7 @@ write_reserved:
     return 1;
 }
 
-static bool vgic_v3_to_sgi(struct vcpu *v, register_t sgir)
+static bool vgic_v3_to_sgi(struct vcpu *v, uint64_t sgir)
 {
     int virq;
     int irqmode;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:49:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:49:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465493.724255 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gvn-0005KR-42; Sat, 17 Dec 2022 23:49:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465493.724255; Sat, 17 Dec 2022 23:49: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 1p6gvn-0005KJ-0t; Sat, 17 Dec 2022 23:49:27 +0000
Received: by outflank-mailman (input) for mailman id 465493;
 Sat, 17 Dec 2022 23:49:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvl-0005K7-K5
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvl-0004b8-JP
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvl-0001dG-If
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=V1bBn+5dCI32h1Ag1yZoo+uN02liyHdxlzpGx6rehrw=; b=YJbbXec3RgH3H9bXK6+HWF2Qcm
	5mQnlY67DLgkqOUE90jbKNR/LUTa5MdGny2EUXAu/MCu8KsNXidlMUX/cdBYO//pAXIBPJLVQKPIL
	69x360IxJ8JyMyHku6u4yKx6fjxEl2YjyOnEQx9su/WTZoX7t6z+SizcLd1uLO/epJ4o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Arm: GICv3: Define ICH_LR<n>_EL2 on AArch32
Message-Id: <E1p6gvl-0001dG-If@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:49:25 +0000

commit 1419b7a6552f71326947d667e0773cb6fe578596
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Dec 5 13:26:33 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:27:06 2022 +0000

    xen/Arm: GICv3: Define ICH_LR<n>_EL2 on AArch32
    
    Refer "Arm IHI 0069H ID020922", 12.4.6, Interrupt Controller List Registers
    
    AArch64 System register ICH_LR<n>_EL2 bits [31:0] are architecturally
    mapped to AArch32 System register ICH_LR<n>[31:0].
    AArch64 System register ICH_LR<n>_EL2 bits [63:32] are architecturally
    mapped to AArch32 System register ICH_LRC<n>[31:0].
    
    Defined ICH_LR<0...15>_EL2 and ICH_LRC<0...15>_EL2 for AArch32.
    For AArch32, the link register is stored as :-
    (((uint64_t) ICH_LRC<0...15>_EL2) << 32) | ICH_LR<0...15>_EL2
    
    Also, ICR_LR macros need to be modified as ULL is 64 bits for AArch32 and
    AArch64.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic-v3.c                    | 132 +++++++++++++++----------------
 xen/arch/arm/include/asm/arm32/sysregs.h |  19 +++++
 xen/arch/arm/include/asm/arm64/sysregs.h |   5 ++
 xen/arch/arm/include/asm/cpregs.h        |  74 +++++++++++++++++
 xen/arch/arm/include/asm/gic_v3_defs.h   |   8 +-
 5 files changed, 168 insertions(+), 70 deletions(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 532ae47c59..adcd40f1a0 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -64,37 +64,37 @@ static inline void gicv3_save_lrs(struct vcpu *v)
     switch ( gicv3_info.nr_lrs )
     {
     case 16:
-        v->arch.gic.v3.lr[15] = READ_SYSREG(ICH_LR15_EL2);
+        v->arch.gic.v3.lr[15] = READ_SYSREG_LR(15);
     case 15:
-        v->arch.gic.v3.lr[14] = READ_SYSREG(ICH_LR14_EL2);
+        v->arch.gic.v3.lr[14] = READ_SYSREG_LR(14);
     case 14:
-        v->arch.gic.v3.lr[13] = READ_SYSREG(ICH_LR13_EL2);
+        v->arch.gic.v3.lr[13] = READ_SYSREG_LR(13);
     case 13:
-        v->arch.gic.v3.lr[12] = READ_SYSREG(ICH_LR12_EL2);
+        v->arch.gic.v3.lr[12] = READ_SYSREG_LR(12);
     case 12:
-        v->arch.gic.v3.lr[11] = READ_SYSREG(ICH_LR11_EL2);
+        v->arch.gic.v3.lr[11] = READ_SYSREG_LR(11);
     case 11:
-        v->arch.gic.v3.lr[10] = READ_SYSREG(ICH_LR10_EL2);
+        v->arch.gic.v3.lr[10] = READ_SYSREG_LR(10);
     case 10:
-        v->arch.gic.v3.lr[9] = READ_SYSREG(ICH_LR9_EL2);
+        v->arch.gic.v3.lr[9] = READ_SYSREG_LR(9);
     case 9:
-        v->arch.gic.v3.lr[8] = READ_SYSREG(ICH_LR8_EL2);
+        v->arch.gic.v3.lr[8] = READ_SYSREG_LR(8);
     case 8:
-        v->arch.gic.v3.lr[7] = READ_SYSREG(ICH_LR7_EL2);
+        v->arch.gic.v3.lr[7] = READ_SYSREG_LR(7);
     case 7:
-        v->arch.gic.v3.lr[6] = READ_SYSREG(ICH_LR6_EL2);
+        v->arch.gic.v3.lr[6] = READ_SYSREG_LR(6);
     case 6:
-        v->arch.gic.v3.lr[5] = READ_SYSREG(ICH_LR5_EL2);
+        v->arch.gic.v3.lr[5] = READ_SYSREG_LR(5);
     case 5:
-        v->arch.gic.v3.lr[4] = READ_SYSREG(ICH_LR4_EL2);
+        v->arch.gic.v3.lr[4] = READ_SYSREG_LR(4);
     case 4:
-        v->arch.gic.v3.lr[3] = READ_SYSREG(ICH_LR3_EL2);
+        v->arch.gic.v3.lr[3] = READ_SYSREG_LR(3);
     case 3:
-        v->arch.gic.v3.lr[2] = READ_SYSREG(ICH_LR2_EL2);
+        v->arch.gic.v3.lr[2] = READ_SYSREG_LR(2);
     case 2:
-        v->arch.gic.v3.lr[1] = READ_SYSREG(ICH_LR1_EL2);
+        v->arch.gic.v3.lr[1] = READ_SYSREG_LR(1);
     case 1:
-         v->arch.gic.v3.lr[0] = READ_SYSREG(ICH_LR0_EL2);
+         v->arch.gic.v3.lr[0] = READ_SYSREG_LR(0);
          break;
     default:
          BUG();
@@ -111,37 +111,37 @@ static inline void gicv3_restore_lrs(const struct vcpu *v)
     switch ( gicv3_info.nr_lrs )
     {
     case 16:
-        WRITE_SYSREG(v->arch.gic.v3.lr[15], ICH_LR15_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[15], 15);
     case 15:
-        WRITE_SYSREG(v->arch.gic.v3.lr[14], ICH_LR14_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[14], 14);
     case 14:
-        WRITE_SYSREG(v->arch.gic.v3.lr[13], ICH_LR13_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[13], 13);
     case 13:
-        WRITE_SYSREG(v->arch.gic.v3.lr[12], ICH_LR12_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[12], 12);
     case 12:
-        WRITE_SYSREG(v->arch.gic.v3.lr[11], ICH_LR11_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[11], 11);
     case 11:
-        WRITE_SYSREG(v->arch.gic.v3.lr[10], ICH_LR10_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[10], 10);
     case 10:
-        WRITE_SYSREG(v->arch.gic.v3.lr[9], ICH_LR9_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[9], 9);
     case 9:
-        WRITE_SYSREG(v->arch.gic.v3.lr[8], ICH_LR8_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[8], 8);
     case 8:
-        WRITE_SYSREG(v->arch.gic.v3.lr[7], ICH_LR7_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[7], 7);
     case 7:
-        WRITE_SYSREG(v->arch.gic.v3.lr[6], ICH_LR6_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[6], 6);
     case 6:
-        WRITE_SYSREG(v->arch.gic.v3.lr[5], ICH_LR5_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[5], 5);
     case 5:
-        WRITE_SYSREG(v->arch.gic.v3.lr[4], ICH_LR4_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[4], 4);
     case 4:
-        WRITE_SYSREG(v->arch.gic.v3.lr[3], ICH_LR3_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[3], 3);
     case 3:
-        WRITE_SYSREG(v->arch.gic.v3.lr[2], ICH_LR2_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[2], 2);
     case 2:
-        WRITE_SYSREG(v->arch.gic.v3.lr[1], ICH_LR1_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[1], 1);
     case 1:
-        WRITE_SYSREG(v->arch.gic.v3.lr[0], ICH_LR0_EL2);
+        WRITE_SYSREG_LR(v->arch.gic.v3.lr[0], 0);
         break;
     default:
          BUG();
@@ -152,22 +152,22 @@ static uint64_t gicv3_ich_read_lr(int lr)
 {
     switch ( lr )
     {
-    case 0: return READ_SYSREG(ICH_LR0_EL2);
-    case 1: return READ_SYSREG(ICH_LR1_EL2);
-    case 2: return READ_SYSREG(ICH_LR2_EL2);
-    case 3: return READ_SYSREG(ICH_LR3_EL2);
-    case 4: return READ_SYSREG(ICH_LR4_EL2);
-    case 5: return READ_SYSREG(ICH_LR5_EL2);
-    case 6: return READ_SYSREG(ICH_LR6_EL2);
-    case 7: return READ_SYSREG(ICH_LR7_EL2);
-    case 8: return READ_SYSREG(ICH_LR8_EL2);
-    case 9: return READ_SYSREG(ICH_LR9_EL2);
-    case 10: return READ_SYSREG(ICH_LR10_EL2);
-    case 11: return READ_SYSREG(ICH_LR11_EL2);
-    case 12: return READ_SYSREG(ICH_LR12_EL2);
-    case 13: return READ_SYSREG(ICH_LR13_EL2);
-    case 14: return READ_SYSREG(ICH_LR14_EL2);
-    case 15: return READ_SYSREG(ICH_LR15_EL2);
+    case 0: return READ_SYSREG_LR(0);
+    case 1: return READ_SYSREG_LR(1);
+    case 2: return READ_SYSREG_LR(2);
+    case 3: return READ_SYSREG_LR(3);
+    case 4: return READ_SYSREG_LR(4);
+    case 5: return READ_SYSREG_LR(5);
+    case 6: return READ_SYSREG_LR(6);
+    case 7: return READ_SYSREG_LR(7);
+    case 8: return READ_SYSREG_LR(8);
+    case 9: return READ_SYSREG_LR(9);
+    case 10: return READ_SYSREG_LR(10);
+    case 11: return READ_SYSREG_LR(11);
+    case 12: return READ_SYSREG_LR(12);
+    case 13: return READ_SYSREG_LR(13);
+    case 14: return READ_SYSREG_LR(14);
+    case 15: return READ_SYSREG_LR(15);
     default:
         BUG();
     }
@@ -178,52 +178,52 @@ static void gicv3_ich_write_lr(int lr, uint64_t val)
     switch ( lr )
     {
     case 0:
-        WRITE_SYSREG(val, ICH_LR0_EL2);
+        WRITE_SYSREG_LR(val, 0);
         break;
     case 1:
-        WRITE_SYSREG(val, ICH_LR1_EL2);
+        WRITE_SYSREG_LR(val, 1);
         break;
     case 2:
-        WRITE_SYSREG(val, ICH_LR2_EL2);
+        WRITE_SYSREG_LR(val, 2);
         break;
     case 3:
-        WRITE_SYSREG(val, ICH_LR3_EL2);
+        WRITE_SYSREG_LR(val, 3);
         break;
     case 4:
-        WRITE_SYSREG(val, ICH_LR4_EL2);
+        WRITE_SYSREG_LR(val, 4);
         break;
     case 5:
-        WRITE_SYSREG(val, ICH_LR5_EL2);
+        WRITE_SYSREG_LR(val, 5);
         break;
     case 6:
-        WRITE_SYSREG(val, ICH_LR6_EL2);
+        WRITE_SYSREG_LR(val, 6);
         break;
     case 7:
-        WRITE_SYSREG(val, ICH_LR7_EL2);
+        WRITE_SYSREG_LR(val, 7);
         break;
     case 8:
-        WRITE_SYSREG(val, ICH_LR8_EL2);
+        WRITE_SYSREG_LR(val, 8);
         break;
     case 9:
-        WRITE_SYSREG(val, ICH_LR9_EL2);
+        WRITE_SYSREG_LR(val, 9);
         break;
     case 10:
-        WRITE_SYSREG(val, ICH_LR10_EL2);
+        WRITE_SYSREG_LR(val, 10);
         break;
     case 11:
-        WRITE_SYSREG(val, ICH_LR11_EL2);
+        WRITE_SYSREG_LR(val, 11);
         break;
     case 12:
-        WRITE_SYSREG(val, ICH_LR12_EL2);
+        WRITE_SYSREG_LR(val, 12);
         break;
     case 13:
-        WRITE_SYSREG(val, ICH_LR13_EL2);
+        WRITE_SYSREG_LR(val, 13);
         break;
     case 14:
-        WRITE_SYSREG(val, ICH_LR14_EL2);
+        WRITE_SYSREG_LR(val, 14);
         break;
     case 15:
-        WRITE_SYSREG(val, ICH_LR15_EL2);
+        WRITE_SYSREG_LR(val, 15);
         break;
     default:
         return;
@@ -408,12 +408,12 @@ static void gicv3_dump_state(const struct vcpu *v)
     if ( v == current )
     {
         for ( i = 0; i < gicv3_info.nr_lrs; i++ )
-            printk("   HW_LR[%d]=%lx\n", i, gicv3_ich_read_lr(i));
+            printk("   HW_LR[%d]=%" PRIx64 "\n", i, gicv3_ich_read_lr(i));
     }
     else
     {
         for ( i = 0; i < gicv3_info.nr_lrs; i++ )
-            printk("   VCPU_LR[%d]=%lx\n", i, v->arch.gic.v3.lr[i]);
+            printk("   VCPU_LR[%d]=%" PRIx64 "\n", i, v->arch.gic.v3.lr[i]);
     }
 }
 
diff --git a/xen/arch/arm/include/asm/arm32/sysregs.h b/xen/arch/arm/include/asm/arm32/sysregs.h
index 6841d5de43..22871999af 100644
--- a/xen/arch/arm/include/asm/arm32/sysregs.h
+++ b/xen/arch/arm/include/asm/arm32/sysregs.h
@@ -62,6 +62,25 @@
 #define READ_SYSREG(R...)       READ_SYSREG32(R)
 #define WRITE_SYSREG(V, R...)   WRITE_SYSREG32(V, R)
 
+/* Wrappers for accessing interrupt controller list registers. */
+#define ICH_LR_REG(index)       ICH_LR ## index ## _EL2
+#define ICH_LRC_REG(index)      ICH_LRC ## index ## _EL2
+
+#define READ_SYSREG_LR(index) ({                            \
+    uint64_t _val;                                          \
+    uint32_t _lrc = READ_CP32(ICH_LRC_REG(index));          \
+    uint32_t _lr = READ_CP32(ICH_LR_REG(index));            \
+                                                            \
+    _val = ((uint64_t) _lrc << 32) | _lr;                   \
+    _val;                                                   \
+})
+
+#define WRITE_SYSREG_LR(v, index) ({                        \
+    uint64_t _val = (v);                                    \
+    WRITE_CP32(_val & GENMASK(31, 0), ICH_LR_REG(index));   \
+    WRITE_CP32(_val >> 32, ICH_LRC_REG(index));             \
+})
+
 /* MVFR2 is not defined on ARMv7 */
 #define MVFR2_MAYBE_UNDEFINED
 
diff --git a/xen/arch/arm/include/asm/arm64/sysregs.h b/xen/arch/arm/include/asm/arm64/sysregs.h
index 54670084c3..4638999514 100644
--- a/xen/arch/arm/include/asm/arm64/sysregs.h
+++ b/xen/arch/arm/include/asm/arm64/sysregs.h
@@ -472,6 +472,11 @@
 #define READ_SYSREG(name)     READ_SYSREG64(name)
 #define WRITE_SYSREG(v, name) WRITE_SYSREG64(v, name)
 
+/* Wrappers for accessing interrupt controller list registers. */
+#define ICH_LR_REG(index)          ICH_LR ## index ## _EL2
+#define WRITE_SYSREG_LR(v, index)  WRITE_SYSREG(v, ICH_LR_REG(index))
+#define READ_SYSREG_LR(index)      READ_SYSREG(ICH_LR_REG(index))
+
 #endif /* _ASM_ARM_ARM64_SYSREGS_H */
 
 /*
diff --git a/xen/arch/arm/include/asm/cpregs.h b/xen/arch/arm/include/asm/cpregs.h
index 6daf2b1a30..7550fb25f5 100644
--- a/xen/arch/arm/include/asm/cpregs.h
+++ b/xen/arch/arm/include/asm/cpregs.h
@@ -259,6 +259,48 @@
 #define VBAR            p15,0,c12,c0,0  /* Vector Base Address Register */
 #define HVBAR           p15,4,c12,c0,0  /* Hyp. Vector Base Address Register */
 
+/* CP15 CR12: Interrupt Controller List Registers, n = 0 - 15 */
+#define __LR0(x)        p15, 4, c12, c12, x
+#define __LR8(x)        p15, 4, c12, c13, x
+
+#define ICH_LR0         __LR0(0)
+#define ICH_LR1         __LR0(1)
+#define ICH_LR2         __LR0(2)
+#define ICH_LR3         __LR0(3)
+#define ICH_LR4         __LR0(4)
+#define ICH_LR5         __LR0(5)
+#define ICH_LR6         __LR0(6)
+#define ICH_LR7         __LR0(7)
+#define ICH_LR8         __LR8(0)
+#define ICH_LR9         __LR8(1)
+#define ICH_LR10        __LR8(2)
+#define ICH_LR11        __LR8(3)
+#define ICH_LR12        __LR8(4)
+#define ICH_LR13        __LR8(5)
+#define ICH_LR14        __LR8(6)
+#define ICH_LR15        __LR8(7)
+
+/* CP15 CR12: Interrupt Controller List Registers, n = 0 - 15 */
+#define __LRC0(x)       p15, 4, c12, c14, x
+#define __LRC8(x)       p15, 4, c12, c15, x
+
+#define ICH_LRC0        __LRC0(0)
+#define ICH_LRC1        __LRC0(1)
+#define ICH_LRC2        __LRC0(2)
+#define ICH_LRC3        __LRC0(3)
+#define ICH_LRC4        __LRC0(4)
+#define ICH_LRC5        __LRC0(5)
+#define ICH_LRC6        __LRC0(6)
+#define ICH_LRC7        __LRC0(7)
+#define ICH_LRC8        __LRC8(0)
+#define ICH_LRC9        __LRC8(1)
+#define ICH_LRC10       __LRC8(2)
+#define ICH_LRC11       __LRC8(3)
+#define ICH_LRC12       __LRC8(4)
+#define ICH_LRC13       __LRC8(5)
+#define ICH_LRC14       __LRC8(6)
+#define ICH_LRC15       __LRC8(7)
+
 /* CP15 CR13:  */
 #define FCSEIDR         p15,0,c13,c0,0  /* FCSE Process ID Register */
 #define CONTEXTIDR      p15,0,c13,c0,1  /* Context ID Register */
@@ -317,6 +359,38 @@
 #define HCR_EL2                 HCR
 #define HPFAR_EL2               HPFAR
 #define HSTR_EL2                HSTR
+#define ICH_LR0_EL2             ICH_LR0
+#define ICH_LR1_EL2             ICH_LR1
+#define ICH_LR2_EL2             ICH_LR2
+#define ICH_LR3_EL2             ICH_LR3
+#define ICH_LR4_EL2             ICH_LR4
+#define ICH_LR5_EL2             ICH_LR5
+#define ICH_LR6_EL2             ICH_LR6
+#define ICH_LR7_EL2             ICH_LR7
+#define ICH_LR8_EL2             ICH_LR8
+#define ICH_LR9_EL2             ICH_LR9
+#define ICH_LR10_EL2            ICH_LR10
+#define ICH_LR11_EL2            ICH_LR11
+#define ICH_LR12_EL2            ICH_LR12
+#define ICH_LR13_EL2            ICH_LR13
+#define ICH_LR14_EL2            ICH_LR14
+#define ICH_LR15_EL2            ICH_LR15
+#define ICH_LRC0_EL2            ICH_LRC0
+#define ICH_LRC1_EL2            ICH_LRC1
+#define ICH_LRC2_EL2            ICH_LRC2
+#define ICH_LRC3_EL2            ICH_LRC3
+#define ICH_LRC4_EL2            ICH_LRC4
+#define ICH_LRC5_EL2            ICH_LRC5
+#define ICH_LRC6_EL2            ICH_LRC6
+#define ICH_LRC7_EL2            ICH_LRC7
+#define ICH_LRC8_EL2            ICH_LRC8
+#define ICH_LRC9_EL2            ICH_LRC9
+#define ICH_LRC10_EL2           ICH_LRC10
+#define ICH_LRC11_EL2           ICH_LRC11
+#define ICH_LRC12_EL2           ICH_LRC12
+#define ICH_LRC13_EL2           ICH_LRC13
+#define ICH_LRC14_EL2           ICH_LRC14
+#define ICH_LRC15_EL2           ICH_LRC15
 #define ID_AFR0_EL1             ID_AFR0
 #define ID_DFR0_EL1             ID_DFR0
 #define ID_DFR1_EL1             ID_DFR1
diff --git a/xen/arch/arm/include/asm/gic_v3_defs.h b/xen/arch/arm/include/asm/gic_v3_defs.h
index 48a1bc401e..227533868f 100644
--- a/xen/arch/arm/include/asm/gic_v3_defs.h
+++ b/xen/arch/arm/include/asm/gic_v3_defs.h
@@ -185,9 +185,9 @@
 #define ICH_LR_HW_SHIFT              61
 #define ICH_LR_GRP_MASK              0x1
 #define ICH_LR_GRP_SHIFT             60
-#define ICH_LR_MAINTENANCE_IRQ       (1UL<<41)
-#define ICH_LR_GRP1                  (1UL<<60)
-#define ICH_LR_HW                    (1UL<<61)
+#define ICH_LR_MAINTENANCE_IRQ       (1ULL << 41)
+#define ICH_LR_GRP1                  (1ULL << 60)
+#define ICH_LR_HW                    (1ULL << 61)
 
 #define ICH_VTR_NRLRGS               0x3f
 #define ICH_VTR_PRIBITS_MASK         0x7
@@ -195,7 +195,7 @@
 
 #define ICH_SGI_IRQMODE_SHIFT        40
 #define ICH_SGI_IRQMODE_MASK         0x1
-#define ICH_SGI_TARGET_OTHERS        1UL
+#define ICH_SGI_TARGET_OTHERS        1ULL
 #define ICH_SGI_TARGET_LIST          0
 #define ICH_SGI_IRQ_SHIFT            24
 #define ICH_SGI_IRQ_MASK             0xf
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:49:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:49:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465494.724259 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gvx-0005Nm-7K; Sat, 17 Dec 2022 23:49:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465494.724259; Sat, 17 Dec 2022 23:49: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 1p6gvx-0005Ne-4f; Sat, 17 Dec 2022 23:49:37 +0000
Received: by outflank-mailman (input) for mailman id 465494;
 Sat, 17 Dec 2022 23:49:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvv-0005NS-N3
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvv-0004bR-ML
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gvv-0001dl-Ld
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Sf4D/Ozw2eyXOfrG6HrNB2Ci/dJ3MN+RTwGG77oHDpM=; b=AnhSHenv5TomySUd8JYSOLdAWG
	d1WPAzafXqLHa8mKWkW00Hb4hyP7FhjhXorziY+/bTMoZwTkQ1fdq4ChzCJzrJM7vTHjGypqplsh7
	ICsgMnNEKRj16K+skAKqw+FJL3/P/i+QXl3THMg0lf4n5G9OLxOb3dR1TO0NGaOd7OiM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Arm: GICv3: Define ICH_AP0R<n> and ICH_AP1R<n> for AArch32
Message-Id: <E1p6gvv-0001dl-Ld@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:49:35 +0000

commit b3e52ffe34f702744a14b7ab7d51658799bc470e
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Dec 5 13:26:34 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:27:06 2022 +0000

    xen/Arm: GICv3: Define ICH_AP0R<n> and ICH_AP1R<n> for AArch32
    
    Adapt save_aprn_regs()/restore_aprn_regs() for AArch32.
    
    For which we have defined the following registers:-
    1. Interrupt Controller Hyp Active Priorities Group0 Registers 0-3
    2. Interrupt Controller Hyp Active Priorities Group1 Registers 0-3
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/cpregs.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/xen/arch/arm/include/asm/cpregs.h b/xen/arch/arm/include/asm/cpregs.h
index 7550fb25f5..4476c9f11b 100644
--- a/xen/arch/arm/include/asm/cpregs.h
+++ b/xen/arch/arm/include/asm/cpregs.h
@@ -259,6 +259,26 @@
 #define VBAR            p15,0,c12,c0,0  /* Vector Base Address Register */
 #define HVBAR           p15,4,c12,c0,0  /* Hyp. Vector Base Address Register */
 
+/*
+ * CP15 CR12: Interrupt Controller Hyp Active Priorities Group 0 Registers,
+ * n = 0 - 3
+ */
+#define __AP0Rx(x)      p15, 4, c12, c8, x
+#define ICH_AP0R0       __AP0Rx(0)
+#define ICH_AP0R1       __AP0Rx(1)
+#define ICH_AP0R2       __AP0Rx(2)
+#define ICH_AP0R3       __AP0Rx(3)
+
+/*
+ * CP15 CR12: Interrupt Controller Hyp Active Priorities Group 1 Registers,
+ * n = 0 - 3
+ */
+#define __AP1Rx(x)      p15, 4, c12, c9, x
+#define ICH_AP1R0       __AP1Rx(0)
+#define ICH_AP1R1       __AP1Rx(1)
+#define ICH_AP1R2       __AP1Rx(2)
+#define ICH_AP1R3       __AP1Rx(3)
+
 /* CP15 CR12: Interrupt Controller List Registers, n = 0 - 15 */
 #define __LR0(x)        p15, 4, c12, c12, x
 #define __LR8(x)        p15, 4, c12, c13, x
@@ -359,6 +379,14 @@
 #define HCR_EL2                 HCR
 #define HPFAR_EL2               HPFAR
 #define HSTR_EL2                HSTR
+#define ICH_AP0R0_EL2           ICH_AP0R0
+#define ICH_AP0R1_EL2           ICH_AP0R1
+#define ICH_AP0R2_EL2           ICH_AP0R2
+#define ICH_AP0R3_EL2           ICH_AP0R3
+#define ICH_AP1R0_EL2           ICH_AP1R0
+#define ICH_AP1R1_EL2           ICH_AP1R1
+#define ICH_AP1R2_EL2           ICH_AP1R2
+#define ICH_AP1R3_EL2           ICH_AP1R3
 #define ICH_LR0_EL2             ICH_LR0
 #define ICH_LR1_EL2             ICH_LR1
 #define ICH_LR2_EL2             ICH_LR2
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:49:47 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:49:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465495.724263 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gw7-0005Qo-8n; Sat, 17 Dec 2022 23:49:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465495.724263; Sat, 17 Dec 2022 23:49: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 1p6gw7-0005Qg-64; Sat, 17 Dec 2022 23:49:47 +0000
Received: by outflank-mailman (input) for mailman id 465495;
 Sat, 17 Dec 2022 23:49:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gw5-0005QS-Q3
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gw5-0004bp-PH
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gw5-0001eB-OU
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BiCzgKOJwfSG2zSKZrZCYMvxWUbMQMc5dfOvuzTgMak=; b=b8+U/WQapSeHO0VYEmyAH+UtIu
	ar1MxAkkEtuL39+uNiWkUXpc8mJKfkoWj1i8LDqY2qxMqI2UjhDpj9zKaaWnioQttB0V0q6+rVUCD
	BVi4YkViSzoXeT4FVl7ce0sQjSV6tGfrdiuGXLzUFEMQWWAD28jBPTrqfwvOm1laCZgg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Arm: GICv3: Define remaining GIC registers for AArch32
Message-Id: <E1p6gw5-0001eB-OU@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:49:45 +0000

commit 7587f76ebfa5693689b38aaf7f545933f50da040
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Dec 5 13:26:35 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:27:06 2022 +0000

    xen/Arm: GICv3: Define remaining GIC registers for AArch32
    
    Define missing assembly aliases for GIC registers on arm32, taking the ones
    defined already for arm64 as a base. Aliases are defined according to the
    GIC Architecture Specification ARM IHI 0069H.
    
    Defined the following registers:-
    1. Interrupt Controller Interrupt Priority Mask Register
    2. Interrupt Controller System Register Enable register
    3. Interrupt Controller Deactivate Interrupt Register
    4. Interrupt Controller End Of Interrupt Register 1
    5. Interrupt Controller Interrupt Acknowledge Register 1
    6. Interrupt Controller Binary Point Register 1
    7. Interrupt Controller Control Register
    8. Interrupt Controller Interrupt Group 1 Enable register
    9. Interrupt Controller Maintenance Interrupt State Register
    10. Interrupt Controller End of Interrupt Status Register
    11. Interrupt Controller Empty List Register Status Register
    12. Interrupt Controller Virtual Machine Control Register
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/cpregs.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/xen/arch/arm/include/asm/cpregs.h b/xen/arch/arm/include/asm/cpregs.h
index 4476c9f11b..6b083de204 100644
--- a/xen/arch/arm/include/asm/cpregs.h
+++ b/xen/arch/arm/include/asm/cpregs.h
@@ -161,6 +161,7 @@
 #define DACR            p15,0,c3,c0,0   /* Domain Access Control Register */
 
 /* CP15 CR4: */
+#define ICC_PMR         p15,0,c4,c6,0   /* Interrupt Priority Mask Register */
 
 /* CP15 CR5: Fault Status Registers */
 #define DFSR            p15,0,c5,c0,0   /* Data Fault Status Register */
@@ -257,6 +258,7 @@
 #define ICC_ASGI1R      p15,1,c12       /* Interrupt Controller Alias SGI Group 1 Register */
 #define ICC_SGI0R       p15,2,c12       /* Interrupt Controller SGI Group 0 */
 #define VBAR            p15,0,c12,c0,0  /* Vector Base Address Register */
+#define ICC_DIR         p15,0,c12,c11,1 /* Interrupt Controller Deactivate Interrupt Register */
 #define HVBAR           p15,4,c12,c0,0  /* Hyp. Vector Base Address Register */
 
 /*
@@ -279,6 +281,20 @@
 #define ICH_AP1R2       __AP1Rx(2)
 #define ICH_AP1R3       __AP1Rx(3)
 
+#define ICC_IAR1        p15,0,c12,c12,0  /* Interrupt Controller Interrupt Acknowledge Register 1 */
+#define ICC_EOIR1       p15,0,c12,c12,1  /* Interrupt Controller End Of Interrupt Register 1 */
+#define ICC_BPR1        p15,0,c12,c12,3  /* Interrupt Controller Binary Point Register 1 */
+#define ICC_CTLR        p15,0,c12,c12,4  /* Interrupt Controller Control Register */
+#define ICC_SRE         p15,0,c12,c12,5  /* Interrupt Controller System Register Enable register */
+#define ICC_IGRPEN1     p15,0,c12,c12,7  /* Interrupt Controller Interrupt Group 1 Enable register */
+#define ICC_HSRE        p15,4,c12,c9,5   /* Interrupt Controller Hyp System Register Enable register */
+#define ICH_HCR         p15,4,c12,c11,0  /* Interrupt Controller Hyp Control Register */
+#define ICH_VTR         p15,4,c12,c11,1  /* Interrupt Controller VGIC Type Register */
+#define ICH_MISR        p15,4,c12,c11,2  /* Interrupt Controller Maintenance Interrupt State Register */
+#define ICH_EISR        p15,4,c12,c11,3  /* Interrupt Controller End of Interrupt Status Register */
+#define ICH_ELRSR       p15,4,c12,c11,5  /* Interrupt Controller Empty List Register Status Register */
+#define ICH_VMCR        p15,4,c12,c11,7  /* Interrupt Controller Virtual Machine Control Register */
+
 /* CP15 CR12: Interrupt Controller List Registers, n = 0 - 15 */
 #define __LR0(x)        p15, 4, c12, c12, x
 #define __LR8(x)        p15, 4, c12, c13, x
@@ -379,6 +395,15 @@
 #define HCR_EL2                 HCR
 #define HPFAR_EL2               HPFAR
 #define HSTR_EL2                HSTR
+#define ICC_BPR1_EL1            ICC_BPR1
+#define ICC_CTLR_EL1            ICC_CTLR
+#define ICC_DIR_EL1             ICC_DIR
+#define ICC_EOIR1_EL1           ICC_EOIR1
+#define ICC_IGRPEN1_EL1         ICC_IGRPEN1
+#define ICC_PMR_EL1             ICC_PMR
+#define ICC_SGI1R_EL1           ICC_SGI1R
+#define ICC_SRE_EL1             ICC_SRE
+#define ICC_SRE_EL2             ICC_HSRE
 #define ICH_AP0R0_EL2           ICH_AP0R0
 #define ICH_AP0R1_EL2           ICH_AP0R1
 #define ICH_AP0R2_EL2           ICH_AP0R2
@@ -387,6 +412,10 @@
 #define ICH_AP1R1_EL2           ICH_AP1R1
 #define ICH_AP1R2_EL2           ICH_AP1R2
 #define ICH_AP1R3_EL2           ICH_AP1R3
+#define ICH_EISR_EL2            ICH_EISR
+#define ICH_ELRSR_EL2           ICH_ELRSR
+#define ICH_HCR_EL2             ICH_HCR
+#define ICC_IAR1_EL1            ICC_IAR1
 #define ICH_LR0_EL2             ICH_LR0
 #define ICH_LR1_EL2             ICH_LR1
 #define ICH_LR2_EL2             ICH_LR2
@@ -419,6 +448,9 @@
 #define ICH_LRC13_EL2           ICH_LRC13
 #define ICH_LRC14_EL2           ICH_LRC14
 #define ICH_LRC15_EL2           ICH_LRC15
+#define ICH_MISR_EL2            ICH_MISR
+#define ICH_VMCR_EL2            ICH_VMCR
+#define ICH_VTR_EL2             ICH_VTR
 #define ID_AFR0_EL1             ID_AFR0
 #define ID_DFR0_EL1             ID_DFR0
 #define ID_DFR1_EL1             ID_DFR1
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:49:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:49:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465496.724267 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gwH-0005TP-AR; Sat, 17 Dec 2022 23:49:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465496.724267; Sat, 17 Dec 2022 23:49: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 1p6gwH-0005TE-7Y; Sat, 17 Dec 2022 23:49:57 +0000
Received: by outflank-mailman (input) for mailman id 465496;
 Sat, 17 Dec 2022 23:49:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwF-0005T0-Sq
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwF-0004c2-SA
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwF-0001ec-RU
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:49: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iTmoT22bOzsM6PW5brS9LlrVkrB+/FXi7dSVDg4Fg4s=; b=o98nIA/j4zFizUXhH5SapaNmF6
	09BW1ycPNBnGE/gXpsmBYvNheLR7Cetz7I0uiJl+B/7h9tSKbW+TTjPZ4wGhEGnFYbJgcyLARHAM1
	vSvQL5SseVPzyHR1e9BUZdFRexSl8Xnj9HtJlzxjn0jG4+PvYQuG81cOwV/7vZgvjIDQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Arm: GICv3: Define macros to read/write 64 bit
Message-Id: <E1p6gwF-0001ec-RU@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:49:55 +0000

commit cd590560adafbf2bb70676c27c758a5df7dc339a
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Dec 5 13:26:36 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:27:06 2022 +0000

    xen/Arm: GICv3: Define macros to read/write 64 bit
    
    On AArch32, ldrd/strd instructions are not atomic when used to access MMIO.
    Furthermore, ldrd/strd instructions are not decoded by Arm when running as
    a guest to access emulated MMIO region.
    Thus, we have defined readq_relaxed_non_atomic()/writeq_relaxed_non_atomic()
    which in turn calls readl_relaxed()/writel_relaxed() for the lower and upper
    32 bits.
    For AArch64, readq_relaxed_non_atomic()/writeq_relaxed_non_atomic() invokes
    readq_relaxed()/writeq_relaxed() respectively.
    As GICv3 registers (GICD_IROUTER, GICR_TYPER) can be accessed in a non atomic
    manner, so we have used readq_relaxed_non_atomic()/readq_relaxed_non_atomic().
    
    However, the following points are noted for the non atomic access :-
    1. In gicv3_dist_init(), using non atomic write on GICD_IROUTER is fine as this
    gets invoked when interrupts are disabled.
    2. In gicv3_populate_rdist(), using non atomic read on GICR_TYPER is fine as
    the register is read and the interrupts are disabled as well.
    3. In gicv3_irq_set_affinity(), using non atomic write on GICD_IROUTER. This
    may be called with interrupts enabled. So, a non-atomic access (on AArch32)
    means the GIC will see a transient value when only one of two 32-bit will be
    updated. However, only AFF3 is defined in the upper 32 bits and they are 0, so
    this will never change.
    On AArch64, writeq_relaxed_non_atomic() invokes writeq_relaxed() (which is
    atomic), so this problem does not arise.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/gic-v3.c               |  6 +++---
 xen/arch/arm/include/asm/arm32/io.h | 20 ++++++++++++++++++++
 xen/arch/arm/include/asm/arm64/io.h |  2 ++
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index adcd40f1a0..bb59ea94cd 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -642,7 +642,7 @@ static void __init gicv3_dist_init(void)
     affinity &= ~GICD_IROUTER_SPI_MODE_ANY;
 
     for ( i = NR_GIC_LOCAL_IRQS; i < nr_lines; i++ )
-        writeq_relaxed(affinity, GICD + GICD_IROUTER + i * 8);
+        writeq_relaxed_non_atomic(affinity, GICD + GICD_IROUTER + i * 8);
 }
 
 static int gicv3_enable_redist(void)
@@ -736,7 +736,7 @@ static int __init gicv3_populate_rdist(void)
         }
 
         do {
-            typer = readq_relaxed(ptr + GICR_TYPER);
+            typer = readq_relaxed_non_atomic(ptr + GICR_TYPER);
 
             if ( (typer >> 32) == aff )
             {
@@ -1256,7 +1256,7 @@ static void gicv3_irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
     affinity &= ~GICD_IROUTER_SPI_MODE_ANY;
 
     if ( desc->irq >= NR_GIC_LOCAL_IRQS )
-        writeq_relaxed(affinity, (GICD + GICD_IROUTER + desc->irq * 8));
+        writeq_relaxed_non_atomic(affinity, (GICD + GICD_IROUTER + desc->irq * 8));
 
     spin_unlock(&gicv3.lock);
 }
diff --git a/xen/arch/arm/include/asm/arm32/io.h b/xen/arch/arm/include/asm/arm32/io.h
index 73a879e9fb..782b564809 100644
--- a/xen/arch/arm/include/asm/arm32/io.h
+++ b/xen/arch/arm/include/asm/arm32/io.h
@@ -80,10 +80,30 @@ static inline u32 __raw_readl(const volatile void __iomem *addr)
                                         __raw_readw(c)); __r; })
 #define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
                                         __raw_readl(c)); __r; })
+/*
+ * ldrd instructions are not decoded by Arm when running as a guest to access
+ * emulated MMIO region. Thus, readq_relaxed_non_atomic() invokes readl_relaxed()
+ * twice to read the lower and upper 32 bits.
+ */
+static inline u64 readq_relaxed_non_atomic(const volatile void __iomem *addr)
+{
+        u64 val = (((u64)readl_relaxed(addr + 4)) << 32) | readl_relaxed(addr);
+        return val;
+}
 
 #define writeb_relaxed(v,c)     __raw_writeb(v,c)
 #define writew_relaxed(v,c)     __raw_writew((__force u16) cpu_to_le16(v),c)
 #define writel_relaxed(v,c)     __raw_writel((__force u32) cpu_to_le32(v),c)
+/*
+ * strd instructions are not decoded by Arm when running as a guest to access
+ * emulated MMIO region. Thus, writeq_relaxed_non_atomic() invokes writel_relaxed()
+ * twice to write the lower and upper 32 bits.
+ */
+static inline void writeq_relaxed_non_atomic(u64 val, volatile void __iomem *addr)
+{
+        writel_relaxed((u32)val, addr);
+        writel_relaxed((u32)(val >> 32), addr + 4);
+}
 
 #define readb(c)                ({ u8  __v = readb_relaxed(c); __iormb(); __v; })
 #define readw(c)                ({ u16 __v = readw_relaxed(c); __iormb(); __v; })
diff --git a/xen/arch/arm/include/asm/arm64/io.h b/xen/arch/arm/include/asm/arm64/io.h
index 30bfc78d9e..2e2ab24f78 100644
--- a/xen/arch/arm/include/asm/arm64/io.h
+++ b/xen/arch/arm/include/asm/arm64/io.h
@@ -102,11 +102,13 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
 #define readw_relaxed(c)        ({ u16 __v = le16_to_cpu((__force __le16)__raw_readw(c)); __v; })
 #define readl_relaxed(c)        ({ u32 __v = le32_to_cpu((__force __le32)__raw_readl(c)); __v; })
 #define readq_relaxed(c)        ({ u64 __v = le64_to_cpu((__force __le64)__raw_readq(c)); __v; })
+#define readq_relaxed_non_atomic(c)           readq_relaxed(c)
 
 #define writeb_relaxed(v,c)     ((void)__raw_writeb((v),(c)))
 #define writew_relaxed(v,c)     ((void)__raw_writew((__force u16)cpu_to_le16(v),(c)))
 #define writel_relaxed(v,c)     ((void)__raw_writel((__force u32)cpu_to_le32(v),(c)))
 #define writeq_relaxed(v,c)     ((void)__raw_writeq((__force u64)cpu_to_le64(v),(c)))
+#define writeq_relaxed_non_atomic(v,c)        writeq_relaxed(v,c)
 
 /*
  * I/O memory access primitives. Reads are ordered relative to any
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:50:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:50:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465497.724272 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gwR-0006Hd-Cj; Sat, 17 Dec 2022 23:50:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465497.724272; Sat, 17 Dec 2022 23:50: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 1p6gwR-0006HI-8y; Sat, 17 Dec 2022 23:50:07 +0000
Received: by outflank-mailman (input) for mailman id 465497;
 Sat, 17 Dec 2022 23:50:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwP-0006EM-Vr
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwP-0004cL-V6
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwP-0001fF-US
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ompui/D0C8rtOgTjcOtDaFiQdHYdvDA/VYzKqrsL9zc=; b=NTGDhiVmNG6v1YO8W2Bp/JX4PA
	Ehb1yja1/6xJm/rzsBn9700uBNmpwgKWHhW+WjNMX/Aj05r56N1MAVV9xIqP4SCnAXMegEWBx/Gk/
	HE6mxpjGZVzQmWIPsJUkvlZdQjupTlXHUKJdeuYLR5LJd2fPOLPy1eprl8sXW4mjuePI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Arm: GICv3: Enable GICv3 for AArch32
Message-Id: <E1p6gwP-0001fF-US@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:50:05 +0000

commit 291c13af5511fb4f868fc8eebd0a8f6800d0a2f3
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Dec 5 13:26:37 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:27:06 2022 +0000

    xen/Arm: GICv3: Enable GICv3 for AArch32
    
    One can now use GICv3 on AArch32 systems. However, ITS is not supported.
    The reason being currently we are trying to validate GICv3 on an AArch32_v8R
    system. Refer ARM DDI 0568A.c ID110520, B1.3.1,
    "A Generic Interrupt Controller (GIC) implemented with an Armv8-R PE must not
    implement LPI support."
    
    By default GICv3 is disabled on AArch32 and enabled on AArch64.
    
    Updated SUPPORT.md to state that GICv3 on Arm32 is not security supported.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 SUPPORT.md                            | 7 +++++++
 xen/arch/arm/Kconfig                  | 9 +++++----
 xen/arch/arm/include/asm/cpufeature.h | 1 +
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index ab71464cf6..295369998e 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -76,6 +76,13 @@ For the Cortex A57 r0p0 - r1p1, see Errata 832075.
     Status, ARM SMMUv3: Tech Preview
     Status, Renesas IPMMU-VMSA: Supported, not security supported
 
+### ARM/GICv3
+
+GICv3 is an interrupt controller specification designed by Arm.
+
+    Status, Arm64: Security supported
+    Status, Arm32: Supported, not security supported
+
 ### ARM/GICv3 ITS
 
 Extension to the GICv3 interrupt controller to support MSI.
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 52a05f704d..239d3aed3c 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -41,16 +41,17 @@ config ARM_EFI
 
 config GICV3
 	bool "GICv3 driver"
-	depends on ARM_64 && !NEW_VGIC
-	default y
+	depends on !NEW_VGIC
+	default n if ARM_32
+	default y if ARM_64
 	---help---
 
 	  Driver for the ARM Generic Interrupt Controller v3.
-	  If unsure, say Y
+	  If unsure, use the default setting.
 
 config HAS_ITS
         bool "GICv3 ITS MSI controller support (UNSUPPORTED)" if UNSUPPORTED
-        depends on GICV3 && !NEW_VGIC
+        depends on GICV3 && !NEW_VGIC && !ARM_32
 
 config HVM
         def_bool y
diff --git a/xen/arch/arm/include/asm/cpufeature.h b/xen/arch/arm/include/asm/cpufeature.h
index c86a2e7f29..c62cf6293f 100644
--- a/xen/arch/arm/include/asm/cpufeature.h
+++ b/xen/arch/arm/include/asm/cpufeature.h
@@ -33,6 +33,7 @@
 #define cpu_has_aarch32   (cpu_has_arm || cpu_has_thumb)
 
 #ifdef CONFIG_ARM_32
+#define cpu_has_gicv3     (boot_cpu_feature32(gic) >= 1)
 #define cpu_has_gentimer  (boot_cpu_feature32(gentimer) == 1)
 /*
  * On Armv7, the value 0 is used to indicate that PMUv2 is not
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:50:17 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:50:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465498.724275 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gwb-0006Mf-DU; Sat, 17 Dec 2022 23:50:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465498.724275; Sat, 17 Dec 2022 23:50: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 1p6gwb-0006MX-Aj; Sat, 17 Dec 2022 23:50:17 +0000
Received: by outflank-mailman (input) for mailman id 465498;
 Sat, 17 Dec 2022 23:50:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwa-0006M8-2W
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwa-0004cY-1p
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwa-0001fn-10
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aDz3A3WRW+g8EMV3uQmBwpBrTm428cnJZHqx9v1yFo0=; b=5CyAt+5kV/QtfQWf0CFq6dM26U
	1TsTaBL43/rnnGV3xxCE7Y06ljxIE5ZA7MV3uk7vbO4lUsbo0O7B6pd76WrCAzkFHmfHv6JWLqkSC
	rLmlYvd5Kt0wyk4k8njfLwzCYwJeXOwnA5QJtRDRAgZhwSq/atnbMh6ceYcUmrS/30jU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: efi-boot misra rule 4.1 fix
Message-Id: <E1p6gwa-0001fn-10@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:50:16 +0000

commit 0dba9a071a1d949df20057a7cf09f1a1ca48652c
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Fri Dec 9 14:25:52 2022 -0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:35:45 2022 +0000

    xen/arm: efi-boot misra rule 4.1 fix
    
    We have 3 violations of MISRA C Rule 4.1 ("Octal and hexadecimal escape
    sequences shall be terminated") in xen/arch/arm/efi/efi-boot.h. Fix them
    and take the opportunity to declare them as static const __initconst and
    improve the style.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/efi/efi-boot.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index 43a836c3a7..223db0c4da 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -542,7 +542,9 @@ static void __init efi_arch_handle_module(const struct file *file,
 
     if ( file == &ramdisk )
     {
-        char ramdisk_compat[] = "multiboot,ramdisk\0multiboot,module";
+        static const char __initconst ramdisk_compat[] = "multiboot,ramdisk\0"
+                                                         "multiboot,module";
+
         node = fdt_add_subnode(fdt, chosen, "ramdisk");
         if ( node < 0 )
             blexit(L"Unable to add ramdisk FDT node.");
@@ -555,7 +557,9 @@ static void __init efi_arch_handle_module(const struct file *file,
     }
     else if ( file == &xsm )
     {
-        char xsm_compat[] = "xen,xsm-policy\0multiboot,module";
+        static const char __initconst xsm_compat[] = "xen,xsm-policy\0"
+                                                     "multiboot,module";
+
         node = fdt_add_subnode(fdt, chosen, "xsm");
         if ( node < 0 )
             blexit(L"Unable to add xsm FDT node.");
@@ -568,7 +572,9 @@ static void __init efi_arch_handle_module(const struct file *file,
     }
     else if ( file == &kernel )
     {
-        char kernel_compat[] = "multiboot,kernel\0multiboot,module";
+        static const char __initconst kernel_compat[] = "multiboot,kernel\0"
+                                                        "multiboot,module";
+
         node = fdt_add_subnode(fdt, chosen, "kernel");
         if ( node < 0 )
             blexit(L"Unable to add dom0 FDT node.");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:50:27 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:50:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465499.724279 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gwl-0006Pp-Fl; Sat, 17 Dec 2022 23:50:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465499.724279; Sat, 17 Dec 2022 23:50: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 1p6gwl-0006Pi-CI; Sat, 17 Dec 2022 23:50:27 +0000
Received: by outflank-mailman (input) for mailman id 465499;
 Sat, 17 Dec 2022 23:50:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwk-0006Pa-5T
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwk-0004cw-4i
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwk-0001gC-3z
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g2eKUR/j1XvCeU0/hGHHLrZBu7smhCFXJ4PxLxXL3wY=; b=yLom3Q65/l9/onrBA4U/D6PTwl
	YFdBAGENPwM0TmWdWGFaSPSGK7i+jiATrGH/7fm6Oh230zbKvPlkkkrSP+hHg7+2vDXlA6J0oxx04
	OZ3CZCCIfln0AUo/6DbeyYFPlcdIWn2qGCj6pmnY6tm/O3r3yu7nBxQtHBLzTiP4/Bbo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Enable use of dump_pt_walk() early during boot
Message-Id: <E1p6gwk-0001gC-3z@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:50:26 +0000

commit 9487a6d62af1edb0bd497b546839b4a0cd768603
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Dec 15 11:44:45 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:46:37 2022 +0000

    xen/arm: Enable use of dump_pt_walk() early during boot
    
    At the moment, dump_pt_walk() is using map_domain_page() to map
    the page tables.
    
    map_domain_page() is only usuable after init_domheap_mappings() is called
    (arm32) or the xenheap has been initialized (arm64).
    
    This means it can be hard to diagnose incorrect page-tables during
    early boot. So update dump_pt_walk() to xen_{, un}map_table() instead.
    
    Note that the two helpers are moved earlier to avoid forward declaring
    them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/mm.c | 56 +++++++++++++++++++++++++++----------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 630175276f..1fd207b27c 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -177,6 +177,30 @@ static void __init __maybe_unused build_assertions(void)
 #undef CHECK_SAME_SLOT
 }
 
+static lpae_t *xen_map_table(mfn_t mfn)
+{
+    /*
+     * During early boot, map_domain_page() may be unusable. Use the
+     * PMAP to map temporarily a page-table.
+     */
+    if ( system_state == SYS_STATE_early_boot )
+        return pmap_map(mfn);
+
+    return map_domain_page(mfn);
+}
+
+static void xen_unmap_table(const lpae_t *table)
+{
+    /*
+     * During early boot, xen_map_table() will not use map_domain_page()
+     * but the PMAP.
+     */
+    if ( system_state == SYS_STATE_early_boot )
+        pmap_unmap(table);
+    else
+        unmap_domain_page(table);
+}
+
 void dump_pt_walk(paddr_t ttbr, paddr_t addr,
                   unsigned int root_level,
                   unsigned int nr_root_tables)
@@ -216,7 +240,7 @@ void dump_pt_walk(paddr_t ttbr, paddr_t addr,
     else
         root_table = 0;
 
-    mapping = map_domain_page(mfn_add(root_mfn, root_table));
+    mapping = xen_map_table(mfn_add(root_mfn, root_table));
 
     for ( level = root_level; ; level++ )
     {
@@ -232,11 +256,11 @@ void dump_pt_walk(paddr_t ttbr, paddr_t addr,
             break;
 
         /* For next iteration */
-        unmap_domain_page(mapping);
-        mapping = map_domain_page(lpae_get_mfn(pte));
+        xen_unmap_table(mapping);
+        mapping = xen_map_table(lpae_get_mfn(pte));
     }
 
-    unmap_domain_page(mapping);
+    xen_unmap_table(mapping);
 }
 
 void dump_hyp_walk(vaddr_t addr)
@@ -699,30 +723,6 @@ void *ioremap(paddr_t pa, size_t len)
     return ioremap_attr(pa, len, PAGE_HYPERVISOR_NOCACHE);
 }
 
-static lpae_t *xen_map_table(mfn_t mfn)
-{
-    /*
-     * During early boot, map_domain_page() may be unusable. Use the
-     * PMAP to map temporarily a page-table.
-     */
-    if ( system_state == SYS_STATE_early_boot )
-        return pmap_map(mfn);
-
-    return map_domain_page(mfn);
-}
-
-static void xen_unmap_table(const lpae_t *table)
-{
-    /*
-     * During early boot, xen_map_table() will not use map_domain_page()
-     * but the PMAP.
-     */
-    if ( system_state == SYS_STATE_early_boot )
-        pmap_unmap(table);
-    else
-        unmap_domain_page(table);
-}
-
 static int create_xen_table(lpae_t *entry)
 {
     mfn_t mfn;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:50:37 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:50:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465500.724284 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gwv-0006T5-Ir; Sat, 17 Dec 2022 23:50:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465500.724284; Sat, 17 Dec 2022 23:50: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 1p6gwv-0006Sx-Fq; Sat, 17 Dec 2022 23:50:37 +0000
Received: by outflank-mailman (input) for mailman id 465500;
 Sat, 17 Dec 2022 23:50:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwu-0006Sm-8O
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwu-0004dE-7f
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gwu-0001gf-6t
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QNNG907gsoDgXhSvYlEgoZY3BzY/InrU4PwXA/45Pj0=; b=DyHWuNWhgNs/hwkrp20awErXUt
	jukbSsTqx3Lfx0gq9qOIjCjxhROh34feTpZ5ulbyX7u3bLADUlrKtW5ebcwxogCQhlZECJi45E7uz
	yLSEYA1Cep/vbBYMI4DGacwlgtnm1HI6+6nBJKUG7WTscgelF0UXkCCoNFWSRBvKNgQs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: mm: Allow xen_pt_update() to work with the current root table
Message-Id: <E1p6gwu-0001gf-6t@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:50:36 +0000

commit 0e506697d016ceab58b06a5c6e1932b9b382e29e
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Dec 15 11:44:54 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:46:37 2022 +0000

    xen/arm: mm: Allow xen_pt_update() to work with the current root table
    
    At the moment, xen_pt_update() will only work on the runtime page tables.
    In follow-up patches, we will also want to use the helper to update
    the boot page tables.
    
    All the existing callers of xen_pt_update() expects to modify the
    current page-tables. Therefore, we can read the root physical address
    directly from TTBR0_EL2.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 1fd207b27c..16ec1d0fe9 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1099,7 +1099,7 @@ static int xen_pt_update(unsigned long virt,
      *
      * XXX: Add a check.
      */
-    const mfn_t root = virt_to_mfn(THIS_CPU_PGTABLE);
+    const mfn_t root = maddr_to_mfn(READ_SYSREG64(TTBR0_EL2));
 
     /*
      * The hardware was configured to forbid mapping both writeable and
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:50:47 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:50:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465501.724287 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gx5-0006VR-K4; Sat, 17 Dec 2022 23:50:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465501.724287; Sat, 17 Dec 2022 23:50: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 1p6gx5-0006VK-HN; Sat, 17 Dec 2022 23:50:47 +0000
Received: by outflank-mailman (input) for mailman id 465501;
 Sat, 17 Dec 2022 23:50:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gx4-0006V4-BJ
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gx4-0004dY-Ac
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gx4-0001h9-9q
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sW/MKml2yM/oPIOkmMXj3F7lWVVZbDywcNVsWoPaNzU=; b=Wuk4RqXxRulrWNj9IPxw+xpw1F
	beAODxXQvdAMJMvI1f0ipVIjhs3NIaY5GEr11kwj3mkF5OmEgRy6FqLlfa28EKaKI0U6Upsw9tHLJ
	Hx5a6ezMu/I2Mg7LJDi22yBYcD32K4EXR5a7a81rKiYECzvUGT1UUPzc17HJfk0gWYPc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: mm: Allow dump_hyp_walk() to work on the current root table
Message-Id: <E1p6gx4-0001h9-9q@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:50:46 +0000

commit 88168c418c3bde7d51797e7cf875d528a8aa0eb1
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Dec 15 11:45:18 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Dec 15 11:46:37 2022 +0000

    xen/arm: mm: Allow dump_hyp_walk() to work on the current root table
    
    dump_hyp_walk() is used to print the tables walk in case of the data or
    instruction abort.
    
    Those abort are not limited to the runtime and could happen at early
    boot. However, the current implementation of dump_hyp_walk() check
    that the TTBR matches the runtime page tables.
    
    Therefore, early abort will result to a secondary abort and not
    print the table walks.
    
    Given that the function is called in the abort path, there is no
    reason for us to keep the BUG_ON() in any form. So drop it.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/mm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 16ec1d0fe9..0fc6f2992d 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -266,13 +266,11 @@ void dump_pt_walk(paddr_t ttbr, paddr_t addr,
 void dump_hyp_walk(vaddr_t addr)
 {
     uint64_t ttbr = READ_SYSREG64(TTBR0_EL2);
-    lpae_t *pgtable = THIS_CPU_PGTABLE;
 
     printk("Walking Hypervisor VA 0x%"PRIvaddr" "
            "on CPU%d via TTBR 0x%016"PRIx64"\n",
            addr, smp_processor_id(), ttbr);
 
-    BUG_ON( virt_to_maddr(pgtable) != ttbr );
     dump_pt_walk(ttbr, addr, HYP_PT_ROOT_LEVEL, 1);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:50:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:50:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465502.724290 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gxF-0006Ya-LU; Sat, 17 Dec 2022 23:50:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465502.724290; Sat, 17 Dec 2022 23:50: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 1p6gxF-0006YS-Iu; Sat, 17 Dec 2022 23:50:57 +0000
Received: by outflank-mailman (input) for mailman id 465502;
 Sat, 17 Dec 2022 23:50:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gxE-0006YG-E2
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gxE-0004dk-DM
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gxE-0001hb-Cl
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:50: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=veCtfCLMnmccLpeInDQ+If7E017RExc8FGrLbCNpgfQ=; b=X8UdLj4tKsXzjb6X5R7entRAxz
	CTHWmX+xltXYeJV4wbONaksqfpgjlk/cR/9YNKC/7v1Yt+nUeMjE5Xclk7CUQVcPEgokQUFaCHoJP
	AbpVtCBTkzROL5usAgVSVCVnFDryOuC1bOvB3fk3mxlMvFmJEKIEJEk8HJorXtwfVf+g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] p2m-pt: avoid hard-coding Xen's PAT
Message-Id: <E1p6gxE-0001hb-Cl@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:50:56 +0000

commit 1ca8af08dfa46a8b3c376e0bd1b74ccde579f48d
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Thu Dec 15 17:03:45 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 15 17:03:45 2022 +0100

    p2m-pt: avoid hard-coding Xen's PAT
    
    This makes the code much easier to understand.  No functional change
    intended.  As per Andrew Cooper, the existing logic is questionable, but
    this does not make it any worse.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m-pt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index eaba2b0fb4..cd1af33b67 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -99,13 +99,13 @@ static unsigned long p2m_type_to_flags(const struct p2m_domain *p2m,
         return flags | P2M_BASE_FLAGS | _PAGE_RW | _PAGE_NX_BIT;
     case p2m_mmio_direct:
         if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn_x(mfn)) )
-            flags |= _PAGE_RW;
+            flags |= _PAGE_RW | _PAGE_UCM;
         else
         {
-            flags |= _PAGE_PWT;
+            flags |= _PAGE_UC;
             ASSERT(!level);
         }
-        return flags | P2M_BASE_FLAGS | _PAGE_PCD;
+        return flags | P2M_BASE_FLAGS;
     }
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:51:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:51:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465503.724294 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gxP-0006bI-Mt; Sat, 17 Dec 2022 23:51:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465503.724294; Sat, 17 Dec 2022 23:51: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 1p6gxP-0006bA-KK; Sat, 17 Dec 2022 23:51:07 +0000
Received: by outflank-mailman (input) for mailman id 465503;
 Sat, 17 Dec 2022 23:51:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gxO-0006as-Gt
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:51:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gxO-0004eE-GD
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:51:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gxO-0001iJ-FR
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:51: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/cOnkA4Q/HPKlIKUwjqEdgGQgHV3QS8Mo5KBIPsbQ/8=; b=izWyD2v6nh7oRsIlRwFA7Gxqcn
	OyIC4/UDh3MM/c5Ih79OEauIfWE6zM510ohaMZmrcj/mDa8/5aHuU1t14r9muLppfgv8JzuAnQkCD
	QLWcGL6dx9CLT+BZHa3wUx9wTu/th8ye+I3jJIvRsxXQTwlckA+TRnCCqBu9jU8y8AZI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] efi: avoid hard-coding the various PAT constants
Message-Id: <E1p6gxO-0001iJ-FR@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:51:06 +0000

commit 32b61bcafccc1f12b7e98d2d2e3cef763ac1fb60
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Thu Dec 15 17:04:40 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 15 17:04:40 2022 +0100

    efi: avoid hard-coding the various PAT constants
    
    This makes the code much easier to understand, and avoids problems if
    Xen's PAT ever changes in the future.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/efi/boot.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index d3c6b055ae..b69c83e354 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1724,23 +1724,23 @@ void __init efi_init_memory(void)
         emfn = PFN_UP(desc->PhysicalStart + len);
 
         if ( desc->Attribute & EFI_MEMORY_WB )
-            /* nothing */;
+            prot |= _PAGE_WB;
         else if ( desc->Attribute & EFI_MEMORY_WT )
-            prot |= _PAGE_PWT | MAP_SMALL_PAGES;
+            prot |= _PAGE_WT | MAP_SMALL_PAGES;
         else if ( desc->Attribute & EFI_MEMORY_WC )
-            prot |= _PAGE_PAT | MAP_SMALL_PAGES;
+            prot |= _PAGE_WC | MAP_SMALL_PAGES;
         else if ( desc->Attribute & (EFI_MEMORY_UC | EFI_MEMORY_UCE) )
-            prot |= _PAGE_PWT | _PAGE_PCD | MAP_SMALL_PAGES;
+            prot |= _PAGE_UC | MAP_SMALL_PAGES;
         else if ( efi_bs_revision >= EFI_REVISION(2, 5) &&
                   (desc->Attribute & EFI_MEMORY_WP) )
-            prot |= _PAGE_PAT | _PAGE_PWT | MAP_SMALL_PAGES;
+            prot |= _PAGE_WP | MAP_SMALL_PAGES;
         else
         {
             printk(XENLOG_ERR "Unknown cachability for MFNs %#lx-%#lx%s\n",
                    smfn, emfn - 1, efi_map_uc ? ", assuming UC" : "");
             if ( !efi_map_uc )
                 continue;
-            prot |= _PAGE_PWT | _PAGE_PCD | MAP_SMALL_PAGES;
+            prot |= _PAGE_UC | MAP_SMALL_PAGES;
         }
 
         if ( desc->Attribute & (efi_bs_revision < EFI_REVISION(2, 5)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:51:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:51:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465504.724299 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gxa-0006eJ-OZ; Sat, 17 Dec 2022 23:51:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465504.724299; Sat, 17 Dec 2022 23:51: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 1p6gxa-0006eB-Lp; Sat, 17 Dec 2022 23:51:18 +0000
Received: by outflank-mailman (input) for mailman id 465504;
 Sat, 17 Dec 2022 23:51:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gxY-0006dx-Jq
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:51:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gxY-0004eW-J7
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:51:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gxY-0001ii-IM
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:51: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dsKCwegK70Wgc06Fvfo8s0m+l0rZl66o8rgUsXJdCTA=; b=ettmg44T32VNJcHqecIGc/GFpU
	cbK2/d3eZnPoAUjDTdeT6ZWvRuzokeYhPo43l4I5Bbqb7iWE6P2boT6va78FDMAVClkRcdtZHjsLU
	Ziiu6e4a17fdBFOS44QCm3ZV4mCm292wTLCvEQXJUfzHrIMJ+udD9eH1wahVMmMQsIK0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxl: Fix virtio build error for 32-bit platforms
Message-Id: <E1p6gxY-0001ii-IM@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:51:16 +0000

commit c8aaebccc8e8fb5d90080e664202b0011ce4d0bd
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Thu Dec 15 19:01:40 2022 +0530
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 15 18:04:53 2022 +0000

    tools/libxl: Fix virtio build error for 32-bit platforms
    
    The field 'base' in 'struct libxl_device_virtio' is defined as uint64,
    while we are printing it with '%lu', which is 32bit only 32-bit
    platforms. And so generates a error like:
    
      libxl_internal.h:4388:51: error: format '%lu' expects argument of type 'long
      unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned
      int'} [-Werror=format=]
    
    Fix it by switching to a 64bit PRI instead.
    
    While fixing this, switch from decimal to hex which is the more natural base
    to use for a field like this.
    
    Fixes: 43ba5202e2ee ("libxl: add support for generic virtio device")
    Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/light/libxl_virtio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_virtio.c b/tools/libs/light/libxl_virtio.c
index 6a38def2fa..faada49e18 100644
--- a/tools/libs/light/libxl_virtio.c
+++ b/tools/libs/light/libxl_virtio.c
@@ -45,12 +45,12 @@ static int libxl__set_xenstore_virtio(libxl__gc *gc, uint32_t domid,
     const char *transport = libxl_virtio_transport_to_string(virtio->transport);
 
     flexarray_append_pair(back, "irq", GCSPRINTF("%u", virtio->irq));
-    flexarray_append_pair(back, "base", GCSPRINTF("%lu", virtio->base));
+    flexarray_append_pair(back, "base", GCSPRINTF("%#"PRIx64, virtio->base));
     flexarray_append_pair(back, "type", GCSPRINTF("%s", virtio->type));
     flexarray_append_pair(back, "transport", GCSPRINTF("%s", transport));
 
     flexarray_append_pair(front, "irq", GCSPRINTF("%u", virtio->irq));
-    flexarray_append_pair(front, "base", GCSPRINTF("%lu", virtio->base));
+    flexarray_append_pair(front, "base", GCSPRINTF("%#"PRIx64, virtio->base));
     flexarray_append_pair(front, "type", GCSPRINTF("%s", virtio->type));
     flexarray_append_pair(front, "transport", GCSPRINTF("%s", transport));
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 17 23:51:28 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Dec 2022 23:51:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.465505.724303 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p6gxk-0006hT-QN; Sat, 17 Dec 2022 23:51:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 465505.724303; Sat, 17 Dec 2022 23:51: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 1p6gxk-0006hL-NL; Sat, 17 Dec 2022 23:51:28 +0000
Received: by outflank-mailman (input) for mailman id 465505;
 Sat, 17 Dec 2022 23:51:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gxi-0006h3-Mp
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:51:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gxi-0004gH-M6
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:51:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p6gxi-0001j7-LJ
 for xen-changelog@lists.xenproject.org; Sat, 17 Dec 2022 23:51: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5rVBsTNYUmMTeYFv4lbBBDN2QhegJL36M+MwAqdSZMQ=; b=Gtlg3ff+AXEZW/Pyo5gnviynkW
	vgqoRVq83t3XCR+BmCwo2HYALZX160zetCAjxRQWv6UHsO3n/Gzak43GnM3Nye90Ms+3p5AsBO7pG
	7WnU3s9v//r/jbS5V5T9qT+jSwxUucj7BrsQlC55vGz9exDxZ7yWytvr4rP1+IBDGr/Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: avoid phys_to_nid() calls for invalid addresses
Message-Id: <E1p6gxi-0001j7-LJ@xenbits.xenproject.org>
Date: Sat, 17 Dec 2022 23:51:26 +0000

commit 12b593ca0d61ef884c2f2de15ed36b4900fc92b2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Dec 13 12:36:54 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 16 19:25:18 2022 +0000

    x86/mm: avoid phys_to_nid() calls for invalid addresses
    
    With phys_to_nid() now actively checking that a valid node ID is on
    record, the two uses in paging_init() can actually trigger at least the
    2nd of the assertions there. They're used to calculate allocation flags,
    but the calculated flags wouldn't be used when dealing with an invalid
    (unpopulated) address range. Defer the calculations such that they can
    be done with a validated MFN in hands. This also does away with the
    artificial calculations of an address to pass to phys_to_nid().
    
    Note that while the variable is provably written before use, at least
    some compiler versions can't actually verify that. Hence the variable
    also needs to gain a (dead) initializer.
    
    Fixes: e9c72d524fbd ("xen/x86: Use ASSERT instead of VIRTUAL_BUG_ON for phys_to_nid")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_64/mm.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 3510a5affe..c9ddaaf36f 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -498,7 +498,7 @@ error:
 void __init paging_init(void)
 {
     unsigned long i, mpt_size, va;
-    unsigned int n, memflags;
+    unsigned int n, memflags = 0;
     l3_pgentry_t *l3_ro_mpt;
     l2_pgentry_t *pl2e = NULL, *l2_ro_mpt = NULL;
     struct page_info *l1_pg;
@@ -547,8 +547,6 @@ void __init paging_init(void)
     {
         BUILD_BUG_ON(RO_MPT_VIRT_START & ((1UL << L3_PAGETABLE_SHIFT) - 1));
         va = RO_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT);
-        memflags = MEMF_node(phys_to_nid(i <<
-            (L2_PAGETABLE_SHIFT - 3 + PAGE_SHIFT)));
 
         if ( cpu_has_page1gb &&
              !((unsigned long)pl2e & ~PAGE_MASK) &&
@@ -559,10 +557,15 @@ void __init paging_init(void)
             for ( holes = k = 0; k < 1 << PAGETABLE_ORDER; ++k)
             {
                 for ( n = 0; n < CNT; ++n)
-                    if ( mfn_valid(_mfn(MFN(i + k) + n * PDX_GROUP_COUNT)) )
+                {
+                    mfn = _mfn(MFN(i + k) + n * PDX_GROUP_COUNT);
+                    if ( mfn_valid(mfn) )
                         break;
+                }
                 if ( n == CNT )
                     ++holes;
+                else if ( k == holes )
+                    memflags = MEMF_node(phys_to_nid(mfn_to_maddr(mfn)));
             }
             if ( k == holes )
             {
@@ -593,8 +596,14 @@ void __init paging_init(void)
         }
 
         for ( n = 0; n < CNT; ++n)
-            if ( mfn_valid(_mfn(MFN(i) + n * PDX_GROUP_COUNT)) )
+        {
+            mfn = _mfn(MFN(i) + n * PDX_GROUP_COUNT);
+            if ( mfn_valid(mfn) )
+            {
+                memflags = MEMF_node(phys_to_nid(mfn_to_maddr(mfn)));
                 break;
+            }
+        }
         if ( n == CNT )
             l1_pg = NULL;
         else if ( (l1_pg = alloc_domheap_pages(NULL, PAGETABLE_ORDER,
@@ -663,15 +672,19 @@ void __init paging_init(void)
                  sizeof(*compat_machine_to_phys_mapping));
     for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++, pl2e++ )
     {
-        memflags = MEMF_node(phys_to_nid(i <<
-            (L2_PAGETABLE_SHIFT - 2 + PAGE_SHIFT)));
         for ( n = 0; n < CNT; ++n)
-            if ( mfn_valid(_mfn(MFN(i) + n * PDX_GROUP_COUNT)) )
+        {
+            mfn = _mfn(MFN(i) + n * PDX_GROUP_COUNT);
+            if ( mfn_valid(mfn) )
+            {
+                memflags = MEMF_node(phys_to_nid(mfn_to_maddr(mfn)));
                 break;
+            }
+        }
         if ( n == CNT )
             continue;
         if ( (l1_pg = alloc_domheap_pages(NULL, PAGETABLE_ORDER,
-                                               memflags)) == NULL )
+                                          memflags)) == NULL )
             goto nomem;
         map_pages_to_xen(
             RDWR_COMPAT_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT),
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:44:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468616.727719 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SQH-0005Pd-9L; Thu, 22 Dec 2022 20:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468616.727719; Thu, 22 Dec 2022 20: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 1p8SQH-0005PW-6l; Thu, 22 Dec 2022 20:44:13 +0000
Received: by outflank-mailman (input) for mailman id 468616;
 Thu, 22 Dec 2022 20:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQG-0005PQ-H9
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQG-0007Vi-GL
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQG-0004Xd-EF
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EqJMsqkbYZD5QVk2kPZNH3HL/Q5oqSBHmE2Gm7v8U+g=; b=eu4IQXifyKm8oizJmghpP7swpZ
	cjHf6iIvOjZEbCGy0cD2Sfq+qO6X7m/lCChVOntv/tLCoYJjrE6H2N6BE7Jzgm6CS/u03kmf5p/jE
	nuoXEvzL04pMF4X2Ai1mkbqVKj/78ZiTX2eWA4tSPGiIrxjTTBvo9CmSJUjByUghK2Z4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/irq: do not release irq until all cleanup is done
Message-Id: <E1p8SQG-0004Xd-EF@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:44:12 +0000

commit 9cbc04a95f8a7f7cc27901211cbe19a42850c4ed
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Dec 20 13:43:04 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 13:43:04 2022 +0100

    x86/irq: do not release irq until all cleanup is done
    
    Current code in _clear_irq_vector() will mark the irq as unused before
    doing the cleanup required when move_in_progress is true.
    
    This can lead to races in create_irq() if the function picks an irq
    desc that's been marked as unused but has move_in_progress set, as the
    call to assign_irq_vector() in that function can then fail with
    -EAGAIN.
    
    Prevent that by only marking irq descs as unused when all the cleanup
    has been done.  While there also use write_atomic() when setting
    IRQ_UNUSED in _clear_irq_vector() and add a barrier in order to
    prevent the setting of IRQ_UNUSED getting reordered by the compiler.
    
    The check for move_in_progress cannot be removed from
    _assign_irq_vector(), as other users (io_apic_set_pci_routing() and
    ioapic_guest_write()) can still pass active irq descs to
    assign_irq_vector().
    
    Note the trace point is not moved and is now set before the irq is
    marked as unused.  This is done so that the CPU mask provided in the
    trace point is the one belonging to the current vector, not the old
    one.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: e267d11969a40f0aec33dbf966f5a6490b205f43
    master date: 2022-12-02 10:32:21 +0100
---
 xen/arch/x86/irq.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index cd0c8a30a8..20150b1c7f 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -220,27 +220,28 @@ static void _clear_irq_vector(struct irq_desc *desc)
         clear_bit(vector, desc->arch.used_vectors);
     }
 
-    desc->arch.used = IRQ_UNUSED;
-
     trace_irq_mask(TRC_HW_IRQ_CLEAR_VECTOR, irq, vector, tmp_mask);
 
-    if ( likely(!desc->arch.move_in_progress) )
-        return;
+    if ( unlikely(desc->arch.move_in_progress) )
+    {
+        /* If we were in motion, also clear desc->arch.old_vector */
+        old_vector = desc->arch.old_vector;
+        cpumask_and(tmp_mask, desc->arch.old_cpu_mask, &cpu_online_map);
 
-    /* If we were in motion, also clear desc->arch.old_vector */
-    old_vector = desc->arch.old_vector;
-    cpumask_and(tmp_mask, desc->arch.old_cpu_mask, &cpu_online_map);
+        for_each_cpu(cpu, tmp_mask)
+        {
+            ASSERT(per_cpu(vector_irq, cpu)[old_vector] == irq);
+            TRACE_3D(TRC_HW_IRQ_MOVE_FINISH, irq, old_vector, cpu);
+            per_cpu(vector_irq, cpu)[old_vector] = ~irq;
+        }
 
-    for_each_cpu(cpu, tmp_mask)
-    {
-        ASSERT(per_cpu(vector_irq, cpu)[old_vector] == irq);
-        TRACE_3D(TRC_HW_IRQ_MOVE_FINISH, irq, old_vector, cpu);
-        per_cpu(vector_irq, cpu)[old_vector] = ~irq;
-    }
+        release_old_vec(desc);
 
-    release_old_vec(desc);
+        desc->arch.move_in_progress = 0;
+    }
 
-    desc->arch.move_in_progress = 0;
+    smp_wmb();
+    write_atomic(&desc->arch.used, IRQ_UNUSED);
 }
 
 void __init clear_irq_vector(int irq)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:44:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468615.727715 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SQ8-0005OI-8M; Thu, 22 Dec 2022 20:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468615.727715; Thu, 22 Dec 2022 20:44:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SQ8-0005OA-52; Thu, 22 Dec 2022 20:44:04 +0000
Received: by outflank-mailman (input) for mailman id 468615;
 Thu, 22 Dec 2022 20:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQ6-0005O4-F8
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQ6-0007Va-C1
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQ6-0004XC-AU
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rmfzxb1968JHlR8YGeh3LedJfGvjwZcAy44pSsnzvG8=; b=H69+w0V3HXBAVUWHfR+XXmzkM3
	1Ji2UX61wWBfn/Bh1d5YPcj3cN4kuJiWHYaO6qkaewJ6YUvVHVREG0EBmC0KIaFZGvpYjagzLqe7h
	Cgru9nan4aAxrYyOEoYcQv3mpUfPtua7L5a2zG8s2nv6rdRdha9nwq9Dd1tgpIsbTLqo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] update Xen version to 4.17.1-pre
Message-Id: <E1p8SQ6-0004XC-AU@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:44:02 +0000

commit 0b999fa2eadaeff840a8331b87f1f73abf3b14eb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Dec 20 13:40:38 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 13:40:38 2022 +0100

    update Xen version to 4.17.1-pre
---
 MAINTAINERS  | 92 ++++++------------------------------------------------------
 xen/Makefile |  2 +-
 2 files changed, 10 insertions(+), 84 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 175f10f33f..ebb908cc37 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -54,6 +54,15 @@ list. Remember to copy the appropriate stable branch maintainer who
 will be listed in this section of the MAINTAINERS file in the
 appropriate branch.
 
+The maintainer for this branch is:
+
+	Jan Beulich <jbeulich@suse.com>
+
+Tools backport requests should also be copied to:
+
+       Anthony Perard <anthony.perard@citrix.com>
+
+
 	Unstable Subsystem Maintainers
 	==============================
 
@@ -104,89 +113,6 @@ Descriptions of section entries:
 	   xen-maintainers-<version format number of this file>
 
 
-	Check-in policy
-	===============
-
-In order for a patch to be checked in, in general, several conditions
-must be met:
-
-1. In order to get a change to a given file committed, it must have
-   the approval of at least one maintainer of that file.
-
-   A patch of course needs Acks from the maintainers of each file that
-   it changes; so a patch which changes xen/arch/x86/traps.c,
-   xen/arch/x86/mm/p2m.c, and xen/arch/x86/mm/shadow/multi.c would
-   require an Ack from each of the three sets of maintainers.
-
-   See below for rules on nested maintainership.
-
-2. It must have appropriate approval from someone other than the
-   submitter.  This can be either:
-
-  a. An Acked-by from a maintainer of the code being touched (a
-     co-maintainer if available, or a more general level maintainer if
-     not available; see the secton on nested maintainership)
-
-  b. A Reviewed-by by anyone of suitable stature in the community
-
-3. Sufficient time must have been given for anyone to respond.  This
-   depends in large part upon the urgency and nature of the patch.
-   For a straightforward uncontroversial patch, a day or two may be
-   sufficient; for a controversial patch, a week or two may be better.
-
-4. There must be no "open" objections.
-
-In a case where one person submits a patch and a maintainer gives an
-Ack, the Ack stands in for both the approval requirement (#1) and the
-Acked-by-non-submitter requirement (#2).
-
-In a case where a maintainer themselves submits a patch, the
-Signed-off-by meets the approval requirement (#1); so a Review
-from anyone in the community suffices for requirement #2.
-
-Before a maintainer checks in their own patch with another community
-member's R-b but no co-maintainer Ack, it is especially important to
-give their co-maintainer opportunity to give feedback, perhaps
-declaring their intention to check it in without their co-maintainers
-ack a day before doing so.
-
-Maintainers may choose to override non-maintainer objections in the
-case that consensus can't be reached.
-
-As always, no policy can cover all possible situations.  In
-exceptional circumstances, committers may commit a patch in absence of
-one or more of the above requirements, if they are reasonably
-confident that the other maintainers will approve of their decision in
-retrospect.
-
-       The meaning of nesting
-       ======================
-
-Many maintainership areas are "nested": for example, there are entries
-for xen/arch/x86 as well as xen/arch/x86/mm, and even
-xen/arch/x86/mm/shadow; and there is a section at the end called "THE
-REST" which lists all committers.  The meaning of nesting is that:
-
-1. Under normal circumstances, the Ack of the most specific maintainer
-is both necessary and sufficient to get a change to a given file
-committed.  So a change to xen/arch/x86/mm/shadow/multi.c requires the
-the Ack of the xen/arch/x86/mm/shadow maintainer for that part of the
-patch, but would not require the Ack of the xen/arch/x86 maintainer or
-the xen/arch/x86/mm maintainer.
-
-2. In unusual circumstances, a more general maintainer's Ack can stand
-in for or even overrule a specific maintainer's Ack.  Unusual
-circumstances might include:
- - The patch is fixing a high-priority issue causing immediate pain,
- and the more specific maintainer is not available.
- - The more specific maintainer has not responded either to the
- original patch, nor to "pings", within a reasonable amount of time.
- - The more general maintainer wants to overrule the more specific
- maintainer on some issue. (This should be exceptional.)
- - In the case of a disagreement between maintainers, THE REST can
- settle the matter by majority vote.  (This should be very exceptional
- indeed.)
-
 
 Maintainers List (try to look for most precise areas first)
 
diff --git a/xen/Makefile b/xen/Makefile
index d7102a3b47..dcedfbc38e 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    = 17
-export XEN_EXTRAVERSION ?= .0$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:44:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468619.727722 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SQR-0005Sf-D2; Thu, 22 Dec 2022 20:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468619.727722; Thu, 22 Dec 2022 20: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 1p8SQR-0005SX-AV; Thu, 22 Dec 2022 20:44:23 +0000
Received: by outflank-mailman (input) for mailman id 468619;
 Thu, 22 Dec 2022 20:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQQ-0005SP-K5
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQQ-0007WH-JF
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQQ-0004YB-Ia
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YJnCxgN9T/7smTSZ4YqqG5xHUnPhtjY1JarxZLVYjeQ=; b=0DB5E5LcNOivgiQ6C/jb/KGnie
	BpOeBDTmP33yfHzwnisM6eqw6ap3VNbqZWMWwMjbXcXXmDdiVkdjeOfeqnDpaWewkIsT+fSxRqvUr
	8IQi1P+qyOn9b0hV2Y59OUtkLVgqk2jXQHqmgW06ETe7uJ4BcZrEmKByLhPAPybfsr6A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/pvh: do not forward MADT Local APIC NMI structures to dom0
Message-Id: <E1p8SQQ-0004YB-Ia@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:44:22 +0000

commit b7b34bd66ac77326bb49b10130013b4a9f83e4a2
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Dec 20 13:43:37 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 13:43:37 2022 +0100

    x86/pvh: do not forward MADT Local APIC NMI structures to dom0
    
    Currently Xen will passthrough any Local APIC NMI Structure found in
    the native ACPI MADT table to a PVH dom0.  This is wrong because PVH
    doesn't have access to the physical local APIC, and instead gets an
    emulated local APIC by Xen, that doesn't have the LINT0 or LINT1
    pins wired to anything.  Furthermore the ACPI Processor UIDs used in
    the APIC NMI Structures are likely to not match the ones generated by
    Xen for the Local x2APIC Structures, creating confusion to dom0.
    
    Fix this by removing the logic to passthrough the Local APIC NMI
    Structure for PVH dom0.
    
    Fixes: 1d74282c45 ('x86: setup PVHv2 Dom0 ACPI tables')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b39e6385250ccef9509af0eab9003ad5c1478842
    master date: 2022-12-02 10:33:40 +0100
---
 xen/arch/x86/hvm/dom0_build.c | 34 +---------------------------------
 1 file changed, 1 insertion(+), 33 deletions(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 1864d048a1..3ac6b7b423 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -58,9 +58,6 @@
 static unsigned int __initdata acpi_intr_overrides;
 static struct acpi_madt_interrupt_override __initdata *intsrcovr;
 
-static unsigned int __initdata acpi_nmi_sources;
-static struct acpi_madt_nmi_source __initdata *nmisrc;
-
 static unsigned int __initdata order_stats[MAX_ORDER + 1];
 
 static void __init print_order_stats(const struct domain *d)
@@ -763,25 +760,6 @@ static int __init cf_check acpi_set_intr_ovr(
     return 0;
 }
 
-static int __init cf_check acpi_count_nmi_src(
-    struct acpi_subtable_header *header, const unsigned long end)
-{
-    acpi_nmi_sources++;
-    return 0;
-}
-
-static int __init cf_check acpi_set_nmi_src(
-    struct acpi_subtable_header *header, const unsigned long end)
-{
-    const struct acpi_madt_nmi_source *src =
-        container_of(header, struct acpi_madt_nmi_source, header);
-
-    *nmisrc = *src;
-    nmisrc++;
-
-    return 0;
-}
-
 static int __init pvh_setup_acpi_madt(struct domain *d, paddr_t *addr)
 {
     struct acpi_table_madt *madt;
@@ -797,16 +775,11 @@ static int __init pvh_setup_acpi_madt(struct domain *d, paddr_t *addr)
     acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE,
                           acpi_count_intr_ovr, UINT_MAX);
 
-    /* Count number of NMI sources in the MADT. */
-    acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_count_nmi_src,
-                          UINT_MAX);
-
     max_vcpus = dom0_max_vcpus();
     /* Calculate the size of the crafted MADT. */
     size = sizeof(*madt);
     size += sizeof(*io_apic) * nr_ioapics;
     size += sizeof(*intsrcovr) * acpi_intr_overrides;
-    size += sizeof(*nmisrc) * acpi_nmi_sources;
     size += sizeof(*x2apic) * max_vcpus;
 
     madt = xzalloc_bytes(size);
@@ -862,12 +835,7 @@ static int __init pvh_setup_acpi_madt(struct domain *d, paddr_t *addr)
     acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_set_intr_ovr,
                           acpi_intr_overrides);
 
-    /* Setup NMI sources. */
-    nmisrc = (void *)intsrcovr;
-    acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_set_nmi_src,
-                          acpi_nmi_sources);
-
-    ASSERT(((void *)nmisrc - (void *)madt) == size);
+    ASSERT(((void *)intsrcovr - (void *)madt) == size);
     madt->header.length = size;
     /*
      * Calling acpi_tb_checksum here is a layering violation, but
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:44:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468620.727727 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SQb-0005Vv-Eh; Thu, 22 Dec 2022 20:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468620.727727; Thu, 22 Dec 2022 20:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SQb-0005Vo-By; Thu, 22 Dec 2022 20:44:33 +0000
Received: by outflank-mailman (input) for mailman id 468620;
 Thu, 22 Dec 2022 20:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQa-0005Vg-NF
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQa-0007WY-MS
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQa-0004Yg-LV
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vPVCokktZnKvwyL6VidpZ+3SnTBsVylWJnJdQQP8lpo=; b=WLwsFt9c6iq+lX/WnDvOmpkGQg
	03MLw0acPI3NCECDoVkPJ+g3drZaZWGncogFhFwtqQ3ZrdznTfIgij0bQGY23dGpbOGZRYJdFIQAj
	1gan6dv2St3RWqsfBPtHMeJMycHwEkG6ndkaoo0y7JEaN61BfAeHf/5ZIL+MwAOfo8rY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/HVM: don't mark external IRQs as pending when vLAPIC is disabled
Message-Id: <E1p8SQa-0004Yg-LV@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:44:32 +0000

commit 54bb56e12868100c5ce06e33b4f57b6b2b8f37b9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Dec 20 13:44:07 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 13:44:07 2022 +0100

    x86/HVM: don't mark external IRQs as pending when vLAPIC is disabled
    
    In software-disabled state an LAPIC does not accept any interrupt
    requests and hence no IRR bit would newly become set while in this
    state. As a result it is also wrong for us to mark IO-APIC or MSI
    originating vectors as having a pending request when the vLAPIC is in
    this state. Such interrupts are simply lost.
    
    Introduce (IO-APIC) or re-use (MSI) a local variable to help
    readability.
    
    Fixes: 4fe21ad3712e ("This patch add virtual IOAPIC support for VMX guest")
    Fixes: 85715f4bc7c9 ("MSI 5/6: add MSI support to passthrough HVM domain")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: f1d7aac1e3c3cd164e17d41791a575a5c3e87121
    master date: 2022-12-02 10:35:01 +0100
---
 xen/arch/x86/hvm/vioapic.c |  9 +++++++--
 xen/arch/x86/hvm/vmsi.c    | 10 ++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index cb7f440160..41e3c4d5e4 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -460,9 +460,14 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
 
     case dest_Fixed:
         for_each_vcpu ( d, v )
-            if ( vlapic_match_dest(vcpu_vlapic(v), NULL, 0, dest, dest_mode) )
-                ioapic_inj_irq(vioapic, vcpu_vlapic(v), vector, trig_mode,
+        {
+            struct vlapic *vlapic = vcpu_vlapic(v);
+
+            if ( vlapic_enabled(vlapic) &&
+                 vlapic_match_dest(vlapic, NULL, 0, dest, dest_mode) )
+                ioapic_inj_irq(vioapic, vlapic, vector, trig_mode,
                                delivery_mode);
+        }
         break;
 
     case dest_NMI:
diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index 75f92885dc..3cd4923060 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -87,10 +87,12 @@ int vmsi_deliver(
 
     case dest_Fixed:
         for_each_vcpu ( d, v )
-            if ( vlapic_match_dest(vcpu_vlapic(v), NULL,
-                                   0, dest, dest_mode) )
-                vmsi_inj_irq(vcpu_vlapic(v), vector,
-                             trig_mode, delivery_mode);
+        {
+            target = vcpu_vlapic(v);
+            if ( vlapic_enabled(target) &&
+                 vlapic_match_dest(target, NULL, 0, dest, dest_mode) )
+                vmsi_inj_irq(target, vector, trig_mode, delivery_mode);
+        }
         break;
 
     default:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:44:43 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468621.727732 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SQl-0005Yu-H9; Thu, 22 Dec 2022 20:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468621.727732; Thu, 22 Dec 2022 20:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SQl-0005Yn-Dj; Thu, 22 Dec 2022 20:44:43 +0000
Received: by outflank-mailman (input) for mailman id 468621;
 Thu, 22 Dec 2022 20:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQk-0005Ye-RD
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQk-0007Wq-Pa
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQk-0004ZJ-Od
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WsnYz2tO4DnSKB9N2Hx5tLpcTk8WqTb9TbOHAR9aKPs=; b=uxvCQ/LQ8Pm8kigd3fKRSlCC9C
	VV9q22S8a1Cb0WnNdWd+3a8FQlRAnf96F/+kZYb+Quist9JUrcRp0QCCTatEIX+eSDF3ZiKYciSp3
	OLcVI8Jm2S7YdbcpP1gs99V+JEHMVmIX1fPNjwEH6RXD+hirf2X1HfxJustzVniHovQM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/Viridian: don't mark IRQ vectors as pending when vLAPIC is disabled
Message-Id: <E1p8SQk-0004ZJ-Od@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:44:42 +0000

commit 5810edc049cd5828c2628a377ca8443610e54f82
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Dec 20 13:44:38 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 13:44:38 2022 +0100

    x86/Viridian: don't mark IRQ vectors as pending when vLAPIC is disabled
    
    In software-disabled state an LAPIC does not accept any interrupt
    requests and hence no IRR bit would newly become set while in this
    state. As a result it is also wrong for us to mark Viridian IPI or timer
    vectors as having a pending request when the vLAPIC is in this state.
    Such interrupts are simply lost.
    
    Introduce a local variable in send_ipi() to help readability.
    
    Fixes: fda96b7382ea ("viridian: add implementation of the HvSendSyntheticClusterIpi hypercall")
    Fixes: 26fba3c85571 ("viridian: add implementation of synthetic timers")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    master commit: 831419f82913417dee4e5b0f80769c5db590540b
    master date: 2022-12-02 10:35:32 +0100
---
 xen/arch/x86/hvm/viridian/synic.c    | 2 +-
 xen/arch/x86/hvm/viridian/viridian.c | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index e18538c60a..856bb898b8 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -359,7 +359,7 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx,
     BUILD_BUG_ON(sizeof(payload) > sizeof(msg->u.payload));
     memcpy(msg->u.payload, &payload, sizeof(payload));
 
-    if ( !vs->masked )
+    if ( !vs->masked && vlapic_enabled(vcpu_vlapic(v)) )
         vlapic_set_irq(vcpu_vlapic(v), vs->vector, 0);
 
     return true;
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 25dca93e8b..2937ddd3a8 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -811,7 +811,12 @@ static void send_ipi(struct hypercall_vpmask *vpmask, uint8_t vector)
         cpu_raise_softirq_batch_begin();
 
     for_each_vp ( vpmask, vp )
-        vlapic_set_irq(vcpu_vlapic(currd->vcpu[vp]), vector, 0);
+    {
+        struct vlapic *vlapic = vcpu_vlapic(currd->vcpu[vp]);
+
+        if ( vlapic_enabled(vlapic) )
+            vlapic_set_irq(vlapic, vector, 0);
+    }
 
     if ( nr > 1 )
         cpu_raise_softirq_batch_finish();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:44:53 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468623.727735 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SQv-0005bR-Hz; Thu, 22 Dec 2022 20:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468623.727735; Thu, 22 Dec 2022 20: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 1p8SQv-0005bJ-FD; Thu, 22 Dec 2022 20:44:53 +0000
Received: by outflank-mailman (input) for mailman id 468623;
 Thu, 22 Dec 2022 20:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQu-0005bB-TR
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQu-0007XO-Si
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SQu-0004Zk-Rq
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ot/V9onU2BIqUKtg/cgGUk7Oi8NHSP31ElsNSvrpw68=; b=POt+uQ4taRdsxKy6vM3nFxZ96h
	BWj/caKBUyV3XAa3u/tKnE7PQdCte6hf+t7O0PDFzmgsYxQeDi7nXWKVoSK+nm3IUBcLjp5xMOd9b
	fajN7erCbcMaW9IRzgrI5tDwdBInNNQ5Od4oAELoRBHXx7FtxXhWHRqYVwUPgTjOdaYA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/HVM: don't mark evtchn upcall vector as pending when vLAPIC is disabled
Message-Id: <E1p8SQu-0004Zk-Rq@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:44:52 +0000

commit 26f39b3d705b667aa21f368c252abffb0b4d3e5d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Dec 20 13:45:07 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 13:45:07 2022 +0100

    x86/HVM: don't mark evtchn upcall vector as pending when vLAPIC is disabled
    
    Linux'es relatively new use of HVMOP_set_evtchn_upcall_vector has
    exposed a problem with the marking of the respective vector as
    pending: For quite some time Linux has been checking whether any stale
    ISR or IRR bits would still be set while preparing the LAPIC for use.
    This check is now triggering on the upcall vector, as the registration,
    at least for APs, happens before the LAPIC is actually enabled.
    
    In software-disabled state an LAPIC would not accept any interrupt
    requests and hence no IRR bit would newly become set while in this
    state. As a result it is also wrong for us to mark the upcall vector as
    having a pending request when the vLAPIC is in this state.
    
    To compensate for the "enabled" check added to the assertion logic, add
    logic to (conditionally) mark the upcall vector as having a request
    pending at the time the LAPIC is being software-enabled by the guest.
    Note however that, like for the pt_may_unmask_irq() we already have
    there, long term we may need to find a different solution. This will be
    especially relevant in case yet better LAPIC acceleration would
    eliminate notifications of guest writes to this and other registers.
    
    Fixes: 7b5b8ca7dffd ("x86/upcall: inject a spurious event after setting upcall vector")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: f5d0279839b58cb622f0995dbf9cff056f03082e
    master date: 2022-12-06 13:51:49 +0100
---
 xen/arch/x86/hvm/irq.c    | 5 +++--
 xen/arch/x86/hvm/vlapic.c | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 858ab5b248..d93ffe4546 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -321,9 +321,10 @@ void hvm_assert_evtchn_irq(struct vcpu *v)
 
     if ( v->arch.hvm.evtchn_upcall_vector != 0 )
     {
-        uint8_t vector = v->arch.hvm.evtchn_upcall_vector;
+        struct vlapic *vlapic = vcpu_vlapic(v);
 
-        vlapic_set_irq(vcpu_vlapic(v), vector, 0);
+        if ( vlapic_enabled(vlapic) )
+           vlapic_set_irq(vlapic, v->arch.hvm.evtchn_upcall_vector, 0);
     }
     else if ( is_hvm_pv_evtchn_domain(v->domain) )
         vcpu_kick(v);
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 257d3b6851..eb32f12e2d 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -829,6 +829,9 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val)
         {
             vlapic->hw.disabled &= ~VLAPIC_SW_DISABLED;
             pt_may_unmask_irq(vlapic_domain(vlapic), &vlapic->pt);
+            if ( v->arch.hvm.evtchn_upcall_vector &&
+                 vcpu_info(v, evtchn_upcall_pending) )
+                vlapic_set_irq(vlapic, v->arch.hvm.evtchn_upcall_vector, 0);
         }
         break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:45:03 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468624.727739 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SR5-0005gu-LT; Thu, 22 Dec 2022 20:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468624.727739; Thu, 22 Dec 2022 20: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 1p8SR5-0005gn-IM; Thu, 22 Dec 2022 20:45:03 +0000
Received: by outflank-mailman (input) for mailman id 468624;
 Thu, 22 Dec 2022 20:45:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SR5-0005ga-0E
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SR4-0007Xz-Vh
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SR4-0004aU-Ux
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Kv3SZLgCs8cVuvfvijI8GIcO0+ubBGf29tyVDdCwUe0=; b=hei+5XWOrfwH678aFc/1La9b8d
	ssFBWKd4umSgdByKkhhTfi/VIBm8G1EmfFf/y+rrQEWnZOl2ay3+KRVFTbWHP+z7yLFlv/9ZCgkNh
	lffAfAFoYe3z/V2UdjvTuyoBhRmfd84+MCnQLJlFMV5GH16T3iZphZjHrtW65EnPEcWw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] ioreq_broadcast(): accept partial broadcast success
Message-Id: <E1p8SR4-0004aU-Ux@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:45:02 +0000

commit c3e37c60fbf8f8cd71db0f0846c9c7aeadf02963
Author:     Per Bilse <per.bilse@citrix.com>
AuthorDate: Tue Dec 20 13:45:38 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 13:45:38 2022 +0100

    ioreq_broadcast(): accept partial broadcast success
    
    Avoid incorrectly triggering an error when a broadcast buffered ioreq
    is not handled by all registered clients, as long as the failure is
    strictly because the client doesn't handle buffered ioreqs.
    
    Signed-off-by: Per Bilse <per.bilse@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    master commit: a44734df6c24fadbdb001f051cc5580c467caf7d
    master date: 2022-12-07 12:17:30 +0100
---
 xen/common/ioreq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c
index 4617aef29b..ecb8f545e1 100644
--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -1317,7 +1317,8 @@ unsigned int ioreq_broadcast(ioreq_t *p, bool buffered)
 
     FOR_EACH_IOREQ_SERVER(d, id, s)
     {
-        if ( !s->enabled )
+        if ( !s->enabled ||
+             (buffered && s->bufioreq_handling == HVM_IOREQSRV_BUFIOREQ_OFF) )
             continue;
 
         if ( ioreq_send(s, p, buffered) == IOREQ_STATUS_UNHANDLED )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:45:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468625.727744 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SRF-0005jP-O3; Thu, 22 Dec 2022 20:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468625.727744; Thu, 22 Dec 2022 20: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 1p8SRF-0005jH-KL; Thu, 22 Dec 2022 20:45:13 +0000
Received: by outflank-mailman (input) for mailman id 468625;
 Thu, 22 Dec 2022 20:45:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRF-0005j7-3W
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRF-0007YE-2i
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRF-0004ax-1s
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QjOJhUT++lcT6YDDW8Vt9m1MhGefH+mGf5r7Zw9CRYY=; b=3FFh4jpT0FT236PGGvCXGQKyoH
	PzqxJ6ZqhtJ4Vm1d7Bjos7A0kVSw4N9Gt/Je65DpyAenN0JS/f9tDQlVetda9fwXxjHjXc6pG3MOB
	Zqus7/tJW4JW+9A1cZh+Mrxv1l5J8s0u8H0h84fd18fPXsHqABVmtaMGJjkZ7UBaWR58=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] EFI: relocate the ESRT when booting via multiboot2
Message-Id: <E1p8SRF-0004ax-1s@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:45:13 +0000

commit 1dcc9b6dfe528c7815a314f9b5581804b5e23750
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Dec 20 13:46:09 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 13:46:09 2022 +0100

    EFI: relocate the ESRT when booting via multiboot2
    
    This was missed in the initial patchset.
    
    Move efi_relocate_esrt() up to avoid adding a forward declaration.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 8d7acf3f7d8d2555c78421dced45bc49f79ae806
    master date: 2022-12-14 12:00:35 +0100
---
 xen/arch/x86/efi/efi-boot.h |   2 +
 xen/common/efi/boot.c       | 136 ++++++++++++++++++++++----------------------
 2 files changed, 70 insertions(+), 68 deletions(-)

diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 27f928ed3c..c94e53d139 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -823,6 +823,8 @@ void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable
     if ( gop )
         efi_set_gop_mode(gop, gop_mode);
 
+    efi_relocate_esrt(SystemTable);
+
     efi_exit_boot(ImageHandle, SystemTable);
 }
 
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index b3de1011ee..d3c6b055ae 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -625,6 +625,74 @@ static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc)
     return esrt_ptr->FwResourceCount * sizeof(esrt_ptr->Entries[0]);
 }
 
+static EFI_GUID __initdata esrt_guid = EFI_SYSTEM_RESOURCE_TABLE_GUID;
+
+static void __init efi_relocate_esrt(EFI_SYSTEM_TABLE *SystemTable)
+{
+    EFI_STATUS status;
+    UINTN info_size = 0, map_key, mdesc_size;
+    void *memory_map = NULL;
+    UINT32 ver;
+    unsigned int i;
+
+    for ( ; ; )
+    {
+        status = efi_bs->GetMemoryMap(&info_size, memory_map, &map_key,
+                                      &mdesc_size, &ver);
+        if ( status == EFI_SUCCESS && memory_map != NULL )
+            break;
+        if ( status == EFI_BUFFER_TOO_SMALL || memory_map == NULL )
+        {
+            info_size += 8 * mdesc_size;
+            if ( memory_map != NULL )
+                efi_bs->FreePool(memory_map);
+            memory_map = NULL;
+            status = efi_bs->AllocatePool(EfiLoaderData, info_size, &memory_map);
+            if ( status == EFI_SUCCESS )
+                continue;
+            PrintErr(L"Cannot allocate memory to relocate ESRT\r\n");
+        }
+        else
+            PrintErr(L"Cannot obtain memory map to relocate ESRT\r\n");
+        return;
+    }
+
+    /* Try to obtain the ESRT.  Errors are not fatal. */
+    for ( i = 0; i < info_size; i += mdesc_size )
+    {
+        /*
+         * ESRT needs to be moved to memory of type EfiACPIReclaimMemory
+         * so that the memory it is in will not be used for other purposes.
+         */
+        void *new_esrt = NULL;
+        const EFI_MEMORY_DESCRIPTOR *desc = memory_map + i;
+        size_t esrt_size = get_esrt_size(desc);
+
+        if ( !esrt_size )
+            continue;
+        if ( desc->Type == EfiRuntimeServicesData ||
+             desc->Type == EfiACPIReclaimMemory )
+            break; /* ESRT already safe from reuse */
+        status = efi_bs->AllocatePool(EfiACPIReclaimMemory, esrt_size,
+                                      &new_esrt);
+        if ( status == EFI_SUCCESS && new_esrt )
+        {
+            memcpy(new_esrt, (void *)esrt, esrt_size);
+            status = efi_bs->InstallConfigurationTable(&esrt_guid, new_esrt);
+            if ( status != EFI_SUCCESS )
+            {
+                PrintErr(L"Cannot install new ESRT\r\n");
+                efi_bs->FreePool(new_esrt);
+            }
+        }
+        else
+            PrintErr(L"Cannot allocate memory for ESRT\r\n");
+        break;
+    }
+
+    efi_bs->FreePool(memory_map);
+}
+
 /*
  * Include architecture specific implementation here, which references the
  * static globals defined above.
@@ -903,8 +971,6 @@ static UINTN __init efi_find_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
     return gop_mode;
 }
 
-static EFI_GUID __initdata esrt_guid = EFI_SYSTEM_RESOURCE_TABLE_GUID;
-
 static void __init efi_tables(void)
 {
     unsigned int i;
@@ -1113,72 +1179,6 @@ static void __init efi_set_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UINTN gop
 #define INVALID_VIRTUAL_ADDRESS (0xBAAADUL << \
                                  (EFI_PAGE_SHIFT + BITS_PER_LONG - 32))
 
-static void __init efi_relocate_esrt(EFI_SYSTEM_TABLE *SystemTable)
-{
-    EFI_STATUS status;
-    UINTN info_size = 0, map_key, mdesc_size;
-    void *memory_map = NULL;
-    UINT32 ver;
-    unsigned int i;
-
-    for ( ; ; )
-    {
-        status = efi_bs->GetMemoryMap(&info_size, memory_map, &map_key,
-                                      &mdesc_size, &ver);
-        if ( status == EFI_SUCCESS && memory_map != NULL )
-            break;
-        if ( status == EFI_BUFFER_TOO_SMALL || memory_map == NULL )
-        {
-            info_size += 8 * mdesc_size;
-            if ( memory_map != NULL )
-                efi_bs->FreePool(memory_map);
-            memory_map = NULL;
-            status = efi_bs->AllocatePool(EfiLoaderData, info_size, &memory_map);
-            if ( status == EFI_SUCCESS )
-                continue;
-            PrintErr(L"Cannot allocate memory to relocate ESRT\r\n");
-        }
-        else
-            PrintErr(L"Cannot obtain memory map to relocate ESRT\r\n");
-        return;
-    }
-
-    /* Try to obtain the ESRT.  Errors are not fatal. */
-    for ( i = 0; i < info_size; i += mdesc_size )
-    {
-        /*
-         * ESRT needs to be moved to memory of type EfiACPIReclaimMemory
-         * so that the memory it is in will not be used for other purposes.
-         */
-        void *new_esrt = NULL;
-        const EFI_MEMORY_DESCRIPTOR *desc = memory_map + i;
-        size_t esrt_size = get_esrt_size(desc);
-
-        if ( !esrt_size )
-            continue;
-        if ( desc->Type == EfiRuntimeServicesData ||
-             desc->Type == EfiACPIReclaimMemory )
-            break; /* ESRT already safe from reuse */
-        status = efi_bs->AllocatePool(EfiACPIReclaimMemory, esrt_size,
-                                      &new_esrt);
-        if ( status == EFI_SUCCESS && new_esrt )
-        {
-            memcpy(new_esrt, (void *)esrt, esrt_size);
-            status = efi_bs->InstallConfigurationTable(&esrt_guid, new_esrt);
-            if ( status != EFI_SUCCESS )
-            {
-                PrintErr(L"Cannot install new ESRT\r\n");
-                efi_bs->FreePool(new_esrt);
-            }
-        }
-        else
-            PrintErr(L"Cannot allocate memory for ESRT\r\n");
-        break;
-    }
-
-    efi_bs->FreePool(memory_map);
-}
-
 static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
 {
     EFI_STATUS status;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:45:24 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:45:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468626.727748 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SRP-0005me-Pu; Thu, 22 Dec 2022 20:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468626.727748; Thu, 22 Dec 2022 20: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 1p8SRP-0005mW-Lu; Thu, 22 Dec 2022 20:45:23 +0000
Received: by outflank-mailman (input) for mailman id 468626;
 Thu, 22 Dec 2022 20:45:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRP-0005mN-6V
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRP-0007YQ-5q
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRP-0004bM-5A
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zkECMRUcsxTxIyom6UKjwbpgiqSj6m06n7plnaZx2bU=; b=c3IBLYvDYJmZFVwcm+UGsf8OM7
	nw5V4S6ibGZhNHfKq5dZEKLHJnyPq2vK2FRJ/OCub/jXVirqXPsYjC6p54LLpI5B7eWvck01G8Wo+
	mFdsgPGJ3UDkG/cpMmDznmHOUHRjuzKdulqOsiLKY9z6InTi4SYootM/hXi49Div9b5w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/time: prevent overflow with high frequency TSCs
Message-Id: <E1p8SRP-0004bM-5A@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:45:23 +0000

commit a7a26da0b59da7233e6c6f63b180bab131398351
Author:     Neowutran <xen@neowutran.ovh>
AuthorDate: Tue Dec 20 13:46:38 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 13:46:38 2022 +0100

    x86/time: prevent overflow with high frequency TSCs
    
    Make sure tsc_khz is promoted to a 64-bit type before multiplying by
    1000 to avoid an 'overflow before widen' bug. Otherwise just above
    4.294GHz the value will overflow. Processors with clocks this high are
    now in production and require this to work correctly.
    
    Signed-off-by: Neowutran <xen@neowutran.ovh>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: ad15a0a8ca2515d8ac58edfc0bc1d3719219cb77
    master date: 2022-12-19 11:34:16 +0100
---
 xen/arch/x86/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index b01acd390d..d882b43cf0 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -2585,7 +2585,7 @@ int tsc_set_info(struct domain *d,
     case TSC_MODE_ALWAYS_EMULATE:
         d->arch.vtsc_offset = get_s_time() - elapsed_nsec;
         d->arch.tsc_khz = gtsc_khz ?: cpu_khz;
-        set_time_scale(&d->arch.vtsc_to_ns, d->arch.tsc_khz * 1000);
+        set_time_scale(&d->arch.vtsc_to_ns, d->arch.tsc_khz * 1000UL);
 
         /*
          * In default mode use native TSC if the host has safe TSC and
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:45:34 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:45:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468627.727753 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SRa-0005pR-R6; Thu, 22 Dec 2022 20:45:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468627.727753; Thu, 22 Dec 2022 20: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 1p8SRa-0005pJ-NV; Thu, 22 Dec 2022 20:45:34 +0000
Received: by outflank-mailman (input) for mailman id 468627;
 Thu, 22 Dec 2022 20:45:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRZ-0005p3-9m
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRZ-0007Yd-90
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRZ-0004bt-82
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QrTzDViNXaSxRcXOZhqH5lP+VrXrstyzebWZnnlovUo=; b=o2kSomFed0z1GTZCy8y8NUb+Z+
	vZYjVXg+UdAAVrsbix2Fi9VQmOuvrnSqyKHvVwubL+jvmF9oay1/umywgVT88HG/Btu3gBy0ETQLj
	3NkozMjJt89xQw7bylzsLLgv6GyrBsKa1D1BTeqWIfqtSpq4dGK3ULXk3y1UA1Ap1cn8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/oxenstored: Fix incorrect scope after an if statement
Message-Id: <E1p8SRZ-0004bt-82@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:45:33 +0000

commit 2e8d7a08bcd111fe21569e9ace1a047df76da949
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 11 18:50:34 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/oxenstored: Fix incorrect scope after an if statement
    
    A debug statement got inserted into a single-expression if statement.
    
    Insert brackets to give the intended meaning, rather than the actual meaning
    where the "let con = Connections..." is outside and executed unconditionally.
    
    This results in some unnecessary ring checks for domains which otherwise have
    IO credit.
    
    Fixes: 42f0581a91d4 ("tools/oxenstored: Implement live update for socket connections")
    Reported-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit ee36179371fd4215a43fb179be2165f65c1cd1cd)
---
 tools/ocaml/xenstored/xenstored.ml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index ffd43a4eee..c5dc7a28d0 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -475,7 +475,7 @@ let _ =
 
 	let ring_scan_checker dom =
 		(* no need to scan domains already marked as for processing *)
-		if not (Domain.get_io_credit dom > 0) then
+		if not (Domain.get_io_credit dom > 0) then (
 			debug "Looking up domid %d" (Domain.get_id dom);
 			let con = Connections.find_domain cons (Domain.get_id dom) in
 			if not (Connection.has_more_work con) then (
@@ -490,7 +490,8 @@ let _ =
 					let n = 32 + 2 * (Domains.number domains) in
 					info "found lazy domain %d, credit %d" (Domain.get_id dom) n;
 					Domain.set_io_credit ~n dom
-			) in
+			)
+		) in
 
 	let last_stat_time = ref 0. in
 	let last_scan_time = ref 0. in
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:45:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:45:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468628.727754 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SRk-0005s8-Rp; Thu, 22 Dec 2022 20:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468628.727754; Thu, 22 Dec 2022 20:45:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SRk-0005s1-P8; Thu, 22 Dec 2022 20:45:44 +0000
Received: by outflank-mailman (input) for mailman id 468628;
 Thu, 22 Dec 2022 20:45:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRj-0005rq-DQ
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRj-0007Yq-Cl
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRj-0004cP-BB
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KgyO4JI0IGURSjLhChEt9e2m/vVB+XY7myHKGrydN5o=; b=CilwagRI6RKeHQGRVLXsASlNIZ
	JJyPUlOP+Z2MiwZEAZvx4LocOgndI1OGLhEWP6P19Iy/KOcMwZN8kcAHF4326OK0q4Y9k2idPI2AI
	e8JtquaRZdQTH+OyQeRAkooy47IqNmCqSyRaEnCB7KSqvWnx9ICBIbG1yugTqdGtijPI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak
Message-Id: <E1p8SRj-0004cP-BB@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:45:43 +0000

commit d11528a993f80c6a86f4cb0c30578c026348e3e4
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Jan 18 15:04:48 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak
    
    There is no binding for xenevtchn_close().  In principle, this is a resource
    leak, but the typical usage is as a singleton that lives for the lifetime of
    the program.
    
    Ocaml 5 no longer permits storing a naked C pointer in an Ocaml value.
    
    Therefore, use a Custom block.  This allows us to use the finaliser callback
    to call xenevtchn_close(), if the Ocaml object goes out of scope.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 22d5affdf0cecfa6faae46fbaec68b8018835220)
---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index f889a7a2e4..37f1cc4e14 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -33,7 +33,22 @@
 #include <caml/fail.h>
 #include <caml/signals.h>
 
-#define _H(__h) ((xenevtchn_handle *)(__h))
+#define _H(__h) (*((xenevtchn_handle **)Data_custom_val(__h)))
+
+static void stub_evtchn_finalize(value v)
+{
+	xenevtchn_close(_H(v));
+}
+
+static struct custom_operations xenevtchn_ops = {
+	.identifier  = "xenevtchn",
+	.finalize    = stub_evtchn_finalize,
+	.compare     = custom_compare_default,     /* Can't compare     */
+	.hash        = custom_hash_default,        /* Can't hash        */
+	.serialize   = custom_serialize_default,   /* Can't serialize   */
+	.deserialize = custom_deserialize_default, /* Can't deserialize */
+	.compare_ext = custom_compare_ext_default, /* Can't compare     */
+};
 
 CAMLprim value stub_eventchn_init(void)
 {
@@ -48,7 +63,9 @@ CAMLprim value stub_eventchn_init(void)
 	if (xce == NULL)
 		caml_failwith("open failed");
 
-	result = (value)xce;
+	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
+	_H(result) = xce;
+
 	CAMLreturn(result);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:45:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:45:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468629.727759 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SRu-0005v4-TY; Thu, 22 Dec 2022 20:45:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468629.727759; Thu, 22 Dec 2022 20:45:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SRu-0005uw-Qf; Thu, 22 Dec 2022 20:45:54 +0000
Received: by outflank-mailman (input) for mailman id 468629;
 Thu, 22 Dec 2022 20:45:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRt-0005uh-Gb
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRt-0007ZC-Fm
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SRt-0004cr-Ez
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:45:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5HC1oCADjU4bUzKQyE6DOzJDGGpwaj9ORU93PnTwB1w=; b=TFSnJdXOanPox1cXsLs7KOVPqr
	YOA5KGhiJFjzjYHa4+CPpz7tsUDtF5LRHIb6huDnIw34JnkTG3CTqIUfcEcs9W3cHIJW5mKGYB7NB
	fb0HTmsKBuSFyNjRQkiQv7U0hyQPlDb3cQbReyVCPtOwrxP7qP6US5h5iMAdrHpVhjCw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/evtchn: Add binding for xenevtchn_fdopen()
Message-Id: <E1p8SRt-0004cr-Ez@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:45:53 +0000

commit 24d9dc2ae2f88249fcf81f7b7e612cdfb7c73e4b
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Mon Nov 14 13:36:19 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/ocaml/evtchn: Add binding for xenevtchn_fdopen()
    
    For live update, the new oxenstored needs to reconstruct an evtchn object
    around an existing file descriptor.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 7ba68a6c558e1fd811c95cb7215a5cd07a3cc2ea)
---
 tools/ocaml/libs/eventchn/xeneventchn.ml      |  1 +
 tools/ocaml/libs/eventchn/xeneventchn.mli     |  4 ++++
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 19 +++++++++++++++++++
 3 files changed, 24 insertions(+)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn.ml b/tools/ocaml/libs/eventchn/xeneventchn.ml
index dd00a1f0ea..be4de82f46 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn.ml
+++ b/tools/ocaml/libs/eventchn/xeneventchn.ml
@@ -17,6 +17,7 @@
 type handle
 
 external init: unit -> handle = "stub_eventchn_init"
+external fdopen: Unix.file_descr -> handle = "stub_eventchn_fdopen"
 external fd: handle -> Unix.file_descr = "stub_eventchn_fd"
 
 type t = int
diff --git a/tools/ocaml/libs/eventchn/xeneventchn.mli b/tools/ocaml/libs/eventchn/xeneventchn.mli
index 08c7337643..98b3c86f37 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn.mli
+++ b/tools/ocaml/libs/eventchn/xeneventchn.mli
@@ -47,6 +47,10 @@ val init: unit -> handle
 (** Return an initialised event channel interface. On error it
     will throw a Failure exception. *)
 
+val fdopen: Unix.file_descr -> handle
+(** Return an initialised event channel interface, from an already open evtchn
+    file descriptor.  On error it will throw a Failure exception. *)
+
 val fd: handle -> Unix.file_descr
 (** Return a file descriptor suitable for Unix.select. When
     the descriptor becomes readable, it is safe to call 'pending'.
diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index 37f1cc4e14..7bdf711bc1 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -69,6 +69,25 @@ CAMLprim value stub_eventchn_init(void)
 	CAMLreturn(result);
 }
 
+CAMLprim value stub_eventchn_fdopen(value fdval)
+{
+	CAMLparam1(fdval);
+	CAMLlocal1(result);
+	xenevtchn_handle *xce;
+
+	caml_enter_blocking_section();
+	xce = xenevtchn_fdopen(NULL, Int_val(fdval), 0);
+	caml_leave_blocking_section();
+
+	if (xce == NULL)
+		caml_failwith("evtchn fdopen failed");
+
+	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
+	_H(result) = xce;
+
+	CAMLreturn(result);
+}
+
 CAMLprim value stub_eventchn_fd(value xce)
 {
 	CAMLparam1(xce);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:46:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:46:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468630.727763 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SS4-0005xS-V8; Thu, 22 Dec 2022 20:46:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468630.727763; Thu, 22 Dec 2022 20:46:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SS4-0005xK-SH; Thu, 22 Dec 2022 20:46:04 +0000
Received: by outflank-mailman (input) for mailman id 468630;
 Thu, 22 Dec 2022 20:46:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SS3-0005x8-KE
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SS3-0007ZT-JV
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SS3-0004db-Hw
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c+1doPgVSBmsiOfK5GeyHCrKTSLCrv7vTQE9sdRXxCQ=; b=2a9KO56GKkK8b4O15i6qbFh2on
	ak8QyJWC9zkCBiHMVo7Q7qgI7Wa/bwURpH01tM+WUeo8cR7Xa81GSGj51ZVM87gjNEx5nz3TQr9Wc
	AmG5lNMY0YNKRuHueOuWy8j5WTtrLpzkrle2c+gnnbnjtgBPOKqW75OIw8CnI4tKrVKs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/evtchn: Extend the init() binding with a cloexec flag
Message-Id: <E1p8SS3-0004db-Hw@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:46:03 +0000

commit c7cf603836e40de1b4a6ca7d1d52736eb4a10327
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Thu Nov 3 14:50:38 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/ocaml/evtchn: Extend the init() binding with a cloexec flag
    
    For live update, oxenstored wants to clear CLOEXEC on the evtchn handle, so it
    survives the execve() into the new oxenstored.
    
    Have the new interface match how cloexec works in other Ocaml standard
    libraries.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 9bafe4a53306e7aa2ce6ffc96f7477c6f329f7a7)
---
 tools/ocaml/libs/eventchn/xeneventchn.ml      |  5 ++++-
 tools/ocaml/libs/eventchn/xeneventchn.mli     |  9 ++++++---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 10 +++++++---
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn.ml b/tools/ocaml/libs/eventchn/xeneventchn.ml
index be4de82f46..c16fdd4674 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn.ml
+++ b/tools/ocaml/libs/eventchn/xeneventchn.ml
@@ -16,7 +16,10 @@
 
 type handle
 
-external init: unit -> handle = "stub_eventchn_init"
+external _init: bool -> handle = "stub_eventchn_init"
+
+let init ?(cloexec=true) () = _init cloexec
+
 external fdopen: Unix.file_descr -> handle = "stub_eventchn_fdopen"
 external fd: handle -> Unix.file_descr = "stub_eventchn_fd"
 
diff --git a/tools/ocaml/libs/eventchn/xeneventchn.mli b/tools/ocaml/libs/eventchn/xeneventchn.mli
index 98b3c86f37..870429b6b5 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn.mli
+++ b/tools/ocaml/libs/eventchn/xeneventchn.mli
@@ -43,9 +43,12 @@ val to_int: t -> int
 
 val of_int: int -> t
 
-val init: unit -> handle
-(** Return an initialised event channel interface. On error it
-    will throw a Failure exception. *)
+val init: ?cloexec:bool -> unit -> handle
+(** [init ?cloexec ()]
+    Return an initialised event channel interface.
+    The default is to close the underlying file descriptor
+    on [execve], which can be overriden with [~cloexec:false].
+    On error it will throw a Failure exception. *)
 
 val fdopen: Unix.file_descr -> handle
 (** Return an initialised event channel interface, from an already open evtchn
diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index 7bdf711bc1..aa8a69cc1e 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -50,14 +50,18 @@ static struct custom_operations xenevtchn_ops = {
 	.compare_ext = custom_compare_ext_default, /* Can't compare     */
 };
 
-CAMLprim value stub_eventchn_init(void)
+CAMLprim value stub_eventchn_init(value cloexec)
 {
-	CAMLparam0();
+	CAMLparam1(cloexec);
 	CAMLlocal1(result);
 	xenevtchn_handle *xce;
+	unsigned int flags = 0;
+
+	if ( !Bool_val(cloexec) )
+		flags |= XENEVTCHN_NO_CLOEXEC;
 
 	caml_enter_blocking_section();
-	xce = xenevtchn_open(NULL, 0);
+	xce = xenevtchn_open(NULL, flags);
 	caml_leave_blocking_section();
 
 	if (xce == NULL)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:46:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:46:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468631.727767 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SSF-00060w-27; Thu, 22 Dec 2022 20:46:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468631.727767; Thu, 22 Dec 2022 20:46: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 1p8SSE-00060i-VO; Thu, 22 Dec 2022 20:46:14 +0000
Received: by outflank-mailman (input) for mailman id 468631;
 Thu, 22 Dec 2022 20:46:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSD-00060V-N5
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSD-0007ZZ-MR
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSD-0004e0-Le
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hiWJ09jPW/nB5u5YEAgpvEzcoTB/o8WfA+BGOSv/8Hk=; b=0dPHWI0unzkaauJVuMTGpDE+8R
	dp5cITX0IAW36w+8Z0gGIuxuxYb1sneYLxyCdnEaFQNmGOt6crRPH/Cybi/Elib+zgssAv0H0Mz+L
	1oXCrs781fjHceKXsvM1pNMTd6zIzSb9abnuBslzYxXmxYQAKXHpQ7TnmSmQETl4k5sU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/oxenstored: Style fixes to Domain
Message-Id: <E1p8SSD-0004e0-Le@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:46:13 +0000

commit 0929960173bc76b8d90df73c8ee665747c233e18
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 30 14:56:43 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/oxenstored: Style fixes to Domain
    
    This file has some style problems so severe that they interfere with the
    readability of the subsequent bugfix patches.
    
    Fix these issues ahead of time, to make the subsequent changes more readable.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit b45bfaf359e4821b1bf98a4fcd194d7fd176f167)
---
 tools/ocaml/xenstored/domain.ml | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index 81cb59b8f1..ab08dcf37f 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -57,17 +57,16 @@ let is_paused_for_conflict dom = dom.conflict_credit <= 0.0
 let is_free_to_conflict = is_dom0
 
 let string_of_port = function
-| None -> "None"
-| Some x -> string_of_int (Xeneventchn.to_int x)
+	| None -> "None"
+	| Some x -> string_of_int (Xeneventchn.to_int x)
 
 let dump d chan =
 	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
 
-let notify dom = match dom.port with
-| None ->
-	warn "domain %d: attempt to notify on unknown port" dom.id
-| Some port ->
-	Event.notify dom.eventchn port
+let notify dom =
+	match dom.port with
+	| None -> warn "domain %d: attempt to notify on unknown port" dom.id
+	| Some port -> Event.notify dom.eventchn port
 
 let bind_interdomain dom =
 	begin match dom.port with
@@ -84,8 +83,7 @@ let close dom =
 	| None -> ()
 	| Some port -> Event.unbind dom.eventchn port
 	end;
-	Xenmmap.unmap dom.interface;
-	()
+	Xenmmap.unmap dom.interface
 
 let make id mfn remote_port interface eventchn = {
 	id = id;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:46:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:46:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468632.727771 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SSP-00063a-3S; Thu, 22 Dec 2022 20:46:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468632.727771; Thu, 22 Dec 2022 20:46: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 1p8SSP-00063Q-0l; Thu, 22 Dec 2022 20:46:25 +0000
Received: by outflank-mailman (input) for mailman id 468632;
 Thu, 22 Dec 2022 20:46:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSN-00063G-Q4
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSN-0007jb-PO
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSN-0004eP-OZ
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RWxI0QiQgKYGLvyn784J/n3zGD1BEa5hcdpUynWZmcA=; b=FWffixX5gN4mEtpZ3Q8mKqK5wy
	vnOFCN7cCrLqoMjvsm41cRBbs4NHhUwksR0nIdTo4n7/BBc/UIRPXpoPMwpe2uup48EZy30RsuRj2
	r0IJG4Z420la788hv/AdQPet54hJZwtSxyGqxsaLcJ5fkgjW/6t8sQfE2KhfRNiqRXBw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/oxenstored: Bind the DOM_EXC VIRQ in in Event.init()
Message-Id: <E1p8SSN-0004eP-OZ@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:46:23 +0000

commit bc5cc00868ea29d814bb3d783e28b49d1acf63e9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Nov 29 21:05:43 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/oxenstored: Bind the DOM_EXC VIRQ in in Event.init()
    
    Xenstored always needs to bind the DOM_EXC VIRQ.
    
    Instead of doing it shortly after the call to Event.init(), do it in the
    constructor directly.  This removes the need for the field to be a mutable
    option.
    
    It will also simplify a future change to support live update.  Rename the
    field from virq_port (which could be any VIRQ) to it's proper name.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 9804a5db435fe40c8ded8cf36c2d2b2281c56f1d)
---
 tools/ocaml/xenstored/event.ml     | 9 ++++++---
 tools/ocaml/xenstored/xenstored.ml | 4 +---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/ocaml/xenstored/event.ml b/tools/ocaml/xenstored/event.ml
index ccca90b6fc..a3be296374 100644
--- a/tools/ocaml/xenstored/event.ml
+++ b/tools/ocaml/xenstored/event.ml
@@ -17,12 +17,15 @@
 (**************** high level binding ****************)
 type t = {
 	handle: Xeneventchn.handle;
-	mutable virq_port: Xeneventchn.t option;
+	domexc: Xeneventchn.t;
 }
 
-let init () = { handle = Xeneventchn.init (); virq_port = None; }
+let init () =
+	let handle = Xeneventchn.init () in
+	let domexc = Xeneventchn.bind_dom_exc_virq handle in
+	{ handle; domexc }
+
 let fd eventchn = Xeneventchn.fd eventchn.handle
-let bind_dom_exc_virq eventchn = eventchn.virq_port <- Some (Xeneventchn.bind_dom_exc_virq eventchn.handle)
 let bind_interdomain eventchn domid port = Xeneventchn.bind_interdomain eventchn.handle domid port
 let unbind eventchn port = Xeneventchn.unbind eventchn.handle port
 let notify eventchn port = Xeneventchn.notify eventchn.handle port
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index c5dc7a28d0..55071b49ec 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -397,7 +397,6 @@ let _ =
 	if cf.restart && Sys.file_exists Disk.xs_daemon_database then (
 		let rwro = DB.from_file store domains cons Disk.xs_daemon_database in
 		info "Live reload: database loaded";
-		Event.bind_dom_exc_virq eventchn;
 		Process.LiveUpdate.completed ();
 		rwro
 	) else (
@@ -413,7 +412,6 @@ let _ =
 
 		if cf.domain_init then (
 			Connections.add_domain cons (Domains.create0 domains);
-			Event.bind_dom_exc_virq eventchn
 		);
 		rw_sock
 	) in
@@ -451,7 +449,7 @@ let _ =
 			let port = Event.pending eventchn in
 			debug "pending port %d" (Xeneventchn.to_int port);
 			finally (fun () ->
-				if Some port = eventchn.Event.virq_port then (
+				if port = eventchn.Event.domexc then (
 					let (notify, deaddom) = Domains.cleanup domains in
 					List.iter (Store.reset_permissions store) deaddom;
 					List.iter (Connections.del_domain cons) deaddom;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:46:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:46:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468633.727774 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SSZ-00066V-4m; Thu, 22 Dec 2022 20:46:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468633.727774; Thu, 22 Dec 2022 20:46:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SSZ-00066O-2G; Thu, 22 Dec 2022 20:46:35 +0000
Received: by outflank-mailman (input) for mailman id 468633;
 Thu, 22 Dec 2022 20:46:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSX-00066C-Sv
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSX-0007lM-SG
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSX-0004ez-Rb
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8VbzDMbEjlfl3L4EeGwccLmRlhDOZ5UKVfnuNUCKr7A=; b=OodvfJAIKaiVoydF4tA13uGrHB
	XLtKrI5qMnoWHgNiWiIEsGJ7Z/A5uVydpvpC3VvDh12DpB0O7d24V7bcXNawddWS9+wW7tUVdDVLO
	3OWuDH9amL1bpxXLYR1Oy/maTQB8j0ay2egw2SQlpWutVthTB/jTKcyXa8POo+jMO+qA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/oxenstored: Rename some 'port' variables to 'remote_port'
Message-Id: <E1p8SSX-0004ez-Rb@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:46:33 +0000

commit fd0d9b05970986545656c8f6f688f70f3e78a29b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 30 03:17:28 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/oxenstored: Rename some 'port' variables to 'remote_port'
    
    This will make the logic clearer when we plumb local_port through these
    functions.
    
    While doing this, rearrange the construct in Domains.create0 to separate the
    remote port handling from the interface handling.  (The interface logic is
    dubious in several ways, but not altered by this cleanup.)
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 31fbee749a75621039ca601eaee7222050a7dd83)
---
 tools/ocaml/xenstored/domains.ml   | 26 ++++++++++++--------------
 tools/ocaml/xenstored/process.ml   | 12 ++++++------
 tools/ocaml/xenstored/xenstored.ml |  8 ++++----
 3 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index 17fe2fa257..26018ac0dd 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -122,9 +122,9 @@ let cleanup doms =
 let resume _doms _domid =
 	()
 
-let create doms domid mfn port =
+let create doms domid mfn remote_port =
 	let interface = Xenctrl.map_foreign_range xc domid (Xenmmap.getpagesize()) mfn in
-	let dom = Domain.make domid mfn port interface doms.eventchn in
+	let dom = Domain.make domid mfn remote_port interface doms.eventchn in
 	Hashtbl.add doms.table domid dom;
 	Domain.bind_interdomain dom;
 	dom
@@ -133,18 +133,16 @@ let xenstored_kva = ref ""
 let xenstored_port = ref ""
 
 let create0 doms =
-	let port, interface =
-		(
-			let port = Utils.read_file_single_integer !xenstored_port
-			and fd = Unix.openfile !xenstored_kva
-					       [ Unix.O_RDWR ] 0o600 in
-			let interface = Xenmmap.mmap fd Xenmmap.RDWR Xenmmap.SHARED
-						  (Xenmmap.getpagesize()) 0 in
-			Unix.close fd;
-			port, interface
-		)
-		in
-	let dom = Domain.make 0 Nativeint.zero port interface doms.eventchn in
+	let remote_port = Utils.read_file_single_integer !xenstored_port in
+
+	let interface =
+		let fd = Unix.openfile !xenstored_kva [ Unix.O_RDWR ] 0o600 in
+		let interface = Xenmmap.mmap fd Xenmmap.RDWR Xenmmap.SHARED (Xenmmap.getpagesize()) 0 in
+		Unix.close fd;
+		interface
+	in
+
+	let dom = Domain.make 0 Nativeint.zero remote_port interface doms.eventchn in
 	Hashtbl.add doms.table 0 dom;
 	Domain.bind_interdomain dom;
 	Domain.notify dom;
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 72a79e9328..b2973aca2a 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -558,10 +558,10 @@ let do_transaction_end con t domains cons data =
 let do_introduce con t domains cons data =
 	if not (Connection.is_dom0 con)
 	then raise Define.Permission_denied;
-	let (domid, mfn, port) =
+	let (domid, mfn, remote_port) =
 		match (split None '\000' data) with
-		| domid :: mfn :: port :: _ ->
-			int_of_string domid, Nativeint.of_string mfn, int_of_string port
+		| domid :: mfn :: remote_port :: _ ->
+			int_of_string domid, Nativeint.of_string mfn, int_of_string remote_port
 		| _                         -> raise Invalid_Cmd_Args;
 		in
 	let dom =
@@ -569,18 +569,18 @@ let do_introduce con t domains cons data =
 			let edom = Domains.find domains domid in
 			if (Domain.get_mfn edom) = mfn && (Connections.find_domain cons domid) != con then begin
 				(* Use XS_INTRODUCE for recreating the xenbus event-channel. *)
-				edom.remote_port <- port;
+				edom.remote_port <- remote_port;
 				Domain.bind_interdomain edom;
 			end;
 			edom
 		else try
-			let ndom = Domains.create domains domid mfn port in
+			let ndom = Domains.create domains domid mfn remote_port in
 			Connections.add_domain cons ndom;
 			Connections.fire_spec_watches (Transaction.get_root t) cons Store.Path.introduce_domain;
 			ndom
 		with _ -> raise Invalid_Cmd_Args
 	in
-	if (Domain.get_remote_port dom) <> port || (Domain.get_mfn dom) <> mfn then
+	if (Domain.get_remote_port dom) <> remote_port || (Domain.get_mfn dom) <> mfn then
 		raise Domain_not_match
 
 let do_release con t domains cons data =
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 55071b49ec..1f11f576b5 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -167,10 +167,10 @@ let from_channel_f chan global_f socket_f domain_f watch_f store_f =
 					global_f ~rw
 				| "socket" :: fd :: [] ->
 					socket_f ~fd:(int_of_string fd)
-				| "dom" :: domid :: mfn :: port :: []->
+				| "dom" :: domid :: mfn :: remote_port :: []->
 					domain_f (int_of_string domid)
 					         (Nativeint.of_string mfn)
-					         (int_of_string port)
+					         (int_of_string remote_port)
 				| "watch" :: domid :: path :: token :: [] ->
 					watch_f (int_of_string domid)
 					        (unhexify path) (unhexify token)
@@ -209,10 +209,10 @@ let from_channel store cons doms chan =
 		else
 			warn "Ignoring invalid socket FD %d" fd
 	in
-	let domain_f domid mfn port =
+	let domain_f domid mfn remote_port =
 		let ndom =
 			if domid > 0 then
-				Domains.create doms domid mfn port
+				Domains.create doms domid mfn remote_port
 			else
 				Domains.create0 doms
 			in
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:46:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:46:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468634.727780 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SSj-00069C-6h; Thu, 22 Dec 2022 20:46:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468634.727780; Thu, 22 Dec 2022 20:46:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SSj-000692-3n; Thu, 22 Dec 2022 20:46:45 +0000
Received: by outflank-mailman (input) for mailman id 468634;
 Thu, 22 Dec 2022 20:46:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSh-00068s-Vo
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSh-0007lS-V1
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSh-0004fO-UR
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZcIzAFNZOdWpVb+Rs0WhSejooop3m7mdyVj5HEC3gh0=; b=4b+sFL2MpkEloji13rI27PiE9W
	DKalBgb1K42sntMLvn67AUjnIo2ndvpttr/62F/SfVUhQN3L4qJJtl6D2BbF1TW8Lrn4tLrXScrEc
	oNKR83poXQ3zcfg6lPEDAnvv36FXhyMuDO/PJn/YVo6VqWs7DLz3MVGN7JQQQ99GEffk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/oxenstored: Implement Domain.rebind_evtchn
Message-Id: <E1p8SSh-0004fO-UR@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:46:43 +0000

commit a20daa7ffda7ccc0e65abe77532a5dc8059bf128
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 30 11:55:58 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/oxenstored: Implement Domain.rebind_evtchn
    
    Generally speaking, the event channel local/remote port is fixed for the
    lifetime of the associated domain object.  The exception to this is a
    secondary XS_INTRODUCE (defined to re-bind to a new event channel) which pokes
    around at the domain object's internal state.
    
    We need to refactor the evtchn handling to support live update, so start by
    moving the relevant manipulation into Domain.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit aecdc28d9538ca2a1028ef9bc6550cb171dbbed4)
---
 tools/ocaml/xenstored/domain.ml  | 12 ++++++++++++
 tools/ocaml/xenstored/process.ml |  3 +--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index ab08dcf37f..d59a9401e2 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -63,6 +63,18 @@ let string_of_port = function
 let dump d chan =
 	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
 
+let rebind_evtchn d remote_port =
+	begin match d.port with
+	| None -> ()
+	| Some p -> Event.unbind d.eventchn p
+	end;
+	let local = Event.bind_interdomain d.eventchn d.id remote_port in
+	debug "domain %d rebind (l %s, r %d) => (l %d, r %d)"
+	      d.id (string_of_port d.port) d.remote_port
+	      (Xeneventchn.to_int local) remote_port;
+	d.remote_port <- remote_port;
+	d.port <- Some (local)
+
 let notify dom =
 	match dom.port with
 	| None -> warn "domain %d: attempt to notify on unknown port" dom.id
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index b2973aca2a..1c80e7198d 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -569,8 +569,7 @@ let do_introduce con t domains cons data =
 			let edom = Domains.find domains domid in
 			if (Domain.get_mfn edom) = mfn && (Connections.find_domain cons domid) != con then begin
 				(* Use XS_INTRODUCE for recreating the xenbus event-channel. *)
-				edom.remote_port <- remote_port;
-				Domain.bind_interdomain edom;
+				Domain.rebind_evtchn edom remote_port;
 			end;
 			edom
 		else try
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:46:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:46:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468635.727783 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SSt-0006Bt-8E; Thu, 22 Dec 2022 20:46:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468635.727783; Thu, 22 Dec 2022 20:46:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8SSt-0006Bl-5U; Thu, 22 Dec 2022 20:46:55 +0000
Received: by outflank-mailman (input) for mailman id 468635;
 Thu, 22 Dec 2022 20:46:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSs-0006BZ-2G
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSs-0007lt-1a
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8SSs-0004g4-0z
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:46:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0Z+EJNiYRSRY2+6v//K+BEsbJk46Zrgb5deXfvdBKU0=; b=PmwNBUrKCMIZ02IbTKs8QR/VBK
	2pEN6ImrgBOeUhCYJBeUKYDpUsBM6j0NyBOYJfifJplMo8O/7scO4MchNZp3JZ4FW5goIAeo49bkP
	xxJof7AkE73OY61cHHq5xMCpgxS2dtHKQxsmPOwQcove/HcXgYN5Xs+r4ZDO9OcPgouE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/oxenstored: Rework Domain evtchn handling to use port_pair
Message-Id: <E1p8SSs-0004g4-0z@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:46:54 +0000

commit 4b418768ef4d75d0f70e4ce7cb5710404527bf47
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 30 11:59:34 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/oxenstored: Rework Domain evtchn handling to use port_pair
    
    Inter-domain event channels are always a pair of local and remote ports.
    Right now the handling is asymmetric, caused by the fact that the evtchn is
    bound after the associated Domain object is constructed.
    
    First, move binding of the event channel into the Domain.make() constructor.
    This means the local port no longer needs to be an option.  It also removes
    the final callers of Domain.bind_interdomain.
    
    Next, introduce a new port_pair type to encapsulate the fact that these two
    should be updated together, and replace the previous port and remote_port
    fields.  This refactoring also changes the Domain.get_port interface (removing
    an option) so take the opportunity to name it get_local_port instead.
    
    Also, this fixes a use-after-free risk with Domain.close.  Once the evtchn has
    been unbound, the same local port number can be reused for a different
    purpose, so explicitly invalidate the ports to prevent their accidental misuse
    in the future.
    
    This also cleans up some of the debugging, to always print a port pair.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit df2db174b36eba67c218763ef621c67912202fc6)
---
 tools/ocaml/xenstored/connections.ml |  9 +----
 tools/ocaml/xenstored/domain.ml      | 75 ++++++++++++++++++------------------
 tools/ocaml/xenstored/domains.ml     |  2 -
 3 files changed, 39 insertions(+), 47 deletions(-)

diff --git a/tools/ocaml/xenstored/connections.ml b/tools/ocaml/xenstored/connections.ml
index 7d68c583b4..a80ae0bed2 100644
--- a/tools/ocaml/xenstored/connections.ml
+++ b/tools/ocaml/xenstored/connections.ml
@@ -48,9 +48,7 @@ let add_domain cons dom =
 	let xbcon = Xenbus.Xb.open_mmap ~capacity (Domain.get_interface dom) (fun () -> Domain.notify dom) in
 	let con = Connection.create xbcon (Some dom) in
 	Hashtbl.add cons.domains (Domain.get_id dom) con;
-	match Domain.get_port dom with
-	| Some p -> Hashtbl.add cons.ports p con;
-	| None -> ()
+	Hashtbl.add cons.ports (Domain.get_local_port dom) con
 
 let select ?(only_if = (fun _ -> true)) cons =
 	Hashtbl.fold (fun _ con (ins, outs) ->
@@ -97,10 +95,7 @@ let del_domain cons id =
 		let con = find_domain cons id in
 		Hashtbl.remove cons.domains id;
 		(match Connection.get_domain con with
-		 | Some d ->
-		   (match Domain.get_port d with
-		    | Some p -> Hashtbl.remove cons.ports p
-		    | None -> ())
+		 | Some d -> Hashtbl.remove cons.ports (Domain.get_local_port d)
 		 | None -> ());
 		del_watches cons con;
 		Connection.close con
diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index d59a9401e2..481e10794d 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -19,14 +19,31 @@ open Printf
 let debug fmt = Logging.debug "domain" fmt
 let warn  fmt = Logging.warn  "domain" fmt
 
+(* A bound inter-domain event channel port pair.  The remote port, and the
+   local port it is bound to. *)
+type port_pair =
+{
+	local: Xeneventchn.t;
+	remote: int;
+}
+
+(* Sentinal port_pair with both set to EVTCHN_INVALID *)
+let invalid_ports =
+{
+	local = Xeneventchn.of_int 0;
+	remote = 0
+}
+
+let string_of_port_pair p =
+	sprintf "(l %d, r %d)" (Xeneventchn.to_int p.local) p.remote
+
 type t =
 {
 	id: Xenctrl.domid;
 	mfn: nativeint;
 	interface: Xenmmap.mmap_interface;
 	eventchn: Event.t;
-	mutable remote_port: int;
-	mutable port: Xeneventchn.t option;
+	mutable ports: port_pair;
 	mutable bad_client: bool;
 	mutable io_credit: int; (* the rounds of ring process left to do, default is 0,
 	                           usually set to 1 when there is work detected, could
@@ -41,8 +58,8 @@ let is_dom0 d = d.id = 0
 let get_id domain = domain.id
 let get_interface d = d.interface
 let get_mfn d = d.mfn
-let get_remote_port d = d.remote_port
-let get_port d = d.port
+let get_remote_port d = d.ports.remote
+let get_local_port d = d.ports.local
 
 let is_bad_domain domain = domain.bad_client
 let mark_as_bad domain = domain.bad_client <- true
@@ -56,54 +73,36 @@ let is_paused_for_conflict dom = dom.conflict_credit <= 0.0
 
 let is_free_to_conflict = is_dom0
 
-let string_of_port = function
-	| None -> "None"
-	| Some x -> string_of_int (Xeneventchn.to_int x)
-
 let dump d chan =
-	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
+	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.ports.remote
 
 let rebind_evtchn d remote_port =
-	begin match d.port with
-	| None -> ()
-	| Some p -> Event.unbind d.eventchn p
-	end;
+	Event.unbind d.eventchn d.ports.local;
 	let local = Event.bind_interdomain d.eventchn d.id remote_port in
-	debug "domain %d rebind (l %s, r %d) => (l %d, r %d)"
-	      d.id (string_of_port d.port) d.remote_port
-	      (Xeneventchn.to_int local) remote_port;
-	d.remote_port <- remote_port;
-	d.port <- Some (local)
+	let new_ports = { local; remote = remote_port } in
+	debug "domain %d rebind %s => %s"
+	      d.id (string_of_port_pair d.ports) (string_of_port_pair new_ports);
+	d.ports <- new_ports
 
 let notify dom =
-	match dom.port with
-	| None -> warn "domain %d: attempt to notify on unknown port" dom.id
-	| Some port -> Event.notify dom.eventchn port
-
-let bind_interdomain dom =
-	begin match dom.port with
-	| None -> ()
-	| Some port -> Event.unbind dom.eventchn port
-	end;
-	dom.port <- Some (Event.bind_interdomain dom.eventchn dom.id dom.remote_port);
-	debug "bound domain %d remote port %d to local port %s" dom.id dom.remote_port (string_of_port dom.port)
-
+	Event.notify dom.eventchn dom.ports.local
 
 let close dom =
-	debug "domain %d unbound port %s" dom.id (string_of_port dom.port);
-	begin match dom.port with
-	| None -> ()
-	| Some port -> Event.unbind dom.eventchn port
-	end;
+	debug "domain %d unbind %s" dom.id (string_of_port_pair dom.ports);
+	Event.unbind dom.eventchn dom.ports.local;
+	dom.ports <- invalid_ports;
 	Xenmmap.unmap dom.interface
 
-let make id mfn remote_port interface eventchn = {
+let make id mfn remote_port interface eventchn =
+	let local = Event.bind_interdomain eventchn id remote_port in
+	let ports = { local; remote = remote_port } in
+	debug "domain %d bind %s" id (string_of_port_pair ports);
+{
 	id = id;
 	mfn = mfn;
-	remote_port = remote_port;
+	ports;
 	interface = interface;
 	eventchn = eventchn;
-	port = None;
 	bad_client = false;
 	io_credit = 0;
 	conflict_credit = !Define.conflict_burst_limit;
diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index 26018ac0dd..2ab0c5f4d8 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -126,7 +126,6 @@ let create doms domid mfn remote_port =
 	let interface = Xenctrl.map_foreign_range xc domid (Xenmmap.getpagesize()) mfn in
 	let dom = Domain.make domid mfn remote_port interface doms.eventchn in
 	Hashtbl.add doms.table domid dom;
-	Domain.bind_interdomain dom;
 	dom
 
 let xenstored_kva = ref ""
@@ -144,7 +143,6 @@ let create0 doms =
 
 	let dom = Domain.make 0 Nativeint.zero remote_port interface doms.eventchn in
 	Hashtbl.add doms.table 0 dom;
-	Domain.bind_interdomain dom;
 	Domain.notify dom;
 	dom
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:47:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:47:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468636.727787 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8ST3-0006FR-BL; Thu, 22 Dec 2022 20:47:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468636.727787; Thu, 22 Dec 2022 20:47: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 1p8ST3-0006FJ-8Y; Thu, 22 Dec 2022 20:47:05 +0000
Received: by outflank-mailman (input) for mailman id 468636;
 Thu, 22 Dec 2022 20:47:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8ST2-0006F7-5I
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8ST2-0007mA-4S
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8ST2-0004ge-3m
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CkxClFIOJDbn7RXbS2BnwB2oY18FAUSzHnvJE6NiJKU=; b=X0RM3JNLIbe6vh2ZS6kBWk7ogd
	BS8iCf/OCW2xoGDpTUKHC0BhhaiTWjMHw+K5jSwXUx0IA4aCkWomewJ69U6aszSfUxiRMvy2APb/c
	HMq+w6jrc+g5CswmdBx2H2LbqoueLgbf755sBjJfwkdhcuHby1fjNzCyXjFWJF8ZS3Is=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/oxenstored: Keep /dev/xen/evtchn open across live update
Message-Id: <E1p8ST2-0004ge-3m@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:47:04 +0000

commit f02171b663393e10d35123e5572c0f5b3e72c29d
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Thu Nov 3 15:31:39 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/oxenstored: Keep /dev/xen/evtchn open across live update
    
    Closing the evtchn handle will unbind and free all local ports.  The new
    xenstored would need to rebind all evtchns, which is work that we don't want
    or need to be doing during the critical handover period.
    
    However, it turns out that the Windows PV drivers also rebind their local port
    too across suspend/resume, leaving (o)xenstored with a stale idea of the
    remote port to use.  In this case, reusing the established connection is the
    only robust option.
    
    Therefore:
     * Have oxenstored open /dev/xen/evtchn without CLOEXEC at start of day.
     * Extend the handover information with the evtchn fd, domexc virq local port,
       and the local port number for each domain connection.
     * Have (the new) oxenstored recover the open handle using Xeneventchn.fdopen,
       and use the provided local ports rather than trying to rebind them.
    
    When this new information isn't present (i.e. live updating from an oxenstored
    prior to this change), the best-effort status quo will have to do.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 9b224c25293a53fcbe32da68052d861dda71a6f4)
---
 tools/ocaml/xenstored/domain.ml    | 13 ++++--
 tools/ocaml/xenstored/domains.ml   |  9 ++--
 tools/ocaml/xenstored/event.ml     | 20 +++++++--
 tools/ocaml/xenstored/process.ml   |  2 +-
 tools/ocaml/xenstored/xenstored.ml | 85 +++++++++++++++++++++++++-------------
 5 files changed, 90 insertions(+), 39 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index 481e10794d..5c15752a37 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -74,7 +74,8 @@ let is_paused_for_conflict dom = dom.conflict_credit <= 0.0
 let is_free_to_conflict = is_dom0
 
 let dump d chan =
-	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.ports.remote
+	fprintf chan "dom,%d,%nd,%d,%d\n"
+		d.id d.mfn d.ports.remote (Xeneventchn.to_int d.ports.local)
 
 let rebind_evtchn d remote_port =
 	Event.unbind d.eventchn d.ports.local;
@@ -93,8 +94,14 @@ let close dom =
 	dom.ports <- invalid_ports;
 	Xenmmap.unmap dom.interface
 
-let make id mfn remote_port interface eventchn =
-	let local = Event.bind_interdomain eventchn id remote_port in
+(* On clean start, local_port will be None, and we must bind the remote port
+   given.  On Live Update, the event channel is already bound, and both the
+   local and remote port numbers come from the transfer record. *)
+let make ?local_port ~remote_port id mfn interface eventchn =
+	let local = match local_port with
+		| None -> Event.bind_interdomain eventchn id remote_port
+		| Some p -> Xeneventchn.of_int p
+	in
 	let ports = { local; remote = remote_port } in
 	debug "domain %d bind %s" id (string_of_port_pair ports);
 {
diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index 2ab0c5f4d8..b6c075c838 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -56,6 +56,7 @@ let exist doms id = Hashtbl.mem doms.table id
 let find doms id = Hashtbl.find doms.table id
 let number doms = Hashtbl.length doms.table
 let iter doms fct = Hashtbl.iter (fun _ b -> fct b) doms.table
+let eventchn doms = doms.eventchn
 
 let rec is_empty_queue q =
 	Queue.is_empty q ||
@@ -122,16 +123,16 @@ let cleanup doms =
 let resume _doms _domid =
 	()
 
-let create doms domid mfn remote_port =
+let create doms ?local_port ~remote_port domid mfn =
 	let interface = Xenctrl.map_foreign_range xc domid (Xenmmap.getpagesize()) mfn in
-	let dom = Domain.make domid mfn remote_port interface doms.eventchn in
+	let dom = Domain.make ?local_port ~remote_port domid mfn interface doms.eventchn in
 	Hashtbl.add doms.table domid dom;
 	dom
 
 let xenstored_kva = ref ""
 let xenstored_port = ref ""
 
-let create0 doms =
+let create0 ?local_port doms =
 	let remote_port = Utils.read_file_single_integer !xenstored_port in
 
 	let interface =
@@ -141,7 +142,7 @@ let create0 doms =
 		interface
 	in
 
-	let dom = Domain.make 0 Nativeint.zero remote_port interface doms.eventchn in
+	let dom = Domain.make ?local_port ~remote_port 0 Nativeint.zero interface doms.eventchn in
 	Hashtbl.add doms.table 0 dom;
 	Domain.notify dom;
 	dom
diff --git a/tools/ocaml/xenstored/event.ml b/tools/ocaml/xenstored/event.ml
index a3be296374..629dc6041b 100644
--- a/tools/ocaml/xenstored/event.ml
+++ b/tools/ocaml/xenstored/event.ml
@@ -20,9 +20,18 @@ type t = {
 	domexc: Xeneventchn.t;
 }
 
-let init () =
-	let handle = Xeneventchn.init () in
-	let domexc = Xeneventchn.bind_dom_exc_virq handle in
+(* On clean start, both parameters will be None, and we must open the evtchn
+   handle and bind the DOM_EXC VIRQ.  On Live Update, the fd is preserved
+   across exec(), and the DOM_EXC VIRQ still bound. *)
+let init ?fd ?domexc_port () =
+	let handle = match fd with
+		| None -> Xeneventchn.init ~cloexec:false ()
+		| Some fd -> fd |> Utils.FD.of_int |> Xeneventchn.fdopen
+	in
+	let domexc = match domexc_port with
+		| None -> Xeneventchn.bind_dom_exc_virq handle
+		| Some p -> Xeneventchn.of_int p
+	in
 	{ handle; domexc }
 
 let fd eventchn = Xeneventchn.fd eventchn.handle
@@ -31,3 +40,8 @@ let unbind eventchn port = Xeneventchn.unbind eventchn.handle port
 let notify eventchn port = Xeneventchn.notify eventchn.handle port
 let pending eventchn = Xeneventchn.pending eventchn.handle
 let unmask eventchn port = Xeneventchn.unmask eventchn.handle port
+
+let dump e chan =
+	Printf.fprintf chan "evtchn-dev,%d,%d\n"
+		       (Utils.FD.to_int @@ Xeneventchn.fd e.handle)
+		       (Xeneventchn.to_int e.domexc)
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 1c80e7198d..02bd0f7d80 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -573,7 +573,7 @@ let do_introduce con t domains cons data =
 			end;
 			edom
 		else try
-			let ndom = Domains.create domains domid mfn remote_port in
+			let ndom = Domains.create ~remote_port domains domid mfn in
 			Connections.add_domain cons ndom;
 			Connections.fire_spec_watches (Transaction.get_root t) cons Store.Path.introduce_domain;
 			ndom
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 1f11f576b5..f526f4fb23 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -144,7 +144,7 @@ exception Bad_format of string
 
 let dump_format_header = "$xenstored-dump-format"
 
-let from_channel_f chan global_f socket_f domain_f watch_f store_f =
+let from_channel_f chan global_f evtchn_f socket_f domain_f watch_f store_f =
 	let unhexify s = Utils.unhexify s in
 	let getpath s =
 		let u = Utils.unhexify s in
@@ -165,12 +165,19 @@ let from_channel_f chan global_f socket_f domain_f watch_f store_f =
 					(* there might be more parameters here,
 					   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)
 				| "socket" :: fd :: [] ->
 					socket_f ~fd:(int_of_string fd)
-				| "dom" :: domid :: mfn :: remote_port :: []->
-					domain_f (int_of_string domid)
-					         (Nativeint.of_string mfn)
-					         (int_of_string remote_port)
+				| "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
+					domain_f ?local_port
+						 ~remote_port:(int_of_string remote_port)
+						 (int_of_string domid)
+						 (Nativeint.of_string mfn)
 				| "watch" :: domid :: path :: token :: [] ->
 					watch_f (int_of_string domid)
 					        (unhexify path) (unhexify token)
@@ -189,10 +196,21 @@ let from_channel_f chan global_f socket_f domain_f watch_f store_f =
 	done;
 	info "Completed loading xenstore dump"
 
-let from_channel store cons doms chan =
+let from_channel store cons domains_init chan =
 	(* don't let the permission get on our way, full perm ! *)
 	let op = Store.get_ops store Perms.Connection.full_rights in
 	let rwro = ref (None) in
+	let doms = ref (None) in
+
+	let require_doms () =
+		match !doms with
+		| None ->
+			warn "No event channel file descriptor available in dump!";
+		        let domains = domains_init @@ Event.init () in
+		        doms := Some domains;
+		        domains
+		| Some d -> d
+	in
 	let global_f ~rw =
 		let get_listen_sock sockfd =
 			let fd = sockfd |> int_of_string |> Utils.FD.of_int in
@@ -201,6 +219,10 @@ let from_channel store cons doms chan =
 		in
 		rwro := get_listen_sock rw
 	in
+	let evtchn_f ~fd ~domexc_port =
+		let evtchn = Event.init ~fd ~domexc_port () in
+		doms := Some(domains_init evtchn)
+	in
 	let socket_f ~fd =
 		let ufd = Utils.FD.of_int fd in
 		let is_valid = try (Unix.fstat ufd).Unix.st_kind = Unix.S_SOCK with _ -> false in
@@ -209,12 +231,13 @@ let from_channel store cons doms chan =
 		else
 			warn "Ignoring invalid socket FD %d" fd
 	in
-	let domain_f domid mfn remote_port =
+	let domain_f ?local_port ~remote_port domid mfn =
+		let doms = require_doms () in
 		let ndom =
 			if domid > 0 then
-				Domains.create doms domid mfn remote_port
+				Domains.create ?local_port ~remote_port doms domid mfn
 			else
-				Domains.create0 doms
+				Domains.create0 ?local_port doms
 			in
 		Connections.add_domain cons ndom;
 		in
@@ -229,8 +252,8 @@ let from_channel store cons doms chan =
 		op.Store.write path value;
 		op.Store.setperms path perms
 		in
-	from_channel_f chan global_f socket_f domain_f watch_f store_f;
-	!rwro
+	from_channel_f chan global_f evtchn_f socket_f domain_f watch_f store_f;
+	!rwro, require_doms ()
 
 let from_file store cons doms file =
 	info "Loading xenstore dump from %s" file;
@@ -238,7 +261,7 @@ let from_file store cons doms file =
 	finally (fun () -> from_channel store doms cons channel)
 	        (fun () -> close_in channel)
 
-let to_channel store cons rw chan =
+let to_channel store cons (rw, evtchn) chan =
 	let hexify s = Utils.hexify s in
 
 	fprintf chan "%s\n" dump_format_header;
@@ -248,6 +271,9 @@ let to_channel store cons rw chan =
 		Utils.FD.to_int fd in
 	fprintf chan "global,%d\n" (fdopt rw);
 
+	(* dump evtchn device info *)
+	Event.dump evtchn chan;
+
 	(* dump connections related to domains: domid, mfn, eventchn port/ sockets, and watches *)
 	Connections.iter cons (fun con -> Connection.dump con chan);
 
@@ -367,7 +393,6 @@ let _ =
 	| None         -> () end;
 
 	let store = Store.create () in
-	let eventchn = Event.init () in
 	let next_frequent_ops = ref 0. in
 	let advance_next_frequent_ops () =
 		next_frequent_ops := (Unix.gettimeofday () +. !Define.conflict_max_history_seconds)
@@ -375,16 +400,8 @@ let _ =
 	let delay_next_frequent_ops_by duration =
 		next_frequent_ops := !next_frequent_ops +. duration
 	in
-	let domains = Domains.init eventchn advance_next_frequent_ops in
+	let domains_init eventchn = Domains.init eventchn advance_next_frequent_ops in
 
-	(* For things that need to be done periodically but more often
-	 * than the periodic_ops function *)
-	let frequent_ops () =
-		if Unix.gettimeofday () > !next_frequent_ops then (
-			History.trim ();
-			Domains.incr_conflict_credit domains;
-			advance_next_frequent_ops ()
-		) in
 	let cons = Connections.create () in
 
 	let quit = ref false in
@@ -393,14 +410,15 @@ let _ =
 	List.iter (fun path ->
 		Store.write store Perms.Connection.full_rights path "") Store.Path.specials;
 
-	let rw_sock =
+	let rw_sock, domains =
 	if cf.restart && Sys.file_exists Disk.xs_daemon_database then (
-		let rwro = DB.from_file store domains cons Disk.xs_daemon_database in
+		let rw, domains = DB.from_file store domains_init cons Disk.xs_daemon_database in
 		info "Live reload: database loaded";
 		Process.LiveUpdate.completed ();
-		rwro
+		rw, domains
 	) else (
 		info "No live reload: regular startup";
+		let domains = domains_init @@ Event.init () in
 		if !Disk.enable then (
 			info "reading store from disk";
 			Disk.read store
@@ -413,9 +431,18 @@ let _ =
 		if cf.domain_init then (
 			Connections.add_domain cons (Domains.create0 domains);
 		);
-		rw_sock
+		rw_sock, domains
 	) in
 
+	(* For things that need to be done periodically but more often
+	 * than the periodic_ops function *)
+	let frequent_ops () =
+		if Unix.gettimeofday () > !next_frequent_ops then (
+			History.trim ();
+			Domains.incr_conflict_credit domains;
+			advance_next_frequent_ops ()
+		) in
+
 	(* required for xenstore-control to detect availability of live-update *)
 	let tool_path = Store.Path.of_string "/tool" in
 	if not (Store.path_exists store tool_path) then
@@ -430,8 +457,10 @@ let _ =
 	Sys.set_signal Sys.sigusr1 (Sys.Signal_handle (fun _ -> sigusr1_handler store));
 	Sys.set_signal Sys.sigpipe Sys.Signal_ignore;
 
+	let eventchn = Domains.eventchn domains in
+
 	if cf.activate_access_log then begin
-		let post_rotate () = DB.to_file store cons (None) Disk.xs_daemon_database in
+		let post_rotate () = DB.to_file store cons (None, eventchn) Disk.xs_daemon_database in
 		Logging.init_access_log post_rotate
 	end;
 
@@ -593,7 +622,7 @@ let _ =
 			live_update := Process.LiveUpdate.should_run cons;
 			if !live_update || !quit then begin
 				(* don't initiate live update if saving state fails *)
-				DB.to_file store cons (rw_sock) Disk.xs_daemon_database;
+				DB.to_file store cons (rw_sock, eventchn) Disk.xs_daemon_database;
 				quit := true;
 			end
 		with exc ->
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:47:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:47:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468637.727790 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8STD-0006ID-Cj; Thu, 22 Dec 2022 20:47:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468637.727790; Thu, 22 Dec 2022 20:47: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 1p8STD-0006I6-A9; Thu, 22 Dec 2022 20:47:15 +0000
Received: by outflank-mailman (input) for mailman id 468637;
 Thu, 22 Dec 2022 20:47:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8STC-0006Hx-BD
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8STC-0007mM-AX
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8STC-0004hE-6d
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tn7dqmRu66E53kLjREie5ZcUTJmhvuMKbSSzaNC5k3k=; b=X4re33WvJ3QmYNqbv3eyoV3jUq
	6LzoValW2xBgdA/2tmTLfyENQG0yf4XtVWhMxU+VT5iRptce16OdLch5a/VxD5lV3TSQ6R4EezCtr
	z9Cs2X4oMI1XnP5n/JNpRLKw7XPtmGyEIF7KF7SZJnu50cZ2gG6ePeDtUptlodrKNJcI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/oxenstored: Log live update issues at warning level
Message-Id: <E1p8STC-0004hE-6d@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:47:14 +0000

commit 991b512f5f69dde3c923804f887be9df56b03a74
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 8 08:57:47 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/oxenstored: Log live update issues at warning level
    
    During live update, oxenstored tries a best effort approach to recover as many
    domains and information as possible even if it encounters errors restoring
    some domains.
    
    However, logging about misunderstood input is more severe than simply info.
    Log it at warning instead.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 3f02e0a70fe9f8143454b742563433958d4a87f8)
---
 tools/ocaml/xenstored/xenstored.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index f526f4fb23..35b8cbd43f 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -186,9 +186,9 @@ let from_channel_f chan global_f evtchn_f socket_f domain_f watch_f store_f =
 					        (Perms.Node.of_string (unhexify perms ^ "\000"))
 					        (unhexify value)
 				| _ ->
-					info "restoring: ignoring unknown line: %s" line
+					warn "restoring: ignoring unknown line: %s" line
 			with exn ->
-				info "restoring: ignoring unknown line: %s (exception: %s)"
+				warn "restoring: ignoring unknown line: %s (exception: %s)"
 				     line (Printexc.to_string exn);
 				()
 		with End_of_file ->
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:47:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:47:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468638.727795 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8STN-0006Ki-EU; Thu, 22 Dec 2022 20:47:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468638.727795; Thu, 22 Dec 2022 20:47: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 1p8STN-0006KZ-Bk; Thu, 22 Dec 2022 20:47:25 +0000
Received: by outflank-mailman (input) for mailman id 468638;
 Thu, 22 Dec 2022 20:47:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8STM-0006KP-EC
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8STM-0007mZ-DR
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8STM-0004jG-Cm
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M25b1J4L40bRaVdLHPJZdvklJLC2Fz7wsyenyvJOblk=; b=IfR8luWDU14x32YP4bSXaB4GK5
	w09lqMO2cVnGmw5D0h2RtpIu2Gme8osjUvAkgZAAV49q/MLKkLMGE2YsKu6cEiPHExBfukSmiY8Oi
	bTh++eTortMVlzU/DAAPdWBBr7SA94tVrNV2h/A9Z4eTCP3doZDAKRKp13zb3DqKp8cQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/oxenstored: Set uncaught exception handler
Message-Id: <E1p8STM-0004jG-Cm@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:47:24 +0000

commit e13a9a2146952859c21c0a0c7b8b07757c2aba9d
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Mon Nov 7 17:41:36 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/oxenstored: Set uncaught exception handler
    
    Unhandled exceptions go to stderr by default, but this doesn't typically work
    for oxenstored because:
     * daemonize reopens stderr as /dev/null
     * systemd redirects stderr to /dev/null too
    
    Debugging an unhandled exception requires reproducing the issue locally when
    using --no-fork, and is not conducive to figuring out what went wrong on a
    remote system.
    
    Install a custom handler which also tries to render the backtrace to the
    configured syslog facility, and DAEMON|ERR otherwise.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit ee7815f49faf743e960dac9e72809eb66393bc6d)
---
 tools/ocaml/xenstored/logging.ml   | 29 +++++++++++++++++++++++++++++
 tools/ocaml/xenstored/xenstored.ml |  3 ++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml
index 39c3036155..255051437d 100644
--- a/tools/ocaml/xenstored/logging.ml
+++ b/tools/ocaml/xenstored/logging.ml
@@ -342,3 +342,32 @@ let xb_answer ~tid ~con ~ty data =
 let watch_not_fired ~con perms path =
 	let data = Printf.sprintf "EPERM perms=[%s] path=%s" perms path in
 	access_logging ~tid:0 ~con ~data Watch_not_fired ~level:Info
+
+let msg_of exn bt =
+	Printf.sprintf "Fatal exception: %s\n%s\n" (Printexc.to_string exn)
+		(Printexc.raw_backtrace_to_string bt)
+
+let fallback_exception_handler exn bt =
+	(* stderr goes to /dev/null, so use the logger where possible,
+	   but always print to stderr too, in case everything else fails,
+	   e.g. this can be used to debug with --no-fork
+
+	   this function should try not to raise exceptions, but if it does
+	   the ocaml runtime should still print the exception, both the original,
+	   and the one from this function, but to stderr this time
+	 *)
+	let msg = msg_of exn bt in
+	prerr_endline msg;
+	(* See Printexc.set_uncaught_exception_handler, need to flush,
+	   so has to call stop and flush *)
+	match !xenstored_logger with
+	| Some l -> error "xenstored-fallback" "%s" msg; l.stop ()
+	| None ->
+		(* Too early, no logger set yet.
+		   We normally try to use the configured logger so we don't flood syslog
+		   during development for example, or if the user has a file set
+		 *)
+		try Syslog.log Syslog.Daemon Syslog.Err msg
+		with e ->
+			let bt = Printexc.get_raw_backtrace () in
+			prerr_endline @@ msg_of e bt
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 35b8cbd43f..4d5851c5cb 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -355,7 +355,8 @@ let tweak_gc () =
 	Gc.set { (Gc.get ()) with Gc.max_overhead = !Define.gc_max_overhead }
 
 
-let _ =
+let () =
+	Printexc.set_uncaught_exception_handler Logging.fallback_exception_handler;
 	let cf = do_argv in
 	let pidfile =
 		if Sys.file_exists (config_filename cf) then
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:47:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:47:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468639.727799 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8STY-0006Ny-Ft; Thu, 22 Dec 2022 20:47:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468639.727799; Thu, 22 Dec 2022 20:47: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 1p8STY-0006Nq-DE; Thu, 22 Dec 2022 20:47:36 +0000
Received: by outflank-mailman (input) for mailman id 468639;
 Thu, 22 Dec 2022 20:47:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8STW-0006ND-Gz
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8STW-0007ms-GI
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8STW-0004ji-FY
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=a/oJGVdNGWtSxX6m1bop+1678G64C2ob/zpEXEzY4VY=; b=nOJyOuhRp8E5sLG9ryP0HTz/x1
	s+iWFxt70cjplznEhq8UroMq2hc9JNPikriMKzUrbyotzmnn5IFJRaMekLaItOQK87UTn8RU6Kzer
	2beP0XtKsMWosX3xvehNI+7c0GdOXAyPThPemG0IRWsUz1AJKy0imJodBqU/8WTWnKdw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/oxenstored/syslog: Avoid potential NULL dereference
Message-Id: <E1p8STW-0004ji-FY@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:47:34 +0000

commit 91a9ac6e9be5aa94020f5c482e6c51b581e2ea39
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 8 14:24:19 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/oxenstored/syslog: Avoid potential NULL dereference
    
    strdup() may return NULL.  Check for this before passing to syslog().
    
    Drop const from c_msg.  It is bogus, as demonstrated by the need to cast to
    void * in order to free the memory.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit acd3fb6d65905f8a185dcb9fe6a330a591b96203)
---
 tools/ocaml/xenstored/syslog_stubs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/syslog_stubs.c b/tools/ocaml/xenstored/syslog_stubs.c
index 875d48ad57..e16c3a9491 100644
--- a/tools/ocaml/xenstored/syslog_stubs.c
+++ b/tools/ocaml/xenstored/syslog_stubs.c
@@ -14,6 +14,7 @@
 
 #include <syslog.h>
 #include <string.h>
+#include <caml/fail.h>
 #include <caml/mlvalues.h>
 #include <caml/memory.h>
 #include <caml/alloc.h>
@@ -35,14 +36,16 @@ static int __syslog_facility_table[] = {
 value stub_syslog(value facility, value level, value msg)
 {
 	CAMLparam3(facility, level, msg);
-	const char *c_msg = strdup(String_val(msg));
+	char *c_msg = strdup(String_val(msg));
 	int c_facility = __syslog_facility_table[Int_val(facility)]
 	               | __syslog_level_table[Int_val(level)];
 
+	if ( !c_msg )
+		caml_raise_out_of_memory();
 	caml_enter_blocking_section();
 	syslog(c_facility, "%s", c_msg);
 	caml_leave_blocking_section();
 
-	free((void*)c_msg);
+	free(c_msg);
 	CAMLreturn(Val_unit);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Dec 22 20:47:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Dec 2022 20:47:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468641.727802 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8STi-0006SG-HQ; Thu, 22 Dec 2022 20:47:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468641.727802; Thu, 22 Dec 2022 20:47: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 1p8STi-0006S9-Ea; Thu, 22 Dec 2022 20:47:46 +0000
Received: by outflank-mailman (input) for mailman id 468641;
 Thu, 22 Dec 2022 20:47:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8STg-0006Rx-Jg
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8STg-0007nA-J2
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8STg-0004kJ-IO
 for xen-changelog@lists.xenproject.org; Thu, 22 Dec 2022 20:47:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q6qLPRjunVlRHbBZWanlcdvMZap8voThNWWbTGqvKJQ=; b=1XfG/3fEc2HckBwrfesvQoM71c
	rFaqM6xdqpieGgpXbScWOFY11RH8rVdlNmA4ucE45hiJl0q+RQRJ1DF7L2oaoO9YpXnawzyplyUxq
	VGPv+h0lUWkdcImaJBHYCKXjtffv5mdwehUg7Up+FdBg4MYcYrEJREspiXf2M4e6zMEg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/oxenstored: Render backtraces more nicely in Syslog
Message-Id: <E1p8STg-0004kJ-IO@xenbits.xenproject.org>
Date: Thu, 22 Dec 2022 20:47:44 +0000

commit c4972a4272690384b15d5706f2a833aed636895e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Dec 1 21:06:25 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 13:13:40 2022 +0000

    tools/oxenstored: Render backtraces more nicely in Syslog
    
    fallback_exception_handler feeds a string with embedded newlines directly into
    syslog().  While this is an improvement on getting nothing, syslogd escapes
    all control characters it gets, and emits one (long) log line.
    
    Fix the problem generally in the syslog stub.  As we already have a local copy
    of the string, split it in place and emit one syslog() call per line.
    
    Also tweak Logging.msg_of to avoid putting an extra newline on a string which
    already ends with one.
    
    Fixes: ee7815f49faf ("tools/oxenstored: Set uncaught exception handler")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit d2162d884cba0ff7b2ac0d832f4e044444bda2e1)
---
 tools/ocaml/xenstored/logging.ml     |  2 +-
 tools/ocaml/xenstored/syslog_stubs.c | 26 +++++++++++++++++++++++---
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml
index 255051437d..f233bc9a39 100644
--- a/tools/ocaml/xenstored/logging.ml
+++ b/tools/ocaml/xenstored/logging.ml
@@ -344,7 +344,7 @@ let watch_not_fired ~con perms path =
 	access_logging ~tid:0 ~con ~data Watch_not_fired ~level:Info
 
 let msg_of exn bt =
-	Printf.sprintf "Fatal exception: %s\n%s\n" (Printexc.to_string exn)
+	Printf.sprintf "Fatal exception: %s\n%s" (Printexc.to_string exn)
 		(Printexc.raw_backtrace_to_string bt)
 
 let fallback_exception_handler exn bt =
diff --git a/tools/ocaml/xenstored/syslog_stubs.c b/tools/ocaml/xenstored/syslog_stubs.c
index e16c3a9491..760e78ff73 100644
--- a/tools/ocaml/xenstored/syslog_stubs.c
+++ b/tools/ocaml/xenstored/syslog_stubs.c
@@ -37,14 +37,34 @@ value stub_syslog(value facility, value level, value msg)
 {
 	CAMLparam3(facility, level, msg);
 	char *c_msg = strdup(String_val(msg));
+	char *s = c_msg, *ss;
 	int c_facility = __syslog_facility_table[Int_val(facility)]
 	               | __syslog_level_table[Int_val(level)];
 
 	if ( !c_msg )
 		caml_raise_out_of_memory();
-	caml_enter_blocking_section();
-	syslog(c_facility, "%s", c_msg);
-	caml_leave_blocking_section();
+
+	/*
+	 * syslog() doesn't like embedded newlines, and c_msg generally
+	 * contains them.
+	 *
+	 * Split the message in place by converting \n to \0, and issue one
+	 * syslog() call per line, skipping the final iteration if c_msg ends
+	 * with a newline anyway.
+	 */
+	do {
+		ss = strchr(s, '\n');
+		if ( ss )
+			*ss = '\0';
+		else if ( *s == '\0' )
+			break;
+
+		caml_enter_blocking_section();
+		syslog(c_facility, "%s", s);
+		caml_leave_blocking_section();
+
+		s = ss + 1;
+	} while ( ss );
 
 	free(c_msg);
 	CAMLreturn(Val_unit);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Dec 23 05:11:10 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Dec 2022 05:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468793.727972 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8aKk-0004oP-Kg; Fri, 23 Dec 2022 05:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468793.727972; Fri, 23 Dec 2022 05: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 1p8aKk-0004oH-Hi; Fri, 23 Dec 2022 05:11:02 +0000
Received: by outflank-mailman (input) for mailman id 468793;
 Fri, 23 Dec 2022 05:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8aKj-0004oB-L9
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 05:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8aKj-0002AW-Dq
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 05:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8aKj-0008Nw-Ck
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=r4nq5EbxUMFKKqI6NLBYVAmfU6PDworQvGQ4VY/c8DE=; b=Tlrsv0gGPO7xrcfVQWDl7/MR4b
	Ox2Kiw0dCapEWg58R5p07xqWuXuM2wSfNppB1kPSxTx6mz7Tmzq5AANXJbl6pH7PanROxKfpQ+rJB
	uQ3VqMju6uor6mFXE0Pa7m7ojVknu3XCG+5/8nl1YFO2pvBBY78iA8bu4c5q50S9LJNs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] update Xen version to 4.13.5
Message-Id: <E1p8aKj-0008Nw-Ck@xenbits.xenproject.org>
Date: Fri, 23 Dec 2022 05:11:01 +0000

commit 708e83f0e7d1e32295fee58c71c1e972d4e61f56
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 19 09:10:08 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 19 09:10:08 2022 +0100

    update Xen version to 4.13.5
---
 Config.mk    | 6 +++---
 xen/Makefile | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index da96fe34cd..0ee845e5d2 100644
--- a/Config.mk
+++ b/Config.mk
@@ -288,15 +288,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 20d2e5a125e34fc8501026613a71549b2a1a3e54
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.13.4
-MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.13.4
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.13.5
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.13.5
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.12.1
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.13.4
+QEMU_TRADITIONAL_REVISION ?= xen-4.13.5
 # Wed Oct 10 18:52:54 2018 +0000
 # xen/pt: allow QEMU to request MSI unmasking at bind time
 
diff --git a/xen/Makefile b/xen/Makefile
index f88e068559..7cd3abee6d 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 13
-export XEN_EXTRAVERSION ?= .4$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .5$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Fri Dec 23 09:00:12 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Dec 2022 09:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468822.727988 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8duN-0001na-Ci; Fri, 23 Dec 2022 09:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468822.727988; Fri, 23 Dec 2022 09:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8duN-0001nS-8q; Fri, 23 Dec 2022 09:00:03 +0000
Received: by outflank-mailman (input) for mailman id 468822;
 Fri, 23 Dec 2022 09:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8duL-0001XD-O1
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 09:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8duL-0007uX-LQ
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 09:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8duL-0002jS-KE
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 09:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WhU3BoR3Zg4esQUiMIBTf3utiQPi9xQmZYCsGgRXt+0=; b=T04YmXWIvDai2OfMtH6XkAkh5s
	I6mFJOOV54jQz9FO5LJwkeGcSTsPo5CsjSuPUJIJpnqmnx1WuOyhRg9EMNnBMstlguXvlcvhyqZKv
	PoaFx+I2XoaQxE3XvRyBkxVbLnjlCX/uzzueAtOGaK1ich23DKSEAauauOT5UwiexNvA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] update Xen version to 4.16.3
Message-Id: <E1p8duL-0002jS-KE@xenbits.xenproject.org>
Date: Fri, 23 Dec 2022 09:00:01 +0000

commit 556c2e817c9cf23b675eb4eaa2dc091f7bb3039f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 19 09:08:32 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 19 09:08:32 2022 +0100

    update Xen version to 4.16.3
---
 Config.mk    | 6 +++---
 xen/Makefile | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Config.mk b/Config.mk
index 6f95067b8d..1215c2725b 100644
--- a/Config.mk
+++ b/Config.mk
@@ -238,15 +238,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.2
-MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.16.2
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.3
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.16.3
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.16.2
+QEMU_TRADITIONAL_REVISION ?= xen-4.16.3
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/xen/Makefile b/xen/Makefile
index 8a403ee896..06dde1e03c 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 16
-export XEN_EXTRAVERSION ?= .3-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Dec 23 09:00:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Dec 2022 09:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468823.727990 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8duX-0002Nv-Eb; Fri, 23 Dec 2022 09:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468823.727990; Fri, 23 Dec 2022 09:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8duX-0002Ni-Ba; Fri, 23 Dec 2022 09:00:13 +0000
Received: by outflank-mailman (input) for mailman id 468823;
 Fri, 23 Dec 2022 09:00:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8duV-0002NM-PJ
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 09:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8duV-0007ub-OU
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 09:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8duV-0002lH-Nc
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 09:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YnuJX5csaxPzbtaQcQJZ4BorW9r8xc9YF4JktOReH68=; b=iH4vMDsjPEsfsi6QSS8aJpo482
	sTwlBRIgKxIvq9QvLDrqlZZjoUlOPK66+QU7W7U3tQfjlO8gSOMoA8ebrzINO7TPjty0Vf6YXFL21
	uDxwIJo1rrPy/pfHhVgg/JhGiqO11GKUanYGuvbFfghWE6//Kb9NYEoye/yFAo+OayK8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] update Xen version to 4.16.4-pre
Message-Id: <E1p8duV-0002lH-Nc@xenbits.xenproject.org>
Date: Fri, 23 Dec 2022 09:00:11 +0000

commit e3396cd8be5ee99d363a23f30c680e42fb2757bd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Dec 20 13:50:16 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 13:50:16 2022 +0100

    update Xen version to 4.16.4-pre
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 06dde1e03c..67c5551ffd 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 16
-export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Dec 23 09:00:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Dec 2022 09:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468825.727996 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8duh-0002QS-GF; Fri, 23 Dec 2022 09:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468825.727996; Fri, 23 Dec 2022 09:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8duh-0002QL-D9; Fri, 23 Dec 2022 09:00:23 +0000
Received: by outflank-mailman (input) for mailman id 468825;
 Fri, 23 Dec 2022 09:00:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8duf-0002Q5-Sd
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 09:00:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8duf-0007uu-Ro
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 09:00:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8duf-0002mF-Qg
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 09:00:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1mBbWRXoWay0dRtlGobmjeEenaqW7aDKybawbug5Wmw=; b=AJXEFhFdCrVCau3Yq7P5VqlL4I
	+b2tsBdyHJ//mryKL6bGN+CcwLcIY1BFiPIw7PKkZg9khCuhBuhZHCHlkDqTH3Lnvylvo9RqEBitn
	BGcPy3Jd3seOvTZQvAbQTea64UeMnjsIy+gKud2vpZsEg6kcD1mGuBH8ewUGxf9JYHFw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] ioreq_broadcast(): accept partial broadcast success
Message-Id: <E1p8duf-0002mF-Qg@xenbits.xenproject.org>
Date: Fri, 23 Dec 2022 09:00:21 +0000

commit f2edbd79f5d5ce3b633885469852e1215dc0d4b5
Author:     Per Bilse <per.bilse@citrix.com>
AuthorDate: Tue Dec 20 13:50:47 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 13:50:47 2022 +0100

    ioreq_broadcast(): accept partial broadcast success
    
    Avoid incorrectly triggering an error when a broadcast buffered ioreq
    is not handled by all registered clients, as long as the failure is
    strictly because the client doesn't handle buffered ioreqs.
    
    Signed-off-by: Per Bilse <per.bilse@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    master commit: a44734df6c24fadbdb001f051cc5580c467caf7d
    master date: 2022-12-07 12:17:30 +0100
---
 xen/common/ioreq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c
index 42414b750b..2a8d8de2d5 100644
--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -1322,7 +1322,8 @@ unsigned int ioreq_broadcast(ioreq_t *p, bool buffered)
 
     FOR_EACH_IOREQ_SERVER(d, id, s)
     {
-        if ( !s->enabled )
+        if ( !s->enabled ||
+             (buffered && s->bufioreq_handling == HVM_IOREQSRV_BUFIOREQ_OFF) )
             continue;
 
         if ( ioreq_send(s, p, buffered) == IOREQ_STATUS_UNHANDLED )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Dec 23 09:00:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Dec 2022 09:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.468826.728000 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p8dur-0002TE-Hh; Fri, 23 Dec 2022 09:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 468826.728000; Fri, 23 Dec 2022 09: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 1p8dur-0002T6-Ei; Fri, 23 Dec 2022 09:00:33 +0000
Received: by outflank-mailman (input) for mailman id 468826;
 Fri, 23 Dec 2022 09:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8dup-0002Su-Ve
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 09:00:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8dup-0007vC-Un
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 09:00:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p8dup-0002nG-Tx
 for xen-changelog@lists.xenproject.org; Fri, 23 Dec 2022 09:00:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eyf/XHD1yO93JDUVG8/FR90ypHLIsG3fyZRbwVW3Mxk=; b=dI8UCMybPtnlefwsoWh9qKuSJL
	hUryzOgkvOKXVZM08z7EHs/D+7fL1u9iCE5/FytKJvauWqKvDSXFkTFW5eURXcBs3YTvDdIz5BvK7
	kw8Hho2KWAGoDZcVHifzOgnV2pSggajwk+jIGoMfoQkrxbt6yCqTTpknTSiZnsXjhDXo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/time: prevent overflow with high frequency TSCs
Message-Id: <E1p8dup-0002nG-Tx@xenbits.xenproject.org>
Date: Fri, 23 Dec 2022 09:00:31 +0000

commit 65bf12135f618614bbf44626fba1c20ca8d1a127
Author:     Neowutran <xen@neowutran.ovh>
AuthorDate: Tue Dec 20 13:51:42 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 13:51:42 2022 +0100

    x86/time: prevent overflow with high frequency TSCs
    
    Make sure tsc_khz is promoted to a 64-bit type before multiplying by
    1000 to avoid an 'overflow before widen' bug. Otherwise just above
    4.294GHz the value will overflow. Processors with clocks this high are
    now in production and require this to work correctly.
    
    Signed-off-by: Neowutran <xen@neowutran.ovh>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: ad15a0a8ca2515d8ac58edfc0bc1d3719219cb77
    master date: 2022-12-19 11:34:16 +0100
---
 xen/arch/x86/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 1daff92dca..db0b149ec6 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -2490,7 +2490,7 @@ int tsc_set_info(struct domain *d,
     case TSC_MODE_ALWAYS_EMULATE:
         d->arch.vtsc_offset = get_s_time() - elapsed_nsec;
         d->arch.tsc_khz = gtsc_khz ?: cpu_khz;
-        set_time_scale(&d->arch.vtsc_to_ns, d->arch.tsc_khz * 1000);
+        set_time_scale(&d->arch.vtsc_to_ns, d->arch.tsc_khz * 1000UL);
 
         /*
          * In default mode use native TSC if the host has safe TSC and
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:11:09 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469111.728363 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Et-0000YF-Km; Sat, 24 Dec 2022 14:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469111.728363; Sat, 24 Dec 2022 14:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Et-0000Y7-I4; Sat, 24 Dec 2022 14:11:03 +0000
Received: by outflank-mailman (input) for mailman id 469111;
 Sat, 24 Dec 2022 14:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Es-0000Y1-IE
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Es-0007xW-HU
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Es-0002ef-GW
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MZVvU14BPTwbaAwhFcP7CSqpCrqSvBK1vTLH+oT1lNg=; b=6dwQjtP9qdkBTxxl68f3bZatA0
	gx+LhfzXc4YfI8zDU/3Gf0bSQd9Fm7rSHQwUCEst0JzFhAr/J+0sUnsmjIKRXk6Da/lZCa51ZtjLW
	0JH9xI9K94cX8rc+ltFZHz2r8rlLQpx3xzTgL6ap66Mcwqv0vJA9m6SDqYjzYZeD6/Dc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: implement VMExit based guest Bus Lock detection
Message-Id: <E1p95Es-0002ef-GW@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:11:02 +0000

commit f7d07619d2ae0382e2922e287fbfbb27722f3f0b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Dec 19 11:22:43 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 19 11:22:43 2022 +0100

    x86/vmx: implement VMExit based guest Bus Lock detection
    
    Add support for enabling guest Bus Lock Detection on Intel systems.
    Such detection works by triggering a vmexit, which ought to be enough
    of a pause to prevent a guest from abusing of the Bus Lock.
    
    Add an extra Xen perf counter to track the number of Bus Locks detected.
    This is done because Bus Locks can also be reported by setting the bit
    26 in the exit reason field, so also account for those.
    
    Note EXIT_REASON_BUS_LOCK VMExits will always have bit 26 set in
    exit_reason, and hence the performance counter doesn't need to be
    increased for EXIT_REASON_BUS_LOCK handling.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c             |  4 +++-
 xen/arch/x86/hvm/vmx/vmx.c              | 15 +++++++++++++++
 xen/arch/x86/hvm/vmx/vvmx.c             |  3 ++-
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  3 +++
 xen/arch/x86/include/asm/hvm/vmx/vmx.h  |  2 ++
 xen/arch/x86/include/asm/perfc_defn.h   |  4 +++-
 6 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 84dbb88d33..a0d5e8d6ab 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -209,6 +209,7 @@ static void __init vmx_display_features(void)
     P(cpu_has_vmx_virt_exceptions, "Virtualisation Exceptions");
     P(cpu_has_vmx_pml, "Page Modification Logging");
     P(cpu_has_vmx_tsc_scaling, "TSC Scaling");
+    P(cpu_has_vmx_bus_lock_detection, "Bus Lock Detection");
 #undef P
 
     if ( !printed )
@@ -318,7 +319,8 @@ static int vmx_init_vmcs_config(bool bsp)
                SECONDARY_EXEC_ENABLE_VM_FUNCTIONS |
                SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS |
                SECONDARY_EXEC_XSAVES |
-               SECONDARY_EXEC_TSC_SCALING);
+               SECONDARY_EXEC_TSC_SCALING |
+               SECONDARY_EXEC_BUS_LOCK_DETECTION);
         if ( _vmx_misc_cap & VMX_MISC_VMWRITE_ALL )
             opt |= SECONDARY_EXEC_ENABLE_VMCS_SHADOWING;
         if ( opt_vpid_enabled )
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 7c81b80710..3898f92f85 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -4081,6 +4081,12 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
             return;
     }
 
+    if ( unlikely(exit_reason & VMX_EXIT_REASONS_BUS_LOCK) )
+    {
+        perfc_incr(buslock);
+        exit_reason &= ~VMX_EXIT_REASONS_BUS_LOCK;
+    }
+
     /* XXX: This looks ugly, but we need a mechanism to ensure
      * any pending vmresume has really happened
      */
@@ -4590,6 +4596,15 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
         vmx_handle_descriptor_access(exit_reason);
         break;
 
+    case EXIT_REASON_BUS_LOCK:
+        /*
+         * Nothing to do: just taking a vmexit should be enough of a pause to
+         * prevent a VM from crippling the host with bus locks.  Note
+         * EXIT_REASON_BUS_LOCK will always have bit 26 set in exit_reason, and
+         * hence the perf counter is already increased.
+         */
+        break;
+
     case EXIT_REASON_VMX_PREEMPTION_TIMER_EXPIRED:
     case EXIT_REASON_INVPCID:
     /* fall through */
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 5f54451475..2095c1e612 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -2405,7 +2405,7 @@ void nvmx_idtv_handling(void)
      * be reinjected, otherwise, pass to L1.
      */
     __vmread(VM_EXIT_REASON, &reason);
-    if ( reason != EXIT_REASON_EPT_VIOLATION ?
+    if ( (uint16_t)reason != EXIT_REASON_EPT_VIOLATION ?
          !(nvmx->intr.intr_info & INTR_INFO_VALID_MASK) :
          !nvcpu->nv_vmexit_pending )
     {
@@ -2486,6 +2486,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
     case EXIT_REASON_EPT_VIOLATION:
     case EXIT_REASON_EPT_MISCONFIG:
     case EXIT_REASON_EXTERNAL_INTERRUPT:
+    case EXIT_REASON_BUS_LOCK:
         /* pass to L0 handler */
         break;
     case VMX_EXIT_REASONS_FAILED_VMENTRY:
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 75f9928abf..f3df5113d4 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -267,6 +267,7 @@ extern u32 vmx_vmentry_control;
 #define SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS   0x00040000
 #define SECONDARY_EXEC_XSAVES                   0x00100000
 #define SECONDARY_EXEC_TSC_SCALING              0x02000000
+#define SECONDARY_EXEC_BUS_LOCK_DETECTION       0x40000000
 extern u32 vmx_secondary_exec_control;
 
 #define VMX_EPT_EXEC_ONLY_SUPPORTED                         0x00000001
@@ -346,6 +347,8 @@ extern u64 vmx_ept_vpid_cap;
     (vmx_secondary_exec_control & SECONDARY_EXEC_XSAVES)
 #define cpu_has_vmx_tsc_scaling \
     (vmx_secondary_exec_control & SECONDARY_EXEC_TSC_SCALING)
+#define cpu_has_vmx_bus_lock_detection \
+    (vmx_secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION)
 
 #define VMCS_RID_TYPE_MASK              0x80000000
 
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index 8eedf59155..03995701a1 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -159,6 +159,7 @@ static inline void pi_clear_sn(struct pi_desc *pi_desc)
  * Exit Reasons
  */
 #define VMX_EXIT_REASONS_FAILED_VMENTRY 0x80000000
+#define VMX_EXIT_REASONS_BUS_LOCK       (1u << 26)
 
 #define EXIT_REASON_EXCEPTION_NMI       0
 #define EXIT_REASON_EXTERNAL_INTERRUPT  1
@@ -219,6 +220,7 @@ static inline void pi_clear_sn(struct pi_desc *pi_desc)
 #define EXIT_REASON_PML_FULL            62
 #define EXIT_REASON_XSAVES              63
 #define EXIT_REASON_XRSTORS             64
+#define EXIT_REASON_BUS_LOCK            74
 /* Remember to also update VMX_PERF_EXIT_REASON_SIZE! */
 
 /*
diff --git a/xen/arch/x86/include/asm/perfc_defn.h b/xen/arch/x86/include/asm/perfc_defn.h
index 509afc516b..6fce21e85a 100644
--- a/xen/arch/x86/include/asm/perfc_defn.h
+++ b/xen/arch/x86/include/asm/perfc_defn.h
@@ -6,7 +6,7 @@ PERFCOUNTER_ARRAY(exceptions,           "exceptions", 32)
 
 #ifdef CONFIG_HVM
 
-#define VMX_PERF_EXIT_REASON_SIZE 65
+#define VMX_PERF_EXIT_REASON_SIZE 75
 #define VMEXIT_NPF_PERFC 143
 #define SVM_PERF_EXIT_REASON_SIZE (VMEXIT_NPF_PERFC + 1)
 PERFCOUNTER_ARRAY(vmexits,              "vmexits",
@@ -128,4 +128,6 @@ PERFCOUNTER(pauseloop_exits, "vmexits from Pause-Loop Detection")
 PERFCOUNTER(iommu_pt_shatters,    "IOMMU page table shatters")
 PERFCOUNTER(iommu_pt_coalesces,   "IOMMU page table coalesces")
 
+PERFCOUNTER(buslock, "Bus Locks Detected")
+
 /*#endif*/ /* __XEN_PERFC_DEFN_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:11:13 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469112.728367 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95F3-0000aC-ME; Sat, 24 Dec 2022 14:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469112.728367; Sat, 24 Dec 2022 14:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95F3-0000a4-Jc; Sat, 24 Dec 2022 14:11:13 +0000
Received: by outflank-mailman (input) for mailman id 469112;
 Sat, 24 Dec 2022 14:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95F2-0000Zu-Mi
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95F2-0007xe-LU
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95F2-0002f4-Jx
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1QRNcl3g2rDrlK2yjwS8GXP4wUR57PTbCKoATxsxg8U=; b=VFjsDrzojHwZWAWHyk6qp2wSWn
	ftVipufikJyVb4QJFj9ufamnrrFqYx1hwpHw3/x/H1ObNVp6viKQHEGzOsG3zHkqAvQjp54F0G94s
	ltH9hVfJkrFGMJDMWoeGV4kpM8Y4mPo7mVH+JSwOsrDqRbAHA6vAuxWnyXstszem2hdY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: introduce helper to set VMX_INTR_SHADOW_NMI
Message-Id: <E1p95F2-0002f4-Jx@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:11:12 +0000

commit d329b37d12132164c3894d0b6284be72576ef950
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Dec 19 11:23:34 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 19 11:23:34 2022 +0100

    x86/vmx: introduce helper to set VMX_INTR_SHADOW_NMI
    
    Introduce a small helper to OR VMX_INTR_SHADOW_NMI in
    GUEST_INTERRUPTIBILITY_INFO in order to help dealing with the NMI
    unblocked by IRET case.  Replace the existing usage in handling
    EXIT_REASON_EXCEPTION_NMI and also add such handling to EPT violations
    and page-modification log-full events.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/hvm/vmx/vmx.c             | 28 +++++++++++++++++++++-------
 xen/arch/x86/include/asm/hvm/vmx/vmx.h |  3 +++
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 3898f92f85..dabf4a3552 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3964,6 +3964,15 @@ static int vmx_handle_apic_write(void)
     return vlapic_apicv_write(current, exit_qualification & 0xfff);
 }
 
+static void undo_nmis_unblocked_by_iret(void)
+{
+    unsigned long guest_info;
+
+    __vmread(GUEST_INTERRUPTIBILITY_INFO, &guest_info);
+    __vmwrite(GUEST_INTERRUPTIBILITY_INFO,
+              guest_info | VMX_INTR_SHADOW_NMI);
+}
+
 void vmx_vmexit_handler(struct cpu_user_regs *regs)
 {
     unsigned long exit_qualification, exit_reason, idtv_info, intr_info = 0;
@@ -4164,13 +4173,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
         if ( unlikely(intr_info & INTR_INFO_NMI_UNBLOCKED_BY_IRET) &&
              !(idtv_info & INTR_INFO_VALID_MASK) &&
              (vector != TRAP_double_fault) )
-        {
-            unsigned long guest_info;
-
-            __vmread(GUEST_INTERRUPTIBILITY_INFO, &guest_info);
-            __vmwrite(GUEST_INTERRUPTIBILITY_INFO,
-                      guest_info | VMX_INTR_SHADOW_NMI);
-        }
+            undo_nmis_unblocked_by_iret();
 
         perfc_incra(cause_vector, vector);
 
@@ -4536,6 +4539,11 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
 
         __vmread(GUEST_PHYSICAL_ADDRESS, &gpa);
         __vmread(EXIT_QUALIFICATION, &exit_qualification);
+
+        if ( unlikely(exit_qualification & INTR_INFO_NMI_UNBLOCKED_BY_IRET) &&
+             !(idtv_info & INTR_INFO_VALID_MASK) )
+            undo_nmis_unblocked_by_iret();
+
         ept_handle_violation(exit_qualification, gpa);
         break;
     }
@@ -4580,6 +4588,12 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
         break;
 
     case EXIT_REASON_PML_FULL:
+        __vmread(EXIT_QUALIFICATION, &exit_qualification);
+
+        if ( unlikely(exit_qualification & INTR_INFO_NMI_UNBLOCKED_BY_IRET) &&
+             !(idtv_info & INTR_INFO_VALID_MASK) )
+            undo_nmis_unblocked_by_iret();
+
         vmx_vcpu_flush_pml_buffer(v);
         break;
 
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index 03995701a1..eae39365aa 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -225,6 +225,9 @@ static inline void pi_clear_sn(struct pi_desc *pi_desc)
 
 /*
  * Interruption-information format
+ *
+ * Note INTR_INFO_NMI_UNBLOCKED_BY_IRET is also used with Exit Qualification
+ * field for EPT violations, PML full and SPP-related event vmexits.
  */
 #define INTR_INFO_VECTOR_MASK           0xff            /* 7:0 */
 #define INTR_INFO_INTR_TYPE_MASK        0x700           /* 10:8 */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:11:23 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469113.728370 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95FD-0000d2-Ni; Sat, 24 Dec 2022 14:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469113.728370; Sat, 24 Dec 2022 14:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95FD-0000cv-LD; Sat, 24 Dec 2022 14:11:23 +0000
Received: by outflank-mailman (input) for mailman id 469113;
 Sat, 24 Dec 2022 14:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95FC-0000cp-Q6
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95FC-0007yG-PN
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95FC-0002fT-OQ
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1z80yucyz4faoKWMKhiYdl2dWdJH0afdiLV1HJYLZ/c=; b=ECsefVgFzkthupVhc9CQnU3qe9
	mYEFdyI3CbaHSJERMSfv76iF21wG5byvnjqaya1N9cBQD1dGUdsD47WCAr7/Ait3mVgxYLzP7KZ5l
	8RIW2Cw76w0/+7Ryr3piRVGQBp2KlXzuOm/i6xJUpIP0AgJBCWnqOwCOH5tv34fQq+PY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: implement Notify VM Exit
Message-Id: <E1p95FC-0002fT-OQ@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:11:22 +0000

commit 573279cde1c4e752d4df34bc65ffafa17573148e
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Dec 19 11:24:14 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 19 11:24:14 2022 +0100

    x86/vmx: implement Notify VM Exit
    
    Under certain conditions guests can get the CPU stuck in an unbounded
    loop without the possibility of an interrupt window to occur on
    instruction boundary.  This was the case with the scenarios described
    in XSA-156.
    
    Make use of the Notify VM Exit mechanism, that will trigger a VM Exit
    if no interrupt window occurs for a specified amount of time.  Note
    that using the Notify VM Exit avoids having to trap #AC and #DB
    exceptions, as Xen is guaranteed to get a VM Exit even if the guest
    puts the CPU in a loop without an interrupt window, as such disable
    the intercepts if the feature is available and enabled.
    
    Setting the notify VM exit window to 0 is safe because there's a
    threshold added by the hardware in order to have a sane window value.
    
    Note the handling of EXIT_REASON_NOTIFY in the nested virtualization
    case is passed to L0, and hence a nested guest being able to trigger a
    notify VM exit with an invalid context would be able to crash the L1
    hypervisor (by L0 destroying the domain).  Since we don't expose VM
    Notify support to L1 it should already enable the required
    protections in order to prevent VM Notify from triggering in the first
    place.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 docs/misc/xen-command-line.pandoc       | 11 +++++++++++
 xen/arch/x86/hvm/vmx/vmcs.c             | 17 +++++++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c              | 32 ++++++++++++++++++++++++++++++--
 xen/arch/x86/hvm/vmx/vvmx.c             |  1 +
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  4 ++++
 xen/arch/x86/include/asm/hvm/vmx/vmx.h  |  6 ++++++
 xen/arch/x86/include/asm/perfc_defn.h   |  3 ++-
 7 files changed, 71 insertions(+), 3 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index b7ee97be76..923910f553 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2636,6 +2636,17 @@ guest will notify Xen that it has failed to acquire a spinlock.
 <major>, <minor> and <build> must be integers. The values will be
 encoded in guest CPUID 0x40000002 if viridian enlightenments are enabled.
 
+### vm-notify-window (Intel)
+> `= <integer>`
+
+> Default: `0`
+
+Specify the value of the VM Notify window used to detect locked VMs. Set to -1
+to disable the feature.  Value is in units of crystal clock cycles.
+
+Note the hardware might add a threshold to the provided value in order to make
+it safe, and hence using 0 is fine.
+
 ### vpid (Intel)
 > `= <boolean>`
 
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index a0d5e8d6ab..3d7c471a3f 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -67,6 +67,9 @@ integer_param("ple_gap", ple_gap);
 static unsigned int __read_mostly ple_window = 4096;
 integer_param("ple_window", ple_window);
 
+static unsigned int __ro_after_init vm_notify_window;
+integer_param("vm-notify-window", vm_notify_window);
+
 static bool __read_mostly opt_ept_pml = true;
 static s8 __read_mostly opt_ept_ad = -1;
 int8_t __read_mostly opt_ept_exec_sp = -1;
@@ -210,6 +213,7 @@ static void __init vmx_display_features(void)
     P(cpu_has_vmx_pml, "Page Modification Logging");
     P(cpu_has_vmx_tsc_scaling, "TSC Scaling");
     P(cpu_has_vmx_bus_lock_detection, "Bus Lock Detection");
+    P(cpu_has_vmx_notify_vm_exiting, "Notify VM Exit");
 #undef P
 
     if ( !printed )
@@ -329,6 +333,8 @@ static int vmx_init_vmcs_config(bool bsp)
             opt |= SECONDARY_EXEC_UNRESTRICTED_GUEST;
         if ( opt_ept_pml )
             opt |= SECONDARY_EXEC_ENABLE_PML;
+        if ( vm_notify_window != ~0u )
+            opt |= SECONDARY_EXEC_NOTIFY_VM_EXITING;
 
         /*
          * "APIC Register Virtualization" and "Virtual Interrupt Delivery"
@@ -1290,6 +1296,17 @@ static int construct_vmcs(struct vcpu *v)
     v->arch.hvm.vmx.exception_bitmap = HVM_TRAP_MASK
               | (paging_mode_hap(d) ? 0 : (1U << TRAP_page_fault))
               | (v->arch.fully_eager_fpu ? 0 : (1U << TRAP_no_device));
+    if ( cpu_has_vmx_notify_vm_exiting )
+    {
+        __vmwrite(NOTIFY_WINDOW, vm_notify_window);
+        /*
+         * Disable #AC and #DB interception: by using VM Notify Xen is
+         * guaranteed to get a VM exit even if the guest manages to lock the
+         * CPU.
+         */
+        v->arch.hvm.vmx.exception_bitmap &= ~((1U << TRAP_debug) |
+                                              (1U << TRAP_alignment_check));
+    }
     vmx_update_exception_bitmap(v);
 
     v->arch.hvm.guest_cr[0] = X86_CR0_PE | X86_CR0_ET;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index dabf4a3552..b11578777a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1428,10 +1428,19 @@ static void cf_check vmx_update_host_cr3(struct vcpu *v)
 
 void vmx_update_debug_state(struct vcpu *v)
 {
+    unsigned int mask = 1u << TRAP_int3;
+
+    if ( !cpu_has_monitor_trap_flag && cpu_has_vmx_notify_vm_exiting )
+        /*
+         * Only allow toggling TRAP_debug if notify VM exit is enabled, as
+         * unconditionally setting TRAP_debug is part of the XSA-156 fix.
+         */
+        mask |= 1u << TRAP_debug;
+
     if ( v->arch.hvm.debug_state_latch )
-        v->arch.hvm.vmx.exception_bitmap |= 1U << TRAP_int3;
+        v->arch.hvm.vmx.exception_bitmap |= mask;
     else
-        v->arch.hvm.vmx.exception_bitmap &= ~(1U << TRAP_int3);
+        v->arch.hvm.vmx.exception_bitmap &= ~mask;
 
     vmx_vmcs_enter(v);
     vmx_update_exception_bitmap(v);
@@ -4180,6 +4189,9 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
         switch ( vector )
         {
         case TRAP_debug:
+            if ( cpu_has_monitor_trap_flag && cpu_has_vmx_notify_vm_exiting )
+                goto exit_and_crash;
+
             /*
              * Updates DR6 where debugger can peek (See 3B 23.2.1,
              * Table 23-1, "Exit Qualification for Debug Exceptions").
@@ -4619,6 +4631,22 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
          */
         break;
 
+    case EXIT_REASON_NOTIFY:
+        __vmread(EXIT_QUALIFICATION, &exit_qualification);
+
+        if ( unlikely(exit_qualification & NOTIFY_VM_CONTEXT_INVALID) )
+        {
+            perfc_incr(vmnotify_crash);
+            gprintk(XENLOG_ERR, "invalid VM context after notify vmexit\n");
+            domain_crash(v->domain);
+            break;
+        }
+
+        if ( unlikely(exit_qualification & INTR_INFO_NMI_UNBLOCKED_BY_IRET) )
+            undo_nmis_unblocked_by_iret();
+
+        break;
+
     case EXIT_REASON_VMX_PREEMPTION_TIMER_EXPIRED:
     case EXIT_REASON_INVPCID:
     /* fall through */
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 2095c1e612..f8fe8d0c14 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -2487,6 +2487,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
     case EXIT_REASON_EPT_MISCONFIG:
     case EXIT_REASON_EXTERNAL_INTERRUPT:
     case EXIT_REASON_BUS_LOCK:
+    case EXIT_REASON_NOTIFY:
         /* pass to L0 handler */
         break;
     case VMX_EXIT_REASONS_FAILED_VMENTRY:
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index f3df5113d4..78404e42b3 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -268,6 +268,7 @@ extern u32 vmx_vmentry_control;
 #define SECONDARY_EXEC_XSAVES                   0x00100000
 #define SECONDARY_EXEC_TSC_SCALING              0x02000000
 #define SECONDARY_EXEC_BUS_LOCK_DETECTION       0x40000000
+#define SECONDARY_EXEC_NOTIFY_VM_EXITING        0x80000000
 extern u32 vmx_secondary_exec_control;
 
 #define VMX_EPT_EXEC_ONLY_SUPPORTED                         0x00000001
@@ -349,6 +350,8 @@ extern u64 vmx_ept_vpid_cap;
     (vmx_secondary_exec_control & SECONDARY_EXEC_TSC_SCALING)
 #define cpu_has_vmx_bus_lock_detection \
     (vmx_secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION)
+#define cpu_has_vmx_notify_vm_exiting \
+    (vmx_secondary_exec_control & SECONDARY_EXEC_NOTIFY_VM_EXITING)
 
 #define VMCS_RID_TYPE_MASK              0x80000000
 
@@ -456,6 +459,7 @@ enum vmcs_field {
     SECONDARY_VM_EXEC_CONTROL       = 0x0000401e,
     PLE_GAP                         = 0x00004020,
     PLE_WINDOW                      = 0x00004022,
+    NOTIFY_WINDOW                   = 0x00004024,
     VM_INSTRUCTION_ERROR            = 0x00004400,
     VM_EXIT_REASON                  = 0x00004402,
     VM_EXIT_INTR_INFO               = 0x00004404,
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index eae39365aa..8e1e42ac47 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -221,6 +221,7 @@ static inline void pi_clear_sn(struct pi_desc *pi_desc)
 #define EXIT_REASON_XSAVES              63
 #define EXIT_REASON_XRSTORS             64
 #define EXIT_REASON_BUS_LOCK            74
+#define EXIT_REASON_NOTIFY              75
 /* Remember to also update VMX_PERF_EXIT_REASON_SIZE! */
 
 /*
@@ -236,6 +237,11 @@ static inline void pi_clear_sn(struct pi_desc *pi_desc)
 #define INTR_INFO_VALID_MASK            0x80000000      /* 31 */
 #define INTR_INFO_RESVD_BITS_MASK       0x7ffff000
 
+/*
+ * Exit Qualifications for NOTIFY VM EXIT
+ */
+#define NOTIFY_VM_CONTEXT_INVALID       1u
+
 /*
  * Exit Qualifications for MOV for Control Register Access
  */
diff --git a/xen/arch/x86/include/asm/perfc_defn.h b/xen/arch/x86/include/asm/perfc_defn.h
index 6fce21e85a..487e20dc97 100644
--- a/xen/arch/x86/include/asm/perfc_defn.h
+++ b/xen/arch/x86/include/asm/perfc_defn.h
@@ -6,7 +6,7 @@ PERFCOUNTER_ARRAY(exceptions,           "exceptions", 32)
 
 #ifdef CONFIG_HVM
 
-#define VMX_PERF_EXIT_REASON_SIZE 75
+#define VMX_PERF_EXIT_REASON_SIZE 76
 #define VMEXIT_NPF_PERFC 143
 #define SVM_PERF_EXIT_REASON_SIZE (VMEXIT_NPF_PERFC + 1)
 PERFCOUNTER_ARRAY(vmexits,              "vmexits",
@@ -129,5 +129,6 @@ PERFCOUNTER(iommu_pt_shatters,    "IOMMU page table shatters")
 PERFCOUNTER(iommu_pt_coalesces,   "IOMMU page table coalesces")
 
 PERFCOUNTER(buslock, "Bus Locks Detected")
+PERFCOUNTER(vmnotify_crash, "domain crashes by Notify VM Exit")
 
 /*#endif*/ /* __XEN_PERFC_DEFN_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:11:33 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469114.728375 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95FN-0000gI-PL; Sat, 24 Dec 2022 14:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469114.728375; Sat, 24 Dec 2022 14: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 1p95FN-0000gA-Mp; Sat, 24 Dec 2022 14:11:33 +0000
Received: by outflank-mailman (input) for mailman id 469114;
 Sat, 24 Dec 2022 14:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95FM-0000g0-TK
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95FM-0007zw-Sb
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95FM-0002g0-Rf
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xp6zDaqxw/USM+jcgnbAbsaD338j0jV9tmKRM3hQ+cU=; b=wHCFeMk7x2C7SwudgyVPxtClXn
	gMhixAlgn1iwcpqfpcx0YLUmlnjPBlHELxtK2lZzgBMulo43UrTMA+9u3iJeQdlJzAG64Satsq5vO
	UudBBUzpgr8z/Llgpuyvjyuv0kGDT2onmfJGBThCqnX1sptUk0Mk/jOcToL63pAtAu/E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: prevent overflow with high frequency TSCs
Message-Id: <E1p95FM-0002g0-Rf@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:11:32 +0000

commit ad15a0a8ca2515d8ac58edfc0bc1d3719219cb77
Author:     Neowutran <xen@neowutran.ovh>
AuthorDate: Mon Dec 19 11:34:16 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 19 11:34:16 2022 +0100

    x86/time: prevent overflow with high frequency TSCs
    
    Make sure tsc_khz is promoted to a 64-bit type before multiplying by
    1000 to avoid an 'overflow before widen' bug. Otherwise just above
    4.294GHz the value will overflow. Processors with clocks this high are
    now in production and require this to work correctly.
    
    Signed-off-by: Neowutran <xen@neowutran.ovh>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index b01acd390d..d882b43cf0 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -2585,7 +2585,7 @@ int tsc_set_info(struct domain *d,
     case TSC_MODE_ALWAYS_EMULATE:
         d->arch.vtsc_offset = get_s_time() - elapsed_nsec;
         d->arch.tsc_khz = gtsc_khz ?: cpu_khz;
-        set_time_scale(&d->arch.vtsc_to_ns, d->arch.tsc_khz * 1000);
+        set_time_scale(&d->arch.vtsc_to_ns, d->arch.tsc_khz * 1000UL);
 
         /*
          * In default mode use native TSC if the host has safe TSC and
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:11:44 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469115.728379 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95FX-0000jY-Sa; Sat, 24 Dec 2022 14:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469115.728379; Sat, 24 Dec 2022 14: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 1p95FX-0000jQ-Pm; Sat, 24 Dec 2022 14:11:43 +0000
Received: by outflank-mailman (input) for mailman id 469115;
 Sat, 24 Dec 2022 14:11:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95FX-0000jH-0p
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95FX-000808-01
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95FW-0002gP-VG
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hT4kPemolGdJf3xx3ZGDJHxFgNkdT6h+aI9bdT5UgNE=; b=6Y88i8bMWLTLYolX/6Qz7u14TG
	Wu0HT9a0e6bF5DN4mty+GgJW7QwwFDo+PlyyKwe6o10t9xwX0G7J6sziKJiEs+qT2esc5Cj8xKb4a
	S7XYqei0dhIg1Sr0L7OAfJRXGLQU+YhEo7V6HwPh6a9pDXC14VNH90lgkU1wIXwJYi3o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] NUMA: replace phys_to_nid()
Message-Id: <E1p95FW-0002gP-VG@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:11:42 +0000

commit da5092e7d6ed4714b5dc63ed2cd7f6c93dd6efd4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 19 11:35:25 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 19 11:35:25 2022 +0100

    NUMA: replace phys_to_nid()
    
    All callers convert frame numbers (perhaps in turn derived from struct
    page_info pointers) to an address, just for the function to convert it
    back to a frame number (as the first step of paddr_to_pdx()). Replace
    the function by mfn_to_nid() plus a page_to_nid() wrapper macro. Replace
    call sites by the respectively most suitable one.
    
    While there also
    - introduce a !NUMA stub, eliminating the need for Arm (and potentially
      other ports) to carry one individually,
    - drop the (strictly speaking wrong) "pure" attribute from the function,
    - extend a condition in dump_numa() to make sure that none of the
      assertions would trigger for empty or (unlikely) single-page nodes (at
      the same time this also prevents the warning printk() to be issued for
      every empty [e.g. CPU-only] node).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/numa.h |  5 -----
 xen/arch/x86/mm/p2m-pod.c       |  2 +-
 xen/arch/x86/x86_64/mm.c        |  6 +++---
 xen/common/numa.c               | 12 ++++++------
 xen/common/page_alloc.c         | 20 ++++++++++----------
 xen/include/xen/numa.h          | 19 ++++++++++++++++---
 6 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/xen/arch/arm/include/asm/numa.h b/xen/arch/arm/include/asm/numa.h
index 268a9db055..e2bee2bd82 100644
--- a/xen/arch/arm/include/asm/numa.h
+++ b/xen/arch/arm/include/asm/numa.h
@@ -11,11 +11,6 @@ typedef u8 nodeid_t;
 #define cpu_to_node(cpu) 0
 #define node_to_cpumask(node)   (cpu_online_map)
 
-static inline __attribute__((pure)) nodeid_t phys_to_nid(paddr_t addr)
-{
-    return 0;
-}
-
 /*
  * TODO: make first_valid_mfn static when NUMA is supported on Arm, this
  * is required because the dummy helpers are using it.
diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 2490c841f9..2edab5e5cd 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -492,7 +492,7 @@ p2m_pod_offline_or_broken_replace(struct page_info *p)
 {
     struct domain *d;
     struct p2m_domain *p2m;
-    nodeid_t node = phys_to_nid(page_to_maddr(p));
+    nodeid_t node = page_to_nid(p);
 
     if ( !(d = page_get_owner(p)) || !(p2m = p2m_get_hostp2m(d)) )
         return;
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index c9ddaaf36f..60db439af3 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -565,7 +565,7 @@ void __init paging_init(void)
                 if ( n == CNT )
                     ++holes;
                 else if ( k == holes )
-                    memflags = MEMF_node(phys_to_nid(mfn_to_maddr(mfn)));
+                    memflags = MEMF_node(mfn_to_nid(mfn));
             }
             if ( k == holes )
             {
@@ -600,7 +600,7 @@ void __init paging_init(void)
             mfn = _mfn(MFN(i) + n * PDX_GROUP_COUNT);
             if ( mfn_valid(mfn) )
             {
-                memflags = MEMF_node(phys_to_nid(mfn_to_maddr(mfn)));
+                memflags = MEMF_node(mfn_to_nid(mfn));
                 break;
             }
         }
@@ -677,7 +677,7 @@ void __init paging_init(void)
             mfn = _mfn(MFN(i) + n * PDX_GROUP_COUNT);
             if ( mfn_valid(mfn) )
             {
-                memflags = MEMF_node(phys_to_nid(mfn_to_maddr(mfn)));
+                memflags = MEMF_node(mfn_to_nid(mfn));
                 break;
             }
         }
diff --git a/xen/common/numa.c b/xen/common/numa.c
index 4948b21fbe..fc1f7f665b 100644
--- a/xen/common/numa.c
+++ b/xen/common/numa.c
@@ -671,15 +671,15 @@ static void cf_check dump_numa(unsigned char key)
 
     for_each_online_node ( i )
     {
-        paddr_t pa = pfn_to_paddr(node_start_pfn(i) + 1);
+        mfn_t mfn = _mfn(node_start_pfn(i) + 1);
 
         printk("NODE%u start->%lu size->%lu free->%lu\n",
                i, node_start_pfn(i), node_spanned_pages(i),
                avail_node_heap_pages(i));
-        /* Sanity check phys_to_nid() */
-        if ( phys_to_nid(pa) != i )
-            printk("phys_to_nid(%"PRIpaddr") -> %d should be %u\n",
-                   pa, phys_to_nid(pa), i);
+        /* Sanity check mfn_to_nid() */
+        if ( node_spanned_pages(i) > 1 && mfn_to_nid(mfn) != i )
+            printk("mfn_to_nid(%"PRI_mfn") -> %d should be %u\n",
+                   mfn_x(mfn), mfn_to_nid(mfn), i);
     }
 
     j = cpumask_first(&cpu_online_map);
@@ -721,7 +721,7 @@ static void cf_check dump_numa(unsigned char key)
         spin_lock(&d->page_alloc_lock);
         page_list_for_each ( page, &d->page_list )
         {
-            i = phys_to_nid(page_to_maddr(page));
+            i = page_to_nid(page);
             page_num_node[i]++;
         }
         spin_unlock(&d->page_alloc_lock);
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 0c93a10787..2b39a2a42f 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -971,7 +971,7 @@ static struct page_info *alloc_heap_pages(
         return NULL;
     }
 
-    node = phys_to_nid(page_to_maddr(pg));
+    node = page_to_nid(pg);
     zone = page_to_zone(pg);
     buddy_order = PFN_ORDER(pg);
 
@@ -1078,7 +1078,7 @@ static struct page_info *alloc_heap_pages(
 /* Remove any offlined page in the buddy pointed to by head. */
 static int reserve_offlined_page(struct page_info *head)
 {
-    unsigned int node = phys_to_nid(page_to_maddr(head));
+    unsigned int node = page_to_nid(head);
     int zone = page_to_zone(head), i, head_order = PFN_ORDER(head), count = 0;
     struct page_info *cur_head;
     unsigned int cur_order, first_dirty;
@@ -1443,7 +1443,7 @@ static void free_heap_pages(
 {
     unsigned long mask;
     mfn_t mfn = page_to_mfn(pg);
-    unsigned int i, node = phys_to_nid(mfn_to_maddr(mfn));
+    unsigned int i, node = mfn_to_nid(mfn);
     unsigned int zone = page_to_zone(pg);
     bool pg_offlined = false;
 
@@ -1487,7 +1487,7 @@ static void free_heap_pages(
                  !page_state_is(predecessor, free) ||
                  (predecessor->count_info & PGC_static) ||
                  (PFN_ORDER(predecessor) != order) ||
-                 (phys_to_nid(page_to_maddr(predecessor)) != node) )
+                 (page_to_nid(predecessor) != node) )
                 break;
 
             check_and_stop_scrub(predecessor);
@@ -1511,7 +1511,7 @@ static void free_heap_pages(
                  !page_state_is(successor, free) ||
                  (successor->count_info & PGC_static) ||
                  (PFN_ORDER(successor) != order) ||
-                 (phys_to_nid(page_to_maddr(successor)) != node) )
+                 (page_to_nid(successor) != node) )
                 break;
 
             check_and_stop_scrub(successor);
@@ -1574,7 +1574,7 @@ static unsigned long mark_page_offline(struct page_info *pg, int broken)
 static int reserve_heap_page(struct page_info *pg)
 {
     struct page_info *head = NULL;
-    unsigned int i, node = phys_to_nid(page_to_maddr(pg));
+    unsigned int i, node = page_to_nid(pg);
     unsigned int zone = page_to_zone(pg);
 
     for ( i = 0; i <= MAX_ORDER; i++ )
@@ -1794,7 +1794,7 @@ static void _init_heap_pages(const struct page_info *pg,
                              bool need_scrub)
 {
     unsigned long s, e;
-    unsigned int nid = phys_to_nid(page_to_maddr(pg));
+    unsigned int nid = page_to_nid(pg);
 
     s = mfn_x(page_to_mfn(pg));
     e = mfn_x(mfn_add(page_to_mfn(pg + nr_pages - 1), 1));
@@ -1869,7 +1869,7 @@ static void init_heap_pages(
 #ifdef CONFIG_SEPARATE_XENHEAP
         unsigned int zone = page_to_zone(pg);
 #endif
-        unsigned int nid = phys_to_nid(page_to_maddr(pg));
+        unsigned int nid = page_to_nid(pg);
         unsigned long left = nr_pages - i;
         unsigned long contig_pages;
 
@@ -1893,7 +1893,7 @@ static void init_heap_pages(
                 break;
 #endif
 
-            if ( nid != (phys_to_nid(page_to_maddr(pg + contig_pages))) )
+            if ( nid != (page_to_nid(pg + contig_pages)) )
                 break;
         }
 
@@ -1934,7 +1934,7 @@ void __init end_boot_allocator(void)
     {
         struct bootmem_region *r = &bootmem_region_list[i];
         if ( (r->s < r->e) &&
-             (phys_to_nid(pfn_to_paddr(r->s)) == cpu_to_node(0)) )
+             (mfn_to_nid(_mfn(r->s)) == cpu_to_node(0)) )
         {
             init_heap_pages(mfn_to_page(_mfn(r->s)), r->e - r->s);
             r->e = r->s;
diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
index 71a5f837b3..29b8c2df89 100644
--- a/xen/include/xen/numa.h
+++ b/xen/include/xen/numa.h
@@ -1,6 +1,7 @@
 #ifndef _XEN_NUMA_H
 #define _XEN_NUMA_H
 
+#include <xen/mm-frame.h>
 #include <asm/numa.h>
 
 #define NUMA_NO_NODE     0xFF
@@ -68,12 +69,15 @@ struct node_data {
 
 extern struct node_data node_data[];
 
-static inline nodeid_t __attribute_pure__ phys_to_nid(paddr_t addr)
+static inline nodeid_t mfn_to_nid(mfn_t mfn)
 {
     nodeid_t nid;
-    ASSERT((paddr_to_pdx(addr) >> memnode_shift) < memnodemapsize);
-    nid = memnodemap[paddr_to_pdx(addr) >> memnode_shift];
+    unsigned long pdx = mfn_to_pdx(mfn);
+
+    ASSERT((pdx >> memnode_shift) < memnodemapsize);
+    nid = memnodemap[pdx >> memnode_shift];
     ASSERT(nid < MAX_NUMNODES && node_data[nid].node_spanned_pages);
+
     return nid;
 }
 
@@ -102,6 +106,15 @@ extern bool numa_update_node_memblks(nodeid_t node, unsigned int arch_nid,
                                      paddr_t start, paddr_t size, bool hotplug);
 extern void numa_set_processor_nodes_parsed(nodeid_t node);
 
+#else
+
+static inline nodeid_t mfn_to_nid(mfn_t mfn)
+{
+    return 0;
+}
+
 #endif
 
+#define page_to_nid(pg) mfn_to_nid(page_to_mfn(pg))
+
 #endif /* _XEN_NUMA_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:11:54 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469116.728382 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Fh-0000lr-Tv; Sat, 24 Dec 2022 14:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469116.728382; Sat, 24 Dec 2022 14: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 1p95Fh-0000lj-RM; Sat, 24 Dec 2022 14:11:53 +0000
Received: by outflank-mailman (input) for mailman id 469116;
 Sat, 24 Dec 2022 14:11:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Fh-0000lb-3z
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Fh-00080L-3G
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Fh-0002h5-2R
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:11:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=e5W6SUk4SIAOG9HkTsKE4MCQ3XcZmpX1IZ6Zs2zt++o=; b=U1jvrq1Jsh60zJhf+7gJYIgOGj
	6s4H7azk2UzHD8BifxSR0IXBFCCuy+/SPBBNvN4Quk0rFdm/ieMC6kRaezCv4MUNfzys2vjJvsQ2j
	7DXsVGp14nHK4adivtTq+io4AvOixH4Q5f2GGNBr0m6wKtZKg1j4xyJA+XuEYghScXg4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Relocate Xen using memcpy() directly
Message-Id: <E1p95Fh-0002h5-2R@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:11:53 +0000

commit 68b2672a63280fa180f4e52c5dab54b04b1369ad
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 6 19:16:23 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 19 11:01:46 2022 +0000

    x86/boot: Relocate Xen using memcpy() directly
    
    We can relocate Xen by reading out of the virtual mapping that we're executing
    on, and write directly into the directmap.  In fact, this removes one
    dependency on Xen being "at 0" (the XEN_IMG_OFFSET passed as src) for
    relocation to occur.
    
    This removes all the temporary pagetable handling under the covers of
    move_memory(), and results in a forward copy rather than a chunked backwards
    copy (caused by move_memory() always constructing src and dst in a way to
    trigger memmove() to copy backwards).
    
    With the penultimate caller of move_memory() dropped, clean up the API.  Drop
    the keep boolean, folding in 0 from the final caller, and drop the return
    address which has been unused since c/s 0b76ce20de85 ("x86/setup: don't
    relocate the VGA hole.") in 2007.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/setup.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6bb5bc7c84..4102aae76d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -425,8 +425,8 @@ void *__init bootstrap_map(const module_t *mod)
     return ret;
 }
 
-static void *__init move_memory(
-    uint64_t dst, uint64_t src, unsigned int size, bool keep)
+static void __init move_memory(
+    uint64_t dst, uint64_t src, unsigned int size)
 {
     unsigned int blksz = BOOTSTRAP_MAP_LIMIT - BOOTSTRAP_MAP_BASE;
     unsigned int mask = (1L << L2_PAGETABLE_SHIFT) - 1;
@@ -463,13 +463,8 @@ static void *__init move_memory(
         src += sz;
         size -= sz;
 
-        if ( keep )
-            return size ? NULL : d + doffs;
-
         bootstrap_map(NULL);
     }
-
-    return NULL;
 }
 
 #undef BOOTSTRAP_MAP_LIMIT
@@ -1277,7 +1272,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
              * data until after we have switched to the relocated pagetables!
              */
             barrier();
-            move_memory(e, XEN_IMG_OFFSET, _end - _start, 1);
+            memcpy(__va(__pa(_start)), _start, _end - _start);
 
             /* Walk idle_pg_table, relocating non-leaf entries. */
             pl4e = __va(__pa(idle_pg_table));
@@ -1334,8 +1329,6 @@ void __init noreturn __start_xen(unsigned long mbi_p)
                    "1" (__va(__pa(cpu0_stack))), "2" (STACK_SIZE / 8)
                 : "memory" );
 
-            bootstrap_map(NULL);
-
             printk("New Xen image base address: %#lx\n", xen_phys_start);
         }
 
@@ -1361,7 +1354,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
             {
                 move_memory(end - size + headroom,
                             (uint64_t)mod[j].mod_start << PAGE_SHIFT,
-                            mod[j].mod_end, 0);
+                            mod[j].mod_end);
                 mod[j].mod_start = (end - size) >> PAGE_SHIFT;
                 mod[j].mod_end += headroom;
                 mod[j].reserved = 1;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:12:04 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469117.728387 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Fr-0000oX-Vh; Sat, 24 Dec 2022 14:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469117.728387; Sat, 24 Dec 2022 14: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 1p95Fr-0000oP-Sn; Sat, 24 Dec 2022 14:12:03 +0000
Received: by outflank-mailman (input) for mailman id 469117;
 Sat, 24 Dec 2022 14:12:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Fr-0000oF-98
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Fr-00080j-6o
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Fr-0002hd-5d
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aQQdDt/eNEOLgLuCw0A40EJY5DZOkakfSCNXp4V9my8=; b=0+552hthiy5xMobrDU3jxoD7Gi
	fkb/KTJGD/nCmSYPXatqhEbwRtAiAvW8o6gzsCP/1MveqWuorylpdo1slBqTW+3qZ59lynfiiAWWC
	aX/Ps00IB0Zi4bKRj6YVZvd4V1lDUDGRlrflloezcq53ms7PBHsWkkFvtTvnfzVuJetE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/golang: Refresh bindings following virtio changes
Message-Id: <E1p95Fr-0002hd-5d@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:12:03 +0000

commit 5f05b229319e25aa7f35735bba060ddbeb325872
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Dec 16 10:46:42 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 19 15:53:54 2022 +0000

    tools/golang: Refresh bindings following virtio changes
    
    Fixes: 43ba5202e2ee ("libxl: add support for generic virtio device")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: George Dunlap <george.dunlap@cloud.com>
---
 tools/golang/xenlight/helpers.gen.go | 62 ++++++++++++++++++++++++++++++++++++
 tools/golang/xenlight/types.gen.go   | 17 ++++++++++
 2 files changed, 79 insertions(+)

diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index cb1bdf9bdf..3ac4938858 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -1722,6 +1722,49 @@ xc.multi_touch_num_contacts = C.uint32_t(x.MultiTouchNumContacts)
  return nil
  }
 
+// NewDeviceVirtio returns an instance of DeviceVirtio initialized with defaults.
+func NewDeviceVirtio() (*DeviceVirtio, error) {
+var (
+x DeviceVirtio
+xc C.libxl_device_virtio)
+
+C.libxl_device_virtio_init(&xc)
+defer C.libxl_device_virtio_dispose(&xc)
+
+if err := x.fromC(&xc); err != nil {
+return nil, err }
+
+return &x, nil}
+
+func (x *DeviceVirtio) fromC(xc *C.libxl_device_virtio) error {
+ x.BackendDomid = Domid(xc.backend_domid)
+x.BackendDomname = C.GoString(xc.backend_domname)
+x.Type = C.GoString(xc._type)
+x.Transport = VirtioTransport(xc.transport)
+x.Devid = Devid(xc.devid)
+x.Irq = uint32(xc.irq)
+x.Base = uint64(xc.base)
+
+ return nil}
+
+func (x *DeviceVirtio) toC(xc *C.libxl_device_virtio) (err error){defer func(){
+if err != nil{
+C.libxl_device_virtio_dispose(xc)}
+}()
+
+xc.backend_domid = C.libxl_domid(x.BackendDomid)
+if x.BackendDomname != "" {
+xc.backend_domname = C.CString(x.BackendDomname)}
+if x.Type != "" {
+xc._type = C.CString(x.Type)}
+xc.transport = C.libxl_virtio_transport(x.Transport)
+xc.devid = C.libxl_devid(x.Devid)
+xc.irq = C.uint32_t(x.Irq)
+xc.base = C.uint64_t(x.Base)
+
+ return nil
+ }
+
 // NewDeviceDisk returns an instance of DeviceDisk initialized with defaults.
 func NewDeviceDisk() (*DeviceDisk, error) {
 var (
@@ -2855,6 +2898,15 @@ if err := x.Vkbs[i].fromC(&v); err != nil {
 return fmt.Errorf("converting field Vkbs: %v", err) }
 }
 }
+x.Virtios = nil
+if n := int(xc.num_virtios); n > 0 {
+cVirtios := (*[1<<28]C.libxl_device_virtio)(unsafe.Pointer(xc.virtios))[:n:n]
+x.Virtios = make([]DeviceVirtio, n)
+for i, v := range cVirtios {
+if err := x.Virtios[i].fromC(&v); err != nil {
+return fmt.Errorf("converting field Virtios: %v", err) }
+}
+}
 x.Vtpms = nil
 if n := int(xc.num_vtpms); n > 0 {
 cVtpms := (*[1<<28]C.libxl_device_vtpm)(unsafe.Pointer(xc.vtpms))[:n:n]
@@ -3016,6 +3068,16 @@ return fmt.Errorf("converting field Vkbs: %v", err)
 }
 }
 }
+if numVirtios := len(x.Virtios); numVirtios > 0 {
+xc.virtios = (*C.libxl_device_virtio)(C.malloc(C.ulong(numVirtios)*C.sizeof_libxl_device_virtio))
+xc.num_virtios = C.int(numVirtios)
+cVirtios := (*[1<<28]C.libxl_device_virtio)(unsafe.Pointer(xc.virtios))[:numVirtios:numVirtios]
+for i,v := range x.Virtios {
+if err := v.toC(&cVirtios[i]); err != nil {
+return fmt.Errorf("converting field Virtios: %v", err)
+}
+}
+}
 if numVtpms := len(x.Vtpms); numVtpms > 0 {
 xc.vtpms = (*C.libxl_device_vtpm)(C.malloc(C.ulong(numVtpms)*C.sizeof_libxl_device_vtpm))
 xc.num_vtpms = C.int(numVtpms)
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index 871576fb0e..16ce879e3f 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -255,6 +255,12 @@ VkbBackendQemu VkbBackend = 1
 VkbBackendLinux VkbBackend = 2
 )
 
+type VirtioTransport int
+const(
+VirtioTransportUnknown VirtioTransport = 0
+VirtioTransportMmio VirtioTransport = 1
+)
+
 type Passthrough int
 const(
 PassthroughDefault Passthrough = 0
@@ -644,6 +650,16 @@ MultiTouchHeight uint32
 MultiTouchNumContacts uint32
 }
 
+type DeviceVirtio struct {
+BackendDomid Domid
+BackendDomname string
+Type string
+Transport VirtioTransport
+Devid Devid
+Irq uint32
+Base uint64
+}
+
 type DeviceDisk struct {
 BackendDomid Domid
 BackendDomname string
@@ -933,6 +949,7 @@ Rdms []DeviceRdm
 Dtdevs []DeviceDtdev
 Vfbs []DeviceVfb
 Vkbs []DeviceVkb
+Virtios []DeviceVirtio
 Vtpms []DeviceVtpm
 P9S []DeviceP9
 Pvcallsifs []DevicePvcallsif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:12:14 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469118.728391 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95G2-0000rd-11; Sat, 24 Dec 2022 14:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469118.728391; Sat, 24 Dec 2022 14:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95G1-0000rR-UM; Sat, 24 Dec 2022 14:12:13 +0000
Received: by outflank-mailman (input) for mailman id 469118;
 Sat, 24 Dec 2022 14:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95G1-0000rK-AT
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95G1-00080u-9m
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95G1-0002iR-94
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=w9hupXYIWjt5APi89rSlcm+3kPexOLoQTnfFf9F8oBA=; b=2K8YzI5SNHyLJaRrLkdndSNAsY
	GqNXd0osfiHILp73rxNyGS+4+bH5Jenyr7Esp4ht1d2bNoGk11c6biS3Ri7ss4nqowCLJlUEaDIz+
	e0xbJqYdwhXpjeehm8DKBcBFmvtPTp1cj9cdU1OUcQtp9QzLdC0Bym9T1i8vr9Z8A5Bo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/xb,mmap: Use Data_abstract_val wrapper
Message-Id: <E1p95G1-0002iR-94@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:12:13 +0000

commit d2ccc637111d6dbcf808aaffeec7a46f0b1e1c81
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Dec 16 18:25:10 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 19 19:31:26 2022 +0000

    tools/ocaml/xb,mmap: Use Data_abstract_val wrapper
    
    This is not strictly necessary since it is essentially a no-op currently: a
    cast to void * and value *, even in OCaml 5.0.
    
    However it does make it clearer that what we have here is not a regular OCaml
    value, but one allocated with Abstract_tag or Custom_tag, and follows the
    example from the manual more closely:
    https://v2.ocaml.org/manual/intfc.html#ss:c-outside-head
    
    It also makes it clearer that these modules have been reviewed for
    compat with OCaml 5.0.
    
    We cannot use OCaml finalizers here, because we want exact control over when
    to unmap these pages from remote domains.
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/mmap/mmap_stubs.h    | 4 ++++
 tools/ocaml/libs/mmap/xenmmap_stubs.c | 2 +-
 tools/ocaml/libs/xb/xs_ring_stubs.c   | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/mmap/mmap_stubs.h b/tools/ocaml/libs/mmap/mmap_stubs.h
index 65e4239890..f4784e4715 100644
--- a/tools/ocaml/libs/mmap/mmap_stubs.h
+++ b/tools/ocaml/libs/mmap/mmap_stubs.h
@@ -30,4 +30,8 @@ struct mmap_interface
 	int len;
 };
 
+#ifndef Data_abstract_val
+#define Data_abstract_val(x) ((void *)Op_val(x))
+#endif
+
 #endif
diff --git a/tools/ocaml/libs/mmap/xenmmap_stubs.c b/tools/ocaml/libs/mmap/xenmmap_stubs.c
index e2ce088e25..e03951d781 100644
--- a/tools/ocaml/libs/mmap/xenmmap_stubs.c
+++ b/tools/ocaml/libs/mmap/xenmmap_stubs.c
@@ -28,7 +28,7 @@
 #include <caml/fail.h>
 #include <caml/callback.h>
 
-#define Intf_val(a) ((struct mmap_interface *) a)
+#define Intf_val(a) ((struct mmap_interface *)Data_abstract_val(a))
 
 static int mmap_interface_init(struct mmap_interface *intf,
                                int fd, int pflag, int mflag,
diff --git a/tools/ocaml/libs/xb/xs_ring_stubs.c b/tools/ocaml/libs/xb/xs_ring_stubs.c
index 7a91fdee75..1f58524535 100644
--- a/tools/ocaml/libs/xb/xs_ring_stubs.c
+++ b/tools/ocaml/libs/xb/xs_ring_stubs.c
@@ -35,7 +35,7 @@
 #include <sys/mman.h>
 #include "mmap_stubs.h"
 
-#define GET_C_STRUCT(a) ((struct mmap_interface *) a)
+#define GET_C_STRUCT(a) ((struct mmap_interface *)Data_abstract_val(a))
 
 /*
  * Bytes_val has been introduced by Ocaml 4.06.1. So define our own version
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:12:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:12:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469119.728397 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95GD-0000uB-3n; Sat, 24 Dec 2022 14:12:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469119.728397; Sat, 24 Dec 2022 14:12: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 1p95GC-0000u3-Vz; Sat, 24 Dec 2022 14:12:24 +0000
Received: by outflank-mailman (input) for mailman id 469119;
 Sat, 24 Dec 2022 14:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95GB-0000tk-Db
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95GB-00081I-Co
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95GB-0002kI-Bz
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hufh3SklPsPI0vszMmjUJ+jeqv5fH40U6TYLe754gfs=; b=oTrecB3sKcrtQqNvVHkDW0FpeD
	S3nKp5tmM7cwCmnMgYd5mo+LsC6aOIQPZC0x2mZFr5PLonKhDsTvxN7fQyXwPSTT8tze/YHWIAo5Z
	LT3PU89RJDpdl8A4E5U/12w0a6CYxMg3Z+vhHKc/b7GJ7cnxmLGb0DPJfH3kQjiPThfQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/xenstored: Use ocamldep -sort for linking order
Message-Id: <E1p95GB-0002kI-Bz@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:12:23 +0000

commit 4a259353238d308a41541370ea7cc222a879ddd3
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Dec 16 18:25:11 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 19 19:31:26 2022 +0000

    tools/ocaml/xenstored: Use ocamldep -sort for linking order
    
    The manually established link order is fragile to code changes.  Use ocamldep
    to calculate the appropriate link order.
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/Makefile b/tools/ocaml/xenstored/Makefile
index 6f7333926e..e8aaecf2e6 100644
--- a/tools/ocaml/xenstored/Makefile
+++ b/tools/ocaml/xenstored/Makefile
@@ -72,7 +72,11 @@ XENSTOREDLIBS = \
 PROGRAMS = oxenstored
 
 oxenstored_LIBS = $(XENSTOREDLIBS)
-oxenstored_OBJS = $(OBJS)
+# use ocamldep to figure out link order, otherwise the Makefile would have
+# to be continously adjusted for security patches that introduce new
+# dependencies between files
+oxenstored_MLSORTED = $(shell $(OCAMLDEP) -sort $(OBJS:=.ml))
+oxenstored_OBJS = $(oxenstored_MLSORTED:.ml=)
 
 OCAML_PROGRAM = oxenstored
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:12:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:12:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469120.728398 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95GN-0000xD-5G; Sat, 24 Dec 2022 14:12:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469120.728398; Sat, 24 Dec 2022 14:12:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95GN-0000x5-2U; Sat, 24 Dec 2022 14:12:35 +0000
Received: by outflank-mailman (input) for mailman id 469120;
 Sat, 24 Dec 2022 14:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95GL-0000wt-Gd
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95GL-00081Z-Fp
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95GL-0002lW-F0
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X48g10URRszliOJZKH3BmlEyXlfrx15/lrnEJIVcuws=; b=PevgAwrkZoMkOn0gUgADNIYaeh
	xCCCPz3JnnyBhCBvkXcFbTFVaP56QNRGHcbfF2hkiBk04OQ1m3JZGjkO2GEoOkOTXJrmVamDuZOro
	eaCYO1y4ws99ykYIfMR2RDd1s6Tm15MttWCHHmHWS6w+5CI0f8Dkd1kV/GFw3fVX+aak=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/xenctrl: Fix unused value warning
Message-Id: <E1p95GL-0002lW-F0@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:12:33 +0000

commit 2e173b8383928e8d98d67ce57ec069eb612def60
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Dec 16 18:25:16 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 19 19:31:26 2022 +0000

    tools/ocaml/xenctrl: Fix unused value warning
    
    Fixes: 8b3c06a3e5 ("tools/ocaml/xenctrl: OCaml 5 support, fix use-after-free")
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/libs/xc/xenctrl.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index 9a80ae5e28..7442bbbfc5 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -182,7 +182,7 @@ let get_handle () = !handle
 
 let close_handle () =
 	match !handle with
-	| Some h -> handle := None
+	| Some _ -> handle := None
 	| None -> ()
 
 let with_intf f =
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:12:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:12:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469121.728403 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95GX-00011F-6U; Sat, 24 Dec 2022 14:12:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469121.728403; Sat, 24 Dec 2022 14:12:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95GX-000117-3v; Sat, 24 Dec 2022 14:12:45 +0000
Received: by outflank-mailman (input) for mailman id 469121;
 Sat, 24 Dec 2022 14:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95GV-00010p-JZ
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95GV-00081h-Ip
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95GV-0002m6-I4
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vW3Dx0/61nk9zHOQvOAnItq3kzNV8+dWEVoqA9OKvzM=; b=DK8nauCUu+Ug7pjySG5w/YfJt1
	qRPgdMQIanrRXSJJ0uEEhRZkT3vUt/tiqSZVvoR6JNq1558gtsOgPWxG9ngNbsLGuorB1gnXyd//i
	8h2aRhBXgbkGxI4+FPwO4JvyKSk+vUgrKktm/PljvSVy0bFm+AWfx5QljGfW0+pqMyWs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/xb: Drop Xs_ring.write
Message-Id: <E1p95GV-0002m6-I4@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:12:43 +0000

commit 01f139215e678c2dc7d4bb3f9f2777069bb1b091
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Dec 16 18:25:20 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 19 19:31:26 2022 +0000

    tools/ocaml/xb: Drop Xs_ring.write
    
    This function is unusued (only Xs_ring.write_substring is used), and the
    bytes/string conversion here is backwards: the C stub implements the bytes
    version and then we use a Bytes.unsafe_of_string to convert a string into
    bytes.
    
    However the operation here really is read-only: we read from the string and
    write it to the ring, so the C stub should implement the read-only string
    version, and if needed we could use Bytes.unsafe_to_string to be able to send
    'bytes'. However that is not necessary as the 'bytes' version is dropped above.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xb/xs_ring.ml      | 5 +----
 tools/ocaml/libs/xb/xs_ring_stubs.c | 2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/ocaml/libs/xb/xs_ring.ml b/tools/ocaml/libs/xb/xs_ring.ml
index db7f86bd27..dd5e014a33 100644
--- a/tools/ocaml/libs/xb/xs_ring.ml
+++ b/tools/ocaml/libs/xb/xs_ring.ml
@@ -25,14 +25,11 @@ module Server_features = Set.Make(struct
 end)
 
 external read: Xenmmap.mmap_interface -> bytes -> int -> int = "ml_interface_read"
-external write: Xenmmap.mmap_interface -> bytes -> int -> int = "ml_interface_write"
+external write_substring: Xenmmap.mmap_interface -> string -> int -> int = "ml_interface_write"
 
 external _internal_set_server_features: Xenmmap.mmap_interface -> int -> unit = "ml_interface_set_server_features" [@@noalloc]
 external _internal_get_server_features: Xenmmap.mmap_interface -> int = "ml_interface_get_server_features" [@@noalloc]
 
-let write_substring mmap buff len =
-	write mmap (Bytes.unsafe_of_string buff) len
-
 let get_server_features mmap =
 	(* NB only one feature currently defined above *)
 	let x = _internal_get_server_features mmap in
diff --git a/tools/ocaml/libs/xb/xs_ring_stubs.c b/tools/ocaml/libs/xb/xs_ring_stubs.c
index 1f58524535..1243c63f03 100644
--- a/tools/ocaml/libs/xb/xs_ring_stubs.c
+++ b/tools/ocaml/libs/xb/xs_ring_stubs.c
@@ -112,7 +112,7 @@ CAMLprim value ml_interface_write(value ml_interface,
 	CAMLlocal1(ml_result);
 
 	struct mmap_interface *interface = GET_C_STRUCT(ml_interface);
-	const unsigned char *buffer = Bytes_val(ml_buffer);
+	const char *buffer = String_val(ml_buffer);
 	int len = Int_val(ml_len);
 	int result;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:12:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:12:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469122.728406 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Gh-00014D-7v; Sat, 24 Dec 2022 14:12:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469122.728406; Sat, 24 Dec 2022 14:12:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Gh-000145-5J; Sat, 24 Dec 2022 14:12:55 +0000
Received: by outflank-mailman (input) for mailman id 469122;
 Sat, 24 Dec 2022 14:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Gf-00013v-MQ
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Gf-00081n-Li
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Gf-0002mZ-Kx
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BhZdcn/2mHL+P+MfZhVqD2km7vodUvO8+7KO/2tZJH0=; b=zKdlFJAf+ULnUzIyTu86X66X5g
	Wxkn5EQhxG9ImyrsRfUJdfo6JZQcNBGpFrIfIpSuaTg0Ok2z0hq4yFBw/zUPMQVOjBV6EMpDgScln
	ehg2MYujMCKoZlzrQk60QWjtAnP1Uael4jBjSfYNUhQ+lVgagrlyR4Q9WOhFcxhIX7Bs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add support for using XTF for arm64 testing
Message-Id: <E1p95Gf-0002mZ-Kx@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:12:53 +0000

commit 99ba7abbda7d42156f9ed70224750244ed42d120
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Dec 16 14:30:11 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Dec 19 13:30:15 2022 -0800

    automation: Add support for using XTF for arm64 testing
    
    Introduce support for using XTF on Arm to perform low-level testing.
    For the purpose of the CI testing, let's use the fork [1] from upstream
    XTF with implemented support for arm64 (the upstream XTF only supports
    x86).
    
    Add a new script under automation/scripts to be used by the CI XTF test
    jobs to perform the following tasks:
     - Compiling XTF,
     - Generating u-boot script using ImageBuilder,
     - Running Xen with XTF as domU in pure dom0less configuration using Qemu,
     - Checking test result.
    
    The script takes the name of the XTF test to run as a first parameter.
    
    [1] https://gitlab.com/xen-project/fusa/xtf.git (branch xtf-arm)
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/qemu-xtf-dom0less-arm64.sh | 68 +++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
new file mode 100755
index 0000000000..3ec9cf74e1
--- /dev/null
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+set -ex
+
+# Name of the XTF test
+xtf_test=$1
+
+# Message returned by XTF in case of success
+passed="Test result: SUCCESS"
+
+# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
+curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
+./binaries/qemu-system-aarch64 \
+   -machine virtualization=true \
+   -cpu cortex-a57 -machine type=virt \
+   -m 2048 -smp 2 -display none \
+   -machine dumpdtb=binaries/virt-gicv2.dtb
+
+# XTF
+# Build a single XTF test passed as a first parameter to the script.
+# Build XTF with GICv2 support to match Qemu configuration and with SBSA UART
+# support, so that the test will use an emulated UART for printing messages.
+# This will allow us to run the test on both debug and non-debug Xen builds.
+rm -rf xtf
+git clone https://gitlab.com/xen-project/fusa/xtf.git -b xtf-arm
+make -C xtf TESTS=tests/${xtf_test} CONFIG_SBSA_UART=y CONFIG_GICV2=y -j$(nproc)
+cp xtf/tests/${xtf_test}/test-mmu64le-${xtf_test} binaries/xtf-test
+
+# ImageBuilder
+echo 'MEMORY_START="0x40000000"
+MEMORY_END="0xC0000000"
+
+XEN="xen"
+DEVICE_TREE="virt-gicv2.dtb"
+
+XEN_CMD="console=dtuart"
+
+DOMU_KERNEL[0]="xtf-test"
+DOMU_MEM[0]="128"
+
+NUM_DOMUS=1
+
+LOAD_CMD="tftpb"
+UBOOT_SOURCE="boot.source"
+UBOOT_SCRIPT="boot.scr"' > binaries/config
+
+rm -rf imagebuilder
+git clone https://gitlab.com/ViryaOS/imagebuilder
+bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/config
+
+# Run the test
+rm -f smoke.serial
+set +e
+echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
+timeout -k 1 120 \
+./binaries/qemu-system-aarch64 \
+    -machine virtualization=true \
+    -cpu cortex-a57 -machine type=virt \
+    -m 2048 -monitor none -serial stdio \
+    -smp 2 \
+    -no-reboot \
+    -device virtio-net-pci,netdev=n0 \
+    -netdev user,id=n0,tftp=binaries \
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+
+set -e
+(grep -q "${passed}" smoke.serial) || exit 1
+exit 0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:13:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:13:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469123.728411 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Gr-00017D-9s; Sat, 24 Dec 2022 14:13:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469123.728411; Sat, 24 Dec 2022 14:13: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 1p95Gr-000175-6m; Sat, 24 Dec 2022 14:13:05 +0000
Received: by outflank-mailman (input) for mailman id 469123;
 Sat, 24 Dec 2022 14:13:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Gp-00016n-PE
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Gp-000827-OX
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Gp-0002nK-Nr
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X9s/jla1R2hfcjd298ab7YlV283ZWvshOWRcecO5sr8=; b=dhUMvBP1I9kl+Nbklc53Zp0KtD
	dNGmjb8wKtznHwFzf9hAXEo2BeY4G3BiSBmuGOaBFsrB/pp8gx/nZ6+mtoFD1/7CherfxjDKXztym
	jWqZtDOzD8QBbqHVSmvfu4CALCKkfS6ca96lkWBx1NAF3Pa1q52iBS1ZwgmOY43SPvf0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add test jobs to run XTF hypercall xen_version test
Message-Id: <E1p95Gp-0002nK-Nr@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:13:03 +0000

commit f1b9a28922d2913dda76fd82b0b79f3651d3fc8d
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Dec 16 14:30:12 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Dec 19 13:30:15 2022 -0800

    automation: Add test jobs to run XTF hypercall xen_version test
    
    Add test jobs in both debug and non-debug versions to run hyp-xen-version
    XTF test as a dom0less domU on arm64. The purpose of this test is to
    validate the functional behavior of xen_version hypercall.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 2d57f4feb7..afd80adfe1 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -165,6 +165,22 @@ qemu-smoke-dom0less-arm64-gcc-debug-boot-cpupools:
     - *arm64-test-needs
     - alpine-3.12-gcc-debug-arm64-boot-cpupools
 
+qemu-xtf-dom0less-arm64-gcc-hyp-xen-version:
+  extends: .qemu-arm64
+  script:
+    - ./automation/scripts/qemu-xtf-dom0less-arm64.sh hyp-xen-version 2>&1 | tee ${LOGFILE}
+  needs:
+    - alpine-3.12-gcc-arm64
+    - qemu-system-aarch64-6.0.0-arm64-export
+
+qemu-xtf-dom0less-arm64-gcc-debug-hyp-xen-version:
+  extends: .qemu-arm64
+  script:
+    - ./automation/scripts/qemu-xtf-dom0less-arm64.sh hyp-xen-version 2>&1 | tee ${LOGFILE}
+  needs:
+    - alpine-3.12-gcc-debug-arm64
+    - qemu-system-aarch64-6.0.0-arm64-export
+
 qemu-smoke-dom0-arm32-gcc:
   extends: .qemu-arm32
   script:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:13:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:13:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469124.728415 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95H1-00019n-B5; Sat, 24 Dec 2022 14:13:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469124.728415; Sat, 24 Dec 2022 14: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 1p95H1-00019f-8U; Sat, 24 Dec 2022 14:13:15 +0000
Received: by outflank-mailman (input) for mailman id 469124;
 Sat, 24 Dec 2022 14:13:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Gz-00019U-S9
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Gz-00082N-RQ
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Gz-0002nj-Qi
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6Z64bBBX1nldbVU76I2A/1qDxXvW2kk3w/YwRvHMzek=; b=OGdVtzu/yhLIlk27oYoNHtYhiP
	+APKGnd7Aek4eMwr+hXueim2aHJrS7HntZbutyXh6q57VW9W8tMDy32CC3GG7o8mI5HinlAjVW4he
	5N8IrTD5dlBBOtydaFrvpGHgAiwwWcrjkXpyl3g4zjUZ4lp/zk6yZoBxE9xSu6Bzk3Ac=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xsm/flask: mkflash.sh: Use const when generating initial_sid_to_string[]
Message-Id: <E1p95Gz-0002nj-Qi@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:13:13 +0000

commit 8b03f3ec04c7f62f21da7684b0d33993aa101d38
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Dec 12 09:36:31 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Dec 20 09:28:06 2022 +0000

    xsm/flask: mkflash.sh: Use const when generating initial_sid_to_string[]
    
    The array initial_sid_to_string is storing pointer to literal strings
    and is not meant to be modified. So change the type of the variable
    to "const char * const ...[]".
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Ack-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/xsm/flask/policy/mkflask.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/xsm/flask/policy/mkflask.sh b/xen/xsm/flask/policy/mkflask.sh
index 591ce832a1..6116897681 100755
--- a/xen/xsm/flask/policy/mkflask.sh
+++ b/xen/xsm/flask/policy/mkflask.sh
@@ -34,7 +34,7 @@ BEGIN	{
 		printf("/*\n * Security object class definitions\n */\n") > debugfile;
 		printf("    S_(\"null\")\n") > debugfile;
 		printf("/* This file is automatically generated.  Do not edit. */\n") > debugfile2;
-		printf("static char *initial_sid_to_string[] =\n{\n") > debugfile2;
+		printf("static const char * const initial_sid_to_string[] =\n{\n") > debugfile2;
 		printf("    \"null\",\n") > debugfile2;
 	}
 /^[ \t]*#/	{
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:13:25 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:13:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469125.728419 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95HB-0001Cu-DH; Sat, 24 Dec 2022 14:13:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469125.728419; Sat, 24 Dec 2022 14: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 1p95HB-0001Cm-9z; Sat, 24 Dec 2022 14:13:25 +0000
Received: by outflank-mailman (input) for mailman id 469125;
 Sat, 24 Dec 2022 14:13:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95H9-0001CW-VM
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95H9-00082m-Uh
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95H9-0002oC-Tq
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GpxZGKKdjAbFWEVHnSQkRpYEcXCg8oeuvO8LKMsIIUM=; b=Jm95sY4rG3vwy6DyXIjM+6oaNK
	oQSpa8EBDuO7+uyPitE9SETjpO2WL4OBpUpCMY+iUXtgivKe47raa9tutKp04ivxhVo58QMs/+U8z
	uA43eiWwso3AWNW3B4V7CVCMyZaMZpBU2ql2aw9ZEGosWU9o4xtMjDRjixs8PoSHwkJg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: smmuv3: mark arm_smmu_disable_pasid __maybe_unused
Message-Id: <E1p95H9-0002oC-Tq@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:13:23 +0000

commit 0fc5fa9333b21122c6e77fa42f5683e31c81bbe5
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Dec 15 16:26:19 2022 -0500
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Dec 20 09:35:06 2022 +0000

    xen/arm: smmuv3: mark arm_smmu_disable_pasid __maybe_unused
    
    When building with clang 12 and CONFIG_ARM_SMMU_V3=y, we observe the
    following build error:
    
    drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 'arm_smmu_disable_pasid' [-Werror,-Wunused-function]
    static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }
                       ^
    
    arm_smmu_disable_pasid is not currently called from anywhere in Xen, but
    it is inside a section of code guarded by CONFIG_PCI_ATS, which may be
    helpful in the future if the PASID feature is to be implemented. Add the
    attribute __maybe_unused to the function.
    
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/passthrough/arm/smmu-v3.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
index 9c9f463009..d58c5cd0bf 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -1376,7 +1376,8 @@ static int arm_smmu_enable_pasid(struct arm_smmu_master *master)
 	return 0;
 }
 
-static void arm_smmu_disable_pasid(struct arm_smmu_master *master)
+static void __maybe_unused
+arm_smmu_disable_pasid(struct arm_smmu_master *master)
 {
 	struct pci_dev *pdev;
 
@@ -1405,7 +1406,8 @@ static inline int arm_smmu_enable_pasid(struct arm_smmu_master *master)
 	return 0;
 }
 
-static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }
+static inline void __maybe_unused
+arm_smmu_disable_pasid(struct arm_smmu_master *master) { }
 #endif /* CONFIG_PCI_ATS */
 
 static void arm_smmu_detach_dev(struct arm_smmu_master *master)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:13:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:13:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469126.728423 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95HL-0001Fh-Es; Sat, 24 Dec 2022 14:13:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469126.728423; Sat, 24 Dec 2022 14:13:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95HL-0001FX-Bc; Sat, 24 Dec 2022 14:13:35 +0000
Received: by outflank-mailman (input) for mailman id 469126;
 Sat, 24 Dec 2022 14:13:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95HK-0001FG-27
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95HK-00082t-1J
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95HK-0002of-0d
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d2gDcxveE3dDtaXJT8hvd4b8kNUHiM3FQ0ztuSs4aLk=; b=JPIBum5CFMgCffb+cxTRv9Bx43
	vXApurlj+ZxXxQEwsVjhlN8zDJkyWTUKqaINLvAhMsRbICujjIBO/+HWG/G64bvhvvux36kJzoST2
	gIGvov8S9yX7ZMoNLuOnbfZxZHEJV0dtM8radzN/K+RlO+aBEN9tvCBf4Tmt8NZEp3+E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: add memory type constants
Message-Id: <E1p95HK-0002of-0d@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:13:34 +0000

commit 4714ae256f8cf75af2631eadc6d275e04f4d5d17
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Dec 20 16:49:16 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 16:49:16 2022 +0100

    x86: add memory type constants
    
    These are not currently used, so there is no functional change.  Future
    patches will use these constants.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/x86-defns.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 28628807cb..42b5f382d4 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -153,4 +153,15 @@
      (1u << X86_EXC_AC) | (1u << X86_EXC_CP) |                      \
      (1u << X86_EXC_VC) | (1u << X86_EXC_SX))
 
+/* Memory types */
+#define X86_MT_UC     0x00 /* uncachable */
+#define X86_MT_WC     0x01 /* write-combined */
+#define X86_MT_RSVD_2 0x02 /* reserved */
+#define X86_MT_RSVD_3 0x03 /* reserved */
+#define X86_MT_WT     0x04 /* write-through */
+#define X86_MT_WP     0x05 /* write-protect */
+#define X86_MT_WB     0x06 /* write-back */
+#define X86_MT_UCM    0x07 /* UC- */
+#define X86_NUM_MT    0x08
+
 #endif	/* __XEN_X86_DEFNS_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:13:45 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:13:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469127.728426 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95HV-0001IJ-GS; Sat, 24 Dec 2022 14:13:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469127.728426; Sat, 24 Dec 2022 14:13:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95HV-0001IB-DP; Sat, 24 Dec 2022 14:13:45 +0000
Received: by outflank-mailman (input) for mailman id 469127;
 Sat, 24 Dec 2022 14:13:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95HU-0001I3-68
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95HU-00082x-5K
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95HU-0002p8-4N
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2j5ZdNvcxKagjPTtjTtdrtWwiJO6Roaf+mdpYp2YJco=; b=lcJwMaPg3c0QL49cWG9E1ooFe5
	SiPGHKsRDA/5TVWuZg5WxWqo0a9JeGPZEXqnDrZe2009o4CKA2nCmZYrr5Ity/HtzpfBu45J3DpqN
	rflGJvlVCT/4qgemYOVeesF1Il8da1NFqeBRPBol8+TJ0IlYQVd+qfGc1W7JhzHC/CNY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: replace PAT_* with X86_MT_*
Message-Id: <E1p95HU-0002p8-4N@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:13:44 +0000

commit 60b8f9a73987e22ab652ac0d4bdd2db81d1dc33a
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Dec 20 16:49:35 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 16:49:35 2022 +0100

    x86: replace PAT_* with X86_MT_*
    
    This allows eliminating the former.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c          | 12 +++++-----
 xen/arch/x86/hvm/mtrr.c         | 52 ++++++++++++++++++++---------------------
 xen/arch/x86/hvm/vmx/vmx.c      | 16 ++++++-------
 xen/arch/x86/include/asm/mtrr.h | 12 +---------
 xen/arch/x86/mm/p2m-ept.c       |  4 ++--
 xen/arch/x86/mm/shadow/multi.c  |  4 ++--
 6 files changed, 45 insertions(+), 55 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index fbf8f2cf5f..927a221660 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -307,12 +307,12 @@ int hvm_set_guest_pat(struct vcpu *v, uint64_t guest_pat)
     for ( i = 0, tmp = guest_pat; i < 8; i++, tmp >>= 8 )
         switch ( tmp & 0xff )
         {
-        case PAT_TYPE_UC_MINUS:
-        case PAT_TYPE_UNCACHABLE:
-        case PAT_TYPE_WRBACK:
-        case PAT_TYPE_WRCOMB:
-        case PAT_TYPE_WRPROT:
-        case PAT_TYPE_WRTHROUGH:
+        case X86_MT_UCM:
+        case X86_MT_UC:
+        case X86_MT_WB:
+        case X86_MT_WC:
+        case X86_MT_WP:
+        case X86_MT_WT:
             break;
         default:
             return 0;
diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 4d2aa6def8..242623f3c2 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -37,7 +37,7 @@ static const uint8_t pat_entry_2_pte_flags[8] = {
     _PAGE_PAT | _PAGE_PCD, _PAGE_PAT | _PAGE_PCD | _PAGE_PWT };
 
 /* Effective mm type lookup table, according to MTRR and PAT. */
-static const uint8_t mm_type_tbl[MTRR_NUM_TYPES][PAT_TYPE_NUMS] = {
+static const uint8_t mm_type_tbl[MTRR_NUM_TYPES][X86_NUM_MT] = {
 #define RS MEMORY_NUM_TYPES
 #define UC MTRR_TYPE_UNCACHABLE
 #define WB MTRR_TYPE_WRBACK
@@ -72,8 +72,8 @@ static uint8_t __read_mostly mtrr_epat_tbl[MTRR_NUM_TYPES][MEMORY_NUM_TYPES] =
     };
 
 /* Lookup table for PAT entry of a given PAT value in host PAT. */
-static uint8_t __read_mostly pat_entry_tbl[PAT_TYPE_NUMS] =
-    { [0 ... PAT_TYPE_NUMS-1] = INVALID_MEM_TYPE };
+static uint8_t __read_mostly pat_entry_tbl[X86_NUM_MT] =
+    { [0 ... X86_NUM_MT - 1] = INVALID_MEM_TYPE };
 
 static int __init cf_check hvm_mtrr_pat_init(void)
 {
@@ -81,7 +81,7 @@ static int __init cf_check hvm_mtrr_pat_init(void)
 
     for ( i = 0; i < MTRR_NUM_TYPES; i++ )
     {
-        for ( j = 0; j < PAT_TYPE_NUMS; j++ )
+        for ( j = 0; j < X86_NUM_MT; j++ )
         {
             unsigned int tmp = mm_type_tbl[i][j];
 
@@ -90,9 +90,9 @@ static int __init cf_check hvm_mtrr_pat_init(void)
         }
     }
 
-    for ( i = 0; i < PAT_TYPE_NUMS; i++ )
+    for ( i = 0; i < X86_NUM_MT; i++ )
     {
-        for ( j = 0; j < PAT_TYPE_NUMS; j++ )
+        for ( j = 0; j < X86_NUM_MT; j++ )
         {
             if ( pat_cr_2_paf(XEN_MSR_PAT, j) == i )
             {
@@ -115,7 +115,7 @@ uint8_t pat_type_2_pte_flags(uint8_t pat_type)
      * given pat_type. If host PAT covers all the PAT types, it can't happen.
      */
     if ( unlikely(pat_entry == INVALID_MEM_TYPE) )
-        pat_entry = pat_entry_tbl[PAT_TYPE_UNCACHABLE];
+        pat_entry = pat_entry_tbl[X86_MT_UC];
 
     return pat_entry_2_pte_flags[pat_entry];
 }
@@ -145,14 +145,14 @@ int hvm_vcpu_cacheattr_init(struct vcpu *v)
     m->mtrr_cap = (1u << 10) | (1u << 8) | num_var_ranges;
 
     v->arch.hvm.pat_cr =
-        ((uint64_t)PAT_TYPE_WRBACK) |               /* PAT0: WB */
-        ((uint64_t)PAT_TYPE_WRTHROUGH << 8) |       /* PAT1: WT */
-        ((uint64_t)PAT_TYPE_UC_MINUS << 16) |       /* PAT2: UC- */
-        ((uint64_t)PAT_TYPE_UNCACHABLE << 24) |     /* PAT3: UC */
-        ((uint64_t)PAT_TYPE_WRBACK << 32) |         /* PAT4: WB */
-        ((uint64_t)PAT_TYPE_WRTHROUGH << 40) |      /* PAT5: WT */
-        ((uint64_t)PAT_TYPE_UC_MINUS << 48) |       /* PAT6: UC- */
-        ((uint64_t)PAT_TYPE_UNCACHABLE << 56);      /* PAT7: UC */
+        ((uint64_t)X86_MT_WB) |           /* PAT0: WB */
+        ((uint64_t)X86_MT_WT << 8) |      /* PAT1: WT */
+        ((uint64_t)X86_MT_UCM << 16) |    /* PAT2: UC- */
+        ((uint64_t)X86_MT_UC << 24) |     /* PAT3: UC */
+        ((uint64_t)X86_MT_WB << 32) |     /* PAT4: WB */
+        ((uint64_t)X86_MT_WT << 40) |     /* PAT5: WT */
+        ((uint64_t)X86_MT_UCM << 48) |    /* PAT6: UC- */
+        ((uint64_t)X86_MT_UC << 56);      /* PAT7: UC */
 
     if ( is_hardware_domain(v->domain) )
     {
@@ -356,7 +356,7 @@ uint32_t get_pat_flags(struct vcpu *v,
      */
     pat_entry_value = mtrr_epat_tbl[shadow_mtrr_type][guest_eff_mm_type];
     /* If conflit occurs(e.g host MTRR is UC, guest memory type is
-     * WB),set UC as effective memory. Here, returning PAT_TYPE_UNCACHABLE will
+     * WB), set UC as effective memory. Here, returning X86_MT_UC will
      * always set effective memory as UC.
      */
     if ( pat_entry_value == INVALID_MEM_TYPE )
@@ -371,7 +371,7 @@ uint32_t get_pat_flags(struct vcpu *v,
                     "because the host mtrr type is:%d\n",
                     gl1e_flags, (uint64_t)gpaddr, guest_eff_mm_type,
                     shadow_mtrr_type);
-        pat_entry_value = PAT_TYPE_UNCACHABLE;
+        pat_entry_value = X86_MT_UC;
     }
     /* 4. Get the pte flags */
     return pat_type_2_pte_flags(pat_entry_value);
@@ -620,13 +620,13 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
                 p2m_memory_type_changed(d);
                 switch ( type )
                 {
-                case PAT_TYPE_UC_MINUS:
+                case X86_MT_UCM:
                     /*
                      * For EPT we can also avoid the flush in this case;
                      * see epte_get_entry_emt().
                      */
                     if ( hap_enabled(d) && cpu_has_vmx )
-                case PAT_TYPE_UNCACHABLE:
+                case X86_MT_UC:
                         break;
                     /* fall through */
                 default:
@@ -638,12 +638,12 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
         rcu_read_unlock(&pinned_cacheattr_rcu_lock);
         return -ENOENT;
 
-    case PAT_TYPE_UC_MINUS:
-    case PAT_TYPE_UNCACHABLE:
-    case PAT_TYPE_WRBACK:
-    case PAT_TYPE_WRCOMB:
-    case PAT_TYPE_WRPROT:
-    case PAT_TYPE_WRTHROUGH:
+    case X86_MT_UCM:
+    case X86_MT_UC:
+    case X86_MT_WB:
+    case X86_MT_WC:
+    case X86_MT_WP:
+    case X86_MT_WT:
         break;
 
     default:
@@ -681,7 +681,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
 
     list_add_rcu(&range->list, &d->arch.hvm.pinned_cacheattr_ranges);
     p2m_memory_type_changed(d);
-    if ( type != PAT_TYPE_WRBACK )
+    if ( type != X86_MT_WB )
         flush_all(FLUSH_CACHE);
 
     return 0;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index b11578777a..68e04d06e5 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1231,14 +1231,14 @@ static void cf_check vmx_handle_cd(struct vcpu *v, unsigned long value)
              * memory type are all UC.
              */
             u64 uc_pat =
-                ((uint64_t)PAT_TYPE_UNCACHABLE)       |       /* PAT0 */
-                ((uint64_t)PAT_TYPE_UNCACHABLE << 8)  |       /* PAT1 */
-                ((uint64_t)PAT_TYPE_UNCACHABLE << 16) |       /* PAT2 */
-                ((uint64_t)PAT_TYPE_UNCACHABLE << 24) |       /* PAT3 */
-                ((uint64_t)PAT_TYPE_UNCACHABLE << 32) |       /* PAT4 */
-                ((uint64_t)PAT_TYPE_UNCACHABLE << 40) |       /* PAT5 */
-                ((uint64_t)PAT_TYPE_UNCACHABLE << 48) |       /* PAT6 */
-                ((uint64_t)PAT_TYPE_UNCACHABLE << 56);        /* PAT7 */
+                ((uint64_t)X86_MT_UC)       |       /* PAT0 */
+                ((uint64_t)X86_MT_UC << 8)  |       /* PAT1 */
+                ((uint64_t)X86_MT_UC << 16) |       /* PAT2 */
+                ((uint64_t)X86_MT_UC << 24) |       /* PAT3 */
+                ((uint64_t)X86_MT_UC << 32) |       /* PAT4 */
+                ((uint64_t)X86_MT_UC << 40) |       /* PAT5 */
+                ((uint64_t)X86_MT_UC << 48) |       /* PAT6 */
+                ((uint64_t)X86_MT_UC << 56);        /* PAT7 */
 
             vmx_get_guest_pat(v, pat);
             vmx_set_guest_pat(v, uc_pat);
diff --git a/xen/arch/x86/include/asm/mtrr.h b/xen/arch/x86/include/asm/mtrr.h
index 7733800b79..92fc930c69 100644
--- a/xen/arch/x86/include/asm/mtrr.h
+++ b/xen/arch/x86/include/asm/mtrr.h
@@ -16,17 +16,7 @@
 #define NORMAL_CACHE_MODE          0
 #define NO_FILL_CACHE_MODE         2
 
-enum {
-    PAT_TYPE_UNCACHABLE=0,
-    PAT_TYPE_WRCOMB=1,
-    PAT_TYPE_WRTHROUGH=4,
-    PAT_TYPE_WRPROT=5,
-    PAT_TYPE_WRBACK=6,
-    PAT_TYPE_UC_MINUS=7,
-    PAT_TYPE_NUMS
-};
-
-#define INVALID_MEM_TYPE PAT_TYPE_NUMS
+#define INVALID_MEM_TYPE X86_NUM_MT
 
 /* In the Intel processor's MTRR interface, the MTRR type is always held in
    an 8 bit field: */
diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index d61d66c20e..126437285d 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -573,8 +573,8 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn,
     if ( gmtrr_mtype >= 0 )
     {
         *ipat = true;
-        return gmtrr_mtype != PAT_TYPE_UC_MINUS ? gmtrr_mtype
-                                                : MTRR_TYPE_UNCACHABLE;
+        return gmtrr_mtype != X86_MT_UCM ? gmtrr_mtype
+                                         : MTRR_TYPE_UNCACHABLE;
     }
     if ( gmtrr_mtype == -EADDRNOTAVAIL )
         return -1;
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 6bb564b014..b64bba70fc 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -561,7 +561,7 @@ _sh_propagate(struct vcpu *v,
              (type = hvm_get_mem_pinned_cacheattr(d, target_gfn, 0)) >= 0 )
             sflags |= pat_type_2_pte_flags(type);
         else if ( d->arch.hvm.is_in_uc_mode )
-            sflags |= pat_type_2_pte_flags(PAT_TYPE_UNCACHABLE);
+            sflags |= pat_type_2_pte_flags(X86_MT_UC);
         else
             if ( iomem_access_permitted(d, mfn_x(target_mfn), mfn_x(target_mfn)) )
             {
@@ -572,7 +572,7 @@ _sh_propagate(struct vcpu *v,
                             mfn_to_maddr(target_mfn),
                             MTRR_TYPE_UNCACHABLE);
                 else if ( iommu_snoop )
-                    sflags |= pat_type_2_pte_flags(PAT_TYPE_WRBACK);
+                    sflags |= pat_type_2_pte_flags(X86_MT_WB);
                 else
                     sflags |= get_pat_flags(v,
                             gflags,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:13:55 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:13:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469128.728431 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Hf-0001LY-Jh; Sat, 24 Dec 2022 14:13:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469128.728431; Sat, 24 Dec 2022 14:13:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Hf-0001LO-Gl; Sat, 24 Dec 2022 14:13:55 +0000
Received: by outflank-mailman (input) for mailman id 469128;
 Sat, 24 Dec 2022 14:13:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95He-0001LB-A0
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95He-000831-9D
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95He-0002ph-8R
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:13:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sVix4+vjQtUMUpSQ7+zxKau6WA6CpgC5JiSzGgTH8kI=; b=ojHA8GBWoqIdwT1e7CJpe5N3Mh
	Lu4yY75XcNkCAFjKTyJoOtMiWvpPqYmuHeLWjG7qLUo/HXl+vjFhq3ubDs8Rx0ybdiQH/dWCwdqTQ
	nBMhPkEsW7rQlOinHLHv9Jfyb4UrZkLKNvdIYj85Y1qcUf8XnF84POq79W09+b+lfjYU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: replace MTRR_* constants with X86_MT_* constants
Message-Id: <E1p95He-0002ph-8R@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:13:54 +0000

commit 6eaaa1fcb96438f35f69443cd375fe0b85595b7b
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Dec 20 16:50:38 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 16:50:38 2022 +0100

    x86: replace MTRR_* constants with X86_MT_* constants
    
    This allows eliminating of the former, with the exception of
    MTRR_NUM_TYPES.  MTRR_NUM_TYPES is kept, as due to a quirk of the x86
    architecture X86_MT_UCM (7) is not valid in an MTRR.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/mtrr/generic.c         | 10 +++----
 xen/arch/x86/cpu/mtrr/main.c            | 26 ++++++++---------
 xen/arch/x86/e820.c                     |  4 +--
 xen/arch/x86/hvm/mtrr.c                 | 30 +++++++++----------
 xen/arch/x86/hvm/vmx/vmcs.c             |  2 +-
 xen/arch/x86/hvm/vmx/vmx.c              |  2 +-
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h |  2 +-
 xen/arch/x86/include/asm/mtrr.h         | 10 ++-----
 xen/arch/x86/mm/p2m-ept.c               | 51 ++++++++++++++++-----------------
 xen/arch/x86/mm/shadow/multi.c          |  2 +-
 10 files changed, 66 insertions(+), 73 deletions(-)

diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c
index 47aaf76226..660ae26c23 100644
--- a/xen/arch/x86/cpu/mtrr/generic.c
+++ b/xen/arch/x86/cpu/mtrr/generic.c
@@ -127,11 +127,11 @@ static const char *__init mtrr_attrib_to_str(mtrr_type x)
 {
 	static const char __initconst strings[MTRR_NUM_TYPES][16] =
 	{
-		[MTRR_TYPE_UNCACHABLE]     = "uncachable",
-		[MTRR_TYPE_WRCOMB]         = "write-combining",
-		[MTRR_TYPE_WRTHROUGH]      = "write-through",
-		[MTRR_TYPE_WRPROT]         = "write-protect",
-		[MTRR_TYPE_WRBACK]         = "write-back",
+		[X86_MT_UC] = "uncachable",
+		[X86_MT_WC] = "write-combining",
+		[X86_MT_WT] = "write-through",
+		[X86_MT_WP] = "write-protect",
+		[X86_MT_WB] = "write-back",
 	};
 
 	return (x < ARRAY_SIZE(strings) && strings[x][0]) ? strings[x] : "?";
diff --git a/xen/arch/x86/cpu/mtrr/main.c b/xen/arch/x86/cpu/mtrr/main.c
index 4e01c8d6f9..2946003b84 100644
--- a/xen/arch/x86/cpu/mtrr/main.c
+++ b/xen/arch/x86/cpu/mtrr/main.c
@@ -163,10 +163,10 @@ static void cf_check ipi_handler(void *info)
 }
 
 static inline int types_compatible(mtrr_type type1, mtrr_type type2) {
-	return type1 == MTRR_TYPE_UNCACHABLE ||
-	       type2 == MTRR_TYPE_UNCACHABLE ||
-	       (type1 == MTRR_TYPE_WRTHROUGH && type2 == MTRR_TYPE_WRBACK) ||
-	       (type1 == MTRR_TYPE_WRBACK && type2 == MTRR_TYPE_WRTHROUGH);
+	return type1 == X86_MT_UC ||
+	       type2 == X86_MT_UC ||
+	       (type1 == X86_MT_WT && type2 == X86_MT_WB) ||
+	       (type1 == X86_MT_WB && type2 == X86_MT_WT);
 }
 
 /**
@@ -297,13 +297,13 @@ static void set_mtrr(unsigned int reg, unsigned long base,
  *
  *	The available types are
  *
- *	%MTRR_TYPE_UNCACHABLE	-	No caching
+ *	%X86_MT_UC	-	No caching
  *
- *	%MTRR_TYPE_WRBACK	-	Write data back in bursts whenever
+ *	%X86_MT_WB	-	Write data back in bursts whenever
  *
- *	%MTRR_TYPE_WRCOMB	-	Write data back soon but allow bursts
+ *	%X86_MT_WC	-	Write data back soon but allow bursts
  *
- *	%MTRR_TYPE_WRTHROUGH	-	Cache reads but not writes
+ *	%X86_MT_WT	-	Cache reads but not writes
  *
  *	BUGS: Needs a quiet flag for the cases where drivers do not mind
  *	failures and do not wish system log messages to be sent.
@@ -328,7 +328,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
 	}
 
 	/*  If the type is WC, check that this processor supports it  */
-	if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
+	if ((type == X86_MT_WC) && !have_wrcomb()) {
 		printk(KERN_WARNING
 		       "mtrr: your processor doesn't support write-combining\n");
 		return -EOPNOTSUPP;
@@ -442,13 +442,13 @@ static int mtrr_check(unsigned long base, unsigned long size)
  *
  *	The available types are
  *
- *	%MTRR_TYPE_UNCACHABLE	-	No caching
+ *	%X86_MT_UC	-	No caching
  *
- *	%MTRR_TYPE_WRBACK	-	Write data back in bursts whenever
+ *	%X86_MT_WB	-	Write data back in bursts whenever
  *
- *	%MTRR_TYPE_WRCOMB	-	Write data back soon but allow bursts
+ *	%X86_MT_WC	-	Write data back soon but allow bursts
  *
- *	%MTRR_TYPE_WRTHROUGH	-	Cache reads but not writes
+ *	%X86_MT_WT	-	Cache reads but not writes
  *
  *	BUGS: Needs a quiet flag for the cases where drivers do not mind
  *	failures and do not wish system log messages to be sent.
diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
index b653a19c93..c5911cf48d 100644
--- a/xen/arch/x86/e820.c
+++ b/xen/arch/x86/e820.c
@@ -459,7 +459,7 @@ static uint64_t __init mtrr_top_of_ram(void)
         printk(" MTRR cap: %"PRIx64" type: %"PRIx64"\n", mtrr_cap, mtrr_def);
 
     /* MTRRs enabled, and default memory type is not writeback? */
-    if ( !test_bit(11, &mtrr_def) || ((uint8_t)mtrr_def == MTRR_TYPE_WRBACK) )
+    if ( !test_bit(11, &mtrr_def) || ((uint8_t)mtrr_def == X86_MT_WB) )
         return 0;
 
     /*
@@ -476,7 +476,7 @@ static uint64_t __init mtrr_top_of_ram(void)
             printk(" MTRR[%d]: base %"PRIx64" mask %"PRIx64"\n",
                    i, base, mask);
 
-        if ( !test_bit(11, &mask) || ((uint8_t)base != MTRR_TYPE_WRBACK) )
+        if ( !test_bit(11, &mask) || ((uint8_t)base != X86_MT_WB) )
             continue;
         base &= addr_mask;
         mask &= addr_mask;
diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 242623f3c2..093103f6c7 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -39,11 +39,11 @@ static const uint8_t pat_entry_2_pte_flags[8] = {
 /* Effective mm type lookup table, according to MTRR and PAT. */
 static const uint8_t mm_type_tbl[MTRR_NUM_TYPES][X86_NUM_MT] = {
 #define RS MEMORY_NUM_TYPES
-#define UC MTRR_TYPE_UNCACHABLE
-#define WB MTRR_TYPE_WRBACK
-#define WC MTRR_TYPE_WRCOMB
-#define WP MTRR_TYPE_WRPROT
-#define WT MTRR_TYPE_WRTHROUGH
+#define UC X86_MT_UC
+#define WB X86_MT_WB
+#define WC X86_MT_WC
+#define WP X86_MT_WP
+#define WT X86_MT_WT
 
 /*          PAT(UC, WC, RS, RS, WT, WP, WB, UC-) */
 /* MTRR(UC) */ {UC, WC, RS, RS, UC, UC, UC, UC},
@@ -202,7 +202,7 @@ int mtrr_get_type(const struct mtrr_state *m, paddr_t pa, unsigned int order)
    unsigned int seg, num_var_ranges = MASK_EXTR(m->mtrr_cap, MTRRcap_VCNT);
 
    if ( unlikely(!m->enabled) )
-       return MTRR_TYPE_UNCACHABLE;
+       return X86_MT_UC;
 
    pa &= mask;
    if ( (pa < 0x100000) && m->fixed_enabled )
@@ -277,13 +277,13 @@ int mtrr_get_type(const struct mtrr_state *m, paddr_t pa, unsigned int order)
        return -1;
 
    /* Two or more matches, one being UC? */
-   if ( overlap_mtrr & (1 << MTRR_TYPE_UNCACHABLE) )
-       return MTRR_TYPE_UNCACHABLE;
+   if ( overlap_mtrr & (1 << X86_MT_UC) )
+       return X86_MT_UC;
 
    /* Two or more matches, all of them WT and WB? */
    if ( overlap_mtrr ==
-        ((1 << MTRR_TYPE_WRTHROUGH) | (1 << MTRR_TYPE_WRBACK)) )
-       return MTRR_TYPE_WRTHROUGH;
+        ((1 << X86_MT_WT) | (1 << X86_MT_WB)) )
+       return X86_MT_WT;
 
    /* Behaviour is undefined, but return the last overlapped type. */
    return overlap_mtrr_pos;
@@ -381,11 +381,11 @@ static inline bool_t valid_mtrr_type(uint8_t type)
 {
     switch ( type )
     {
-    case MTRR_TYPE_UNCACHABLE:
-    case MTRR_TYPE_WRBACK:
-    case MTRR_TYPE_WRCOMB:
-    case MTRR_TYPE_WRPROT:
-    case MTRR_TYPE_WRTHROUGH:
+    case X86_MT_UC:
+    case X86_MT_WB:
+    case X86_MT_WC:
+    case X86_MT_WP:
+    case X86_MT_WT:
         return 1;
     }
     return 0;
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 3d7c471a3f..8992f4e0ae 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -563,7 +563,7 @@ static int vmx_init_vmcs_config(bool bsp)
     /* Require Write-Back (WB) memory type for VMCS accesses. */
     opt = (vmx_basic_msr_high & (VMX_BASIC_MEMORY_TYPE_MASK >> 32)) /
           ((VMX_BASIC_MEMORY_TYPE_MASK & -VMX_BASIC_MEMORY_TYPE_MASK) >> 32);
-    if ( opt != MTRR_TYPE_WRBACK )
+    if ( opt != X86_MT_WB )
     {
         printk("VMX: CPU%d has unexpected VMCS access type %u\n",
                smp_processor_id(), opt);
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 68e04d06e5..43a4865d1c 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -434,7 +434,7 @@ static void cf_check domain_creation_finished(struct domain *d)
         return;
 
     ASSERT(epte_get_entry_emt(d, gfn, apic_access_mfn, 0, &ipat,
-                              p2m_mmio_direct) == MTRR_TYPE_WRBACK);
+                              p2m_mmio_direct) == X86_MT_WB);
     ASSERT(ipat);
 
     if ( set_mmio_p2m_entry(d, gfn, apic_access_mfn, PAGE_ORDER_4K) )
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 78404e42b3..0a84e74478 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -38,7 +38,7 @@ struct vmx_msr_entry {
     u64 data;
 };
 
-#define EPT_DEFAULT_MT      MTRR_TYPE_WRBACK
+#define EPT_DEFAULT_MT      X86_MT_WB
 
 struct ept_data {
     union {
diff --git a/xen/arch/x86/include/asm/mtrr.h b/xen/arch/x86/include/asm/mtrr.h
index 92fc930c69..e4f6ca6048 100644
--- a/xen/arch/x86/include/asm/mtrr.h
+++ b/xen/arch/x86/include/asm/mtrr.h
@@ -3,15 +3,9 @@
 
 #include <xen/mm.h>
 
-/* These are the region types. They match the architectural specification. */
-#define MTRR_TYPE_UNCACHABLE 0
-#define MTRR_TYPE_WRCOMB     1
-#define MTRR_TYPE_WRTHROUGH  4
-#define MTRR_TYPE_WRPROT     5
-#define MTRR_TYPE_WRBACK     6
-#define MTRR_NUM_TYPES       7
+#define MTRR_NUM_TYPES       X86_MT_UCM
 #define MEMORY_NUM_TYPES     MTRR_NUM_TYPES
-#define NO_HARDCODE_MEM_TYPE    MTRR_NUM_TYPES
+#define NO_HARDCODE_MEM_TYPE MTRR_NUM_TYPES
 
 #define NORMAL_CACHE_MODE          0
 #define NO_FILL_CACHE_MODE         2
diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 126437285d..bb143c6c42 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -506,7 +506,7 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn,
                                                mfn_x(mfn) | ((1UL << order) - 1)) )
         {
             *ipat = true;
-            return MTRR_TYPE_UNCACHABLE;
+            return X86_MT_UC;
         }
         /* Force invalid memory type so resolve_misconfig() will split it */
         return -1;
@@ -515,7 +515,7 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn,
     if ( !mfn_valid(mfn) )
     {
         *ipat = true;
-        return MTRR_TYPE_UNCACHABLE;
+        return X86_MT_UC;
     }
 
     /*
@@ -526,7 +526,7 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn,
          !cache_flush_permitted(d) )
     {
         *ipat = true;
-        return MTRR_TYPE_WRBACK;
+        return X86_MT_WB;
     }
 
     for ( special_pgs = i = 0; i < (1ul << order); i++ )
@@ -539,13 +539,13 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn,
             return -1;
 
         *ipat = true;
-        return MTRR_TYPE_WRBACK;
+        return X86_MT_WB;
     }
 
     switch ( type )
     {
     case p2m_mmio_direct:
-        return MTRR_TYPE_UNCACHABLE;
+        return X86_MT_UC;
 
     case p2m_grant_map_ro:
     case p2m_grant_map_rw:
@@ -563,7 +563,7 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn,
          * diverges. See p2m_type_to_flags for the AMD attributes.
          */
         *ipat = true;
-        return MTRR_TYPE_WRBACK;
+        return X86_MT_WB;
 
     default:
         break;
@@ -573,15 +573,14 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn,
     if ( gmtrr_mtype >= 0 )
     {
         *ipat = true;
-        return gmtrr_mtype != X86_MT_UCM ? gmtrr_mtype
-                                         : MTRR_TYPE_UNCACHABLE;
+        return gmtrr_mtype != X86_MT_UCM ? gmtrr_mtype : X86_MT_UC;
     }
     if ( gmtrr_mtype == -EADDRNOTAVAIL )
         return -1;
 
     gmtrr_mtype = v ? mtrr_get_type(&v->arch.hvm.mtrr,
                                     gfn_x(gfn) << PAGE_SHIFT, order)
-                    : MTRR_TYPE_WRBACK;
+                    : X86_MT_WB;
     hmtrr_mtype = mtrr_get_type(&mtrr_state, mfn_x(mfn) << PAGE_SHIFT,
                                 order);
     if ( gmtrr_mtype < 0 || hmtrr_mtype < 0 )
@@ -592,14 +591,14 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn,
         return hmtrr_mtype;
 
     /* If either type is UC, we have to go with that one. */
-    if ( gmtrr_mtype == MTRR_TYPE_UNCACHABLE ||
-         hmtrr_mtype == MTRR_TYPE_UNCACHABLE )
-        return MTRR_TYPE_UNCACHABLE;
+    if ( gmtrr_mtype == X86_MT_UC ||
+         hmtrr_mtype == X86_MT_UC )
+        return X86_MT_UC;
 
     /* If either type is WB, we have to go with the other one. */
-    if ( gmtrr_mtype == MTRR_TYPE_WRBACK )
+    if ( gmtrr_mtype == X86_MT_WB )
         return hmtrr_mtype;
-    if ( hmtrr_mtype == MTRR_TYPE_WRBACK )
+    if ( hmtrr_mtype == X86_MT_WB )
         return gmtrr_mtype;
 
     /*
@@ -610,13 +609,13 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn,
      * permit this), while WT and WP require writes to go straight to memory
      * (WC can buffer them).
      */
-    if ( (gmtrr_mtype == MTRR_TYPE_WRTHROUGH &&
-          hmtrr_mtype == MTRR_TYPE_WRPROT) ||
-         (gmtrr_mtype == MTRR_TYPE_WRPROT &&
-          hmtrr_mtype == MTRR_TYPE_WRTHROUGH) )
-        return MTRR_TYPE_WRPROT;
+    if ( (gmtrr_mtype == X86_MT_WT &&
+          hmtrr_mtype == X86_MT_WP) ||
+         (gmtrr_mtype == X86_MT_WP &&
+          hmtrr_mtype == X86_MT_WT) )
+        return X86_MT_WP;
 
-    return MTRR_TYPE_UNCACHABLE;
+    return X86_MT_UC;
 }
 
 /*
@@ -1426,12 +1425,12 @@ void ept_p2m_uninit(struct p2m_domain *p2m)
 static const char *memory_type_to_str(unsigned int x)
 {
     static const char memory_types[8][3] = {
-        [MTRR_TYPE_UNCACHABLE]     = "UC",
-        [MTRR_TYPE_WRCOMB]         = "WC",
-        [MTRR_TYPE_WRTHROUGH]      = "WT",
-        [MTRR_TYPE_WRPROT]         = "WP",
-        [MTRR_TYPE_WRBACK]         = "WB",
-        [MTRR_NUM_TYPES]           = "??"
+        [X86_MT_UC]      = "UC",
+        [X86_MT_WC]      = "WC",
+        [X86_MT_WT]      = "WT",
+        [X86_MT_WP]      = "WP",
+        [X86_MT_WB]      = "WB",
+        [MTRR_NUM_TYPES] = "??",
     };
 
     ASSERT(x < ARRAY_SIZE(memory_types));
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index b64bba70fc..f5f7ff021b 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -570,7 +570,7 @@ _sh_propagate(struct vcpu *v,
                             gflags,
                             gfn_to_paddr(target_gfn),
                             mfn_to_maddr(target_mfn),
-                            MTRR_TYPE_UNCACHABLE);
+                            X86_MT_UC);
                 else if ( iommu_snoop )
                     sflags |= pat_type_2_pte_flags(X86_MT_WB);
                 else
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:14:05 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:14:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469129.728435 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Hp-0001OW-L1; Sat, 24 Dec 2022 14:14:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469129.728435; Sat, 24 Dec 2022 14:14:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Hp-0001OP-IN; Sat, 24 Dec 2022 14:14:05 +0000
Received: by outflank-mailman (input) for mailman id 469129;
 Sat, 24 Dec 2022 14:14:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Ho-0001OH-Cz
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Ho-00083O-CC
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Ho-0002qK-BY
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mh1xj2O9g9QaM8+7ROJ6F4/L7Kd8lvR5H5V0uFCOVcM=; b=CErb3AEyNT8JIOwkdSPS9yJexc
	egY3de/m7XQDk23L701+NRKqz5q8pjezBjWVyFMjHq/8PDQxiAwVBUm/cdl6rHgesdadG9dqHRqQS
	WPn8Ef3yohuDDdReP1XbE4wE89r/MHnfe8tVW5WMbOOiYZC8GCcNGwZfu81XVZaSQ1g0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: replace EPT_EMT_* constants with X86_MT_*
Message-Id: <E1p95Ho-0002qK-BY@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:14:04 +0000

commit b7dd0f590aa69431f26f825ae3d568623ee7fe54
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Dec 20 16:51:18 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 16:51:18 2022 +0100

    x86: replace EPT_EMT_* constants with X86_MT_*
    
    This allows eliminating the former.  No functional change intended.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/hvm/vmx/vmx.h | 9 ---------
 xen/arch/x86/mm/hap/nested_ept.c       | 4 ++--
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index 8e1e42ac47..96a9f07ca5 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -80,15 +80,6 @@ typedef enum {
 #define EPTE_RWX_MASK           0x7
 #define EPTE_FLAG_MASK          0x7f
 
-#define EPT_EMT_UC              0
-#define EPT_EMT_WC              1
-#define EPT_EMT_RSV0            2
-#define EPT_EMT_RSV1            3
-#define EPT_EMT_WT              4
-#define EPT_EMT_WP              5
-#define EPT_EMT_WB              6
-#define EPT_EMT_RSV2            7
-
 #define PI_xAPIC_NDST_MASK      0xFF00
 
 void vmx_asm_vmexit_handler(struct cpu_user_regs);
diff --git a/xen/arch/x86/mm/hap/nested_ept.c b/xen/arch/x86/mm/hap/nested_ept.c
index 1cb7fefc37..23fb3889b7 100644
--- a/xen/arch/x86/mm/hap/nested_ept.c
+++ b/xen/arch/x86/mm/hap/nested_ept.c
@@ -84,8 +84,8 @@ static bool_t nept_emt_bits_check(ept_entry_t e, uint32_t level)
 {
     if ( e.sp || level == 1 )
     {
-        if ( e.emt == EPT_EMT_RSV0 || e.emt == EPT_EMT_RSV1 ||
-             e.emt == EPT_EMT_RSV2 )
+        if ( e.emt == X86_MT_RSVD_2 || e.emt == X86_MT_RSVD_3 ||
+             e.emt == X86_MT_UCM )
             return 1;
     }
     return 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:14:15 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:14:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469130.728438 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Hz-0001RF-Mn; Sat, 24 Dec 2022 14:14:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469130.728438; Sat, 24 Dec 2022 14:14:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Hz-0001R7-KB; Sat, 24 Dec 2022 14:14:15 +0000
Received: by outflank-mailman (input) for mailman id 469130;
 Sat, 24 Dec 2022 14:14:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Hy-0001Qx-G6
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Hy-00083S-FL
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Hy-0002qn-Eh
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lhHjYbTLXZy6Lg+VJtcnTHFNUYeSBVYq5Q9m6gLMUwk=; b=qaqIZGYFtZEvDoP3lzamaPgKYa
	HYU2nhSwO+YrsuCAb5pX/uAVyiT5kQ6cGSWv7MH1jxcZ60h5GGfEv5hMo1E2PYIA94MzscBjzKsSQ
	oEMeYo1LTlsNMq+P8A+EtrjaTr+dtmyhzqFQvBIA3KlcL/qOKI6R3esFO7nT1vozuaB8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: derive XEN_MSR_PAT from its individual entries
Message-Id: <E1p95Hy-0002qn-Eh@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:14:14 +0000

commit 4b40d68e663e87eb916b5bdf3da9743a17f43537
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Dec 20 16:51:55 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 20 16:51:55 2022 +0100

    x86: derive XEN_MSR_PAT from its individual entries
    
    This avoids it being a magic constant that is difficult for humans to
    decode.  Use BUILD_BUG_ON to check that the old and new values are
    identical.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/processor.h |  9 ++++++++-
 xen/arch/x86/mm.c                    | 11 +++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index 8e2816fae9..60b9020609 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -96,7 +96,14 @@
  * Host IA32_CR_PAT value to cover all memory types.  This is not the default
  * MSR_PAT value, and is an ABI with PV guests.
  */
-#define XEN_MSR_PAT _AC(0x050100070406, ULL)
+#define XEN_MSR_PAT ((_AC(X86_MT_WB,  ULL) << 0x00) | \
+                     (_AC(X86_MT_WT,  ULL) << 0x08) | \
+                     (_AC(X86_MT_UCM, ULL) << 0x10) | \
+                     (_AC(X86_MT_UC,  ULL) << 0x18) | \
+                     (_AC(X86_MT_WC,  ULL) << 0x20) | \
+                     (_AC(X86_MT_WP,  ULL) << 0x28) | \
+                     (_AC(X86_MT_UC,  ULL) << 0x30) | \
+                     (_AC(X86_MT_UC,  ULL) << 0x38))
 
 #ifndef __ASSEMBLY__
 
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 8b9740f575..8fa29d5c8b 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -6283,6 +6283,17 @@ unsigned long get_upper_mfn_bound(void)
     return min(max_mfn, 1UL << (paddr_bits - PAGE_SHIFT)) - 1;
 }
 
+static void __init __maybe_unused build_assertions(void)
+{
+    /*
+     * If this trips, any guests that blindly rely on the public API in xen.h
+     * (instead of reading the PAT from Xen, as Linux 3.19+ does) will be
+     * broken.  Furthermore, live migration of PV guests between Xen versions
+     * using different PATs will not work.
+     */
+    BUILD_BUG_ON(XEN_MSR_PAT != 0x050100070406ULL);
+}
+
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:14:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:14:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469131.728444 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95I9-0001Tz-Oc; Sat, 24 Dec 2022 14:14:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469131.728444; Sat, 24 Dec 2022 14:14:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95I9-0001Tr-La; Sat, 24 Dec 2022 14:14:25 +0000
Received: by outflank-mailman (input) for mailman id 469131;
 Sat, 24 Dec 2022 14:14:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95I8-0001Tk-Iy
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95I8-00083m-IG
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95I8-0002rF-HZ
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t9PvKNY/OezZLWyfJMUAWmHj9ba1/07pYqBSxRs87LY=; b=e5DmHxC591XFGqdxyU9W1mCoSb
	3ZFBKkJG046S6gV1JUHBaEvA3e4a+jq2imn27ozN4DY1mp+afqK3X1/33OZmwvqfpdC8GYS7qfHvF
	H9s9u+1jm9ATqFzwo/RZ/hLYlX7cVB1Rx3jF1zpmmb6ERwYrx1RBxgoDB358uf76wI2o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/multiboot: add proper struct definitions to typedefs
Message-Id: <E1p95I8-0002rF-HZ@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:14:24 +0000

commit 1233294a8d6dd25ae3fe5d055d25524bd9f5984c
Author:     Sergey Dyasli <sergey.dyasli@citrix.com>
AuthorDate: Mon Dec 19 14:45:31 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 19:33:04 2022 +0000

    xen/multiboot: add proper struct definitions to typedefs
    
    This allows to use them for forward declaration in other headers.
    
    Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/multiboot.h | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/xen/include/xen/multiboot.h b/xen/include/xen/multiboot.h
index d1b43e1183..80a1761d9e 100644
--- a/xen/include/xen/multiboot.h
+++ b/xen/include/xen/multiboot.h
@@ -46,23 +46,25 @@
 #ifndef __ASSEMBLY__
 
 /* The symbol table for a.out.  */
-typedef struct {
+struct aout_symbol_table {
     u32 tabsize;
     u32 strsize;
     u32 addr;
     u32 reserved;
-} aout_symbol_table_t;
+};
+typedef struct aout_symbol_table aout_symbol_table_t;
 
 /* The section header table for ELF.  */
-typedef struct {
+struct elf_section_header_table {
     u32 num;
     u32 size;
     u32 addr;
     u32 shndx;
-} elf_section_header_table_t;
+};
+typedef struct elf_section_header_table elf_section_header_table_t;
 
 /* The Multiboot information.  */
-typedef struct {
+struct multiboot_info {
     u32 flags;
 
     /* Valid if flags sets MBI_MEMLIMITS */
@@ -101,26 +103,29 @@ typedef struct {
 
     /* Valid if flags sets MBI_APM */
     u32 apm_table;
-} multiboot_info_t;
+};
+typedef struct multiboot_info multiboot_info_t;
 
 /* The module structure.  */
-typedef struct {
+struct module {
     u32 mod_start;
     u32 mod_end;
     u32 string;
     u32 reserved;
-} module_t;
+};
+typedef struct module module_t;
 
 /* The memory map. Be careful that the offset 0 is base_addr_low
    but no size.  */
-typedef struct {
+struct memory_map {
     u32 size;
     u32 base_addr_low;
     u32 base_addr_high;
     u32 length_low;
     u32 length_high;
     u32 type;
-} memory_map_t;
+};
+typedef struct memory_map memory_map_t;
 
 
 #endif /* __ASSEMBLY__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:14:35 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:14:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469132.728447 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95IJ-0001Wg-R5; Sat, 24 Dec 2022 14:14:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469132.728447; Sat, 24 Dec 2022 14:14:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95IJ-0001WY-NE; Sat, 24 Dec 2022 14:14:35 +0000
Received: by outflank-mailman (input) for mailman id 469132;
 Sat, 24 Dec 2022 14:14:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95II-0001WO-Lm
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95II-00083u-L8
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95II-0002ri-KX
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hoiyctHlJPVcHrinh5VXEE8fACPp44c3fsnIfG0J5gs=; b=Mg8qQXQwZ1I2JfVeVy8bcbALYX
	HeIDrwc9HVIGjkYNSavl7ictIplHzeRa6B9rbXQE30XBvxOMyFsJlDE72icbSNphu+I24abM2RwZB
	rPFiyR7l3H3H+QzeMJtV2+32DNiX8ETiERCWM8CmGmDZ4m2c3S87YmCVUYBHRZBHdSQE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: allow cpu_request_microcode() to skip memory allocation
Message-Id: <E1p95II-0002ri-KX@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:14:34 +0000

commit 44a6871a5bd0e8b96e8bf7fccc8abf8eaf369680
Author:     Sergey Dyasli <sergey.dyasli@citrix.com>
AuthorDate: Mon Dec 19 14:45:32 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 19:33:04 2022 +0000

    x86/ucode: allow cpu_request_microcode() to skip memory allocation
    
    This is a preparatory step in order to do earlier microcode loading on
    the boot CPU when the domain heap has not been initialized yet and
    xmalloc still unavailable.
    
    Add make_copy argument which will allow to load microcode directly from
    the blob bypassing microcode_cache.
    
    Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c     | 13 +++++++++----
 xen/arch/x86/cpu/microcode/core.c    |  2 +-
 xen/arch/x86/cpu/microcode/intel.c   | 13 +++++++++----
 xen/arch/x86/cpu/microcode/private.h | 16 +++++++++++-----
 4 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 8195707ee1..4b097187a0 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -300,7 +300,7 @@ static int scan_equiv_cpu_table(const struct container_equiv_table *et)
 }
 
 static struct microcode_patch *cf_check cpu_request_microcode(
-    const void *buf, size_t size)
+    const void *buf, size_t size, bool make_copy)
 {
     const struct microcode_patch *saved = NULL;
     struct microcode_patch *patch = NULL;
@@ -411,9 +411,14 @@ static struct microcode_patch *cf_check cpu_request_microcode(
 
     if ( saved )
     {
-        patch = xmemdup_bytes(saved, saved_size);
-        if ( !patch )
-            error = -ENOMEM;
+        if ( make_copy )
+        {
+            patch = xmemdup_bytes(saved, saved_size);
+            if ( !patch )
+                error = -ENOMEM;
+        }
+        else
+            patch = (struct microcode_patch *)saved;
     }
 
     if ( error && !patch )
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 452a7ca773..85c05e480d 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -244,7 +244,7 @@ static struct microcode_patch *parse_blob(const char *buf, size_t len)
 {
     alternative_vcall(ucode_ops.collect_cpu_info);
 
-    return alternative_call(ucode_ops.cpu_request_microcode, buf, len);
+    return alternative_call(ucode_ops.cpu_request_microcode, buf, len, true);
 }
 
 static void microcode_free_patch(struct microcode_patch *patch)
diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c
index f5ba6d76d7..f7fec4b4ed 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -324,7 +324,7 @@ static int cf_check apply_microcode(const struct microcode_patch *patch)
 }
 
 static struct microcode_patch *cf_check cpu_request_microcode(
-    const void *buf, size_t size)
+    const void *buf, size_t size, bool make_copy)
 {
     int error = 0;
     const struct microcode_patch *saved = NULL;
@@ -364,10 +364,15 @@ static struct microcode_patch *cf_check cpu_request_microcode(
 
     if ( saved )
     {
-        patch = xmemdup_bytes(saved, get_totalsize(saved));
+        if ( make_copy )
+        {
+            patch = xmemdup_bytes(saved, get_totalsize(saved));
 
-        if ( !patch )
-            error = -ENOMEM;
+            if ( !patch )
+                error = -ENOMEM;
+        }
+        else
+            patch = (struct microcode_patch *)saved;
     }
 
     if ( error && !patch )
diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h
index c085a10268..73b095d5bf 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -23,15 +23,21 @@ struct microcode_ops {
      * older that what is running in the CPU.  This is a feature, to better
      * cope with corner cases from buggy firmware.)
      *
-     * If one is found, allocate and return a struct microcode_patch
-     * encapsulating the appropriate microcode patch.  Does not alias the
-     * original buffer.  Must be suitable to be freed with a single xfree().
+     * If one is found, behaviour depends on the make_copy argument:
+     *
+     *     true: allocate and return a struct microcode_patch encapsulating
+     *           the appropriate microcode patch.  Does not alias the original
+     *           buffer.  Must be suitable to be freed with a single xfree().
+     *
+     *    false: return a pointer to the patch within the original buffer.
+     *           This is useful for early microcode loading when xmalloc might
+     *           not be available yet.
      *
      * If one is not found, (nothing matches the current CPU), return NULL.
      * Also may return ERR_PTR(-err), e.g. bad container, out of memory.
      */
-    struct microcode_patch *(*cpu_request_microcode)(const void *buf,
-                                                     size_t size);
+    struct microcode_patch *(*cpu_request_microcode)(
+        const void *buf, size_t size, bool make_copy);
 
     /*
      * Obtain microcode-relevant details for the current CPU.  Results in
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:14:47 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:14:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469133.728451 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95IU-0001a2-U8; Sat, 24 Dec 2022 14:14:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469133.728451; Sat, 24 Dec 2022 14:14:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95IU-0001Zu-RR; Sat, 24 Dec 2022 14:14:46 +0000
Received: by outflank-mailman (input) for mailman id 469133;
 Sat, 24 Dec 2022 14:14:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95IS-0001Zc-Or
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95IS-000842-OA
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95IS-0002sF-NU
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hUaYauhAP3h/CwRYZQtLC7SMoNu4IFDy1OVfVRkPLNw=; b=zxX7idOwYSJBilaGyX4W7PgatZ
	2DHKfojDaGDg0wTTvlugdgsvxOuPj35uxsIBxgazEKDg0fCqnaFF1j+5lYx/sY0HvtnhuP1wdG1hF
	2Uh3q8t7HWZnSLumJzX7NN9s4oK7w0m40X2cecWwpNZNCU22RpaKme0C8Lw4HOsBkBds=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: load microcode earlier on boot CPU
Message-Id: <E1p95IS-0002sF-NU@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:14:44 +0000

commit dc380df12acfe53ccdcbeecaaee3510a3b0e374e
Author:     Sergey Dyasli <sergey.dyasli@citrix.com>
AuthorDate: Mon Dec 19 14:45:33 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 20 19:33:04 2022 +0000

    x86/ucode: load microcode earlier on boot CPU
    
    Call early_microcode_init() straight after multiboot modules become
    accessible. Modify it to load the ucode directly from the blob bypassing
    populating microcode_cache because xmalloc is still not available at
    that point during Xen boot.
    
    Introduce early_microcode_init_cache() for populating microcode_cache.
    It needs to rescan the modules in order to find the new virtual address
    of the ucode blob because it changes during the boot process, e.g.
    from 0x00000000010802fc to 0xffff83204dac52fc.
    
    While at it, drop alternative_vcall() from early_microcode_init() since
    it's not useful in an __init fuction.
    
    Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/core.c    | 66 ++++++++++++++++++++++++++++++------
 xen/arch/x86/include/asm/microcode.h |  7 +++-
 xen/arch/x86/include/asm/setup.h     |  3 --
 xen/arch/x86/setup.c                 | 10 ++++--
 4 files changed, 68 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 85c05e480d..d14754e222 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -27,6 +27,7 @@
 #include <xen/err.h>
 #include <xen/guest_access.h>
 #include <xen/init.h>
+#include <xen/multiboot.h>
 #include <xen/param.h>
 #include <xen/spinlock.h>
 #include <xen/stop_machine.h>
@@ -198,7 +199,8 @@ void __init microcode_scan_module(
         bootstrap_map(NULL);
     }
 }
-void __init microcode_grab_module(
+
+static void __init microcode_grab_module(
     unsigned long *module_map,
     const multiboot_info_t *mbi)
 {
@@ -732,10 +734,54 @@ int microcode_update_one(void)
     return microcode_update_cpu(NULL);
 }
 
+static int __init early_update_cache(const void *data, size_t len)
+{
+    int rc = 0;
+    struct microcode_patch *patch;
+
+    if ( !data )
+        return -ENOMEM;
+
+    patch = parse_blob(data, len);
+    if ( IS_ERR(patch) )
+    {
+        printk(XENLOG_WARNING "Parsing microcode blob error %ld\n",
+               PTR_ERR(patch));
+        return PTR_ERR(patch);
+    }
+
+    if ( !patch )
+        return -ENOENT;
+
+    spin_lock(&microcode_mutex);
+    rc = microcode_update_cache(patch);
+    spin_unlock(&microcode_mutex);
+    ASSERT(rc);
+
+    return rc;
+}
+
+int __init microcode_init_cache(unsigned long *module_map,
+                                const struct multiboot_info *mbi)
+{
+    int rc = 0;
+
+    if ( ucode_scan )
+        /* Need to rescan the modules because they might have been relocated */
+        microcode_scan_module(module_map, mbi);
+
+    if ( ucode_mod.mod_end )
+        rc = early_update_cache(bootstrap_map(&ucode_mod),
+                                ucode_mod.mod_end);
+    else if ( ucode_blob.size )
+        rc = early_update_cache(ucode_blob.data, ucode_blob.size);
+
+    return rc;
+}
+
 /* BSP calls this function to parse ucode blob and then apply an update. */
 static int __init early_microcode_update_cpu(void)
 {
-    int rc = 0;
     const void *data = NULL;
     size_t len;
     struct microcode_patch *patch;
@@ -754,7 +800,7 @@ static int __init early_microcode_update_cpu(void)
     if ( !data )
         return -ENOMEM;
 
-    patch = parse_blob(data, len);
+    patch = ucode_ops.cpu_request_microcode(data, len, false);
     if ( IS_ERR(patch) )
     {
         printk(XENLOG_WARNING "Parsing microcode blob error %ld\n",
@@ -765,15 +811,11 @@ static int __init early_microcode_update_cpu(void)
     if ( !patch )
         return -ENOENT;
 
-    spin_lock(&microcode_mutex);
-    rc = microcode_update_cache(patch);
-    spin_unlock(&microcode_mutex);
-    ASSERT(rc);
-
-    return microcode_update_one();
+    return microcode_update_cpu(patch);
 }
 
-int __init early_microcode_init(void)
+int __init early_microcode_init(unsigned long *module_map,
+                                const struct multiboot_info *mbi)
 {
     const struct cpuinfo_x86 *c = &boot_cpu_data;
     int rc = 0;
@@ -797,7 +839,9 @@ int __init early_microcode_init(void)
         return -ENODEV;
     }
 
-    alternative_vcall(ucode_ops.collect_cpu_info);
+    microcode_grab_module(module_map, mbi);
+
+    ucode_ops.collect_cpu_info();
 
     if ( ucode_mod.mod_end || ucode_blob.size )
         rc = early_microcode_update_cpu();
diff --git a/xen/arch/x86/include/asm/microcode.h b/xen/arch/x86/include/asm/microcode.h
index 3b0234e9fa..62ce3418f7 100644
--- a/xen/arch/x86/include/asm/microcode.h
+++ b/xen/arch/x86/include/asm/microcode.h
@@ -6,6 +6,8 @@
 
 #include <public/xen.h>
 
+struct multiboot_info;
+
 struct cpu_signature {
     /* CPU signature (CPUID.1.EAX). */
     unsigned int sig;
@@ -21,7 +23,10 @@ DECLARE_PER_CPU(struct cpu_signature, cpu_sig);
 
 void microcode_set_module(unsigned int idx);
 int microcode_update(XEN_GUEST_HANDLE(const_void), unsigned long len);
-int early_microcode_init(void);
+int early_microcode_init(unsigned long *module_map,
+                         const struct multiboot_info *mbi);
+int microcode_init_cache(unsigned long *module_map,
+                         const struct multiboot_info *mbi);
 int microcode_update_one(void);
 
 #endif /* ASM_X86__MICROCODE_H */
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index ae470ea12f..ae0dd3915a 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -44,9 +44,6 @@ void *bootstrap_map(const module_t *mod);
 
 int xen_in_range(unsigned long mfn);
 
-void microcode_grab_module(
-    unsigned long *, const multiboot_info_t *);
-
 extern uint8_t kbd_shift_flags;
 
 #ifdef NDEBUG
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 4102aae76d..566422600d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1173,6 +1173,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         mod[i].reserved = 0;
     }
 
+    /*
+     * TODO: load ucode earlier once multiboot modules become accessible
+     * at an earlier stage.
+     */
+    early_microcode_init(module_map, mbi);
+
     if ( xen_phys_start )
     {
         relocated = true;
@@ -1755,11 +1761,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     init_IRQ();
 
-    microcode_grab_module(module_map, mbi);
-
     timer_init();
 
-    early_microcode_init();
+    microcode_init_cache(module_map, mbi); /* Needs xmalloc() */
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:14:57 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:14:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469134.728454 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Ie-0001cz-VS; Sat, 24 Dec 2022 14:14:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469134.728454; Sat, 24 Dec 2022 14:14:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Ie-0001cq-Su; Sat, 24 Dec 2022 14:14:56 +0000
Received: by outflank-mailman (input) for mailman id 469134;
 Sat, 24 Dec 2022 14:14:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Ic-0001cG-Rz
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Ic-000846-RL
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Ic-0002se-Qg
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:14:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UWhMAQ7GPeMSJY8TUsQdxoMTbl9QCOgPiaIOlgrVHuQ=; b=RiDTKVGBHVKtP4sY7qLL1ZawvS
	hzuAnrKrOAdzbidZYyhvqfS2YJqZBqp7BqmWDPG8ythfvA/VWqiegWojfdUG1Zg6CA1ZcQI7IEl0s
	laCJV2h5W/imzW8WWbi/veXsBqz7bVctoMQ0wUNsfXW6SSUEUCp3glhipFhZ12zsauM8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Allow to set grant table related limits for dom0less domUs
Message-Id: <E1p95Ic-0002se-Qg@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:14:54 +0000

commit 9c57a297378932249c3edefa5065c838f47cb3fb
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Dec 19 09:59:08 2022 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Dec 21 17:20:43 2022 -0800

    xen/arm: Allow to set grant table related limits for dom0less domUs
    
    At the moment, for dom0less domUs, we do not have a way to specify
    per domain grant table related limits (unlike when using xl), namely
    max version, max number of grant frames, max number of maptrack frames.
    This means that such domains always use the values specified by the Xen
    command line parameters or their default values if unspecified.
    
    In order to have more control over dom0less domUs, introduce the
    following device-tree properties that can be set under domUs nodes:
     - max_grant_version to set the maximum grant table version the domain
       is allowed to use,
     - max_grant_frames to set the maximum number of grant frames the domain
       is allowed to have,
     - max_maptrack_frames to set the maximum number of grant maptrack frames
       the domain is allowed to have.
    
    Update documentation accordingly.
    
    Note that the values obtained from device tree are of type uint32_t,
    whereas the d_cfg.max_{grant_frames,maptrack_frames} are of type int32_t.
    Call panic in case of overflow. Other sanity checks are already there in
    grant_table_init() resulting in panic in case of errors, therefore no
    need to repeat them in create_domUs().
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/misc/arm/device-tree/booting.txt | 21 +++++++++++++++++++++
 xen/arch/arm/domain_build.c           | 18 ++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
index 87eaa3e254..3879340b5e 100644
--- a/docs/misc/arm/device-tree/booting.txt
+++ b/docs/misc/arm/device-tree/booting.txt
@@ -223,6 +223,27 @@ with the following properties:
     the default size of domain P2M pool, i.e. 1MB per guest vCPU plus 4KB
     per MB of guest RAM plus 512KB for guest extended regions.
 
+- max_grant_version
+
+    Optional. A 32-bit integer specifying the maximum grant table version
+    the domain is allowed to use (valid values are 1 or 2). If this property
+    is missing, the value specified by Xen command line parameter gnttab=max-ver
+    (or its default value if unspecified, i.e. 1) is used.
+
+- max_grant_frames
+
+    Optional. A 32-bit integer specifying the maximum number of grant frames
+    the domain is allowed to have. If this property is missing, the value
+    specified by Xen command line parameter gnttab_max_frames (or its default
+    value if unspecified, i.e. 64) is used.
+
+- max_maptrack_frames
+
+    Optional. A 32-bit integer specifying the maximum number of grant maptrack
+    frames the domain is allowed to have. If this property is missing, the
+    value specified by Xen command line parameter gnttab_max_maptrack_frames
+    (or its default value if unspecified, i.e. 1024) is used.
+
 Under the "xen,domain" compatible node, one or more sub-nodes are present
 for the DomU kernel and ramdisk.
 
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index bef5e905a7..829cea8de8 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -3872,6 +3872,7 @@ void __init create_domUs(void)
             .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
         };
         unsigned int flags = 0U;
+        uint32_t val;
 
         if ( !dt_device_is_compatible(node, "xen,domain") )
             continue;
@@ -3940,6 +3941,23 @@ void __init create_domUs(void)
             d_cfg.cpupool_id = pool_id;
         }
 
+        if ( dt_property_read_u32(node, "max_grant_version", &val) )
+            d_cfg.grant_opts = XEN_DOMCTL_GRANT_version(val);
+
+        if ( dt_property_read_u32(node, "max_grant_frames", &val) )
+        {
+            if ( val > INT32_MAX )
+                panic("max_grant_frames (%"PRIu32") overflow\n", val);
+            d_cfg.max_grant_frames = val;
+        }
+
+        if ( dt_property_read_u32(node, "max_maptrack_frames", &val) )
+        {
+            if ( val > INT32_MAX )
+                panic("max_maptrack_frames (%"PRIu32") overflow\n", val);
+            d_cfg.max_maptrack_frames = val;
+        }
+
         /*
          * The variable max_init_domid is initialized with zero, so here it's
          * very important to use the pre-increment operator to call
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:15:07 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:15:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469135.728459 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Ip-0001h1-13; Sat, 24 Dec 2022 14:15:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469135.728459; Sat, 24 Dec 2022 14:15: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 1p95Io-0001gs-UQ; Sat, 24 Dec 2022 14:15:06 +0000
Received: by outflank-mailman (input) for mailman id 469135;
 Sat, 24 Dec 2022 14:15:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Im-0001gR-VB
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Im-00084i-US
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Im-0002tI-TX
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=28Cd456zVycpIPDDzdi2IYcR7QMCfPfeKi/wtVzZtmU=; b=FEAJLzeYpmCWr4BCqKGnjlLGCo
	xMx2H8HTPcvK2oQncS2xDqpC54NRmB6BgCsAUG1epacXF5SeqHZQmeCenb9vSLawl0ULg6D2QVN6D
	rZbUht92ljzTebis7c7Kris0iAaiyhJ6WZCECGqlSUxhvGIxMitXRgoCre1TkcQx8xRs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] public: misra rule 20.7 fix on errno.h
Message-Id: <E1p95Im-0002tI-TX@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:15:04 +0000

commit e03427ebb6af75b5a29c9997d9b48121122a39d5
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Thu Dec 22 10:04:17 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 22 10:04:17 2022 +0100

    public: misra rule 20.7 fix on errno.h
    
    Cppcheck has found a violation of rule 20.7 for the macro XEN_ERRNO,
    while the macro parameter is never used as an expression, it doesn't
    harm the code or the readability to add parenthesis, so add them.
    
    This finding is reported also by eclair and coverity.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/errno.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/public/errno.h b/xen/include/public/errno.h
index 6bdc8c5079..5a78a7607c 100644
--- a/xen/include/public/errno.h
+++ b/xen/include/public/errno.h
@@ -31,7 +31,7 @@
 
 #ifndef __ASSEMBLY__
 
-#define XEN_ERRNO(name, value) XEN_##name = value,
+#define XEN_ERRNO(name, value) XEN_##name = (value),
 enum xen_errno {
 
 #elif __XEN_INTERFACE_VERSION__ < 0x00040700
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:15:16 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:15:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469136.728463 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Iy-0001jW-2V; Sat, 24 Dec 2022 14:15:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469136.728463; Sat, 24 Dec 2022 14:15: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 1p95Ix-0001jO-Vy; Sat, 24 Dec 2022 14:15:15 +0000
Received: by outflank-mailman (input) for mailman id 469136;
 Sat, 24 Dec 2022 14:15:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Ix-0001jH-25
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Ix-00084v-1Q
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Ix-0002tj-0S
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pMgoSpBxBR78jaK6xiWHvxPsaVSq+tnjI/Q+BUuN4AE=; b=mVCGm4l2Pb03SP2YS2ym3TgaTy
	LqfXthbJM6snrcTGBBek5mf8SqXVsWWCQdNVIvHTQ7dbuBqzv5Q9VnnoqSICQbQGdnPlcBFqmvXVX
	RMyrQzoaF2V8xhzsc19y8/SJnLVcQIq9l8fVL7ElhroQX6Dn+cmxsiu7Sr4Iq+dofsHE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] public: misra rule 20.7 fix on memory.h
Message-Id: <E1p95Ix-0002tj-0S@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:15:15 +0000

commit ee17d521b808a918bec2a27bbeeebd0f1bb0303b
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Thu Dec 22 10:04:34 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 22 10:04:34 2022 +0100

    public: misra rule 20.7 fix on memory.h
    
    Cppcheck has found a violation of rule 20.7 for the macro
    XENMEM_SHARING_OP_FIELD_MAKE_GREF, the argument "val" is used in an
    expression, hence add parenthesis to the argument "val" to fix the
    violation.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/memory.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index 29cf5c8239..c5f0d31e23 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -485,7 +485,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_mem_access_op_t);
 #define XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG   (xen_mk_ullong(1) << 62)
 
 #define XENMEM_SHARING_OP_FIELD_MAKE_GREF(field, val)  \
-    (field) = (XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG | val)
+    (field) = (XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG | (val))
 #define XENMEM_SHARING_OP_FIELD_IS_GREF(field)         \
     ((field) & XENMEM_SHARING_OP_FIELD_IS_GREF_FLAG)
 #define XENMEM_SHARING_OP_FIELD_GET_GREF(field)        \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:15:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:15:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469137.728469 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95J8-0001m4-52; Sat, 24 Dec 2022 14:15:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469137.728469; Sat, 24 Dec 2022 14:15: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 1p95J8-0001lw-1M; Sat, 24 Dec 2022 14:15:26 +0000
Received: by outflank-mailman (input) for mailman id 469137;
 Sat, 24 Dec 2022 14:15:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95J7-0001lg-5Z
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95J7-00085S-4s
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95J7-0002u8-4E
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qyVtlrZX8f4IV/whUtaXyQgtRituu2kHL+4+iKeAkjc=; b=AkxApeE52uwjuNL2OUkRPrtJ1I
	sgAhNthIM9pIZmIEitUPA0FeFck1dfQjKrWkoiWuJGaB7kyc+Y6suyFwJxICap6hwz28iga0FhVGn
	JKAlaQ9peRyO85x9NeMvE4bI54IdQXhlxfi0xYVc/qnDyptuZiL5fEVexexMV1yP+B4U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/paging: fold HAP and shadow memory alloc related fields
Message-Id: <E1p95J7-0002u8-4E@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:15:25 +0000

commit 5d58062192dc38daeb993589fe0d3c035ef6f9e6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Dec 22 10:05:21 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 22 10:05:21 2022 +0100

    x86/paging: fold HAP and shadow memory alloc related fields
    
    Especially with struct shadow_domain and struct hap_domain not living in
    a union inside struct paging_domain, let's avoid the duplication: The
    fields are named and used in identical ways, and only one of HAP or
    shadow can be in use for a domain. This then also renders involved
    expressions slightly more legible.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/domain.h |  17 +++---
 xen/arch/x86/include/asm/hap.h    |   1 -
 xen/arch/x86/include/asm/shadow.h |   4 --
 xen/arch/x86/mm/hap/hap.c         |  71 ++++++++++-------------
 xen/arch/x86/mm/paging.c          |  13 +++--
 xen/arch/x86/mm/shadow/common.c   | 116 +++++++++++++++-----------------------
 xen/arch/x86/mm/shadow/hvm.c      |   2 +-
 7 files changed, 91 insertions(+), 133 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 43ace233d7..b5354c3677 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -99,12 +99,6 @@ struct shadow_domain {
     unsigned int      opt_flags;    /* runtime tunable optimizations on/off */
     struct page_list_head pinned_shadows;
 
-    /* Memory allocation */
-    struct page_list_head freelist;
-    unsigned int      total_pages;  /* number of pages allocated */
-    unsigned int      free_pages;   /* number of pages on freelists */
-    unsigned int      p2m_pages;    /* number of pages allocated to p2m */
-
     /* 1-to-1 map for use when HVM vcpus have paging disabled */
     pagetable_t unpaged_pagetable;
 
@@ -179,10 +173,6 @@ struct shadow_vcpu {
 /*            hardware assisted paging          */
 /************************************************/
 struct hap_domain {
-    struct page_list_head freelist;
-    unsigned int      total_pages;  /* number of pages allocated */
-    unsigned int      free_pages;   /* number of pages on freelists */
-    unsigned int      p2m_pages;    /* number of pages allocated to p2m */
 };
 
 /************************************************/
@@ -218,6 +208,13 @@ struct paging_domain {
     struct shadow_domain    shadow;
     /* extension for hardware-assited paging */
     struct hap_domain       hap;
+
+    /* Memory allocation (common to shadow and HAP) */
+    struct page_list_head   freelist;
+    unsigned int            total_pages;  /* number of pages allocated */
+    unsigned int            free_pages;   /* number of pages on freelists */
+    unsigned int            p2m_pages;    /* number of pages allocated to p2m */
+
     /* log dirty support */
     struct log_dirty_domain log_dirty;
 
diff --git a/xen/arch/x86/include/asm/hap.h b/xen/arch/x86/include/asm/hap.h
index 14d2f212da..90dece29de 100644
--- a/xen/arch/x86/include/asm/hap.h
+++ b/xen/arch/x86/include/asm/hap.h
@@ -47,7 +47,6 @@ int   hap_track_dirty_vram(struct domain *d,
 extern const struct paging_mode *hap_paging_get_mode(struct vcpu *);
 int hap_set_allocation(struct domain *d, unsigned int pages, bool *preempted);
 unsigned int hap_get_allocation(struct domain *d);
-int hap_get_allocation_bytes(struct domain *d, uint64_t *size);
 
 #endif /* XEN_HAP_H */
 
diff --git a/xen/arch/x86/include/asm/shadow.h b/xen/arch/x86/include/asm/shadow.h
index dad876d294..1365fe4805 100644
--- a/xen/arch/x86/include/asm/shadow.h
+++ b/xen/arch/x86/include/asm/shadow.h
@@ -97,8 +97,6 @@ void shadow_blow_tables_per_domain(struct domain *d);
 int shadow_set_allocation(struct domain *d, unsigned int pages,
                           bool *preempted);
 
-int shadow_get_allocation_bytes(struct domain *d, uint64_t *size);
-
 #else /* !CONFIG_SHADOW_PAGING */
 
 #define shadow_vcpu_teardown(v) ASSERT(is_pv_vcpu(v))
@@ -110,8 +108,6 @@ int shadow_get_allocation_bytes(struct domain *d, uint64_t *size);
     ({ ASSERT_UNREACHABLE(); -EOPNOTSUPP; })
 #define shadow_set_allocation(d, pages, preempted) \
     ({ ASSERT_UNREACHABLE(); -EOPNOTSUPP; })
-#define shadow_get_allocation_bytes(d, size) \
-    ({ ASSERT_UNREACHABLE(); -EOPNOTSUPP; })
 
 static inline void sh_remove_shadows(struct domain *d, mfn_t gmfn,
                                      int fast, int all) {}
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 0fc1b1d9ac..84cb358df1 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -249,11 +249,11 @@ static struct page_info *hap_alloc(struct domain *d)
     if ( unlikely(d->is_dying) )
         return NULL;
 
-    pg = page_list_remove_head(&d->arch.paging.hap.freelist);
+    pg = page_list_remove_head(&d->arch.paging.freelist);
     if ( unlikely(!pg) )
         return NULL;
 
-    d->arch.paging.hap.free_pages--;
+    d->arch.paging.free_pages--;
 
     clear_domain_page(page_to_mfn(pg));
 
@@ -274,12 +274,12 @@ static void hap_free(struct domain *d, mfn_t mfn)
     if ( unlikely(d->is_dying) )
     {
         free_domheap_page(pg);
-        d->arch.paging.hap.total_pages--;
+        d->arch.paging.total_pages--;
         return;
     }
 
-    d->arch.paging.hap.free_pages++;
-    page_list_add_tail(pg, &d->arch.paging.hap.freelist);
+    d->arch.paging.free_pages++;
+    page_list_add_tail(pg, &d->arch.paging.freelist);
 }
 
 static struct page_info *cf_check hap_alloc_p2m_page(struct domain *d)
@@ -293,8 +293,8 @@ static struct page_info *cf_check hap_alloc_p2m_page(struct domain *d)
 
     if ( likely(pg != NULL) )
     {
-        d->arch.paging.hap.total_pages--;
-        d->arch.paging.hap.p2m_pages++;
+        d->arch.paging.total_pages--;
+        d->arch.paging.p2m_pages++;
         ASSERT(!page_get_owner(pg) && !(pg->count_info & PGC_count_mask));
     }
     else if ( !d->arch.paging.p2m_alloc_failed && !d->is_dying )
@@ -328,8 +328,8 @@ static void cf_check hap_free_p2m_page(struct domain *d, struct page_info *pg)
         pg->count_info &= ~PGC_count_mask;
         page_set_owner(pg, NULL);
     }
-    d->arch.paging.hap.p2m_pages--;
-    d->arch.paging.hap.total_pages++;
+    d->arch.paging.p2m_pages--;
+    d->arch.paging.total_pages++;
     hap_free(d, page_to_mfn(pg));
 
     paging_unlock(d);
@@ -338,24 +338,13 @@ static void cf_check hap_free_p2m_page(struct domain *d, struct page_info *pg)
 /* Return the size of the pool, rounded up to the nearest MB */
 unsigned int hap_get_allocation(struct domain *d)
 {
-    unsigned int pg = d->arch.paging.hap.total_pages
-        + d->arch.paging.hap.p2m_pages;
+    unsigned int pg = d->arch.paging.total_pages
+        + d->arch.paging.p2m_pages;
 
     return ((pg >> (20 - PAGE_SHIFT))
             + ((pg & ((1 << (20 - PAGE_SHIFT)) - 1)) ? 1 : 0));
 }
 
-int hap_get_allocation_bytes(struct domain *d, uint64_t *size)
-{
-    unsigned long pages = d->arch.paging.hap.total_pages;
-
-    pages += d->arch.paging.hap.p2m_pages;
-
-    *size = pages << PAGE_SHIFT;
-
-    return 0;
-}
-
 /* Set the pool of pages to the required number of pages.
  * Returns 0 for success, non-zero for failure. */
 int hap_set_allocation(struct domain *d, unsigned int pages, bool *preempted)
@@ -364,14 +353,14 @@ int hap_set_allocation(struct domain *d, unsigned int pages, bool *preempted)
 
     ASSERT(paging_locked_by_me(d));
 
-    if ( pages < d->arch.paging.hap.p2m_pages )
+    if ( pages < d->arch.paging.p2m_pages )
         pages = 0;
     else
-        pages -= d->arch.paging.hap.p2m_pages;
+        pages -= d->arch.paging.p2m_pages;
 
     for ( ; ; )
     {
-        if ( d->arch.paging.hap.total_pages < pages )
+        if ( d->arch.paging.total_pages < pages )
         {
             /* Need to allocate more memory from domheap */
             pg = alloc_domheap_page(d, MEMF_no_owner);
@@ -380,22 +369,22 @@ int hap_set_allocation(struct domain *d, unsigned int pages, bool *preempted)
                 HAP_PRINTK("failed to allocate hap pages.\n");
                 return -ENOMEM;
             }
-            d->arch.paging.hap.free_pages++;
-            d->arch.paging.hap.total_pages++;
-            page_list_add_tail(pg, &d->arch.paging.hap.freelist);
+            d->arch.paging.free_pages++;
+            d->arch.paging.total_pages++;
+            page_list_add_tail(pg, &d->arch.paging.freelist);
         }
-        else if ( d->arch.paging.hap.total_pages > pages )
+        else if ( d->arch.paging.total_pages > pages )
         {
             /* Need to return memory to domheap */
-            if ( page_list_empty(&d->arch.paging.hap.freelist) )
+            if ( page_list_empty(&d->arch.paging.freelist) )
             {
                 HAP_PRINTK("failed to free enough hap pages.\n");
                 return -ENOMEM;
             }
-            pg = page_list_remove_head(&d->arch.paging.hap.freelist);
+            pg = page_list_remove_head(&d->arch.paging.freelist);
             ASSERT(pg);
-            d->arch.paging.hap.free_pages--;
-            d->arch.paging.hap.total_pages--;
+            d->arch.paging.free_pages--;
+            d->arch.paging.total_pages--;
             free_domheap_page(pg);
         }
         else
@@ -462,8 +451,6 @@ void hap_domain_init(struct domain *d)
         .clean   = hap_clean_dirty_bitmap,
     };
 
-    INIT_PAGE_LIST_HEAD(&d->arch.paging.hap.freelist);
-
     /* Use HAP logdirty mechanism. */
     paging_log_dirty_init(d, &hap_ops);
 }
@@ -484,7 +471,7 @@ int hap_enable(struct domain *d, u32 mode)
 
     domain_pause(d);
 
-    old_pages = d->arch.paging.hap.total_pages;
+    old_pages = d->arch.paging.total_pages;
     if ( old_pages == 0 )
     {
         paging_lock(d);
@@ -566,16 +553,16 @@ void hap_final_teardown(struct domain *d)
         p2m_teardown(d->arch.nested_p2m[i], true, NULL);
     }
 
-    if ( d->arch.paging.hap.total_pages != 0 )
+    if ( d->arch.paging.total_pages != 0 )
         hap_teardown(d, NULL);
 
     p2m_teardown(p2m_get_hostp2m(d), true, NULL);
     /* Free any memory that the p2m teardown released */
     paging_lock(d);
     hap_set_allocation(d, 0, NULL);
-    ASSERT(d->arch.paging.hap.p2m_pages == 0);
-    ASSERT(d->arch.paging.hap.free_pages == 0);
-    ASSERT(d->arch.paging.hap.total_pages == 0);
+    ASSERT(d->arch.paging.p2m_pages == 0);
+    ASSERT(d->arch.paging.free_pages == 0);
+    ASSERT(d->arch.paging.total_pages == 0);
     paging_unlock(d);
 }
 
@@ -644,14 +631,14 @@ void hap_teardown(struct domain *d, bool *preempted)
 
     paging_lock(d); /* Keep various asserts happy */
 
-    if ( d->arch.paging.hap.total_pages != 0 )
+    if ( d->arch.paging.total_pages != 0 )
     {
         hap_set_allocation(d, 0, preempted);
 
         if ( preempted && *preempted )
             goto out;
 
-        ASSERT(d->arch.paging.hap.total_pages == 0);
+        ASSERT(d->arch.paging.total_pages == 0);
     }
 
     d->arch.paging.mode &= ~PG_log_dirty;
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 8d579fa9a3..1c5f54f92a 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -651,6 +651,7 @@ int paging_domain_init(struct domain *d)
     if ( (rc = p2m_init(d)) != 0 )
         return rc;
 
+    INIT_PAGE_LIST_HEAD(&d->arch.paging.freelist);
     mm_lock_init(&d->arch.paging.lock);
 
     /* This must be initialized separately from the rest of the
@@ -979,17 +980,17 @@ int __init paging_set_allocation(struct domain *d, unsigned int pages,
 
 int arch_get_paging_mempool_size(struct domain *d, uint64_t *size)
 {
-    int rc;
+    unsigned long pages;
 
     if ( is_pv_domain(d) )                 /* TODO: Relax in due course */
         return -EOPNOTSUPP;
 
-    if ( hap_enabled(d) )
-        rc = hap_get_allocation_bytes(d, size);
-    else
-        rc = shadow_get_allocation_bytes(d, size);
+    pages  = d->arch.paging.total_pages;
+    pages += d->arch.paging.p2m_pages;
 
-    return rc;
+    *size = pages << PAGE_SHIFT;
+
+    return 0;
 }
 
 int arch_set_paging_mempool_size(struct domain *d, uint64_t size)
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index cae1d9190c..16a5a2bcf8 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -55,7 +55,6 @@ int shadow_domain_init(struct domain *d)
         .clean   = sh_clean_dirty_bitmap,
     };
 
-    INIT_PAGE_LIST_HEAD(&d->arch.paging.shadow.freelist);
     INIT_PAGE_LIST_HEAD(&d->arch.paging.shadow.pinned_shadows);
 
     /* Use shadow pagetables for log-dirty support */
@@ -936,7 +935,7 @@ static bool __must_check _shadow_prealloc(struct domain *d, unsigned int pages)
     mfn_t smfn;
     int i;
 
-    if ( d->arch.paging.shadow.free_pages >= pages )
+    if ( d->arch.paging.free_pages >= pages )
         return true;
 
     if ( unlikely(d->is_dying) )
@@ -958,7 +957,7 @@ static bool __must_check _shadow_prealloc(struct domain *d, unsigned int pages)
         sh_unpin(d, smfn);
 
         /* See if that freed up enough space */
-        if ( d->arch.paging.shadow.free_pages >= pages )
+        if ( d->arch.paging.free_pages >= pages )
             return true;
     }
 
@@ -979,7 +978,7 @@ static bool __must_check _shadow_prealloc(struct domain *d, unsigned int pages)
                     0);
 
                 /* See if that freed up enough space */
-                if ( d->arch.paging.shadow.free_pages >= pages )
+                if ( d->arch.paging.free_pages >= pages )
                 {
                     guest_flush_tlb_mask(d, d->dirty_cpumask);
                     return true;
@@ -991,10 +990,8 @@ static bool __must_check _shadow_prealloc(struct domain *d, unsigned int pages)
      * hold Xen mappings for some vcpu.  This can never happen. */
     printk(XENLOG_ERR "Can't pre-allocate %u shadow pages!\n"
            "  shadow pages total = %u, free = %u, p2m=%u\n",
-           pages,
-           d->arch.paging.shadow.total_pages,
-           d->arch.paging.shadow.free_pages,
-           d->arch.paging.shadow.p2m_pages);
+           pages, d->arch.paging.total_pages,
+           d->arch.paging.free_pages, d->arch.paging.p2m_pages);
 
     ASSERT_UNREACHABLE();
 
@@ -1122,7 +1119,7 @@ mfn_t shadow_alloc(struct domain *d,
     ASSERT(shadow_type != SH_type_none);
     perfc_incr(shadow_alloc);
 
-    if ( d->arch.paging.shadow.free_pages < pages )
+    if ( d->arch.paging.free_pages < pages )
     {
         /* If we get here, we failed to allocate. This should never
          * happen.  It means that we didn't call shadow_prealloc()
@@ -1132,7 +1129,7 @@ mfn_t shadow_alloc(struct domain *d,
         printk(XENLOG_ERR "Can't allocate %u shadow pages!\n", pages);
         BUG();
     }
-    d->arch.paging.shadow.free_pages -= pages;
+    d->arch.paging.free_pages -= pages;
 
     /* Backpointers that are MFNs need to be packed into PDXs (PFNs don't) */
     switch (shadow_type)
@@ -1153,7 +1150,7 @@ mfn_t shadow_alloc(struct domain *d,
     /* Init page info fields and clear the pages */
     for ( i = 0; i < pages ; i++ )
     {
-        sp = page_list_remove_head(&d->arch.paging.shadow.freelist);
+        sp = page_list_remove_head(&d->arch.paging.freelist);
         /* Before we overwrite the old contents of this page,
          * we need to be sure that no TLB holds a pointer to it. */
         cpumask_copy(&mask, d->dirty_cpumask);
@@ -1249,15 +1246,15 @@ void shadow_free(struct domain *d, mfn_t smfn)
             free_domheap_page(sp);
         }
         else
-            page_list_add_tail(sp, &d->arch.paging.shadow.freelist);
+            page_list_add_tail(sp, &d->arch.paging.freelist);
 
         sp = next;
     }
 
     if ( unlikely(dying) )
-        d->arch.paging.shadow.total_pages -= pages;
+        d->arch.paging.total_pages -= pages;
     else
-        d->arch.paging.shadow.free_pages += pages;
+        d->arch.paging.free_pages += pages;
 }
 
 /* Divert a page from the pool to be used by the p2m mapping.
@@ -1276,7 +1273,7 @@ shadow_alloc_p2m_page(struct domain *d)
      * paging lock) and the log-dirty code (which always does). */
     paging_lock_recursive(d);
 
-    if ( d->arch.paging.shadow.total_pages
+    if ( d->arch.paging.total_pages
          < shadow_min_acceptable_pages(d) + 1 )
     {
         if ( !d->arch.paging.p2m_alloc_failed )
@@ -1284,8 +1281,8 @@ shadow_alloc_p2m_page(struct domain *d)
             d->arch.paging.p2m_alloc_failed = 1;
             dprintk(XENLOG_ERR,
                     "d%d failed to allocate from shadow pool (tot=%u p2m=%u min=%u)\n",
-                    d->domain_id, d->arch.paging.shadow.total_pages,
-                    d->arch.paging.shadow.p2m_pages,
+                    d->domain_id, d->arch.paging.total_pages,
+                    d->arch.paging.p2m_pages,
                     shadow_min_acceptable_pages(d));
         }
         goto out;
@@ -1295,8 +1292,8 @@ shadow_alloc_p2m_page(struct domain *d)
         goto out;
 
     pg = mfn_to_page(shadow_alloc(d, SH_type_p2m_table, 0));
-    d->arch.paging.shadow.p2m_pages++;
-    d->arch.paging.shadow.total_pages--;
+    d->arch.paging.p2m_pages++;
+    d->arch.paging.total_pages--;
     ASSERT(!page_get_owner(pg) && !(pg->count_info & PGC_count_mask));
 
  out:
@@ -1327,8 +1324,8 @@ shadow_free_p2m_page(struct domain *d, struct page_info *pg)
      * paging lock) and the log-dirty code (which always does). */
     paging_lock_recursive(d);
 
-    d->arch.paging.shadow.p2m_pages--;
-    d->arch.paging.shadow.total_pages++;
+    d->arch.paging.p2m_pages--;
+    d->arch.paging.total_pages++;
     shadow_free(d, page_to_mfn(pg));
 
     paging_unlock(d);
@@ -1345,7 +1342,7 @@ static unsigned int sh_min_allocation(const struct domain *d)
            max(max(domain_tot_pages(d) / 256,
                    is_hvm_domain(d) ? CONFIG_PAGING_LEVELS + 2 : 0U) +
                is_hvm_domain(d),
-               d->arch.paging.shadow.p2m_pages);
+               d->arch.paging.p2m_pages);
 }
 
 int shadow_set_allocation(struct domain *d, unsigned int pages, bool *preempted)
@@ -1361,15 +1358,15 @@ int shadow_set_allocation(struct domain *d, unsigned int pages, bool *preempted)
 
         if ( pages < lower_bound )
             pages = lower_bound;
-        pages -= d->arch.paging.shadow.p2m_pages;
+        pages -= d->arch.paging.p2m_pages;
     }
 
     SHADOW_PRINTK("current %i target %i\n",
-                   d->arch.paging.shadow.total_pages, pages);
+                   d->arch.paging.total_pages, pages);
 
     for ( ; ; )
     {
-        if ( d->arch.paging.shadow.total_pages < pages )
+        if ( d->arch.paging.total_pages < pages )
         {
             /* Need to allocate more memory from domheap */
             sp = (struct page_info *)
@@ -1379,29 +1376,29 @@ int shadow_set_allocation(struct domain *d, unsigned int pages, bool *preempted)
                 SHADOW_PRINTK("failed to allocate shadow pages.\n");
                 return -ENOMEM;
             }
-            d->arch.paging.shadow.free_pages++;
-            d->arch.paging.shadow.total_pages++;
+            d->arch.paging.free_pages++;
+            d->arch.paging.total_pages++;
             sp->u.sh.type = 0;
             sp->u.sh.pinned = 0;
             sp->u.sh.count = 0;
             sp->tlbflush_timestamp = 0; /* Not in any TLB */
-            page_list_add_tail(sp, &d->arch.paging.shadow.freelist);
+            page_list_add_tail(sp, &d->arch.paging.freelist);
         }
-        else if ( d->arch.paging.shadow.total_pages > pages )
+        else if ( d->arch.paging.total_pages > pages )
         {
             /* Need to return memory to domheap */
             if ( !_shadow_prealloc(d, 1) )
                 return -ENOMEM;
 
-            sp = page_list_remove_head(&d->arch.paging.shadow.freelist);
+            sp = page_list_remove_head(&d->arch.paging.freelist);
             ASSERT(sp);
             /*
              * The pages were allocated anonymously, but the owner field
              * gets overwritten normally, so need to clear it here.
              */
             page_set_owner(sp, NULL);
-            d->arch.paging.shadow.free_pages--;
-            d->arch.paging.shadow.total_pages--;
+            d->arch.paging.free_pages--;
+            d->arch.paging.total_pages--;
             free_domheap_page(sp);
         }
         else
@@ -1421,23 +1418,12 @@ int shadow_set_allocation(struct domain *d, unsigned int pages, bool *preempted)
 /* Return the size of the shadow pool, rounded up to the nearest MB */
 static unsigned int shadow_get_allocation(struct domain *d)
 {
-    unsigned int pg = d->arch.paging.shadow.total_pages
-        + d->arch.paging.shadow.p2m_pages;
+    unsigned int pg = d->arch.paging.total_pages
+        + d->arch.paging.p2m_pages;
     return ((pg >> (20 - PAGE_SHIFT))
             + ((pg & ((1 << (20 - PAGE_SHIFT)) - 1)) ? 1 : 0));
 }
 
-int shadow_get_allocation_bytes(struct domain *d, uint64_t *size)
-{
-    unsigned long pages = d->arch.paging.shadow.total_pages;
-
-    pages += d->arch.paging.shadow.p2m_pages;
-
-    *size = pages << PAGE_SHIFT;
-
-    return 0;
-}
-
 /**************************************************************************/
 /* Hash table for storing the guest->shadow mappings.
  * The table itself is an array of pointers to shadows; the shadows are then
@@ -2708,7 +2694,7 @@ int shadow_enable(struct domain *d, u32 mode)
     }
 
     /* Init the shadow memory allocation if the user hasn't done so */
-    old_pages = d->arch.paging.shadow.total_pages;
+    old_pages = d->arch.paging.total_pages;
     if ( old_pages < sh_min_allocation(d) )
     {
         paging_lock(d);
@@ -2888,7 +2874,7 @@ void shadow_teardown(struct domain *d, bool *preempted)
     }
 #endif /* (SHADOW_OPTIMIZATIONS & (SHOPT_VIRTUAL_TLB|SHOPT_OUT_OF_SYNC)) */
 
-    if ( d->arch.paging.shadow.total_pages != 0 )
+    if ( d->arch.paging.total_pages != 0 )
     {
         /* Destroy all the shadows and release memory to domheap */
         shadow_set_allocation(d, 0, preempted);
@@ -2900,7 +2886,7 @@ void shadow_teardown(struct domain *d, bool *preempted)
         if (d->arch.paging.shadow.hash_table)
             shadow_hash_teardown(d);
 
-        ASSERT(d->arch.paging.shadow.total_pages == 0);
+        ASSERT(d->arch.paging.total_pages == 0);
     }
 
     /* Free the non-paged-vcpus pagetable; must happen after we've
@@ -2959,15 +2945,13 @@ void shadow_final_teardown(struct domain *d)
 {
     SHADOW_PRINTK("dom %u final teardown starts."
                    "  Shadow pages total = %u, free = %u, p2m=%u\n",
-                   d->domain_id,
-                   d->arch.paging.shadow.total_pages,
-                   d->arch.paging.shadow.free_pages,
-                   d->arch.paging.shadow.p2m_pages);
+                   d->domain_id, d->arch.paging.total_pages,
+                   d->arch.paging.free_pages, d->arch.paging.p2m_pages);
 
     /* Double-check that the domain didn't have any shadow memory.
      * It is possible for a domain that never got domain_kill()ed
      * to get here with its shadow allocation intact. */
-    if ( d->arch.paging.shadow.total_pages != 0 )
+    if ( d->arch.paging.total_pages != 0 )
         shadow_teardown(d, NULL);
 
     /* It is now safe to pull down the p2m map. */
@@ -2977,13 +2961,11 @@ void shadow_final_teardown(struct domain *d)
     shadow_set_allocation(d, 0, NULL);
     SHADOW_PRINTK("dom %u final teardown done."
                    "  Shadow pages total = %u, free = %u, p2m=%u\n",
-                   d->domain_id,
-                   d->arch.paging.shadow.total_pages,
-                   d->arch.paging.shadow.free_pages,
-                   d->arch.paging.shadow.p2m_pages);
-    ASSERT(!d->arch.paging.shadow.total_pages);
-    ASSERT(!d->arch.paging.shadow.free_pages);
-    ASSERT(!d->arch.paging.shadow.p2m_pages);
+                   d->domain_id, d->arch.paging.total_pages,
+                   d->arch.paging.free_pages, d->arch.paging.p2m_pages);
+    ASSERT(d->arch.paging.p2m_pages == 0);
+    ASSERT(d->arch.paging.free_pages == 0);
+    ASSERT(d->arch.paging.total_pages == 0);
     paging_unlock(d);
 }
 
@@ -3000,7 +2982,7 @@ static int shadow_one_bit_enable(struct domain *d, u32 mode)
 
     mode |= PG_SH_enable;
 
-    if ( d->arch.paging.shadow.total_pages < sh_min_allocation(d) )
+    if ( d->arch.paging.total_pages < sh_min_allocation(d) )
     {
         /* Init the shadow memory allocation if the user hasn't done so */
         if ( shadow_set_allocation(d, 1, NULL) != 0 )
@@ -3049,10 +3031,8 @@ static int shadow_one_bit_disable(struct domain *d, u32 mode)
         /* Get this domain off shadows */
         SHADOW_PRINTK("un-shadowing of domain %u starts."
                        "  Shadow pages total = %u, free = %u, p2m=%u\n",
-                       d->domain_id,
-                       d->arch.paging.shadow.total_pages,
-                       d->arch.paging.shadow.free_pages,
-                       d->arch.paging.shadow.p2m_pages);
+                       d->domain_id, d->arch.paging.total_pages,
+                       d->arch.paging.free_pages, d->arch.paging.p2m_pages);
         for_each_vcpu(d, v)
         {
             if ( v->arch.paging.mode )
@@ -3082,10 +3062,8 @@ static int shadow_one_bit_disable(struct domain *d, u32 mode)
         shadow_hash_teardown(d);
         SHADOW_PRINTK("un-shadowing of domain %u done."
                        "  Shadow pages total = %u, free = %u, p2m=%u\n",
-                       d->domain_id,
-                       d->arch.paging.shadow.total_pages,
-                       d->arch.paging.shadow.free_pages,
-                       d->arch.paging.shadow.p2m_pages);
+                       d->domain_id, d->arch.paging.total_pages,
+                       d->arch.paging.free_pages, d->arch.paging.p2m_pages);
     }
 
     return 0;
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 29a58d9131..88c3c16322 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -809,7 +809,7 @@ static void cf_check sh_unshadow_for_p2m_change(
      * If there are any shadows, update them.  But if shadow_teardown()
      * has already been called then it's not safe to try.
      */
-    if ( unlikely(!d->arch.paging.shadow.total_pages) )
+    if ( unlikely(!d->arch.paging.total_pages) )
         return;
 
     /* Only previously present / valid entries need processing. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:15:36 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:15:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469138.728471 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95JI-0001pG-7R; Sat, 24 Dec 2022 14:15:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469138.728471; Sat, 24 Dec 2022 14:15: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 1p95JI-0001p8-4W; Sat, 24 Dec 2022 14:15:36 +0000
Received: by outflank-mailman (input) for mailman id 469138;
 Sat, 24 Dec 2022 14:15:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95JH-0001p0-8d
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95JH-00085f-7v
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95JH-0002uZ-78
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v5Nv9Y7j4kxyKc+1LPfdTYB5ga57J3ng1aPI/J10UVk=; b=uzodxEjlS19+QLcnO2hWjkk3U9
	3RFJ9KdIZMoiiobbfu1L3+zRiVf+jBM8Ge/bDs2xNvrRCv019j3p4zg3dRVbFoWdsOULY+kMcXebB
	RElvLWiXvdT9Jw3+AfahBXKfhBv2wb+APQHHJiFW8mFnPaeYT1g3Omwf9fn59nZlOSy4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PV: drop dead paging_update_paging_modes() call during Dom0 construction
Message-Id: <E1p95JH-0002uZ-78@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:15:35 +0000

commit f90a265f5b6a10f558294e4d33642868fdabc416
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Dec 22 10:06:57 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 22 10:06:57 2022 +0100

    x86/PV: drop dead paging_update_paging_modes() call during Dom0 construction
    
    The function won't ever be invoked, as paging_mode_enabled() always
    returns false here due to the immediately preceding clearing of
    d->arch.paging.mode. While compilers recognize this and eliminate the
    call, make this explicit in the source (which likely 9a28170f2da2 ["pvh
    dom0: construct_dom0 changes"] should have done right away, albeit even
    before that the call looks to have been pointless - shadow mode enabling
    has occurred later virtually forever).
    
    While there also update an adjacent partly stale comment.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/pv/dom0_build.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index a62f0fa2ef..a26832ad5d 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -10,7 +10,6 @@
 #include <xen/init.h>
 #include <xen/libelf.h>
 #include <xen/multiboot.h>
-#include <xen/paging.h>
 #include <xen/pfn.h>
 #include <xen/sched.h>
 #include <xen/softirq.h>
@@ -804,11 +803,8 @@ int __init dom0_construct_pv(struct domain *d,
 
     d->arch.paging.mode = 0;
 
-    /* Set up CR3 value for write_ptbase */
-    if ( paging_mode_enabled(d) )
-        paging_update_paging_modes(v);
-    else
-        update_cr3(v);
+    /* Set up CR3 value for switch_cr3_cr4(). */
+    update_cr3(v);
 
     /* We run on dom0's page tables for the final part of the build process. */
     switch_cr3_cr4(cr3_pa(v->arch.cr3), read_cr4());
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:15:46 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:15:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469139.728475 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95JS-0001sJ-8b; Sat, 24 Dec 2022 14:15:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469139.728475; Sat, 24 Dec 2022 14:15: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 1p95JS-0001sC-61; Sat, 24 Dec 2022 14:15:46 +0000
Received: by outflank-mailman (input) for mailman id 469139;
 Sat, 24 Dec 2022 14:15:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95JR-0001s0-Bh
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95JR-00085y-B4
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95JR-0002v3-AL
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vThh4FPj50hgTYTckGszOGY3jebMCLKLFVpGswJwUQk=; b=BEoGFe/GbGw2yvOTd4j9v96pNV
	mjcVscFcwFtC1zWqukg0UnBZbx4hfwuDI58Ops7+0bJZHTvzA3fB8vg+ezfvwjxryl9yBdAlljGKS
	3JaJtdLaKirl4XH9/30D31Mz15lPq08SkCF8OnNHvFXY+TItDrpVEiyr/xWcwfUXmPbs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: adjust and move sh_type_to_size[]
Message-Id: <E1p95JR-0002v3-AL@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:15:45 +0000

commit 4fec945409fcd52f5d95a66a2087920816b77854
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Dec 22 10:07:50 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 22 10:07:50 2022 +0100

    x86/shadow: adjust and move sh_type_to_size[]
    
    Drop the SH_type_none entry - there are no allocation attempts with
    this type, and there also shouldn't be any. Adjust the shadow_size()
    alternative path to match that change. Also generalize two related
    assertions.
    
    While there move the entire table and the respective part of the comment
    there to hvm.c, resulting in one less #ifdef. In the course of the
    movement switch to using designated initializers.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c  | 37 ++-----------------------------------
 xen/arch/x86/mm/shadow/hvm.c     | 31 +++++++++++++++++++++++++++++++
 xen/arch/x86/mm/shadow/private.h |  2 +-
 3 files changed, 34 insertions(+), 36 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 16a5a2bcf8..b0ef574890 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -833,44 +833,11 @@ sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size)
  * not contiguous in memory; functions for handling offsets into them are
  * defined in shadow/multi.c (shadow_l1_index() etc.)
  *
- * This table shows the allocation behaviour of the different modes:
- *
- * Xen paging      64b  64b  64b
- * Guest paging    32b  pae  64b
- * PV or HVM       HVM  HVM   *
- * Shadow paging   pae  pae  64b
- *
- * sl1 size         8k   4k   4k
- * sl2 size        16k   4k   4k
- * sl3 size         -    -    4k
- * sl4 size         -    -    4k
- *
  * In HVM guests, the p2m table is built out of shadow pages, and we provide
  * a function for the p2m management to steal pages, in max-order chunks, from
  * the free pool.
  */
 
-#ifdef CONFIG_HVM
-const u8 sh_type_to_size[] = {
-    1, /* SH_type_none           */
-    2, /* SH_type_l1_32_shadow   */
-    2, /* SH_type_fl1_32_shadow  */
-    4, /* SH_type_l2_32_shadow   */
-    1, /* SH_type_l1_pae_shadow  */
-    1, /* SH_type_fl1_pae_shadow */
-    1, /* SH_type_l2_pae_shadow  */
-    1, /* SH_type_l1_64_shadow   */
-    1, /* SH_type_fl1_64_shadow  */
-    1, /* SH_type_l2_64_shadow   */
-    1, /* SH_type_l2h_64_shadow  */
-    1, /* SH_type_l3_64_shadow   */
-    1, /* SH_type_l4_64_shadow   */
-    1, /* SH_type_p2m_table      */
-    1, /* SH_type_monitor_table  */
-    1  /* SH_type_oos_snapshot   */
-};
-#endif
-
 /*
  * Figure out the least acceptable quantity of shadow memory.
  * The minimum memory requirement for always being able to free up a
@@ -1116,7 +1083,7 @@ mfn_t shadow_alloc(struct domain *d,
     unsigned int i;
 
     ASSERT(paging_locked_by_me(d));
-    ASSERT(shadow_type != SH_type_none);
+    ASSERT(pages);
     perfc_incr(shadow_alloc);
 
     if ( d->arch.paging.free_pages < pages )
@@ -1196,9 +1163,9 @@ void shadow_free(struct domain *d, mfn_t smfn)
     perfc_incr(shadow_free);
 
     shadow_type = sp->u.sh.type;
-    ASSERT(shadow_type != SH_type_none);
     ASSERT(sp->u.sh.head || (shadow_type > SH_type_max_shadow));
     pages = shadow_size(shadow_type);
+    ASSERT(pages);
     pin_list = &d->arch.paging.shadow.pinned_shadows;
 
     for ( i = 0; i < pages; i++ )
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 88c3c16322..f14fc42eab 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -33,6 +33,37 @@
 
 #include "private.h"
 
+/*
+ * This table shows the allocation behaviour of the different modes:
+ *
+ * Xen paging      64b  64b  64b
+ * Guest paging    32b  pae  64b
+ * PV or HVM       HVM  HVM   *
+ * Shadow paging   pae  pae  64b
+ *
+ * sl1 size         8k   4k   4k
+ * sl2 size        16k   4k   4k
+ * sl3 size         -    -    4k
+ * sl4 size         -    -    4k
+ */
+const uint8_t sh_type_to_size[] = {
+    [SH_type_l1_32_shadow]   = 2,
+    [SH_type_fl1_32_shadow]  = 2,
+    [SH_type_l2_32_shadow]   = 4,
+    [SH_type_l1_pae_shadow]  = 1,
+    [SH_type_fl1_pae_shadow] = 1,
+    [SH_type_l2_pae_shadow]  = 1,
+    [SH_type_l1_64_shadow]   = 1,
+    [SH_type_fl1_64_shadow]  = 1,
+    [SH_type_l2_64_shadow]   = 1,
+    [SH_type_l2h_64_shadow]  = 1,
+    [SH_type_l3_64_shadow]   = 1,
+    [SH_type_l4_64_shadow]   = 1,
+    [SH_type_p2m_table]      = 1,
+    [SH_type_monitor_table]  = 1,
+    [SH_type_oos_snapshot]   = 1,
+};
+
 /**************************************************************************/
 /* x86 emulator support for the shadow code
  */
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index b8a62ec1ff..2c2c18985d 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -363,7 +363,7 @@ shadow_size(unsigned int shadow_type)
     return sh_type_to_size[shadow_type];
 #else
     ASSERT(shadow_type < SH_type_unused);
-    return 1;
+    return shadow_type != SH_type_none;
 #endif
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:15:56 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:15:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469140.728479 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Jc-0001ur-AN; Sat, 24 Dec 2022 14:15:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469140.728479; Sat, 24 Dec 2022 14:15: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 1p95Jc-0001uk-7o; Sat, 24 Dec 2022 14:15:56 +0000
Received: by outflank-mailman (input) for mailman id 469140;
 Sat, 24 Dec 2022 14:15:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Jb-0001ue-FZ
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Jb-000869-Ep
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Jb-0002vV-DH
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:15: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S1DCT6oSygxe34gmCxkbcJ5slFraFo6p7oRS+ehGeIo=; b=h7jv3JSNcyJEE1FAMObNisCW2Z
	5hM4PGhSUMVWHdasacL6MmDyR0vc4/NzoydoHJT08IR3XzhmuklDWLa9wMoIamQwX5znW3I7tVyaR
	2EZJGqpy9XNYn2sY1Gi3YeeAvnhp45OwbxYPaagQIUOKhknUlmm9vcXY0wAu8p23oOlc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: don't open-code copy_domain_page()
Message-Id: <E1p95Jb-0002vV-DH@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:15:55 +0000

commit 43b5d7b14c569e2deaf6a2863cfa44351061ad80
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Dec 22 10:08:31 2022 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 22 10:08:31 2022 +0100

    x86/shadow: don't open-code copy_domain_page()
    
    Let's use the library-like function that we have.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index b0ef574890..e1db6cf890 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -450,7 +450,6 @@ static void _sh_resync(struct vcpu *v, mfn_t gmfn,
 static void oos_hash_add(struct vcpu *v, mfn_t gmfn)
 {
     int i, idx, oidx, swap = 0;
-    void *gptr, *gsnpptr;
     mfn_t *oos = v->arch.paging.shadow.oos;
     mfn_t *oos_snapshot = v->arch.paging.shadow.oos_snapshot;
     struct oos_fixup *oos_fixup = v->arch.paging.shadow.oos_fixup;
@@ -483,11 +482,7 @@ static void oos_hash_add(struct vcpu *v, mfn_t gmfn)
     if ( swap )
         SWAP(oos_snapshot[idx], oos_snapshot[oidx]);
 
-    gptr = map_domain_page(oos[oidx]);
-    gsnpptr = map_domain_page(oos_snapshot[oidx]);
-    memcpy(gsnpptr, gptr, PAGE_SIZE);
-    unmap_domain_page(gptr);
-    unmap_domain_page(gsnpptr);
+    copy_domain_page(oos_snapshot[oidx], oos[oidx]);
 }
 
 /* Remove an MFN from the list of out-of-sync guest pagetables */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:16:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:16:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469141.728483 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Jm-0001y1-CM; Sat, 24 Dec 2022 14:16:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469141.728483; Sat, 24 Dec 2022 14:16: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 1p95Jm-0001xt-9d; Sat, 24 Dec 2022 14:16:06 +0000
Received: by outflank-mailman (input) for mailman id 469141;
 Sat, 24 Dec 2022 14:16:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Jl-0001xg-Ie
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:16:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Jl-00086X-Hz
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:16:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Jl-0002w9-H5
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:16: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xVWhR5N0LdUqF8/Jb87jBTTtGtj0mvXf1qG05CNfT4g=; b=sc58aYr9pqygHHO3UW6vujkDYS
	EyxVGxDB2xAxnLHl/C482iIZ4dfpbiAMUH+ETFkXOyekIIKZNuKYEYrScssbX4sXPvmk1Sb9m+ymm
	hgGa4+ppzokKsgDHphTsSaRrEVDY1WMgwD3tJOhIKWADH8IGVwkkssz+oMvx8v6CaSeU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/common: page_alloc: Re-order includes
Message-Id: <E1p95Jl-0002w9-H5@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:16:05 +0000

commit 03697629bc1d05742098038bf3e93f519b0a7711
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Dec 23 09:26:36 2022 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 23 09:27:03 2022 +0000

    xen/common: page_alloc: Re-order includes
    
    Order the includes with the xen headers first, then asm headers and
    last public headers. Within each category, they are sorted alphabetically.
    
    Note that the includes in protected by CONFIG_X86 hasn't been sorted
    to avoid adding multiple #ifdef.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/page_alloc.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 2b39a2a42f..e40473f71e 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -120,27 +120,30 @@
  *   regions within it.
  */
 
+#include <xen/domain_page.h>
+#include <xen/event.h>
 #include <xen/init.h>
-#include <xen/types.h>
+#include <xen/irq.h>
+#include <xen/keyhandler.h>
 #include <xen/lib.h>
-#include <xen/sched.h>
-#include <xen/spinlock.h>
 #include <xen/mm.h>
+#include <xen/nodemask.h>
+#include <xen/numa.h>
 #include <xen/param.h>
-#include <xen/irq.h>
-#include <xen/softirq.h>
-#include <xen/domain_page.h>
-#include <xen/keyhandler.h>
 #include <xen/perfc.h>
 #include <xen/pfn.h>
-#include <xen/numa.h>
-#include <xen/nodemask.h>
-#include <xen/event.h>
+#include <xen/types.h>
+#include <xen/sched.h>
+#include <xen/softirq.h>
+#include <xen/spinlock.h>
+
+#include <asm/flushtlb.h>
+#include <asm/numa.h>
+#include <asm/page.h>
+
 #include <public/sysctl.h>
 #include <public/sched.h>
-#include <asm/page.h>
-#include <asm/numa.h>
-#include <asm/flushtlb.h>
+
 #ifdef CONFIG_X86
 #include <asm/guest.h>
 #include <asm/p2m.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:16:18 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:16:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469142.728488 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95Jw-00020i-EX; Sat, 24 Dec 2022 14:16:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469142.728488; Sat, 24 Dec 2022 14:16: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 1p95Jw-00020a-BD; Sat, 24 Dec 2022 14:16:16 +0000
Received: by outflank-mailman (input) for mailman id 469142;
 Sat, 24 Dec 2022 14:16:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Jv-00020S-La
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:16:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Jv-00086m-Ks
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:16:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95Jv-0002wa-KA
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:16: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CUEafUpJmOQ0yEOkjsuN5hJCnHfHrs3IZo3aUE4OybQ=; b=H7EXDmmzMwd02HOoRxPRMS2tjh
	p7+PwCmO0J+wrJkEjZgUO2NRxfkC13/51rsq1N4rqZ0/egjrvd8rZjafhx+F1VhIrlSnIeFZa5/YQ
	hCW1gp1qi0p/f3drwq91lrGunSPYw6LJj4985N23y20C4lnuFnxseBxVs3/BS5qMVb24=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: vpl011: emulate non-SBSA registers as WI/RAZ
Message-Id: <E1p95Jv-0002wa-KA@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:16:15 +0000

commit b8d5ea6de0f8dabe4f88379398d44f1f148ac807
Author:     Jiamei Xie <jiamei.xie@arm.com>
AuthorDate: Mon Dec 5 15:26:39 2022 +0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 23 17:55:02 2022 +0000

    xen/arm: vpl011: emulate non-SBSA registers as WI/RAZ
    
    When the guest kernel enables DMA engine with "CONFIG_DMA_ENGINE=y",
    Linux SBSA PL011 driver will access PL011 DMACR register in some
    functions. As chapter "B Generic UART" in "ARM Server Base System
    Architecture"[1] documentation describes, SBSA UART doesn't support
    DMA. In current code, when the kernel tries to access DMACR register,
    Xen will inject a data abort:
    Unhandled fault at 0xffffffc00944d048
    Mem abort info:
      ESR = 0x96000000
      EC = 0x25: DABT (current EL), IL = 32 bits
      SET = 0, FnV = 0
      EA = 0, S1PTW = 0
      FSC = 0x00: ttbr address size fault
    Data abort info:
      ISV = 0, ISS = 0x00000000
      CM = 0, WnR = 0
    swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000020e2e000
    [ffffffc00944d048] pgd=100000003ffff803, p4d=100000003ffff803, pud=100000003ffff803, pmd=100000003fffa803, pte=006800009c090f13
    Internal error: ttbr address size fault: 96000000 [#1] PREEMPT SMP
    ...
    Call trace:
     pl011_stop_rx+0x70/0x80
     tty_port_shutdown+0x7c/0xb4
     tty_port_close+0x60/0xcc
     uart_close+0x34/0x8c
     tty_release+0x144/0x4c0
     __fput+0x78/0x220
     ____fput+0x1c/0x30
     task_work_run+0x88/0xc0
     do_notify_resume+0x8d0/0x123c
     el0_svc+0xa8/0xc0
     el0t_64_sync_handler+0xa4/0x130
     el0t_64_sync+0x1a0/0x1a4
    Code: b9000083 b901f001 794038a0 8b000042 (b9000041)
    ---[ end trace 83dd93df15c3216f ]---
    note: bootlogd[132] exited with preempt_count 1
    /etc/rcS.d/S07bootlogd: line 47: 132 Segmentation fault start-stop-daemon
    
    As discussed in [2], this commit makes the access to non-SBSA registers
    RAZ/WI as an improvement.
    
    [1] https://developer.arm.com/documentation/den0094/c/?lang=en
    [2] https://lore.kernel.org/xen-devel/alpine.DEB.2.22.394.2211161552420.4020@ubuntu-linux-20-04-desktop/
    
    Signed-off-by: Jiamei Xie <jiamei.xie@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/vpl011.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index f6144da1d7..c5b695469b 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -403,11 +403,15 @@ static int vpl011_mmio_read(struct vcpu *v,
     default:
         gprintk(XENLOG_ERR, "vpl011: unhandled read r%d offset %#08x\n",
                 dabt.reg, vpl011_reg);
-        return 0;
+        goto read_as_zero;
     }
 
     return 1;
 
+read_as_zero:
+    *r = 0;
+    return 1;
+
 bad_width:
     gprintk(XENLOG_ERR, "vpl011: bad read width %d r%d offset %#08x\n",
             dabt.size, dabt.reg, vpl011_reg);
@@ -475,7 +479,7 @@ static int vpl011_mmio_write(struct vcpu *v,
     default:
         gprintk(XENLOG_ERR, "vpl011: unhandled write r%d offset %#08x\n",
                 dabt.reg, vpl011_reg);
-        return 0;
+        goto write_ignore;
     }
 
 write_ignore:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 24 14:16:26 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Dec 2022 14:16:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469143.728491 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1p95K6-00023G-FY; Sat, 24 Dec 2022 14:16:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469143.728491; Sat, 24 Dec 2022 14:16: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 1p95K6-000238-Cj; Sat, 24 Dec 2022 14:16:26 +0000
Received: by outflank-mailman (input) for mailman id 469143;
 Sat, 24 Dec 2022 14:16:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95K5-00022y-OM
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:16:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95K5-0008Jb-Ne
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:16:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1p95K5-0002x3-N1
 for xen-changelog@lists.xenproject.org; Sat, 24 Dec 2022 14:16: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9SBVGrlyl8kFKnASx3BPt1VVWBo6yyP2PwhionMXwS0=; b=s1hgWosCHUxUGx3nMMRJ/bcwT1
	OcIbRdTH1CBqH2UPHRhfuB5F/e6Q535Lg8SFN+zfNL2rQWisVq/IMjO44BN/nTl7P/pqxnNkmK5cS
	ahaAVUGqDA0s+9R5LnoQzJMsXI62W+p/BDgB/EcQ0L7LHx1QBCUAsLArAqsVQ1r1SInw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: vpl011: add ASSERT_UNREACHABLE in vpl011_mmio_read
Message-Id: <E1p95K5-0002x3-N1@xenbits.xenproject.org>
Date: Sat, 24 Dec 2022 14:16:25 +0000

commit 84ece04e7f11fe30c2f83753d72f481610357ed0
Author:     Jiamei Xie <jiamei.xie@arm.com>
AuthorDate: Mon Dec 5 15:26:40 2022 +0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 23 17:55:02 2022 +0000

    xen/arm: vpl011: add ASSERT_UNREACHABLE in vpl011_mmio_read
    
    In vpl011_mmio_read switch block, all cases should have a return. Add
    ASSERT_UNREACHABLE to catch case where the return is not added.
    
    Signed-off-by: Jiamei Xie <jiamei.xie@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/vpl011.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index c5b695469b..541ec962f1 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -406,6 +406,7 @@ static int vpl011_mmio_read(struct vcpu *v,
         goto read_as_zero;
     }
 
+    ASSERT_UNREACHABLE();
     return 1;
 
 read_as_zero:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 29 07:33:06 2022
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Dec 2022 07:33:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.469633.729016 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pAnPS-0005Lj-A0; Thu, 29 Dec 2022 07:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 469633.729016; Thu, 29 Dec 2022 07:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pAnPS-0005Lb-7G; Thu, 29 Dec 2022 07:33:02 +0000
Received: by outflank-mailman (input) for mailman id 469633;
 Thu, 29 Dec 2022 07:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pAnPR-0005LT-Ao
 for xen-changelog@lists.xenproject.org; Thu, 29 Dec 2022 07:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pAnPR-0007NA-A3
 for xen-changelog@lists.xenproject.org; Thu, 29 Dec 2022 07:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pAnPR-0003SZ-94
 for xen-changelog@lists.xenproject.org; Thu, 29 Dec 2022 07:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t3U/n+GMWj+uE6XmlvNvHMW0kNRl8Sw4dRpDAK70neQ=; b=taN44ERoiGUEt8NQosCbU50nJ5
	j5mdvOMyfFZ8+ONs+ziwugtqYcZWf+KpxdUsxCSn8uHqyoXGxgSe+z311ukObDJD3Y4cTf7KwlrrA
	DibIrueZFqTKwsGUY469dDwl4caWhTPUWs8Cs1ueIEybUX3QxypgfaVQnrC5AtHQwdos=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: Introduce asm/page-bits.h
Message-Id: <E1pAnPR-0003SZ-94@xenbits.xenproject.org>
Date: Thu, 29 Dec 2022 07:33:01 +0000

commit 7eef80e06ed2282bbcec3619d860c6aacb0515d8
Author:     Alistair Francis <alistair.francis@wdc.com>
AuthorDate: Wed Dec 28 15:20:18 2022 +1000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Dec 28 18:32:35 2022 +0000

    xen/riscv: Introduce asm/page-bits.h
    
    Define PADDR_BITS and PAGE_SHIFT for the RISC-V 64-bit architecture.
    
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/riscv/include/asm/page-bits.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/riscv/include/asm/page-bits.h b/xen/arch/riscv/include/asm/page-bits.h
new file mode 100644
index 0000000000..1801820294
--- /dev/null
+++ b/xen/arch/riscv/include/asm/page-bits.h
@@ -0,0 +1,7 @@
+#ifndef __RISCV_PAGE_BITS_H__
+#define __RISCV_PAGE_BITS_H__
+
+#define PAGE_SHIFT              12 /* 4 KiB Pages */
+#define PADDR_BITS              56 /* 44-bit PPN */
+
+#endif /* __RISCV_PAGE_BITS_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


